mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Use makoless grid for published page list
This commit is contained in:
@@ -10,6 +10,7 @@ var jQuery = require( 'jquery' ),
|
||||
CustomBuilds = require( 'mvc/user/user-custom-builds' ),
|
||||
Tours = require( 'mvc/tours' ),
|
||||
Workflows = require( 'mvc/workflow/workflow' );
|
||||
GridView = require( 'mvc/grid/grid-view' )
|
||||
|
||||
/** define the 'Analyze Data'/analysis/main/home page for Galaxy
|
||||
* * has a masthead
|
||||
@@ -79,12 +80,13 @@ window.app = function app( options, bootstrapped ){
|
||||
'(/)user(/)' : 'show_user',
|
||||
'(/)user(/)(:form_id)' : 'show_user_form',
|
||||
'(/)workflow(/)' : 'show_workflows',
|
||||
'(/)custom_builds' : 'show_custom_builds'
|
||||
'(/)custom_builds' : 'show_custom_builds',
|
||||
'(/)pages(/)(:action_id)' : 'show_pages',
|
||||
},
|
||||
|
||||
require_login: [
|
||||
'show_user',
|
||||
'show_user_form'
|
||||
'show_user_form',
|
||||
],
|
||||
|
||||
loginRequired: function() {
|
||||
@@ -111,6 +113,10 @@ window.app = function app( options, bootstrapped ){
|
||||
this.page.display( new UserPreferences.Forms( { form_id: form_id, user_id: Galaxy.params.id } ) );
|
||||
},
|
||||
|
||||
show_pages : function( action_id ) {
|
||||
this.page.display( new GridView( { url_base: Galaxy.root + 'page/list_published', dict_format: true } ) );
|
||||
},
|
||||
|
||||
show_workflows : function(){
|
||||
this.page.display( new Workflows.View() );
|
||||
},
|
||||
|
||||
@@ -65,7 +65,7 @@ var Collection = Backbone.Collection.extend({
|
||||
url : 'visualization/list_published'
|
||||
},{
|
||||
title : _l('Pages'),
|
||||
url : 'page/list_published'
|
||||
url : 'pages/list_published'
|
||||
}]
|
||||
});
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ jQuery.ajaxSettings.traditional = true;
|
||||
|
||||
// dependencies
|
||||
define([
|
||||
'utils/utils',
|
||||
'mvc/grid/grid-model',
|
||||
'mvc/grid/grid-template',
|
||||
"mvc/ui/popup-menu"
|
||||
], function(GridModel, Templates, PopupMenu) {
|
||||
], function(Utils, GridModel, Templates, PopupMenu) {
|
||||
|
||||
// grid view
|
||||
return Backbone.View.extend({
|
||||
@@ -18,6 +19,7 @@ return Backbone.View.extend({
|
||||
// Initialize
|
||||
initialize: function(grid_config)
|
||||
{
|
||||
this.dict_format = grid_config.dict_format;
|
||||
var self = this;
|
||||
window.add_tag_to_grid_filter = function( tag_name, tag_value ){
|
||||
// Put tag name and value together.
|
||||
@@ -31,7 +33,23 @@ return Backbone.View.extend({
|
||||
};
|
||||
|
||||
// set element
|
||||
this.setElement('#grid-container');
|
||||
if ( this.dict_format ) {
|
||||
this.setElement('<div/>');
|
||||
if ( grid_config.url_base && !grid_config.items ) {
|
||||
Utils.get({
|
||||
url: grid_config.url_base,
|
||||
success: function( response ) {
|
||||
self.init_grid( response );
|
||||
window.console.log( self.$el );
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.init_grid(grid_config);
|
||||
}
|
||||
} else {
|
||||
this.setElement('#grid-container');
|
||||
this.init_grid(grid_config);
|
||||
}
|
||||
|
||||
// fix padding
|
||||
if (grid_config.use_panels) {
|
||||
@@ -40,9 +58,6 @@ return Backbone.View.extend({
|
||||
overflow : 'auto'
|
||||
});
|
||||
}
|
||||
|
||||
// initialize controls
|
||||
this.init_grid(grid_config);
|
||||
},
|
||||
|
||||
// refresh frames
|
||||
@@ -557,7 +572,7 @@ return Backbone.View.extend({
|
||||
});
|
||||
|
||||
// Do operation. If operation cannot be performed asynchronously, redirect to location.
|
||||
if (this.grid.can_async_op(operation)) {
|
||||
if (this.grid.can_async_op(operation) || this.dict_format) {
|
||||
this.update_grid();
|
||||
} else {
|
||||
this.go_to(target, href);
|
||||
@@ -574,7 +589,7 @@ return Backbone.View.extend({
|
||||
}
|
||||
|
||||
// refresh grid
|
||||
if (this.grid.get('async')) {
|
||||
if (this.grid.get('async') || this.dict_format) {
|
||||
this.update_grid();
|
||||
} else {
|
||||
this.go_to(target, href);
|
||||
@@ -642,7 +657,7 @@ return Backbone.View.extend({
|
||||
var insert = self.grid.get('insert');
|
||||
|
||||
// request new configuration
|
||||
var json = $.parseJSON(response_text);
|
||||
var json = self.dict_format ? response_text.embedded_grid || response_text : $.parseJSON(response_text);
|
||||
|
||||
// update
|
||||
json.embedded = embedded;
|
||||
|
||||
@@ -108,6 +108,7 @@ def paste_app_factory( global_conf, **kwargs ):
|
||||
webapp.add_client_route( '/user' )
|
||||
webapp.add_client_route( '/user/{form_id}' )
|
||||
webapp.add_client_route( '/workflow' )
|
||||
webapp.add_client_route( '/pages/{action_id}' )
|
||||
webapp.add_client_route( '/custom_builds' )
|
||||
|
||||
# ==== Done
|
||||
|
||||
@@ -342,14 +342,10 @@ class PageController( BaseUIController, SharableMixin,
|
||||
return trans.fill_template( "page/index.mako", embedded_grid=grid, shared_by_others=shared_by_others )
|
||||
|
||||
@web.expose
|
||||
@web.json
|
||||
def list_published( self, trans, *args, **kwargs ):
|
||||
kwargs[ 'embedded' ] = True
|
||||
grid = self._all_published_list( trans, *args, **kwargs )
|
||||
if 'async' in kwargs:
|
||||
return grid
|
||||
|
||||
# Render grid wrapped in panels
|
||||
return trans.fill_template( "page/list_published.mako", embedded_grid=grid )
|
||||
kwargs[ 'dict_format' ] = True
|
||||
return self._all_published_list( trans, *args, **kwargs )
|
||||
|
||||
@web.expose
|
||||
@web.require_login( "create pages" )
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,33 +0,0 @@
|
||||
<%inherit file="/webapps/galaxy/base_panels.mako"/>
|
||||
|
||||
<%def name="init()">
|
||||
<%
|
||||
self.has_left_panel=False
|
||||
self.has_right_panel=False
|
||||
self.active_view="shared"
|
||||
self.message_box_visible=False
|
||||
%>
|
||||
</%def>
|
||||
|
||||
<%def name="title()">
|
||||
Galaxy | Published Pages
|
||||
</%def>
|
||||
|
||||
<%def name="stylesheets()">
|
||||
${parent.stylesheets()}
|
||||
<style>
|
||||
.grid td {
|
||||
min-width: 100px;
|
||||
}
|
||||
</style>
|
||||
</%def>
|
||||
|
||||
<%def name="center_panel()">
|
||||
|
||||
<div style="overflow: auto; height: 100%;">
|
||||
<div class="page-container" style="padding: 10px;">
|
||||
<!-- embedded grid -->
|
||||
${h.to_unicode( embedded_grid )}
|
||||
</div>
|
||||
</div>
|
||||
</%def>
|
||||
Reference in New Issue
Block a user