$(this).append(parsedData.summary + "<br/>");
}
});
+
+var showhide_compare = function() {
+ var form = $('form#compare')[0];
+ $('input[type=hidden][name="uuids[]"]', form).remove();
+ $('input[type=submit]', form).prop('disabled',true).show();
+ var checked_inputs = $('[data-object-uuid*=-d1hrv-] input[name="uuids[]"]:checked');
+ if (checked_inputs.length >= 2 && checked_inputs.length <= 3) {
+ checked_inputs.each(function(){
+ if(this.checked) {
+ $('input[type=submit]', form).prop('disabled',false).show();
+ $(form).append($('<input type="hidden" name="uuids[]"/>').val(this.value));
+ }
+ });
+ }
+};
+$('[data-object-uuid*=-d1hrv-] input[name="uuids[]"]').on('click', showhide_compare);
+showhide_compare();
$('.remove-selection').on('click', remove_selection_click);
$('#clear_selections_button').on('click', clear_selections);
+ $(document).trigger('selections-updated', [lst]);
};
$(document).
on('change', '.persistent-selection:checkbox', function(e) {
- //console.log($(this));
- //console.log($(this).val());
-
var inc = 0;
if ($(this).is(":checked")) {
add_selection($(this).val(), $(this).attr('friendly_name'), $(this).attr('href'), $(this).attr('friendly_type'));
}
});
-
$(window).on('load storage', update_count);
$('#selection-form-content').on("click", function(e) {
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
+ // &foo=... as appropriate) to reflect the current object
+ // selections.
+ var data = [];
+ var param_name = $(this).attr('data-selection-param-name');
+ var href = $(this).attr('data-href');
+ $('.persistent-selection:checkbox:checked').each(function() {
+ data.push({name: param_name, value: $(this).val()});
+ });
+ if (href.indexOf('?') >= 0)
+ href += '&';
+ else
+ href += '?';
+ href += $.param(data, true);
+ $(this).attr('href', href);
+ return true;
+}
+
+function enable_disable_selection_actions() {
+ var $checked = $('.persistent-selection:checkbox:checked');
+ $('[data-selection-action]').
+ closest('div.btn-group-sm').
+ find('*').
+ prop('disabled', ($checked.length == 0));
+ $('[data-selection-action=compare]').
+ closest('li').
+ toggleClass('disabled',
+ ($checked.filter('[value*=-d1hrv-]').length < 2) ||
+ ($checked.not('[value*=-d1hrv-]').length > 0));
+}
+
+$(document).
+ on('selections-updated ready ajax:complete', function() {
+ $('[data-selection-action]').click(dispatch_selection_action);
+ enable_disable_selection_actions();
+ });
end
def remove_item
+ params[:item_uuids] = [params[:item_uuid]]
+ remove_items
+ render template: 'folders/remove_items'
+ end
+
+ def remove_items
@removed_uuids = []
links = []
- item = ArvadosBase.find params[:item_uuid]
- if (item.class == Link and
- item.link_class == 'name' and
- item.tail_uuid = @object.uuid)
- # Given uuid is a name link, linking an object to this
- # folder. First follow the link to find the item we're removing,
- # then delete the link.
- links << item
- item = ArvadosBase.find item.head_uuid
- else
- # Given uuid is an object. Delete all names.
- links += Link.where(tail_uuid: @object.uuid,
- head_uuid: item.uuid,
- link_class: 'name')
- end
- links.each do |link|
- @removed_uuids << link.uuid
- link.destroy
- end
- if item.owner_uuid == @object.uuid
- # Object is owned by this folder. Remove it from the folder by
- # changing owner to the current user.
- item.update_attributes owner_uuid: current_user.uuid
- @removed_uuids << item.uuid
+ params[:item_uuids].collect { |uuid| ArvadosBase.find uuid }.each do |item|
+ if (item.class == Link and
+ item.link_class == 'name' and
+ item.tail_uuid == @object.uuid)
+ # Given uuid is a name link, linking an object to this
+ # folder. First follow the link to find the item we're removing,
+ # then delete the link.
+ links << item
+ item = ArvadosBase.find item.head_uuid
+ else
+ # Given uuid is an object. Delete all names.
+ links += Link.where(tail_uuid: @object.uuid,
+ head_uuid: item.uuid,
+ link_class: 'name')
+ end
+ links.each do |link|
+ @removed_uuids << link.uuid
+ link.destroy
+ end
+ if item.owner_uuid == @object.uuid
+ # Object is owned by this folder. Remove it from the folder by
+ # changing owner to the current user.
+ item.update_attributes owner_uuid: current_user.uuid
+ @removed_uuids << item.uuid
+ end
end
end
:class => "editable"
}.merge(htmloptions).merge(ajax_options)
edit_button = raw('<a href="#" class="btn btn-xs btn-default btn-nodecorate" data-toggle="x-editable tooltip" data-toggle-selector="#' + span_id + '" data-placement="top" title="' + (htmloptions[:tiptitle] || 'edit') + '"><i class="fa fa-fw fa-pencil"></i></a>')
- if htmloptions[:tipplacement] == :left
+ if htmloptions[:btnplacement] == :left
edit_button + ' ' + span_tag
else
span_tag + ' ' + edit_button
<h4 class="modal-title"><%= params[:title] || "Choose #{@objects.first.class_for_display}" %></h4>
</div>
<div class="modal-body">
- <div class="container-fluid">
+ <div>
<div class="row">
<div class="col-sm-6">
</div>
<div class="tab-content">
<% panes.each_with_index do |(pane, content), i| %>
<div id="<%= pane %>" class="tab-pane fade <%= 'in active' if i==0 %>">
- <div id="<%= pane %>-scroll" class="smart-scroll" style="margin-top:0.5em;">
+ <div id="<%= pane %>-scroll" class="<%= 'smart-scroll' if pane.match(/graph/) %>" style="margin-top:0.5em;">
<%= content %>
</div>
</div>
<i class="fa fa-fw fa-archive"></i>
<%= name_link.name %>
</div>
- <div class="col-sm-11 col-sm-push-1 arv-description-in-table">
+ <div class="col-sm-11 col-sm-push-1" style="overflow-x: hidden">
<%= render_controller_partial(
'show_object_description_cell.html',
controller_name: 'collections',
</div>
<div class="modal-body">
- <div class="container-fluid selectable-container" style="height: 15em; overflow-y: scroll">
+ <div class="selectable-container" style="height: 15em; overflow-y: scroll">
<% [@my_folder_tree, @shared_folder_tree].each do |tree| %>
<% tree.each do |foldernode| %>
<% if foldernode[:object].is_a? String %>
-<div class="container-fluid">
+<div>
<% any = false %>
<% recent_jobs_and_pipelines[0..9].each do |object| %>
<% any = true %>
<div class="col-sm-4">
<%= render :partial => "show_object_button", :locals => {object: object, size: 'xs'} %>
<% if object.respond_to?(:name) %>
- <%= render_editable_attribute object, 'name', nil %>
+ <%= render_editable_attribute object, 'name', nil, {tiptitle: 'rename', btnplacement: :left} %>
<% else %>
<%= object.class_for_display %> <%= object.uuid %>
<% end %>
<% end %>
<% end %>
-<div class="container-fluid">
+<div class="selection-action-container">
<div class="row">
- <div class="col-md-4">
+ <div class="col-sm-5">
+ <div class="btn-group btn-group-sm">
+ <button type="button" class="btn btn-default">Selection...</button>
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+ <span class="caret"></span>
+ <span class="sr-only">Toggle Dropdown</span>
+ </button>
+ <ul class="dropdown-menu" role="menu">
+ <li><%= link_to "Compare selected", '#',
+ 'data-href' => compare_pipeline_instances_path,
+ 'data-selection-param-name' => 'uuids[]',
+ 'data-selection-action' => 'compare'
+ %></li>
+ <li><%= link_to "Remove selected", '#',
+ 'data-href' => url_for(action: :remove_items),
+ 'data-selection-param-name' => 'item_uuids[]',
+ 'data-selection-action' => 'remove',
+ 'data-remote' => true,
+ 'method' => 'delete'
+ %></li>
+ </ul>
+ </div>
<% if @object.editable? %>
<%= link_to(
choose_collections_path(
<% end %>
<% end %>
</div>
- <div class="col-md-4">
+ <div class="col-sm-3">
<form class="form-inline" role="form">
Show:
- <select class="form-control filterable-control" data-filterable-attribute="data-kind" data-filterable-target="table.arv-index.arv-folder-contents tbody">
+ <select class="form-control form-control-sm filterable-control" data-filterable-attribute="data-kind" data-filterable-target="table.arv-index.arv-folder-contents tbody">
<option value="">Everything</option>
<option value="arvados#collection">Data</option>
<option value="arvados#pipelineInstance arvados#job">Compute jobs</option>
</select>
</form>
</div>
- <div class="col-md-4">
+ <div class="col-sm-4">
<input type="text" class="form-control filterable-control" placeholder="Search folder contents" data-filterable-target="table.arv-index.arv-folder-contents tbody"/>
</div>
</div>
-</div>
-<table class="table table-condensed table-fixedlayout arv-index arv-folder-contents" style="overflow-x: hidden">
- <colgroup>
- <col width="40%" />
- <col width="60%" />
- </colgroup>
- <tbody data-infinite-scroller="#Contents-scroll" data-infinite-content-href="<%= url_for(format: :json, partial: :contents_rows, offset: next_page_offset) if next_page_offset %>">
- <%= render partial: 'show_contents_rows', locals: {folder: @object, objects_and_names: @objects_and_names} %>
- </tbody>
- <thead>
- <tr>
- <th>
- </th>
- <th>
- description
- </th>
- </tr>
- </thead>
-</table>
+ <table class="table table-condensed table-fixedlayout arv-index arv-folder-contents" style="overflow-x: hidden">
+ <colgroup>
+ <col width="40%" />
+ <col width="60%" />
+ </colgroup>
+ <tbody data-infinite-scroller="#Contents-scroll" data-infinite-content-href="<%= url_for(format: :json, partial: :contents_rows, offset: next_page_offset) if next_page_offset %>">
+ <%= render partial: 'show_contents_rows', locals: {folder: @object, objects_and_names: @objects_and_names} %>
+ </tbody>
+ <thead>
+ <tr>
+ <th>
+ </th>
+ <th>
+ description
+ </th>
+ </tr>
+ </thead>
+ </table>
+
+</div>
data-kind="<%= object.kind %>"
>
<td>
+ <%= render partial: 'selection_checkbox', locals: {object: object, friendly_name: (name_object.name rescue nil)} %>
+
<% if folder.editable? %>
<%= link_to({action: 'remove_item', id: folder.uuid, item_uuid: ((name_link && name_link.uuid) || object.uuid)}, method: :delete, remote: true, data: {confirm: "Remove #{object.class_for_display.downcase} #{name_object.name rescue object.uuid} from this folder?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-sm btn-default btn-nodecorate', title: 'remove') do %>
<i class="fa fa-fw fa-ban"></i>
<%= render :partial => "show_object_button", :locals => {object: object, size: 'sm'} %>
- <%= render_editable_attribute name_object, 'name', nil, {tipplacement: :left, tiptitle: 'rename'} %>
+ <%= render_editable_attribute name_object, 'name', nil, {btnplacement: :left, tiptitle: 'rename'} %>
</td>
<td class="arv-description-in-table">
<%= render_controller_partial(
-<div class="container-fluid">
+<div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<li><a href="#">Home</a></li>
<% end %>
-<div class="container-fluid">
+<div>
<div class="row">
<div class="col-sm-6">
<% if my_folders.empty? %>
height: 100%;
}
- body > div.container-fluid {
- padding-top: 70px; /* 70px to make the container go all the way to the bottom of the navbar */
- }
-
@media (max-width: 979px) { body { padding-top: 0; } }
.navbar .nav li.nav-separator > span.glyphicon.glyphicon-arrow-right {
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet">
</head>
<body>
- <div id="wrapper">
+ <div id="wrapper" class="container-fluid">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<% end %>
<%= render partial: "paging", locals: {results: @objects, object: @object} %>
-
-<% content_for :footer_js do %>
-var showhide_compare = function() {
- var form = $('form#compare')[0];
- $('input[type=hidden][name="uuids[]"]', form).remove();
- $('input[type=submit]', form).prop('disabled',true).show();
- var checked_inputs = $('input[name="uuids[]"]:checked');
- if (checked_inputs.length >= 2 && checked_inputs.length <= 3) {
- checked_inputs.each(function(){
- if(this.checked) {
- $('input[type=submit]', form).prop('disabled',false).show();
- $(form).append($('<input type="hidden" name="uuids[]"/>').val(this.value));
- }
- });
- }
-};
-$('form input[name="uuids[]"]').on('click', showhide_compare);
-showhide_compare();
-<% end %>
}
<% end %>
-<div class="container-fluid" id="home-tables">
+<div id="home-tables">
<%= render :partial => 'tables' %>
get '/collections/:uuid/*file' => 'collections#show_file', :format => false
resources :folders do
match 'remove/:item_uuid', on: :member, via: :delete, action: :remove_item
+ match 'remove_items', on: :member, via: :delete, action: :remove_items
get 'choose', on: :collection
end