Class: I18nProofreading::SuggestionsController
- Inherits:
-
DashboardController
- Object
- DashboardController
- I18nProofreading::SuggestionsController
- Defined in:
- app/controllers/i18n_proofreading/suggestions_controller.rb
Constant Summary collapse
- PER_PAGE =
50
Instance Method Summary collapse
-
#index ⇒ Object
--- triage dashboard (admin) --------------------------------------------.
- #show ⇒ Object
Instance Method Details
#index ⇒ Object
--- triage dashboard (admin) --------------------------------------------
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/i18n_proofreading/suggestions_controller.rb', line 12 def index @status = Suggestion::STATUSES.include?(params[:status]) ? params[:status] : 'pending' @locale = params[:locale].presence @counts = Suggestion.group(:status).count @locales = Suggestion.distinct.pluck(:locale).compact.sort scope = Suggestion.where(status: @status) scope = scope.where(locale: @locale) if @locale @page = [params[:page].to_i, 1].max rows = scope.newest_first.offset((@page - 1) * PER_PAGE).limit(PER_PAGE + 1).to_a @more = rows.size > PER_PAGE @suggestions = rows.first(PER_PAGE) @selected_suggestion = Suggestion.find_by(id: params[:suggestion_id]) if params[:suggestion_id].present? end |
#show ⇒ Object
28 |
# File 'app/controllers/i18n_proofreading/suggestions_controller.rb', line 28 def show; end |