3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f760a391f14a/ Changeset: f760a391f14a User: dannon Date: 2015-01-29 21:10:56+00:00 Summary: Convert everything from elementtree to stdlib xml module. Affected #: 24 files diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 cron/parse_builds.py --- a/cron/parse_builds.py +++ b/cron/parse_builds.py @@ -8,12 +8,7 @@ import sys import urllib -if sys.version_info[:2] >= ( 2, 5 ): - import xml.etree.ElementTree as ElementTree -else: - from galaxy import eggs - import pkg_resources; pkg_resources.require( "elementtree" ) - from elementtree import ElementTree +import xml.etree.ElementTree as ElementTree URL = "http://genome.cse.ucsc.edu/cgi-bin/das/dsn" @@ -38,7 +33,7 @@ for dsn in tree: build = dsn.find("SOURCE").attrib['id'] description = dsn.find("DESCRIPTION").text.replace(" - Genome at UCSC","").replace(" Genome at UCSC","") - + fields = description.split(" ") temp = fields[0] for i in range(len(fields)-1): diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 cron/parse_builds_3_sites.py --- a/cron/parse_builds_3_sites.py +++ b/cron/parse_builds_3_sites.py @@ -5,12 +5,7 @@ import sys import urllib -if sys.version_info[:2] >= ( 2, 5 ): - import xml.etree.ElementTree as ElementTree -else: - from galaxy import eggs - import pkg_resources; pkg_resources.require( "elementtree" ) - from elementtree import ElementTree +import xml.etree.ElementTree as ElementTree sites = ['http://genome.ucsc.edu/cgi-bin/', 'http://archaea.ucsc.edu/cgi-bin/', @@ -38,7 +33,7 @@ print "#Invalid xml passed back from " + site continue print "#Harvested from",site - + for dsn in tree: build = dsn.find("SOURCE").attrib['id'] builds.append(build) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 eggs.ini --- a/eggs.ini +++ b/eggs.ini @@ -38,7 +38,6 @@ decorator = 3.1.2 docutils = 0.7 drmaa = 0.7.6 -elementtree = 1.2.6_20050316 Fabric = 1.7.0 importlib = 1.0.3 kombu = 3.0.13 diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/datatypes/dataproviders/hierarchy.py --- a/lib/galaxy/datatypes/dataproviders/hierarchy.py +++ b/lib/galaxy/datatypes/dataproviders/hierarchy.py @@ -3,7 +3,7 @@ """ import line -import xml.etree.ElementTree as elementtree +from xml.etree.ElementTree import Element, iterparse _TODO = """ """ @@ -30,7 +30,7 @@ """ Data provider that converts selected XML elements to dictionaries. """ - # using elementtree's iterparse method to keep mem down + # using xml.etree's iterparse method to keep mem down #TODO: this, however (AFAIK), prevents the use of xpath settings = { 'selector' : 'str', #urlencoded @@ -54,7 +54,7 @@ """ Returns true if the ``element`` matches the ``selector``. - :param element: an XML ``ElementTree.Element`` + :param element: an XML ``Element`` :param selector: some partial string in the desired tags to return Change point for more sophisticated selectors. @@ -64,13 +64,13 @@ #TODO: fails with '#' - browser thinks it's an anchor - use urlencode #TODO: need removal/replacement of etree namespacing here - then move to string match return bool( ( selector == None ) - or ( isinstance( element, elementtree.Element ) and selector in element.tag ) ) + or ( isinstance( element, Element ) and selector in element.tag ) ) def element_as_dict( self, element ): """ Converts an XML element (its text, tag, and attributes) to dictionary form. - :param element: an XML ``ElementTree.Element`` + :param element: an XML ``Element`` """ #TODO: Key collision is unlikely here, but still should be better handled return { @@ -84,7 +84,7 @@ """ Yield all children of element (and their children - recursively) in dictionary form. - :param element: an XML ``ElementTree.Element`` + :param element: an XML ``Element`` :param max_depth: the number of generations of descendents to return """ if not isinstance( max_depth, int ) or max_depth >= 1: @@ -99,7 +99,7 @@ yield child_data def __iter__( self ): - context = elementtree.iterparse( self.source, events=self.ITERPARSE_ALL_EVENTS ) + context = iterparse( self.source, events=self.ITERPARSE_ALL_EVENTS ) context = iter( context ) selected_element = None diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/sample_tracking/external_service_types.py --- a/lib/galaxy/sample_tracking/external_service_types.py +++ b/lib/galaxy/sample_tracking/external_service_types.py @@ -4,7 +4,6 @@ from galaxy import util, jobs, model from galaxy.forms.forms import form_factory from galaxy.external_services.service import ExternalServiceActionsGroup -from elementtree.ElementTree import XML from galaxy.sample_tracking.data_transfer import data_transfer_factories log = logging.getLogger( __name__ ) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -18,12 +18,11 @@ eggs.require( "MarkupSafe" ) # MarkupSafe must load before mako eggs.require( "Mako" ) -eggs.require( "elementtree" ) eggs.require( "Paste" ) eggs.require( "SQLAlchemy >= 0.4" ) from cgi import FieldStorage -from elementtree import ElementTree +from xml.etree import ElementTree from mako.template import Template from paste import httpexceptions @@ -2280,7 +2279,7 @@ trans.response.status = 500 log.error('Failed to get job information.') return { 'error': 'Failed to get job information.' } - + # load job parameters into incoming tool_message = '' if job: @@ -2295,7 +2294,7 @@ # create parameter object params = galaxy.util.Params( kwd, sanitize = False ) - + # convert value to jsonifiable value def jsonify(v): # check if value is numeric @@ -2344,16 +2343,16 @@ # update and return dict[key] = value - + # check the current state of a value and update it if necessary def check_state(trans, input, default_value, context): value = default_value error = 'State validation failed.' - + # skip dynamic fields if deactivated if not is_dynamic and input.is_dynamic: return [value, None] - + # validate value content try: # resolves the inconsistent definition of boolean parameters (see base.py) without modifying shared code @@ -2365,7 +2364,7 @@ log.error('Checking parameter failed. %s', str(err)) pass return [value, error] - + # populates state with incoming url parameters def populate_state(trans, inputs, state, errors, incoming, prefix="", context=None ): context = ExpressionContext(state, context) @@ -2410,7 +2409,7 @@ if error: errors[key] = error state[input.name] = value - + # builds tool model including all attributes def iterate(group_inputs, inputs, state_inputs, other_values=None): other_values = ExpressionContext( state_inputs, other_values ) @@ -2442,13 +2441,13 @@ tool_dict = input.to_dict(trans, other_values=other_values) except Exception: pass - + # identify name input_name = tool_dict.get('name') if input_name: # backup default value tool_dict['default_value'] = input.get_initial_value(trans, other_values) - + # update input value from tool state if input_name in state_inputs: tool_dict['value'] = state_inputs[input_name] @@ -2481,7 +2480,7 @@ # do param translation here, used by datasource tools if self.input_translator: self.input_translator.translate( params ) - + # initialize and populate tool state state_inputs = {} state_errors = {} @@ -2490,7 +2489,7 @@ # create basic tool model tool_model = self.to_dict(trans) tool_model['inputs'] = {} - + # build tool model and tool state iterate(tool_model['inputs'], self.inputs, state_inputs, '') @@ -2504,18 +2503,18 @@ tool_help = tool_help.render( static_path=url_for( '/static' ), host_url=url_for('/', qualified=True) ) if type( tool_help ) is not unicode: tool_help = unicode( tool_help, 'utf-8') - + # check if citations exist tool_citations = False if self.citations: tool_citations = True - + # get tool versions tool_versions = [] tools = self.app.toolbox.get_loaded_tools_by_lineage(self.id) for t in tools: tool_versions.append(t.version) - + ## add information with underlying requirements and their versions tool_requirements = [] if self.requirements: @@ -2577,13 +2576,13 @@ except Exception, error: trans.response.status = 500 return { 'error': str (error) } - + # can't rerun upload, external data sources, et cetera. workflow compatible will proxy this for now #if not self.is_workflow_compatible: # trans.response.status = 500 # return { 'error': 'The \'%s\' tool does currently not support re-running.' % self.name } return message - + def get_default_history_by_trans( self, trans, create=False ): return trans.get_history( create=create ) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -8,7 +8,7 @@ import os import os.path import urllib -from elementtree.ElementTree import XML, Element +from xml.etree.ElementTree import XML from galaxy import config, datatypes, util from galaxy.web import form_builder from galaxy.util.bunch import Bunch diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/tools/parameters/input_translation.py --- a/lib/galaxy/tools/parameters/input_translation.py +++ b/lib/galaxy/tools/parameters/input_translation.py @@ -13,7 +13,7 @@ This is used for data source tools >>> from galaxy.util import Params - >>> from elementtree.ElementTree import XML + >>> from xml.etree.ElementTree import XML >>> translator = ToolInputTranslator.from_element( XML( ... ''' ... <request_param_translation> diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/tools/parameters/sanitize.py --- a/lib/galaxy/tools/parameters/sanitize.py +++ b/lib/galaxy/tools/parameters/sanitize.py @@ -12,7 +12,7 @@ """ Handles tool parameter specific sanitizing. - >>> from elementtree.ElementTree import XML + >>> from xml.etree.ElementTree import XML >>> sanitizer = ToolParameterSanitizer.from_element( XML( ... ''' ... <sanitizer invalid_char=""> diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/tools/parameters/validation.py --- a/lib/galaxy/tools/parameters/validation.py +++ b/lib/galaxy/tools/parameters/validation.py @@ -3,7 +3,7 @@ """ import os, re, logging -from elementtree.ElementTree import XML +from xml.etree.ElementTree import XML from galaxy import model log = logging.getLogger( __name__ ) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -40,8 +40,7 @@ import docutils.core import docutils.writers.html4css1 -eggs.require( 'elementtree' ) -from elementtree import ElementTree, ElementInclude +from xml.etree import ElementTree, ElementInclude eggs.require( "wchartype" ) import wchartype diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/webapps/galaxy/api/forms.py --- a/lib/galaxy/webapps/galaxy/api/forms.py +++ b/lib/galaxy/webapps/galaxy/api/forms.py @@ -5,7 +5,7 @@ from galaxy.web.base.controller import BaseAPIController, url_for from galaxy import web from galaxy.forms.forms import form_factory -from elementtree.ElementTree import XML +from xml.etree.ElementTree import XML log = logging.getLogger( __name__ ) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/webapps/galaxy/api/request_types.py --- a/lib/galaxy/webapps/galaxy/api/request_types.py +++ b/lib/galaxy/webapps/galaxy/api/request_types.py @@ -5,7 +5,7 @@ from galaxy.web.base.controller import BaseAPIController, url_for from galaxy import web from galaxy.sample_tracking.request_types import request_type_factory -from elementtree.ElementTree import XML +from xml.etree.ElementTree import XML log = logging.getLogger( __name__ ) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/webapps/galaxy/controllers/forms.py --- a/lib/galaxy/webapps/galaxy/controllers/forms.py +++ b/lib/galaxy/webapps/galaxy/controllers/forms.py @@ -5,7 +5,7 @@ import logging, os, sys from galaxy.web.form_builder import * from galaxy.tools.parameters.basic import parameter_types -from elementtree.ElementTree import XML, Element +from xml.etree.ElementTree import XML, Element from galaxy.util.odict import odict import copy from galaxy.web.framework.helpers import time_ago, iff, grids @@ -65,7 +65,7 @@ global_actions = [ grids.GridAction( "Create new form", dict( controller='forms', action='create_form_definition' ) ) ] - + def build_initial_query( self, trans, **kwargs ): return trans.sa_session.query( self.model_class ).join (model.FormDefinition, self.model_class.latest_form_id == model.FormDefinition.id) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 lib/galaxy/workflow/modules.py --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -6,9 +6,8 @@ import re from galaxy import eggs -eggs.require( "elementtree" ) -from elementtree.ElementTree import Element +from xml.etree.ElementTree import Element import galaxy.tools from galaxy import exceptions diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 scripts/loc_files/create_all_fasta_loc.py --- a/scripts/loc_files/create_all_fasta_loc.py +++ b/scripts/loc_files/create_all_fasta_loc.py @@ -1,5 +1,5 @@ import optparse, os, sys -import elementtree.ElementTree as etree +from xml.etree.ElementTree import parse """ Generates a loc file containing names of all the fasta files that match the @@ -212,7 +212,7 @@ # get column names col_values = [] loc_path = None - tree = etree.parse( options.data_table_xml ) + tree = parse( options.data_table_xml ) tables = tree.getroot() for table in tables.getiterator(): name = table.attrib.get( 'name' ) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 scripts/microbes/ncbi_to_ucsc.py --- a/scripts/microbes/ncbi_to_ucsc.py +++ b/scripts/microbes/ncbi_to_ucsc.py @@ -7,7 +7,7 @@ import sys, os import urllib -from elementtree import ElementTree +from xml.etree import ElementTree from BeautifulSoup import BeautifulSoup from shutil import move @@ -17,7 +17,7 @@ base_dir = sys.argv[1] except: print "using default base_dir:", base_dir - + organisms = {} for result in os.walk(base_dir): this_base_dir,sub_dirs,files = result @@ -76,7 +76,7 @@ org_page.pop(0) if org_page[-1]=="": org_page.pop(-1) - + for row in org_page: chr = row.split("</a>")[0].split(">")[-1] refseq = row.split("</a>")[-2].split(">")[-1] @@ -87,20 +87,20 @@ builds[org]={'chrs':{},'build':build} builds[org]['chrs'][refseq]=chr #print build,org,chr,refseq - + print ext_to_edit = ['bed', 'info', ] for org in builds: print org,"changed to",builds[org]['build'] - + #org info file info_file_old = os.path.join(base_dir+org,org+".info") info_file_new = os.path.join(base_dir+org,builds[org]['build']+".info") - - + + old_dir = base_dir+org new_dir = base_dir+builds[org]['build'] - + #open and edit org info file info_file_contents = open(info_file_old).read() info_file_contents = info_file_contents+"build="+builds[org]['build']+"\n" @@ -114,31 +114,31 @@ old_name = os.path.join(this_base_dir,file) new_name = os.path.join(this_base_dir,builds[org]['chrs'][chrom]+file[len(chrom):]) move(old_name,new_name) - + #edit contents of file, skiping those in list if file.split(".")[-1] not in ext_to_edit: continue - + file_contents = open(new_name).read() file_contents = file_contents.replace(chrom,builds[org]['chrs'][chrom]) - + #special case fixes... if file[-5:] == ".info": file_contents = file_contents.replace("organism="+org,"organism="+builds[org]['build']) file_contents = file_contents.replace("refseq="+builds[org]['chrs'][chrom],"refseq="+chrom) - + #write out new file file_out = open(new_name,'w') file_out.write(file_contents) file_out.close() - - - + + + #write out org info file and remove old file org_info_out = open(info_file_new,'w') org_info_out.write(info_file_contents) org_info_out.close() os.unlink(info_file_old) - + #change org directory name move(old_dir,new_dir) diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 test/base/asserts/xml.py --- a/test/base/asserts/xml.py +++ b/test/base/asserts/xml.py @@ -1,10 +1,10 @@ -import elementtree.ElementTree +import xml.etree import re # Helper functions used to work with XML output. def to_xml(output): - return elementtree.ElementTree.fromstring(output) + return xml.etree.fromstring(output) def xml_find_text(output, path): @@ -31,8 +31,7 @@ def assert_has_element_with_path(output, path): """ Asserts the specified output has at least one XML element with a path matching the specified path argument. Valid paths are the - simplified subsets of XPath implemented by elementtree (currently - Galaxy makes use of elementtree 1.2). See + simplified subsets of XPath implemented by xml.etree; http://effbot.org/zone/element-xpath.htm for more information.""" if xml_find(output, path) is None: errmsg = "Expected to find XML element matching expression %s, not such match was found." % path @@ -74,13 +73,13 @@ errmsg = "Expected attribute '%s' on element with path '%s' to match '%s', instead attribute value was '%s'." % (attribute, path, expression, attribute_value) raise AssertionError(errmsg) - + def assert_attribute_is(output, path, attribute, text): """ Asserts the specified attribute of the first element matching the specified path matches exactly the specified text.""" assert_attribute_matches(output, path, attribute, re.escape(text)) - + def assert_element_text(output, path, verify_assertions_function, children): """ Recursively checks the specified assertions against the text of the first element matching the specified path.""" diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 test/base/twilltestcase.py --- a/test/base/twilltestcase.py +++ b/test/base/twilltestcase.py @@ -22,10 +22,9 @@ from urlparse import urlparse from galaxy import eggs -eggs.require( "elementtree" ) eggs.require( 'twill' ) -from elementtree import ElementTree +from xml.etree import ElementTree import twill import twill.commands as tc diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 test/unit/tools/test_actions.py --- a/test/unit/tools/test_actions.py +++ b/test/unit/tools/test_actions.py @@ -6,7 +6,7 @@ from galaxy.tools.actions import DefaultToolAction from galaxy.tools.actions import on_text_for_names from galaxy.tools.actions import determine_output_format -from elementtree.ElementTree import XML +from xml.etree.ElementTree import XML import tools_support diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 test/unit/tools/test_dataset_matcher.py --- a/test/unit/tools/test_dataset_matcher.py +++ b/test/unit/tools/test_dataset_matcher.py @@ -1,12 +1,11 @@ from unittest import TestCase +from xml.etree.ElementTree import XML from galaxy import model from galaxy.util import bunch from galaxy.tools.parameters import basic from galaxy.tools.parameters import dataset_matcher -from elementtree.ElementTree import XML - import tools_support from .test_data_parameters import MockHistoryDatasetAssociation diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 test/unit/tools/test_evaluation.py --- a/test/unit/tools/test_evaluation.py +++ b/test/unit/tools/test_evaluation.py @@ -1,6 +1,7 @@ import os +from xml.etree.ElementTree import XML +from unittest import TestCase -from unittest import TestCase from galaxy.model import Job from galaxy.model import History from galaxy.model import Dataset @@ -21,7 +22,6 @@ from galaxy.tools.parameters.basic import IntegerToolParameter from galaxy.tools.parameters.basic import SelectToolParameter from galaxy.tools.parameters.basic import DataToolParameter -from elementtree.ElementTree import XML # Import after model, to ensure elementtree # Test fixtures for Galaxy infrastructure. diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 test/unit/tools/test_parameter_parsing.py --- a/test/unit/tools/test_parameter_parsing.py +++ b/test/unit/tools/test_parameter_parsing.py @@ -2,7 +2,7 @@ from galaxy.tools.parameters import basic from galaxy.util import bunch -from elementtree.ElementTree import XML +from xml.etree.ElementTree import XML import tools_support diff -r c8da6ac751e7ba5c7eddd5dd3231bd914ecd5ba2 -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 test/unit/tools/test_wrappers.py --- a/test/unit/tools/test_wrappers.py +++ b/test/unit/tools/test_wrappers.py @@ -10,7 +10,7 @@ from galaxy.tools.wrappers import DatasetFilenameWrapper from galaxy.jobs.datasets import DatasetPath from galaxy.util.bunch import Bunch -from elementtree.ElementTree import XML +from xml.etree.ElementTree import XML from galaxy.datatypes.metadata import MetadataSpecCollection https://bitbucket.org/galaxy/galaxy-central/commits/cfb7985afbea/ Changeset: cfb7985afbea User: dannon Date: 2015-01-29 21:15:48+00:00 Summary: Add TODO to follow up and simplify logic in tools/loader related to elementtree. Affected #: 1 file diff -r f760a391f14af4a518bbf3b4ef47c9c1c4b1e898 -r cfb7985afbea9726297ebd6076bcd4cb191c8c45 lib/galaxy/tools/loader.py --- a/lib/galaxy/tools/loader.py +++ b/lib/galaxy/tools/loader.py @@ -120,6 +120,7 @@ # HACK for elementtree, newer implementations (etree/lxml) won't # require this parent_map data structure but elementtree does not # track parents or recongnize .find('..'). + # TODO fix this now that we're not using elementtree parent_map = dict((c, p) for p in element.getiterator() for c in p) _xml_replace(expand_el, macro_def, parent_map) https://bitbucket.org/galaxy/galaxy-central/commits/a0c2bd2de611/ Changeset: a0c2bd2de611 User: dannon Date: 2015-01-29 21:22:59+00:00 Summary: Merge. Affected #: 6 files diff -r cfb7985afbea9726297ebd6076bcd4cb191c8c45 -r a0c2bd2de611ab95292f9ae5f759dae9fa4939aa client/galaxy/scripts/mvc/history/history-panel-edit.js --- a/client/galaxy/scripts/mvc/history/history-panel-edit.js +++ b/client/galaxy/scripts/mvc/history/history-panel-edit.js @@ -75,13 +75,17 @@ /** Override to handle history as drag-drop target */ _setUpListeners : function(){ - _super.prototype._setUpListeners.call( this ); + var panel = this; + _super.prototype._setUpListeners.call( panel ); - this.on( 'drop', function( ev, data ){ - this.dataDropped( data ); + panel.on( 'drop', function( ev, data ){ + panel.dataDropped( data ); // remove the drop target - this.dropTargetOff(); + panel.dropTargetOff(); }); + panel.on( 'view:attached view:removed', function(){ + panel._renderCounts(); + }, panel ); }, // ------------------------------------------------------------------------ listeners @@ -332,7 +336,10 @@ // override to control where the view is added, how/whether it's rendered panel.views.unshift( view ); panel.$list().prepend( view.render( 0 ).$el.hide() ); - view.$el.slideDown( panel.fxSpeed ); + panel.trigger( 'view:attached', view ); + view.$el.slideDown( panel.fxSpeed, function(){ + panel.trigger( 'view:attached:rendered' ); + }); }, /** In this override, add purgeAllowed and whether tags/annotation editors should be shown */ diff -r cfb7985afbea9726297ebd6076bcd4cb191c8c45 -r a0c2bd2de611ab95292f9ae5f759dae9fa4939aa client/galaxy/scripts/mvc/list/list-panel.js --- a/client/galaxy/scripts/mvc/list/list-panel.js +++ b/client/galaxy/scripts/mvc/list/list-panel.js @@ -477,7 +477,10 @@ // override to control where the view is added, how/whether it's rendered panel.views.push( view ); panel.$list().append( view.render( 0 ).$el.hide() ); - view.$el.slideDown( panel.fxSpeed ); + panel.trigger( 'view:attached', view ); + view.$el.slideDown( panel.fxSpeed, function(){ + panel.trigger( 'view:attached:rendered' ); + }); }, /** Remove a view from the panel (if found) */ @@ -487,6 +490,7 @@ view = panel.viewFromModel( model ); if( !view ){ return undefined; } panel.views = _.without( panel.views, view ); + panel.trigger( 'view:removed', view ); // potentially show the empty message if no views left // use anonymous queue here - since remove can happen multiple times @@ -494,6 +498,7 @@ function( next ){ view.$el.fadeOut( panel.fxSpeed, next ); }, function( next ){ view.remove(); + panel.trigger( 'view:removed:rendered' ); if( !panel.views.length ){ panel._renderEmptyMessage().fadeIn( panel.fxSpeed, next ); } else { diff -r cfb7985afbea9726297ebd6076bcd4cb191c8c45 -r a0c2bd2de611ab95292f9ae5f759dae9fa4939aa static/scripts/mvc/history/history-panel-edit.js --- a/static/scripts/mvc/history/history-panel-edit.js +++ b/static/scripts/mvc/history/history-panel-edit.js @@ -75,13 +75,17 @@ /** Override to handle history as drag-drop target */ _setUpListeners : function(){ - _super.prototype._setUpListeners.call( this ); + var panel = this; + _super.prototype._setUpListeners.call( panel ); - this.on( 'drop', function( ev, data ){ - this.dataDropped( data ); + panel.on( 'drop', function( ev, data ){ + panel.dataDropped( data ); // remove the drop target - this.dropTargetOff(); + panel.dropTargetOff(); }); + panel.on( 'view:attached view:removed', function(){ + panel._renderCounts(); + }, panel ); }, // ------------------------------------------------------------------------ listeners @@ -332,7 +336,10 @@ // override to control where the view is added, how/whether it's rendered panel.views.unshift( view ); panel.$list().prepend( view.render( 0 ).$el.hide() ); - view.$el.slideDown( panel.fxSpeed ); + panel.trigger( 'view:attached', view ); + view.$el.slideDown( panel.fxSpeed, function(){ + panel.trigger( 'view:attached:rendered' ); + }); }, /** In this override, add purgeAllowed and whether tags/annotation editors should be shown */ diff -r cfb7985afbea9726297ebd6076bcd4cb191c8c45 -r a0c2bd2de611ab95292f9ae5f759dae9fa4939aa static/scripts/mvc/list/list-panel.js --- a/static/scripts/mvc/list/list-panel.js +++ b/static/scripts/mvc/list/list-panel.js @@ -477,7 +477,10 @@ // override to control where the view is added, how/whether it's rendered panel.views.push( view ); panel.$list().append( view.render( 0 ).$el.hide() ); - view.$el.slideDown( panel.fxSpeed ); + panel.trigger( 'view:attached', view ); + view.$el.slideDown( panel.fxSpeed, function(){ + panel.trigger( 'view:attached:rendered' ); + }); }, /** Remove a view from the panel (if found) */ @@ -487,6 +490,7 @@ view = panel.viewFromModel( model ); if( !view ){ return undefined; } panel.views = _.without( panel.views, view ); + panel.trigger( 'view:removed', view ); // potentially show the empty message if no views left // use anonymous queue here - since remove can happen multiple times @@ -494,6 +498,7 @@ function( next ){ view.$el.fadeOut( panel.fxSpeed, next ); }, function( next ){ view.remove(); + panel.trigger( 'view:removed:rendered' ); if( !panel.views.length ){ panel._renderEmptyMessage().fadeIn( panel.fxSpeed, next ); } else { diff -r cfb7985afbea9726297ebd6076bcd4cb191c8c45 -r a0c2bd2de611ab95292f9ae5f759dae9fa4939aa static/scripts/packed/mvc/history/history-panel-edit.js --- a/static/scripts/packed/mvc/history/history-panel-edit.js +++ b/static/scripts/packed/mvc/history/history-panel-edit.js @@ -1,1 +1,1 @@ -define(["mvc/history/history-panel","mvc/history/history-contents","mvc/dataset/states","mvc/history/hda-model","mvc/history/hda-li-edit","mvc/history/hdca-li-edit","mvc/tags","mvc/annotations","ui/fa-icon-button","mvc/ui/popup-menu","utils/localization"],function(h,j,m,f,e,i,l,c,b,a,d){var k=h.HistoryPanel;var g=k.extend({HDAViewClass:e.HDAListItemEdit,HDCAViewClass:i.HDCAListItemEdit,initialize:function(n){n=n||{};k.prototype.initialize.call(this,n);this.tagsEditor=null;this.annotationEditor=null;this.purgeAllowed=n.purgeAllowed||false;this.annotationEditorShown=n.annotationEditorShown||false;this.tagsEditorShown=n.tagsEditorShown||false;this.multiselectActions=n.multiselectActions||this._getActions()},_setUpListeners:function(){k.prototype._setUpListeners.call(this);this.on("drop",function(n,o){this.dataDropped(o);this.dropTargetOff()})},_setUpCollectionListeners:function(){k.prototype._setUpCollectionListeners.call(this);this.collection.on("change:deleted",this._handleHdaDeletionChange,this);this.collection.on("change:visible",this._handleHdaVisibleChange,this);this.collection.on("change:purged",function(n){this.model.fetch()},this);return this},_setUpModelListeners:function(){k.prototype._setUpModelListeners.call(this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);return this},_buildNewRender:function(){var n=k.prototype._buildNewRender.call(this);if(!this.model){return n}if(Galaxy&&Galaxy.currUser&&Galaxy.currUser.id&&Galaxy.currUser.id===this.model.get("user_id")){this._renderTags(n);this._renderAnnotation(n)}return n},renderItems:function(o){var n=k.prototype.renderItems.call(this,o);this._renderCounts(o);return n},_renderCounts:function(p){function o(s,t){return['<a class="',s,'" href="javascript:void(0);">',t,"</a>"].join("")}p=p||this.$el;var n=this.collection.where({deleted:true}),r=this.collection.where({visible:false}),q=[];if(this.views.length){q.push([this.views.length,d("shown")].join(" "))}if(n.length){q.push((!this.showDeleted)?([n.length,o("toggle-deleted-link",d("deleted"))].join(" ")):(o("toggle-deleted-link",d("hide deleted"))))}if(r.length){q.push((!this.showHidden)?([r.length,o("toggle-hidden-link",d("hidden"))].join(" ")):(o("toggle-hidden-link",d("hide hidden"))))}return p.find("> .controls .subtitle").html(q.join(", "))},_renderTags:function(n){var o=this;this.tagsEditor=new l.TagsEditor({model:this.model,el:n.find(".controls .tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){o.toggleHDATagEditors(true,o.fxSpeed)},onhide:function(){o.toggleHDATagEditors(false,o.fxSpeed)},$activator:b({title:d("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(n.find(".controls .actions"))})},_renderAnnotation:function(n){var o=this;this.annotationEditor=new c.AnnotationEditor({model:this.model,el:n.find(".controls .annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){o.toggleHDAAnnotationEditors(true,o.fxSpeed)},onhide:function(){o.toggleHDAAnnotationEditors(false,o.fxSpeed)},$activator:b({title:d("Edit history annotation"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(n.find(".controls .actions"))})},_setUpBehaviors:function(n){n=n||this.$el;k.prototype._setUpBehaviors.call(this,n);if(!this.model){return}if(this.multiselectActions.length){this.actionsPopup=new a(n.find(".list-action-popup-btn"),this.multiselectActions)}if((!Galaxy.currUser||Galaxy.currUser.isAnonymous())||(Galaxy.currUser.id!==this.model.get("user_id"))){return}var o=this,p=".controls .name";n.find(p).attr("title",d("Click to rename history")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(q){var r=o.model.get("name");if(q&&q!==r){o.$el.find(p).text(q);o.model.save({name:q}).fail(function(){o.$el.find(p).text(o.model.previous("name"))})}else{o.$el.find(p).text(r)}}})},_getActions:function(){var n=this,o=[{html:d("Hide datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.hide;n.getSelectedModels().ajaxQueue(p)}},{html:d("Unhide datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.unhide;n.getSelectedModels().ajaxQueue(p)}},{html:d("Delete datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype["delete"];n.getSelectedModels().ajaxQueue(p)}},{html:d("Undelete datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.undelete;n.getSelectedModels().ajaxQueue(p)}}];if(n.purgeAllowed){o.push({html:d("Permanently delete datasets"),func:function(){if(confirm(d("This will permanently remove the data in your datasets. Are you sure?"))){var p=f.HistoryDatasetAssociation.prototype.purge;n.getSelectedModels().ajaxQueue(p)}}})}o.push({html:d("Build Dataset List"),func:function(){n.getSelectedModels().promoteToHistoryDatasetCollection(n.model,"list")}});o.push({html:d("Build Dataset Pair"),func:function(){n.getSelectedModels().promoteToHistoryDatasetCollection(n.model,"paired")}});o.push({html:d("Build List of Dataset Pairs"),func:_.bind(n._showPairedCollectionModal,n)});return o},_showPairedCollectionModal:function(){var n=this,o=n.getSelectedModels().toJSON().filter(function(p){return p.history_content_type==="dataset"&&p.state===m.OK});if(o.length){require(["mvc/collection/paired-collection-creator"],function(p){window.creator=p.pairedCollectionCreatorModal(o,{historyId:n.model.id})})}else{}},_attachItems:function(n){this.$list(n).append(this.views.reverse().map(function(o){return o.$el}));return this},_attachView:function(o){var n=this;n.views.unshift(o);n.$list().prepend(o.render(0).$el.hide());o.$el.slideDown(n.fxSpeed)},_getItemViewOptions:function(o){var n=k.prototype._getItemViewOptions.call(this,o);_.extend(n,{purgeAllowed:this.purgeAllowed,tagsEditorShown:(this.tagsEditor&&!this.tagsEditor.hidden),annotationEditorShown:(this.annotationEditor&&!this.annotationEditor.hidden)});return n},_handleHdaDeletionChange:function(n){if(n.get("deleted")&&!this.showDeleted){this.removeItemView(n)}this._renderCounts()},_handleHdaVisibleChange:function(n){if(n.hidden()&&!this.storage.showHidden){this.removeItemView(n)}this._renderCounts()},toggleHDATagEditors:function(n){var o=Array.prototype.slice.call(arguments,1);_.each(this.views,function(p){if(p.tagsEditor){p.tagsEditor.toggle.apply(p.tagsEditor,o)}})},toggleHDAAnnotationEditors:function(n){var o=Array.prototype.slice.call(arguments,1);_.each(this.views,function(p){if(p.annotationEditor){p.annotationEditor.toggle.apply(p.annotationEditor,o)}})},events:_.extend(_.clone(k.prototype.events),{"click .show-selectors-btn":"toggleSelectors","click .toggle-deleted-link":function(n){this.toggleShowDeleted()},"click .toggle-hidden-link":function(n){this.toggleShowHidden()}}),updateHistoryDiskSize:function(){this.$el.find(".history-size").text(this.model.get("nice_size"))},dropTargetOn:function(){if(this.dropTarget){return this}this.dropTarget=true;var o={dragenter:_.bind(this.dragenter,this),dragover:_.bind(this.dragover,this),dragleave:_.bind(this.dragleave,this),drop:_.bind(this.drop,this)};var p=this._renderDropTarget();this.$list().before([this._renderDropTargetHelp(),p]);for(var n in o){if(o.hasOwnProperty(n)){p.on(n,o[n])}}return this},_renderDropTarget:function(){return $("<div/>").addClass("history-drop-target").css({height:"64px",margin:"0px 10px 10px 10px",border:"1px dashed black","border-radius":"3px"})},_renderDropTargetHelp:function(){return $("<div/>").addClass("history-drop-target-help").css({margin:"10px 10px 4px 10px",color:"grey","font-size":"80%","font-style":"italic"}).text(d("Drag datasets here to copy them to the current history"))},dropTargetOff:function(){if(!this.dropTarget){return this}this.dropTarget=false;this.$(".history-drop-target").remove();this.$(".history-drop-target-help").remove();return this},dropTargetToggle:function(){if(this.dropTarget){this.dropTargetOff()}else{this.dropTargetOn()}return this},dragenter:function(n){n.preventDefault();n.stopPropagation();this.$(".history-drop-target").css("border","2px solid black")},dragover:function(n){n.preventDefault();n.stopPropagation()},dragleave:function(n){n.preventDefault();n.stopPropagation();this.$(".history-drop-target").css("border","1px dashed black")},drop:function(p){p.preventDefault();p.dataTransfer.dropEffect="move";var n=this,q=p.dataTransfer.getData("text");try{q=JSON.parse(q)}catch(o){this.warn("error parsing JSON from drop:",q)}this.trigger("droptarget:drop",p,q,n);return false},dataDropped:function(o){var n=this;if(_.isObject(o)&&o.model_class==="HistoryDatasetAssociation"&&o.id){return n.model.contents.copy(o.id)}return jQuery.when()},toString:function(){return"HistoryPanelEdit("+((this.model)?(this.model.get("name")):(""))+")"}});return{HistoryPanelEdit:g}}); \ No newline at end of file +define(["mvc/history/history-panel","mvc/history/history-contents","mvc/dataset/states","mvc/history/hda-model","mvc/history/hda-li-edit","mvc/history/hdca-li-edit","mvc/tags","mvc/annotations","ui/fa-icon-button","mvc/ui/popup-menu","utils/localization"],function(h,j,m,f,e,i,l,c,b,a,d){var k=h.HistoryPanel;var g=k.extend({HDAViewClass:e.HDAListItemEdit,HDCAViewClass:i.HDCAListItemEdit,initialize:function(n){n=n||{};k.prototype.initialize.call(this,n);this.tagsEditor=null;this.annotationEditor=null;this.purgeAllowed=n.purgeAllowed||false;this.annotationEditorShown=n.annotationEditorShown||false;this.tagsEditorShown=n.tagsEditorShown||false;this.multiselectActions=n.multiselectActions||this._getActions()},_setUpListeners:function(){var n=this;k.prototype._setUpListeners.call(n);n.on("drop",function(o,p){n.dataDropped(p);n.dropTargetOff()});n.on("view:attached view:removed",function(){n._renderCounts()},n)},_setUpCollectionListeners:function(){k.prototype._setUpCollectionListeners.call(this);this.collection.on("change:deleted",this._handleHdaDeletionChange,this);this.collection.on("change:visible",this._handleHdaVisibleChange,this);this.collection.on("change:purged",function(n){this.model.fetch()},this);return this},_setUpModelListeners:function(){k.prototype._setUpModelListeners.call(this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);return this},_buildNewRender:function(){var n=k.prototype._buildNewRender.call(this);if(!this.model){return n}if(Galaxy&&Galaxy.currUser&&Galaxy.currUser.id&&Galaxy.currUser.id===this.model.get("user_id")){this._renderTags(n);this._renderAnnotation(n)}return n},renderItems:function(o){var n=k.prototype.renderItems.call(this,o);this._renderCounts(o);return n},_renderCounts:function(p){function o(s,t){return['<a class="',s,'" href="javascript:void(0);">',t,"</a>"].join("")}p=p||this.$el;var n=this.collection.where({deleted:true}),r=this.collection.where({visible:false}),q=[];if(this.views.length){q.push([this.views.length,d("shown")].join(" "))}if(n.length){q.push((!this.showDeleted)?([n.length,o("toggle-deleted-link",d("deleted"))].join(" ")):(o("toggle-deleted-link",d("hide deleted"))))}if(r.length){q.push((!this.showHidden)?([r.length,o("toggle-hidden-link",d("hidden"))].join(" ")):(o("toggle-hidden-link",d("hide hidden"))))}return p.find("> .controls .subtitle").html(q.join(", "))},_renderTags:function(n){var o=this;this.tagsEditor=new l.TagsEditor({model:this.model,el:n.find(".controls .tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){o.toggleHDATagEditors(true,o.fxSpeed)},onhide:function(){o.toggleHDATagEditors(false,o.fxSpeed)},$activator:b({title:d("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(n.find(".controls .actions"))})},_renderAnnotation:function(n){var o=this;this.annotationEditor=new c.AnnotationEditor({model:this.model,el:n.find(".controls .annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){o.toggleHDAAnnotationEditors(true,o.fxSpeed)},onhide:function(){o.toggleHDAAnnotationEditors(false,o.fxSpeed)},$activator:b({title:d("Edit history annotation"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(n.find(".controls .actions"))})},_setUpBehaviors:function(n){n=n||this.$el;k.prototype._setUpBehaviors.call(this,n);if(!this.model){return}if(this.multiselectActions.length){this.actionsPopup=new a(n.find(".list-action-popup-btn"),this.multiselectActions)}if((!Galaxy.currUser||Galaxy.currUser.isAnonymous())||(Galaxy.currUser.id!==this.model.get("user_id"))){return}var o=this,p=".controls .name";n.find(p).attr("title",d("Click to rename history")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(q){var r=o.model.get("name");if(q&&q!==r){o.$el.find(p).text(q);o.model.save({name:q}).fail(function(){o.$el.find(p).text(o.model.previous("name"))})}else{o.$el.find(p).text(r)}}})},_getActions:function(){var n=this,o=[{html:d("Hide datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.hide;n.getSelectedModels().ajaxQueue(p)}},{html:d("Unhide datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.unhide;n.getSelectedModels().ajaxQueue(p)}},{html:d("Delete datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype["delete"];n.getSelectedModels().ajaxQueue(p)}},{html:d("Undelete datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.undelete;n.getSelectedModels().ajaxQueue(p)}}];if(n.purgeAllowed){o.push({html:d("Permanently delete datasets"),func:function(){if(confirm(d("This will permanently remove the data in your datasets. Are you sure?"))){var p=f.HistoryDatasetAssociation.prototype.purge;n.getSelectedModels().ajaxQueue(p)}}})}o.push({html:d("Build Dataset List"),func:function(){n.getSelectedModels().promoteToHistoryDatasetCollection(n.model,"list")}});o.push({html:d("Build Dataset Pair"),func:function(){n.getSelectedModels().promoteToHistoryDatasetCollection(n.model,"paired")}});o.push({html:d("Build List of Dataset Pairs"),func:_.bind(n._showPairedCollectionModal,n)});return o},_showPairedCollectionModal:function(){var n=this,o=n.getSelectedModels().toJSON().filter(function(p){return p.history_content_type==="dataset"&&p.state===m.OK});if(o.length){require(["mvc/collection/paired-collection-creator"],function(p){window.creator=p.pairedCollectionCreatorModal(o,{historyId:n.model.id})})}else{}},_attachItems:function(n){this.$list(n).append(this.views.reverse().map(function(o){return o.$el}));return this},_attachView:function(o){var n=this;n.views.unshift(o);n.$list().prepend(o.render(0).$el.hide());n.trigger("view:attached",o);o.$el.slideDown(n.fxSpeed,function(){n.trigger("view:attached:rendered")})},_getItemViewOptions:function(o){var n=k.prototype._getItemViewOptions.call(this,o);_.extend(n,{purgeAllowed:this.purgeAllowed,tagsEditorShown:(this.tagsEditor&&!this.tagsEditor.hidden),annotationEditorShown:(this.annotationEditor&&!this.annotationEditor.hidden)});return n},_handleHdaDeletionChange:function(n){if(n.get("deleted")&&!this.showDeleted){this.removeItemView(n)}this._renderCounts()},_handleHdaVisibleChange:function(n){if(n.hidden()&&!this.storage.showHidden){this.removeItemView(n)}this._renderCounts()},toggleHDATagEditors:function(n){var o=Array.prototype.slice.call(arguments,1);_.each(this.views,function(p){if(p.tagsEditor){p.tagsEditor.toggle.apply(p.tagsEditor,o)}})},toggleHDAAnnotationEditors:function(n){var o=Array.prototype.slice.call(arguments,1);_.each(this.views,function(p){if(p.annotationEditor){p.annotationEditor.toggle.apply(p.annotationEditor,o)}})},events:_.extend(_.clone(k.prototype.events),{"click .show-selectors-btn":"toggleSelectors","click .toggle-deleted-link":function(n){this.toggleShowDeleted()},"click .toggle-hidden-link":function(n){this.toggleShowHidden()}}),updateHistoryDiskSize:function(){this.$el.find(".history-size").text(this.model.get("nice_size"))},dropTargetOn:function(){if(this.dropTarget){return this}this.dropTarget=true;var o={dragenter:_.bind(this.dragenter,this),dragover:_.bind(this.dragover,this),dragleave:_.bind(this.dragleave,this),drop:_.bind(this.drop,this)};var p=this._renderDropTarget();this.$list().before([this._renderDropTargetHelp(),p]);for(var n in o){if(o.hasOwnProperty(n)){p.on(n,o[n])}}return this},_renderDropTarget:function(){return $("<div/>").addClass("history-drop-target").css({height:"64px",margin:"0px 10px 10px 10px",border:"1px dashed black","border-radius":"3px"})},_renderDropTargetHelp:function(){return $("<div/>").addClass("history-drop-target-help").css({margin:"10px 10px 4px 10px",color:"grey","font-size":"80%","font-style":"italic"}).text(d("Drag datasets here to copy them to the current history"))},dropTargetOff:function(){if(!this.dropTarget){return this}this.dropTarget=false;this.$(".history-drop-target").remove();this.$(".history-drop-target-help").remove();return this},dropTargetToggle:function(){if(this.dropTarget){this.dropTargetOff()}else{this.dropTargetOn()}return this},dragenter:function(n){n.preventDefault();n.stopPropagation();this.$(".history-drop-target").css("border","2px solid black")},dragover:function(n){n.preventDefault();n.stopPropagation()},dragleave:function(n){n.preventDefault();n.stopPropagation();this.$(".history-drop-target").css("border","1px dashed black")},drop:function(p){p.preventDefault();p.dataTransfer.dropEffect="move";var n=this,q=p.dataTransfer.getData("text");try{q=JSON.parse(q)}catch(o){this.warn("error parsing JSON from drop:",q)}this.trigger("droptarget:drop",p,q,n);return false},dataDropped:function(o){var n=this;if(_.isObject(o)&&o.model_class==="HistoryDatasetAssociation"&&o.id){return n.model.contents.copy(o.id)}return jQuery.when()},toString:function(){return"HistoryPanelEdit("+((this.model)?(this.model.get("name")):(""))+")"}});return{HistoryPanelEdit:g}}); \ No newline at end of file diff -r cfb7985afbea9726297ebd6076bcd4cb191c8c45 -r a0c2bd2de611ab95292f9ae5f759dae9fa4939aa static/scripts/packed/mvc/list/list-panel.js --- a/static/scripts/packed/mvc/list/list-panel.js +++ b/static/scripts/packed/mvc/list/list-panel.js @@ -1,1 +1,1 @@ -define(["mvc/list/list-item","ui/loading-indicator","mvc/base-mvc","utils/localization","ui/search-input"],function(d,f,b,c){var e=Backbone.View.extend(b.LoggableMixin).extend({viewClass:d.ListItemView,collectionClass:Backbone.Collection,tagName:"div",className:"list-panel",fxSpeed:"fast",emptyMsg:c("This list is empty"),noneFoundMsg:c("No matching items found"),searchPlaceholder:c("search"),multiselectActions:[],initialize:function(g,h){g=g||{};if(g.logger){this.logger=g.logger}this.log(this+".initialize:",g);this.fxSpeed=_.has(g,"fxSpeed")?(g.fxSpeed):(this.fxSpeed);this.filters=[];this.searchFor=g.searchFor||"";this.indicator=new f(this.$el);this.selecting=(g.selecting!==undefined)?g.selecting:true;this.selected=g.selected||[];this.lastSelected=null;this.dragItems=g.dragItems||false;this.viewClass=g.viewClass||this.viewClass;this.views=[];this.collection=g.collection||(new this.collectionClass([]));this.filters=g.filters||[];this.$scrollContainer=g.$scrollContainer||this.$scrollContainer;this.title=g.title||"";this.subtitle=g.subtitle||"";this.multiselectActions=g.multiselectActions||this.multiselectActions;this.actionsPopup=null;this._setUpListeners()},freeViews:function(){_.each(this.views,function(g){g.off()});this.views=[];return this},_setUpListeners:function(){this.off();this.on("error",function(h,k,g,j,i){console.error(h,k,g,j,i)},this);this.on("loading",function(){this._showLoadingIndicator("loading...",40)},this);this.on("loading-done",function(){this._hideLoadingIndicator(40)},this);this.once("rendered",function(){this.trigger("rendered:initial",this)},this);if(this.logger){this.on("all",function(g){this.log(this+"",arguments)},this)}this._setUpCollectionListeners();this._setUpViewListeners();return this},_setUpCollectionListeners:function(){this.log(this+"._setUpCollectionListeners",this.collection);this.collection.off();this.collection.on("error",function(h,k,g,j,i){this.trigger("error",h,k,g,j,i)},this);this.collection.on("reset",function(){this.renderItems()},this);this.collection.on("add",this.addItemView,this);this.collection.on("remove",this.removeItemView,this);if(this.logger){this.collection.on("all",function(g){this.info(this+"(collection)",arguments)},this)}return this},_setUpViewListeners:function(){this.log(this+"._setUpViewListeners");this.on("view:selected",function(g,h){if(h&&h.shiftKey&&this.lastSelected){var i=this.viewFromModelId(this.lastSelected);if(i){this.selectRange(g,i)}}else{if(h&&h.altKey&&!this.selecting){this.showSelectors()}}this.selected.push(g.model.id);this.lastSelected=g.model.id},this);this.on("view:de-selected",function(g,h){this.selected=_.without(this.selected,g.model.id)},this)},render:function(h){this.log(this+".render",h);var g=this._buildNewRender();this._setUpBehaviors(g);this._queueNewRender(g,h);return this},_buildNewRender:function(){this.debug(this+"(ListPanel)._buildNewRender");var g=$(this.templates.el({},this));this._renderControls(g);this._renderTitle(g);this._renderSubtitle(g);this._renderSearch(g);this.renderItems(g);return g},_renderControls:function(h){this.debug(this+"(ListPanel)._renderControls");var g=$(this.templates.controls({},this));h.find(".controls").replaceWith(g);return g},_renderTitle:function(g){},_renderSubtitle:function(g){},_queueNewRender:function(h,i){i=(i===undefined)?(this.fxSpeed):(i);var g=this;g.log("_queueNewRender:",h,i);$(g).queue("fx",[function(j){this.$el.fadeOut(i,j)},function(j){g._swapNewRender(h);j()},function(j){this.$el.fadeIn(i,j)},function(j){g.trigger("rendered",g);j()}])},_swapNewRender:function(g){this.$el.empty().attr("class",this.className).append(g.children());if(this.selecting){this.showSelectors(0)}return this},_setUpBehaviors:function(g){g=g||this.$el;g.find(".controls [title]").tooltip({placement:"bottom"});return this},$scrollContainer:function(){return this.$el.parent().parent()},$list:function(g){return(g||this.$el).find("> .list-items")},$messages:function(g){return(g||this.$el).find("> .controls .messages")},$emptyMessage:function(g){return(g||this.$el).find("> .empty-message")},renderItems:function(i){i=i||this.$el;var g=this;g.log(this+".renderItems",i);var h=g.$list(i);g.views=g._filterCollection().map(function(j){return g._createItemView(j).render(0)});h.empty();if(g.views.length){g._attachItems(i);g.$emptyMessage(i).hide()}else{g._renderEmptyMessage(i).show()}return g.views},_filterCollection:function(){var g=this;return g.collection.filter(_.bind(g._filterItem,g))},_filterItem:function(h){var g=this;return(_.every(g.filters.map(function(i){return i.call(h)})))&&(!g.searchFor||h.matchesAll(g.searchFor))},_createItemView:function(i){var j=this._getItemViewClass(i),h=_.extend(this._getItemViewOptions(i),{model:i}),g=new j(h);this._setUpItemViewListeners(g);return g},_getItemViewClass:function(g){return this.viewClass},_getItemViewOptions:function(g){return{fxSpeed:this.fxSpeed,expanded:false,selectable:this.selecting,selected:_.contains(this.selected,g.id),draggable:this.dragItems}},_setUpItemViewListeners:function(h){var g=this;h.on("all",function(){var i=Array.prototype.slice.call(arguments,0);i[0]="view:"+i[0];g.trigger.apply(g,i)});h.on("draggable:dragstart",function(l,i){var j={},k=this.getSelectedModels();if(k.length){j=k.toJSON()}else{j=[i.model.toJSON()]}l.dataTransfer.setData("text",JSON.stringify(j))},this);return g},_attachItems:function(g){this.$list(g).append(this.views.map(function(h){return h.$el}));return this},_renderEmptyMessage:function(g){this.debug("_renderEmptyMessage",g,this.searchFor);var h=this.searchFor?this.noneFoundMsg:this.emptyMsg;return this.$emptyMessage(g).text(h)},expandAll:function(){_.each(this.views,function(g){g.expand()})},collapseAll:function(){_.each(this.views,function(g){g.collapse()})},addItemView:function(j,k,i){this.log(this+".addItemView:",j);var h=this;if(!h._filterItem(j)){return undefined}var g=h._createItemView(j);$(g).queue("fx",[function(l){h.$emptyMessage().fadeOut(h.fxSpeed,l)},function(l){h._attachView(g);l()}]);return g},_attachView:function(h){var g=this;g.views.push(h);g.$list().append(h.render(0).$el.hide());h.$el.slideDown(g.fxSpeed)},removeItemView:function(j,k,i){this.log(this+".removeItemView:",j);var h=this,g=h.viewFromModel(j);if(!g){return undefined}h.views=_.without(h.views,g);$({}).queue("fx",[function(l){g.$el.fadeOut(h.fxSpeed,l)},function(l){g.remove();if(!h.views.length){h._renderEmptyMessage().fadeIn(h.fxSpeed,l)}else{l()}}]);return g},viewFromModelId:function(h){for(var g=0;g<this.views.length;g++){if(this.views[g].model.id===h){return this.views[g]}}return undefined},viewFromModel:function(g){if(!g){return undefined}return this.viewFromModelId(g.id)},viewsWhereModel:function(g){return this.views.filter(function(h){var j=h.model.toJSON();for(var i in g){if(g.hasOwnProperty(i)){if(j[i]!==h.model.get(i)){return false}}}return true})},viewRange:function(j,i){if(j===i){return(j)?([j]):([])}var h=this.views.indexOf(j),g=this.views.indexOf(i);if(h===-1||g===-1){if(h===g){return[]}return(h===-1)?([i]):([j])}return(h<g)?this.views.slice(h,g+1):this.views.slice(g,h+1)},_renderSearch:function(g){g.find(".controls .search-input").searchInput({placeholder:this.searchPlaceholder,initialVal:this.searchFor,onfirstsearch:_.bind(this._firstSearch,this),onsearch:_.bind(this.searchItems,this),onclear:_.bind(this.clearSearch,this)});return g},_firstSearch:function(g){this.log("onFirstSearch",g);return this.searchItems(g)},searchItems:function(g){this.searchFor=g;this.trigger("search:searching",g,this);this.renderItems();this.$("> .controls .search-query").val(g);return this},clearSearch:function(g){this.searchFor="";this.trigger("search:clear",this);this.renderItems();this.$("> .controls .search-query").val("");return this},showSelectors:function(g){g=(g!==undefined)?(g):(this.fxSpeed);this.selecting=true;this.$(".list-actions").slideDown(g);_.each(this.views,function(h){h.showSelector(g)})},hideSelectors:function(g){g=(g!==undefined)?(g):(this.fxSpeed);this.selecting=false;this.$(".list-actions").slideUp(g);_.each(this.views,function(h){h.hideSelector(g)});this.selected=[];this.lastSelected=null},toggleSelectors:function(){if(!this.selecting){this.showSelectors()}else{this.hideSelectors()}},selectAll:function(g){_.each(this.views,function(h){h.select(g)})},deselectAll:function(g){this.lastSelected=null;_.each(this.views,function(h){h.deselect(g)})},selectRange:function(i,h){var g=this.viewRange(i,h);_.each(g,function(j){j.select()});return g},getSelectedViews:function(){return _.filter(this.views,function(g){return g.selected})},getSelectedModels:function(){return new this.collection.constructor(_.map(this.getSelectedViews(),function(g){return g.model}))},_showLoadingIndicator:function(h,g,i){this.debug("_showLoadingIndicator",this.indicator,h,g,i);g=(g!==undefined)?(g):(this.fxSpeed);if(!this.indicator){this.indicator=new f(this.$el,this.$el.parent());this.debug("\t created",this.indicator)}if(!this.$el.is(":visible")){this.indicator.show(0,i)}else{this.$el.fadeOut(g);this.indicator.show(h,g,i)}},_hideLoadingIndicator:function(g,h){this.debug("_hideLoadingIndicator",this.indicator,g,h);g=(g!==undefined)?(g):(this.fxSpeed);if(this.indicator){this.indicator.hide(g,h)}},scrollPosition:function(){return this.$scrollContainer().scrollTop()},scrollTo:function(h,g){g=g||0;this.$scrollContainer().animate({scrollTop:h},g);return this},scrollToTop:function(g){return this.scrollTo(0,g)},scrollToItem:function(g,i){if(!g){return this}var h=g.$el.position().top;return this.scrollTo(h,i)},scrollToId:function(h,g){return this.scrollToItem(this.viewFromModelId(h),g)},events:{"click .select-all":"selectAll","click .deselect-all":"deselectAll"},toString:function(){return"ListPanel("+this.collection+")"}});e.prototype.templates=(function(){var h=b.wrapTemplate(["<div>",'<div class="controls"></div>','<div class="list-items"></div>','<div class="empty-message infomessagesmall"></div>',"</div>"]);var g=b.wrapTemplate(['<div class="controls">','<div class="title">','<div class="name"><%= view.title %></div>',"</div>",'<div class="subtitle"><%= view.subtitle %></div>','<div class="actions"></div>','<div class="messages"></div>','<div class="search">','<div class="search-input"></div>',"</div>",'<div class="list-actions">','<div class="btn-group">','<button class="select-all btn btn-default"','data-mode="select">',c("All"),"</button>",'<button class="deselect-all btn btn-default"','data-mode="select">',c("None"),"</button>","</div>","</div>","</div>"]);return{el:h,controls:g}}());var a=e.extend({modelCollectionKey:"contents",initialize:function(g){e.prototype.initialize.call(this,g);this.selecting=(g.selecting!==undefined)?g.selecting:false;this.setModel(this.model,g)},setModel:function(h,g){g=g||{};this.debug(this+".setModel:",h,g);this.freeModel();this.freeViews();if(h){var i=this.model?this.model.get("id"):null;this.model=h;if(this.logger){this.model.logger=this.logger}this._setUpModelListeners();this.collection.off();this.collection=(this.model[this.modelCollectionKey])?this.model[this.modelCollectionKey]:(g.collection||(new this.collectionClass([])));this._setUpCollectionListeners();if(i&&h.get("id")!==i){this.trigger("new-model",this)}}return this},freeModel:function(){if(this.model){this.stopListening(this.model)}return this},_setUpModelListeners:function(){this.log(this+"._setUpModelListeners",this.model);this.model.on("error",function(){var g=Array.prototype.slice.call(arguments,0);g.unshift("error");this.trigger.apply(this,g)},this);return this},_renderControls:function(h){this.debug(this+"(ListPanel)._renderControls");var i=this.model?this.model.toJSON():{},g=$(this.templates.controls(i,this));h.find(".controls").replaceWith(g);return g},toString:function(){return"ModelListPanel("+this.model+")"}});a.prototype.templates=(function(){var g=b.wrapTemplate(['<div class="controls">','<div class="title">','<div class="name"><%= model.name %></div>',"</div>",'<div class="subtitle"><%= view.subtitle %></div>','<div class="actions"></div>','<div class="messages"></div>','<div class="search">','<div class="search-input"></div>',"</div>",'<div class="list-actions">','<div class="btn-group">','<button class="select-all btn btn-default"','data-mode="select">',c("All"),"</button>",'<button class="deselect-all btn btn-default"','data-mode="select">',c("None"),"</button>","</div>","</div>","</div>"]);return _.extend(_.clone(e.prototype.templates),{controls:g})}());return{ListPanel:e,ModelListPanel:a}}); \ No newline at end of file +define(["mvc/list/list-item","ui/loading-indicator","mvc/base-mvc","utils/localization","ui/search-input"],function(d,f,b,c){var e=Backbone.View.extend(b.LoggableMixin).extend({viewClass:d.ListItemView,collectionClass:Backbone.Collection,tagName:"div",className:"list-panel",fxSpeed:"fast",emptyMsg:c("This list is empty"),noneFoundMsg:c("No matching items found"),searchPlaceholder:c("search"),multiselectActions:[],initialize:function(g,h){g=g||{};if(g.logger){this.logger=g.logger}this.log(this+".initialize:",g);this.fxSpeed=_.has(g,"fxSpeed")?(g.fxSpeed):(this.fxSpeed);this.filters=[];this.searchFor=g.searchFor||"";this.indicator=new f(this.$el);this.selecting=(g.selecting!==undefined)?g.selecting:true;this.selected=g.selected||[];this.lastSelected=null;this.dragItems=g.dragItems||false;this.viewClass=g.viewClass||this.viewClass;this.views=[];this.collection=g.collection||(new this.collectionClass([]));this.filters=g.filters||[];this.$scrollContainer=g.$scrollContainer||this.$scrollContainer;this.title=g.title||"";this.subtitle=g.subtitle||"";this.multiselectActions=g.multiselectActions||this.multiselectActions;this.actionsPopup=null;this._setUpListeners()},freeViews:function(){_.each(this.views,function(g){g.off()});this.views=[];return this},_setUpListeners:function(){this.off();this.on("error",function(h,k,g,j,i){console.error(h,k,g,j,i)},this);this.on("loading",function(){this._showLoadingIndicator("loading...",40)},this);this.on("loading-done",function(){this._hideLoadingIndicator(40)},this);this.once("rendered",function(){this.trigger("rendered:initial",this)},this);if(this.logger){this.on("all",function(g){this.log(this+"",arguments)},this)}this._setUpCollectionListeners();this._setUpViewListeners();return this},_setUpCollectionListeners:function(){this.log(this+"._setUpCollectionListeners",this.collection);this.collection.off();this.collection.on("error",function(h,k,g,j,i){this.trigger("error",h,k,g,j,i)},this);this.collection.on("reset",function(){this.renderItems()},this);this.collection.on("add",this.addItemView,this);this.collection.on("remove",this.removeItemView,this);if(this.logger){this.collection.on("all",function(g){this.info(this+"(collection)",arguments)},this)}return this},_setUpViewListeners:function(){this.log(this+"._setUpViewListeners");this.on("view:selected",function(g,h){if(h&&h.shiftKey&&this.lastSelected){var i=this.viewFromModelId(this.lastSelected);if(i){this.selectRange(g,i)}}else{if(h&&h.altKey&&!this.selecting){this.showSelectors()}}this.selected.push(g.model.id);this.lastSelected=g.model.id},this);this.on("view:de-selected",function(g,h){this.selected=_.without(this.selected,g.model.id)},this)},render:function(h){this.log(this+".render",h);var g=this._buildNewRender();this._setUpBehaviors(g);this._queueNewRender(g,h);return this},_buildNewRender:function(){this.debug(this+"(ListPanel)._buildNewRender");var g=$(this.templates.el({},this));this._renderControls(g);this._renderTitle(g);this._renderSubtitle(g);this._renderSearch(g);this.renderItems(g);return g},_renderControls:function(h){this.debug(this+"(ListPanel)._renderControls");var g=$(this.templates.controls({},this));h.find(".controls").replaceWith(g);return g},_renderTitle:function(g){},_renderSubtitle:function(g){},_queueNewRender:function(h,i){i=(i===undefined)?(this.fxSpeed):(i);var g=this;g.log("_queueNewRender:",h,i);$(g).queue("fx",[function(j){this.$el.fadeOut(i,j)},function(j){g._swapNewRender(h);j()},function(j){this.$el.fadeIn(i,j)},function(j){g.trigger("rendered",g);j()}])},_swapNewRender:function(g){this.$el.empty().attr("class",this.className).append(g.children());if(this.selecting){this.showSelectors(0)}return this},_setUpBehaviors:function(g){g=g||this.$el;g.find(".controls [title]").tooltip({placement:"bottom"});return this},$scrollContainer:function(){return this.$el.parent().parent()},$list:function(g){return(g||this.$el).find("> .list-items")},$messages:function(g){return(g||this.$el).find("> .controls .messages")},$emptyMessage:function(g){return(g||this.$el).find("> .empty-message")},renderItems:function(i){i=i||this.$el;var g=this;g.log(this+".renderItems",i);var h=g.$list(i);g.views=g._filterCollection().map(function(j){return g._createItemView(j).render(0)});h.empty();if(g.views.length){g._attachItems(i);g.$emptyMessage(i).hide()}else{g._renderEmptyMessage(i).show()}return g.views},_filterCollection:function(){var g=this;return g.collection.filter(_.bind(g._filterItem,g))},_filterItem:function(h){var g=this;return(_.every(g.filters.map(function(i){return i.call(h)})))&&(!g.searchFor||h.matchesAll(g.searchFor))},_createItemView:function(i){var j=this._getItemViewClass(i),h=_.extend(this._getItemViewOptions(i),{model:i}),g=new j(h);this._setUpItemViewListeners(g);return g},_getItemViewClass:function(g){return this.viewClass},_getItemViewOptions:function(g){return{fxSpeed:this.fxSpeed,expanded:false,selectable:this.selecting,selected:_.contains(this.selected,g.id),draggable:this.dragItems}},_setUpItemViewListeners:function(h){var g=this;h.on("all",function(){var i=Array.prototype.slice.call(arguments,0);i[0]="view:"+i[0];g.trigger.apply(g,i)});h.on("draggable:dragstart",function(l,i){var j={},k=this.getSelectedModels();if(k.length){j=k.toJSON()}else{j=[i.model.toJSON()]}l.dataTransfer.setData("text",JSON.stringify(j))},this);return g},_attachItems:function(g){this.$list(g).append(this.views.map(function(h){return h.$el}));return this},_renderEmptyMessage:function(g){this.debug("_renderEmptyMessage",g,this.searchFor);var h=this.searchFor?this.noneFoundMsg:this.emptyMsg;return this.$emptyMessage(g).text(h)},expandAll:function(){_.each(this.views,function(g){g.expand()})},collapseAll:function(){_.each(this.views,function(g){g.collapse()})},addItemView:function(j,k,i){this.log(this+".addItemView:",j);var h=this;if(!h._filterItem(j)){return undefined}var g=h._createItemView(j);$(g).queue("fx",[function(l){h.$emptyMessage().fadeOut(h.fxSpeed,l)},function(l){h._attachView(g);l()}]);return g},_attachView:function(h){var g=this;g.views.push(h);g.$list().append(h.render(0).$el.hide());g.trigger("view:attached",h);h.$el.slideDown(g.fxSpeed,function(){g.trigger("view:attached:rendered")})},removeItemView:function(j,k,i){this.log(this+".removeItemView:",j);var h=this,g=h.viewFromModel(j);if(!g){return undefined}h.views=_.without(h.views,g);h.trigger("view:removed",g);$({}).queue("fx",[function(l){g.$el.fadeOut(h.fxSpeed,l)},function(l){g.remove();h.trigger("view:removed:rendered");if(!h.views.length){h._renderEmptyMessage().fadeIn(h.fxSpeed,l)}else{l()}}]);return g},viewFromModelId:function(h){for(var g=0;g<this.views.length;g++){if(this.views[g].model.id===h){return this.views[g]}}return undefined},viewFromModel:function(g){if(!g){return undefined}return this.viewFromModelId(g.id)},viewsWhereModel:function(g){return this.views.filter(function(h){var j=h.model.toJSON();for(var i in g){if(g.hasOwnProperty(i)){if(j[i]!==h.model.get(i)){return false}}}return true})},viewRange:function(j,i){if(j===i){return(j)?([j]):([])}var h=this.views.indexOf(j),g=this.views.indexOf(i);if(h===-1||g===-1){if(h===g){return[]}return(h===-1)?([i]):([j])}return(h<g)?this.views.slice(h,g+1):this.views.slice(g,h+1)},_renderSearch:function(g){g.find(".controls .search-input").searchInput({placeholder:this.searchPlaceholder,initialVal:this.searchFor,onfirstsearch:_.bind(this._firstSearch,this),onsearch:_.bind(this.searchItems,this),onclear:_.bind(this.clearSearch,this)});return g},_firstSearch:function(g){this.log("onFirstSearch",g);return this.searchItems(g)},searchItems:function(g){this.searchFor=g;this.trigger("search:searching",g,this);this.renderItems();this.$("> .controls .search-query").val(g);return this},clearSearch:function(g){this.searchFor="";this.trigger("search:clear",this);this.renderItems();this.$("> .controls .search-query").val("");return this},showSelectors:function(g){g=(g!==undefined)?(g):(this.fxSpeed);this.selecting=true;this.$(".list-actions").slideDown(g);_.each(this.views,function(h){h.showSelector(g)})},hideSelectors:function(g){g=(g!==undefined)?(g):(this.fxSpeed);this.selecting=false;this.$(".list-actions").slideUp(g);_.each(this.views,function(h){h.hideSelector(g)});this.selected=[];this.lastSelected=null},toggleSelectors:function(){if(!this.selecting){this.showSelectors()}else{this.hideSelectors()}},selectAll:function(g){_.each(this.views,function(h){h.select(g)})},deselectAll:function(g){this.lastSelected=null;_.each(this.views,function(h){h.deselect(g)})},selectRange:function(i,h){var g=this.viewRange(i,h);_.each(g,function(j){j.select()});return g},getSelectedViews:function(){return _.filter(this.views,function(g){return g.selected})},getSelectedModels:function(){return new this.collection.constructor(_.map(this.getSelectedViews(),function(g){return g.model}))},_showLoadingIndicator:function(h,g,i){this.debug("_showLoadingIndicator",this.indicator,h,g,i);g=(g!==undefined)?(g):(this.fxSpeed);if(!this.indicator){this.indicator=new f(this.$el,this.$el.parent());this.debug("\t created",this.indicator)}if(!this.$el.is(":visible")){this.indicator.show(0,i)}else{this.$el.fadeOut(g);this.indicator.show(h,g,i)}},_hideLoadingIndicator:function(g,h){this.debug("_hideLoadingIndicator",this.indicator,g,h);g=(g!==undefined)?(g):(this.fxSpeed);if(this.indicator){this.indicator.hide(g,h)}},scrollPosition:function(){return this.$scrollContainer().scrollTop()},scrollTo:function(h,g){g=g||0;this.$scrollContainer().animate({scrollTop:h},g);return this},scrollToTop:function(g){return this.scrollTo(0,g)},scrollToItem:function(g,i){if(!g){return this}var h=g.$el.position().top;return this.scrollTo(h,i)},scrollToId:function(h,g){return this.scrollToItem(this.viewFromModelId(h),g)},events:{"click .select-all":"selectAll","click .deselect-all":"deselectAll"},toString:function(){return"ListPanel("+this.collection+")"}});e.prototype.templates=(function(){var h=b.wrapTemplate(["<div>",'<div class="controls"></div>','<div class="list-items"></div>','<div class="empty-message infomessagesmall"></div>',"</div>"]);var g=b.wrapTemplate(['<div class="controls">','<div class="title">','<div class="name"><%= view.title %></div>',"</div>",'<div class="subtitle"><%= view.subtitle %></div>','<div class="actions"></div>','<div class="messages"></div>','<div class="search">','<div class="search-input"></div>',"</div>",'<div class="list-actions">','<div class="btn-group">','<button class="select-all btn btn-default"','data-mode="select">',c("All"),"</button>",'<button class="deselect-all btn btn-default"','data-mode="select">',c("None"),"</button>","</div>","</div>","</div>"]);return{el:h,controls:g}}());var a=e.extend({modelCollectionKey:"contents",initialize:function(g){e.prototype.initialize.call(this,g);this.selecting=(g.selecting!==undefined)?g.selecting:false;this.setModel(this.model,g)},setModel:function(h,g){g=g||{};this.debug(this+".setModel:",h,g);this.freeModel();this.freeViews();if(h){var i=this.model?this.model.get("id"):null;this.model=h;if(this.logger){this.model.logger=this.logger}this._setUpModelListeners();this.collection.off();this.collection=(this.model[this.modelCollectionKey])?this.model[this.modelCollectionKey]:(g.collection||(new this.collectionClass([])));this._setUpCollectionListeners();if(i&&h.get("id")!==i){this.trigger("new-model",this)}}return this},freeModel:function(){if(this.model){this.stopListening(this.model)}return this},_setUpModelListeners:function(){this.log(this+"._setUpModelListeners",this.model);this.model.on("error",function(){var g=Array.prototype.slice.call(arguments,0);g.unshift("error");this.trigger.apply(this,g)},this);return this},_renderControls:function(h){this.debug(this+"(ListPanel)._renderControls");var i=this.model?this.model.toJSON():{},g=$(this.templates.controls(i,this));h.find(".controls").replaceWith(g);return g},toString:function(){return"ModelListPanel("+this.model+")"}});a.prototype.templates=(function(){var g=b.wrapTemplate(['<div class="controls">','<div class="title">','<div class="name"><%= model.name %></div>',"</div>",'<div class="subtitle"><%= view.subtitle %></div>','<div class="actions"></div>','<div class="messages"></div>','<div class="search">','<div class="search-input"></div>',"</div>",'<div class="list-actions">','<div class="btn-group">','<button class="select-all btn btn-default"','data-mode="select">',c("All"),"</button>",'<button class="deselect-all btn btn-default"','data-mode="select">',c("None"),"</button>","</div>","</div>","</div>"]);return _.extend(_.clone(e.prototype.templates),{controls:g})}());return{ListPanel:e,ModelListPanel:a}}); \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.