# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User Kanwei Li <kanwei@gmail.com> # Date 1289758795 18000 # Node ID 1449307bdaf7671bea8a879a6c0990bc0c3b7aa7 # Parent 0171a44ec8268209b762965d7a66a928e077e1d4 Data libraries: 'Delete template' renamed to 'Unuse template', 'Add template' renamed to 'Use template' as these are more semantically correct. Checkbox form fields now have 'id' attribute as well. Fix bug when adding a template when no templates exist. --- a/templates/library/common/library_info.mako +++ b/templates/library/common/library_info.mako @@ -41,7 +41,7 @@ <div popupmenu="library-${library.id}-popup"> %if not library.deleted: %if can_add and not library.info_association: - <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a> %endif %if can_manage: <a class="action-button" href="${h.url_for( controller='library_common', action='library_permissions', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a> --- a/lib/galaxy/web/form_builder.py +++ b/lib/galaxy/web/form_builder.py @@ -90,25 +90,26 @@ class CheckboxField(BaseField): A checkbox (boolean input) >>> print CheckboxField( "foo" ).get_html() - <input type="checkbox" name="foo" value="true" ><input type="hidden" name="foo" value="true"> + <input type="checkbox" id="foo" name="foo" value="true"><input type="hidden" name="foo" value="true"> >>> print CheckboxField( "bar", checked="yes" ).get_html() - <input type="checkbox" name="bar" value="true" checked><input type="hidden" name="bar" value="true"> + <input type="checkbox" id="bar" name="bar" value="true" checked="checked"><input type="hidden" name="bar" value="true"> """ def __init__( self, name, checked=None ): self.name = name self.checked = ( checked == True ) or ( isinstance( checked, basestring ) and ( checked.lower() in ( "yes", "true", "on" ) ) ) def get_html( self, prefix="", disabled=False ): if self.checked: - checked_text = "checked" + checked_text = ' checked="checked"' else: checked_text = "" + id_name = prefix + self.name # The hidden field is necessary because if the check box is not checked on the form, it will # not be included in the request params. The hidden field ensure that this will happen. When # parsing the request, the value 'true' in the hidden field actually means it is NOT checked. # See the is_checked() method below. The prefix is necessary in each case to ensure functional # correctness when the param is inside a conditional. - return '<input type="checkbox" name="%s%s" value="true" %s%s><input type="hidden" name="%s%s" value="true"%s>' \ - % ( prefix, self.name, checked_text, self.get_disabled_str( disabled ), prefix, self.name, self.get_disabled_str( disabled ) ) + return '<input type="checkbox" id="%s" name="%s" value="true"%s%s><input type="hidden" name="%s%s" value="true"%s>' \ + % ( id_name, id_name, checked_text, self.get_disabled_str( disabled ), prefix, self.name, self.get_disabled_str( disabled ) ) @staticmethod def is_checked( value ): if value == True: --- a/templates/library/common/browse_library.mako +++ b/templates/library/common/browse_library.mako @@ -152,16 +152,6 @@ }); }); - // For view info links, use a modal popup - /*$(".view-info").live("click", function() { - $.get( $(this).attr("href"), function(info) { - show_modal("View Information", info, { - "Close": function() { hide_modal(); } - }); - }); - return false; - });*/ - function checkForm() { if ( $("select#action_on_datasets_select option:selected").text() == "delete" ) { if ( confirm( "Click OK to delete these datasets?" ) ) { @@ -276,14 +266,14 @@ %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify: <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_edit_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a> %else: - <a class="action-button" class="view-info" href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">View information</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">View information</a> %endif %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify and not info_association: - <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a> %endif %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify and info_association: <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a> - <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Delete template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a> %endif %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_manage: %if not trans.app.security_agent.dataset_is_public( ldda.dataset ): @@ -393,11 +383,11 @@ %endif %endif %if not branch_deleted( folder ) and can_modify and not info_association: - <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a> %endif %if not branch_deleted( folder ) and can_modify and info_association: <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a> - <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Delete template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a> %endif %if not branch_deleted( folder ) and can_manage: %if not trans.app.security_agent.folder_is_public( folder ): @@ -509,11 +499,11 @@ %endif %endif %if can_modify and not library.info_association: - <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a> %endif %if can_modify and info_association: <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a> - <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Delete template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a> %endif %if can_manage: %if not trans.app.security_agent.library_is_public( library, contents=True ): --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -270,7 +270,7 @@ class BooleanToolParameter( ToolParamete >>> print p.name blah >>> print p.get_html() - <input type="checkbox" name="blah" value="true" checked><input type="hidden" name="blah" value="true"> + <input type="checkbox" id="blah" name="blah" value="true" checked="checked"><input type="hidden" name="blah" value="true"> >>> print p.from_html( ["true","true"] ) True >>> print p.to_param_dict_string( True ) --- a/templates/library/common/common.mako +++ b/templates/library/common/common.mako @@ -92,7 +92,7 @@ <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Select a different template</a> %elif info_association and not inherited and can_modify: <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Edit template</a> - <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Delete template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Unuse template</a> %if item_type not in [ 'ldda', 'library_dataset' ]: %if info_association.inheritable: <a class="action-button" href="${h.url_for( controller='library_common', action='manage_template_inheritance', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Dis-inherit template</a> @@ -110,7 +110,7 @@ <b> This is an inherited template and is not required to be used with this ${item_type}. You can <a href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}"><font color="red">select a different template</font></a> - or fill in the desired fields and save this one. This template will not be assocaiated with this ${item_type} until you click the Save button. + or fill in the desired fields and save this one. This template will not be associated with this ${item_type} until you click the Save button. </b></font></div> --- a/lib/galaxy/web/controllers/library_common.py +++ b/lib/galaxy/web/controllers/library_common.py @@ -1781,7 +1781,8 @@ class LibraryCommon( BaseController, Use if not forms: message = "There are no forms on which to base the template, so create a form and then add the template." return trans.response.send_redirect( web.url_for( controller='forms', - action='create_request', + action='create_form', + cntrller='library', message=message, status='done', form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE ) ) --- a/templates/library/common/select_template.mako +++ b/templates/library/common/select_template.mako @@ -28,18 +28,18 @@ </div> % if item_type in [ 'library', 'folder' ]: <div class="form-row"> - <label>Inherit template to contained folders and datasets?</label> %if inheritable_checked: <% inheritable_check_box.checked = True %> %endif ${inheritable_check_box.get_html()} + <label for="inheritable" style="display:inline;">Inherit template to contained folders and datasets?</label><div class="toolParamHelp" style="clear: both;"> Check if you want this template to be used by other folders and datasets contained within this ${item_desc} </div></div> %endif <div class="form-row"> - <input type="submit" name="add_template_button" value="Add template to ${item_desc}"/> + <input type="submit" name="add_template_button" value="Use this template"/></div></form></div> --- a/templates/library/common/ldda_info.mako +++ b/templates/library/common/ldda_info.mako @@ -52,10 +52,10 @@ %if can_modify: <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_edit_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a> %if not info_association: - <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a> %else: <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a> - <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Delete template</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a> %endif %endif %if can_manage: