sufia 6.4.0 → 6.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d8a1fa7fdbec5a9eaa73924bdb9c7adf05d4719
4
- data.tar.gz: d557d8cd73484d6fd5ea8f15e167073bb02bb668
3
+ metadata.gz: 3e188dc963a308bd78feb2a92a99548eb2b641d6
4
+ data.tar.gz: a5e2f06bbe6f5d816541b523f8346448958b00c2
5
5
  SHA512:
6
- metadata.gz: 001e60eba3c4768f171c4ae0d1771c1bba5d2fa9deac895d107ca6a0fa85b7cbb1e084e6fee1e21fd976da8b7f853b3ba2f8bee29ab49482298c94f77cc09766
7
- data.tar.gz: e0f21e08e467500f4c9fa2579e14004abd2964ebc3b403651cf27c9141cd18080e1d6f2c7fa407aa18daaaeccbd8323937ecee27e97664e9edadfbd9c9acf8d7
6
+ metadata.gz: ee2f8d43dd936f3fe4586da46a0de8215f4abcac9f93728c5f7ea88fcde725d0aa12810bbe20b008dcc2212a7d038af3b0ac61be8d9c28997fabb30f17dac517
7
+ data.tar.gz: 6ed19074ad147367a53b8d5a15d39ecab27aea1b2d2146dd71db9dceeaa1895cfccbc1e4e1281e35f04807fc591f31abf513ad32d8f2d7229e97450048f6a389
data/.gitignore CHANGED
@@ -62,6 +62,7 @@ db/*.sqlite3
62
62
  db/*.sqlite3-journal
63
63
  log/*.log
64
64
  tmp
65
+ .byebug_history
65
66
 
66
67
  *.sqlite3
67
68
  *.log
data/History.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # History of Sufia releases
2
2
 
3
+ ## 6.5.0
4
+ * Remove unnecessary require [Justin Coyne]
5
+ * Option to show collection facet in Dashboard and search results [E. Lynette Rayle]
6
+ * Remove space after icon if no text is present, fix projecthydra/sufia#1354 [Anna Headley]
7
+ * Ignore byebug history file [Adam Wead]
8
+ * Ignore visibility of files[] input, it's hidden from Capybara [Adam Wead]
9
+
3
10
  ## 6.4.0
4
11
 
5
12
  * Remove deprecation warnings [Adam Wead]
data/README.md CHANGED
@@ -90,7 +90,7 @@ If you have questions or need help, please email [the Hydra community tech list]
90
90
  # Creating a Sufia-based app
91
91
 
92
92
  This document contains instructions specific to setting up an app with __Sufia
93
- v6.4.0__. If you are looking for instructions on installing a different
93
+ v6.5.0__. If you are looking for instructions on installing a different
94
94
  version, be sure to select the appropriate branch or tag from the drop-down
95
95
  menu above.
96
96
 
@@ -142,7 +142,7 @@ rails new my_app
142
142
  Add the following lines to your application's Gemfile.
143
143
 
144
144
  ```
145
- gem 'sufia', '6.4.0'
145
+ gem 'sufia', '6.5.0'
146
146
  gem 'kaminari', github: 'jcoyne/kaminari', branch: 'sufia' # required to handle pagination properly in dashboard. See https://github.com/amatsuda/kaminari/pull/322
147
147
  ```
148
148
 
@@ -1 +1 @@
1
- 6.4.0
1
+ 6.5.0
@@ -30,6 +30,16 @@ module Sufia
30
30
  presenter
31
31
  end
32
32
 
33
+ def create
34
+ super
35
+ update_members_indices
36
+ end
37
+
38
+ def update
39
+ super
40
+ update_members_indices
41
+ end
42
+
33
43
  protected
34
44
 
35
45
  def presenter
@@ -77,5 +87,12 @@ module Sufia
77
87
  def _prefixes
78
88
  @_prefixes ||= super + ['catalog']
79
89
  end
90
+
91
+ def update_members_indices
92
+ return if Sufia.config.collection_facet.nil?
93
+ Array(params[:batch_document_ids]).each do |gf|
94
+ Sufia.queue.push(ResolrizeGenericFileJob.new(gf))
95
+ end
96
+ end
80
97
  end
81
98
  end
@@ -1,5 +1,3 @@
1
- require 'blacklight/catalog'
2
-
3
1
  module Sufia
4
2
  module MyControllerBehavior
5
3
  extend ActiveSupport::Concern
@@ -0,0 +1,13 @@
1
+ module FacetsHelper
2
+ include Blacklight::FacetsHelperBehavior
3
+
4
+ def display_collection_facet
5
+ if Sufia.config.collection_facet == :public
6
+ true
7
+ elsif Sufia.config.collection_facet == :user && current_user
8
+ true
9
+ else
10
+ false
11
+ end
12
+ end
13
+ end
@@ -114,8 +114,10 @@ module Sufia
114
114
  end
115
115
 
116
116
  def iconify_auto_link(text, showLink = true)
117
+ # this block is only executed when a link is inserted;
118
+ # if we pass text containing no links, it just returns text.
117
119
  auto_link(text) do |value|
118
- "<i class='glyphicon glyphicon-new-window'></i>&nbsp;#{value if showLink}<br />"
120
+ "<i class='glyphicon glyphicon-new-window'></i>#{('&nbsp;' + value) if showLink}<br />"
119
121
  end
120
122
  end
121
123
 
@@ -57,6 +57,7 @@ class CatalogController < ApplicationController
57
57
  config.add_facet_field solr_name("based_near", :facetable), label: "Location", limit: 5
58
58
  config.add_facet_field solr_name("publisher", :facetable), label: "Publisher", limit: 5
59
59
  config.add_facet_field solr_name("file_format", :facetable), label: "File Format", limit: 5
60
+ config.add_facet_field solr_name("collection", :facetable), label: "Collection", helper_method: :collection_name, limit: 5, show: :display_collection_facet
60
61
 
61
62
  # Have BL send all facet field names to Solr, which has been the default
62
63
  # previously. Simply remove these lines if you'd rather use Solr request
@@ -1,3 +1,3 @@
1
1
  module Sufia
2
- VERSION = "6.4.0"
2
+ VERSION = "6.5.0"
3
3
  end
@@ -0,0 +1,119 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Collection Facet", type: :feature do
4
+ def visit_dashboard_my_files
5
+ visit '/dashboard/files'
6
+ expect(page.title).to eq 'Files listing'
7
+ expect(page).to have_link('My Files')
8
+ expect(page).to have_link('My Collections')
9
+ expect(page).to have_link('Fake PDF Title')
10
+ expect(page).to have_css('h3', text: 'Filter your files')
11
+ end
12
+
13
+ def search_for_files
14
+ visit '/'
15
+ fill_in('search-field-header', with: 'pdf')
16
+ click_button('search-submit-header')
17
+ expect(page.title).to eq 'Keyword: pdf - Blacklight Search Results'
18
+ expect(page).to have_link('Fake PDF Title')
19
+ expect(page).to have_css('h4', text: 'Limit your search')
20
+ end
21
+
22
+ def facet?(page)
23
+ f = page.all('a', text: /\ACollection\z/)
24
+ return true if f.size == 1
25
+ false
26
+ end
27
+
28
+ let(:auser) { FactoryGirl.create(:curator) }
29
+
30
+ let!(:fixtures) do
31
+ create_file_fixtures(auser.user_key, [:public_pdf]) do |f|
32
+ f.tag = ['pdf']
33
+ f.apply_depositor_metadata(auser.user_key)
34
+ end
35
+ end
36
+
37
+ let(:collection1) do
38
+ Collection.create(title: 'Test Collection 1', description: 'Description for collection 1',
39
+ members: []) { |c| c.apply_depositor_metadata(auser.user_key) }
40
+ end
41
+
42
+ context "with collection having a member" do
43
+ before do
44
+ Sufia.config.collection_facet = :public
45
+ collection1.add_members([fixtures[0].id])
46
+ collection1.save
47
+ fixtures[0].update_index
48
+ end
49
+
50
+ context "and collection_facet config == :user" do
51
+ before do
52
+ Sufia.config.collection_facet = :user
53
+ end
54
+
55
+ it "shows collection facet in Dashboard -> My Files" do
56
+ login_as auser
57
+ visit_dashboard_my_files
58
+ expect(facet?(page)).to eq true
59
+ end
60
+
61
+ it "does show collection facet in pubic search with user logged in" do
62
+ login_as auser
63
+ search_for_files
64
+ expect(facet?(page)).to eq true
65
+ end
66
+
67
+ it "does NOT show collection facet in pubic search with user NOT logged in" do
68
+ search_for_files
69
+ expect(facet?(page)).to eq false
70
+ end
71
+ end
72
+
73
+ context "and collection_facet config == :public" do
74
+ before do
75
+ Sufia.config.collection_facet = :public
76
+ end
77
+
78
+ it "shows collection facet in Dashboard -> My Files" do
79
+ login_as auser
80
+ visit_dashboard_my_files
81
+ expect(facet?(page)).to eq true
82
+ end
83
+
84
+ it "shows collection facet in pubic search with user logged in" do
85
+ login_as auser
86
+ search_for_files
87
+ expect(facet?(page)).to eq true
88
+ end
89
+
90
+ it "shows collection facet in pubic search with user NOT logged in" do
91
+ search_for_files
92
+ expect(facet?(page)).to eq true
93
+ end
94
+ end
95
+
96
+ context "and collection_facet config == nil" do
97
+ before do
98
+ Sufia.config.collection_facet = nil
99
+ end
100
+
101
+ it "does NOT show collection facet in Dashboard -> My Files" do
102
+ login_as auser
103
+ visit_dashboard_my_files
104
+ expect(facet?(page)).to eq false
105
+ end
106
+
107
+ it "does NOT show collection facet in pubic search with user logged in" do
108
+ login_as auser
109
+ search_for_files
110
+ expect(facet?(page)).to eq false
111
+ end
112
+
113
+ it "does NOT show collection facet in pubic search with user NOT logged in" do
114
+ search_for_files
115
+ expect(facet?(page)).to eq false
116
+ end
117
+ end
118
+ end
119
+ end
@@ -15,8 +15,8 @@ describe "Uploading files via web form", type: :feature do
15
15
 
16
16
  context "the terms of service", :js do
17
17
  it "is required to be checked" do
18
- attach_file("files[]", File.dirname(__FILE__) + "/../../spec/fixtures/image.jp2")
19
- attach_file("files[]", File.dirname(__FILE__) + "/../../spec/fixtures/jp2_fits.xml")
18
+ attach_file("files[]", File.dirname(__FILE__) + "/../../spec/fixtures/image.jp2", visible: false)
19
+ attach_file("files[]", File.dirname(__FILE__) + "/../../spec/fixtures/jp2_fits.xml", visible: false)
20
20
  expect(page).to have_css("button#main_upload_start[disabled]")
21
21
  find('#main_upload_start_span').hover
22
22
  expect(page).to have_content "Please accept Deposit Agreement before you can upload."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sufia
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.0
4
+ version: 6.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-12 00:00:00.000000000 Z
12
+ date: 2015-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sufia-models
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 6.4.0
20
+ version: 6.5.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 6.4.0
27
+ version: 6.5.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: blacklight_advanced_search
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -657,6 +657,7 @@ files:
657
657
  - app/helpers/contact_form_helper.rb
658
658
  - app/helpers/content_block_helper.rb
659
659
  - app/helpers/dashboard_helper.rb
660
+ - app/helpers/facets_helper.rb
660
661
  - app/helpers/generic_file_helper.rb
661
662
  - app/helpers/sufia/blacklight_override.rb
662
663
  - app/helpers/sufia/dashboard_helper_behavior.rb
@@ -1006,6 +1007,7 @@ files:
1006
1007
  - spec/features/browse_files_spec.rb
1007
1008
  - spec/features/catalog_search_spec.rb
1008
1009
  - spec/features/cloud_upload_spec.rb
1010
+ - spec/features/collection_facet_spec.rb
1009
1011
  - spec/features/collection_spec.rb
1010
1012
  - spec/features/contact_form_spec.rb
1011
1013
  - spec/features/display_dashboard_spec.rb
@@ -1243,7 +1245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1243
1245
  version: '0'
1244
1246
  requirements: []
1245
1247
  rubyforge_project:
1246
- rubygems_version: 2.4.8
1248
+ rubygems_version: 2.4.5
1247
1249
  signing_key:
1248
1250
  specification_version: 4
1249
1251
  summary: Sufia was extracted from ScholarSphere developed by Penn State University
@@ -1291,6 +1293,7 @@ test_files:
1291
1293
  - spec/features/browse_files_spec.rb
1292
1294
  - spec/features/catalog_search_spec.rb
1293
1295
  - spec/features/cloud_upload_spec.rb
1296
+ - spec/features/collection_facet_spec.rb
1294
1297
  - spec/features/collection_spec.rb
1295
1298
  - spec/features/contact_form_spec.rb
1296
1299
  - spec/features/display_dashboard_spec.rb