curation_concerns 1.0.0.beta3 → 1.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/curation_concerns/curation_concerns.js +0 -1
  3. data/app/assets/javascripts/curation_concerns/file_manager/member.es6 +9 -0
  4. data/app/assets/javascripts/curation_concerns/file_manager/sorting.es6 +10 -1
  5. data/app/assets/stylesheets/curation_concerns/modules/forms.scss +2 -2
  6. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +1 -1
  7. data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +2 -2
  8. data/app/jobs/characterize_job.rb +2 -1
  9. data/app/jobs/import_url_job.rb +5 -13
  10. data/app/presenters/curation_concerns/collection_presenter.rb +4 -2
  11. data/app/presenters/curation_concerns/file_set_presenter.rb +4 -2
  12. data/app/presenters/curation_concerns/presenter_factory.rb +7 -6
  13. data/app/presenters/curation_concerns/work_show_presenter.rb +11 -5
  14. data/app/views/collections/_form_permission.html.erb +1 -1
  15. data/app/views/curation_concerns/base/_file_manager_member.html.erb +1 -1
  16. data/app/views/curation_concerns/base/_file_manager_members.html.erb +5 -0
  17. data/app/views/curation_concerns/base/_form_permission.html.erb +1 -1
  18. data/app/views/curation_concerns/base/_form_permission_under_embargo.html.erb +1 -1
  19. data/app/views/curation_concerns/base/_form_permission_under_lease.html.erb +1 -1
  20. data/app/views/curation_concerns/base/file_manager.html.erb +1 -13
  21. data/app/views/embargoes/edit.html.erb +1 -1
  22. data/app/views/leases/edit.html.erb +1 -1
  23. data/curation_concerns.gemspec +2 -0
  24. data/lib/curation_concerns/configuration.rb +1 -1
  25. data/lib/curation_concerns/version.rb +1 -1
  26. data/spec/jobs/characterize_job_spec.rb +2 -1
  27. data/spec/jobs/import_url_job_spec.rb +6 -9
  28. data/spec/presenters/curation_concerns/presenter_factory_spec.rb +21 -0
  29. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +12 -7
  30. data/spec/spec_helper.rb +2 -0
  31. metadata +32 -4
  32. data/app/assets/javascripts/curation_concerns/file_manager/list_toggle.es6 +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 479354206a40bb627e8757bf979959e1334a9d36
4
- data.tar.gz: ba279782938b4e3a7e66bb03b9f932855f0afddd
3
+ metadata.gz: 4308100446011564275bcdedd4c7481463a38e5c
4
+ data.tar.gz: 7b81af4f3ea2ed2c2d576532ad300325447ea269
5
5
  SHA512:
6
- metadata.gz: 4e741f7d4aa0ecb1ecdcd5bf0e1d82788409196b74b37c94a22bba836eb85f4d74aa8add3d3c3a2f5b3a332dbec5009a1aee63deb7fc8527cf555320628c1900
7
- data.tar.gz: 9a89a75c1178e14d566e980a39d1e7ef363a1ccc1e96a18f5e5bef8b2f53d4b44777a8ddcbb9c53e61f1ba1740a85ed4e50d502cf3ff9aa6157bd5e3fbf2d0af
6
+ metadata.gz: 80590935c92b01803e6112748622e8932907900449355710af1bdb7162e9b8ff2b5e2d2a7f4fa02279e607aac1fe614b2eca92eb5e9fe77011b5f64bedeb1173
7
+ data.tar.gz: 2beb2613b9ec9627081d40d0177e678f31a9a10802528ae1d75be089b4d1bca4d1c570445ecf86efca6225d84069f46adb4a254093c02d3a3bf9d14696b6ffb3
@@ -3,7 +3,6 @@
3
3
  //= require curation_concerns/embargoes
4
4
  //= require curation_concerns/fileupload
5
5
  //= require curation_concerns/file_manager/affix
6
- //= require curation_concerns/file_manager/list_toggle
7
6
  //= require curation_concerns/file_manager/sorting
8
7
  //= require curation_concerns/file_manager/save_manager
9
8
  //= require curation_concerns/file_manager/member
@@ -63,14 +63,23 @@ class FileManagerMember {
63
63
  if(this.is_changed) {
64
64
  let form = this.element.find("form")
65
65
  let deferred = $.Deferred()
66
+ this.element.addClass("pending")
67
+ this.element.removeClass("success")
68
+ this.element.removeClass("failure")
66
69
  form.on("ajax:success", () => {
67
70
  this.elements.forEach((element) => {
68
71
  element.data("tracker").reset()
69
72
  })
70
73
  deferred.resolve()
74
+ this.element.addClass("success")
75
+ this.element.removeClass("failure")
76
+ this.element.removeClass("pending")
71
77
  })
72
78
  form.on("ajax:error", () => {
73
79
  deferred.reject()
80
+ this.element.addClass("failure")
81
+ this.element.removeClass("success")
82
+ this.element.removeClass("pending")
74
83
  })
75
84
  form.submit()
76
85
  return deferred
@@ -14,7 +14,6 @@
14
14
 
15
15
  initialize_sort() {
16
16
  this.element.sortable({handle: ".panel-heading"})
17
- this.element.disableSelection()
18
17
  this.element.on("sortstop", this.stopped_sorting)
19
18
  this.element.on("sortstart", this.started_sorting)
20
19
  }
@@ -25,11 +24,21 @@
25
24
  "ordered_member_ids": this.order
26
25
  }
27
26
  params["_method"] = "PATCH"
27
+ this.element.addClass("pending")
28
+ this.element.removeClass("success")
29
+ this.element.removeClass("failure")
28
30
  let persisting = $.post(
29
31
  `/concern/${this.class_name}/${this.id}`,
30
32
  params
31
33
  ).done(() => {
32
34
  this.element.data("current-order", this.order)
35
+ this.element.addClass("success")
36
+ this.element.removeClass("failure")
37
+ }).fail(() => {
38
+ this.element.addClass("failure")
39
+ this.element.removeClass("success")
40
+ }).always(() => {
41
+ this.element.removeClass("pending")
33
42
  })
34
43
  return persisting
35
44
  }
@@ -38,9 +38,9 @@ legend small {
38
38
  form label.optional { font-weight: normal; }
39
39
  form label.required { font-weight: bold; }
40
40
 
41
- #set-access-controls {
41
+ .set-access-controls {
42
42
  label { font-weight: normal; }
43
- & > .form-group { padding: 0 1.75em; }
43
+ & .form-group { padding: 0 1.75em; }
44
44
 
45
45
  .form-inline {
46
46
  .control-label, label {
@@ -119,7 +119,7 @@ module CurationConcerns::CurationConcernController
119
119
  end
120
120
 
121
121
  def presenter
122
- @presenter ||= show_presenter.new(curation_concern_from_search_results, current_ability)
122
+ @presenter ||= show_presenter.new(curation_concern_from_search_results, current_ability, request)
123
123
  end
124
124
 
125
125
  def _prefixes
@@ -136,7 +136,7 @@ module CurationConcerns
136
136
  _, document_list = search_results(params)
137
137
  curation_concern = document_list.first
138
138
  raise CanCan::AccessDenied unless curation_concern
139
- show_presenter.new(curation_concern, current_ability)
139
+ show_presenter.new(curation_concern, current_ability, request)
140
140
  end
141
141
  end
142
142
 
@@ -217,7 +217,7 @@ module CurationConcerns
217
217
  # this is provided so that implementing application can override this behavior and map params to different attributes
218
218
  def update_metadata_from_upload_screen
219
219
  # Relative path is set by the jquery uploader when uploading a directory
220
- curation_concer.relative_path = params[:relative_path] if params[:relative_path]
220
+ curation_concern.relative_path = params[:relative_path] if params[:relative_path]
221
221
  end
222
222
 
223
223
  def curation_concern_type
@@ -6,7 +6,8 @@ class CharacterizeJob < ActiveJob::Base
6
6
  def perform(file_set, filename)
7
7
  raise LoadError, "#{file_set.class.characterization_proxy} was not found" unless file_set.characterization_proxy?
8
8
  Hydra::Works::CharacterizationService.run(file_set.characterization_proxy, filename)
9
- file_set.save!
9
+ file_set.characterization_proxy.save!
10
+ file_set.update_index
10
11
  CreateDerivativesJob.perform_later(file_set, filename)
11
12
  end
12
13
  end
@@ -1,6 +1,6 @@
1
- require 'net/https'
2
1
  require 'uri'
3
2
  require 'tempfile'
3
+ require 'browse_everything/retriever'
4
4
 
5
5
  class ImportUrlJob < ActiveJob::Base
6
6
  queue_as CurationConcerns.config.ingest_queue_name
@@ -38,18 +38,10 @@ class ImportUrlJob < ActiveJob::Base
38
38
  f.binmode
39
39
  # download file from url
40
40
  uri = URI(file_set.import_url)
41
- http = Net::HTTP.new(uri.host, uri.port)
42
- http.use_ssl = uri.scheme == 'https' # enable SSL/TLS
43
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
44
- mime_type = nil
45
-
46
- http.start do
47
- http.request_get(uri.request_uri) do |resp|
48
- mime_type = resp.content_type
49
- resp.read_body do |segment|
50
- f.write(segment)
51
- end
52
- end
41
+ spec = { 'url' => uri }
42
+ retriever = BrowseEverything::Retriever.new
43
+ retriever.retrieve(spec) do |chunk|
44
+ f.write(chunk)
53
45
  end
54
46
  f.rewind
55
47
  end
@@ -3,13 +3,15 @@ module CurationConcerns
3
3
  include ModelProxy
4
4
  include PresentsAttributes
5
5
  include ActionView::Helpers::NumberHelper
6
- attr_accessor :solr_document, :current_ability
6
+ attr_accessor :solr_document, :current_ability, :request
7
7
 
8
8
  # @param [SolrDocument] solr_document
9
9
  # @param [Ability] current_ability
10
- def initialize(solr_document, current_ability)
10
+ # @param [ActionDispatch::Request] request the http request context
11
+ def initialize(solr_document, current_ability, request = nil)
11
12
  @solr_document = solr_document
12
13
  @current_ability = current_ability
14
+ @request = request
13
15
  end
14
16
 
15
17
  # CurationConcern methods
@@ -2,13 +2,15 @@ module CurationConcerns
2
2
  class FileSetPresenter
3
3
  include ModelProxy
4
4
  include PresentsAttributes
5
- attr_accessor :solr_document, :current_ability
5
+ attr_accessor :solr_document, :current_ability, :request
6
6
 
7
7
  # @param [SolrDocument] solr_document
8
8
  # @param [Ability] current_ability
9
- def initialize(solr_document, current_ability)
9
+ # @param [ActionDispatch::Request] request the http request context
10
+ def initialize(solr_document, current_ability, request = nil)
10
11
  @solr_document = solr_document
11
12
  @current_ability = current_ability
13
+ @request = request
12
14
  end
13
15
 
14
16
  # CurationConcern methods
@@ -3,18 +3,19 @@ module CurationConcerns
3
3
  class << self
4
4
  # @param [Array] ids the list of ids to load
5
5
  # @param [Class] klass the class of presenter to make
6
+ # @param [Array] args any other arguments to pass to the presenters
6
7
  # @return [Array] presenters for the documents in order of the ids
7
- def build_presenters(ids, klass, ability)
8
- new(ids, klass, ability).build
8
+ def build_presenters(ids, klass, *args)
9
+ new(ids, klass, *args).build
9
10
  end
10
11
  end
11
12
 
12
- attr_reader :ids, :klass, :ability
13
+ attr_reader :ids, :klass, :args
13
14
 
14
- def initialize(ids, klass, ability)
15
+ def initialize(ids, klass, *args)
15
16
  @ids = ids
16
17
  @klass = klass
17
- @ability = ability
18
+ @args = args
18
19
  end
19
20
 
20
21
  def build
@@ -22,7 +23,7 @@ module CurationConcerns
22
23
  docs = load_docs
23
24
  ids.map do |id|
24
25
  solr_doc = docs.find { |doc| doc.id == id }
25
- klass.new(solr_doc, ability) if solr_doc
26
+ klass.new(solr_doc, *args) if solr_doc
26
27
  end.compact
27
28
  end
28
29
 
@@ -2,7 +2,7 @@ module CurationConcerns
2
2
  class WorkShowPresenter
3
3
  include ModelProxy
4
4
  include PresentsAttributes
5
- attr_accessor :solr_document, :current_ability
5
+ attr_accessor :solr_document, :current_ability, :request
6
6
 
7
7
  class_attribute :collection_presenter_class, :file_presenter_class, :work_presenter_class
8
8
 
@@ -17,13 +17,15 @@ module CurationConcerns
17
17
 
18
18
  # @param [SolrDocument] solr_document
19
19
  # @param [Ability] current_ability
20
- def initialize(solr_document, current_ability)
20
+ # @param [ActionDispatch::Request] request the http request context
21
+ def initialize(solr_document, current_ability, request = nil)
21
22
  @solr_document = solr_document
22
23
  @current_ability = current_ability
24
+ @request = request
23
25
  end
24
26
 
25
27
  def page_title
26
- solr_document.title
28
+ solr_document.title.first
27
29
  end
28
30
 
29
31
  # CurationConcern methods
@@ -64,18 +66,22 @@ module CurationConcerns
64
66
  def member_presenters(ids = ordered_ids, presenter_class = file_presenter_class)
65
67
  PresenterFactory.build_presenters(ids,
66
68
  presenter_class,
67
- current_ability)
69
+ *presenter_factory_arguments)
68
70
  end
69
71
 
70
72
  # @return [Array<CollectionPresenter>] presenters for the collections that this work is a member of
71
73
  def collection_presenters
72
74
  PresenterFactory.build_presenters(in_collection_ids,
73
75
  collection_presenter_class,
74
- current_ability)
76
+ *presenter_factory_arguments)
75
77
  end
76
78
 
77
79
  private
78
80
 
81
+ def presenter_factory_arguments
82
+ [current_ability, request]
83
+ end
84
+
79
85
  # @return [Array<String>] ids of the collections that this work is a member of
80
86
  def in_collection_ids
81
87
  ActiveFedora::SolrService.query("{!field f=member_ids_ssim}#{id}",
@@ -1,4 +1,4 @@
1
- <div id="set-access-controls">
1
+ <div class="set-access-controls">
2
2
  <fieldset>
3
3
  <legend>
4
4
  Visibility
@@ -1,5 +1,5 @@
1
1
  <li data-reorder-id='<%= node.id %>'>
2
- <%= simple_form_for [main_app, node], remote: true do |f| %>
2
+ <%= simple_form_for [main_app, node], remote: true, html: {'data-type': 'json'} do |f| %>
3
3
  <div class="panel panel-default">
4
4
  <div class="panel-heading">
5
5
  <div class="order-title">
@@ -0,0 +1,5 @@
1
+ <ul id="sortable" data-id="<%= @presenter.id %>" data-class-name="<%= @presenter.model_name.plural %>" data-singular-class-name="<%= @presenter.model_name.singular %>" class="list-unstyled grid clearfix">
2
+ <% @presenter.file_presenters.each do |member| %>
3
+ <%= render "file_manager_member", node: member %>
4
+ <% end %>
5
+ </ul>
@@ -4,7 +4,7 @@
4
4
  <% elsif f.object.lease_expiration_date %>
5
5
  <%= render 'form_permission_under_lease', f: f %>
6
6
  <% else %>
7
- <fieldset id="set-access-controls">
7
+ <fieldset class="set-access-controls">
8
8
  <legend>
9
9
  Visibility
10
10
  <small>Who should be able to view or download this content?</small>
@@ -1,4 +1,4 @@
1
- <fieldset id="set-access-controls">
1
+ <fieldset class="set-access-controls">
2
2
  <legend>
3
3
  Visibility
4
4
  <small>Who should be able to view or download this content?</small>
@@ -1,4 +1,4 @@
1
- <fieldset id="set-access-controls">
1
+ <fieldset class="set-access-controls">
2
2
  <legend>
3
3
  Visibility
4
4
  <small>Who should be able to view or download this content?</small>
@@ -13,19 +13,7 @@
13
13
  </div>
14
14
  <div class="col-md-3" id="label-tools-spacer" class="fixed"></div>
15
15
  <div class="col-md-9" id="order-grid">
16
- <div class="btn-group" role="group" data-action="list-toggle">
17
- <button type="button" class="btn btn-default list" aria-label="List">
18
- <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
19
- </button>
20
- <button type="button" class="btn btn-default active grid" aria-label="Grid">
21
- <span class="glyphicon glyphicon-th" aria-hidden="true"></span>
22
- </button>
23
- </div>
24
- <ul id="sortable" data-id="<%= @presenter.id %>" data-class-name="<%= @presenter.model_name.plural %>" data-singular-class-name="<%= @presenter.model_name.singular %>" class="list-unstyled grid">
25
- <% @presenter.file_presenters.each do |member| %>
26
- <%= render "file_manager_member", node: member %>
27
- <% end %>
28
- </ul>
16
+ <%= render "file_manager_members" %>
29
17
  </div>
30
18
  </div>
31
19
  <% end %>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <h2>Current Embargo</h2>
6
6
  <%= simple_form_for [main_app, curation_concern] do |f| %>
7
- <fieldset id="set-access-controls">
7
+ <fieldset class="set-access-controls">
8
8
  <section class="help-block">
9
9
  <p>
10
10
  <% if curation_concern.embargo_release_date %>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <h2>Current Lease</h2>
6
6
  <%= simple_form_for curation_concern do |f| %>
7
- <fieldset id="set-access-controls">
7
+ <fieldset class="set-access-controls">
8
8
  <section class="help-block">
9
9
  <p>
10
10
  <% if curation_concern.lease_expiration_date %>
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency 'rdf', '~> 1.99'
39
39
  spec.add_dependency 'rdf-vocab', '~> 0'
40
40
  spec.add_dependency 'awesome_nested_set', '~> 3.0'
41
+ spec.add_dependency 'browse-everything', '~> 0.10'
41
42
 
42
43
  spec.add_development_dependency 'solr_wrapper', '~> 0.4'
43
44
  spec.add_development_dependency 'fcrepo_wrapper', '~> 0.1'
@@ -58,5 +59,6 @@ Gem::Specification.new do |spec|
58
59
  spec.add_development_dependency 'jasmine'
59
60
  spec.add_development_dependency 'rubocop', '~> 0.39'
60
61
  spec.add_development_dependency 'rubocop-rspec', '~> 1.4.1'
62
+ spec.add_development_dependency 'webmock'
61
63
 
62
64
  end
@@ -131,7 +131,7 @@ module CurationConcerns
131
131
  # ActiveJob queue to handle ingest-like jobs.
132
132
  attr_writer :ingest_queue_name
133
133
  def ingest_queue_name
134
- @ingest_queue_name ||= :ingest
134
+ @ingest_queue_name ||= :default
135
135
  end
136
136
 
137
137
  callback.enable :after_create_concern, :after_create_fileset,
@@ -1,3 +1,3 @@
1
1
  module CurationConcerns
2
- VERSION = "1.0.0.beta3".freeze
2
+ VERSION = "1.0.0.beta4".freeze
3
3
  end
@@ -16,7 +16,8 @@ describe CharacterizeJob do
16
16
  context 'when the characterization proxy content is present' do
17
17
  it 'runs Hydra::Works::CharacterizationService and creates a CreateDerivativesJob' do
18
18
  expect(Hydra::Works::CharacterizationService).to receive(:run).with(file, filename)
19
- expect(file_set).to receive(:save!)
19
+ expect(file).to receive(:save!)
20
+ expect(file_set).to receive(:update_index)
20
21
  expect(CreateDerivativesJob).to receive(:perform_later).with(file_set, filename)
21
22
  described_class.perform_now(file_set, filename)
22
23
  end
@@ -13,15 +13,14 @@ describe ImportUrlJob do
13
13
  end
14
14
  end
15
15
 
16
- let(:mock_response) do
17
- double('response').tap do |http_res|
18
- allow(http_res).to receive(:start).and_yield
19
- allow(http_res).to receive(:content_type).and_return('image/png')
20
- allow(http_res).to receive(:read_body).and_yield(File.open(File.expand_path(file_path, __FILE__)).read)
21
- end
22
- end
23
16
  let(:log) { create(:operation) }
24
17
 
18
+ before do
19
+ stub_request(:get, "http://example.org#{file_hash}").to_return(
20
+ body: File.open(File.expand_path(file_path, __FILE__)).read, status: 200, headers: { 'Content-Type' => 'image/png' }
21
+ )
22
+ end
23
+
25
24
  context 'after running the job' do
26
25
  let(:actor) { double }
27
26
 
@@ -32,7 +31,6 @@ describe ImportUrlJob do
32
31
  end
33
32
 
34
33
  it 'creates the content' do
35
- expect_any_instance_of(Net::HTTP).to receive(:request_get).with(file_hash).and_yield(mock_response)
36
34
  expect(actor).to receive(:create_content).and_return(true)
37
35
  described_class.perform_now(file_set, log)
38
36
  expect(log.status).to eq 'success'
@@ -51,7 +49,6 @@ describe ImportUrlJob do
51
49
  allow(ActiveFedora::Base).to receive(:find).with(file_set_id).and_return(file_set)
52
50
  allow_any_instance_of(CurationConcerns::Actors::FileSetActor).to receive(:create_content)
53
51
  allow_any_instance_of(Ability).to receive(:can?).and_return(true)
54
- expect_any_instance_of(Net::HTTP).to receive(:request_get).with(file_hash).and_yield(mock_response)
55
52
  end
56
53
 
57
54
  it "does not kill all the metadata set by other processes" do
@@ -25,5 +25,26 @@ describe CurationConcerns::PresenterFactory do
25
25
  expect(subject.size).to eq 1
26
26
  end
27
27
  end
28
+
29
+ context "with more arguments" do
30
+ let(:presenter_class) do
31
+ Class.new(CurationConcerns::FileSetPresenter) do
32
+ attr_reader :two, :three
33
+ def initialize(_one, two, three)
34
+ @two = two
35
+ @three = three
36
+ end
37
+ end
38
+ end
39
+ let(:results) { [{ "id" => "12" }, { "id" => "13" }] }
40
+ subject { described_class.build_presenters(['12', '13'],
41
+ presenter_class,
42
+ 'more',
43
+ 'and more') }
44
+ it 'passes all the arguments' do
45
+ expect(subject.first.two).to eq 'more'
46
+ expect(subject.first.three).to eq 'and more'
47
+ end
48
+ end
28
49
  end
29
50
  end
@@ -2,10 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe CurationConcerns::WorkShowPresenter do
4
4
  let(:solr_document) { SolrDocument.new(attributes) }
5
+ let(:request) { double }
5
6
  let(:date_value) { Date.today }
6
7
  let(:date_index) { date_value.to_s }
7
8
  let(:attributes) do
8
- { "title_tesim" => ["foo bar"],
9
+ { "title_tesim" => ['foo', 'bar'],
9
10
  "human_readable_type_tesim" => ["Generic Work"],
10
11
  "has_model_ssim" => ["GenericWork"],
11
12
  "date_created_tesim" => ['an unformatted date'],
@@ -14,11 +15,11 @@ describe CurationConcerns::WorkShowPresenter do
14
15
  end
15
16
 
16
17
  let(:ability) { nil }
17
- let(:presenter) { described_class.new(solr_document, ability) }
18
+ let(:presenter) { described_class.new(solr_document, ability, request) }
18
19
 
19
20
  describe "#to_s" do
20
21
  subject { presenter.to_s }
21
- it { is_expected.to eq 'foo bar' }
22
+ it { is_expected.to eq 'foo, bar' }
22
23
  end
23
24
 
24
25
  describe "#human_readable_type" do
@@ -103,7 +104,7 @@ describe CurationConcerns::WorkShowPresenter do
103
104
 
104
105
  it "uses the set class" do
105
106
  expect(CurationConcerns::PresenterFactory).to receive(:build_presenters)
106
- .with(['12', '33'], presenter_class, ability)
107
+ .with(['12', '33'], presenter_class, ability, request)
107
108
  presenter.file_set_presenters
108
109
  end
109
110
  end
@@ -118,7 +119,7 @@ describe CurationConcerns::WorkShowPresenter do
118
119
  end
119
120
  it "has a representative" do
120
121
  expect(CurationConcerns::PresenterFactory).to receive(:build_presenters)
121
- .with([obj.members[0].id], presenter_class, ability).and_return ["abc"]
122
+ .with([obj.members[0].id], presenter_class, ability, request).and_return ["abc"]
122
123
  expect(presenter.representative_presenter).to eq("abc")
123
124
  end
124
125
  end
@@ -139,14 +140,18 @@ describe CurationConcerns::WorkShowPresenter do
139
140
  end
140
141
  end
141
142
 
143
+ describe '#page_title' do
144
+ subject { presenter.page_title }
145
+ it { is_expected.to eq 'foo' }
146
+ end
147
+
142
148
  describe "#attribute_to_html" do
143
- let(:presenter) { described_class.new(solr_document, ability) }
144
149
  let(:renderer) { double('renderer') }
145
150
 
146
151
  context 'with an existing field' do
147
152
  before do
148
153
  allow(CurationConcerns::Renderers::AttributeRenderer).to receive(:new)
149
- .with(:title, ["foo bar"], {})
154
+ .with(:title, ['foo', 'bar'], {})
150
155
  .and_return(renderer)
151
156
  end
152
157
 
data/spec/spec_helper.rb CHANGED
@@ -22,6 +22,8 @@ Capybara.javascript_driver = :poltergeist
22
22
  Capybara.default_max_wait_time = ENV['TRAVIS'] ? 30 : 15
23
23
  require 'capybara/rspec'
24
24
  require 'capybara/rails'
25
+ require 'webmock/rspec'
26
+ WebMock.allow_net_connect!
25
27
 
26
28
  $in_travis = !ENV['TRAVIS'].nil? && ENV['TRAVIS'] == 'true'
27
29
 
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: 1.0.0.beta3
4
+ version: 1.0.0.beta4
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-05-18 00:00:00.000000000 Z
13
+ date: 2016-05-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hydra-head
@@ -298,6 +298,20 @@ dependencies:
298
298
  - - "~>"
299
299
  - !ruby/object:Gem::Version
300
300
  version: '3.0'
301
+ - !ruby/object:Gem::Dependency
302
+ name: browse-everything
303
+ requirement: !ruby/object:Gem::Requirement
304
+ requirements:
305
+ - - "~>"
306
+ - !ruby/object:Gem::Version
307
+ version: '0.10'
308
+ type: :runtime
309
+ prerelease: false
310
+ version_requirements: !ruby/object:Gem::Requirement
311
+ requirements:
312
+ - - "~>"
313
+ - !ruby/object:Gem::Version
314
+ version: '0.10'
301
315
  - !ruby/object:Gem::Dependency
302
316
  name: solr_wrapper
303
317
  requirement: !ruby/object:Gem::Requirement
@@ -564,6 +578,20 @@ dependencies:
564
578
  - - "~>"
565
579
  - !ruby/object:Gem::Version
566
580
  version: 1.4.1
581
+ - !ruby/object:Gem::Dependency
582
+ name: webmock
583
+ requirement: !ruby/object:Gem::Requirement
584
+ requirements:
585
+ - - ">="
586
+ - !ruby/object:Gem::Version
587
+ version: '0'
588
+ type: :development
589
+ prerelease: false
590
+ version_requirements: !ruby/object:Gem::Requirement
591
+ requirements:
592
+ - - ">="
593
+ - !ruby/object:Gem::Version
594
+ version: '0'
567
595
  description: 'A Rails Engine that allows an application to CRUD CurationConcern objects
568
596
  (a.k.a. "Works") '
569
597
  email:
@@ -617,7 +645,6 @@ files:
617
645
  - app/assets/javascripts/curation_concerns/embargoes.js
618
646
  - app/assets/javascripts/curation_concerns/facet_mine.js
619
647
  - app/assets/javascripts/curation_concerns/file_manager/affix.es6
620
- - app/assets/javascripts/curation_concerns/file_manager/list_toggle.es6
621
648
  - app/assets/javascripts/curation_concerns/file_manager/member.es6
622
649
  - app/assets/javascripts/curation_concerns/file_manager/save_manager.es6
623
650
  - app/assets/javascripts/curation_concerns/file_manager/sorting.es6
@@ -848,6 +875,7 @@ files:
848
875
  - app/views/curation_concerns/base/_file_manager_attributes.html.erb
849
876
  - app/views/curation_concerns/base/_file_manager_extra_tools.html.erb
850
877
  - app/views/curation_concerns/base/_file_manager_member.html.erb
878
+ - app/views/curation_concerns/base/_file_manager_members.html.erb
851
879
  - app/views/curation_concerns/base/_file_manager_thumbnail.html.erb
852
880
  - app/views/curation_concerns/base/_form.html.erb
853
881
  - app/views/curation_concerns/base/_form_additional_information.html.erb
@@ -1205,7 +1233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1205
1233
  version: 1.3.1
1206
1234
  requirements: []
1207
1235
  rubyforge_project:
1208
- rubygems_version: 2.6.4
1236
+ rubygems_version: 2.5.1
1209
1237
  signing_key:
1210
1238
  specification_version: 4
1211
1239
  summary: A Rails Engine that allows an application to CRUD CurationConcern objects
@@ -1,6 +0,0 @@
1
- Blacklight.onLoad(function() {
2
- $("*[data-action=list-toggle] button").click(function() {
3
- $(this).parent().find("button").toggleClass("active")
4
- $("#sortable").toggleClass("grid")
5
- })
6
- })