Skip to content

Commit

Permalink
Put homepage text into i18n
Browse files Browse the repository at this point in the history
Changed "File Details" to "Details"
Fixes #1421
  • Loading branch information
jcoyne committed Dec 10, 2015
1 parent e619ace commit 6afea54
Show file tree
Hide file tree
Showing 27 changed files with 49 additions and 52 deletions.
@@ -1,4 +1,4 @@
module Sufia::HomepageController
module Sufia::HomepageControllerBehavior
extend ActiveSupport::Concern

included do
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/homepage_controller.rb

This file was deleted.

3 changes: 3 additions & 0 deletions app/controllers/sufia/homepage_controller.rb
@@ -0,0 +1,3 @@
class Sufia::HomepageController < ApplicationController
include Sufia::HomepageControllerBehavior
end
3 changes: 2 additions & 1 deletion app/helpers/sufia/sufia_helper_behavior.rb
Expand Up @@ -47,7 +47,8 @@ def number_of_deposits(user)
end

def link_to_facet(field, field_string)
link_to(field, add_facet_params(field_string, field).merge!(controller: "catalog", action: "index"))
facet_params = add_facet_params(field_string, field)
link_to(field, catalog_index_path(facet_params))
end

# @param values [Array] The values to display
Expand Down
18 changes: 0 additions & 18 deletions app/views/homepage/_recents.html.erb

This file was deleted.

File renamed without changes.
File renamed without changes.
Expand Up @@ -6,14 +6,14 @@
<div class="panel-group dd" id="dd">
<ol id="featured_works">
<%= f.fields_for :featured_works do |featured| %>
<%= render partial: 'homepage/sortable_featured', locals: {f: featured} %>
<%= render 'sortable_featured', f: featured %>
<% end %>
</ol>
</div>
<%= f.submit("Save order", class: 'btn btn-default') %>
<% end %>
<% else %>
<ol id="featured_works">
<%= render partial: 'homepage/featured', collection: @featured_work_list.featured_works %>
<%= render partial: 'featured', collection: @featured_work_list.featured_works %>
</ol>
<% end %>
File renamed without changes.
@@ -1,14 +1,14 @@
<div class="col-xs-12 col-sm-6">
<ul id="homeTabs" class="nav nav-tabs">
<li><a href="#featured_container" data-toggle="tab" role="tab" id="featureTab"><%= t('sufia.homepage.featured_works.tab_label') %></a></li>
<li><a href="#recently_uploaded" data-toggle="tab" role="tab" id="recentTab"><%= t('sufia.homepage.recently_uploaded') %></a></li>
<li><a href="#recently_uploaded" data-toggle="tab" role="tab" id="recentTab"><%= t('sufia.homepage.recently_uploaded.tab_label') %></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in" id="featured_container" role="tabpanel" aria-labelledby="featureTab">
<%= render partial: '/homepage/featured_works' %>
<%= render 'featured_works' %>
</div>
<div class="tab-pane fade" id="recently_uploaded" role="tabpanel" aria-labelledby="recentTab">
<%= render partial: 'recents', locals: { recent_documents: @recent_documents, msg: t('sufia.homepage.no_public'), display_thumbs: true, display_access: false } %>
<%= render 'recently_uploaded', recent_documents: @recent_documents %>
</div>
</div>
</div><!-- /.col-xs-6 -->
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,18 +1,13 @@
<tr>
<% if display_thumbs %>
<td class="col-sm-2">
<%= link_to_profile recent_document.depositor("no depositor value") %>
<%= link_to curation_concerns_generic_work_path(recent_document) do %>
<%= render_thumbnail_tag recent_document, { width: 45 }, false %>
<% end %>
</td>
<% end %>
<td class="col-sm-2">
<%= link_to_profile recent_document.depositor("no depositor value") %>
<%= link_to curation_concerns_generic_work_path(recent_document) do %>
<%= render_thumbnail_tag recent_document, { width: 45 }, false %>
<% end %>
</td>
<td>
<h3>
<span class="sr-only">Title</span><%= link_to truncate(recent_document.title_or_label, length: 28, separator: ' '), curation_concerns_file_set_path(recent_document) %>
<% if display_access %>
<%= render_visibility_label(recent_document) %>
<% end %>
</h3>
<p>
<span class="sr-only">Filename</span><%= link_to truncate(recent_document.label, length: 25),
Expand Down
16 changes: 16 additions & 0 deletions app/views/sufia/homepage/_recently_uploaded.html.erb
@@ -0,0 +1,16 @@
<div>
<% if recent_documents.blank? %>
<h3><%= t('.no_public') %></h3>
<% else %>
<div id="recent_docs">
<table class="table table-bordered table-striped">
<tr>
<th scope="col"><%= t('.depositor') %></th>
<th scope="col"><%= t('.details') %></th>
</tr>
<%= render partial: "recent_document", collection: recent_documents %>
</table>
</div>
<% end %>

</div>
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions config/locales/sufia.en.yml
Expand Up @@ -64,10 +64,13 @@ en:
tab_label: 'Featured Works'
title: 'Featured Works'
no_works: 'No works have been featured'
recently_uploaded: 'Recently Uploaded'
recently_uploaded:
depositor: 'Depositor'
details: 'Details'
tab_label: 'Recently Uploaded'
no_public: 'No public work has been contributed.'
explore: 'Explore'
sr_explore: 'Popular Keywords'
no_public: 'No public work has been contributed.'
dashboard:
title: "My Dashboard"
greeting: "Hello, "
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Expand Up @@ -3,7 +3,7 @@
resources :homepage, only: 'index'

# Route the home page as the root
root to: 'homepage#index'
root to: 'sufia/homepage#index'

match 'batch_edits/clear' => 'batch_edits#clear', as: :batch_edits_clear, via: [:get, :post]

Expand Down
6 changes: 3 additions & 3 deletions lib/generators/sufia/install_generator.rb
Expand Up @@ -84,9 +84,9 @@ def inject_routes
gsub_file 'config/routes.rb', /('welcome#index')/, '\1, as: :welcome_root' # Name welcome root to from CurationConcerns

routing_code = "\n Hydra::BatchEdit.add_routes(self)\n" \
" # This must be the very last route in the file because it has a catch-all route for 404 errors.
# This behavior seems to show up only in production mode.
mount Sufia::Engine => '/'\n root to: 'homepage#index'\n"
" # This must be the very last route in the file because it has a catch-all route for 404 errors.\n" \
" # This behavior seems to show up only in production mode.\n" \
" mount Sufia::Engine => '/'\n"

sentinel = /devise_for :users/
inject_into_file 'config/routes.rb', routing_code, after: sentinel, verbose: false
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/homepage_controller_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'

describe HomepageController, type: :controller do
routes { Rails.application.class.routes }
describe Sufia::HomepageController, type: :controller do
routes { Sufia::Engine.routes }

describe "#index" do
let(:user) { create(:user) }
Expand Down
2 changes: 1 addition & 1 deletion spec/routing/route_spec.rb
Expand Up @@ -5,7 +5,7 @@

describe 'Homepage' do
it 'routes the root url to the homepage controller' do
expect(get: '/').to route_to(controller: 'homepage', action: 'index')
expect(get: '/').to route_to(controller: 'sufia/homepage', action: 'index')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/views/homepage/_announcement.html.erb_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

describe "homepage/_announcement.html.erb" do
describe "sufia/homepage/_announcement.html.erb" do
let(:groups) { [] }
let(:ability) { instance_double("Ability") }
let(:announcement) { ContentBlock.new(name: ContentBlock::ANNOUNCEMENT, value: announcement_value) }
Expand Down
2 changes: 1 addition & 1 deletion spec/views/homepage/_featured_works.html.erb_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

describe "homepage/_featured_works.html.erb" do
describe "sufia/homepage/_featured_works.html.erb" do
let(:list) { FeaturedWorkList.new }
subject { rendered }
before { assign(:featured_work_list, list) }
Expand Down
4 changes: 2 additions & 2 deletions spec/views/homepage/_home_header.html.erb_spec.rb
@@ -1,13 +1,13 @@
require 'spec_helper'

describe "homepage/_home_header.html.erb" do
describe "sufia/homepage/_home_header.html.erb" do
let(:groups) { [] }
let(:ability) { instance_double("Ability") }
describe "share your work button" do
before do
allow(controller).to receive(:current_ability).and_return(ability)
allow(ability).to receive(:can?).with(:view_share_work, FileSet).and_return(can_view_share_work)
stub_template "homepage/_marketing.html.erb" => "marketing"
stub_template "sufia/homepage/_marketing.html.erb" => "marketing"
render
end
context "when the user can view" do
Expand Down

0 comments on commit 6afea54

Please sign in to comment.