closes #5220
[arvados.git] / apps / workbench / app / views / collections / show.html.erb
1 <div class="row row-fill-height">
2   <div class="col-md-6">
3     <div class="panel panel-info">
4       <div class="panel-heading">
5         <h3 class="panel-title">
6           <% if @name_link.nil? and @object.uuid.match /[0-9a-f]{32}/ %>
7             Content hash <%= @object.portable_data_hash %>
8           <% else %>
9             <%= if @object.respond_to? :name
10                   render_editable_attribute @object, :name
11                 else
12                   @name_link.andand.name || @object.uuid
13                 end %>
14             <% end %>
15         </h3>
16       </div>
17       <div class="panel-body">
18         <div class="arv-description-as-subtitle">
19           <%= render_editable_attribute @object, 'description', nil, { 'data-emptytext' => "(No description provided)", 'data-toggle' => 'manual' } %>
20         </div>
21         <img src="/favicon.ico" class="pull-right" alt="" style="opacity: 0.3"/>
22         <p><i>Content hash:</i><br />
23           <span class="arvados-uuid"><%= link_to @object.portable_data_hash, collection_path(@object.portable_data_hash) %></span>
24         </p>
25         <%= render partial: "show_source_summary" %>
26       </div>
27     </div>
28   </div>
29   <div class="col-md-3">
30     <div class="panel panel-default">
31       <div class="panel-heading">
32         <h3 class="panel-title">
33           Activity
34         </h3>
35       </div>
36       <div class="panel-body smaller-text">
37         <!--
38         <input type="text" class="form-control" placeholder="Search"/>
39         -->
40         <div style="height:0.5em;"></div>
41         <% name_or_object = @name_link.andand.uuid ? @name_link : @object %>
42         <% if name_or_object.created_at and not @logs.andand.any? %>
43           <p>
44             Created: <%= name_or_object.created_at.to_s(:long) if name_or_object.created_at %>
45           </p>
46           <p>
47             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 %>
48           </p>
49         <% else %>
50           <%= render_arvados_object_list_start(@logs, 'Show all activity',
51                 logs_path(filters: [['object_uuid','=',name_or_object.uuid]].to_json)) do |log| %>
52           <p>
53           <%= time_ago_in_words(log.event_at) rescue 'unknown time' %> ago: <%= log.summary %>
54             <% if log.object_uuid %>
55             <%= link_to_if_arvados_object log.object_uuid, link_text: raw('<i class="fa fa-hand-o-right"></i>') %>
56             <% end %>
57           </p>
58           <% end %>
59         <% end %>
60       </div>
61     </div>
62   </div>
63   <% if current_user %>
64   <div class="col-md-3">
65     <div class="panel panel-default">
66       <div class="panel-heading">
67         <h3 class="panel-title">
68           Sharing and permissions
69         </h3>
70       </div>
71       <div class="panel-body">
72         <!--
73         <input type="text" class="form-control" placeholder="Search"/>
74         -->
75
76         <div id="sharing-button">
77           <%= render partial: 'sharing_button' %>
78         </div>
79
80         <div style="height:0.5em;"></div>
81         <% if @projects.andand.any? %>
82           <p>Included in projects:<br />
83           <%= render_arvados_object_list_start(@projects, 'Show all projects',
84                 links_path(filters: [['head_uuid', '=', @object.uuid],
85                                      ['link_class', '=', 'name']].to_json)) do |project| %>
86             <%= link_to_if_arvados_object(project, friendly_name: true) %><br />
87           <% end %>
88           </p>
89         <% end %>
90         <% if @permissions.andand.any? %>
91           <p>Readable by:<br />
92           <%= render_arvados_object_list_start(@permissions, 'Show all permissions',
93                 links_path(filters: [['head_uuid', '=', @object.uuid],
94                                     ['link_class', '=', 'permission']].to_json)) do |link| %>
95           <%= link_to_if_arvados_object(link.tail_uuid, friendly_name: true) %><br />
96           <% end %>
97           </p>
98         <% end %>
99
100       </div>
101     </div>
102   </div>
103   <% else %>
104   <div class="col-md-3">
105     <div class="panel panel-default">
106       <div class="panel-heading">
107         <h3 class="panel-title">
108           Welcome to Arvados
109         </h3>
110       </div>
111       <div class="panel-body">
112         You are accessing public data.
113       </div>
114     </div>
115   </div>
116   <% end %>
117 </div>
118
119 <%= render file: 'application/show.html.erb', locals: local_assigns %>