Skip to content

Commit

Permalink
replacing files with works
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed Dec 10, 2015
1 parent a9cde1f commit cb08e30
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion app/controllers/concerns/sufia/breadcrumbs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def trail_from_referer

def add_breadcrumb_for_controller
case controller_name
when 'file_sets'.freeze, 'my/files'.freeze, 'batch_edits'.freeze
when 'file_sets'.freeze, 'my/works'.freeze, 'batch_edits'.freeze
add_breadcrumb I18n.t('sufia.dashboard.my.works'), sufia.dashboard_works_path
when 'stats'.freeze
add_breadcrumb I18n.t('sufia.dashboard.my.works'), sufia.dashboard_works_path
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/my/works_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def index
protected

def search_action_url(*args)
sufia.dashboard_files_url(*args)
sufia.dashboard_works_url(*args)
end
end
end
4 changes: 2 additions & 2 deletions app/helpers/sufia/dashboard_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def on_the_dashboard?
params[:controller].match(/^dashboard|my/)
end

def on_my_files?
params[:controller].match(/^my\/files/)
def on_my_works?
params[:controller].match(/^my\/works/)
end

def number_of_files(user = current_user)
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/sufia/sufia_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def link_to_telephone(user = nil)
end

# Only display the current search parameters if the user is not in the dashboard.
# If they are in the dashboard, then the search defaults to the user's files and not
# If they are in the dashboard, then the search defaults to the user's works and not
# all of Sufia.
def current_search_parameters
if on_the_dashboard?
Expand Down Expand Up @@ -145,7 +145,7 @@ def collection_thumbnail(_document, _image_options = {}, _url_options = {})

def search_action_for_dashboard
case params[:controller]
when "my/files"
when "my/works"
sufia.dashboard_works_path
when "my/collections"
sufia.dashboard_collections_path
Expand Down
2 changes: 1 addition & 1 deletion app/views/my/_facet_limit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<% unless paginator.last_page? || params[:action] == "facet" %>
<li class="more_facets_link"><%= link_to 'more ' + facet_field.label.pluralize + '»',
sufia.dashboard_files_facet_path(solr_field), class: "more_facets_link" %></li>
sufia.dashboard_works_facet_path(solr_field), class: "more_facets_link" %></li>
<% end %>
</ul>
2 changes: 1 addition & 1 deletion app/views/my/_sort_and_per_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= render partial: 'collections/form_for_select_collection', locals: {user_collections: @user_collections} %>
</div>

<% if on_my_files? %>
<% if on_my_works? %>
<div class="batch-toggle">
<%= batch_delete %>
<%= button_tag "Add to Collection", class: 'btn btn-primary submits-batches submits-batches-add',
Expand Down
2 changes: 1 addition & 1 deletion app/views/my/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h1 class="sr-only">My Files, Collections, Highlights, and Files Shared with Me</h1>
<ul class="nav nav-tabs" id="my_nav" role="navigation">
<span class="sr-only">You are currently listing your <%= current_tab.pluralize %> . You have <%= @response.docs.count %> <%= current_tab.pluralize(@response.docs.count)%> </span>
<li class="<%= "active" if @selected_tab == :files %>">
<li class="<%= "active" if @selected_tab == :works %>">
<%= link_to t('sufia.dashboard.my.works'), sufia.dashboard_works_path %>
</li>
<li class="<%= "active" if @selected_tab == :collections %>">
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/batch_edits_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
expect(controller).to receive(:can?).with(:edit, two.id).and_return(true)
end

let(:mycontroller) { "my/files" }
let(:mycontroller) { "my/works" }

it "is successful" do
put :update, update_type: "delete_all"
Expand Down
4 changes: 2 additions & 2 deletions spec/features/browse_dashboard_files_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
click_button "search-submit-header"
expect(page).to have_content("Fake PDF Title")

visit "/dashboard/files"
visit "/dashboard/works"
fill_in "q", with: "PDF"
click_button "search-submit-header"
expect(page).to have_content("Fake PDF Title")
Expand Down Expand Up @@ -59,7 +59,7 @@
end

it "allows me to delete works in upload_sets", js: true do
visit "/dashboard/files"
visit "/dashboard/works"
first('input#check_all').click
expect {
click_button('Delete Selected')
Expand Down
2 changes: 1 addition & 1 deletion spec/features/ownership_transfer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

before do
sign_in original_owner
go_to_dashboard_files
go_to_dashboard_works
end

describe 'When I request a work transfer:', :js do
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/batch_edits_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
@max_batch_size = 10
end

context "with my files" do
context "with my works" do
it "shows the check all dropdown" do
allow(helper).to receive(:params).and_return(controller: "my/files")
allow(helper).to receive(:params).and_return(controller: "my/works")
allow(helper).to receive(:controller_name).and_return("batch_edits")
expect(helper.render_check_all).to have_css("span.glyphicon-cog")
end
Expand Down
14 changes: 7 additions & 7 deletions spec/helpers/dashboard_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
end

it "returns true for controllers that are part of the dashboard" do
allow(helper).to receive(:params).and_return(controller: "my/files")
allow(helper).to receive(:params).and_return(controller: "my/works")
expect(helper).to be_on_the_dashboard
allow(helper).to receive(:params).and_return(controller: "my/collections")
expect(helper).to be_on_the_dashboard
Expand All @@ -37,14 +37,14 @@
end
end

describe "#on_my_files" do
it "returns false when the controller isn't my files" do
describe "#on_my_works" do
it "returns false when the controller isn't my works" do
allow(helper).to receive(:params).and_return(controller: "my/collections")
expect(helper).to_not be_on_my_files
expect(helper).to_not be_on_my_works
end
it "returns true when the controller is my files" do
allow(helper).to receive(:params).and_return(controller: "my/files")
expect(helper).to be_on_my_files
it "returns true when the controller is my works" do
allow(helper).to receive(:params).and_return(controller: "my/works")
expect(helper).to be_on_my_works
end
end

Expand Down
10 changes: 5 additions & 5 deletions spec/helpers/sufia_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
expect(helper.current_search_parameters).to be_nil
end

it "is ignored on dashboard files, collections, highlights and shares" do
allow(helper).to receive(:params).and_return(controller: "my/files", q: "foo")
it "is ignored on dashboard works, collections, highlights and shares" do
allow(helper).to receive(:params).and_return(controller: "my/works", q: "foo")
expect(helper.current_search_parameters).to be_nil
allow(helper).to receive(:params).and_return(controller: "my/collections", q: "foo")
expect(helper.current_search_parameters).to be_nil
Expand All @@ -106,9 +106,9 @@
end
end

context "when the user is on the my files page" do
it "returns the my dashboard files path" do
allow(helper).to receive(:params).and_return(controller: "my/files")
context "when the user is on the my works page" do
it "returns the my dashboard works path" do
allow(helper).to receive(:params).and_return(controller: "my/works")
expect(helper.search_form_action).to eq(sufia.dashboard_works_path)
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/lib/sufia/breadcrumbs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def add_breadcrumb(text, link)
allow(crumbs).to receive(:user_signed_in?) { true }
allow(crumbs).to receive(:action_name).and_return("view")
end
specify "the trail goes back to the user's files" do
allow(crumbs).to receive(:controller_name).and_return("my/files")
specify "the trail goes back to the user's works" do
allow(crumbs).to receive(:controller_name).and_return("my/works")
crumbs.trail_from_referer
expect(crumbs.trail.first).to eql([I18n.t('sufia.dashboard.title'), sufia.dashboard_index_path])
expect(crumbs.trail.last).to eql([I18n.t('sufia.dashboard.my.works'), sufia.dashboard_works_path])
Expand All @@ -72,7 +72,7 @@ def add_breadcrumb(text, link)
expect(crumbs.trail.first).to eql([I18n.t('sufia.dashboard.title'), sufia.dashboard_index_path])
expect(crumbs.trail.last).to eql([I18n.t('sufia.dashboard.my.collections'), sufia.dashboard_collections_path])
end
specify "the trail goes back to the user's files when on the batch edit page" do
specify "the trail goes back to the user's works when on the batch edit page" do
allow(crumbs).to receive(:controller_name).and_return("batch_edits")
crumbs.trail_from_referer
expect(crumbs.trail.first).to eql([I18n.t('sufia.dashboard.title'), sufia.dashboard_index_path])
Expand All @@ -89,7 +89,7 @@ def add_breadcrumb(text, link)
allow(crumbs).to receive(:controller_name).and_return("file_sets")
end

specify "the trail goes back to the user's files and the browse view" do
specify "the trail goes back to the user's works and the browse view" do
crumbs.trail_from_referer
expect(crumbs.trail.first).to eql([I18n.t('sufia.dashboard.title'), sufia.dashboard_index_path])
expect(crumbs.trail[1]).to eql([I18n.t('sufia.dashboard.my.works'), sufia.dashboard_works_path])
Expand All @@ -106,7 +106,7 @@ def add_breadcrumb(text, link)
allow(crumbs).to receive(:controller_name).and_return("stats")
end

specify "the trail goes back to the user's files and the browse view" do
specify "the trail goes back to the user's works and the browse view" do
crumbs.trail_from_referer
expect(crumbs.trail.first).to eql([I18n.t('sufia.dashboard.title'), sufia.dashboard_index_path])
expect(crumbs.trail[1]).to eql([I18n.t('sufia.dashboard.my.works'), sufia.dashboard_works_path])
Expand Down
6 changes: 3 additions & 3 deletions spec/support/locations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ def go_to_dashboard
expect(page).to have_content('My Dashboard')
end

def go_to_dashboard_files
visit '/dashboard/files'
expect(page).to have_selector('li.active', text: "My Files")
def go_to_dashboard_works
visit '/dashboard/works'
expect(page).to have_selector('li.active', text: "My Works")
end

def go_to_dashboard_collections
Expand Down

0 comments on commit cb08e30

Please sign in to comment.