Class: Elabs::Admin::TagsController
- Inherits:
-
AdminApplicationController
- Object
- ActionController::Base
- ElabsApplicationController
- AdminApplicationController
- Elabs::Admin::TagsController
- Defined in:
- app/controllers/elabs/admin/tags_controller.rb
Constant Summary collapse
- DEFAULT_ORDER_FIELD =
'name'.freeze
Constants inherited from AdminApplicationController
AdminApplicationController::MAX_ITEMS_PER_PAGE
Instance Method Summary collapse
-
#destroy ⇒ Object
DELETE /tags/1 DELETE /tags/1.json.
-
#edit ⇒ Object
GET /tags/1/edit.
-
#index ⇒ Object
GET /tags GET /tags.json.
-
#update ⇒ Object
PATCH/PUT /tags/1 PATCH/PUT /tags/1.json.
Instance Method Details
#destroy ⇒ Object
DELETE /tags/1 DELETE /tags/1.json
35 36 37 38 39 40 41 |
# File 'app/controllers/elabs/admin/tags_controller.rb', line 35 def destroy @tag.destroy respond_to do |format| format.html { redirect_to , notice: _('Tag was successfully destroyed.') } format.json { head :no_content } end end |
#edit ⇒ Object
GET /tags/1/edit
17 |
# File 'app/controllers/elabs/admin/tags_controller.rb', line 17 def edit; end |
#index ⇒ Object
GET /tags GET /tags.json
10 11 12 13 14 |
# File 'app/controllers/elabs/admin/tags_controller.rb', line 10 def index order = params['order_by'] || self.class::DEFAULT_ORDER_FIELD direction = params['direction'] || 'desc' @tags = Tag.order(order => direction).all end |
#update ⇒ Object
PATCH/PUT /tags/1 PATCH/PUT /tags/1.json
21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/elabs/admin/tags_controller.rb', line 21 def update respond_to do |format| if @tag.update(tag_params) format.html { redirect_to , notice: _('Tag was successfully updated.') } format.json { render :_tag, status: :ok, location: , locals: { tag: @tag } } else format.html { render :edit, tag: @tag } format.json { render json: @tag.errors, status: :unprocessable_entity } end end end |