Class: Kaui::TagDefinitionsController
- Inherits:
-
EngineController
- Object
- EngineController
- Kaui::TagDefinitionsController
- Defined in:
- app/controllers/kaui/tag_definitions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 16 def create params[:tag_definition][:applicable_object_types] = params[:tag_definition][:applicable_object_types].values if params[:tag_definition][:applicable_object_types].present? @tag_definition = Kaui::TagDefinition.new(params[:tag_definition]) begin @tag_definition = @tag_definition.create(current_user.kb_username, params[:reason], params[:comment], ) redirect_to kaui_engine.tag_definitions_path, notice: 'Tag definition successfully created' rescue StandardError => e flash.now[:error] = "Error while creating tag definition: #{as_string(e)}" render action: :new end end |
#destroy ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 29 def destroy @tag_definition = Kaui::TagDefinition.find_by_id(params[:id], 'NONE', ) begin @tag_definition.delete(current_user.kb_username, params[:reason], params[:comment], ) redirect_to kaui_engine.tag_definitions_path, notice: 'Tag definition successfully deleted' rescue StandardError => e flash.now[:error] = "Error while deleting tag definition: #{as_string(e)}" @tag_definitions = Kaui::TagDefinition.all('NONE', ) render action: :index end end |
#index ⇒ Object
5 6 7 8 9 10 |
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 5 def index @tag_definitions = Kaui::TagDefinition.all('NONE', ) rescue StandardError => e flash.now[:error] = "Error while retrieving tag definitions: #{as_string(e)}" @tag_definitions = [] end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 12 def new @tag_definition = Kaui::TagDefinition.new end |