worthwhile 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -3
  3. data/README.md +2 -0
  4. data/app/assets/stylesheets/worthwhile/_worthwhile.css.scss +2 -0
  5. data/app/helpers/curate/collections_helper.rb +17 -117
  6. data/app/helpers/worthwhile/collections_helper.rb +15 -4
  7. data/app/views/catalog/_action_menu_partials/_default.html.erb +1 -1
  8. data/app/views/catalog/index.html.erb +5 -6
  9. data/app/views/collections/_form.html.erb +1 -1
  10. data/app/views/collections/_form_representative_image.html.erb +13 -0
  11. data/app/views/collections/edit.html.erb +7 -12
  12. data/app/views/collections/new.html.erb +9 -11
  13. data/app/views/curate/collections/_add_to_collection_modal.html.erb +2 -2
  14. data/app/views/curation_concern/base/_form_descriptive_fields.erb +1 -13
  15. data/app/views/curation_concern/base/_form_editors.html.erb +15 -0
  16. data/app/views/curation_concern/base/edit.html.erb +10 -12
  17. data/app/views/curation_concern/base/new.html.erb +9 -11
  18. data/app/views/curation_concern/base/show.html.erb +15 -19
  19. data/app/views/curation_concern/generic_files/edit.html.erb +2 -2
  20. data/app/views/curation_concern/generic_files/show.html.erb +3 -3
  21. data/app/views/curation_concern/linked_resources/edit.html.erb +2 -2
  22. data/app/views/curation_concern/linked_resources/new.html.erb +2 -2
  23. data/app/views/embargoes/edit.html.erb +1 -1
  24. data/app/views/layouts/curate_nd/1_column.html.erb +1 -12
  25. data/app/views/layouts/curate_nd/catalog.html.erb +1 -2
  26. data/app/views/layouts/curate_nd.html.erb +2 -13
  27. data/app/views/leases/edit.html.erb +1 -1
  28. data/app/views/worthwhile/classify_concerns/new.html.erb +3 -5
  29. data/config/locales/sufia.en.yml +2 -2
  30. data/lib/generators/worthwhile/install_generator.rb +6 -1
  31. data/lib/generators/worthwhile/templates/worthwhile.css.scss +0 -2
  32. data/lib/worthwhile/rails/routes.rb +4 -5
  33. data/lib/worthwhile/version.rb +1 -1
  34. data/spec/controllers/collections_controller_spec.rb +1 -1
  35. data/spec/controllers/curation_concern/permissions_controller_spec.rb +3 -3
  36. data/spec/controllers/downloads_controller_spec.rb +2 -2
  37. data/spec/controllers/worthwhile/classify_concerns_controller_spec.rb +19 -11
  38. data/spec/features/collection_spec.rb +48 -48
  39. data/spec/helpers/worthwhile/collections_helper_spec.rb +19 -0
  40. data/spec/matchers/metadata_field_matchers.rb +3 -3
  41. data/spec/models/collection_spec.rb +23 -23
  42. data/spec/models/curation_concern/collection_model_spec.rb +2 -2
  43. data/spec/models/worthwhile/content_version_spec.rb +2 -2
  44. data/spec/models/worthwhile/linked_resource_spec.rb +8 -8
  45. data/spec/routing/worthwhile/routes_spec.rb +2 -3
  46. data/spec/spec_helper.rb +5 -11
  47. data/spec/views/collections/_form_representative_image.html.erb_spec.rb +20 -0
  48. data/spec/views/curation_concern/base/_attributes.html.erb_spec.rb +3 -3
  49. data/spec/views/curation_concern/base/show.html.erb_spec.rb +13 -9
  50. metadata +8 -7
  51. data/app/assets/stylesheets/worthwhile.css.scss +0 -23
  52. data/app/views/curate/collections/add_member_form.html.erb +0 -6
  53. data/app/views/layouts/common_objects.html.erb +0 -36
  54. data/app/views/layouts/curate_nd/2_column.html.erb +0 -26
  55. data/app/views/layouts/curate_nd/dashboard.html.erb +0 -22
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'collections/_form_representative_image.html.erb' do
4
+ let(:file) { build(:generic_file, title: ['birds.jpg']) }
5
+ let(:work) { build(:generic_work, generic_files: [ file ]) }
6
+ let(:collection) { build(:collection, members: [ work ]) }
7
+ let(:form) { ActionView::Helpers::FormBuilder.new(:collection, collection, view, {}) }
8
+
9
+ before do
10
+ allow(collection).to receive(:persisted?).and_return(true)
11
+ allow(view).to receive(:curation_concern).and_return(collection)
12
+ allow(view).to receive(:f).and_return(form)
13
+ end
14
+
15
+ it "should have a list of the generic files images" do
16
+ render
17
+ expect(rendered).to have_selector "select#collection_representative option[value='#{file.id}']",
18
+ text: 'birds.jpg'
19
+ end
20
+ end
@@ -11,11 +11,11 @@ describe 'curation_concern/base/_attributes.html.erb' do
11
11
  subject: [subject]) }
12
12
 
13
13
  before do
14
- view.stub(:dom_class) { '' }
15
- view.stub(:permission_badge_for) { '' }
14
+ allow(view).to receive(:dom_class) { '' }
15
+ allow(view).to receive(:permission_badge_for) { '' }
16
16
 
17
17
  render partial: 'attributes', locals: { curation_concern: curation_concern }
18
- end
18
+ end
19
19
 
20
20
  it 'has links to search for other objects with the same metadata' do
21
21
  expect(rendered).to have_link(creator, href: catalog_index_path(search_field: 'creator', q: creator))
@@ -5,21 +5,25 @@ describe 'curation_concern/base/show.html.erb' do
5
5
  let!(:curation_concern) { FactoryGirl.create(:private_generic_work) }
6
6
 
7
7
  context "for editors" do
8
- it 'has links to edit and add to collections' do
8
+ before do
9
9
  allow(view).to receive(:can?).and_return(true)
10
+ end
11
+
12
+ it 'has links to edit and add to collections' do
10
13
  render file: 'curation_concern/base/show', locals: { curation_concern: curation_concern }
11
- expect(view.content_for(:second_row)).to have_link("Edit This Generic Work", href: edit_polymorphic_path([:curation_concern, curation_concern]))
12
- expect(view.content_for(:second_row)).to have_link("Add to a Collection", href: add_member_form_collections_path(collectible_id:curation_concern.pid))
14
+ expect(rendered).to have_link("Edit This Generic Work", href: edit_polymorphic_path([:curation_concern, curation_concern]))
15
+ expect(rendered).to have_selector "a[data-toggle='modal'][data-target='##{curation_concern.to_param}-modal']", text: "Add to a Collection"
16
+ expect(rendered).to have_selector("div.modal##{curation_concern.to_param}-modal form[action='#{collections.collections_path}'] input[value='Add to collection']")
13
17
  end
14
18
  end
19
+
15
20
  context "for non-editors" do
16
- it 'does not have links to edit' do
17
- render file: 'curation_concern/base/show', locals: { curation_concern: curation_concern }
18
- expect(view.content_for(:second_row)).not_to have_content("Edit this Generic Work")
19
- end
20
- it 'has link to add to a collection' do
21
+ it 'does not have links to edit, but has add to collection' do
21
22
  render file: 'curation_concern/base/show', locals: { curation_concern: curation_concern }
22
- expect(view.content_for(:second_row)).to have_link("Add to a Collection", href: add_member_form_collections_path(collectible_id:curation_concern.pid))
23
+ expect(rendered).not_to have_content("Edit this Generic Work")
24
+
25
+ expect(rendered).to have_selector "a[data-toggle='modal'][data-target='##{curation_concern.to_param}-modal']", text: "Add to a Collection"
26
+ expect(rendered).to have_selector("div.modal##{curation_concern.to_param}-modal form[action='#{collections.collections_path}'] input[value='Add to collection']")
23
27
  end
24
28
  end
25
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worthwhile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-18 00:00:00.000000000 Z
11
+ date: 2014-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hydra-head
@@ -299,7 +299,6 @@ files:
299
299
  - app/assets/javascripts/worthwhile/proxy_submission.js
300
300
  - app/assets/javascripts/worthwhile/select_works.js.coffee
301
301
  - app/assets/javascripts/worthwhile/worthwhile.js
302
- - app/assets/stylesheets/worthwhile.css.scss
303
302
  - app/assets/stylesheets/worthwhile/_global-variables.css.scss
304
303
  - app/assets/stylesheets/worthwhile/_modules.css.scss
305
304
  - app/assets/stylesheets/worthwhile/_positioning.css.scss
@@ -407,6 +406,7 @@ files:
407
406
  - app/views/collections/_form.html.erb
408
407
  - app/views/collections/_form_for_select_collection.html.erb
409
408
  - app/views/collections/_form_permission.html.erb
409
+ - app/views/collections/_form_representative_image.html.erb
410
410
  - app/views/collections/_form_required_information.html.erb
411
411
  - app/views/collections/_identifier_and_action.html.erb
412
412
  - app/views/collections/_media_display.html.erb
@@ -424,7 +424,6 @@ files:
424
424
  - app/views/curate/collections/_add_to_collection_modal.html.erb
425
425
  - app/views/curate/collections/_button_remove_from_collection.html.erb
426
426
  - app/views/curate/collections/_form_to_add_member.html.erb
427
- - app/views/curate/collections/add_member_form.html.erb
428
427
  - app/views/curation_concern/base/_attributes.html.erb
429
428
  - app/views/curation_concern/base/_collections.html.erb
430
429
  - app/views/curation_concern/base/_form.html.erb
@@ -432,6 +431,7 @@ files:
432
431
  - app/views/curation_concern/base/_form_content_license.html.erb
433
432
  - app/views/curation_concern/base/_form_contributor_agreement.html.erb
434
433
  - app/views/curation_concern/base/_form_descriptive_fields.erb
434
+ - app/views/curation_concern/base/_form_editors.html.erb
435
435
  - app/views/curation_concern/base/_form_files_and_links.html.erb
436
436
  - app/views/curation_concern/base/_form_permission.html.erb
437
437
  - app/views/curation_concern/base/_form_permission_embargo.html.erb
@@ -467,12 +467,9 @@ files:
467
467
  - app/views/embargoes/edit.html.erb
468
468
  - app/views/embargoes/index.html.erb
469
469
  - app/views/layouts/boilerplate.html.erb
470
- - app/views/layouts/common_objects.html.erb
471
470
  - app/views/layouts/curate_nd.html.erb
472
471
  - app/views/layouts/curate_nd/1_column.html.erb
473
- - app/views/layouts/curate_nd/2_column.html.erb
474
472
  - app/views/layouts/curate_nd/catalog.html.erb
475
- - app/views/layouts/curate_nd/dashboard.html.erb
476
473
  - app/views/leases/_lease_history.html.erb
477
474
  - app/views/leases/_list_active_leases.html.erb
478
475
  - app/views/leases/_list_deactivated_leases.html.erb
@@ -540,6 +537,7 @@ files:
540
537
  - spec/helpers/render_constraints_helper_spec.rb
541
538
  - spec/helpers/thumbnail_helper_spec.rb
542
539
  - spec/helpers/url_helper_spec.rb
540
+ - spec/helpers/worthwhile/collections_helper_spec.rb
543
541
  - spec/matchers.rb
544
542
  - spec/matchers/metadata_field_matchers.rb
545
543
  - spec/models/collection_spec.rb
@@ -563,6 +561,7 @@ files:
563
561
  - spec/support/shared/shared_examples_is_embargoable.rb
564
562
  - spec/support/shared/shared_examples_with_access_rights.rb
565
563
  - spec/test_app_templates/lib/generators/test_app_generator.rb
564
+ - spec/views/collections/_form_representative_image.html.erb_spec.rb
566
565
  - spec/views/curation_concern/base/_attributes.html.erb_spec.rb
567
566
  - spec/views/curation_concern/base/show.html.erb_spec.rb
568
567
  - spec/views/shared/_add_content.html.erb_spec.rb
@@ -642,6 +641,7 @@ test_files:
642
641
  - spec/helpers/render_constraints_helper_spec.rb
643
642
  - spec/helpers/thumbnail_helper_spec.rb
644
643
  - spec/helpers/url_helper_spec.rb
644
+ - spec/helpers/worthwhile/collections_helper_spec.rb
645
645
  - spec/matchers.rb
646
646
  - spec/matchers/metadata_field_matchers.rb
647
647
  - spec/models/collection_spec.rb
@@ -665,6 +665,7 @@ test_files:
665
665
  - spec/support/shared/shared_examples_is_embargoable.rb
666
666
  - spec/support/shared/shared_examples_with_access_rights.rb
667
667
  - spec/test_app_templates/lib/generators/test_app_generator.rb
668
+ - spec/views/collections/_form_representative_image.html.erb_spec.rb
668
669
  - spec/views/curation_concern/base/_attributes.html.erb_spec.rb
669
670
  - spec/views/curation_concern/base/show.html.erb_spec.rb
670
671
  - spec/views/shared/_add_content.html.erb_spec.rb
@@ -1,23 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require jquery-ui-lightness
12
- *=# require bootstrap-datepicker3
13
- *= require_self
14
- */
15
-
16
- @import 'worthwhile/global-variables';
17
- @import 'bootstrap';
18
- @import 'blacklight/blacklight';
19
- @import 'worthwhile/positioning';
20
- @import 'worthwhile/modules';
21
- @import 'token-input-facebook';
22
- @import 'worthwhile/theme';
23
- @import 'worthwhile/typography';
@@ -1,6 +0,0 @@
1
- <% content_for :page_header do %>
2
- <h1 id="add-to-title">Add <%= @collectible %> to:</h1>
3
- <% end %>
4
- <% if can? :collect, @collectible %>
5
- <%= render partial: 'form_to_add_member', locals: { collectible: @collectible, select_label_id: 'add-to-title', button_class: 'btn btn-primary' } %>
6
- <% end %>
@@ -1,36 +0,0 @@
1
- <% content_for :layout_name, 'common_objects, ' %>
2
- <% content_for :body do %>
3
-
4
- <header id="banner" role="banner">
5
- <hgroup>
6
- <div id="brand-bar-wrapper">
7
- <%= render 'shared/brand_bar' %>
8
- </div>
9
- </hgroup>
10
- </header>
11
-
12
- <div id="main" role="main" class="container <%= yield(:page_class) if content_for?(:page_class)%>">
13
- <% if content_for?(:page_header) %>
14
- <div class="row">
15
- <div class="col-md-12 main-header">
16
- <%= yield(:page_header) %>
17
- </div>
18
- </div>
19
- <% end %>
20
- <div class="row">
21
- <div class="<%= content_for?(:main_column_class) ? yield(:main_column_class) : "col-md-12" %>">
22
- <%= yield %>
23
- </div>
24
- </div>
25
- <% if content_for?(:second_row) %>
26
- <div class="row">
27
- <div class="col-md-12">
28
- <%= yield(:second_row) %>
29
- </div>
30
- </div>
31
- <% end %>
32
- </div>
33
-
34
- <% end %>
35
-
36
- <%= render :template => 'layouts/boilerplate' %>
@@ -1,26 +0,0 @@
1
- <% content_for :layout_name, 'two_column, ' %>
2
- <% content_for :main do %>
3
-
4
- <div class="row">
5
- <div class="<%= content_for?(:left_column_class) ? yield(:left_column_class) : "col-md-6" %>">
6
- <%= content_for?(:left_column) ? yield(:left_column) : yield %>
7
- </div>
8
-
9
- <div class="<%= content_for?(:right_column_class) ? yield(:right_column_class) : "col-md-6" %>">
10
- <%= yield(:right_column) if content_for?(:right_column) %>
11
- </div>
12
- </div>
13
-
14
- <% if content_for?(:second_row) %>
15
-
16
- <div class="row">
17
- <div class="col-md-12">
18
- <%= yield(:second_row) %>
19
- </div>
20
- </div>
21
-
22
- <% end %>
23
-
24
- <% end %>
25
-
26
- <%= render template: "layouts/#{theme}" %>
@@ -1,22 +0,0 @@
1
- <% content_for :layout_name, 'dashboard, ' %>
2
- <% content_for :main do %>
3
-
4
- <div class="row">
5
-
6
- <% if content_for?(:sidebar) %>
7
- <div class="col-md-3">
8
- <%= yield(:sidebar) %>
9
- </div>
10
-
11
- <div class="col-md-9">
12
- <% else %>
13
- <div class="col-md-12">
14
- <% end %>
15
- <%= yield %>
16
- </div>
17
-
18
- </div>
19
-
20
- <% end %>
21
-
22
- <%= render template: "layouts/#{theme}" %>