Class: LesliBabel::TranslationsController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliBabel::TranslationsController
- Defined in:
- app/controllers/lesli_babel/translations_controller.rb
Instance Method Summary collapse
- #clean ⇒ Object
-
#create ⇒ Object
POST /translations.
- #deploy ⇒ Object
-
#destroy ⇒ Object
DELETE /translations/1.
- #download ⇒ Object
-
#edit ⇒ Object
GET /translations/1/edit.
-
#index ⇒ Object
GET /translations.
-
#new ⇒ Object
GET /translations/new.
- #options ⇒ Object
- #renovate ⇒ Object
-
#show ⇒ Object
GET /translations/1.
- #sync ⇒ Object
-
#update ⇒ Object
PATCH/PUT /translations/1.
Instance Method Details
#clean ⇒ Object
87 88 89 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 87 def clean respond_with_successful() end |
#create ⇒ Object
POST /translations
56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 56 def create @translation = Translation.new(translation_params) if @translation.save redirect_to @translation, notice: "Translation was successfully created." else render :new end end |
#deploy ⇒ Object
91 92 93 94 95 96 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 91 def deploy #TranslationsService.clean DeployRailsService.new(current_user, query).build #TranslationsService.restart_server respond_with_successful end |
#destroy ⇒ Object
DELETE /translations/1
76 77 78 79 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 76 def destroy @translation.destroy redirect_to translations_url, notice: "Translation was successfully destroyed." end |
#download ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 110 def download engine = params[:engine] platform = params[:platform] translations_result = TranslationsMiddlemanService.build(engine) if platform == "middleman" translations_result = TranslationsAndroidService.build(engine) if platform == "android" translations_result = TranslationsFlutterService.build(engine) if platform == "flutter" translations_result = TranslationsIosService.build(engine) if platform == "ios" translations_result = TranslationsJsService.build() if platform == "js" return respond_with_error if translations_result.blank? zip_file = "#{platform}-#{engine}-translations.zip" LC::System::IO.zip(zip_file, translations_result.payload) redirect_to "/tmp/#{zip_file}" end |
#edit ⇒ Object
GET /translations/1/edit
52 53 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 52 def edit end |
#index ⇒ Object
GET /translations
38 39 40 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 38 def index #@translations = Translation.all end |
#new ⇒ Object
GET /translations/new
47 48 49 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 47 def new @translation = Translation.new end |
#options ⇒ Object
81 82 83 84 85 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 81 def respond_with_successful({ locales_available: Lesli.config.locales }) end |
#renovate ⇒ Object
98 99 100 101 102 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 98 def renovate result = TranslationsSynchronizationService.remote_sync respond_with_successful if result.success? respond_with_error if not result.success? end |
#show ⇒ Object
GET /translations/1
43 44 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 43 def show end |
#sync ⇒ Object
104 105 106 107 108 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 104 def sync result = TranslationsSynchronizationService.remote_sync true respond_with_successful if result.success? respond_with_error if not result.success? end |
#update ⇒ Object
PATCH/PUT /translations/1
67 68 69 70 71 72 73 |
# File 'app/controllers/lesli_babel/translations_controller.rb', line 67 def update if @translation.update(translation_params) redirect_to @translation, notice: "Translation was successfully updated." else render :edit end end |