Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Commit

Permalink
migrate JS to use RequireJS frameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dodge committed Feb 13, 2015
1 parent 7e3a539 commit 799672e
Show file tree
Hide file tree
Showing 18 changed files with 713 additions and 197 deletions.
21 changes: 21 additions & 0 deletions edx_notifications/server/web/static/edx_notifications/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
;(function (define) {

define([
'jquery',
'backbone',
'/static/edx_notifications/js/views/counter_icon_view.js',
], function($, Backbone, CounterIconView) {
'use strict';

return function (config) {
this.EdxNotificationIcon= new CounterIconView({
el: $('#edx_notification_counter'),
pane_el: $('#edx_notification_pane'),
endpoints: config.endpoints,
view_templates: config.view_templates
});
};

});

})(define || RequireJS.define);
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
;(function (define) {

define([
'backbone',
'/static/edx_notifications/js/models/user_notification_model.js',
], function (Backbone, UserNotificationModel) {
'use strict';

return Backbone.Collection.extend({
/* model for a collection of UserNotifications */
model: UserNotificationModel,

});
});
})(define || RequireJS.define);
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
var CounterIconModel = Backbone.Model.extend({
/* model for the Notification Icon which will display a counter of unread messages */
;(function (define) {

defaults: {
/* start with unknown number of unread notifications */
'count': null
},
define(['backbone'],
function (Backbone) {
'use strict';

return Backbone.Model.extend({
/* model for the Notification Icon which will display a counter of unread messages */

defaults: {
/* start with unknown number of unread notifications */
'count': null
},
});
});
})(define || RequireJS.define);

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
var UserNotificationModel = Backbone.Model.extend({
/* model for the client-side UserNotification equivalent */
;(function (define) {

define(['backbone'],
function (Backbone) {
'use strict';

return Backbone.Model.extend({
/* model for the client-side UserNotification equivalent */
});
});
})(define || RequireJS.define);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 799672e

Please sign in to comment.