diff --git a/lib/galaxy/web/controllers/history.py b/lib/galaxy/web/controllers/history.py index 5fca0008392..5579ded3a6e 100644 --- a/lib/galaxy/web/controllers/history.py +++ b/lib/galaxy/web/controllers/history.py @@ -369,7 +369,30 @@ class HistoryController( BaseController ): history.name = new_name trans.sa_session.add( history ) trans.sa_session.flush() + + @web.expose + @web.require_login( "get history name" ) + def get_name_async( self, trans, id=None ): + """ Returns the name for a given history. """ + history = get_history( trans, id, False ) + # To get name: user must own history, history must be importable. + if history.user == trans.get_user() or history.importable or trans.get_user() in history.users_shared_with: + return history.name + return + + @web.expose + @web.require_login( "set history's importable flag" ) + def set_importable_async( self, trans, id=None, importable=False ): + """ Set history's importable attribute. """ + history = get_history( trans, id, True ) + + if history: + history.importable = importable + trans.sa_session.flush() + + return + @web.expose def name_autocomplete_data( self, trans, q=None, limit=None, timestamp=None ): """Return autocomplete data for history names""" diff --git a/lib/galaxy/web/controllers/page.py b/lib/galaxy/web/controllers/page.py index 5f8c0f63bc5..8630a370e62 100644 --- a/lib/galaxy/web/controllers/page.py +++ b/lib/galaxy/web/controllers/page.py @@ -116,13 +116,13 @@ class HistorySelectionGrid( grids.Grid ): # Grid definition. title = "Saved Histories" - template = "grid_base_async.mako" + template = "/page/select_histories_grid.mako" async_template = "grid_body_async.mako" model_class = model.History default_filter = { "deleted" : "False" , "shared" : "All" } default_sort_key = "-update_time" use_paging = True - num_rows_per_page = 5 + num_rows_per_page = 10 columns = [ NameColumn( "Name", key="name", model_class=model.History, filterable="advanced" ), grids.TagsColumn( "Tags", "tags", model.History, model.HistoryTagAssociation, filterable="advanced"), diff --git a/static/scripts/jquery.wymeditor.js b/static/scripts/jquery.wymeditor.js index bba4083c692..0c8e7ab0f67 100644 --- a/static/scripts/jquery.wymeditor.js +++ b/static/scripts/jquery.wymeditor.js @@ -295,67 +295,6 @@ jQuery.extend(WYMeditor, { }); -/* - Galaxy code that integrates into the WYM Editor. - */ -var Galaxy = -{ - /* - Galaxy constants for WYM Editor: - TOOLS - A string replaced by the galaxy toolbar's HTML. - TOOLS_ITEMS - A string replaced by the galaxy toolbar items. - INSERT_HISTORY - Command: open the insert history dialog. - INSERT_DATASET - Command: open the insert dataset dialog. - DIALOG_HISTORY - A dialog to insert a history. - DIALOG_DATASET - A dialog to insert a dataset. - */ - TOOLS : "{Galaxy_Tools}", - TOOLS_ITEMS : "{Galaxy_Tools_Items}", - INSERT_HISTORY : "InsertHistory", - INSERT_DATASET : "InsertDataset", - DIALOG_HISTORY : "DialogHistory", - DIALOG_DATASET : "DialogDataset", - - // Tool items overview. - toolsItems: [ - {'name': "InsertHistory", 'title': 'History', 'css': 'galaxy_tools_insert_history_link'}, - {'name': "InsertDataset", 'title': 'Dataset', 'css': 'galaxy_dataset'} - ], - - // Tools HTML. - toolsHtml: "
" - + "

" + this.TOOLS + "

" - + "" - + "
", - - // Insert history dialog. - dialogHistoryHtml: "" - + "
" - + "
" - + "" - + "{Link}" - + "
" - + "" - + "" - + "
" - + "
" - + "" - + "" - + "
" - + "
" - + "
" - + "", -}; - - /********** JQUERY **********/ /** @@ -414,7 +353,6 @@ jQuery.fn.wymeditor = function(options) { + "
" + WYMeditor.CONTAINERS + WYMeditor.CLASSES - + Galaxy.TOOLS + "
" + "
" + WYMeditor.HTML @@ -445,8 +383,6 @@ jQuery.fn.wymeditor = function(options) { + "

{Tools}

" + "" + "
", @@ -821,7 +757,6 @@ WYMeditor.editor.prototype.init = function() { boxHtml = h.replaceAll(boxHtml, WYMeditor.LOGO, this._options.logoHtml); boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS, this._options.toolsHtml); - boxHtml = h.replaceAll(boxHtml, Galaxy.TOOLS, Galaxy.toolsHtml); boxHtml = h.replaceAll(boxHtml, WYMeditor.CONTAINERS,this._options.containersHtml); boxHtml = h.replaceAll(boxHtml, WYMeditor.CLASSES, this._options.classesHtml); boxHtml = h.replaceAll(boxHtml, WYMeditor.HTML, this._options.htmlHtml); @@ -846,24 +781,6 @@ WYMeditor.editor.prototype.init = function() { boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS_ITEMS, sTools); - // Construct Galaxy tools list. - var galaxyTools = eval(Galaxy.toolsItems); - sTools = ""; - for(var i = 0; i < galaxyTools.length; i++) { - var galaxyTool = galaxyTools[i]; - if(galaxyTool.name && galaxyTool.title) { - var sTool = this._options.toolsItemHtml; - var sTool = h.replaceAll(sTool, WYMeditor.TOOL_NAME, galaxyTool.name); - sTool = h.replaceAll(sTool, WYMeditor.TOOL_TITLE, this._options.stringDelimiterLeft - + galaxyTool.title - + this._options.stringDelimiterRight); - sTool = h.replaceAll(sTool, WYMeditor.TOOL_CLASS, galaxyTool.css); - sTools += sTool; - } - } - - //boxHtml = h.replaceAll(boxHtml, Galaxy.TOOLS_ITEMS, sTools); - //construct classes list var aClasses = eval(this._options.classesItems); var sClasses = ""; @@ -1029,10 +946,6 @@ WYMeditor.editor.prototype.exec = function(cmd) { this.dialog(WYMeditor.PREVIEW, this._options.dialogFeaturesPreview); break; - case Galaxy.INSERT_HISTORY: - this.dialog(Galaxy.DIALOG_HISTORY); - break; - default: this._exec(cmd); break; @@ -1263,10 +1176,6 @@ WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHt case(WYMeditor.PREVIEW): sBodyHtml = this._options.dialogPreviewHtml; break; - case(Galaxy.DIALOG_HISTORY): - sBodyHtml = Galaxy.dialogHistoryHtml; - break; - default: sBodyHtml = bodyHtml; } diff --git a/static/wymeditor/lang/en.js b/static/wymeditor/lang/en.js index d878e38d3e9..ebe1ef893d0 100644 --- a/static/wymeditor/lang/en.js +++ b/static/wymeditor/lang/en.js @@ -43,7 +43,7 @@ WYMeditor.STRINGS['en'] = { Source_Code: 'Source code', // Galaxy replacements. - History: 'History', - Dataset: 'Dataset', + Galaxy_History_Link: 'Insert Link to History', + Galaxy_Dataset_Link: 'Insert Link to Dataset', }; diff --git a/templates/grid_base_async.mako b/templates/grid_base_async.mako index 8f936d1efc7..2630d31d720 100644 --- a/templates/grid_base_async.mako +++ b/templates/grid_base_async.mako @@ -407,7 +407,11 @@ ${self.render_grid_table()} // Update grid. function update_grid(maintain_page_links) { + // If there's an operation in the args, do POST; otherwise, do GET. + var operation = url_args['operation']; + var method = (operation != null && operation != undefined ? "POST" : "GET" ); $.ajax({ + type: method, url: "${h.url_for()}", data: url_args, error: function() { alert( "Grid refresh failed" ) }, @@ -504,9 +508,11 @@ ${self.render_grid_table()} <%namespace file="./grid_common_async.mako" import="*" /> ## Print grid header. -<%def name="render_grid_header()"> +<%def name="render_grid_header(include_title)">
-

${grid.title}

+ %if include_title: +

${grid.title}

+ %endif %if grid.global_actions: