Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / apps / workbench / app / views / application / _title_and_buttons.html.erb
1 <%# Copyright (C) The Arvados Authors. All rights reserved.
2
3 SPDX-License-Identifier: AGPL-3.0 %>
4
5 <% object_class = @object.class_for_display.downcase %>
6 <% content_for :page_title do %>
7   <%= (@object.respond_to?(:properties) and !@object.properties.nil? ? @object.properties[:page_title] : nil) ||
8       @name_link.andand.name ||
9       @object.friendly_link_name %>
10 <% end %>
11
12 <% content_for :content_top do %>
13   <% if !['Group','User', 'Collection'].include? @object.class.to_s # projects and collections handle it themselves %>
14     <%= render partial: 'name_and_description' %>
15   <% end %>
16 <% end %>
17
18 <% if @object.class.goes_in_projects? && @object.uuid != current_user.andand.uuid # Not the "Home" project %>
19   <% content_for :tab_line_buttons do %>
20     <% if current_user.andand.is_active %>
21       <%= render partial: 'extra_tab_line_buttons' %>
22     <% end %>
23     <% if current_user.andand.is_active && @object.class.copies_to_projects? %>
24       <%= link_to(
25           choose_projects_path(
26            title: "Copy this #{object_class} to:",
27            action_name: 'Copy',
28            action_href: actions_path,
29            action_method: 'post',
30            action_data: {
31              copy_selections_into_project: true,
32              selection: @name_link.andand.uuid || @object.uuid,
33              selection_param: 'uuid',
34              success: 'redirect-to-created-object'
35            }.to_json),
36           { class: "btn btn-sm btn-primary", remote: true, method: 'get',
37             title: "Make a copy of this #{object_class}" }) do %>
38         <i class="fa fa-fw fa-copy"></i> Copy to project...
39       <% end %>
40     <% end %>
41     <% if (ArvadosBase.find(@object.owner_uuid).writable_by.include?(current_user.andand.uuid) rescue nil) %>
42       <%= link_to(
43           choose_projects_path(
44            title: "Move this #{object_class} to:",
45            action_name: 'Move',
46            action_href: actions_path,
47            action_method: 'post',
48            action_data: {
49              move_selections_into_project: true,
50              selection: @name_link.andand.uuid || @object.uuid,
51              selection_param: 'uuid',
52              success: 'redirect-to-created-object'
53            }.to_json),
54           { class: "btn btn-sm btn-primary force-cache-reload", remote: true, method: 'get',
55             title: "Move this #{object_class} to a different project"}) do %>
56         <i class="fa fa-fw fa-truck"></i> Move <%=object_class%>...
57       <% end %>
58     <% end %>
59   <% end %>
60 <% end %>
61
62 <% unless flash["error"].blank? %>
63 <div class="flash-message alert alert-danger" role="alert">
64   <p class="contain-align-left"><%= flash["error"] %></p>
65 </div>
66 <% flash.delete("error") %>
67 <% end %>
68
69 <% unless flash.empty? %>
70 <div class="flash-message alert alert-warning">
71   <% flash.each do |_, msg| %>
72   <p class="contain-align-left"><%= msg %></p>
73   <% end %>
74 </div>
75 <% end %>