mirror of
https://github.com/fergalmoran/dss.git
synced 2026-05-27 05:36:26 +00:00
Added user list view
This commit is contained in:
@@ -24,7 +24,7 @@ class ActivityResource(BackboneCompatibleResource):
|
||||
user_image = bundle.obj.user.get_profile().get_small_profile_image()
|
||||
user_profile = bundle.obj.user.get_profile().get_profile_url()
|
||||
else:
|
||||
user_name = "Anonymous user"
|
||||
user_name = "Anonymous"
|
||||
user_image = UserProfile.get_default_avatar_image()
|
||||
user_profile = ""
|
||||
|
||||
@@ -45,13 +45,3 @@ class ActivityResource(BackboneCompatibleResource):
|
||||
except Exception, ee:
|
||||
self.logger.debug("Exception: Error dehydrating activity, %s" % ee.message)
|
||||
return None
|
||||
|
||||
""""
|
||||
def alter_list_data_to_serialize(self, request, data):
|
||||
return [i for i in data['objects'] if i is not None and i.obj.user is not None and i.obj.get_object_name is not None and i.obj.get_object_url is not None]
|
||||
"""
|
||||
|
||||
"""
|
||||
def dehydrate_date(self, bundle):
|
||||
return self.humanize_date(bundle.obj.date)
|
||||
"""
|
||||
@@ -1,7 +1,7 @@
|
||||
define ['app', 'marionette',
|
||||
'models/mix/mixItem', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView',
|
||||
'models/user/userItem', 'views/user/userEditView'],
|
||||
(App, Marionette, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserEditView)->
|
||||
'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'],
|
||||
(App, Marionette, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserListView, UserEditView)->
|
||||
class DssController extends Marionette.Controller
|
||||
home: ->
|
||||
console.log "Controller: home"
|
||||
@@ -49,7 +49,14 @@ define ['app', 'marionette',
|
||||
)
|
||||
true
|
||||
|
||||
user: (slug) ->
|
||||
showUserList: (type) ->
|
||||
console.log("Controller: showUserList")
|
||||
app = require('app')
|
||||
app.contentRegion.show(new UserListView())
|
||||
|
||||
|
||||
showUserDetail: (slug) ->
|
||||
console.log("Controller: showUserDetail")
|
||||
@showMixList('latest', {user: slug})
|
||||
|
||||
editUser: () ->
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
var __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; };
|
||||
|
||||
define(['app', 'marionette', 'models/mix/mixItem', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'models/user/userItem', 'views/user/userEditView'], function(App, Marionette, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserEditView) {
|
||||
define(['app', 'marionette', 'models/mix/mixItem', 'views/mix/mixListView', 'views/mix/mixDetailView', 'views/mix/mixEditView', 'models/user/userItem', 'views/user/userListView', 'views/user/userEditView'], function(App, Marionette, MixItem, MixListView, MixDetailView, MixEditView, UserItem, UserListView, UserEditView) {
|
||||
var DssController;
|
||||
DssController = (function(_super) {
|
||||
|
||||
@@ -81,7 +81,15 @@
|
||||
return true;
|
||||
};
|
||||
|
||||
DssController.prototype.user = function(slug) {
|
||||
DssController.prototype.showUserList = function(type) {
|
||||
var app;
|
||||
console.log("Controller: showUserList");
|
||||
app = require('app');
|
||||
return app.contentRegion.show(new UserListView());
|
||||
};
|
||||
|
||||
DssController.prototype.showUserDetail = function(slug) {
|
||||
console.log("Controller: showUserDetail");
|
||||
return this.showMixList('latest', {
|
||||
user: slug
|
||||
});
|
||||
|
||||
@@ -12,7 +12,8 @@ define ['marionette', 'app.lib/controller'],
|
||||
"mix/:slug": "showMix"
|
||||
"mix/edit/:slug": "editMix",
|
||||
|
||||
"user/:slug": "user"
|
||||
"users": "showUserList"
|
||||
"user/:slug": "showUserDetail"
|
||||
"me": "editUser"
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
"mixes/:type": "showMixList",
|
||||
"mix/:slug": "showMix",
|
||||
"mix/edit/:slug": "editMix",
|
||||
"user/:slug": "user",
|
||||
"users": "showUserList",
|
||||
"user/:slug": "showUserDetail",
|
||||
"me": "editUser"
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ define ['marionette', 'models/mix/mixCollection', 'views/mix/mixItemView', 'text
|
||||
itemViewContainer: "#mix-list-container-ul"
|
||||
|
||||
initialize: ->
|
||||
console.log "MixListView: Before render"
|
||||
console.log "MixListView: initialize"
|
||||
@collection = new MixCollection()
|
||||
@collection.fetch(
|
||||
data: @options
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
MixListView.prototype.initialize = function() {
|
||||
var _this = this;
|
||||
console.log("MixListView: Before render");
|
||||
console.log("MixListView: initialize");
|
||||
this.collection = new MixCollection();
|
||||
this.collection.fetch({
|
||||
data: this.options,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
define ['app', 'marionette'],
|
||||
(App, Marionette)->
|
||||
define ['app', 'marionette', 'text!/tpl/UserListItemView'],
|
||||
(App, Marionette, Template)->
|
||||
class UserItemView extends Marionette.ItemView
|
||||
itemView: UserItemView
|
||||
|
||||
template: _.template(Template)
|
||||
tagName: "tr"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
var __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; };
|
||||
|
||||
define(['app', 'marionette'], function(App, Marionette) {
|
||||
define(['app', 'marionette', 'text!/tpl/UserListItemView'], function(App, Marionette, Template) {
|
||||
var UserItemView;
|
||||
return UserItemView = (function(_super) {
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
return UserItemView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
UserItemView.prototype.itemView = UserItemView;
|
||||
UserItemView.prototype.template = _.template(Template);
|
||||
|
||||
UserItemView.prototype.tagName = "tr";
|
||||
|
||||
return UserItemView;
|
||||
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
define ['marionette', 'views/user/userItemView'],
|
||||
(Marionette, UserItemView) ->
|
||||
define ['marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView'],
|
||||
(Marionette, UserCollection, UserItemView, Template) ->
|
||||
class UserListView extends Marionette.CompositeView
|
||||
template: "<h1>Hello Sailor</h1"
|
||||
|
||||
template: _.template(Template)
|
||||
tagName: "table"
|
||||
className: "table table-striped"
|
||||
itemView: UserItemView
|
||||
itemViewContainer: "#content"
|
||||
tagName: "li"
|
||||
|
||||
initialize: ->
|
||||
console.log "UserListView: initialize"
|
||||
@collection = new UserCollection()
|
||||
@collection.fetch(
|
||||
data: @options
|
||||
success: =>
|
||||
console.log("UserListView: Collection fetched")
|
||||
return
|
||||
)
|
||||
return
|
||||
|
||||
return UserListView
|
||||
UserListView
|
||||
@@ -1,6 +1,42 @@
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
(function() {
|
||||
var __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; };
|
||||
|
||||
define(['marionette', 'views/user/userItemView']);
|
||||
define(['marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView'], function(Marionette, UserCollection, UserItemView, Template) {
|
||||
var UserListView;
|
||||
UserListView = (function(_super) {
|
||||
|
||||
__extends(UserListView, _super);
|
||||
|
||||
function UserListView() {
|
||||
return UserListView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
UserListView.prototype.template = _.template(Template);
|
||||
|
||||
UserListView.prototype.tagName = "table";
|
||||
|
||||
UserListView.prototype.className = "table table-striped";
|
||||
|
||||
UserListView.prototype.itemView = UserItemView;
|
||||
|
||||
UserListView.prototype.initialize = function() {
|
||||
var _this = this;
|
||||
console.log("UserListView: initialize");
|
||||
this.collection = new UserCollection();
|
||||
this.collection.fetch({
|
||||
data: this.options,
|
||||
success: function() {
|
||||
console.log("UserListView: Collection fetched");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return UserListView;
|
||||
|
||||
})(Marionette.CompositeView);
|
||||
return UserListView;
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
9
templates/views/UserListItemView.html
Normal file
9
templates/views/UserListItemView.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<td><%= profile.display_name %></td>
|
||||
<td>
|
||||
<a href="/user/<%= profile.slug %>"><%= profile.mix_count%></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/user/<%= profile.slug %>/followers"><%= profile.follower_count %></a>
|
||||
</td>
|
||||
<td><%= profile.following_count %></td>
|
||||
<td><%= human_last_login %></td>
|
||||
10
templates/views/UserListView.html
Normal file
10
templates/views/UserListView.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Uploads</th>
|
||||
<th>Followers</th>
|
||||
<th>Following</th>
|
||||
<th>Last seen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
Reference in New Issue
Block a user