Class: I18nFeedback::SuggestionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- I18nFeedback::SuggestionsController
- Defined in:
- app/controllers/i18n_feedback/suggestions_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#index ⇒ Object
Pending suggestions for one key/locale, shown as read-only context when the proofreader reopens the popover for a string someone already flagged.
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/i18n_feedback/suggestions_controller.rb', line 16 def create suggestion = Suggestion.new(suggestion_params) (suggestion) if suggestion.save head :created else render json: { errors: suggestion.errors. }, status: :unprocessable_entity end end |
#index ⇒ Object
Pending suggestions for one key/locale, shown as read-only context when the proofreader reopens the popover for a string someone already flagged.
7 8 9 10 11 12 13 14 |
# File 'app/controllers/i18n_feedback/suggestions_controller.rb', line 7 def index suggestions = Suggestion .where(translation_key: params[:key], locale: params[:locale]) .order(id: :desc) .limit(20) render json: suggestions.map { |suggestion| suggestion_json(suggestion) } end |