Carded notifications

pull/2/head
Mark McDowall 12 years ago
parent 3d2a47627f
commit 195f9d9d27

@ -9,6 +9,7 @@
@import "backgrid/backgrid"; @import "backgrid/backgrid";
@import "../shared/styles/clickable"; @import "../shared/styles/clickable";
@import "prefixer"; @import "prefixer";
@import "icons";
.progress { .progress {
width : 125px; width : 125px;

@ -0,0 +1,55 @@
@import "FontAwesome/font-awesome.less";
@import "Bootstrap/variables";
/* Icon rotations and mirroring */
.icon-rotate-90() {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
}
.icon-rotate-180() {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
}
.icon-rotate-270() {
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
.icon-flip-horizontal() {
-webkit-transform: scale(-1, 1);
-moz-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
-o-transform: scale(-1, 1);
transform: scale(-1, 1);
}
.icon-flip-vertical() {
-webkit-transform: scale(1, -1);
-moz-transform: scale(1, -1);
-ms-transform: scale(1, -1);
-o-transform: scale(1, -1);
transform: scale(1, -1);
}
.icon-nd-edit:before {
.icon(@wrench);
}
.icon-nd-delete:before {
.icon(@remove);
color: @errorText;
}

@ -3,7 +3,7 @@
<h3>Add Notification</h3> <h3>Add Notification</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="notifications"> <div class="add-notifications">
<ul class="items"></ul> <ul class="items"></ul>
</div> </div>
</div> </div>

@ -7,7 +7,7 @@ define([
return Marionette.CompositeView.extend({ return Marionette.CompositeView.extend({
itemView : AddItemView, itemView : AddItemView,
itemViewContainer: '.notifications .items', itemViewContainer: '.add-notifications .items',
template : 'Settings/Notifications/AddTemplate', template : 'Settings/Notifications/AddTemplate',
itemViewOptions: function () { itemViewOptions: function () {

@ -1,14 +1,10 @@
<table class="table table-hover"> <div class="row">
<thead> <div class="span12">
<tr> <button class="btn btn-success x-add">Add Notification</button>
<th>Name</th> </div>
<th>Type</th> </div>
<th>On Grab</th> <div class="row">
<th>On Download</th> <div class="span12">
<th>Controls</th> <ul class="notifications"></ul>
</tr> </div>
</thead> </div>
<tbody></tbody>
</table>
<button class="btn btn-success x-add">Add</button>

@ -8,14 +8,14 @@ define([
], function (App, Marionette, NotificationCollection, NotificationItemView, AddSelectionNotificationView) { ], function (App, Marionette, NotificationCollection, NotificationItemView, AddSelectionNotificationView) {
return Marionette.CompositeView.extend({ return Marionette.CompositeView.extend({
itemView : NotificationItemView, itemView : NotificationItemView,
itemViewContainer: 'tbody', itemViewContainer: '.notifications',
template : 'Settings/Notifications/CollectionTemplate', template : 'Settings/Notifications/CollectionTemplate',
events: { events: {
'click .x-add': 'openSchemaModal' 'click .x-add': '_openSchemaModal'
}, },
openSchemaModal: function () { _openSchemaModal: function () {
var schemaCollection = new NotificationCollection(); var schemaCollection = new NotificationCollection();
schemaCollection.url = '/api/notification/schema'; schemaCollection.url = '/api/notification/schema';
schemaCollection.fetch(); schemaCollection.fetch();

@ -57,7 +57,6 @@
</div> </div>
{{formBuilder}} {{formBuilder}}
index
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

@ -6,7 +6,8 @@ define([
'Settings/Notifications/Model', 'Settings/Notifications/Model',
'Settings/Notifications/DeleteView', 'Settings/Notifications/DeleteView',
'Shared/Messenger', 'Shared/Messenger',
'Mixins/AsModelBoundView' 'Mixins/AsModelBoundView',
'Form/FormBuilder'
], function (App, Marionette, NotificationModel, DeleteView, Messenger, AsModelBoundView) { ], function (App, Marionette, NotificationModel, DeleteView, Messenger, AsModelBoundView) {
@ -29,10 +30,14 @@ define([
}, },
_saveNotification: function () { _saveNotification: function () {
var self = this;
var promise = this.model.saveSettings(); var promise = this.model.saveSettings();
if (promise) { if (promise) {
promise.done(this._saveSuccess); promise.done(function () {
self.notificationCollection.add(self.model, { merge: true });
App.modalRegion.closeModal();
});
} }
}, },

@ -1,9 +1,23 @@
<td name="name"></td> <div class="notification-item">
<td name="implementationName"></td> <div>
<td name="onGrab"></td> <h3>{{name}}</h3>
<td name="onDownload"></td> <span class="btn-group pull-right">
<td name="cutoff.name"></td> <button class="btn btn-mini x-edit"><i class="icon-nd-edit"/></button>
<td> <button class="btn btn-mini x-delete"><i class="icon-nd-delete"/></button>
<i class="icon-cog x-edit" title="Edit"/> </span>
<i class="icon-remove x-delete" title="Delete"/> </div>
</td>
<div>
{{#if onGrab}}
<span class="label label-success">On Grab</span>
{{else}}
<span class="label">On Grab</span>
{{/if}}
{{#if onDownload}}
<span class="label label-success">On Download</span>
{{else}}
<span class="label">On Download</span>
{{/if}}
</div>
</div>

@ -10,19 +10,23 @@ define([
return Marionette.ItemView.extend({ return Marionette.ItemView.extend({
template: 'Settings/Notifications/ItemTemplate', template: 'Settings/Notifications/ItemTemplate',
tagName : 'tr', tagName : 'li',
events: { events: {
'click .x-edit' : 'edit', 'click .x-edit' : '_editNotification',
'click .x-delete': 'deleteNotification' 'click .x-delete': '_deleteNotification'
}, },
edit: function () { initialize: function () {
this.listenTo(this.model, 'sync', this.render);
},
_editNotification: function () {
var view = new EditView({ model: this.model, notificationCollection: this.model.collection}); var view = new EditView({ model: this.model, notificationCollection: this.model.collection});
App.modalRegion.show(view); App.modalRegion.show(view);
}, },
deleteNotification: function () { _deleteNotification: function () {
var view = new DeleteView({ model: this.model}); var view = new DeleteView({ model: this.model});
App.modalRegion.show(view); App.modalRegion.show(view);
} }

@ -1,8 +1,9 @@
'use strict'; 'use strict';
define( define([
[ 'Settings/SettingsModelBase'], function (ModelBase) {
'backbone.deepmodel' return ModelBase.extend({
], function (DeepModel) {
return DeepModel.DeepModel.extend({ successMessage: 'Notification Saved',
errorMessage : 'Couldn\'t save notification'
}); });
}); });

@ -8,7 +8,7 @@
text-align: center; text-align: center;
} }
.notifications { .add-notifications {
text-align: center; text-align: center;
.items { .items {
@ -22,3 +22,31 @@
} }
} }
.notifications {
li {
display: inline-block;
vertical-align: top;
}
}
.notification-item {
.card;
width: 250px;
height: 80px;
padding: 10px 15px;
h3 {
margin-top: 0px;
display: inline-block;
width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.btn-group {
margin-top: 8px;
}
}
Loading…
Cancel
Save