Skip to content

Commit

Permalink
Merge pull request #5 from acesuares/master
Browse files Browse the repository at this point in the history
Make it compatible with Ruby 1.8.x. Fix typo
  • Loading branch information
wpiekutowski committed Apr 1, 2012
2 parents 187e136 + 279ccbe commit 0e2b733
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
3 changes: 1 addition & 2 deletions app/controllers/translator/translations_controller.rb
Expand Up @@ -5,8 +5,7 @@ class TranslationsController < ApplicationController
def index
section = params[:key].present? && params[:key] + '.'
params[:group] = "all" unless params["group"]
@sections = Translator.keys_for_strings(:group => params[:group])
.map {|k| k = k.scan(/^[a-z0-9\-_]*\./)[0]; k ? k.gsub('.', '') : false}.select{|k| k}.uniq.sort
@sections = Translator.keys_for_strings(:group => params[:group]).map {|k| k = k.scan(/^[a-z0-9\-_]*\./)[0]; k ? k.gsub('.', '') : false}.select{|k| k}.uniq.sort
@keys = Translator.keys_for_strings(:group => params[:group], :filter => section)
if params[:search]
@keys = @keys.select {|k|
Expand Down
22 changes: 11 additions & 11 deletions app/views/translator/translations/index.html.erb
Expand Up @@ -2,13 +2,13 @@
<div id="header">
<h1>Translations</h1>
<ul id="groups">
<li><%= link_to_unless_current "All", translations_group_path("all"), class: 'button' %></li>
<li><%= link_to_unless_current "Application", translations_group_path("application"), class: 'button' %></li>
<li><%= link_to_unless_current "Framework", translations_group_path("framework"), class: 'button' %></li>
<li><%= link_to_unless_current "Deleted", translations_group_path("deleted"), class: 'button' %></li>
<li><%= link_to_unless_current "All", translations_group_path("all"), :class => 'button' %></li>
<li><%= link_to_unless_current "Application", translations_group_path("application"), :class => 'button' %></li>
<li><%= link_to_unless_current "Framework", translations_group_path("framework"), :class => 'button' %></li>
<li><%= link_to_unless_current "Deleted", translations_group_path("deleted"), :class => 'button' %></li>
</ul>

<%= form_tag translations_group_path(params[:group]), method: "get" do %>
<%= form_tag translations_group_path(params[:group]), :method => "get" do %>
<%= label_tag :key, "Filter: " %>
<%= text_field_tag :search, params[:search], :placeholder => "Search for text..." %>
<%= select_tag :key, options_for_select(@sections.collect {|k| [k.humanize, k]}.unshift(["All sections", nil]), params[:key]) %>
Expand Down Expand Up @@ -36,12 +36,12 @@
</h2>

<% if params[:group] && params[:group] == 'deleted' %>
<%= link_to 'destroy', translation_path(id: key.gsub('.','-')),
remote: true,
method: :delete,
confirm: 'Are you sure? This operation is irreversible.',
class: 'button warning',
title: 'Clear form database as translation no longer exists in default language file.'
<%= link_to 'destroy', translation_path(:id => key.gsub('.','-')),
:remote => true,
:method => :delete,
:confirm => 'Are you sure? This operation is irreversible.',
:class => 'button warning',
:title => 'Clear form database as translation no longer exists in default language file.'
%>
<% end %>
<% Translator.locales.each do |locale| %>
Expand Down

0 comments on commit 0e2b733

Please sign in to comment.