Class: Moirai::TranslationFilesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Moirai::TranslationFilesController
- Defined in:
- app/controllers/moirai/translation_files_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create_or_update ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/controllers/moirai/translation_files_controller.rb', line 22 def create_or_update if (translation = Translation.find_by(key: translation_params[:key], locale: translation_params[:locale])) handle_update(translation) else handle_create end end |
#index ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/moirai/translation_files_controller.rb', line 6 def index @files = @file_handler.file_paths.map do |path| { id: Digest::SHA256.hexdigest(path), name: File.basename(path), path: path } end end |
#open_pr ⇒ Object
30 31 32 33 34 35 |
# File 'app/controllers/moirai/translation_files_controller.rb', line 30 def open_pr flash.notice = "I created an amazing Pull Request" changes = Moirai::TranslationDumper.new.call Moirai::PullRequestCreator.new.create_pull_request(changes) redirect_back_or_to(root_path) end |
#show ⇒ Object
16 17 18 19 20 |
# File 'app/controllers/moirai/translation_files_controller.rb', line 16 def show @translation_keys = @file_handler.parse_file(@file_path) @locale = @file_handler.get_first_key(@file_path) @translations = Moirai::Translation.by_file_path(@file_path) end |