From f2467bbf426e7163521891dbc888fbf0dec46aaa Mon Sep 17 00:00:00 2001 From: Didier Lafforgue Date: Tue, 7 Feb 2012 01:29:33 +0100 Subject: [PATCH] ask for default site locale when creating the first site --- .../locomotive/installation_controller.rb | 2 +- app/helpers/locomotive/sites_helper.rb | 6 ++++++ app/views/locomotive/installation/step_2.html.haml | 14 ++++---------- config/locales/admin_ui.en.yml | 5 +++-- doc/TODO | 1 + 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/controllers/locomotive/installation_controller.rb b/app/controllers/locomotive/installation_controller.rb index a516940d..fa1348f9 100644 --- a/app/controllers/locomotive/installation_controller.rb +++ b/app/controllers/locomotive/installation_controller.rb @@ -7,7 +7,7 @@ module Locomotive before_filter :allow_installation? - helper Locomotive::BaseHelper + helper Locomotive::BaseHelper, Locomotive::SitesHelper def show request.get? ? self.handle_get : self.handle_post diff --git a/app/helpers/locomotive/sites_helper.rb b/app/helpers/locomotive/sites_helper.rb index 70dd1e3b..e2f92b12 100644 --- a/app/helpers/locomotive/sites_helper.rb +++ b/app/helpers/locomotive/sites_helper.rb @@ -5,5 +5,11 @@ module Locomotive current_site.locales + (Locomotive.config.site_locales - current_site.locales) end + def options_for_site_locales + Locomotive.config.site_locales.map do |locale| + [I18n.t("locomotive.locales.#{locale}"), locale] + end + end + end end \ No newline at end of file diff --git a/app/views/locomotive/installation/step_2.html.haml b/app/views/locomotive/installation/step_2.html.haml index 0e7a6a41..5fc6e5e4 100644 --- a/app/views/locomotive/installation/step_2.html.haml +++ b/app/views/locomotive/installation/step_2.html.haml @@ -15,16 +15,10 @@ - if multi_sites? = f.input :subdomain, :required => true - - if Locomotive.default_site_template_present? - %li{ :class => 'question', :id => 'default_site_template_input' } - = check_box_tag 'default_site_template', '1', params[:default_site_template].blank? || params[:default_site_template] == '1' - %label{ :for => 'default_site_template' }!= t('formtastic.labels.import.new.default_site_template') - - %li{ :class => 'string optional', :id => 'zipfile_input', :style => "#{'display: none' if Locomotive.default_site_template_present?}" } - %label{ :for => 'zipfile' }= t('formtastic.labels.import.new.source') - = file_field_tag 'zipfile' - - if Locomotive.default_site_template_present? - %p.inline-hints!= t('.back_to_default_template') + %li{ :class => 'select optional', :id => 'default_site_locale' } + %label{ :for => 'default_site_locale_input' }= t('.default_site_locale') + = select_tag 'site[locales][]', options_for_select(options_for_site_locales, @site.default_locale), :id => 'default_site_locale_input' + %p.inline-hints!= t('.default_site_locales_hints') .footer = submit_tag t('.next') \ No newline at end of file diff --git a/config/locales/admin_ui.en.yml b/config/locales/admin_ui.en.yml index 675fa91d..e3cade3c 100644 --- a/config/locales/admin_ui.en.yml +++ b/config/locales/admin_ui.en.yml @@ -287,8 +287,9 @@ en: next: Create account step_2: title: "Step 2/2 — Create your first site" - explanations: "If you already uploaded the default site template (see instructions), you can use it right away. Or you can upload a site template as a zip file (free available templates here)." - back_to_default_template: "Click here to select the default site template instead" + explanations: "You are almost done. Please give a name to your first site and pick up the default locale." + default_site_locale: Site locale + default_site_locales_hints: You can add more locales in the Settings panel later. next: Create site public: diff --git a/doc/TODO b/doc/TODO index 5ea0bd0d..bdc3f52b 100644 --- a/doc/TODO +++ b/doc/TODO @@ -126,6 +126,7 @@ x missing custom_fields - display by categories does not work when localized - disallow to click twice on the submit form button (spinner ?) - message to notify people if their browser is too old + - weird behaviour when changing the default locale of a site ? install a site by default at the first installation (without asking)