Sha256: 9bc578f68aa742e33bdd1459bb9a02e9c2793fc81a5189f5ad91e931f2eb5773
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
# Ajax action for Languages Controller class ExpressTranslate::Ajax::LanguagesController < ActionController::Base # Include and require Libraries require 'redis' require 'json' require 'csv' include ExpressTranslate # Add language # Load html content when add Language def language_add load_content_language(params, Language.add(params)) end # Update language # Load html content when update Language def language_update load_content_language(params, Language.update_by_id_packages(params[:old_id], params[:packages], params)) end # Delete language # Load html content when delete Language def language_delete load_content_language(params, Language.delete_by_id_packages(params[:id], params[:packages])) end # Set origin language # Load html content when set origin Language for package def language_set_origin load_content_language(params, Language.set_origin(params[:id], params[:packages])) end private # Load language html content # The firstly: check status for action add, update, delete and set origin language # get origin language for know max count => percent complete # get max number language origin # render to html content def load_content_language(params, check) if check['success'] == true @selects = YAML.load_file("#{ExpressTranslate.root}/config/languages.yml") @origin = Language.get_origin(params[:packages]) @origin_keys = [] LanguageDetail.info(@origin).all.each do |item| @origin_keys.push(item["code"]) end @languages = Package.find(params[:packages])['language'] @max = @origin.nil? ? 1 : LanguageDetail.info(@origin).all.count @LanguageDetail = LanguageDetail @Package = Package render :action => :language_update return end render :json => check end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
express_translate-1.0.8 | app/controllers/express_translate/ajax/languages_controller.rb |
express_translate-1.0.7 | app/controllers/express_translate/ajax/languages_controller.rb |