Sha256: d26e1fb6a0277c992d748f60cc21c4e75930a4ee3f4e583c9792c9afeb0ac508
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
module Admin class TranslationsController < ApplicationController respond_to :html, :json layout "admin" before_filter :authenticate_user! access_control do allow :admin end def index @pending_translations = Translation.pending.group_by{|t| t.locale } @all_translations = Translation.not_pending.group_by{|t| t.locale } end def new if params[:type] && params[:type] == "pending" @translations = Translation.search_query(params[:query]).pending.where(:locale => params[:language]).page(params[:page]).per(10) else @translations = Translation.search_query(params[:query]).not_pending.where(:locale => params[:language]).page(params[:page]).per(10) end end def create params[:translations].values.each do |record| logger.debug("DESTROY : #{record[:destroy]}") destroy_record = record.delete(:destroy) if destroy_record == "false" record_id = record.delete(:id) translation = Translation.find(record_id) logger.debug("TRANSLATION : #{translation.inspect}") logger.debug("RECORD : #{record.inspect}") translation.update_attributes(record) end end redirect_to admin_translations_path, :notice => t('translations.notice.translation_added') end def destroy @translation = Translation.find(params[:id]) @translation.destroy respond_with(@translation) do |format| format.html { redirect_to new_admin_translation_path(:type => params[:type], :language => params[:language]) } format.js end end def dump Translation.dump_all redirect_to admin_translations_path, :notice => t('translations.notice.dumped') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
merrycms-0.1.0 | app/controllers/admin/translations_controller.rb |