diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 15 | ||||
-rw-r--r-- | app/views/admin_public_body/_form.rhtml | 10 | ||||
-rw-r--r-- | app/views/general/_frontpage_intro_sentence.rhtml | 5 | ||||
-rw-r--r-- | app/views/general/frontpage.rhtml | 34 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 3 |
5 files changed, 44 insertions, 23 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ec56566a9..d12238582 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -94,5 +94,20 @@ module ApplicationHelper block.call end end + # (unfortunately) ugly way of getting id of generated form element + # ids + # see http://chrisblunt.com/2009/10/12/rails-getting-the-id-of-form-fields-inside-a-fields_for-block/ + def sanitized_object_name(object_name) + object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") + end + + def sanitized_method_name(method_name) + method_name.sub(/\?$/, "") + end + + def form_tag_id(object_name, method_name) + return "#{sanitized_object_name(object_name.to_s)}_#{sanitized_method_name(method_name.to_s)}" + end + end diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml index 191b29e89..dc7732fc1 100644 --- a/app/views/admin_public_body/_form.rhtml +++ b/app/views/admin_public_body/_form.rhtml @@ -27,19 +27,19 @@ <%= t.hidden_field :locale, :value => locale.to_s %> <p><label for="public_body_name">Name</label><br/> - <%= t.text_field :name, :size => 60 %></p> + <%= t.text_field :name, :size => 60, :id => form_tag_id(t.object_name, :name) %></p> <p><label for="public_body_short_name">Short name <small>(only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL - don't worry about breaking URLs through renaming, as the history is used to redirect)</small></label><br/> - <%= t.text_field :short_name, :size => 60 %></p> + <%= t.text_field :short_name, :size => 60, :id => form_tag_id(t.object_name, :short_name) %></p> <p><label for="public_body_request_email">Request email <small>(set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA)</small></label><br/> - <%= t.text_field :request_email, :size => 40 %></p> + <%= t.text_field :request_email, :size => 40, :id => form_tag_id(t.object_name, :request_email) %></p> <p><label for="public_body_publication_scheme">Publication scheme URL</label><br/> - <%= t.text_field :publication_scheme, :size => 60 %></p> + <%= t.text_field :publication_scheme, :size => 60, :id => form_tag_id(t.object_name, :publication_scheme) %></p> <p><label for="public_body_notes">Public notes</label> <small>(HTML, for users to consider when making FOI requests to the authority)</small><br/> - <%= t.text_area :notes, :rows => 3, :cols => 60 %></p> + <%= t.text_area :notes, :rows => 3, :cols => 60, :id => form_tag_id(t.object_name, :notes) %></p> </div> <% end diff --git a/app/views/general/_frontpage_intro_sentence.rhtml b/app/views/general/_frontpage_intro_sentence.rhtml index 8ef69897c..70b47ad06 100644 --- a/app/views/general/_frontpage_intro_sentence.rhtml +++ b/app/views/general/_frontpage_intro_sentence.rhtml @@ -1 +1,4 @@ -Every citizen has the right to access information held by public authorities. <strong>By law, they have to respond</strong>. <a href="<%= help_about_url %>">Find out more about freedom of information.</a> +<h2> + Your <strong>Right to Know</strong> +</h2> +<p>Every citizen has the right to access information held by public authorities. <strong>By law, they have to respond</strong>. <a href="<%= help_about_url %>">Find out more about freedom of information.</a></p> diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml index 60bed18a4..ecb5720c2 100644 --- a/app/views/general/frontpage.rhtml +++ b/app/views/general/frontpage.rhtml @@ -2,31 +2,31 @@ <div id="frontpage_splash"> <div id="left_column"> <h1> - Make a new<br/> + <%= _("Make a new<br/> <strong>Freedom <span>of</span><br/> Information<br/> - request</strong> + request</strong>") %> </h1> - <a class="link_button_green_large" href="/en/new/tgq">Start now »</a> + <a class="link_button_green_large" href="/en/new/tgq"><%= _("Start now »") %></a> </div> <div id="right_column"> <div id="frontpage_search_box"> <h2> - Search over</br> - <strong><%= InfoRequest.count %> requests</strong> <span>and</span><br/> - <strong><%= PublicBody.count %> authorities</strong> + <%= _("Search over<br/> + <strong>{{number_of_requests}} requests</strong> <span>and</span><br/> + <strong>{{number_of_authorities}} authorities</strong>", + :number_of_requests => InfoRequest.count, :number_of_authorities => PublicBody.count) %> </h2> <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %> + <div> <%= text_field_tag 'query', params[:query], { :size => 30 } %> <%= hidden_field_tag 'bodies', 1 %> - <%= submit_tag 'Search' %> + <%= submit_tag _('Search') %> + </div> <% end %> </div> <div id="frontpage_right_to_know"> - <h2> - Your <strong>Right to Know</strong> - </h2> - <p><%= render :partial => 'frontpage_intro_sentence' %></p> + <%= render :partial => 'frontpage_intro_sentence' %> </div> </div> <div style="clear:both"></div> @@ -35,8 +35,9 @@ <div id="frontpage_examples"> <% if @popular_bodies.size > 0 %> <div id="examples_0"> - <h3>Who has the information?</h3> - <%= site_name %> covers requests to <%= PublicBody.count %> authorities, including: + <h3><%= _("Who can I request information from?") %></h3> + <%= _("{{site_name}} covers requests to {{number_of_authorities}} authorities, including:", + :site_name => site_name, :number_of_authorities => PublicBody.count) %> <ul> <% for popular_body in @popular_bodies %> <li><%=public_body_link(popular_body)%> @@ -51,13 +52,14 @@ <% end %> <div id="examples_1"> - <h3>What are people asking?</h3> - <%= site_name %> users have asked <%= InfoRequest.count %> questions. + <h3><%= _("What information has been released?") %></h3> + <%= _("{{site_name}} users have made {{number_of_requests}} requests:", + :site_name => site_name, :number_of_requests => InfoRequest.count) %> <ul> <% for event in @successful_request_events %> <li> - <%= public_body_link(event.info_request.public_body) %> answered a question about + <%= public_body_link(event.info_request.public_body) %> answered a request about <%=link_to h(event.info_request.title), request_url(event.info_request)%> <%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(event.described_at)) %> <p class="excerpt" onclick="document.location.href='<%=request_url(event.info_request)%>'"><%= excerpt(event.info_request.title, "", 200) %></p> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index f365134e5..e21553d0e 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -125,7 +125,7 @@ <div id="footer"> <%= link_to _("Contact {{site_name}}", :site_name => site_name), help_contact_url %> - | <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="http://www.twitter.com/<%= MySociety::Config.get('TWITTER_USERNAME') %>">Follow us on twitter</a> + | <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="http://www.twitter.com/<%= MySociety::Config.get('TWITTER_USERNAME') %>"><%= _("Follow us on twitter") %></a> <%= render :partial => 'general/credits' %> </div> <div class="after-footer"> </div> @@ -134,3 +134,4 @@ </div> </body> </html> + |