Class: Admin::LocatorsController
- Defined in:
- app/controllers/admin/locators_controller.rb
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
7 8 9 |
# File 'app/controllers/admin/locators_controller.rb', line 7 def edit @locale_hash = YAML.load_file(@file) end |
#prepare ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/admin/locators_controller.rb', line 21 def prepare result = Locator.instance.prepare_files if !result flash[:error] = 'Failed to prepare locale files' elsif result[:message] flash[:error] = result[:message] else flash[:notice] = I18n.t('flash.admin.locators.prepared') end redirect_to admin_locators_path end |
#reload ⇒ Object
33 34 35 36 37 38 |
# File 'app/controllers/admin/locators_controller.rb', line 33 def reload I18n.reload! Locator.reload_checker.expire if Locator.respond_to?(:reload_checker) flash[:notice] = I18n.t('flash.admin.locators.restart') redirect_to admin_locators_path end |
#update ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/admin/locators_controller.rb', line 11 def update if Locator.save(@file, {params[:edit_locale_name] => params[:locale_hash]}) flash[:notice] = I18n.t('flash.admin.locators.updated') redirect_to admin_locators_path else flash[:error] = I18n.t('flash.admin.locators.update_error') redirect_to edit_admin_locators_path(filename: params[:filename]) end end |