Merge branch 'master' into 2752-arv-put-resume-wip
[arvados.git] / apps / workbench / app / views / folders / 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           <%= render_editable_attribute @object, 'name', nil, {data: {emptytext: "New folder"}} %>
7         </h3>
8       </div>
9       <div class="panel-body">
10         <img src="/favicon.ico" class="pull-right" alt="" style="opacity: 0.3"/>
11         <%= render_editable_attribute @object, 'description', nil, { 'data-emptytext' => "Created: #{@object.created_at.to_s(:long)}", 'data-toggle' => 'manual', 'id' => "#{@object.uuid}-description" } %>
12         <% if @object.attribute_editable? 'description' %>
13         <div style="margin-top: 1em;">
14           <a href="#" class="btn btn-xs btn-default" data-toggle="x-editable" data-toggle-selector="#<%= @object.uuid %>-description"><i class="fa fa-fw fa-pencil"></i> Edit description</a>
15         </div>
16         <% end %>
17       </div>
18     </div>
19   </div>
20   <div class="col-md-3">
21     <div class="panel panel-default">
22       <div class="panel-heading">
23         <h3 class="panel-title">
24           Activity
25         </h3>
26       </div>
27       <div class="panel-body smaller-text">
28         <!--
29         <input type="text" class="form-control" placeholder="Search"/>
30         -->
31         <div style="height:0.5em;"></div>
32         <% if @logs.any? %>
33           <%= render_arvados_object_list_start(@logs, 'Show all activity',
34                 logs_path(filters: [['object_uuid','=',@object.uuid]].to_json)) do |log| %>
35           <p>
36           <%= time_ago_in_words(log.event_at) %> ago: <%= log.summary %>
37             <% if log.object_uuid %>
38             <%= link_to_if_arvados_object log.object_uuid, link_text: raw('<i class="fa fa-hand-o-right"></i>') %>
39             <% end %>
40           </p>
41           <% end %>
42         <% else %>
43           <p>
44             Created: <%= @object.created_at.to_s(:long) %>
45           </p>
46           <p>
47             Last modified: <%= @object.modified_at.to_s(:long) %> by <%= link_to_if_arvados_object @object.modified_by_user_uuid, friendly_name: true %>
48           </p>
49         <% end %>
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           Sharing and permissions
58         </h3>
59       </div>
60       <div class="panel-body">
61         <!--
62         <input type="text" class="form-control" placeholder="Search"/>
63         -->
64         <div style="height:0.5em;"></div>
65         <% if @object.owner %>
66           <p>Permissions inherited from:
67             <br />
68             <% if User == resource_class_for_uuid(@object.owner_uuid) %>
69               <i class="fa fa-fw fa-user"></i>
70             <% else %>
71               <i class="fa fa-fw fa-folder"></i>
72             <% end %>
73             <%= link_to_if_arvados_object @object.owner_uuid, friendly_name: true %>
74             <%= button_to('Move to...',
75                 choose_folders_path(
76                  title: 'Move to...',
77                  editable: true,
78                  action_name: 'Move',
79                  action_href: folder_path(@object.uuid),
80                  action_method: 'put',
81                  action_data: {selection_param: 'folder[owner_uuid]'}.to_json),
82                 { class: "btn btn-default btn-xs arv-move-to-folder", remote: true, method: 'get' }) %>
83           </p>
84           <hr />
85         <% end %>
86         <p>
87           <% if not @share_links.any? %>
88             <span class="deemphasize">(No additional permissions)</span>
89           <% else %>
90             Also shared with:
91             <% @share_links.andand.each do |link| %>
92               <br /><%= link_to_if_arvados_object link.tail_uuid, friendly_name: true %>
93             <% end %>
94           <% end %>
95         </p>
96       </div>
97     </div>
98   </div>
99 </div>
100
101 <% if @show_cards %>
102 <!-- disable cards section until we have bookmarks -->
103 <div class="row">
104   <% @objects[0..3].each do |object| %>
105   <div class="card arvados-object">
106     <div class="card-top blue">
107       <a href="#">
108         <img src="/favicon.ico" alt=""/>
109       </a>
110     </div>
111     <div class="card-info">
112       <span class="title"><%= @objects.name_for(object) || object.class_for_display %></span>
113       <div class="desc"><%= object.respond_to?(:description) ? object.description : object.uuid %></div>
114     </div>
115     <div class="card-bottom">
116       <%= render :partial => "show_object_button", :locals => {object: object, htmloptions: {class: 'btn-default btn-block'}} %>
117     </div>
118   </div>
119   <% end %>
120 </div>
121 <!-- end disabled cards section -->
122 <% end %>
123
124 <div class="row">
125   <div class="col-md-12">
126     <div class="panel panel-info">
127       <div class="panel-heading">
128         <div class="row">
129           <div class="col-md-6">
130             <h3 class="panel-title" style="vertical-align:middle;">
131               Contents
132             </h3>
133           </div>
134           <div class="col-md-6">
135             <div class="input-group input-group-sm pull-right">
136               <input type="text" class="form-control search-folder-contents" placeholder="Search folder contents"/>
137             </div>
138           </div>
139         </div>
140       </div>
141       <div class="panel-body">
142         <p>
143         </p>
144         <table class="table table-condensed arv-index">
145           <tbody>
146             <colgroup>
147               <col width="3%" />
148               <col width="8%" />
149               <col width="30%" />
150               <col width="15%" />
151               <col width="15%" />
152               <col width="20%" />
153               <col width="8%" />
154             </colgroup>
155             <% @objects_and_names.each do |object, name_link| %>
156               <tr data-object-uuid="<%= (name_link && name_link.uuid) || object.uuid %>">
157                 <td>
158                   <%= render :partial => "selection_checkbox", :locals => {object: object} %>
159                 </td>
160                 <td>
161                   <%= render :partial => "show_object_button", :locals => {object: object, size: 'xs'} %>
162                 </td>
163                 <td>
164                   <%= render_editable_attribute name_link, 'name', nil, {data: {emptytext: "Unnamed #{object.class_for_display}"}} %>
165                 </td>
166                 <td>
167                   <%= object.content_summary %>
168                 </td>
169                 <td title="<%= object.modified_at %>">
170                   <span>
171                     <%= raw distance_of_time_in_words(object.modified_at, Time.now).sub('about ','~').sub(' ','&nbsp;') + '&nbsp;ago' rescue object.modified_at %>
172                   </span>
173                 </td>
174                 <td class="arvados-uuid">
175                   <%= object.uuid %>
176                 </td>
177                 <td>
178                   <% if @object.editable? %>
179                     <%= link_to({action: 'remove_item', id: @object.uuid, item_uuid: ((name_link && name_link.uuid) || object.uuid)}, method: :delete, remote: true, data: {confirm: "You are about to remove #{object.class_for_display} #{object.uuid} from this folder.\n\nAre you sure?"}, class: 'btn btn-xs btn-default') do %>
180                       Remove <i class="fa fa-fw fa-ban"></i>
181                     <% end %>
182                   <% end %>
183                 </td>
184               </tr>
185             <% end %>
186           </tbody>
187           <thead>
188             <tr>
189               <th>
190               </th>
191               <th>
192               </th>
193               <th>
194                 name
195               </th>
196               <th>
197                 type
198               </th>
199               <th>
200                 modified
201               </th>
202               <th>
203                 uuid
204               </th>
205               <th>
206               </th>
207             </tr>
208           </thead>
209         </table>
210         <p></p>
211       </div>
212     </div>
213   </div>
214 </div>