Display first file in collection if name field is nil or empty. refs #3504
[arvados.git] / apps / workbench / app / views / collections / show.html.erb
1 <% content_for :tab_line_buttons do %>
2   <%= link_to(
3       choose_projects_path(
4        title: 'Copy to project...',
5        my_root_selectable: true,
6        action_name: 'Copy',
7        action_href: actions_path,
8        action_method: 'post',
9        action_data: {
10          copy_selections_into_project: true,
11          selection: @name_link.andand.uuid || @object.uuid,
12          selection_param: 'uuid',
13          success: 'redirect-to-created-object'
14        }.to_json),
15       { class: "btn btn-sm btn-primary arv-move-to-project", remote: true, method: 'get' }) do %>
16     <i class="fa fa-fw fa-copy"></i> Copy to project...
17   <% end %>
18 <% end %>
19
20 <div class="row row-fill-height">
21   <div class="col-md-6">
22     <div class="panel panel-info">
23       <div class="panel-heading">
24         <h3 class="panel-title">
25           <% if @name_link.nil? and @object.uuid.match /[0-9a-f]{32}/ %>
26             Content hash <%= @object.portable_data_hash %>
27           <% else %>
28             <%= if @object.respond_to? :name
29                   render_editable_attribute @object, :name
30                 else
31                   @name_link.andand.name || @object.uuid
32                 end %>
33             <% end %>
34         </h3>
35       </div>
36       <div class="panel-body">
37         <img src="/favicon.ico" class="pull-right" alt="" style="opacity: 0.3"/>
38         <% if defined? @same_pdh %>
39           <p>Found in collections:<p>
40           <p>
41             <% @same_pdh.each do |c| %>
42               <%= link_to_if_arvados_object get_object(c.owner_uuid), {:friendly_name => true} %> / <%= link_to_if_arvados_object c, {:friendly_name => true} %><br>
43             <% end %>
44           </p>
45         <% else %>
46           <p><i>Content hash:</i><br />
47             <span class="arvados-uuid"><%= link_to @object.portable_data_hash, collection_path(@object.portable_data_hash) %></span></p>
48         <% end %>
49         <%= render partial: "show_source_summary" %>
50       </div>
51     </div>
52   </div>
53   <div class="col-md-3">
54     <div class="panel panel-default">
55       <div class="panel-heading">
56         <h3 class="panel-title">
57           Activity
58         </h3>
59       </div>
60       <div class="panel-body smaller-text">
61         <!--
62         <input type="text" class="form-control" placeholder="Search"/>
63         -->
64         <div style="height:0.5em;"></div>
65         <% name_or_object = @name_link.andand.uuid ? @name_link : @object %>
66         <% if name_or_object.created_at and not @logs.andand.any? %>
67           <p>
68             Created: <%= name_or_object.created_at.to_s(:long) if name_or_object.created_at %>
69           </p>
70           <p>
71             Last modified: <%= name_or_object.modified_at.to_s(:long) if name_or_object.modified_at %> by <%= link_to_if_arvados_object name_or_object.modified_by_user_uuid, friendly_name: true %>
72           </p>
73         <% else %>
74           <%= render_arvados_object_list_start(@logs, 'Show all activity',
75                 logs_path(filters: [['object_uuid','=',name_or_object.uuid]].to_json)) do |log| %>
76           <p>
77           <%= time_ago_in_words(log.event_at) rescue 'unknown time' %> ago: <%= log.summary %>
78             <% if log.object_uuid %>
79             <%= link_to_if_arvados_object log.object_uuid, link_text: raw('<i class="fa fa-hand-o-right"></i>') %>
80             <% end %>
81           </p>
82           <% end %>
83         <% end %>
84       </div>
85     </div>
86   </div>
87   <div class="col-md-3">
88     <div class="panel panel-default">
89       <div class="panel-heading">
90         <h3 class="panel-title">
91           Sharing and permissions
92         </h3>
93       </div>
94       <div class="panel-body">
95         <!--
96         <input type="text" class="form-control" placeholder="Search"/>
97         -->
98
99         <div id="sharing-button">
100           <%= render partial: 'sharing_button' %>
101         </div>
102
103         <div style="height:0.5em;"></div>
104         <% if @projects.andand.any? %>
105           <p>Included in projects:<br />
106           <%= render_arvados_object_list_start(@projects, 'Show all projects',
107                 links_path(filters: [['head_uuid', '=', @object.uuid],
108                                      ['link_class', '=', 'name']].to_json)) do |project| %>
109             <%= link_to_if_arvados_object(project, friendly_name: true) %><br />
110           <% end %>
111           </p>
112         <% end %>
113         <% if @permissions.andand.any? %>
114           <p>Readable by:<br />
115           <%= render_arvados_object_list_start(@permissions, 'Show all permissions',
116                 links_path(filters: [['head_uuid', '=', @object.uuid],
117                                     ['link_class', '=', 'permission']].to_json)) do |link| %>
118           <%= link_to_if_arvados_object(link.tail_uuid, friendly_name: true) %><br />
119           <% end %>
120           </p>
121         <% end %>
122
123       </div>
124     </div>
125   </div>
126 </div>
127
128 <%= render file: 'application/show.html.erb', locals: local_assigns %>