Class: Admin::DictionaryEntriesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Admin::DictionaryEntriesController
- Defined in:
- lib/generators/open_loam/install/templates/admin/dictionary_entries_controller.rb
Overview
Entries of a OpenLoam::Dictionary — manager-only, nested under a dictionary.
Add / edit (value, label, color, icon, position, default, active) / delete;
reordering is by editing position.
Constant Summary
Constants included from Pagination
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from Pagination
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/open_loam/install/templates/admin/dictionary_entries_controller.rb', line 10 def create @entry = @dictionary.entries.new(entry_params) if @entry.save redirect_to edit_admin_dictionary_path(@dictionary), notice: "Entry added." else @dictionary_errors = @entry.errors. redirect_to edit_admin_dictionary_path(@dictionary), alert: @dictionary_errors.join(", ") end end |
#destroy ⇒ Object
28 29 30 31 |
# File 'lib/generators/open_loam/install/templates/admin/dictionary_entries_controller.rb', line 28 def destroy @entry.destroy! redirect_to edit_admin_dictionary_path(@dictionary), notice: "Entry removed." end |
#update ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/generators/open_loam/install/templates/admin/dictionary_entries_controller.rb', line 20 def update if @entry.update(entry_params) redirect_to edit_admin_dictionary_path(@dictionary), notice: "Entry updated." else redirect_to edit_admin_dictionary_path(@dictionary), alert: @entry.errors..join(", ") end end |