Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

shared locale_picker partial tpl #1936

Merged
merged 1 commit into from

3 participants

@keram

Locale picker is used in many engines so it can be shared.
m.

@parndt
Owner

@robyurkowski @ugisozols what do you think?

@keram

For more explanation, this can help prevent bugs like here refinery/refinerycms-blog#284

@ugisozols
Owner

I'm :+1: for this.

@ugisozols ugisozols merged commit 0a82ec5 into from
@tsemana tsemana referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@keram keram referenced this pull request in refinery/refinerycms-blog
Closed

use global locale picker and fix bugs .) #284

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 10, 2012
  1. @keram
This page is out of date. Refresh to see the latest.
View
11 core/app/views/refinery/admin/_locale_picker.html.erb
@@ -0,0 +1,11 @@
+<input type="hidden" name="switch_locale" id="switch_locale" value="<%= local_assigns[:current_locale] %>" />
+<% if (locales ||= Refinery::I18n.frontend_locales).present? and locales.many? %>
+ <ul id="switch_locale_picker" class="clearfix">
+ <% locales.each do |locale| %>
+ <li<%= %Q{ class=selected} if locale.to_s == local_assigns[:current_locale].to_s %>>
+ <%= link_to refinery_icon_tag(%Q{flags/#{locale}.png}, :size => '32x22'),
+ refinery.url_for(:switch_locale => locale) %>
+ </li>
+ <% end %>
+ </ul>
+<% end %>
View
5 core/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb
@@ -8,9 +8,8 @@
:include_object_name => true %>
<% if localized? -%>
- <%%= render "locale_picker",
- :current_locale => Globalize.locale if Refinery.i18n_enabled? -%>
-
+ <%%= render '/refinery/admin/locale_picker',
+ :current_locale => Globalize.locale if Refinery.i18n_enabled? %>
<% end -%>
<% attributes.each_with_index do |attribute, index| -%>
<% if attribute.type.to_s == 'image' -%>
View
1  core/spec/lib/generators/refinery/engine/engine_generator_with_i18n_spec.rb
@@ -41,7 +41,6 @@ module Refinery
directory "admin" do
directory "rspec_product_tests" do
file "_form.html.erb"
- file "_locale_picker.html.erb"
file "_sortable_list.html.erb"
file "edit.html.erb"
file "index.html.erb"
View
2  pages/app/views/refinery/admin/pages/_form.html.erb
@@ -3,7 +3,7 @@
<%= render '/refinery/admin/error_messages', :object => @page, :include_object_name => true %>
- <%= render 'locale_picker', :current_locale => Globalize.locale if Refinery.i18n_enabled? %>
+ <%= render '/refinery/admin/locale_picker', :current_locale => Globalize.locale if Refinery.i18n_enabled? %>
<div class="field">
<%= f.label :title %>
View
11 pages/app/views/refinery/admin/pages/_locale_picker.html.erb
@@ -1,11 +0,0 @@
-<input type='hidden' name='switch_locale' id='switch_locale' value='<%= local_assigns[:current_locale] %>' />
-<% if (locales ||= (Refinery::I18n.frontend_locales if Refinery.i18n_enabled?)).present? && locales.many? %>
- <ul id='switch_locale_picker' class='clearfix'>
- <% locales.each do |locale| %>
- <li<%= " class='selected'".html_safe if locale.to_s == local_assigns[:current_locale].to_s %>>
- <%= link_to refinery_icon_tag("flags/#{locale}.png", :size => "32x22"),
- refinery.url_for(:switch_locale => locale) %>
- </li>
- <% end %>
- </ul>
-<% end %>
Something went wrong with that request. Please try again.