[ARVADOS] updated: c8471ae15fddf918fd77045491aca20b3371b3d0

git at public.curoverse.com git at public.curoverse.com
Mon Jan 6 18:02:48 EST 2014


Summary of changes:
 .../app/views/layouts/application.html.erb         |    1 +
 .../app/views/user_agreements/index.html.erb       |   39 ++++++++++++++------
 2 files changed, 29 insertions(+), 11 deletions(-)

       via  c8471ae15fddf918fd77045491aca20b3371b3d0 (commit)
      from  7e951eab94d0c984779b673d915c2736e730103b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit c8471ae15fddf918fd77045491aca20b3371b3d0
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jan 6 15:00:35 2014 -0800

    If there is only one user agreement, show it inline with an OBJECT tag
    instead of making the user open it in a separate window.
    
    closes #1797
    closes #1813

diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index f92b32c..ce8689c 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -26,6 +26,7 @@
     padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
     }
     @media (max-width: 979px) { body { padding-top: 0; } }
+    <%= yield :css %>
   </style>
 </head>
 <body>
diff --git a/apps/workbench/app/views/user_agreements/index.html.erb b/apps/workbench/app/views/user_agreements/index.html.erb
index 59d9282..6cad423 100644
--- a/apps/workbench/app/views/user_agreements/index.html.erb
+++ b/apps/workbench/app/views/user_agreements/index.html.erb
@@ -4,25 +4,42 @@
 
 <button data-toggle="modal" href="#open_user_agreement" class="btn btn-primary">Show details</button>
 
+<% n_files = @required_user_agreements.collect(&:files).flatten(1).count %>
+
+<% if n_files == 1 %>
+<% content_for :css do %>
+#open_user_agreement { width: 900px; margin-left: -450px; }
+#open_user_agreement .modal-body { max-height: 900px; }
+<% end %>
+<% end %>
+
 <div id="open_user_agreement" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="uaModalLabel" aria-hidden="true" data-show="true">
   <%= form_for(@required_user_agreements.first, {url: {action: 'sign', controller: 'user_agreements'}}) do |f| %>
-    <%= hidden_field_tag :return_to, request.url %>
-  <% n_files = @required_user_agreements.collect(&:files).flatten(1).count %>
+  <%= hidden_field_tag :return_to, request.url %>
   <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
     <h3 id="uaModalLabel">User agreement<%= 's' if n_files != 1 %></h3>
   </div>
   <div class="modal-body">
-    <p>Please check <%= n_files > 1 ? 'each' : 'the' %> box to indicate that you have read and accepted the agreement.</p>
-    <% @required_user_agreements.each do |ua| %>
-    <% ua.files.each do |file| %>
-    <%= f.label 'checked[]', class: 'checkbox inline' do %>
-    <%= check_box_tag 'checked[]', "#{ua.uuid}/#{file[0]}/#{file[1]}", false %>
-    <%= link_to 'view', {controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}"}, {target: '_blank', class: 'label label-info'} %>
-    <%= file[1] %>
-    <% end %>
-    <% end %>
+    <% if n_files == 1 %>
+      <% ua = @required_user_agreements.first; file = ua.files.first %>
+      <object data="<%= url_for(controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}") %>" type="<%= Rack::Mime::MIME_TYPES[file[1]] || 'application/pdf' %>" width="100%" height="400px">
+      </object>
     <% end %>
+    <div class="alert alert-info">
+      <strong>Please check <%= n_files > 1 ? 'each' : 'the' %> box</strong> to indicate that you have read and accepted the agreement.
+    </div>
+    <div style="margin-left: 4em">
+      <% @required_user_agreements.each do |ua| %>
+      <% ua.files.each do |file| %>
+      <%= f.label 'checked[]', class: 'checkbox inline' do %>
+      <%= check_box_tag 'checked[]', "#{ua.uuid}/#{file[0]}/#{file[1]}", false %>
+      <%= link_to 'open', {controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}"}, {target: '_blank', class: 'label label-info'} %>
+      <%= file[1] %>
+      <% end %>
+      <% end %>
+      <% end %>
+    </div>
   </div>
   <div class="modal-footer">
     <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list