Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into grid_histories
- Loading branch information
Showing
42 changed files
with
1,141 additions
and
367 deletions.
There are no files selected for viewing
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
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
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
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,56 @@ | ||
/** This class renders the page list. */ | ||
define( [ 'utils/utils', 'mvc/grid/grid-view' ], function( Utils, GridView ) { | ||
var View = Backbone.View.extend({ | ||
initialize: function( options ) { | ||
var self = this; | ||
this.setElement( $( '<div/>' ) ); | ||
this.model = new Backbone.Model(); | ||
Utils.get({ | ||
url : Galaxy.root + 'page/list', | ||
success : function( response ) { | ||
response[ 'dict_format' ] = true; | ||
self.model.set( response ); | ||
self.render(); | ||
} | ||
}); | ||
}, | ||
|
||
render: function() { | ||
var grid = new GridView( this.model.attributes ); | ||
this.$el.empty().append( grid.$el ); | ||
this.$el.append( this._templateShared() ); | ||
}, | ||
|
||
_templateShared: function() { | ||
var $tmpl = $( '<div>' + | ||
'<h2>Pages shared with you by others</h2>' + | ||
'</div>' ); | ||
var options = this.model.attributes; | ||
if ( options.shared_by_others && options.shared_by_others.length > 0 ) { | ||
var $table = $( '<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">' + | ||
'<tr class="header">' + | ||
'<th>Title</th>' + | ||
'<th>Owner</th>' + | ||
'</tr>' + | ||
'</table>' ); | ||
_.each( options.shared_by_others, function( page, index ) { | ||
var display_url = Galaxy.root + 'page/display_by_username_and_slug?username=' + page.username + '&slug=' + page.slug; | ||
$table.append( '<tr>' + | ||
'<td>' + | ||
'<a href="' + display_url + '">' + _.escape( page.title ) + '</a>' + | ||
'</td>' + | ||
'<td>' + _.escape( page.username ) + '</td>' + | ||
'</tr>' ); | ||
}); | ||
$tmpl.append( $table ); | ||
} else { | ||
$tmpl.append( 'No pages have been shared with you.' ); | ||
} | ||
return $tmpl; | ||
} | ||
}); | ||
|
||
return { | ||
View: View | ||
} | ||
}); |
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
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
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
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
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
Oops, something went wrong.