diff --git a/app/assets/images/describe.png b/app/assets/images/describe.png new file mode 100644 index 0000000..c490477 Binary files /dev/null and b/app/assets/images/describe.png differ diff --git a/app/assets/images/organize.png b/app/assets/images/organize.png new file mode 100644 index 0000000..f1bea4c Binary files /dev/null and b/app/assets/images/organize.png differ diff --git a/app/assets/images/publish.png b/app/assets/images/publish.png new file mode 100644 index 0000000..125c7fa Binary files /dev/null and b/app/assets/images/publish.png differ diff --git a/app/assets/images/upload.png b/app/assets/images/upload.png new file mode 100644 index 0000000..5eae76c Binary files /dev/null and b/app/assets/images/upload.png differ diff --git a/app/assets/stylesheets/dashboard.scss b/app/assets/stylesheets/dashboard.scss index 5699d82..ba00f8d 100755 --- a/app/assets/stylesheets/dashboard.scss +++ b/app/assets/stylesheets/dashboard.scss @@ -1,30 +1,45 @@ @import 'global'; -div.heading-tile .glyphicon { - background: $hokie-orange; +div.dashboard-breadcrumb { + margin-bottom: 20px; + margin-top: 20px; + border-bottom: solid $hokie-orange; +} + +div.heading-tile { color: white; display: block; - width: 2em; - height: 2em; + border-radius: 5px 5px 0 0; line-height: 1.75em; margin: 0 auto; - border-radius: 50%; - border: 2px solid $hokie-orange; + padding-top: 10px; overflow: hidden; transition-property: background-color, color; transition-duration: .35s; transition-timing-function: ease-out; } -div.heading-tile:hover .glyphicon { +div.heading-tile.active { + background-color: orange; + color: white; + transition-property: background-color, color; + transition-duration: .35s; + transition-timing-function: ease-out; +} + +div.heading-tile:hover { background-color: $hokie-orange; - border-color: $hokie-orange; color: white; transition-property: background-color, color; transition-duration: .35s; transition-timing-function: ease-out; } +div.heading-tile a:hover { + text-decoration: none; +} + + .dashboard { .panel-default > .panel-heading { background-color: $hokie-grey; @@ -42,4 +57,10 @@ div.heading-tile:hover .glyphicon { padding: 0 .25em; } -} \ No newline at end of file +} + +.heading-tile { + img { + height: 64px; + } +} diff --git a/app/assets/stylesheets/styles.scss b/app/assets/stylesheets/styles.scss index 8e79e20..980fe0e 100755 --- a/app/assets/stylesheets/styles.scss +++ b/app/assets/stylesheets/styles.scss @@ -23,6 +23,12 @@ text-align: left; } +.table-actionable { + .text-left { + text-align: left; + } +} + #login-form { margin-top: 5%; margin-bottom: 5%; diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index bea75a8..5669f12 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -1,6 +1,8 @@ class CollectionsController < ApplicationController + include Hydra::Catalog + include Sufia::CollectionsControllerBehavior - skip_load_and_authorize_resource :only => [:datacite_search, :crossref_search, :import_metadata, :ldap_search] + skip_load_and_authorize_resource :only => [:datacite_search, :crossref_search, :import_metadata, :ldap_search, :add_files] def presenter_class MyCollectionPresenter @@ -115,4 +117,14 @@ def ldap_search render :layout => false end + def add_files + if current_user.admin? + search_params_logic = [:show_only_generic_files, :add_access_controls_to_solr_params] + else + search_params_logic = [:show_only_generic_files, :show_only_resources_deposited_by_current_user] + end + (_, @files) = search_results({ q: '' }, search_params_logic) + @collection = Collection.find(params[:id]) + authorize! :edit, @collection + end end diff --git a/app/controllers/publishables_controller.rb b/app/controllers/publishables_controller.rb new file mode 100644 index 0000000..2f76ef1 --- /dev/null +++ b/app/controllers/publishables_controller.rb @@ -0,0 +1,17 @@ +class PublishablesController < ApplicationController + include Hydra::Catalog + include Hydra::BatchEditBehavior + include Hydra::Collections::SelectsCollections + + def index + @publishables = [] + # there is almost certainly a better way to do this!!! + Collection.where(depositor: current_user.user_key).each do |collection| + unless collection.member_ids.empty? + unless collection.identifier.any? {|uri| uri.start_with? "doi:"} + @publishables << collection + end + end + end + end +end diff --git a/app/helpers/dashboard_breadcrumb_helper.rb b/app/helpers/dashboard_breadcrumb_helper.rb new file mode 100644 index 0000000..2daedd9 --- /dev/null +++ b/app/helpers/dashboard_breadcrumb_helper.rb @@ -0,0 +1,17 @@ +module DashboardBreadcrumbHelper + @@dashboard_groups = { + "generic_files" => :upload, + "batch" => :describe, + "my/files" => :describe, + "my/highlights" => :describe, + "my/shares" => :describe, + "batch_edits" => :describe, + "my/collections" => :organize, + "collections" => :organize, + "publishables" => :publish + } + + def current_dashboard_tab?(sym) + @@dashboard_groups[params[:controller]] == sym + end +end diff --git a/app/views/batch/edit.html.erb b/app/views/batch/edit.html.erb new file mode 100644 index 0000000..e17cf6c --- /dev/null +++ b/app/views/batch/edit.html.erb @@ -0,0 +1,28 @@ +<%= javascript_tag do %> + <%= render partial: "edit", formats: [:js] %> +<% end %> + +<%= render partial: "dashboard/_index_partials/heading_actions" %> + +

Apply Metadata

+

+ The information you provide for Title will be applied to the corresponding file only; however all other + information you provide will be applied to the entire batch of files you have just + deposited into <%= t('sufia.product_name') %>. You may edit individual files from + <%= link_to " #{t('sufia.bread_crumb.file_list')}".html_safe, sufia.dashboard_files_path %> + once this step is finished. * indicates required fields. +

+<%= simple_form_for [sufia, @batch, @form], html: { multipart: true }, builder: Sufia::FormBuilder do |f| %> + + <%= render 'metadata', f: f %> + + <%= render 'generic_files/permission_form', f: f, batch: @batch %> + +
+ <%= button_tag type: 'submit', class: 'btn btn-primary btn-lg', + onclick: "confirmation_needed = false;", id: "upload_submit", name: "update_permission" do %> + Save + <% end %> +
+ +<% end %> diff --git a/app/views/batch_edits/edit.html.erb b/app/views/batch_edits/edit.html.erb new file mode 100644 index 0000000..d1a7586 --- /dev/null +++ b/app/views/batch_edits/edit.html.erb @@ -0,0 +1,59 @@ +<%= render_breadcrumbs builder: Sufia::BootstrapBreadcrumbsBuilder %> +<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %> +

Batch Edit Descriptions    Click on labels below to edit file descriptions.

+
+

Changes will be applied to: (<%= @names.size %> files)

+ <%= @names.join(", ").html_safe %> +
+ +
+

Descriptions:

+ + +
+
+ <% @terms.each do |term| %> +
+ <%= simple_form_for @generic_file, url: batch_edits_path, method: :put, remote: true, + builder: Sufia::FormBuilder, html: { id: "form_#{term.to_s}", class: "ajax-form"} do |f| %> + +
+ <%= hidden_field_tag('update_type', 'update') %> + <%= hidden_field_tag('key', term.to_s) %> + <%# TODO we don't need to show required %> + <%= render_edit_field_partial(term, f: f) %> +
+ <%= f.submit "Save changes", class: 'btn btn-primary field-save updates-batches' , id: "#{term.to_s}_save" %> + Cancel +
+
+
+ <% end %> +
+ <% end %> +
+ +
+ <%= form_for @generic_file, url: batch_edits_path, method: :put, remote: true, html: { id: "form_permissions", class: "ajax-form"} do |f| %> + <%= hidden_field_tag('update_type', 'update') %> + <%= hidden_field_tag('key', 'permissions') %> + <%= render "generic_files/permission_form", f: f %> +
+ <%= f.submit "Save changes", class: 'btn btn-primary updates-batches', id: 'permissions_save' %> +
+
+ <% end %> +
+
+ + +<%= button_to "Clear Batch", { controller: :batch_edits, action: :clear }, form_class: 'hidden', remote: true, id: 'clear_batch' %> + +
diff --git a/app/views/collections/_show_actions.html.erb b/app/views/collections/_show_actions.html.erb index d68071d..e7944c0 100644 --- a/app/views/collections/_show_actions.html.erb +++ b/app/views/collections/_show_actions.html.erb @@ -5,10 +5,9 @@ <%= link_to collections.edit_collection_path, class: "btn btn-default", title: "Edit this Dataset" do %> Edit <% end %> - <%= link_to sufia.dashboard_files_path, class: "btn btn-default", title: "Add files to this Dataset" do %> - Files + <%= link_to collections_add_files_path(@collection), class: "btn btn-default", title: "Edit this Dataset" do %> + Files <% end %> - <%= request_doi_link(@collection) %> <% end %> diff --git a/app/views/collections/add_files.html.erb b/app/views/collections/add_files.html.erb new file mode 100644 index 0000000..886db7b --- /dev/null +++ b/app/views/collections/add_files.html.erb @@ -0,0 +1,32 @@ +<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %> +

Files in <%= @collection.title %>

+<% if @files.empty? %> + Please upload some files first +<% else %> + <%= form_for @collection, url: collections.collection_path(@collection) do |f| %> + <%= hidden_field_tag "collection[members][]" %> +
+ + + + + + + + + + <% @files.each do |file| %> + + + + + + <% end %> + +
FilenameDate UploadedIn Collection
<%= render_thumbnail_tag file, { class: "hidden-xs file_listing_thumbnail pull-left media-left" }, { suppress_link: true } %> + <%= file.title_or_label %><%= file.date_uploaded %><%= check_box_tag 'batch_document_ids[]', file.id, @collection.member_ids.include?(file.id) %>
+
+
+ <%= f.button('Add Files to Collection', class: 'btn btn-primary') %> + <% end %> +<% end %> diff --git a/app/views/collections/edit.html.erb b/app/views/collections/edit.html.erb index 3140749..194a682 100755 --- a/app/views/collections/edit.html.erb +++ b/app/views/collections/edit.html.erb @@ -1,5 +1,8 @@ <% @page_title = "Edit Dataset #{display_title(@collection)} - #{application_name}" %> <%= render_breadcrumbs builder: Sufia::BootstrapBreadcrumbsBuilder %> + +<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %> +

Edit Dataset: <%= display_title(@collection) %>

<% unless has_collection_search_parameters? %> diff --git a/app/views/collections/new.html.erb b/app/views/collections/new.html.erb index 20ddfe4..7342ae6 100644 --- a/app/views/collections/new.html.erb +++ b/app/views/collections/new.html.erb @@ -1,3 +1,7 @@ +
+<%= render partial: "dashboard/_index_partials/heading_actions" %> +
+

Create New Dataset

<%= radio_button_tag :doi_status, "assigned", checked = false %> diff --git a/app/views/collections/show.html.erb b/app/views/collections/show.html.erb index 3a36565..eeeb642 100755 --- a/app/views/collections/show.html.erb +++ b/app/views/collections/show.html.erb @@ -1,7 +1,7 @@ <% @page_title = "#{@collection.title} - #{application_name}" %> <%= render_breadcrumbs builder: Sufia::BootstrapBreadcrumbsBuilder %> - +<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %>
<%= render partial: 'collections/media_display', locals: { generic_file: @collection } %> diff --git a/app/views/dashboard/_index_partials/_heading_actions.html.erb b/app/views/dashboard/_index_partials/_heading_actions.html.erb new file mode 100644 index 0000000..7278ead --- /dev/null +++ b/app/views/dashboard/_index_partials/_heading_actions.html.erb @@ -0,0 +1,31 @@ +<% current_tab ||= nil %> +
+ <% if can?(:create, GenericFile) %> +
"> + <%= link_to sufia.new_generic_file_path do %> + <%= image_tag('upload.png') %>
+ <%= t("sufia.dashboard.upload") %> + <% end %> +
+ <% end %> +
"> + <%= link_to sufia.dashboard_files_path do %> + <%= image_tag('describe.png') %>
+ <%= t("sufia.dashboard.view_files") %> + <% end %> +
+ <% if can?(:create, Collection) %> +
"> + <%= link_to sufia.dashboard_collections_path, id: "hydra-collection-add" do %> + <%= image_tag('organize.png') %>
+ <%= t("sufia.dashboard.create_collection") %> + <% end %> +
+ <% end %> +
"> + <%= link_to dashboard_publishables_path, id: "hydra-collection-view" do %> + <%= image_tag('publish.png') %>
+ <%= t("sufia.dashboard.publish") %> + <% end %> +
+
diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb new file mode 100644 index 0000000..e4acf29 --- /dev/null +++ b/app/views/dashboard/index.html.erb @@ -0,0 +1,16 @@ +<%= content_for :heading do %> + + <%= render partial: "dashboard/_index_partials/heading_greetings" %> + +<% end %> + +<%= content_for :sidebar do %> + + <%= render partial: "dashboard/_index_partials/stats" %> + + <%= render partial: "dashboard/_index_partials/user_info" %> + +<% end %> + +<%= render partial: "dashboard/_index_partials/contents" %> + diff --git a/app/views/generic_files/edit.html.erb b/app/views/generic_files/edit.html.erb new file mode 100644 index 0000000..450c820 --- /dev/null +++ b/app/views/generic_files/edit.html.erb @@ -0,0 +1,31 @@ +<%= javascript_tag do %> + <%= render partial: "edit", formats: [:js] %> +<% end %> + +<%= render_breadcrumbs builder: Sufia::BootstrapBreadcrumbsBuilder %> +<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %> +

Edit <%= @generic_file %>

+ +
+
+ <%= render partial: 'media_display' %> +
+
+ +
+ <%= render "descriptions", form: @form %> + <%= render "permission", generic_file: @generic_file %> + <%= render "versioning", generic_file: @generic_file %> +
+
+
diff --git a/app/views/generic_files/new.html.erb b/app/views/generic_files/new.html.erb new file mode 100644 index 0000000..aad1989 --- /dev/null +++ b/app/views/generic_files/new.html.erb @@ -0,0 +1,33 @@ +

Upload

+<%= render partial: 'dashboard/_index_partials/heading_actions' %> +<%= render partial: 'generic_files/upload/alerts' %> +<%# using partials rather than inlining, so implementers can add or change stuff on this page without much duplication %> + + +
+
+ <%= t("sufia.upload.my_computer.sr_instructions") %> + <%= render partial: 'multiple_upload' %> +
+ + <% if Sufia.config.browse_everything %> +
+ <%= render partial: 'browse_everything' %> +
+ <% end %> + + <% if Sufia.config.enable_local_ingest %> +
+ <%= render partial: 'generic_files/local_file_import' %> +
+ <% end %> + +
diff --git a/app/views/layouts/sufia-dashboard.html.erb b/app/views/layouts/sufia-dashboard.html.erb index 7b062ae..6a61abf 100755 --- a/app/views/layouts/sufia-dashboard.html.erb +++ b/app/views/layouts/sufia-dashboard.html.erb @@ -17,6 +17,7 @@
+ <%= render partial: "dashboard/_index_partials/heading_actions" %>
<%= yield %>
@@ -30,4 +31,4 @@
<%= render 'shared/ajax_modal' %> - \ No newline at end of file + diff --git a/app/views/my/_collection_action_menu.html.erb b/app/views/my/_collection_action_menu.html.erb index 5511c69..1f9eb32 100755 --- a/app/views/my/_collection_action_menu.html.erb +++ b/app/views/my/_collection_action_menu.html.erb @@ -14,6 +14,8 @@ class: 'itemicon itemtrash', title: 'Delete Dataset', method: :delete, data: { confirm: "Deleting a dataset from #{t('sufia.product_name')} is permanent. Click OK to delete this dataset from #{t('sufia.product_name')}, or Cancel to cancel this operation" } %> +
  • + <%= link_to raw(' Add Files'), collections_add_files_path(id), class: 'itemicon', title: 'Add Files' %> <% end %>
  • diff --git a/app/views/my/index.html.erb b/app/views/my/index.html.erb index 6fb917b..2363c02 100755 --- a/app/views/my/index.html.erb +++ b/app/views/my/index.html.erb @@ -10,22 +10,21 @@ <% @page_title = "#{current_tab.capitalize} listing" %> -

    My Files, Datasets, Highlights, and Files Shared with Me

    - +<% unless @selected_tab == :collections %> +

    My Files, Datasets, Highlights, and Files Shared with Me

    + +<% end %> <%= render 'search_header' %> @@ -37,8 +36,11 @@
    - <%= link_to t('sufia.dashboard.upload_html'), sufia.new_generic_file_path, class: "btn btn-primary" %> + <% if @selected_tab == :collections %> <%= link_to t('sufia.dashboard.create_collection_html'), collections.new_collection_path, id: "hydra-collection-add", class: "btn btn-primary" %> + <% elsif @selected_tab == :files || @selected_tab == :highlighted || @selected_tab == :shared %> + <%= link_to t('sufia.dashboard.upload_html'), sufia.new_generic_file_path, class: "btn btn-primary" %> + <% end %>


    diff --git a/app/views/publishables/index.html.erb b/app/views/publishables/index.html.erb new file mode 100644 index 0000000..46b5b81 --- /dev/null +++ b/app/views/publishables/index.html.erb @@ -0,0 +1,27 @@ +<% @page_title = "Publishable Datasets - #{application_name}" %> + +<%= render_breadcrumbs builder: Sufia::BootstrapBreadcrumbsBuilder %> +<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %> +<% if @publishables.empty? %> + Noting to publish +<% else %> +
    + + + + + + + + + <% @publishables.each do |publishable| %> + + + + + <% end %> + +
    TitleAction
    <%= link_to publishable, "/collections/#{publishable.id}" %><%= request_doi_link(publishable) %>
    +
    +
    +<% end %> diff --git a/config/locales/sufia.en.yml b/config/locales/sufia.en.yml index 9785186..0211876 100755 --- a/config/locales/sufia.en.yml +++ b/config/locales/sufia.en.yml @@ -78,9 +78,10 @@ en: greeting: "Hello, " upload_html: ' Upload' create_collection_html: ' Create Dataset' - create_collection: "Create Dataset" + create_collection: "Organize" view_collections: "View Datasets" - view_files: "View Files" + view_files: "Describe" + publish: "Publish" user_activity: "User Activity" no_activity: "User has no recent activity" user_notiticiations: "User Notifications" diff --git a/config/routes.rb b/config/routes.rb index abd98db..caf538b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,9 @@ post 'collections/crossref_search', to: 'collections#crossref_search' get "collections/import_metadata", to: 'collections#import_metadata', as: 'import_collection' get 'collections/ldap_search', to: 'collections#ldap_search' + get 'dashboard/publishables', to: 'publishables#index', as: 'dashboard_publishables' get 'help', to: 'pages#show', id: 'help_page' + get 'collections/:id/add-files', to: 'collections#add_files', as: 'collections_add_files' blacklight_for :catalog devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' } diff --git a/spec/controllers/collections_controller_spec.rb b/spec/controllers/collections_controller_spec.rb index 488cb39..de9cabd 100644 --- a/spec/controllers/collections_controller_spec.rb +++ b/spec/controllers/collections_controller_spec.rb @@ -7,6 +7,7 @@ # but need to do this for now as controller view tests are not working let(:user) { FactoryGirl.create(:user) } + let(:admin) { FactoryGirl.create(:user, :with_admin_role) } describe '#create' do routes { Hydra::Collections::Engine.routes } @@ -91,7 +92,7 @@ end end - describe "ldap_search" do + describe "#ldap_search" do before do sign_in user end @@ -109,4 +110,58 @@ end + describe "#add_files" do + let(:file1) do + f = FactoryGirl.build(:public_file) + f.apply_depositor_metadata user.user_key + f.save + f + end + + let(:file2) do + f = FactoryGirl.build(:public_file) + f.apply_depositor_metadata admin.user_key + f.save + f + end + + context "for normal users" do + before {sign_in user} + + let(:collection) do + c = FactoryGirl.build(:collection) + c.apply_depositor_metadata user.user_key + c.save + c + end + + it "shows all files of the user" do + files = [file1] + get :add_files, id: collection + expect(assigns[:collection]).to eq collection + expect(assigns[:files].length).to eq files.length + expect(assigns[:files][0].id).to eq files[0].id + end + end + + context "for admin users" do + before {sign_in admin} + + let(:collection) do + c = FactoryGirl.build(:collection) + c.apply_depositor_metadata admin.user_key + c.save + c + end + + it "shows all files of the user" do + files = [file1, file2] + get :add_files, id: collection + expect(assigns[:collection]).to eq collection + expect(assigns[:files].length).to eq files.length + expect(assigns[:files].map{|f| f.id}).to include files[0].id + expect(assigns[:files].map{|f| f.id}).to include files[1].id + end + end + end end diff --git a/spec/controllers/publishables_controller_spec.rb b/spec/controllers/publishables_controller_spec.rb new file mode 100644 index 0000000..5e76b95 --- /dev/null +++ b/spec/controllers/publishables_controller_spec.rb @@ -0,0 +1,27 @@ +require 'rails_helper' + +RSpec.describe PublishablesController, type: :controller do + render_views + let(:user) {FactoryGirl.create(:user)} + + describe "#index" do + before do + sign_in user + end + + let(:collection) do + f = FactoryGirl.create(:generic_file) + c = FactoryGirl.build(:collection) + c.apply_depositor_metadata user.user_key + c.member_ids = [f.id] + c.save + c + end + + it "shows collections with files and without doi requests" do + collections = [collection] + get :index + expect(assigns[:publishables]).to eq collections + end + end +end diff --git a/spec/features/browse_dashboard_files_spec.rb b/spec/features/browse_dashboard_files_spec.rb index d3c9c94..c3c5736 100644 --- a/spec/features/browse_dashboard_files_spec.rb +++ b/spec/features/browse_dashboard_files_spec.rb @@ -30,7 +30,7 @@ it "links to my other tabs" do # TODO: this would make a good view test. - ["My Datasets", "My Highlights", "Files Shared with Me"].each do |tab| + ["My Highlights", "Files Shared with Me"].each do |tab| within("#my_nav") do click_link(tab) end @@ -53,7 +53,6 @@ first(".label-success") do expect(page).to have_content("Open Access") end - expect(page).to have_link("Create Dataset") expect(page).to have_link("Upload") end end diff --git a/spec/features/collection_view_spec.rb b/spec/features/collection_view_spec.rb index 4eefaf3..aaadf72 100644 --- a/spec/features/collection_view_spec.rb +++ b/spec/features/collection_view_spec.rb @@ -21,6 +21,7 @@ end it 'allows user to request doi for the collection' do + pending "this feature has been removed!" visit '/collections/' + collection.id click_button "Request DOI" expect(page).to have_content "DOI request is pending..." diff --git a/spec/features/create_collections_spec.rb b/spec/features/create_collections_spec.rb index ac3176e..4214499 100644 --- a/spec/features/create_collections_spec.rb +++ b/spec/features/create_collections_spec.rb @@ -11,6 +11,7 @@ it "allows user to create a new collection without a DOI without identifier" do visit "/dashboard" + click_link "Organize" click_link "Create Dataset" choose "doi_status_unassigned" fill_in "Title", with: "Test Title" @@ -23,11 +24,11 @@ #expect(page).to have_content("john.doe@example.com") #expect(page).to have_content("jane.doe@example.com") expect(page).to have_content("abc: def") - expect(page).to have_button "Request DOI" end it "allows user to create a new collection with direct DOI and identifier" do visit "/dashboard" + click_link "Organize" click_link "Create Dataset" choose "doi_status_assigned" click_button "Directly Fill Form" @@ -40,11 +41,11 @@ expect(page).to have_content("Test Title") #expect(page).to have_content("john.doe@example.com") #expect(page).to have_content("jane.doe@example.com") - expect(page).not_to have_button "Request DOI" end it "allows user to create a new collection with datacite search" do visit "/dashboard" + click_link "Organize" click_link "Create Dataset" choose "doi_status_assigned" fill_in "Datacite Metadata Search:", with: "test" @@ -55,11 +56,11 @@ click_button "Import Metadata" click_button "Create Dataset" expect(page).to have_content "Collection was successfully created." - expect(page).not_to have_content "DOI request is pending..." end it "allows user to create a new collection with crossref search" do visit "/dashboard" + click_link "Organize" click_link "Create Dataset" choose "doi_status_unassigned" fill_in "Title", with: "Test Title" @@ -76,6 +77,7 @@ it "does not allow a user to create new collection without a title" do visit "/dashboard" + click_link "Organize" click_link "Create Dataset" choose "doi_status_unassigned" click_button "Create Dataset" @@ -86,6 +88,7 @@ it "does not allow user to enter wrongly formatted funder information" do visit "/dashboard" + click_link "Organize" click_link "Create Dataset" choose "doi_status_unassigned" click_button "Create Dataset" diff --git a/spec/views/collections_spec.rb b/spec/views/collections_spec.rb index ff47cbd..486f7e8 100644 --- a/spec/views/collections_spec.rb +++ b/spec/views/collections_spec.rb @@ -21,3 +21,18 @@ expect(view).to render_template(:new) end end + +RSpec.describe "collections/add_files" do + let(:blacklight_config) { Blacklight::Configuration.new } + let(:collection) {FactoryGirl.create(:collection, :with_default_user)} + let(:file) {FactoryGirl.create(:generic_file)} + + it "renders collections add-file page" do + allow(view).to receive(:blacklight_config).and_return(blacklight_config) + allow(file).to receive(:title_or_label).and_return(file.filename) + assign(:collection, collection) + assign(:files, [file]) + render + expect(view).to render_template(:add_files) + end +end diff --git a/spec/views/publishables_spec.rb b/spec/views/publishables_spec.rb new file mode 100644 index 0000000..10eb2f3 --- /dev/null +++ b/spec/views/publishables_spec.rb @@ -0,0 +1,11 @@ +require "rails_helper" + +RSpec.describe "publishables/index" do + let(:collection) {FactoryGirl.create(:collection, :with_default_user)} + + it "renders publishables index page with one publishable" do + assign(:publishables, [collection]) + render + expect(rendered).to render_template(:index) + end +end