This repository has been archived by the owner on May 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate JS to use RequireJS frameworks
- Loading branch information
Chris Dodge
committed
Feb 13, 2015
1 parent
7e3a539
commit 799672e
Showing
18 changed files
with
713 additions
and
197 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
edx_notifications/server/web/static/edx_notifications/js/app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
15 changes: 15 additions & 0 deletions
15
...tifications/server/web/static/edx_notifications/js/collections/notification_collection.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
20 changes: 14 additions & 6 deletions
20
edx_notifications/server/web/static/edx_notifications/js/models/counter_icon_model.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
5 changes: 0 additions & 5 deletions
5
...ifications/server/web/static/edx_notifications/js/models/notification_collection_model.js
This file was deleted.
Oops, something went wrong.
11 changes: 9 additions & 2 deletions
11
edx_notifications/server/web/static/edx_notifications/js/models/user_notification_model.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
36 changes: 36 additions & 0 deletions
36
edx_notifications/server/web/static/edx_notifications/js/vendor/require.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.