4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/b63caa7dfa98/
Changeset: b63caa7dfa98
Branch: next-stable
User: dannon
Date: 2015-02-17 20:18:08+00:00
Summary: Fix xml.etree relative import error happening in test/asserts/xml.py
Affected #: 1 file
diff -r b6d15f14d0b392c4e9d9db56129bc67d6d4ba26b -r b63caa7dfa9865430d87d6023efd45ccf02228ca test/base/asserts/xml.py
--- a/test/base/asserts/xml.py
+++ b/test/base/asserts/xml.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
import xml.etree
import re
https://bitbucket.org/galaxy/galaxy-central/commits/9f2731b49115/
Changeset: 9f2731b49115
User: dannon
Date: 2015-02-17 20:18:45+00:00
Summary: Merge bugfix from next-stable.
Affected #: 1 file
diff -r 798e912004b2b26b219d5ed2214f1e65e8c099fa -r 9f2731b49115c44da4dc9bc4d91e9514b4c0b8ba test/base/asserts/xml.py
--- a/test/base/asserts/xml.py
+++ b/test/base/asserts/xml.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
import xml.etree
import re
https://bitbucket.org/galaxy/galaxy-central/commits/6310fc863764/
Changeset: 6310fc863764
Branch: next-stable
User: dannon
Date: 2015-02-17 20:19:00+00:00
Summary: Merge.
Affected #: 1 file
diff -r b63caa7dfa9865430d87d6023efd45ccf02228ca -r 6310fc863764ef515861a64638bacebad8079514 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -886,14 +886,15 @@
legal_values = self.get_legal_values( trans, context )
if not legal_values and self.optional:
return None
- assert legal_values, "Parameter %s requires a value, but has no legal values defined" % self.name
+ if not legal_values:
+ raise ValueError( "Parameter %s requires a value, but has no legal values defined." % self.name )
if isinstance( value, list ):
- if not(self.repeat):
- assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name
+ if not self.repeat and not self.multiple:
+ raise ValueError( "Multiple values provided but parameter %s is not expecting multiple values." % self.name )
rval = []
for v in value:
if v not in legal_values:
- raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, v))
+ raise ValueError( "An invalid option was selected for %s, %r, please verify." % ( self.name, v ) )
rval.append( v )
return rval
else:
@@ -903,9 +904,9 @@
if self.optional:
return []
else:
- raise ValueError( "No option was selected for %s but input is not optional." % self.name)
+ raise ValueError( "No option was selected for %s but input is not optional." % self.name )
if value not in legal_values:
- raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, value))
+ raise ValueError( "An invalid option was selected for %s, %r, please verify." % ( self.name, value ) )
return value
def to_html_value( self, value, app ):
@@ -918,8 +919,8 @@
if value is None:
return "None"
if isinstance( value, list ):
- if not( self.repeat ):
- assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name
+ if not self.repeat and not self.multiple:
+ raise ValueError( "Multiple values provided but parameter %s is not expecting multiple values." % self.name )
value = map( str, value )
else:
value = str( value )
https://bitbucket.org/galaxy/galaxy-central/commits/cc01fa14d826/
Changeset: cc01fa14d826
User: dannon
Date: 2015-02-17 20:19:40+00:00
Summary: Merge.
Affected #: 1 file
diff -r a49498479b2e71f8d2abf955ce4c7c041de730b9 -r cc01fa14d8269a5dc40b09fa3658ff3b58c2bc67 test/base/asserts/xml.py
--- a/test/base/asserts/xml.py
+++ b/test/base/asserts/xml.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
import xml.etree
import re
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/83fb18cb8c3d/
Changeset: 83fb18cb8c3d
Branch: next-stable
User: dan
Date: 2015-02-17 20:17:17+00:00
Summary: For select tool parameter, when testing input values, raise ValueErrors instead of assert/AssertionErrors, as ValueError are cased to be caught. Fixes errors on rerun, when options have been removed.
Affected #: 1 file
diff -r b6d15f14d0b392c4e9d9db56129bc67d6d4ba26b -r 83fb18cb8c3d21351f6267e574ed75c72eeb770a lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -886,14 +886,15 @@
legal_values = self.get_legal_values( trans, context )
if not legal_values and self.optional:
return None
- assert legal_values, "Parameter %s requires a value, but has no legal values defined" % self.name
+ if not legal_values:
+ raise ValueError( "Parameter %s requires a value, but has no legal values defined." % self.name )
if isinstance( value, list ):
- if not(self.repeat):
- assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name
+ if not self.repeat and not self.multiple:
+ raise ValueError( "Multiple values provided but parameter %s is not expecting multiple values." % self.name )
rval = []
for v in value:
if v not in legal_values:
- raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, v))
+ raise ValueError( "An invalid option was selected for %s, %r, please verify." % ( self.name, v ) )
rval.append( v )
return rval
else:
@@ -903,9 +904,9 @@
if self.optional:
return []
else:
- raise ValueError( "No option was selected for %s but input is not optional." % self.name)
+ raise ValueError( "No option was selected for %s but input is not optional." % self.name )
if value not in legal_values:
- raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, value))
+ raise ValueError( "An invalid option was selected for %s, %r, please verify." % ( self.name, value ) )
return value
def to_html_value( self, value, app ):
@@ -918,8 +919,8 @@
if value is None:
return "None"
if isinstance( value, list ):
- if not( self.repeat ):
- assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name
+ if not self.repeat and not self.multiple:
+ raise ValueError( "Multiple values provided but parameter %s is not expecting multiple values." % self.name )
value = map( str, value )
else:
value = str( value )
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a49498479b2e/
Changeset: a49498479b2e
User: dan
Date: 2015-02-17 20:17:17+00:00
Summary: For select tool parameter, when testing input values, raise ValueErrors instead of assert/AssertionErrors, as ValueError are cased to be caught. Fixes errors on rerun, when options have been removed.
Affected #: 1 file
diff -r 798e912004b2b26b219d5ed2214f1e65e8c099fa -r a49498479b2e71f8d2abf955ce4c7c041de730b9 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -886,14 +886,15 @@
legal_values = self.get_legal_values( trans, context )
if not legal_values and self.optional:
return None
- assert legal_values, "Parameter %s requires a value, but has no legal values defined" % self.name
+ if not legal_values:
+ raise ValueError( "Parameter %s requires a value, but has no legal values defined." % self.name )
if isinstance( value, list ):
- if not(self.repeat):
- assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name
+ if not self.repeat and not self.multiple:
+ raise ValueError( "Multiple values provided but parameter %s is not expecting multiple values." % self.name )
rval = []
for v in value:
if v not in legal_values:
- raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, v))
+ raise ValueError( "An invalid option was selected for %s, %r, please verify." % ( self.name, v ) )
rval.append( v )
return rval
else:
@@ -903,9 +904,9 @@
if self.optional:
return []
else:
- raise ValueError( "No option was selected for %s but input is not optional." % self.name)
+ raise ValueError( "No option was selected for %s but input is not optional." % self.name )
if value not in legal_values:
- raise ValueError( "An invalid option was selected for %s, %r, please verify" % (self.name, value))
+ raise ValueError( "An invalid option was selected for %s, %r, please verify." % ( self.name, value ) )
return value
def to_html_value( self, value, app ):
@@ -918,8 +919,8 @@
if value is None:
return "None"
if isinstance( value, list ):
- if not( self.repeat ):
- assert self.multiple, "Multiple values provided but parameter %s is not expecting multiple values" % self.name
+ if not self.repeat and not self.multiple:
+ raise ValueError( "Multiple values provided but parameter %s is not expecting multiple values." % self.name )
value = map( str, value )
else:
value = str( value )
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/41f41e587c34/
Changeset: 41f41e587c34
User: jmchilton
Date: 2015-02-17 19:02:04+00:00
Summary: Fix tool shed tests for GALAXY_TEST_DB_TEMPLATE unset.
I guess everyone who has ran tool shed tests in the last couple years has set either that or GALAXY_TEST_DBURI? Odd.
Affected #: 1 file
diff -r df4ab158d14e2b371ecced7392bcf02bc4e7dd65 -r 41f41e587c3470019855358afb7eaff7377c1ca0 test/tool_shed/functional_tests.py
--- a/test/tool_shed/functional_tests.py
+++ b/test/tool_shed/functional_tests.py
@@ -224,6 +224,8 @@
# cases (namely tool shed tests expecting clean database).
__copy_database_template(os.environ['GALAXY_TEST_DB_TEMPLATE'], db_path)
galaxy_database_auto_migrate = True
+ if not os.path.exists(galaxy_db_path):
+ os.makedirs(galaxy_db_path)
galaxy_database_connection = 'sqlite:///%s' % db_path
if 'GALAXY_TEST_INSTALL_DBURI' in os.environ:
install_galaxy_database_connection = os.environ[ 'GALAXY_TEST_INSTALL_DBURI' ]
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/80f553f98f2f/
Changeset: 80f553f98f2f
Branch: next-stable
User: dannon
Date: 2015-02-17 14:50:58+00:00
Summary: Merge PR over from default.
Affected #: 5 files
diff -r 9bb938ddd02e88abce8570049049982acc934690 -r 80f553f98f2fabe60173f9d1f361c11e7c7105b8 config/galaxy.ini.sample
--- a/config/galaxy.ini.sample
+++ b/config/galaxy.ini.sample
@@ -786,6 +786,14 @@
# public.
#new_user_dataset_access_role_default_private = False
+# Expose user list. Setting this to true will expose the user list to authenticated users. This
+# makes sharing datasets in smaller galaxy instances much easier as they can type a name/email and
+# have the correct user show up. This makes less sense on large public galaxy instances where
+# that data shouldn't be exposed. For semi-public galaxies, it may make sense to expose just the
+# username and not email, or vice versa.
+#expose_user_name = False
+#expose_user_email = False
+
# -- Beta features
# Use new tool form
diff -r 9bb938ddd02e88abce8570049049982acc934690 -r 80f553f98f2fabe60173f9d1f361c11e7c7105b8 lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -106,6 +106,9 @@
self.user_label_filters = listify( kwargs.get( "user_tool_label_filters", [] ), do_strip=True )
self.user_section_filters = listify( kwargs.get( "user_tool_section_filters", [] ), do_strip=True )
+ self.expose_user_name = kwargs.get( "expose_user_name", False )
+ self.expose_user_email = kwargs.get( "expose_user_email", False )
+
# Check for tools defined in the above non-shed tool configs (i.e., tool_conf.xml) tht have
# been migrated from the Galaxy code distribution to the Tool Shed.
self.check_migrate_tools = string_as_bool( kwargs.get( 'check_migrate_tools', True ) )
diff -r 9bb938ddd02e88abce8570049049982acc934690 -r 80f553f98f2fabe60173f9d1f361c11e7c7105b8 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -131,7 +131,7 @@
histories, credentials, and roles.
"""
# attributes that will be accessed and returned when calling to_dict( view='collection' )
- dict_collection_visible_keys = ( 'id', 'email' )
+ dict_collection_visible_keys = ( 'id', 'email', 'username' )
# attributes that will be accessed and returned when calling to_dict( view='element' )
dict_element_visible_keys = ( 'id', 'email', 'username', 'total_disk_usage', 'nice_total_disk_usage' )
diff -r 9bb938ddd02e88abce8570049049982acc934690 -r 80f553f98f2fabe60173f9d1f361c11e7c7105b8 lib/galaxy/webapps/galaxy/api/users.py
--- a/lib/galaxy/webapps/galaxy/api/users.py
+++ b/lib/galaxy/webapps/galaxy/api/users.py
@@ -43,11 +43,19 @@
else:
query = query.filter( trans.app.model.User.table.c.deleted == False ) # noqa
# special case: user can see only their own user
- if not trans.user_is_admin():
+ # special case2: if the galaxy admin has specified that other user email/names are
+ # exposed, we don't want special case #1
+ if not trans.user_is_admin() and not trans.app.config.expose_user_name and not trans.app.config.expose_user_email:
item = trans.user.to_dict( value_mapper={ 'id': trans.security.encode_id } )
return [item]
for user in query:
item = user.to_dict( value_mapper={ 'id': trans.security.encode_id } )
+ # If NOT configured to expose_email, do not expose email UNLESS the user is self, or
+ # the user is an admin
+ if not trans.app.config.expose_user_name and user is not trans.user and not trans.user_is_admin():
+ del item['username']
+ if not trans.app.config.expose_user_email and user is not trans.user and not trans.user_is_admin():
+ del item['email']
# TODO: move into api_values
rval.append( item )
return rval
diff -r 9bb938ddd02e88abce8570049049982acc934690 -r 80f553f98f2fabe60173f9d1f361c11e7c7105b8 templates/webapps/galaxy/history/share.mako
--- a/templates/webapps/galaxy/history/share.mako
+++ b/templates/webapps/galaxy/history/share.mako
@@ -36,10 +36,10 @@
</div><div style="clear: both"></div><div class="form-row">
+ <% existing_emails = ','.join([ d.user.email for d in history.users_shared_with ]) %><label>Galaxy user emails with which to share histories</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="text" name="email" value="${email}" size="40">
- </div>
+ <input type="hidden" id="email_select" name="email" value="${ existing_emails }" style="float: left; width: 250px; margin-right: 10px;">
+ </input><div class="toolParamHelp" style="clear: both;">
Enter a Galaxy user email address or a comma-separated list of addresses if sharing with multiple users
</div>
@@ -55,6 +55,94 @@
<input type="submit" name="share_button" value="Submit"></div></form>
+ <script type="text/javascript">
+ // stolen from templates/admin/impersonate.mako
+ /* This should be ripped out and made generic at some point for the
+ * various API bindings available, and once the API can filter list
+ * queries (term, below) */
+
+ var user_id = "${trans.security.encode_id(trans.user.id)}";
+ var history_id = "${trans.security.encode_id( history.id )}";
+
+ function item_to_label(item){
+ var text = "";
+ if(typeof(item.username) === "string" && typeof(item.email) === "string"){
+ text = item.username + " <" + item.email + ">";
+ }else if(typeof(item.username) === "string"){
+ text = item.username;
+ }else{
+ text = item.email;
+ }
+ return text;
+ //return "id:" + item.id + "|e:" + item.email + "|u:" + item.username;
+ }
+
+ $("#email_select").select2({
+ placeholder: "Select a user",
+ multiple: true,
+ initSelection: function(element, callback) {
+ var data = [
+ // Must be here to loop across the users that this has been shared with.
+ %for i, association in enumerate( history.users_shared_with ):
+ <% shared_with = association.user %>
+ {
+ email: "${ shared_with.email }",
+ id: "${trans.security.encode_id(shared_with.id)}",
+ text: item_to_label({"email": "${ shared_with.email }", "username": "${ shared_with.username }" })
+ },
+ %endfor
+ ];
+ callback(data);
+ },
+ tokenSeparators: [',', ' '],
+ // Required for initSelection
+ id: function(object) {
+ return object.id;
+ },
+ ajax: {
+ url: "${h.url_for(controller="/api/users", action="index")}",
+ data: function (term) {
+ return {
+ f_email: term
+ };
+ },
+ dataType: 'json',
+ quietMillis: 250,
+ results: function (data) {
+ var results = [];
+ // For every user returned by the API call,
+ $.each(data, function(index, item){
+ // If they aren't the requesting user, add to the
+ // list that will populate the select
+ if(item.id != "${trans.security.encode_id(trans.user.id)}"){
+ results.push({
+ id: item.id,
+ name: item.username,
+ text: item_to_label(item),
+ });
+ }
+ });
+ return {
+ results: results
+ };
+ }
+ },
+ createSearchChoice: function(term, data) {
+ // Check for a user with a matching email.
+ var matches = _.filter(data, function(user){
+ return user.text.indexOf(term) > -1;
+ });
+ // If there aren't any users with matching object labels, then
+ // display a "default" entry with whatever text they're entering.
+ // id is set to term as that will be used in
+ if(matches.length == 0){
+ return {id: term, text:term};
+ }else{
+ // No extra needed
+ }
+ }
+ });
+ </script>
%else:
## We are sharing restricted histories
%if no_change_needed or can_change:
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/8519e2f351f8/
Changeset: 8519e2f351f8
User: dannon
Date: 2015-02-17 14:46:09+00:00
Summary: Merged in erasche2/galaxy-central (pull request #570)
Enable user/email list for sharing of datasets
Affected #: 5 files
diff -r 2e3855e25b9bdbe6e574a1795fe3dd4334e85eb7 -r 8519e2f351f82229ccec63f5b33ff719b8837fd5 config/galaxy.ini.sample
--- a/config/galaxy.ini.sample
+++ b/config/galaxy.ini.sample
@@ -786,6 +786,14 @@
# public.
#new_user_dataset_access_role_default_private = False
+# Expose user list. Setting this to true will expose the user list to authenticated users. This
+# makes sharing datasets in smaller galaxy instances much easier as they can type a name/email and
+# have the correct user show up. This makes less sense on large public galaxy instances where
+# that data shouldn't be exposed. For semi-public galaxies, it may make sense to expose just the
+# username and not email, or vice versa.
+#expose_user_name = False
+#expose_user_email = False
+
# -- Beta features
# Use new tool form
diff -r 2e3855e25b9bdbe6e574a1795fe3dd4334e85eb7 -r 8519e2f351f82229ccec63f5b33ff719b8837fd5 lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -106,6 +106,9 @@
self.user_label_filters = listify( kwargs.get( "user_tool_label_filters", [] ), do_strip=True )
self.user_section_filters = listify( kwargs.get( "user_tool_section_filters", [] ), do_strip=True )
+ self.expose_user_name = kwargs.get( "expose_user_name", False )
+ self.expose_user_email = kwargs.get( "expose_user_email", False )
+
# Check for tools defined in the above non-shed tool configs (i.e., tool_conf.xml) tht have
# been migrated from the Galaxy code distribution to the Tool Shed.
self.check_migrate_tools = string_as_bool( kwargs.get( 'check_migrate_tools', True ) )
diff -r 2e3855e25b9bdbe6e574a1795fe3dd4334e85eb7 -r 8519e2f351f82229ccec63f5b33ff719b8837fd5 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -131,7 +131,7 @@
histories, credentials, and roles.
"""
# attributes that will be accessed and returned when calling to_dict( view='collection' )
- dict_collection_visible_keys = ( 'id', 'email' )
+ dict_collection_visible_keys = ( 'id', 'email', 'username' )
# attributes that will be accessed and returned when calling to_dict( view='element' )
dict_element_visible_keys = ( 'id', 'email', 'username', 'total_disk_usage', 'nice_total_disk_usage' )
diff -r 2e3855e25b9bdbe6e574a1795fe3dd4334e85eb7 -r 8519e2f351f82229ccec63f5b33ff719b8837fd5 lib/galaxy/webapps/galaxy/api/users.py
--- a/lib/galaxy/webapps/galaxy/api/users.py
+++ b/lib/galaxy/webapps/galaxy/api/users.py
@@ -43,11 +43,19 @@
else:
query = query.filter( trans.app.model.User.table.c.deleted == False ) # noqa
# special case: user can see only their own user
- if not trans.user_is_admin():
+ # special case2: if the galaxy admin has specified that other user email/names are
+ # exposed, we don't want special case #1
+ if not trans.user_is_admin() and not trans.app.config.expose_user_name and not trans.app.config.expose_user_email:
item = trans.user.to_dict( value_mapper={ 'id': trans.security.encode_id } )
return [item]
for user in query:
item = user.to_dict( value_mapper={ 'id': trans.security.encode_id } )
+ # If NOT configured to expose_email, do not expose email UNLESS the user is self, or
+ # the user is an admin
+ if not trans.app.config.expose_user_name and user is not trans.user and not trans.user_is_admin():
+ del item['username']
+ if not trans.app.config.expose_user_email and user is not trans.user and not trans.user_is_admin():
+ del item['email']
# TODO: move into api_values
rval.append( item )
return rval
diff -r 2e3855e25b9bdbe6e574a1795fe3dd4334e85eb7 -r 8519e2f351f82229ccec63f5b33ff719b8837fd5 templates/webapps/galaxy/history/share.mako
--- a/templates/webapps/galaxy/history/share.mako
+++ b/templates/webapps/galaxy/history/share.mako
@@ -36,10 +36,10 @@
</div><div style="clear: both"></div><div class="form-row">
+ <% existing_emails = ','.join([ d.user.email for d in history.users_shared_with ]) %><label>Galaxy user emails with which to share histories</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="text" name="email" value="${email}" size="40">
- </div>
+ <input type="hidden" id="email_select" name="email" value="${ existing_emails }" style="float: left; width: 250px; margin-right: 10px;">
+ </input><div class="toolParamHelp" style="clear: both;">
Enter a Galaxy user email address or a comma-separated list of addresses if sharing with multiple users
</div>
@@ -55,6 +55,94 @@
<input type="submit" name="share_button" value="Submit"></div></form>
+ <script type="text/javascript">
+ // stolen from templates/admin/impersonate.mako
+ /* This should be ripped out and made generic at some point for the
+ * various API bindings available, and once the API can filter list
+ * queries (term, below) */
+
+ var user_id = "${trans.security.encode_id(trans.user.id)}";
+ var history_id = "${trans.security.encode_id( history.id )}";
+
+ function item_to_label(item){
+ var text = "";
+ if(typeof(item.username) === "string" && typeof(item.email) === "string"){
+ text = item.username + " <" + item.email + ">";
+ }else if(typeof(item.username) === "string"){
+ text = item.username;
+ }else{
+ text = item.email;
+ }
+ return text;
+ //return "id:" + item.id + "|e:" + item.email + "|u:" + item.username;
+ }
+
+ $("#email_select").select2({
+ placeholder: "Select a user",
+ multiple: true,
+ initSelection: function(element, callback) {
+ var data = [
+ // Must be here to loop across the users that this has been shared with.
+ %for i, association in enumerate( history.users_shared_with ):
+ <% shared_with = association.user %>
+ {
+ email: "${ shared_with.email }",
+ id: "${trans.security.encode_id(shared_with.id)}",
+ text: item_to_label({"email": "${ shared_with.email }", "username": "${ shared_with.username }" })
+ },
+ %endfor
+ ];
+ callback(data);
+ },
+ tokenSeparators: [',', ' '],
+ // Required for initSelection
+ id: function(object) {
+ return object.id;
+ },
+ ajax: {
+ url: "${h.url_for(controller="/api/users", action="index")}",
+ data: function (term) {
+ return {
+ f_email: term
+ };
+ },
+ dataType: 'json',
+ quietMillis: 250,
+ results: function (data) {
+ var results = [];
+ // For every user returned by the API call,
+ $.each(data, function(index, item){
+ // If they aren't the requesting user, add to the
+ // list that will populate the select
+ if(item.id != "${trans.security.encode_id(trans.user.id)}"){
+ results.push({
+ id: item.id,
+ name: item.username,
+ text: item_to_label(item),
+ });
+ }
+ });
+ return {
+ results: results
+ };
+ }
+ },
+ createSearchChoice: function(term, data) {
+ // Check for a user with a matching email.
+ var matches = _.filter(data, function(user){
+ return user.text.indexOf(term) > -1;
+ });
+ // If there aren't any users with matching object labels, then
+ // display a "default" entry with whatever text they're entering.
+ // id is set to term as that will be used in
+ if(matches.length == 0){
+ return {id: term, text:term};
+ }else{
+ // No extra needed
+ }
+ }
+ });
+ </script>
%else:
## We are sharing restricted histories
%if no_change_needed or can_change:
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.