/
show.html.erb
58 lines (53 loc) · 2.69 KB
/
show.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<% content_for :locale do %>
<span class="locale"><%= @locale.language_name %></span>
<% end %>
<% content_for :head do %>
<link rel="alternate" type="application/rss+xml" title="RSS" href="<%= tolk.locale_path(@locale, :format => 'atom') -%>" />
<% end %>
<h3 class="switch">Phrases missing translation (<%= @locale.count_phrases_without_translation %>) <span>(<%= link_to 'See completed translations', tolk.all_locale_path(@locale) %>)</span></h3>
<% if @locale.has_updated_translations? && action_name != 'updated' %>
<span class="notice">Some phrases have changed. <%= link_to "Update translations", tolk.updated_locale_path(@locale) %>.</span>
<% end %>
<div class="search">
<%= render :partial => "tolk/searches/form", :locals => { :locale => @locale } %>
</div>
<div class="translations">
<% if @phrases.any? %>
<%= form_for @locale do |locale_form| %>
<table class="translations">
<tr>
<th class="translation"><%= @locale.language_name -%></th>
<th class="key"><%= Tolk::Locale.primary_language_name -%></th>
</tr>
<% @phrases.each do |phrase| %>
<tr>
<% translation = Tolk::Translation.new(:locale => @locale, :phrase => phrase) %>
<td class="translation">
<%= hidden_field_tag :"translations[][id]", translation.id, :id => "#{translation.object_id}_id" %>
<%= hidden_field_tag :"translations[][phrase_id]", phrase.id, :id => "#{translation.object_id}_phrase_id" %>
<%= hidden_field_tag :"translations[][locale_id]", translation.locale_id, :id => "#{translation.object_id}_locale_id" %>
<%= text_area_tag :"translations[][text]", format_i18n_text_area_value(translation.text), :class => "locale", :id => "#{translation.object_id}_text", :onfocus => "$(this).up('tr').addClassName('active');", :onblur => "$(this).up('tr').removeClassName('active');" %>
</td>
<td class="phrase">
<% if params[:q].present? -%>
<%= highlight(format_i18n_value(phrase.translations.primary.text), params[:q]) -%>
<% else -%>
<%= format_i18n_value(phrase.translations.primary.text) -%>
<% end -%>
<span class="key" title="<%= phrase.key %>"><%= truncate(phrase.key, :length => 100) %></span>
</td>
</tr>
<% end %>
</table>
<div class="table_submit">
<p><%= locale_form.submit "Save changes" %></p>
</div>
<% end %>
<div class="paginate">
<%= paginate @phrases %>
</div>
<% else %>
<p style="text-align: left">There aren't any missing or updated phrases that need translation.</p>
<p> </p>
<% end %>
</div>