Class: Vulgata::TranslationStatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Vulgata::TranslationStatesController
- Defined in:
- app/controllers/vulgata/translation_states_controller.rb
Instance Method Summary collapse
-
#edit ⇒ Object
GET /translation_states/1/edit.
-
#index ⇒ Object
GET /translation_states.
-
#proofread ⇒ Object
GET /proofread.
-
#show ⇒ Object
GET /translation_states/1.
-
#update ⇒ Object
PATCH/PUT /translation_states/1.
Methods inherited from ApplicationController
#suggest_translation, #vulgata_current_user, #vulgata_users
Methods included from ControllerConfigurable
#suggest_translation, #vulgata_current_user, #vulgata_users
Methods included from Controller
#authorize_admin, #authorize_admin_or_proofreader, #authorize_admin_proofreader_or_assigned_translator, #authorize_all_role_holders, #layout_by_role, #root_redirect, #set_tranlsation_classes_if_admin, #set_tranlsation_count_if_translator, #set_vulgata_user, #translation_queue_sort
Instance Method Details
#edit ⇒ Object
GET /translation_states/1/edit
37 38 39 |
# File 'app/controllers/vulgata/translation_states_controller.rb', line 37 def edit @translation_state end |
#index ⇒ Object
GET /translation_states
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/vulgata/translation_states_controller.rb', line 13 def index @translation_states = Vulgata::TranslationState.includes(:item).where.not(status: Vulgata::TranslationState.statuses[:source]) @translation_states = case params[:sort] when 'updated_at_desc' then @translation_states.order('updated_at DESC') when 'updated_at_asc' then @translation_states.order('updated_at ASC') when 'priority_desc' then @translation_states.order('priority DESC') when 'priority_asc' then @translation_states.order('priority ASC') else @translation_states.order(translation_queue_sort) end @translation_states = @translation_states.where('status = ?', Vulgata::TranslationState.statuses[params[:status]]) if (params[:status].present? && params[:status] != "all") @translation_states = @translation_states.page(params[:page]).per(10) end |
#proofread ⇒ Object
GET /proofread
55 56 57 58 59 60 61 62 |
# File 'app/controllers/vulgata/translation_states_controller.rb', line 55 def proofread set_user_locales @translation_state = dequeue_translation_state_for_proofreading return if @translation_state.nil? @state_changed_to_proofreading = true set_translation_state_and_source_state end |
#show ⇒ Object
GET /translation_states/1
30 31 32 33 34 |
# File 'app/controllers/vulgata/translation_states_controller.rb', line 30 def show @is_admin = vulgata_current_user.vulgata_admin? @translation_state set_translation_state_and_source_state end |
#update ⇒ Object
PATCH/PUT /translation_states/1
42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/vulgata/translation_states_controller.rb', line 42 def update if params[:stop_proofreading].present? stop_proofreading elsif translation_state_params[:status] == "rejected" reject_translation elsif translation_state_params[:status] == "approved" approve_translation else update_translation end end |