[ARVADOS] updated: 72ea413fc98371c50196f337f104807ab7472288
git at public.curoverse.com
git at public.curoverse.com
Mon Jul 28 22:49:14 EDT 2014
Summary of changes:
.../app/assets/javascripts/select_modal.js | 39 ++++++++++++++++++++--
.../workbench/app/views/application/_choose.js.erb | 1 -
apps/workbench/app/views/layouts/body.html.erb | 28 ++++++----------
3 files changed, 48 insertions(+), 20 deletions(-)
via 72ea413fc98371c50196f337f104807ab7472288 (commit)
from 86f3157d2fa86e6b36c2d112bf2e6598e4c06b6d (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 72ea413fc98371c50196f337f104807ab7472288
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Jul 28 22:49:07 2014 -0400
3235: Replace link with search widget in top nav.
diff --git a/apps/workbench/app/assets/javascripts/select_modal.js b/apps/workbench/app/assets/javascripts/select_modal.js
index c1267d1..0a6aad3 100644
--- a/apps/workbench/app/assets/javascripts/select_modal.js
+++ b/apps/workbench/app/assets/javascripts/select_modal.js
@@ -87,12 +87,47 @@ $(document).on('click', '.selectable', function() {
$($(this).closest('[data-filterable-target]').attr('data-filterable-target')).
data('infinite-content-params', params).
trigger('refresh-content');
-});
-$(document).on('page-refresh', function(event, data, status, jqxhr, action_data) {
+}).on('ready', function() {
+ $('form[data-search-modal] *').on('click keyup paste', function() {
+ // When user types, pastes, or clicks the top nav Search
+ // input, ask the server for a Search modal. When it arrives,
+ // copy the search string from the top nav input into the
+ // modal's search query field.
+ var $form = $(this).closest('form');
+ var $a;
+ if ($form.find('a[data-remote]').length > 0) {
+ // A search dialog is already loading.
+ return;
+ }
+ $a = $('<a />').
+ attr('href', $form.attr('data-search-modal')).
+ attr('data-remote', 'true').
+ attr('data-method', 'GET').
+ hide().
+ appendTo($form).
+ on('ajax:success', function(data, status, xhr) {
+ // Move the dialog to the top of the window to prevent
+ // a well timed click on the top nav search box from
+ // closing the dialog as soon as it opens.
+ $('body > .modal-container .modal-dialog').
+ css('margin-top', '0');
+ $('body > .modal-container input[type=text]').
+ val($form.find('input').val()).
+ focus();
+ $form.find('input').val('');
+ }).on('ajax:complete', function() {
+ $(this).detach();
+ }).
+ click();
+ return false;
+ });
+}).on('page-refresh', function(event, data, status, jqxhr, action_data) {
window.location.reload();
}).on('tab-refresh', function(event, data, status, jqxhr, action_data) {
$(document).trigger('arv:pane:reload:all');
$('body > .modal-container .modal').modal('hide');
}).on('redirect-to-created-object', function(event, data, status, jqxhr, action_data) {
window.location.href = data.href.replace(/^[^\/]*\/\/[^\/]*/, '');
+}).on('shown.bs.modal', 'body > .modal-container .modal', function() {
+ $('.focus-on-display', this).focus();
});
diff --git a/apps/workbench/app/views/application/_choose.js.erb b/apps/workbench/app/views/application/_choose.js.erb
index 2d18975..44c2cd9 100644
--- a/apps/workbench/app/views/application/_choose.js.erb
+++ b/apps/workbench/app/views/application/_choose.js.erb
@@ -5,4 +5,3 @@ $('body > .modal-container .modal .modal-footer .btn-primary').
attr('data-action-href', '<%= j params[:action_href] %>').
attr('data-method', '<%= j params[:action_method] %>').
data('action-data', <%= raw params[:action_data] %>);
-$('body > .modal-container .modal .focus-on-display').focus();
diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 78a0ebe..8b6fb42 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -18,30 +18,24 @@
</li>
<% if current_user %>
- <!-- XXX placeholder for this when search is implemented
<li>
- <form class="navbar-form" role="search">
+ <form class="navbar-form" role="search"
+ data-search-modal=
+ "<%= url_for(
+ action: 'choose',
+ controller: 'search',
+ title: 'Search',
+ action_name: 'Show',
+ action_href: url_for(controller: :actions, action: :show),
+ action_method: 'get',
+ action_data: {selection_param: 'uuid', success: 'redirect-to-created-object', copy_from_search_box: true}.to_json)
+ %>">
<div class="input-group" style="width: 220px">
<input type="text" class="form-control" placeholder="search">
<span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
</div>
</form>
</li>
- -->
-
- <li>
- <%= link_to(url_for(
- action: 'choose',
- controller: 'search',
- title: 'Search',
- action_name: 'Show',
- action_href: url_for(controller: :actions, action: :show),
- action_method: 'get',
- action_data: {selection_param: 'uuid', success: 'redirect-to-created-object'}.to_json),
- { class: "", remote: true, method: 'get' }) do %>
- <i class="fa fa-fw fa-search"></i> Search
- <% end %>
- </li>
<li class="dropdown notification-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notifications-menu">
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list