From 37ba688480f3355342fd05a627ebf4d674e635bf Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Thu, 16 May 2013 20:54:48 +0100 Subject: [PATCH] Switch.. --- static/js/app/app.js | 14 +++++++---- static/js/app/models/followers.coffee | 0 static/js/app/models/followers.js | 6 +++++ static/js/app/models/user.js | 5 ++++ static/js/app/views/user/userItem.coffee | 2 ++ static/js/app/views/user/userItem.js | 23 +++++++++++++++++++ static/js/app/views/user/userList.coffee | 2 ++ static/js/app/views/user/userList.js | 19 +++++++++++++++ static/js/app/views/{user.js => userEdit.js} | 2 +- templates/base.html | 2 +- .../{UserView.html => UserEditView.html} | 0 11 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 static/js/app/models/followers.coffee create mode 100644 static/js/app/models/followers.js create mode 100644 static/js/app/views/user/userItem.coffee create mode 100644 static/js/app/views/user/userItem.js create mode 100644 static/js/app/views/user/userList.coffee create mode 100644 static/js/app/views/user/userList.js rename static/js/app/views/{user.js => userEdit.js} (96%) rename templates/views/{UserView.html => UserEditView.html} (100%) diff --git a/static/js/app/app.js b/static/js/app/app.js index e0a67f1..77b57a2 100644 --- a/static/js/app/app.js +++ b/static/js/app/app.js @@ -28,8 +28,10 @@ var AppRouter = Backbone.Router.extend({ //"accounts/login/": "login", //"accounts/logout/": "logout", "user/:id": "user", + "users": "users", + "user/:id/followers": "userFollowers", "upload/": "defaultRoute", - "me": "userDetails", + "me": "editUser", "*path": "defaultRoute" }, initialize: function () { @@ -80,14 +82,18 @@ var AppRouter = Backbone.Router.extend({ } }); }, - userDetails: function () { + users: function(){ + alert('Argle'); + + }, + editUser: function () { var user = new User({ id: com.podnoms.settings.currentUser }); $('#site-content-fill').html(''); user.fetch({ success: function () { - var content = new UserView({ + var content = new UserEditView({ model: user }); $('#content').html(content.render().el); @@ -253,7 +259,7 @@ var AppRouter = Backbone.Router.extend({ } }); -com.podnoms.utils.loadTemplate(['HeaderView', 'SidebarView', 'SidebarViewUser', 'UserView', 'MixListView', 'MixListItemView', 'MixView', 'MixCreateView', 'CommentListView', 'CommentListItemView', 'ActivityListView', 'ActivityListItemView', 'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseCreateView', 'ReleaseAudioListView', 'ReleaseAudioItemView', 'EventCreateView', 'EventListView', 'EventListItemView', 'EventView', 'EventItemView'], function () { +com.podnoms.utils.loadTemplate(['HeaderView', 'SidebarView', 'SidebarViewUser', 'UserEditView', 'MixListView', 'MixListItemView', 'MixView', 'MixCreateView', 'CommentListView', 'CommentListItemView', 'ActivityListView', 'ActivityListItemView', 'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseCreateView', 'ReleaseAudioListView', 'ReleaseAudioItemView', 'EventCreateView', 'EventListView', 'EventListItemView', 'EventView', 'EventItemView'], function () { window.app = new AppRouter(); // Trigger the initial route and enable HTML5 History API support, set the // root folder to '/' by default. Change in app.js. diff --git a/static/js/app/models/followers.coffee b/static/js/app/models/followers.coffee new file mode 100644 index 0000000..e69de29 diff --git a/static/js/app/models/followers.js b/static/js/app/models/followers.js new file mode 100644 index 0000000..273865e --- /dev/null +++ b/static/js/app/models/followers.js @@ -0,0 +1,6 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + + + +}).call(this); diff --git a/static/js/app/models/user.js b/static/js/app/models/user.js index 33e969e..00103a4 100644 --- a/static/js/app/models/user.js +++ b/static/js/app/models/user.js @@ -22,3 +22,8 @@ var User = DSSModel.extend({ return this.get('profile').avatar_type == 'custom'; } }); + +var UserCollection = TastypieCollection.extend({ + model: User, + url:com.podnoms.settings.urlRoot + "users/" +}); \ No newline at end of file diff --git a/static/js/app/views/user/userItem.coffee b/static/js/app/views/user/userItem.coffee new file mode 100644 index 0000000..3b52e17 --- /dev/null +++ b/static/js/app/views/user/userItem.coffee @@ -0,0 +1,2 @@ +class UserItemView extends Marionette.ItemView -> + itemView: UserItemView \ No newline at end of file diff --git a/static/js/app/views/user/userItem.js b/static/js/app/views/user/userItem.js new file mode 100644 index 0000000..af56fb6 --- /dev/null +++ b/static/js/app/views/user/userItem.js @@ -0,0 +1,23 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var UserItemView, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + UserItemView = (function(_super) { + + __extends(UserItemView, _super); + + function UserItemView() { + return UserItemView.__super__.constructor.apply(this, arguments); + } + + return UserItemView; + + })(Marionette.ItemView(function() { + return { + itemView: UserItemView + }; + })); + +}).call(this); diff --git a/static/js/app/views/user/userList.coffee b/static/js/app/views/user/userList.coffee new file mode 100644 index 0000000..857cedb --- /dev/null +++ b/static/js/app/views/user/userList.coffee @@ -0,0 +1,2 @@ +class UserListView extends Marionette.CollectionView -> + \ No newline at end of file diff --git a/static/js/app/views/user/userList.js b/static/js/app/views/user/userList.js new file mode 100644 index 0000000..a2558c5 --- /dev/null +++ b/static/js/app/views/user/userList.js @@ -0,0 +1,19 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var UserListView, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + UserListView = (function(_super) { + + __extends(UserListView, _super); + + function UserListView() { + return UserListView.__super__.constructor.apply(this, arguments); + } + + return UserListView; + + })(Marionette.CollectionView(function() {})); + +}).call(this); diff --git a/static/js/app/views/user.js b/static/js/app/views/userEdit.js similarity index 96% rename from static/js/app/views/user.js rename to static/js/app/views/userEdit.js index b881f5d..01b7f81 100644 --- a/static/js/app/views/user.js +++ b/static/js/app/views/userEdit.js @@ -7,7 +7,7 @@ */ -UserView = DSSEditableView.extend({ +UserEditView = DSSEditableView.extend({ events: { "click #save-changes": "saveChanges", "change input[type=radio]": "selectAvatar" diff --git a/templates/base.html b/templates/base.html index 58d236f..889ac01 100644 --- a/templates/base.html +++ b/templates/base.html @@ -93,7 +93,7 @@ - + diff --git a/templates/views/UserView.html b/templates/views/UserEditView.html similarity index 100% rename from templates/views/UserView.html rename to templates/views/UserEditView.html