sufia 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +247 -215
  3. data/README.md +7 -3
  4. data/SUFIA_VERSION +1 -1
  5. data/app/assets/javascripts/sufia.js +5 -2
  6. data/app/assets/javascripts/sufia/proxy_rights.js +68 -0
  7. data/app/assets/javascripts/sufia/transfers.js +3 -0
  8. data/app/assets/javascripts/sufia/user_search.js +31 -0
  9. data/app/assets/stylesheets/jquery-ui.css +17 -17
  10. data/app/assets/stylesheets/sufia.css.scss +3 -2
  11. data/app/assets/stylesheets/sufia/_proxy-rights.scss +10 -0
  12. data/app/controllers/concerns/sufia/contact_form_controller_behavior.rb +22 -23
  13. data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +41 -0
  14. data/app/controllers/concerns/sufia/files_controller_behavior.rb +1 -0
  15. data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +76 -0
  16. data/app/controllers/concerns/sufia/users_controller_behavior.rb +9 -11
  17. data/app/controllers/depositors_controller.rb +3 -0
  18. data/app/controllers/transfers_controller.rb +3 -0
  19. data/app/helpers/sufia/dashboard_helper_behavior.rb +15 -0
  20. data/app/helpers/sufia/sufia_helper_behavior.rb +24 -2
  21. data/app/jobs/content_depositor_change_event_job.rb +50 -0
  22. data/app/views/dashboard/_index_partials/_contents.html.erb +18 -0
  23. data/app/views/dashboard/_index_partials/_proxy_rights.html.erb +23 -0
  24. data/app/views/dashboard/_index_partials/_transfers.html.erb +14 -0
  25. data/app/views/generic_files/proxy.html.erb +5 -0
  26. data/app/views/generic_files/upload/_form.html.erb +7 -2
  27. data/app/views/my/_action_menu.html.erb +3 -1
  28. data/app/views/records/edit_fields/_default.html.erb +1 -1
  29. data/app/views/transfers/_received.html.erb +58 -0
  30. data/app/views/transfers/_sent.html.erb +38 -0
  31. data/app/views/transfers/index.html.erb +7 -0
  32. data/app/views/transfers/new.html.erb +23 -0
  33. data/app/views/users/_proxies.html.erb +8 -0
  34. data/app/views/users/_user_util_links_extra.html.erb +1 -0
  35. data/app/views/users/edit.html.erb +6 -1
  36. data/config/locales/sufia.en.yml +9 -4
  37. data/config/routes.rb +14 -3
  38. data/lib/sufia.rb +7 -5
  39. data/lib/sufia/version.rb +1 -1
  40. data/spec/controllers/authorities_controller_spec.rb +6 -6
  41. data/spec/controllers/batch_controller_spec.rb +29 -29
  42. data/spec/controllers/batch_edits_controller_spec.rb +7 -7
  43. data/spec/controllers/catalog_controller_spec.rb +9 -9
  44. data/spec/controllers/collections_controller_spec.rb +28 -28
  45. data/spec/controllers/content_blocks_controller_spec.rb +3 -3
  46. data/spec/controllers/dashboard_controller_spec.rb +1 -1
  47. data/spec/controllers/depositors_controller_spec.rb +50 -0
  48. data/spec/controllers/downloads_controller_spec.rb +22 -22
  49. data/spec/controllers/featured_work_lists_controller_spec.rb +1 -1
  50. data/spec/controllers/featured_works_controller_spec.rb +1 -1
  51. data/spec/controllers/generic_files_controller_spec.rb +98 -90
  52. data/spec/controllers/homepage_controller_spec.rb +1 -1
  53. data/spec/controllers/mailbox_controller_spec.rb +10 -10
  54. data/spec/controllers/my/collections_controller_spec.rb +1 -1
  55. data/spec/controllers/my/files_controller_spec.rb +1 -1
  56. data/spec/controllers/my/highlights_controller_spec.rb +1 -1
  57. data/spec/controllers/my/shares_controller_spec.rb +1 -1
  58. data/spec/controllers/my_controller_spec.rb +1 -1
  59. data/spec/controllers/pages_controller_spec.rb +1 -1
  60. data/spec/controllers/single_use_links_controller_spec.rb +46 -50
  61. data/spec/controllers/single_use_links_viewer_controller_spec.rb +16 -16
  62. data/spec/controllers/static_controller_spec.rb +9 -9
  63. data/spec/controllers/tinymce_assets_controller_spec.rb +1 -1
  64. data/spec/controllers/transfers_controller_spec.rb +212 -0
  65. data/spec/controllers/users_controller_spec.rb +1 -1
  66. data/spec/factories/generic_files.rb +4 -4
  67. data/spec/factories/proxy_deposit_requests.rb +6 -0
  68. data/spec/features/browse_dashboard_files_spec.rb +25 -36
  69. data/spec/features/browse_files_spec.rb +18 -13
  70. data/spec/features/catalog_search_spec.rb +3 -6
  71. data/spec/features/cloud_upload_spec.rb +5 -7
  72. data/spec/features/collection_spec.rb +28 -35
  73. data/spec/features/contact_form_spec.rb +24 -24
  74. data/spec/features/display_dashboard_spec.rb +11 -11
  75. data/spec/features/ingest_upload_files_spec.rb +10 -10
  76. data/spec/features/notifications_spec.rb +11 -11
  77. data/spec/features/ownership_transfer_spec.rb +111 -0
  78. data/spec/features/proxy_spec.rb +52 -0
  79. data/spec/features/search_spec.rb +1 -1
  80. data/spec/features/single_use_links_spec.rb +28 -18
  81. data/spec/features/users_spec.rb +3 -3
  82. data/spec/helpers/batch_edits_helper_spec.rb +1 -1
  83. data/spec/helpers/content_block_helper_spec.rb +1 -1
  84. data/spec/helpers/dashboard_helper_spec.rb +1 -1
  85. data/spec/helpers/generic_file_helper_spec.rb +1 -1
  86. data/spec/helpers/records_helper_spec.rb +1 -1
  87. data/spec/helpers/sufia_helper_spec.rb +8 -8
  88. data/spec/helpers/trophy_helper_spec.rb +1 -1
  89. data/spec/jobs/audit_job_spec.rb +5 -5
  90. data/spec/jobs/batch_update_job_spec.rb +14 -14
  91. data/spec/jobs/content_depositor_change_event_job_spec.rb +22 -0
  92. data/spec/jobs/event_jobs_spec.rb +104 -104
  93. data/spec/jobs/import_url_job_spec.rb +2 -2
  94. data/spec/jobs/ingest_local_file_job_spec.rb +1 -1
  95. data/spec/lib/sufia/breadcrumbs_spec.rb +3 -3
  96. data/spec/lib/sufia/id_service_spec.rb +1 -1
  97. data/spec/lib/sufia/upload_complete_behavior_spec.rb +4 -4
  98. data/spec/models/ability_spec.rb +59 -15
  99. data/spec/models/batch_spec.rb +16 -16
  100. data/spec/models/characterization_spec.rb +1 -1
  101. data/spec/models/checksum_audit_log_spec.rb +34 -26
  102. data/spec/models/collection_spec.rb +1 -1
  103. data/spec/models/download_spec.rb +1 -1
  104. data/spec/models/featured_work_list_spec.rb +1 -1
  105. data/spec/models/featured_work_spec.rb +15 -4
  106. data/spec/models/file_content_datastream_spec.rb +14 -14
  107. data/spec/models/file_usage_spec.rb +1 -1
  108. data/spec/models/fits_datastream_spec.rb +1 -1
  109. data/spec/models/generic_file/reload_on_save_spec.rb +4 -4
  110. data/spec/models/generic_file/visibility_spec.rb +1 -1
  111. data/spec/models/generic_file/web_form_spec.rb +6 -5
  112. data/spec/models/generic_file_rdf_datastream_spec.rb +1 -1
  113. data/spec/models/generic_file_spec.rb +254 -220
  114. data/spec/models/geo_names_resource_spec.rb +2 -2
  115. data/spec/models/local_authority_spec.rb +60 -59
  116. data/spec/models/pageview_spec.rb +1 -1
  117. data/spec/models/properties_datastream_spec.rb +29 -10
  118. data/spec/models/proxy_deposit_request_spec.rb +107 -0
  119. data/spec/models/single_use_link_spec.rb +13 -13
  120. data/spec/models/solr_document_spec.rb +1 -1
  121. data/spec/models/trophy_spec.rb +6 -6
  122. data/spec/models/user_spec.rb +38 -22
  123. data/spec/routing/featured_works_route_spec.rb +1 -1
  124. data/spec/routing/ownership_transfers_route_spec.rb +45 -0
  125. data/spec/routing/route_spec.rb +42 -42
  126. data/spec/services/noid_spec.rb +2 -2
  127. data/spec/spec_helper.rb +10 -5
  128. data/spec/support/cleaner.rb +12 -0
  129. data/spec/support/features.rb +5 -0
  130. data/spec/support/features/session_helpers.rb +3 -17
  131. data/spec/support/locations.rb +36 -0
  132. data/spec/support/poltergeist.rb +11 -0
  133. data/spec/support/proxies.rb +14 -0
  134. data/spec/support/selectors.rb +122 -0
  135. data/spec/views/batch/edit.html.erb_spec.rb +1 -1
  136. data/spec/views/batch_edits/check_all_spec.rb +4 -4
  137. data/spec/views/catalog/index.html.erb_spec.rb +1 -1
  138. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +1 -1
  139. data/spec/views/collections/_form.html.erb_spec.rb +3 -1
  140. data/spec/views/collections/_show_descriptions.html.erb_spec.rb +1 -1
  141. data/spec/views/dashboard/index_spec.rb +3 -6
  142. data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
  143. data/spec/views/generic_file/show.html.erb_spec.rb +1 -1
  144. data/spec/views/generic_file/stats.html.erb_spec.rb +1 -1
  145. data/spec/views/my/facet.html.erb_spec.rb +2 -2
  146. data/spec/views/users/_follower_modal.html.erb_spec.rb +1 -1
  147. data/spec/views/users/_following_modal.html.erb_spec.rb +1 -1
  148. data/spec/views/users/_notify_number.html.erb_spec.rb +1 -1
  149. data/spec/views/users/_user_util_links.html.erb_spec.rb +1 -1
  150. data/spec/views/users/index.html.erb_spec.rb +2 -2
  151. data/spec/views/users/show.html.erb_spec.rb +2 -2
  152. data/sufia-models/app/models/concerns/sufia/ability.rb +22 -0
  153. data/sufia-models/app/models/concerns/sufia/generic_file.rb +1 -0
  154. data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +22 -0
  155. data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +3 -0
  156. data/sufia-models/app/models/concerns/sufia/user.rb +9 -0
  157. data/sufia-models/app/models/proxy_deposit_request.rb +85 -0
  158. data/sufia-models/app/models/proxy_deposit_rights.rb +4 -0
  159. data/sufia-models/app/models/sufia/avatar_uploader.rb +2 -3
  160. data/sufia-models/lib/generators/sufia/models/install_generator.rb +9 -1
  161. data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +53 -0
  162. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +16 -0
  163. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +11 -0
  164. data/sufia-models/lib/sufia/models/engine.rb +1 -1
  165. data/sufia-models/lib/sufia/models/version.rb +1 -1
  166. data/sufia.gemspec +2 -1
  167. data/tasks/sufia-dev.rake +5 -0
  168. metadata +82 -6
  169. data/tasks/sufia-db.rake +0 -21
@@ -24,14 +24,14 @@ module Sufia::UsersControllerBehavior
24
24
  format.html
25
25
  format.json { render json: @users.to_json }
26
26
  end
27
-
27
+
28
28
  end
29
29
 
30
30
  # Display user profile
31
31
  def show
32
32
  if @user.respond_to? :profile_events
33
- @events = @user.profile_events(100)
34
- else
33
+ @events = @user.profile_events(100)
34
+ else
35
35
  @events = []
36
36
  end
37
37
  @trophies = @user.trophy_files
@@ -65,7 +65,7 @@ module Sufia::UsersControllerBehavior
65
65
  redirect_to sufia.profile_path(@user.to_param), notice: "Your profile has been updated"
66
66
  end
67
67
 
68
- def toggle_trophy
68
+ def toggle_trophy
69
69
  id = Sufia::Noid.namespaceize params[:file_id]
70
70
  unless current_user.can? :edit, id
71
71
  redirect_to root_path, alert: "You do not have permissions to the file"
@@ -73,17 +73,16 @@ module Sufia::UsersControllerBehavior
73
73
  end
74
74
  # TODO make sure current user has access to file
75
75
  t = current_user.trophies.where(generic_file_id: params[:file_id]).first
76
- if t
77
- t.destroy
76
+ if t
77
+ t.destroy
78
78
  #TODO do this better says Mike
79
- return false if t.persisted?
79
+ return false if t.persisted?
80
80
  else
81
81
  t = current_user.trophies.create(generic_file_id: params[:file_id])
82
82
  return false unless t.persisted?
83
83
  end
84
84
  render json: t
85
- end
86
-
85
+ end
87
86
 
88
87
  # Follow a user
89
88
  def follow
@@ -105,7 +104,7 @@ module Sufia::UsersControllerBehavior
105
104
 
106
105
  protected
107
106
 
108
- # You can override base_query to return a list of arguments
107
+ # You can override base_query to return a list of arguments
109
108
  def base_query
110
109
  [nil]
111
110
  end
@@ -133,4 +132,3 @@ module Sufia::UsersControllerBehavior
133
132
  return sort_val
134
133
  end
135
134
  end
136
-
@@ -0,0 +1,3 @@
1
+ class DepositorsController < ApplicationController
2
+ include Sufia::DepositorsControllerBehavior
3
+ end
@@ -0,0 +1,3 @@
1
+ class TransfersController < ApplicationController
2
+ include Sufia::TransfersControllerBehavior
3
+ end
@@ -1,5 +1,20 @@
1
1
  module Sufia
2
2
  module DashboardHelperBehavior
3
+ def render_sent_transfers
4
+ if @outgoing.present?
5
+ render partial: 'transfers/sent'
6
+ else
7
+ t('sufia.dashboard.no_transfers')
8
+ end
9
+ end
10
+
11
+ def render_received_transfers
12
+ if @incoming.present?
13
+ render partial: 'transfers/received'
14
+ else
15
+ t('sufia.dashboard.no_transfer_requests')
16
+ end
17
+ end
3
18
 
4
19
  def render_recent_activity
5
20
  if @activity.empty?
@@ -1,5 +1,27 @@
1
1
  module Sufia
2
2
  module SufiaHelperBehavior
3
+ def error_messages_for(object)
4
+ if object.try(:errors) and object.errors.full_messages.any?
5
+ content_tag(:div, class: 'alert alert-block alert-error validation-errors') do
6
+ content_tag(:h4, I18n.t('sufia.errors.header', model: object.class.model_name.human.downcase), class: 'alert-heading') +
7
+ content_tag(:ul) do
8
+ object.errors.full_messages.map do |message|
9
+ content_tag(:li, message)
10
+ end.join('').html_safe
11
+ end
12
+ end
13
+ else
14
+ '' # return empty string
15
+ end
16
+ end
17
+
18
+ def show_transfer_request_title(req)
19
+ if req.deleted_file?
20
+ req.title
21
+ else
22
+ link_to(req.title, sufia.generic_file_path(req['pid'].split(':').last))
23
+ end
24
+ end
3
25
 
4
26
  # You can configure blacklight to use this as the thumbnail
5
27
  # example:
@@ -122,7 +144,7 @@ module Sufia
122
144
  def search_form_action
123
145
  if on_the_dashboard?
124
146
  search_action_for_dashboard
125
- else
147
+ else
126
148
  catalog_index_path
127
149
  end
128
150
  end
@@ -156,7 +178,7 @@ module Sufia
156
178
  sufia.dashboard_highlights_path
157
179
  else
158
180
  sufia.dashboard_files_path
159
- end
181
+ end
160
182
  end
161
183
 
162
184
  end
@@ -0,0 +1,50 @@
1
+ class ContentDepositorChangeEventJob < EventJob
2
+
3
+ def queue_name
4
+ :proxy_deposit
5
+ end
6
+
7
+ attr_accessor :pid, :login, :reset
8
+
9
+ # @param [String] pid identifier of the file to be transfered
10
+ # @param [String] login the user key of the user the file is being transfered to.
11
+ # @param [Boolean] reset (false) should the access controls be reset. This means revoking edit access from the depositor
12
+ def initialize(pid, login, reset=false)
13
+ self.pid = pid
14
+ self.login = login
15
+ self.reset = reset
16
+ end
17
+
18
+ def run
19
+ # TODO: This should be in its own job, not this event job
20
+ file = ::GenericFile.find(pid)
21
+ file.proxy_depositor = file.depositor
22
+ file.rightsMetadata.clear_permissions! if reset
23
+ file.apply_depositor_metadata(login)
24
+ file.save!
25
+
26
+ action = "User #{link_to_profile file.proxy_depositor} has transferred #{link_to file.title.first, Sufia::Engine.routes.url_helpers.generic_file_path(file.noid)} to User #{link_to_profile login}"
27
+ timestamp = Time.now.to_i
28
+ depositor = ::User.find_by_user_key(file.depositor)
29
+ proxy_depositor = ::User.find_by_user_key(file.proxy_depositor)
30
+ # Create the event
31
+ event = proxy_depositor.create_event(action, timestamp)
32
+ # Log the event to the GF's stream
33
+ file.log_event(event)
34
+
35
+ #log the event to the depositor
36
+ log_depositor_event(event, depositor, file)
37
+
38
+ #log the event to the proxy_depositor
39
+ log_depositor_event(event, proxy_depositor, file)
40
+ end
41
+
42
+ def log_depositor_event(event, depositor, gf)
43
+ # Log the event to the depositor's profile stream
44
+ depositor.log_profile_event(event)
45
+ # Fan out the event to all followers who have access
46
+ depositor.followers.select { |user| user.can? :read, gf }.each do |follower|
47
+ follower.log_event(event)
48
+ end
49
+ end
50
+ end
@@ -16,3 +16,21 @@
16
16
  <%= link_to_additional_notifications %>
17
17
  </div>
18
18
  </div>
19
+
20
+ <div class="panel panel-default" id="proxy_management">
21
+ <div class="panel-heading dashboard-panel">
22
+ <h3 class="panel-title ">Manage Proxies</h3>
23
+ </div>
24
+ <div class="panel-body">
25
+ <%= render partial: 'dashboard/_index_partials/proxy_rights' %>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="panel panel-default" id="transfers">
30
+ <div class="panel-heading dashboard-panel">
31
+ <h3 class="panel-title "><%= t("sufia.dashboard.transfer_of_ownership") %></h3>
32
+ </div>
33
+ <div class="panel-body">
34
+ <%= render partial: 'dashboard/_index_partials/transfers' %>
35
+ </div>
36
+ </div>
@@ -0,0 +1,23 @@
1
+ <div class="clearfix proxy-rights">
2
+
3
+ <div class="col-xs-6 proxy-search">
4
+ <h3 class="panel-title">Authorize Proxy</h3>
5
+ <label class="sr-only" for="user">Proxy User</label>
6
+ <%= hidden_field_tag :user, nil, data: { grantor: current_user.to_param } %>
7
+ </div>
8
+
9
+ <div class="col-xs-6">
10
+ <h3 class="panel-title">Current Proxies</h3>
11
+ <table class="table table-condensed table-striped" id="authorizedProxies">
12
+ <tbody>
13
+ <% @user.can_receive_deposits_from.each do |depositor| %>
14
+ <tr><td class="depositor-name"><%= depositor.name %></td>
15
+ <td><%= link_to(sufia.user_depositor_path(@user, depositor), method: :delete, class: "remove-proxy-button") do %>
16
+ <i class="glyphicon glyphicon-remove"></i><% end %>
17
+ </td></tr>
18
+ <% end %>
19
+ </tbody>
20
+ </table>
21
+ </div>
22
+
23
+ </div>
@@ -0,0 +1,14 @@
1
+ <div class="row">
2
+ <div class="col-xs-12 col-sm-9">
3
+ <h4>Sent</h4>
4
+ </div>
5
+ <div class="col-xs-12 col-sm-3 transfer_link">
6
+ <%= link_to sufia.dashboard_files_path do %>
7
+ <%= t("sufia.dashboard.transfer_files_link") %>
8
+ <% end %>
9
+ </div>
10
+ </div>
11
+ <%= render_sent_transfers %>
12
+
13
+ <h4>Received</h4>
14
+ <%= render_received_transfers %>
@@ -0,0 +1,5 @@
1
+ <%= @proxy_deposit_request.sending_user %> has deposited the file <%= @generic_file.title %> on your behalf.
2
+
3
+ <%= form_for @proxy_deposit_request do |f| %>
4
+ <% f.submit "Accept" %>
5
+ <% end %>
@@ -1,6 +1,11 @@
1
- <%= form_for(@generic_file, url: sufia.generic_files_path, html: {multipart: true, id: 'fileupload'}) do |f| %>
1
+ <%= form_for(@generic_file, url: sufia.generic_files_path, html: { multipart: true, id: 'fileupload' }) do |f| %>
2
+ <% unless current_user.can_make_deposits_for.empty? %>
3
+ <div class="controls">
4
+ <%= label_tag :on_behalf_of, 'On Behalf of' %>
5
+ <%= select_tag :on_behalf_of, options_for_select(current_user.can_make_deposits_for), prompt: "Yourself" %>
6
+ </div>
7
+ <% end %>
2
8
  <div class="well">
3
9
  <%= render partial: 'generic_files/upload/form_fields' %>
4
10
  </div>
5
11
  <% end %>
6
-
@@ -27,6 +27,8 @@
27
27
  <i aria-hidden="true" class='glyphicon glyphicon-star'></i> <%= text %>
28
28
  <% end %>
29
29
  </li>
30
+ <li>
31
+ <%= link_to raw('<i class="glyphicon glyphicon-transfer" aria-hidden="true"></i> Transfer Ownership of File'), sufia.new_generic_file_transfer_path(noid), class: 'itemicon itemtransfer', title: 'Transfer Ownership of File' if gf.depositor == @user.user_key %>
32
+ </li>
30
33
  </ul>
31
34
  </div>
32
-
@@ -1,6 +1,6 @@
1
1
  <div <% if index == 0 %> id="additional_<%= key.to_s %>_clone" <% end %>>
2
2
  <% required = render_req && (index == 0) && record.required?(key) %>
3
3
  <%= f.text_field :title, name: "#{ActiveModel::Naming.singular(f.object)}[#{key.to_s}][]", id: "#{ActiveModel::Naming.singular(f.object)}_#{key.to_s}", value: v, class: "input-large", required: required %>
4
- <%= render partial: "records/edit_fields/suffix", locals: { key: key, index: index } %>
4
+ <%= render partial: "records/edit_fields/suffix", locals: { key: key, index: index, single: f.object.class.unique?(key) } %>
5
5
  </div>
6
6
  <div id="additional_<%= key %>_elements"></div>
@@ -0,0 +1,58 @@
1
+ <table class="table table-striped" id="incoming-transfers">
2
+ <thead>
3
+ <tr>
4
+ <th>Title</th>
5
+ <th>Date</th>
6
+ <th>From</th>
7
+ <th>Status</th>
8
+ <th>Comments</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% @incoming.each do |req| %>
13
+ <% unless req.sending_user.blank? %>
14
+ <tr>
15
+ <td> <%= show_transfer_request_title(req) %> </td>
16
+ <td class="sorts-dash">
17
+ <% if req.created_at > Time.now.beginning_of_day %>
18
+ <%= "#{time_ago_in_words(req.created_at)} ago"%>
19
+ <% else %>
20
+ <%= req.created_at.strftime("%b %d %Y") %>
21
+ <% end %>
22
+ </td>
23
+ <td><%= link_to req.sending_user.name, sufia.profile_path(req.sending_user) %></td>
24
+ <td>
25
+ <% if req.pending? %>
26
+ <div class="btn-group">
27
+ <button class="btn btn-primary" href="#">Accept</button>
28
+ <button class="btn btn-small dropdown-toggle accept" data-toggle="dropdown" href="#"><span class="caret"></span></button>
29
+ <ul class="dropdown-menu">
30
+ <li>
31
+ <%= link_to 'Allow depositor to retain edit access', sufia.accept_transfer_path(req), method: :put, class: 'accept-retain', title: 'Accept the file and allow the original depositor to retain access to edit the file and metadat' %>
32
+ </li>
33
+ <li>
34
+ <%= link_to 'Remove depositor access', sufia.accept_transfer_path(req, reset: true), method: :put, class: 'accept-reset', title: 'Accept the file remove access from the original depositor.' %>
35
+ </li>
36
+ <li>
37
+ <%= link_to 'Authorize depositor as proxy', sufia.accept_transfer_path(req, sticky: true), method: :put, class: 'accept-stick', title: 'Accept the file and allow the original depositor to retain access and authorize the original depositor as a proxy to deposit file on your behalf.' %>
38
+ </li>
39
+ </ul>
40
+ </div>
41
+
42
+ <%#= button_to "Accept and allow depositor to retain edit access", sufia.accept_transfer_path(req), method: :put, class: 'btn btn-primary' %>
43
+ <%#= button_to "Accept and reset access", sufia.accept_transfer_path(req, reset: true), method: :put, class: 'btn btn-primary' %>
44
+ <%#= button_to "Accept & Authorize Proxy", sufia.accept_transfer_path(req, sticky: true), method: :put, class: 'btn btn-primary' %>
45
+ <%= button_to "Reject", sufia.reject_transfer_path(req), method: :put, class: 'btn btn-danger', data: {confirm: "Are you sure you want to reject this request?"} %>
46
+ <% else %>
47
+ <%= req.status.capitalize %>
48
+ <% end %>
49
+ </td>
50
+
51
+ <td><%= req.sender_comment %></td>
52
+ </tr>
53
+ <% else %>
54
+ <% Rails.logger.error "A proxy request has no sender: #{req.inspect}" %>
55
+ <% end %>
56
+ <% end %>
57
+ </tbody>
58
+ </table>
@@ -0,0 +1,38 @@
1
+ <table class="table table-striped" id="outgoing-transfers">
2
+ <thead>
3
+ <tr>
4
+ <th>Title</th>
5
+ <th>Date</th>
6
+ <th>To</th>
7
+ <th>Status</th>
8
+ <th>Comments</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% @outgoing.each do |req| %>
13
+ <% unless req.receiving_user.blank? %>
14
+ <tr>
15
+ <td> <%= show_transfer_request_title(req) %> </td>
16
+ <td class="sorts-dash">
17
+ <% if req.created_at > Time.now.beginning_of_day %>
18
+ <%= "#{time_ago_in_words(req.created_at)} ago"%>
19
+ <% else %>
20
+ <%= req.created_at.strftime("%b %d %Y") %>
21
+ <% end %>
22
+ </td>
23
+ <td><%= link_to req.receiving_user.name, sufia.profile_path(req.receiving_user) %></td>
24
+ <td>
25
+ <% if req.pending? %>
26
+ <%= button_to "Cancel", sufia.transfer_path(req), method: :delete, class:'btn btn-danger', data: {confirm: "Are you sure you want to cancel this request?"} %>
27
+ <% else %>
28
+ <%= req.status.capitalize %>
29
+ <% end %>
30
+ </td>
31
+ <td><%= req.sender_comment %></td>
32
+ </tr>
33
+ <% else %>
34
+ <% Rails.logger.error "A proxy request has no receiver: #{req.inspect}" %>
35
+ <% end %>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
@@ -0,0 +1,7 @@
1
+ <h1>Transfer of Ownership</h1>
2
+
3
+ <h2>Sent</h2>
4
+ <%= render_sent_transfers %>
5
+
6
+ <h2>Received</h2>
7
+ <%= render_received_transfers %>
@@ -0,0 +1,23 @@
1
+ <h1>Transfer ownership of "<%= @proxy_deposit_request.title %>"</h1>
2
+ <span class="sr-only">Select a user to transfer <%= @proxy_deposit_request.title %> to, add optional comments and then press transfer.</span>
3
+ <%= form_for @proxy_deposit_request, url: sufia.generic_file_transfers_path(@generic_file), html: {class: 'form-horizontal', id: 'new_transfer'} do |f| %>
4
+ <div class="well">
5
+ <%= error_messages_for(f.object) %>
6
+ <div class="control-group">
7
+ <%= f.label :transfer_to, "User", class: 'control-label' %>
8
+ <div class="controls">
9
+ <%= f.text_field :transfer_to, "aria-hidden" => true %>
10
+ </div>
11
+ </div>
12
+ <div class="control-group">
13
+ <%= f.label :sender_comment, "Comments", class: 'control-label' %>
14
+ <div class="controls">
15
+ <%= f.text_area :sender_comment %>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="form-actions">
21
+ <%= f.submit "Transfer", class: 'btn btn-primary', data: {confirm: "Are you sure you want to transfer ownership of this file to another user? Click Ok to transfer or Cancel to return to the transfer screen"} %>
22
+ </div>
23
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <div class="tab-pane" id="proxies">
2
+ <h2>Proxies</h2>
3
+ <% @user.can_receive_deposits_from.each do |depositor| %>
4
+ <tr><td><%= link_to_profile depositor.user_key %></td>
5
+ </tr>
6
+ <% end %>
7
+
8
+ </div> <!-- /profile -->
@@ -2,3 +2,4 @@
2
2
  <% # render on the user utility button using the sample HTML shown below %>
3
3
  <% # %>
4
4
  <% # <li><%= link_to 'text', 'path', id: 'extra_nav_link' </li> %>
5
+ <li><%= link_to raw('<i class="glyphicon glyphicon-transfer"></i> transfer requests'), sufia.transfers_path, id: 'transfer_nav_link' %></li>
@@ -1,5 +1,6 @@
1
1
  <h1>Edit Profile</h1>
2
- <div class="col-xs-12 col-sm-5 well">
2
+ <div class="col-xs-12 col-sm-5">
3
+ <div class="well">
3
4
  <%= form_for @user, url: sufia.profile_path(@user.to_param), html: {multipart: true, class: 'form-horizontal' } do |f| %>
4
5
  <div class="form-group">
5
6
  <%= f.label :avatar, '<i class="glyphicon glyphicon-camera"></i> Change picture'.html_safe, class: "col-xs-4 control-label" %>
@@ -53,6 +54,10 @@
53
54
 
54
55
  <%= f.button '<i class="glyphicon glyphicon-save"></i> Save Profile'.html_safe, type: 'submit', class: "btn btn-primary" %>
55
56
  <% end %>
57
+ </div>
58
+ <div class="well">
59
+ <%= render partial: 'dashboard/_index_partials/proxy_rights' %>
60
+ </div>
56
61
  </div><!-- .col-xs-5 /well-->
57
62
 
58
63
  <div class="col-xs-12 col-sm-offset-1 col-sm-6 well">