fcrepo_admin 0.5.3 → 0.5.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e26f1848c179673df8ef4efefa687c718365bcb
4
- data.tar.gz: ba0010feb90c17d3853f647f0f9a0cd1b2ea8e30
3
+ metadata.gz: 846f4e519831674baf94f1db10f8c40196136d58
4
+ data.tar.gz: 643de27ff77646f00ab3fde0b5d73e3a79da4157
5
5
  SHA512:
6
- metadata.gz: 7a47b722727bc7eb6f4518a425fc050752585b9ec1493901ef7ee84db04a9c7fc9f30d715841180a53aa4163dc7c20d7864f95b9748b337ef8db5e2a881b88f1
7
- data.tar.gz: 3c5218ad09ed98edae213f2fa179b7b92f1c09c9c25e106d4f83b2a83b137923318ab35886929dc0c53a42c9834da8703bf010c32ac6bc0cdc3eab3f9e6428f4
6
+ metadata.gz: c2f5c11df23df0a4fc79ee771e95fa1a3537189d7c6532cc32feb11554524815b191a484ff0bb5e5b252a7ae3e61c3fc4531553d7cdf8e0890e26cbdf24b6b06
7
+ data.tar.gz: 045a7e428c0932f767175815aea618456879a57dbd7453894bf3c6e60bca27b041bf0f0a7ecd83e600c5618a597a9ff338995a1c0f71c66c3432e6126188969a
data/HISTORY.md CHANGED
@@ -1,18 +1,23 @@
1
+ #### 0.5.4 (2013-05-24)
2
+
3
+ * Changed config setting `associated_objects_sort_param` (v0.5.3) to `association_collection_query_sort_param`.
4
+ * Changed config setting `associated_objects_per_page` (v0.5.1) to `association_show_docs_per_page`.
5
+
1
6
  #### 0.5.3 (2013-05-23)
2
7
 
3
- * Added configuration setting `associated_object_sort_param` to specify Solr query sort clause for retrieving associated objects. Default is `nil`, meaning that no sort clause is used.
8
+ * Added configuration setting `associated_objects_sort_param` to specify Solr query sort clause for retrieving associated objects. Default is `nil`, meaning that no sort clause is used.
4
9
 
5
10
  #### 0.5.2 (2013-05-22)
6
11
 
7
12
  * Fixed association show view pagination by working around Kaminari.
8
13
  * Object XML (FOXML) accessible from object context nav.
9
- * Catalog show fields and show document actions displayed in object show view (summary).
14
+ * Catalog show document actions displayed in object show view (summary).
10
15
 
11
16
  #### 0.5.1 (2013-05-21)
12
17
 
13
18
  * Association show view paginated (Fixes #18).
14
19
  * Association show view uses blacklight document list rendering.
15
- * Object show view loads Solr document for object and incorporates Blacklight document show fields.
20
+ * Object show action loads Solr document for object and show view incorporates Blacklight document show fields.
16
21
 
17
22
  ### 0.5.0 (2013-05-17)
18
23
 
data/README.md CHANGED
@@ -65,10 +65,12 @@ instead of the catalog show view, create `app/helpers/blacklight_helper.rb` with
65
65
  module BlacklightHelper
66
66
  include Blacklight::BlacklightHelperBehavior # Default Blacklight behaviors
67
67
  include FcrepoAdmin::Helpers::BlacklightHelperBehavior # fcrepo_admin overrides
68
- # additional customizations here, if any
69
68
  end
70
69
  ```
71
70
 
71
+ If you have an existing custom blacklight helper module, simply include `FcrepoAdmin::Helpers::BlacklightHelperBehavior`
72
+ *after* `Blacklight::BlacklightHelperBehavior`.
73
+
72
74
  **Add audit trail support** (optional)
73
75
 
74
76
  To enable access to the Fedora audit trail data through the fcrepo_admin UI, include the
@@ -178,6 +180,22 @@ class Ability
178
180
  end
179
181
  ```
180
182
 
183
+ #### Associations
184
+
185
+ Due to issues with Rails partials and relative paths, in order to use Blacklight's default document index view behavior
186
+ on the associations show page and avoid missing template errors, fcrepo_admin provides a custom document partial at
187
+ `fcrepo_admin/catalog/document` that renders the partial at `catalog/document`, for which Blacklight provides a default.
188
+ If you have a custom document partial at a different path that you want to use for the document list on the associations
189
+ show page, you *may* be able to simply copy it to `app/views/fcrepo_admin/catalog/document`, or you might try putting
190
+ this content in that file:
191
+
192
+ ```
193
+ <%= render :partial => 'path/to/my/document', :locals => { :document => document, :document_counter => document_counter } %>
194
+ ```
195
+
196
+ replacing the partial path as appropriate. If anyone has a better solution or knows of a way to avoid providing the
197
+ document partial in fcrepo_admin admin, please submit a pull request.
198
+
181
199
  #### Read-only mode
182
200
 
183
201
  To suppress mutating behaviors (i.e, routes, nav items, etc.) regardless of user permissions,
@@ -192,6 +210,34 @@ FcrepoAdmin.read_only = true
192
210
  An effort has been made to support i18n on headings, menus, etc. See https://github.com/projecthydra/fcrepo-admin/blob/master/config/locales/fcrepo_admin.en.yml
193
211
  for the keys and consult the Rails documentation on how to provide your own translations or alternate text values.
194
212
 
213
+ ### Known Issues
214
+
215
+ #### Pagination
216
+
217
+ Kaminari as of version 0.14.1 does not support namespace-prefixed routes, which causes a routing error in Blacklight's
218
+ `paginate_rsolr_response` helper when called from within fcrepo_admin. In place of `paginate_rsolr_response` fcrepo_admin
219
+ use its own helper `safe_paginate_rsolr_response` which provides a basic set of pagination links without using Kaminari.
220
+
221
+ There is (as of 2013-05-24) an outstanding Kaminari pull request which resolves the routing issue (https://github.com/amatsuda/kaminari/pull/322).
222
+ You can implement this solution by adding to your application's Gemfile:
223
+
224
+ ```
225
+ gem 'kaminari', github: 'harai/kaminari', branch: 'route_prefix_prototype'
226
+ ```
227
+
228
+ and then override the `safe_paginate_rsolr_response` helper with something like:
229
+
230
+ ```ruby
231
+ def safe_paginate_rsolr_response(response)
232
+ paginate_rsolr_response response, :outer_window => 2, :theme => 'blacklight', :route_set => fcrepo_admin
233
+ end
234
+ ```
235
+
236
+ the key part being the `:route_set` option -- note that the value is not a string -- with gets passed through to Kaminari.
237
+
238
+ If Kaminari is suitably patched in the future, we will likely remove `safe_paginate_rsolr_response` in favor of
239
+ `paginate_rsolr_response`.
240
+
195
241
  ### Contributing
196
242
 
197
243
  * Consider first posting to hydra-tech@googlegroups.com with a question or bug report, or submit an issue
@@ -15,7 +15,7 @@ module FcrepoAdmin
15
15
  if @association.nil?
16
16
  render :text => "Association not found", :status => 404
17
17
  elsif @association.collection?
18
- get_collection_from_solr
18
+ @response, @documents = get_collection_from_solr
19
19
  else
20
20
  # This shouldn't normally happen b/c UI links directly to target object view in this case
21
21
  # but we'll handle it gracefully anyway.
@@ -31,8 +31,8 @@ module FcrepoAdmin
31
31
  protected
32
32
 
33
33
  def get_collection_from_solr
34
- @response = solr_response_for_raw_result(get_collection_query_result)
35
- @documents = solr_documents_for_response(@response)
34
+ solr_response = solr_response_for_raw_result(get_collection_query_result)
35
+ [solr_response, solr_documents_for_response(solr_response)]
36
36
  end
37
37
 
38
38
  def get_collection_query_result
@@ -41,11 +41,11 @@ module FcrepoAdmin
41
41
 
42
42
  def collection_query_args
43
43
  page = params[:page].blank? ? 1 : params[:page].to_i
44
- rows = FcrepoAdmin.associated_objects_per_page
44
+ rows = FcrepoAdmin.association_show_docs_per_page
45
45
  start = (page - 1) * rows
46
46
  args = {raw: true, start: start, rows: rows}
47
- if FcrepoAdmin.associated_objects_sort_param
48
- args[:sort] = FcrepoAdmin.associated_objects_sort_param
47
+ if FcrepoAdmin.association_collection_query_sort_param
48
+ args[:sort] = FcrepoAdmin.association_collection_query_sort_param
49
49
  end
50
50
  apply_gated_discovery(args, nil) # add args to enforce Hydra access controls
51
51
  args
@@ -1,17 +1,13 @@
1
1
  <h3><%= t("fcrepo_admin.object.associations.title") %>: <%= @association.name %></h3>
2
2
 
3
3
  <% if @response.total > 0 %>
4
- <% if @response.total > associated_objects_per_page %>
5
- <div class="pagination">
6
- <%= render_pagination_info @response %>
7
- </div>
8
- <% end %>
9
- <%= render :partial => 'catalog/document_list', :locals => {:documents => @documents} %>
10
- <% if @response.total > associated_objects_per_page %>
11
- <div class="pagination">
12
- <%= render :partial => 'pagination', :locals => {:pagination_info => paginate_params(@response)} %>
13
- </div>
14
- <% end %>
4
+ <div class="pagination">
5
+ <%= render_pagination_info @response %>
6
+ </div>
7
+ <%= render_document_index @documents %>
8
+ <div class="pagination">
9
+ <%= safe_paginate_rsolr_response @response %>
10
+ </div>
15
11
  <% else %>
16
12
  <div class="alert">
17
13
  No associated objects found.
@@ -1,4 +1 @@
1
- <div class="document <%= render_document_class document %>">
2
- <%= render :partial => 'catalog/document_header', :locals => { :document => document, :document_counter => document_counter } %>
3
- <%= render :partial => 'catalog/index_default', :locals => {:document => document} %>
4
- </div>
1
+ <%= render :partial => 'catalog/document', :locals => { :document => document, :document_counter => document_counter } %>
@@ -2,9 +2,9 @@
2
2
  <table class="table table-condensed table-bordered" style="width: auto">
3
3
  <thead>
4
4
  <tr>
5
- <th scope="col"><%= t("fcrepo_admin.datastream.profile.dsVersionID") %></th>
5
+ <th scope="col"><%= t("fcrepo_admin.datastream.profile.keys.dsVersionID") %></th>
6
6
  <% datastream_history_columns.each do |col| %>
7
- <th scope="col"><%= t("fcrepo_admin.datastream.profile.#{col}") %></th>
7
+ <th scope="col"><%= t("fcrepo_admin.datastream.profile.keys.#{col}") %></th>
8
8
  <% end %>
9
9
  </tr>
10
10
  </thead>
@@ -0,0 +1,10 @@
1
+ <% pagination_info = paginate_params(response) %>
2
+ <div class="pagination">
3
+ <ul>
4
+ <li class="<% if pagination_info.current_page == 1 %>disabled<% end %>"><a href="?page=<%= pagination_info.current_page - 1 %>">&laquo;</a></li>
5
+ <% (1..pagination_info.num_pages).each do |n| %>
6
+ <li class="<% if n == pagination_info.current_page %>active<% end %>"><a href="?page=<%= n %>"><%= n %></a></li>
7
+ <% end %>
8
+ <li class="<% if pagination_info.current_page == pagination_info.num_pages %>disabled<% end %>"><a href="?page=<%= pagination_info.current_page + 1 %>">&raquo;</a></li>
9
+ </ul>
10
+ </div>
@@ -47,13 +47,13 @@ module FcrepoAdmin::Configurable
47
47
  mattr_accessor :object_properties
48
48
  self.object_properties = [:label, :state, :create_date, :modified_date, :owner_id]
49
49
 
50
- # Number of objects to display per page on associations show view
51
- mattr_accessor :associated_objects_per_page
52
- self.associated_objects_per_page = 10
50
+ # Number of documents to display per page on associations show view
51
+ mattr_accessor :association_show_docs_per_page
52
+ self.association_show_docs_per_page = 10
53
53
 
54
- # Solr sort param added to association collection query
55
- mattr_accessor :associated_objects_sort_param
56
- self.associated_objects_sort_param = nil
54
+ # Solr sort param added to query for association target documents when target is a collection
55
+ mattr_accessor :association_collection_query_sort_param
56
+ self.association_collection_query_sort_param = nil
57
57
  end
58
58
 
59
59
  end
@@ -4,7 +4,8 @@ module FcrepoAdmin::Helpers
4
4
  def link_to_association_target(association)
5
5
  target = @object.send(association.name)
6
6
  if association.collection?
7
- link_to_unless target.size == 0, "#{association.class_name} (#{target.size})", fcrepo_admin.object_association_path(@object, association.name) do |text|
7
+ size = target.size
8
+ link_to_unless size == 0, "#{association.class_name} (#{size})", fcrepo_admin.object_association_path(@object, association.name) do |text|
8
9
  text
9
10
  end
10
11
  else # not a collection
@@ -16,8 +17,12 @@ module FcrepoAdmin::Helpers
16
17
  end
17
18
  end
18
19
 
19
- def associated_objects_per_page
20
- FcrepoAdmin.associated_objects_per_page
20
+ # We attempt to use Blacklight's #paginate_rsolr_response, but it causes a routing error
21
+ # b/c Kaminari as of version 0.14.1 cannot handle namespace-prefixed routes.
22
+ # The fallback rendering bypasses Kaminari, but doesn't look so good on a large page set.
23
+ # See https://github.com/amatsuda/kaminari/pull/322.
24
+ def safe_paginate_rsolr_response(response)
25
+ render :partial => "fcrepo_admin/pagination/links", :locals => {:response => response}
21
26
  end
22
27
 
23
28
  end
@@ -1,3 +1,3 @@
1
1
  module FcrepoAdmin
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcrepo_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chandek-Stark
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-05-23 00:00:00.000000000 Z
14
+ date: 2013-05-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: hydra-head
@@ -250,11 +250,9 @@ files:
250
250
  - app/mailers/.gitkeep
251
251
  - app/models/.gitkeep
252
252
  - app/views/fcrepo_admin/associations/_associations.html.erb
253
- - app/views/fcrepo_admin/associations/_pagination.html.erb
254
253
  - app/views/fcrepo_admin/associations/index.html.erb
255
254
  - app/views/fcrepo_admin/associations/show.html.erb
256
255
  - app/views/fcrepo_admin/catalog/_document.html.erb
257
- - app/views/fcrepo_admin/catalog/_document_header.html.erb
258
256
  - app/views/fcrepo_admin/datastreams/_active_fedora.html.erb
259
257
  - app/views/fcrepo_admin/datastreams/_alert.html.erb
260
258
  - app/views/fcrepo_admin/datastreams/_content.html.erb
@@ -277,6 +275,7 @@ files:
277
275
  - app/views/fcrepo_admin/objects/audit_trail.html.erb
278
276
  - app/views/fcrepo_admin/objects/permissions.html.erb
279
277
  - app/views/fcrepo_admin/objects/show.html.erb
278
+ - app/views/fcrepo_admin/pagination/_links.html.erb
280
279
  - app/views/fcrepo_admin/shared/_context_nav.html.erb
281
280
  - app/views/layouts/fcrepo_admin/datastreams.html.erb
282
281
  - app/views/layouts/fcrepo_admin/default.html.erb
@@ -1,7 +0,0 @@
1
- <ul>
2
- <li class="<% if pagination_info.current_page == 1 %>disabled<% end %>"><a href="?page=<%= pagination_info.current_page - 1 %>">&laquo;</a></li>
3
- <% (1..pagination_info.num_pages).each do |n| %>
4
- <li class="<% if n == pagination_info.current_page %>active<% end %>"><a href="?page=<%= n %>"><%= n %></a></li>
5
- <% end %>
6
- <li class="<% if pagination_info.current_page == pagination_info.num_pages %>disabled<% end %>"><a href="?page=<%= pagination_info.current_page + 1 %>">&raquo;</a></li>
7
- </ul>
@@ -1,7 +0,0 @@
1
- <% # header bar for doc items in index view -%>
2
- <div class="documentHeader clearfix">
3
- <% # main title container for doc partial view -%>
4
- <h5 class="index_title"><%= t('blacklight.search.documents.counter', :counter => (document_counter + 1 + @response.params[:start].to_i)) %><%= link_to_document document, :label=>document_show_link_field(document), :counter => (document_counter + 1 + @response.params[:start].to_i) %></h5>
5
- <% # bookmark functions for items/docs -%>
6
- <%= render_index_doc_actions document, :wrapping_class => "documentFunctions span2" %>
7
- </div>