curation_concerns 0.9.0 → 0.10.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: 486de7c9666ed5692b30a092358a383d973ba26e
4
- data.tar.gz: 0e6d9c42e6ac2d775beb079586d49cd29786ea1e
3
+ metadata.gz: 942802ebcf7c7e14d4ee9470a4a3a215af0bca4d
4
+ data.tar.gz: 468ff214bd88dcc7ec4d226d51974e16061fccde
5
5
  SHA512:
6
- metadata.gz: 43a18393765b33bf0d05993f2a3867e572901db5f25a4f6c6a373f515fe007c857d3ad4b21bab06c161964382b52f8f2deecd36fd64ce8742cb3305da981a745
7
- data.tar.gz: 9a68911a9bac50570143d18bceaf09f2b6b1e15b556c588bedd14132a12bbe6871c812014b604ebe15b071bc04659cd301c8b1493e88d215fdeeb65e1c5f97ac
6
+ metadata.gz: 031509db45e6bd7c1bedb70cc4be63c0cf42ef0d5516178c8462534a51c45fc0c82259ce95ab4724d0216cd7fe529f2e256dc074367096074a680b539bc810ba
7
+ data.tar.gz: be8bd2e85ac10c0c98b3ad0194e9f1db681028b5999ad754b97026ac15fa3fe958065115711bdd12ab57e2f77d67d4faa7ba3c9c66e3af90e8a789a34b3bb8c6
@@ -61,7 +61,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
61
61
  class PostsController
62
62
  def index
63
63
  respond_to do |wants|
64
- wants.html { render 'index' }
64
+ wants.html { render 'index' }
65
65
  end
66
66
  end
67
67
  end
@@ -86,12 +86,13 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
86
86
  * `git pull --rebase`
87
87
  * `git checkout <your-branch>`
88
88
  * `git rebase master`
89
- * It is likely a good idea to run your tests again.
89
+ * It is a good idea to run your tests again.
90
90
  * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
91
91
  * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
92
92
  * `git rebase --interactive HEAD~<number-of-commits>` ([See Github help](https://help.github.com/articles/interactive-rebase))
93
93
  * To determine the number of commits on your branch: `git log master..<your-branch> --oneline | wc -l`
94
94
  * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
95
+
95
96
  * Push your changes to a topic branch in your fork of the repository.
96
97
  * Submit a pull request from your fork to the project.
97
98
 
@@ -106,9 +107,6 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
106
107
  * If you are uncertain, bring other contributors into the conversation by creating a comment that includes their @username.
107
108
  * If you like the pull request, but want others to chime in, create a +1 comment and tag a user.
108
109
 
109
- ## New Developers
110
- A great way to get new developers involved and to learn the process is to have them go through the Hierarchy of Promises and create a pull request to improve it.
111
-
112
110
  # Additional Resources
113
111
 
114
112
  * [General GitHub documentation](http://help.github.com/)
@@ -0,0 +1,16 @@
1
+ ### Descriptive summary
2
+
3
+ Include what version of CurationConcerns relates to this issue (0.7.x, 0.8.x, HEAD, etc.) if appropriate, and any relevant tracebacks if you're reporting a bug.
4
+
5
+ ### Expected behavior
6
+
7
+ ### Actual behavior
8
+
9
+ ### Steps to reproduce the behavior
10
+
11
+ 1. Do this
12
+ 1. Then do this...
13
+
14
+ ### Related work
15
+
16
+ Link to related tickets or prior related work here.
@@ -0,0 +1,22 @@
1
+ Fixes #issuenumber ; refs #issuenumber
2
+
3
+ Present tense short summary (50 characters or less)
4
+
5
+ More detailed description, if necessary. Try to be as descriptive as you can: even if you think that the PR content is obvious, it may not be obvious to others. Include tracebacks if helpful, and be sure to call out any bits of the PR that may be work-in-progress.
6
+
7
+ Description can have multiple paragraphs and you can use code examples inside:
8
+
9
+ ``` ruby
10
+ class PostsController
11
+ def index
12
+ respond_with Post.limit(10)
13
+ end
14
+ end
15
+ ```
16
+
17
+ Changes proposed in this pull request:
18
+ *
19
+ *
20
+ *
21
+
22
+ @projecthydra/sufia-code-reviewers
data/.rubocop.yml CHANGED
@@ -126,11 +126,6 @@ Style/HashSyntax:
126
126
  Exclude:
127
127
  - 'lib/generators/curation_concerns/templates/catalog_controller.rb'
128
128
 
129
- Style/LineEndConcatenation:
130
- Exclude:
131
- - 'spec/test_app_templates/lib/generators/**/*'
132
- - 'curation_concerns-models/lib/generators/**/*'
133
-
134
129
  Style/PredicateName:
135
130
  Exclude:
136
131
  - 'app/helpers/curation_concerns/curation_concerns_helper_behavior.rb'
@@ -140,10 +135,6 @@ Style/PredicateName:
140
135
  Style/GlobalVars:
141
136
  Exclude:
142
137
  - 'spec/**/*'
143
- - 'spec/jobs/event_jobs_spec.rb'
144
- - 'curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis_config.rb'
145
- - 'curation_concerns-models/lib/curation_concerns/models/active_record/redis.rb'
146
- - 'curation_concerns-models/lib/curation_concerns/models/active_fedora/redis.rb'
147
138
 
148
139
  Style/SingleLineBlockParams:
149
140
  Enabled: false
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.10.0
@@ -18,14 +18,14 @@ module CurationConcerns
18
18
 
19
19
  # Metadata Methods
20
20
  delegate :title, :description, :creator, :contributor, :subject, :publisher, :language,
21
- :embargo_release_date, :lease_expiration_date, :rights, to: :solr_document
21
+ :embargo_release_date, :lease_expiration_date, :rights, :date_created, to: :solr_document
22
22
 
23
23
  def size
24
24
  number_to_human_size(@solr_document['bytes_is'])
25
25
  end
26
26
 
27
27
  def total_items
28
- @solr_document['member_ids_ssim'].length
28
+ @solr_document.fetch('member_ids_ssim', []).length
29
29
  end
30
30
  end
31
31
  end
@@ -10,7 +10,10 @@ module CurationConcerns
10
10
  # you can explicitly set the URL's search field name
11
11
  # @option options [String] :label The default label for the field if no translation is found
12
12
  def attribute_to_html(field, options = {})
13
- return unless respond_to?(field)
13
+ unless respond_to?(field)
14
+ Rails.logger.warn("#{self.class} attempted to render #{field}, but no method exists with that name.")
15
+ return
16
+ end
14
17
  AttributeRenderer.new(field, send(field), options).render
15
18
  end
16
19
 
@@ -5,14 +5,9 @@
5
5
  </thead>
6
6
  <tbody>
7
7
  <%= render 'attribute_rows', presenter: presenter %>
8
- <tr>
9
- <th>Visibility</th>
10
- <td>
11
- <%= presenter.permission_badge %>
12
- </td>
13
- </tr>
14
- <%= presenter.attribute_to_html(:embargo_release_date) %>
15
- <%= presenter.attribute_to_html(:lease_expiration_date) %>
16
- <%= presenter.attribute_to_html(:rights) %>
8
+ <%= presenter.attribute_to_html(:permission_badge, label: 'Visibility') %>
9
+ <%= presenter.attribute_to_html(:embargo_release_date) %>
10
+ <%= presenter.attribute_to_html(:lease_expiration_date) %>
11
+ <%= presenter.attribute_to_html(:rights) %>
17
12
  </tbody>
18
13
  </table>
@@ -8,7 +8,7 @@
8
8
  <% end %>
9
9
  <% if collector %>
10
10
  <%= render 'collections/add_to_collection_modal', collectible: @presenter %>
11
- <%= link_to_select_collection @presenter, class: 'btn btn-primary' %>
11
+ <%= link_to_select_collection @presenter, class: 'btn btn-default' %>
12
12
  <% end %>
13
13
  </div>
14
14
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module CurationConcerns
2
- VERSION = "0.9.0".freeze
2
+ VERSION = "0.10.0".freeze
3
3
  end
@@ -5,4 +5,3 @@ module CurationConcerns
5
5
  self.model_class = ::<%= class_name %>
6
6
  end
7
7
  end
8
-
@@ -7,4 +7,3 @@ describe CurationConcerns::<%= class_name %>Form do
7
7
  skip "Add your tests here"
8
8
  end
9
9
  end
10
-
@@ -65,7 +65,7 @@ class CurationConcerns::WorkGenerator < Rails::Generators::NamedBase
65
65
  end
66
66
 
67
67
  def create_views
68
- create_file "app/views/#{plural_file_name}/_#{file_name}.html.erb" do
68
+ create_file "app/views/curation_concerns/#{plural_file_name}/_#{file_name}.html.erb" do
69
69
  "<%# This is a search result view %>\n" \
70
70
  "<%= render 'catalog/document', document: #{file_name}, document_counter: #{file_name}_counter %>\n"
71
71
  end
@@ -21,4 +21,13 @@ describe CurationConcerns::WorkIndexer do
21
21
  expect(subject['generic_type_sim']).to eq ['Work']
22
22
  expect(subject.fetch('thumbnail_path_ss')).to eq "/downloads/#{file.id}?file=thumbnail"
23
23
  end
24
+
25
+ context "when thumbnail_field is configured" do
26
+ before do
27
+ service.thumbnail_field = 'thumbnail_url_ss'
28
+ end
29
+ it "uses the configured field" do
30
+ expect(subject.fetch('thumbnail_url_ss')).to eq "/downloads/#{file.id}?file=thumbnail"
31
+ end
32
+ end
24
33
  end
@@ -44,7 +44,7 @@ describe GenericWork do
44
44
  describe '#to_partial_path' do
45
45
  let(:work) { described_class.new }
46
46
  subject { work.to_partial_path }
47
- it { is_expected.to eq 'generic_works/generic_work' }
47
+ it { is_expected.to eq 'curation_concerns/generic_works/generic_work' }
48
48
  end
49
49
 
50
50
  describe "#destroy" do
@@ -5,7 +5,8 @@ describe CurationConcerns::CollectionPresenter do
5
5
  build(:collection,
6
6
  id: 'adc12v',
7
7
  description: ['a nice collection'],
8
- title: ['A clever title'])
8
+ title: ['A clever title'],
9
+ date_created: ['some date'])
9
10
  end
10
11
  let(:work) { build(:work, title: ['unimaginitive title']) }
11
12
  let(:solr_document) { SolrDocument.new(collection.to_solr) }
@@ -39,5 +40,14 @@ describe CurationConcerns::CollectionPresenter do
39
40
  before { collection.members << work }
40
41
  it { is_expected.to eq 1 }
41
42
  end
43
+ context "null members" do
44
+ let(:presenter) { described_class.new({}, nil) }
45
+ it { is_expected.to eq 0 }
46
+ end
47
+ end
48
+
49
+ describe "#date_created" do
50
+ subject { presenter.date_created }
51
+ it { is_expected.to eq 'some date' }
42
52
  end
43
53
  end
@@ -8,7 +8,7 @@ describe CurationConcerns::WorkShowPresenter do
8
8
  { "title_tesim" => ["foo bar"],
9
9
  "human_readable_type_tesim" => ["Generic Work"],
10
10
  "has_model_ssim" => ["GenericWork"],
11
- "date_created_dtsi" => date_index,
11
+ "date_created_tesim" => ['an unformatted date'],
12
12
  "date_modified_dtsi" => date_index,
13
13
  "date_uploaded_dtsi" => date_index }
14
14
  end
@@ -31,7 +31,12 @@ describe CurationConcerns::WorkShowPresenter do
31
31
  it { is_expected.to be_kind_of ActiveModel::Name }
32
32
  end
33
33
 
34
- [:date_created, :date_modified, :date_uploaded].each do |date_field|
34
+ describe "#date_created" do
35
+ subject { presenter.date_created }
36
+ it { is_expected.to eq('an unformatted date') }
37
+ end
38
+
39
+ [:date_modified, :date_uploaded].each do |date_field|
35
40
  describe "##{date_field}" do
36
41
  subject { presenter.send date_field }
37
42
  it { is_expected.to eq date_value.to_formatted_s(:standard) }
@@ -69,4 +74,29 @@ describe CurationConcerns::WorkShowPresenter do
69
74
  end
70
75
  end
71
76
  end
77
+
78
+ describe "#attribute_to_html" do
79
+ let(:presenter) { described_class.new(solr_document, ability) }
80
+ let(:renderer) { double('renderer') }
81
+
82
+ context 'with an existing field' do
83
+ before do
84
+ allow(CurationConcerns::AttributeRenderer).to receive(:new)
85
+ .with(:title, "foo bar", {})
86
+ .and_return(renderer)
87
+ end
88
+
89
+ it "calls the AttributeRenderer" do
90
+ expect(renderer).to receive(:render)
91
+ presenter.attribute_to_html(:title)
92
+ end
93
+ end
94
+
95
+ context "with a field that doesn't exist" do
96
+ it "logs a warning" do
97
+ expect(Rails.logger).to receive(:warn).with('CurationConcerns::WorkShowPresenter attempted to render restrictions, but no method exists with that name.')
98
+ presenter.attribute_to_html(:restrictions)
99
+ end
100
+ end
101
+ end
72
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curation_concerns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-25 00:00:00.000000000 Z
13
+ date: 2016-03-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hydra-head
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.9.0
91
+ version: 0.10.0
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 0.9.0
98
+ version: 0.10.0
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: hydra-editor
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -398,11 +398,13 @@ executables: []
398
398
  extensions: []
399
399
  extra_rdoc_files: []
400
400
  files:
401
+ - ".github/CONTRIBUTING.md"
402
+ - ".github/ISSUE_TEMPLATE.md"
403
+ - ".github/PULL_REQUEST_TEMPLATE.md"
401
404
  - ".gitignore"
402
405
  - ".rspec"
403
406
  - ".rubocop.yml"
404
407
  - ".travis.yml"
405
- - CONTRIBUTING.md
406
408
  - Gemfile
407
409
  - LICENSE.txt
408
410
  - README.md