Skip to content

Commit

Permalink
Renaming My::Files to My::Works
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed Dec 10, 2015
1 parent f448e99 commit c540e2a
Show file tree
Hide file tree
Showing 33 changed files with 69 additions and 69 deletions.
6 changes: 3 additions & 3 deletions app/controllers/concerns/sufia/breadcrumbs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def trail_from_referer

def add_breadcrumb_for_controller
case controller_name
when 'file_sets'.freeze, 'my/files'.freeze, 'batch_edits'.freeze
add_breadcrumb I18n.t('sufia.dashboard.my.files'), sufia.dashboard_files_path
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.files'), sufia.dashboard_files_path
add_breadcrumb I18n.t('sufia.dashboard.my.works'), sufia.dashboard_works_path
when 'my/collections'.freeze
add_breadcrumb I18n.t('sufia.dashboard.my.collections'), sufia.dashboard_collections_path
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def upload_complete_path(upload_set_id)
end

def destroy_complete_path(_params)
Sufia::Engine.routes.url_helpers.dashboard_files_path
Sufia::Engine.routes.url_helpers.dashboard_works_path
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def redirect_after_update
if uploading_on_behalf_of? @upload_set
redirect_to sufia.dashboard_shares_path
else
redirect_to sufia.dashboard_files_path
redirect_to sufia.dashboard_works_path
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module My
class FilesController < MyController
class WorksController < MyController
self.search_params_logic += [
:show_only_resources_deposited_by_current_user,
:show_only_generic_works
]

def index
super
@selected_tab = :files
@selected_tab = :works
end

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
8 changes: 4 additions & 4 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,16 +145,16 @@ def collection_thumbnail(_document, _image_options = {}, _url_options = {})

def search_action_for_dashboard
case params[:controller]
when "my/files"
sufia.dashboard_files_path
when "my/works"
sufia.dashboard_works_path
when "my/collections"
sufia.dashboard_collections_path
when "my/shares"
sufia.dashboard_shares_path
when "my/highlights"
sufia.dashboard_highlights_path
else
sufia.dashboard_files_path
sufia.dashboard_works_path
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/catalog/_search_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<% if current_user %>
<li>
<%= link_to t("sufia.search.form.option.my_works.label_long"), "#",
data: { "search-option" => sufia.dashboard_files_path, "search-label" => t("sufia.search.form.option.my_works.label_short") } %>
data: { "search-option" => sufia.dashboard_works_path, "search-label" => t("sufia.search.form.option.my_works.label_short") } %>
</li>
<li>
<%= link_to t("sufia.search.form.option.my_collections.label_long"), "#",
Expand Down
2 changes: 1 addition & 1 deletion app/views/collections/_edit_actions.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2 class="sr-only">Actions</h2>
<div class="actions-controls-collections">
<span class="label label-default"><%= link_to "Browse", collections.collection_path %></span> &nbsp;&nbsp;
<span class="label label-default"><%= link_to "Add files", sufia.dashboard_files_path %></span>
<span class="label label-default"><%= link_to "Add files", sufia.dashboard_works_path %></span>
</div>
2 changes: 1 addition & 1 deletion app/views/collections/_show_actions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<div class="actions-controls-collections">
<% if can? :edit, @presenter.solr_document %>
<span class="label label-default"><%= link_to "Edit", collections.edit_collection_path, title: "Edit this Collection" %></span> &nbsp;&nbsp;
<span class="label label-default"><%= link_to "Add files", sufia.dashboard_files_path(add_files_to_collection: @presenter.id), title: "Add files to this Collection" %></span>
<span class="label label-default"><%= link_to "Add files", sufia.dashboard_works_path(add_files_to_collection: @presenter.id), title: "Add files to this Collection" %></span>
<%end %>
</div>
2 changes: 1 addition & 1 deletion app/views/collections/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<% end %>

<div style="float: right">
<%= link_to t('sufia.collection.select_works'), sufia.dashboard_files_path %> | <%= link_to t('sufia.collection.add_work'), new_curation_concerns_generic_work_path %>
<%= link_to t('sufia.collection.select_works'), sufia.dashboard_works_path %> | <%= link_to t('sufia.collection.add_work'), new_curation_concerns_generic_work_path %>
</div>
<div class="row">
<div class="col-xs-12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<% end %>
</div>
<div class="col-xs-6 col-sm-2 heading-tile">
<%= link_to sufia.dashboard_files_path do %>
<%= link_to sufia.dashboard_works_path do %>
<span class="glyphicon glyphicon-eye-open"></span>
<%= t("sufia.dashboard.view_works") %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/dashboard/_index_partials/_transfers.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h4>Sent</h4>
</div>
<div class="col-xs-12 col-sm-3 transfer_link">
<%= link_to sufia.dashboard_files_path do %>
<%= link_to sufia.dashboard_works_path do %>
<%= t("sufia.dashboard.transfer_files_link") %>
<% end %>
</div>
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
4 changes: 2 additions & 2 deletions app/views/my/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<h1 class="sr-only">My Works, 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 %>">
<%= link_to t('sufia.dashboard.my.files'), sufia.dashboard_files_path %>
<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 %>">
<%= link_to t('sufia.dashboard.my.collections'), sufia.dashboard_collections_path %>
Expand Down
2 changes: 1 addition & 1 deletion config/locales/sufia.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ en:
following: "People you follow"
followers: "People who are following you"
my:
files: "My Works"
works: "My Works"
collections: "My Collections"
highlights: "My Highlights"
shares: "Files Shared with Me"
Expand Down
8 changes: 4 additions & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@
end
end

# Routes for user's files, collections, highlights and shares
# Routes for user's works, collections, highlights and shares
# Preserves existing behavior by maintaining paths to /dashboard
# Routes actions to the various My controllers
scope :dashboard do
get '/files', controller: 'my/files', action: :index, as: 'dashboard_files'
get '/files/page/:page', controller: 'my/files', action: :index
get '/files/facet/:id', controller: 'my/files', action: :facet, as: 'dashboard_files_facet'
get '/works', controller: 'my/works', action: :index, as: 'dashboard_works'
get '/works/page/:page', controller: 'my/works', action: :index
get '/works/facet/:id', controller: 'my/works', action: :facet, as: 'dashboard_works_facet'

get '/collections', controller: 'my/collections', action: :index, as: 'dashboard_collections'
get '/collections/page/:page', controller: 'my/collections', action: :index
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/batch_edits_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

it "sets the breadcrumb trail" do
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.title'), Sufia::Engine.routes.url_helpers.dashboard_index_path)
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.my.files'), Sufia::Engine.routes.url_helpers.dashboard_files_path)
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.my.works'), Sufia::Engine.routes.url_helpers.dashboard_works_path)
get :edit
end
end
Expand All @@ -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
2 changes: 1 addition & 1 deletion spec/controllers/file_sets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
it "sets the breadcrumbs and versions presenter" do
allow(controller.request).to receive(:referer).and_return('foo')
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.title'), Sufia::Engine.routes.url_helpers.dashboard_index_path)
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.my.files'), Sufia::Engine.routes.url_helpers.dashboard_files_path)
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.my.works'), Sufia::Engine.routes.url_helpers.dashboard_works_path)
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.file_set.browse_view'), Rails.application.routes.url_helpers.curation_concerns_file_set_path(file_set))
get :edit, id: file_set

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe My::FilesController, type: :controller do
describe My::WorksController, type: :controller do
let(:user) { create(:user) }

before { sign_in user }
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/stats_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
it 'renders the stats view' do
allow(controller.request).to receive(:referer).and_return('foo')
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.title'), Sufia::Engine.routes.url_helpers.dashboard_index_path)
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.my.files'), Sufia::Engine.routes.url_helpers.dashboard_files_path)
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.dashboard.my.works'), Sufia::Engine.routes.url_helpers.dashboard_works_path)
expect(controller).to receive(:add_breadcrumb).with(I18n.t('sufia.file_set.browse_view'), Rails.application.routes.url_helpers.curation_concerns_file_set_path(file_set))
get :file, id: file_set
expect(response).to be_success
Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/upload_sets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
'open')
post :update, id: upload_set, title: { '1' => 'foo' },
visibility: 'open',
upload_set: { tag: [""] }
expect(response).to redirect_to Sufia::Engine.routes.url_helpers.dashboard_files_path
work: { tag: [""] }
expect(response).to redirect_to Sufia::Engine.routes.url_helpers.dashboard_works_path
expect(flash[:notice]).to include("Your files are being processed")
end
end
Expand All @@ -43,8 +43,8 @@
let!(:work) { create(:work, upload_set: upload_set, user: user) }

it "sets the groups" do
post :update, id: upload_set, upload_set: { "permissions_attributes" => [{ "type" => "group", "name" => "public", "access" => "read" }] }
expect(response).to redirect_to Sufia::Engine.routes.url_helpers.dashboard_files_path
post :update, id: upload_set, "work" => { "permissions_attributes" => [{ "type" => "group", "name" => "public", "access" => "read" }] }
expect(response).to redirect_to Sufia::Engine.routes.url_helpers.dashboard_works_path
work.reload
expect(work.read_groups).to include "public"
end
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
2 changes: 1 addition & 1 deletion spec/helpers/batch_edits_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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
10 changes: 5 additions & 5 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
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 works" do
allow(helper).to receive(:params).and_return(controller: "my/files")
expect(helper).to be_on_my_files
allow(helper).to receive(:params).and_return(controller: "my/works")
expect(helper).to be_on_my_works
end
end

Expand Down
12 changes: 6 additions & 6 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 @@ -102,14 +102,14 @@
context "when the user is on the dashboard page" do
it "defaults to My Works" do
allow(helper).to receive(:params).and_return(controller: "dashboard")
expect(helper.search_form_action).to eq(sufia.dashboard_files_path)
expect(helper.search_form_action).to eq(sufia.dashboard_works_path)
end
end

context "when the user is on the my works page" do
it "returns the my dashboard files path" do
allow(helper).to receive(:params).and_return(controller: "my/files")
expect(helper.search_form_action).to eq(sufia.dashboard_files_path)
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
Loading

0 comments on commit c540e2a

Please sign in to comment.