-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9652f6b
commit c5471ac
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module System | ||
class DashboardController < Decidim::System::ApplicationController | ||
before_action :check_organizations_presence | ||
|
||
def show | ||
@organizations = Organization.all | ||
@db_size = db_size | ||
end | ||
|
||
def check_organizations_presence | ||
return if Organization.exists? | ||
|
||
redirect_to new_organization_path | ||
end | ||
|
||
private | ||
|
||
def db_size | ||
dbname = ActiveRecord::Base.connection.current_database | ||
sql = "SELECT pg_size_pretty(pg_database_size('#{dbname}'));" | ||
ActiveRecord::Base.connection.execute(sql)[0]["pg_size_pretty"] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<% provide :title do %> | ||
<h2><%= t("decidim.system.titles.dashboard.title") %></h2> | ||
<h3><%= t ".current_organizations" %></h3> | ||
<%= render partial: "decidim/system/shared/organizations_list", locals: { organizations: @organizations } %> | ||
<div class="header"> | ||
<h3><%= I18n.t("decidim.system.titles.dashboard.info.title") %></h3> | ||
<div> | ||
<p><%= I18n.t("decidim.system.titles.dashboard.info.db_size", db_size: @db_size) %></p> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters