diff --git a/lib/galaxy/web/base/controller.py b/lib/galaxy/web/base/controller.py index 7c138095f95..413dad0cfc0 100644 --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -204,6 +204,12 @@ class Sharable: return self.sharing( trans, id, **kwargs ) # Abstract methods. + + @web.expose + @web.require_login( "modify Galaxy items" ) + def set_slug_async( self, trans, id, new_slug ): + """ Set item slug asynchronously. """ + pass @web.expose @web.require_login( "share Galaxy items" ) diff --git a/lib/galaxy/web/controllers/history.py b/lib/galaxy/web/controllers/history.py index 18781a47311..f019f89a259 100644 --- a/lib/galaxy/web/controllers/history.py +++ b/lib/galaxy/web/controllers/history.py @@ -395,7 +395,16 @@ class HistoryController( BaseController, Sharable ): trans.sa_session.flush() return - + + @web.expose + @web.require_login( "modify Galaxy items" ) + def set_slug_async( self, trans, id, new_slug ): + history = self.get_history( trans, id ) + if history: + history.slug = new_slug + 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 90cb06a1b59..beae43ec5c6 100644 --- a/lib/galaxy/web/controllers/page.py +++ b/lib/galaxy/web/controllers/page.py @@ -540,6 +540,15 @@ class PageController( BaseController, Sharable ): trans.sa_session.flush() return + @web.expose + @web.require_login( "modify Galaxy items" ) + def set_slug_async( self, trans, id, new_slug ): + page = self.get_page( trans, id ) + if page: + page.slug = new_slug + trans.sa_session.flush() + return + @web.expose @web.json @web.require_login( "use Galaxy pages" ) diff --git a/lib/galaxy/web/controllers/workflow.py b/lib/galaxy/web/controllers/workflow.py index f5573581d24..e60b962be06 100644 --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -382,6 +382,15 @@ class WorkflowController( BaseController, Sharable ): return + @web.expose + @web.require_login( "modify Galaxy items" ) + def set_slug_async( self, trans, id, new_slug ): + stored = get_stored_workflow( trans, id ) + if stored: + stored.slug = new_slug + trans.sa_session.flush() + return + @web.expose @web.json @web.require_login( "use Galaxy workflows" ) diff --git a/static/images/pencil.png b/static/images/pencil.png new file mode 100755 index 00000000000..dbab8f4067a Binary files /dev/null and b/static/images/pencil.png differ diff --git a/static/scripts/galaxy.base.js b/static/scripts/galaxy.base.js index 5ab9f6ad6e1..15d8a173bd9 100644 --- a/static/scripts/galaxy.base.js +++ b/static/scripts/galaxy.base.js @@ -211,7 +211,7 @@ var replace_dbkey_select = function() // // Edit and save text asynchronously. // -function async_save_text(click_to_edit_elt, text_elt_id, save_url, text_parm_name, use_textarea, num_rows) +function async_save_text(click_to_edit_elt, text_elt_id, save_url, text_parm_name, use_textarea, num_rows, on_start, on_finish) { $("#" + click_to_edit_elt).click( function() { var old_text = $("#" + text_elt_id).text() @@ -236,13 +236,25 @@ function async_save_text(click_to_edit_elt, text_elt_id, save_url, text_parm_nam $.ajax({ url: save_url, data: ajax_data, - error: function() { alert( "Text editing for elt " + text_elt_id + " failed" ) }, + error: function() { + alert( "Text editing for elt " + text_elt_id + " failed" ); + // TODO: call finish or no? For now, let's not because error occurred. + }, success: function() { + // Set new text and call finish method. $("#" + text_elt_id).text( new_text ); + if (on_finish != null) + on_finish(t); } }); } }); + + // Call onstart method if it exists. + if (on_start != null) + on_start(t); + + // Replace text with input object and focus & select. $("#" + text_elt_id).hide(); t.insertAfter( $("#" + text_elt_id) ); t.focus(); diff --git a/templates/dataset/display.mako b/templates/dataset/display.mako index b9a406a685b..7087c6ef964 100644 --- a/templates/dataset/display.mako +++ b/templates/dataset/display.mako @@ -18,7 +18,7 @@ <%def name="title()"> - Galaxy | ${get_class_display_name( item.__class__ )} | ${get_item_name( item )} + Galaxy | ${get_class_display_name( item.__class__ )} | ${get_item_name( item ) | h} <%def name="render_item_links( data )"> @@ -43,7 +43,7 @@
${get_class_display_name( item.__class__ )} - | ${get_item_name( item )} + | ${get_item_name( item ) | h}
@@ -72,11 +72,13 @@

Author

-

${item.history.user.username}

+

${item.history.user.username | h}

- ## Page meta. No page meta for datasets for now. + ## Page meta. + + ## No links for datasets right now. ## Tags.

diff --git a/templates/display_base.mako b/templates/display_base.mako index 717f37a1c0e..86ffd4b313b 100644 --- a/templates/display_base.mako +++ b/templates/display_base.mako @@ -13,13 +13,13 @@ <%namespace file="/display_common.mako" import="*" /> <%def name="title()"> - Galaxy | ${iff( item.published, "Published ", iff( item.importable , "Accessible ", iff( item.users_shared_with, "Shared ", "Private " ) ) ) + get_class_display_name( item.__class__ )} | ${get_item_name( item )} + Galaxy | ${iff( item.published, "Published ", iff( item.importable , "Accessible ", iff( item.users_shared_with, "Shared ", "Private " ) ) ) + get_class_display_name( item.__class__ )} | ${get_item_name( item ) | h} <%def name="init()"> <% self.has_left_panel=False - self.has_right_panel=item.published + self.has_right_panel=True self.message_box_visible=False self.active_view="user" self.overlay_visible=False @@ -152,7 +152,7 @@

Author

-

${item.user.username}

+

${item.user.username | h}

@@ -162,7 +162,7 @@

Related ${item_plural}

All published ${item_plural.lower()}
- ${item_plural} owned by ${item.user.username} + Published ${item_plural.lower()} by ${item.user.username | h} ## Tags.

Tags

diff --git a/templates/display_common.mako b/templates/display_common.mako index a452f085c03..34e72bdb333 100644 --- a/templates/display_common.mako +++ b/templates/display_common.mako @@ -1,6 +1,8 @@ ## ## Utilities for sharing items and displaying shared items. +## HACK: these should probably go in the web helper object. ## + <%! from galaxy import model %> ## Get display name for a class. diff --git a/templates/history/display.mako b/templates/history/display.mako index 15dbe352e36..dfb203e052e 100644 --- a/templates/history/display.mako +++ b/templates/history/display.mako @@ -241,7 +241,7 @@ <%def name="render_item( history, datasets )"> %if history.deleted: diff --git a/templates/root/history.mako b/templates/root/history.mako index f31d0286f57..485de71e677 100644 --- a/templates/root/history.mako +++ b/templates/root/history.mako @@ -276,7 +276,7 @@ div.form-row { %if history.deleted: @@ -311,7 +311,7 @@ div.form-row {
%if annotation: -
${h.escape(annotation)}
+
${annotation | h}
%else:
%endif diff --git a/templates/sharing_base.mako b/templates/sharing_base.mako index c43b96445e7..ca51e20d0c3 100644 --- a/templates/sharing_base.mako +++ b/templates/sharing_base.mako @@ -15,6 +15,40 @@ Sharing and Publishing ${get_class_display_name( item.__class__ )} '${get_item_name( item )}' +<%def name="javascripts()"> + ${parent.javascripts()} + + + <%def name="stylesheets()"> ${parent.stylesheets()}