1 <h1>User agreements</h1>
3 <p>You must read and sign all applicable user agreements before continuing.</p>
5 <button data-toggle="modal" href="#open_user_agreement" class="btn btn-primary">Show details</button>
7 <div id="open_user_agreement" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="uaModalLabel" aria-hidden="true" data-show="true">
8 <%= form_for(@required_user_agreements.first, {url: {action: 'sign', controller: 'user_agreements'}}) do |f| %>
9 <%= hidden_field_tag :return_to, request.url %>
10 <% n_files = @required_user_agreements.collect(&:files).flatten(1).count %>
11 <div class="modal-header">
12 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
13 <h3 id="uaModalLabel">User agreement<%= 's' if n_files != 1 %></h3>
15 <div class="modal-body">
16 <p>Please check <%= n_files > 1 ? 'each' : 'the' %> box to indicate that you have read and accepted the agreement.</p>
17 <% @required_user_agreements.each do |ua| %>
18 <% ua.files.each do |file| %>
19 <%= f.label 'checked[]', class: 'checkbox inline' do %>
20 <%= check_box_tag 'checked[]', "#{ua.uuid}/#{file[0]}/#{file[1]}", false %>
21 <%= link_to 'view', {controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}"}, {target: '_blank', class: 'label label-info'} %>
27 <div class="modal-footer">
28 <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
29 <%= f.submit 'Accept', {class: 'btn btn-primary', disabled: true} %>
34 <% content_for :footer_js do %>
35 $('#open_user_agreement').modal();
36 $('#open_user_agreement input[name="checked[]"]').on('click', function() {
37 var dialog = $('#open_user_agreement')[0]
38 $('input[type=submit]', dialog).prop('disabled',false);
39 $('input[name="checked[]"]', dialog).each(function(){
41 $('input[type=submit]', dialog).prop('disabled',true);