Skip to content

Instantly share code, notes, and snippets.

@cfitz
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfitz/5261622fddbc62e5cbef to your computer and use it in GitHub Desktop.
Save cfitz/5261622fddbc62e5cbef to your computer and use it in GitHub Desktop.
Localization Examples
<%# Add this file to :
plugins/local/public/views/site/_branding.html.erb to override logo in
https://github.com/hudmol/archivesspace/blob/master/public/app/views/site/_branding.html.erb
%>
<h1>
<%= image_tag "#{AppConfig[:frontend_prefix]}assets/cuhk/cuhk_logo.png", :alt => I18n.t("brand.title") %>
</h1>
<%# Add this file to plugins/local/public/views/site/_header.html.erb to override
https://github.com/archivesspace/archivesspace/blob/master/public/app/views/site/_header.html.erb
%>
<%# here we add the custom stylesheet %>
<%= stylesheet_link_tag("#{AppConfig[:frontend_prefix]}assets/cuhk/cuhk.css", :media => "all").html_safe %>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="nav-collapse collapse">
<div class="container top">
<ul class="nav">
<li <% if controller_name === "site" and controller.action_name === "index" %>class="active"<% end %>>
<%= link_to raw('<span class="icon-home"></span>'), :controller => :site, :action => :index %>
</li
<%# here we remove what we don't want in our list %>
<li class="divider-vertical"></li>
<li <% if params["type"]==="resource"%> class="active" <% end%>><%= link_to I18n.t("resource._plural"), {:controller => :search, :action => :search, :type => "resource"} %></li>
<li <% if params["type"]==="digital_object"%> class="active" <% end%>><%= link_to I18n.t("digital_object._plural"), {:controller => :search, :action => :search, :type => "digital_object"} %></li>
<li <% if params["type"]==="subject"%> class="active" <% end%>><%= link_to I18n.t("subject._plural"), {:controller => :search, :action => :search, :type => "subject"} %></li>
<li <% if params["type"]==="agent"%> class="active" <% end%>><%= link_to I18n.t("agent._plural"), {:controller => :search, :action => :search, :type => "agent"} %></li>
<% if not current_page?(root_url) %>
<li class="pull-right">
<%= form_tag(url_for(:controller => :search, :action => :search), :method => :get, :class => "navbar-form pull-left") do %>
<div class="input-append">
<input id="global-search-box" type="text" class="span2" placeholder="<%= I18n.t("navbar.search_placeholder") %>" name="q" value="<%= params[:q] %>"/>
<div class="btn-group">
<button id="global-search-button" class="btn"><span class=" icon-search"></span></button>
<%= link_to "<span class='icon-chevron-down'></span>".html_safe, { :advanced => nil }, { :class => "btn search-switcher last", :style => params["advanced"]?"display:none":"" } %>
<%= link_to "<span class='icon-chevron-up'></span>".html_safe, { :advanced => true }, { :class => "btn search-switcher last", :style => params["advanced"]?"":"display:none" } %>
</div>
</div>
<% end %>
</li>
<% end %>
</ul>
</div>
</div><!-- /.nav-collapse -->
</div>
</div><!-- /navbar-inner -->
</div>
/* add this to
plugins/local/public/assets/cuhk/cuhk.css
*/
body {
background: none;
background-color: red;
}
# this file goes in plugins/local/public/locales/en.yml
en:
brand:
title: CUHK Library Archival Collections
tips:
html: <b>Tips:</b><ol><li>The first bit of help text</li><li>Another list item to help people</li><li>A third tip</li></ol>
<%# This file goes in plugins/local/public/views/site/index.html.erb %>
<%# this is just a copy of the original template from https://github.com/archivesspace/archivesspace/blob/master/public/app/views/site/index.html.erb with one line changed %>
<% set_title I18n.t("brand.home") %>
<br/>
<div class="well">
<div class="row-fluid">
<div class="span8">
<h3><%= I18n.t("brand.welcome_message") %></h3>
<%# below is the added text we want to display %>
<p><%= t("brand.tips.html") %></p>
<div class="tab-content">
<div id="simpleSearch" class="tab-pane active">
<%= render_aspace_partial :partial => "simple_search" %>
</div>
<div id="advancedSearch" class="tab-pane">
<%= render_aspace_partial :partial => "advanced_search" %>
</div>
</div>
<ul class="search-switcher">
<li class="active">
<a href="#simpleSearch" data-toggle="tab"><%= I18n.t("actions.hide_advanced_search") %></a>
</li>
<li>
<a href="#advancedSearch" data-toggle="tab"><%= I18n.t("actions.show_advanced_search") %></a>
</li>
</ul>
</div>
<div class="span4">
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment