Merge branch 'master' into 4036-combine-collections-in-project-issue
[arvados.git] / apps / workbench / app / views / application / _title_and_buttons.html.erb
1 <% content_for :page_title do %>
2   <%= (@object.respond_to?(:properties) and !@object.properties.nil? ? @object.properties[:page_title] : nil) ||
3       @name_link.andand.name ||
4       @object.friendly_link_name %>
5 <% end %>
6
7 <% content_for :content_top do %>
8   <% if !['Group','User', 'Collection'].include? @object.class.to_s # projects and collections handle it themselves %>
9     <%= render partial: 'name_and_description' %>
10   <% end %>
11 <% end %>
12
13 <% if @object.class.goes_in_projects? && @object.uuid != current_user.uuid # Not the "Home" project %>
14   <% content_for :tab_line_buttons do %>
15     <% if @object.class.copies_to_projects? %>
16       <%= link_to(
17           choose_projects_path(
18            title: 'Copy to project...',
19            action_name: 'Copy',
20            action_href: actions_path,
21            action_method: 'post',
22            action_data: {
23              copy_selections_into_project: true,
24              selection: @name_link.andand.uuid || @object.uuid,
25              selection_param: 'uuid',
26              success: 'redirect-to-created-object'
27            }.to_json),
28           { class: "btn btn-sm btn-primary", remote: true, method: 'get' }) do %>
29         <i class="fa fa-fw fa-copy"></i> Copy to project...
30       <% end %>
31     <% end %>
32     <% if @object.owner_uuid == current_user.uuid or (Group.find(@object.owner_uuid).writable_by.include?(current_user.uuid) rescue nil) %>
33       <%= link_to(
34           choose_projects_path(
35            title: 'Move to project...',
36            action_name: 'Move',
37            action_href: actions_path,
38            action_method: 'post',
39            action_data: {
40              move_selections_into_project: true,
41              selection: @name_link.andand.uuid || @object.uuid,
42              selection_param: 'uuid',
43              success: 'redirect-to-created-object'
44            }.to_json),
45           { class: "btn btn-sm btn-primary", remote: true, method: 'get' }) do %>
46         <i class="fa fa-fw fa-truck"></i> Move to project...
47       <% end %>
48     <% end %>
49   <% end %>
50 <% end %>
51
52 <%
53   flash_msg = ''
54   flash_msg_is_error = false
55   flash.each do |msg|
56     flash_msg_is_error ||= (msg[0]=='error')
57     flash_msg += ('<p class="contain-align-left">' + msg[1] + '</p>')
58   end
59   if flash_msg != ''
60 %>
61 <div class="modal-footer-status alert <%= flash_msg_is_error ? 'alert-danger' : 'alert-warning' %>"><%=flash_msg.html_safe%></div>
62 <% end %>