Class: DbdocAdmin::DbDesignTableGroupsController
- Inherits:
-
BaseController
- Object
- BaseController
- DbdocAdmin::DbDesignTableGroupsController
- Defined in:
- app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Creates a new table group.
-
#deleted_groups ⇒ Object
Displays only soft-deleted table groups.
-
#destroy ⇒ Object
Soft deletes a table group.
-
#edit ⇒ Object
Renders form for editing an existing table group.
-
#index ⇒ Object
Displays table groups with optional search and deleted items filtering.
-
#new ⇒ Object
Renders form for creating a new table group.
-
#permanent_destroy ⇒ Object
Permanently deletes a table group.
-
#restore ⇒ Object
Restores a soft-deleted table group.
-
#update ⇒ Object
Updates an existing table group.
Instance Method Details
#create ⇒ Object
Creates a new table group.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 32 def create result = TableGroupsService.new(params).create_group if result[:success] flash[:notice] = result[:message] redirect_to dbdoc_admin_db_design_table_groups_path else flash[:alert] = result[:message] @table_group = result[:table_group] render :new, status: :unprocessable_entity end end |
#deleted_groups ⇒ Object
Displays only soft-deleted table groups.
20 21 22 23 24 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 20 def deleted_groups @search_query = params[:search] @table_groups = DbdocEngine::DbDesignTableGroupQueries.search_deleted_groups(@search_query) @table_groups = @table_groups.page(params[:page]).per(10) end |
#destroy ⇒ Object
Soft deletes a table group.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 62 def destroy result = TableGroupsService.new(params).delete_group(@table_group) if result[:success] flash[:notice] = result[:message] else flash[:alert] = result[:errors].join(', ') end redirect_to dbdoc_admin_db_design_table_groups_path end |
#edit ⇒ Object
Renders form for editing an existing table group.
46 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 46 def edit; end |
#index ⇒ Object
Displays table groups with optional search and deleted items filtering.
10 11 12 13 14 15 16 17 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 10 def index @search_query = params[:search] showing_deleted = params[:show_deleted] == 'true' @table_groups = DbdocEngine::DbDesignTableGroupQueries.search_all_groups(@search_query, showing_deleted) @table_groups = @table_groups.page(params[:page]).per(10) @showing_deleted = showing_deleted end |
#new ⇒ Object
Renders form for creating a new table group.
27 28 29 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 27 def new @table_group = DbDesignTableGroup.new end |
#permanent_destroy ⇒ Object
Permanently deletes a table group.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 88 def permanent_destroy result = TableGroupsService.new(params).permanent_delete_group(@table_group) if result[:success] flash[:notice] = result[:message] else flash[:alert] = result[:errors].join(', ') end redirect_to deleted_groups_dbdoc_admin_db_design_table_groups_path(show_deleted: true) end |
#restore ⇒ Object
Restores a soft-deleted table group.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 75 def restore result = TableGroupsService.new(params).restore_group(@table_group) if result[:success] flash[:notice] = result[:message] else flash[:alert] = result[:errors].join(', ') end redirect_to deleted_groups_dbdoc_admin_db_design_table_groups_path(show_deleted: true) end |
#update ⇒ Object
Updates an existing table group.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/dbdoc_engine/dbdoc_admin/db_design_table_groups_controller.rb', line 49 def update result = TableGroupsService.new(params).update_group(@table_group) if result[:success] flash[:notice] = result[:message] redirect_to dbdoc_admin_db_design_table_groups_path else flash[:alert] = result[:message] render :edit, status: :unprocessable_entity end end |