refs #6279
[arvados.git] / apps / workbench / app / views / users / _manage_repositories.html.erb
index 7ff11bd2161c044fceedad4bc52daf7872a89f58..bcf0d643198a7f33ccc8eaee48a3de2bb8692564 100644 (file)
@@ -1,36 +1,62 @@
-<div>
+<div class="panel panel-default">
+  <div class="panel-heading">
+    <div class="pull-right">
+      <%= link_to raw('<i class="fa fa-plus"></i> Add new repository'), "#",
+                   {class: 'btn btn-xs btn-primary', 'data-toggle' => "modal",
+                    'data-target' => '#add-repository-modal'}  %>
+    </div>
+    <h4 class="panel-title">
+      <a data-parent="#arv-adv-accordion" href="#manage_repositories">
+        Repositories
+      </a>
+    </h4>
+  </div>
+
+<div id="manage_repositories" class="panel-body">
   <p>
     For more information see <%= link_to raw('Writing a pipeline'),
-    "#{Rails.configuration.arvados_docsite}/user/tutorials/tutorial-firstscript.html", target: "_blank"%>
+    "#{Rails.configuration.arvados_docsite}/user/tutorials/tutorial-firstscript.html", target: "_blank"%>.
   </p>
 
-  <table class="table repositories-table">
-    <colgroup>
-      <col style="width: 30%" />
-      <col style="width: 10%" />
-      <col style="width: 60%" />
-    </colgroup>
-    <thead>
-      <tr>
-        <th> Name </th>
-        <th> Writable </th>
-        <th> URL </th>
-      </tr>
-    </thead>
-    <tbody>
-      <% @my_repositories.andand.each do |repo| %>
+  <% if !@my_repositories.any? %>
+    You do not seem to have access to any repositories. If you would like to request access, please contact your system admin.
+  <% else %>
+    <table class="table repositories-table">
+      <colgroup>
+        <col style="width: 30%" />
+        <col style="width: 10%" />
+        <col style="width: 60%" />
+      </colgroup>
+      <thead>
         <tr>
-          <td style="word-break:break-all;">
-            <%= repo[:name] %>
-          </td>
-          <td>
-            <%= repo[:push_url] != nil %>
-          </td>
-          <td style="word-break:break-all;">
-            <%= repo[:fetch_url] %>
-          </td>
+          <th> Name </th>
+          <th> Read/Write </th>
+          <th> URL </th>
+          <th> </th>
         </tr>
-      <% end %>
-    </tbody>
-  </table>
+      </thead>
+      <tbody>
+        <% @my_repositories.andand.each do |repo| %>
+          <% writable = @repo_writable[repo.uuid] %>
+          <tr>
+            <td style="word-break:break-all;">
+              <%= repo[:name] %>
+            </td>
+            <td>
+              <%= writable ? 'writable' : 'read-only' %>
+            </td>
+            <td style="word-break:break-all;">
+              <code><%= writable ? repo.push_url : repo.fetch_url %></code>
+            </td>
+            <td>
+              <% if writable == 'can_manage' %>
+                <%= link_to "Share", "/repositories/#{repo[:uuid]}#Sharing" %>
+              <% end %>
+            </td>
+          </tr>
+        <% end %>
+      </tbody>
+    </table>
+  <% end %>
+</div>
 </div>