Class: DbdocEngine::HomeController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dbdoc_engine/home_controller.rb

Instance Method Summary collapse

Instance Method Details

#changelog_details ⇒ Object

Show details for a specific changelog entry



66
67
68
69
70
71
72
73
74
75
76
77
# File 'app/controllers/dbdoc_engine/home_controller.rb', line 66

def changelog_details
  # Find the changelog entry by ID
  @changelog = DbdocEngine::DbDesignChangelogQueries.find_changelog(params[:id])
  if @changelog.nil?
    # If not found, redirect with alert
    flash[:alert] = 'Changelog entry not found.'
    redirect_to changelogs_path
  else
    # Get all groups for sidebar/nav display
    @groups = DbdocEngine::DbDesignTableGroupQueries.all_groups_with_tables_and_columns
  end
end

#changelogs ⇒ Object

Show paginated changelogs with optional filters



56
57
58
59
60
61
62
63
# File 'app/controllers/dbdoc_engine/home_controller.rb', line 56

def changelogs
  # Get filtered changelogs based on params
  @changelogs = DbdocEngine::DbDesignChangelogQueries.filtered_changelogs(params)
  # Paginate changelogs (7 per page)
  @changelogs = @changelogs.page(params[:page]).per(7)
  # Get all groups for sidebar/nav display
  @groups = DbdocEngine::DbDesignTableGroupQueries.all_groups_with_tables_and_columns
end

#group_details ⇒ Object

Show details for a specific group



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/dbdoc_engine/home_controller.rb', line 21

def group_details
  # Find the group with its tables and columns by ID
  @group = DbdocEngine::DbDesignTableGroupQueries.find_group_with_tables_and_columns(params[:id])

  if @group.nil?
    # If group not found, redirect with alert
    flash[:alert] = 'Table group deleted or does not exist.'
    redirect_to root_path
  else
    # Get table count for this group
    @tables_count = DbdocEngine::DbDesignDynamicTableQueries.count_tables_in_group(@group)
    # Get all groups for sidebar/nav display
    @groups = DbdocEngine::DbDesignTableGroupQueries.all_groups_with_tables_and_columns
  end
end

#index ⇒ Object

Home page/dashboard



11
12
13
14
15
16
17
18
# File 'app/controllers/dbdoc_engine/home_controller.rb', line 11

def index
  # Get total table count
  @table_count = DbdocEngine::DbDesignDynamicTableQueries.count_all_tables
  # Get total column count
  @field_count = DbDesignDynamicColumn.count
  # Get all groups with their tables and columns
  @groups = DbdocEngine::DbDesignTableGroupQueries.all_groups_with_tables_and_columns
end

#table_details ⇒ Object

Show details for a specific table



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/dbdoc_engine/home_controller.rb', line 38

def table_details
  # Find the table with its columns and group by ID
  @table = DbdocEngine::DbDesignDynamicTableQueries.find_table_with_columns_and_group(params[:id])

  if @table.nil?
    # If table not found, redirect with alert
    flash[:alert] = '❌ Table deleted or does not exist.'
    redirect_to root_path
  else
    @columns_count = @table.db_design_dynamic_columns.size
    # Get the group this table belongs to
    @group = @table.db_design_table_group
    # Get all groups for sidebar/nav display
    @groups = DbdocEngine::DbDesignTableGroupQueries.all_groups_with_tables_and_columns
  end
end