[ARVADOS] updated: a2b994514a6743a055116f9362c303db66f480b5
git at public.curoverse.com
git at public.curoverse.com
Wed Dec 3 18:24:56 EST 2014
Summary of changes:
.../app/assets/javascripts/selection.js.erb | 85 ++++++++++++++++++----
apps/workbench/app/assets/javascripts/tab_panes.js | 1 -
apps/workbench/app/helpers/application_helper.rb | 7 ++
3 files changed, 76 insertions(+), 17 deletions(-)
via a2b994514a6743a055116f9362c303db66f480b5 (commit)
via 525d62c7c7dfca214d16343f3d8aeabfba2e87d5 (commit)
via 51aaccb65bb4ce087e2b9ba69486f3db870825e7 (commit)
from 521f28a39284606dc7d5b00a1688fecb388a855a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit a2b994514a6743a055116f9362c303db66f480b5
Merge: 525d62c 51aaccb
Author: radhika <radhika at radhika>
Date: Wed Dec 3 18:21:19 2014 -0500
Merge branch '4525-remove-stale-clippy-code-TC' into 4525-remove-stale-clippy-code
commit 525d62c7c7dfca214d16343f3d8aeabfba2e87d5
Author: radhika <radhika at radhika>
Date: Wed Dec 3 18:16:08 2014 -0500
4525: restore add_form_selection_sources function
diff --git a/apps/workbench/app/assets/javascripts/selection.js.erb b/apps/workbench/app/assets/javascripts/selection.js.erb
index 34a5d7a..b483c2c 100644
--- a/apps/workbench/app/assets/javascripts/selection.js.erb
+++ b/apps/workbench/app/assets/javascripts/selection.js.erb
@@ -14,6 +14,61 @@ jQuery(function($){
});
});
+add_form_selection_sources = null;
+select_form_sources = null;
+
+(function() {
+ var form_selection_sources = {};
+ add_form_selection_sources = function (src) {
+ for (var i = 0; i < src.length; i++) {
+ var t = form_selection_sources[src[i].type];
+ if (!t) {
+ t = form_selection_sources[src[i].type] = {};
+ }
+ if (!t[src[i].uuid]) {
+ t[src[i].uuid] = src[i];
+ }
+ }
+ };
+
+ select_form_sources = function(type) {
+ var ret = [];
+
+ if (get_selection_list) {
+ var lst = get_selection_list();
+ if (lst.length > 0) {
+ var text = "― Selections ―";
+ var span = document.createElement('span');
+ span.innerHTML = text;
+ ret.push({text: span.innerHTML, value: "***invalid***"});
+
+ for (var i = 0; i < lst.length; i++) {
+ if (lst[i].type == type) {
+ var n = lst[i].name;
+ n = n.replace(/<span[^>]*>/i, "[");
+ n = n.replace(/<\/span>/i, "]");
+ ret.push({text: n, value: lst[i].uuid})
+ }
+ }
+ }
+ }
+
+ var text = "― Recent ―";
+ var span = document.createElement('span');
+ span.innerHTML = text;
+ ret.push({text: span.innerHTML, value: "***invalid***"});
+
+ var t = form_selection_sources[type];
+ for (var key in t) {
+ if (t.hasOwnProperty(key)) {
+ var obj = t[key];
+ ret.push({text: obj.name, value: obj.uuid})
+ }
+ }
+ return ret;
+ };
+})();
+
function dispatch_selection_action() {
// Build a new "href" attribute for this link by starting with the
// "data-href" attribute and appending ?foo[]=bar&foo[]=baz (or
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index ff7c80f..c8c4ccc 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -380,6 +380,13 @@ module ApplicationHelper
}.merge(htmloptions)
lt += raw("\n<script>")
+
+ if selectables.any?
+ lt += raw("add_form_selection_sources(#{selectables.to_json});\n")
+ end
+
+ lt += raw("$('[data-name=\"#{dn}\"]').editable({source: function() { return select_form_sources('#{dataclass}'); } });\n")
+
lt += raw("</script>")
lt
commit 51aaccb65bb4ce087e2b9ba69486f3db870825e7
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Dec 3 17:26:23 2014 -0500
4525: Call enable_disable_selection_actions once per container to
avoid crosstalk between containers.
Also, separate event binding setup from enable/disable hook, and avoid
binding many copies of the selection dispatch click handler.
diff --git a/apps/workbench/app/assets/javascripts/selection.js.erb b/apps/workbench/app/assets/javascripts/selection.js.erb
index 34a5d7a..0032ebd 100644
--- a/apps/workbench/app/assets/javascripts/selection.js.erb
+++ b/apps/workbench/app/assets/javascripts/selection.js.erb
@@ -41,40 +41,38 @@ function dispatch_selection_action() {
}
function enable_disable_selection_actions() {
- var $container = $(this).closest('.selection-action-container');
- var $checked = $('.persistent-selection:checkbox:checked:visible', $container);
- $('[data-selection-action]').
+ var $container = $(this);
+ var $checked = $('.persistent-selection:checkbox:checked', $container);
+ $('[data-selection-action]', $container).
closest('div.btn-group-sm').
find('ul li').
toggleClass('disabled', ($checked.length == 0));
- $('[data-selection-action=compare]').
+ $('[data-selection-action=compare]', $container).
closest('li').
toggleClass('disabled',
($checked.filter('[value*=-d1hrv-]').length < 2) ||
($checked.not('[value*=-d1hrv-]').length > 0));
<% unless Group.copies_to_projects? %>
- $('[data-selection-action=copy]').
+ $('[data-selection-action=copy]', $container).
closest('li').
toggleClass('disabled',
($checked.filter('[value*=-j7d0g-]').length > 0) ||
($checked.length < 1));
<% end %>
- $('[data-selection-action=combine-project-contents]').
+ $('[data-selection-action=combine-project-contents]', $container).
closest('li').
toggleClass('disabled',
($checked.filter('[value*=-4zz18-]').length < 1) ||
($checked.length != $checked.filter('[value*=-4zz18-]').length));
}
-function update_selection_actions() {
- var $btn = $('[data-selection-action]');
- $btn.click(dispatch_selection_action);
- enable_disable_selection_actions.call($btn);
-}
-
$(document).
- on('selections-updated ready ajax:complete', function() {
- var $btn = $('[data-selection-action]');
- $btn.click(dispatch_selection_action);
- enable_disable_selection_actions.call($btn);
+ on('selections-updated', function() {
+ $('.selection-action-container').each(enable_disable_selection_actions);
+ }).
+ on('ready ajax:complete', function() {
+ $('[data-selection-action]').
+ off('click', dispatch_selection_action).
+ on('click', dispatch_selection_action);
+ $(this).trigger('selections-updated');
});
diff --git a/apps/workbench/app/assets/javascripts/tab_panes.js b/apps/workbench/app/assets/javascripts/tab_panes.js
index 11990b0..07e46fe 100644
--- a/apps/workbench/app/assets/javascripts/tab_panes.js
+++ b/apps/workbench/app/assets/javascripts/tab_panes.js
@@ -2,7 +2,6 @@
// Fire when a tab is selected/clicked.
$(document).on('shown.bs.tab', '[data-toggle="tab"]', function(event) {
- update_selection_actions();
// reload the pane (unless it's already loaded)
$($(event.target).attr('href')).
not('.pane-loaded').
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list