-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3206 from manyfold3d/admin-sidebar
Redesign site settings area, to allow future expansion
- Loading branch information
Showing
39 changed files
with
454 additions
and
2,192 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class SettingsPolicy < ApplicationPolicy | ||
def show? | ||
update? | ||
end | ||
|
||
def analysis? | ||
update? | ||
end | ||
|
||
def multiuser? | ||
update? | ||
end | ||
|
||
def reporting? | ||
update? | ||
end | ||
|
||
def update? | ||
one_of( | ||
user&.is_administrator? | ||
) | ||
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,47 @@ | ||
<h1><%= t ".title" %></h1> | ||
<div class="row mt-2"> | ||
<div class="col col-auto border-end" id="sidebar"> | ||
<ul class="nav flex-column"> | ||
<li class="nav-item"> | ||
<%= link_to t(".organization"), settings_path, class: "nav-link" %> | ||
</li> | ||
<li class="nav-item"> | ||
<%= link_to t(".libraries"), settings_libraries_path, class: "nav-link" %> | ||
</li> | ||
<li class="nav-item"> | ||
<%= link_to t("settings.analysis.heading"), analysis_settings_path(anchor: "analysis"), class: "nav-link" %> | ||
</li> | ||
<li class="nav-item"> | ||
<%= link_to t("settings.multiuser.heading"), multiuser_settings_path(anchor: "multiuser"), class: "nav-link" %> | ||
</li> | ||
<li class="nav-item"> | ||
<%= link_to t("settings.reporting.heading"), reporting_settings_path(anchor: "reporting"), class: "nav-link" %> | ||
</li> | ||
</ul> | ||
<% unless SiteSettings.demo_mode_enabled? %> | ||
<hr> | ||
<h5><%= t(".tools_heading") %></h5> | ||
<ul class="nav flex-column"> | ||
<li class="nav-item"> | ||
<%= link_to t(".activeadmin"), admin_root_path, class: "nav-link" %> | ||
</li> | ||
<li class="nav-item"> | ||
<%= link_to t(".performance"), rails_performance_path, class: "nav-link" unless Rails.env.test? %> | ||
</li> | ||
<li class="nav-item"> | ||
<%= link_to t(".sidekiq"), sidekiq_web_path, class: "nav-link" %> | ||
</li> | ||
<%= if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ApplicationRecord.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) | ||
link_to safe_join([icon("database", t(".pghero")), t(".pghero")], " "), | ||
pg_hero_path, | ||
class: "btn btn-danger mb-3" | ||
end %> | ||
</ul> | ||
<% end %> | ||
</div> | ||
<div class="col" id="content"> | ||
<%= yield %> | ||
</div> | ||
</div> | ||
|
||
<% parent_layout "application" %> |
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,69 @@ | ||
<h3><%= t(".heading") %></h3> | ||
<%= link_to t("libraries.general.new"), new_library_path, class: "btn btn-secondary float-end" if policy(:library).new? %> | ||
<p class='lead'> | ||
<%= t(".description") %> | ||
</p> | ||
<div class="row"> | ||
<% Library.find_each do |library| %> | ||
<div class="col-md-6"> | ||
<div class="card"> | ||
<div class="card-header"> | ||
<%= icon(library.icon, library.icon) if library.icon %> | ||
<%= library.name %> | ||
</div> | ||
<div class="card-body"> | ||
<%= link_to t("general.edit"), edit_library_path(library), {class: "btn btn-secondary float-end #{policy(:library).edit? ? "" : "disabled"}"} %> | ||
<p> | ||
<%= markdownify(library.notes) if library.notes %> | ||
</p> | ||
<table class="table"> | ||
<tr> | ||
<td><%= t("activerecord.attributes.library.storage_service") %></td> | ||
<td><%= t("libraries.storage_services.%{service}" % {service: library.storage_service}) %></td> | ||
</tr> | ||
<% if library.storage_service == "filesystem" %> | ||
<tr> | ||
<td><%= t("activerecord.attributes.library.path") %></td> | ||
<td><code style="word-break: break-all"><%= library.path %></code></td> | ||
</tr> | ||
<% end %> | ||
<% if library.storage_service == "s3" %> | ||
<tr> | ||
<td><%= t("activerecord.attributes.library.s3_endpoint") %></td> | ||
<td><%= library.s3_endpoint %></td> | ||
</tr> | ||
<tr> | ||
<td><%= t("activerecord.attributes.library.s3_bucket") %></td> | ||
<td><%= library.s3_bucket %></td> | ||
</tr> | ||
<tr> | ||
<td><%= t("activerecord.attributes.library.s3_region") %></td> | ||
<td><%= library.s3_region %></td> | ||
</tr> | ||
<% end %> | ||
<% if library.free_space %> | ||
<tr> | ||
<td><%= t(".free_space.label") %></td> | ||
<td><%= number_to_human_size(library.free_space, precision: 2) %></td> | ||
</tr> | ||
<% end %> | ||
<tr> | ||
<td><%= t("activerecord.attributes.library.caption") %></td> | ||
<td><%= library.caption %></td> | ||
</tr> | ||
<tr> | ||
<td><%= t("activerecord.attributes.library.tag_regex") %></td> | ||
<td> | ||
<% library.tag_regex.each do |reg| %> | ||
<%= link_to t(".tag_regex.check"), models_path(library: library, missingtag: reg), {class: "btn btn-outline-secondary"} %> | ||
<code><%= reg %></code><br> | ||
<% end %> | ||
<%= if !library.tag_regex.empty? then link_to t(".tag_regex.search_missing"), models_path(library: library, missingtag: ""), {class: "btn btn-outline-secondary"} end %> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,48 +1,44 @@ | ||
<div class="card mb-2"> | ||
<h3 class="card-header"><%= t(".title") %></h3> | ||
<div class="card-body"> | ||
<p class='lead'> | ||
<%= t ".summary" %> | ||
</p> | ||
<p> | ||
<%= t ".details" %> | ||
</p> | ||
<ul> | ||
<li> | ||
<code>{tags}</code>: <%= t ".tokens.tags_html" %> | ||
</li> | ||
<li> | ||
<code>{creator}</code>: <%= t ".tokens.creator" %> | ||
</li> | ||
<li> | ||
<code>{collection}</code>: <%= t ".tokens.collection" %> | ||
</li> | ||
<li> | ||
<code>{modelName}</code>: <%= t ".tokens.model_name" %> | ||
</li> | ||
<li> | ||
<code>{modelId}</code>: <%= t ".tokens.model_id" %> | ||
</li> | ||
</ul> | ||
<div class="row mb-2"> | ||
<%= form.label nil, t(".model_path_template.label"), for: "folders[model_path_template]", class: "col-sm-4 col-form-label" %> | ||
<div class="col-sm-8 form-check form-switch"> | ||
<%= form.text_field "folders[model_path_template]", value: SiteSettings.model_path_template, class: "form-control" %> | ||
</div> | ||
</div> | ||
<div class="row mb-2"> | ||
<%= form.label nil, t(".parse_metadata_from_path.label"), for: "folders[parse_metadata_from_path]", class: "col-sm-4 col-form-label" %> | ||
<div class="col-sm-8 form-check form-switch"> | ||
<%= form.check_box "folders[parse_metadata_from_path]", checked: SiteSettings.parse_metadata_from_path, class: "form-check-input" %> | ||
<small><%= t ".parse_metadata_from_path.help" %></small> | ||
</div> | ||
</div> | ||
<div class="row mb-2"> | ||
<%= form.label nil, t(".safe_folder_names.label"), for: "folders[safe_folder_names]", class: "col-sm-4 col-form-label" %> | ||
<div class="col-sm-8 form-check form-switch"> | ||
<%= form.check_box "folders[safe_folder_names]", checked: SiteSettings.safe_folder_names, class: "form-check-input" %> | ||
<small><%= t(".safe_folder_names.help_html") %></small> | ||
</div> | ||
</div> | ||
<h3><%= t(".title") %></h3> | ||
<p class='lead'> | ||
<%= t ".summary" %> | ||
</p> | ||
<p> | ||
<%= t ".details" %> | ||
</p> | ||
<ul> | ||
<li> | ||
<code>{tags}</code>: <%= t ".tokens.tags_html" %> | ||
</li> | ||
<li> | ||
<code>{creator}</code>: <%= t ".tokens.creator" %> | ||
</li> | ||
<li> | ||
<code>{collection}</code>: <%= t ".tokens.collection" %> | ||
</li> | ||
<li> | ||
<code>{modelName}</code>: <%= t ".tokens.model_name" %> | ||
</li> | ||
<li> | ||
<code>{modelId}</code>: <%= t ".tokens.model_id" %> | ||
</li> | ||
</ul> | ||
<div class="row mb-2"> | ||
<%= form.label nil, t(".model_path_template.label"), for: "folders[model_path_template]", class: "col-sm-4 col-form-label" %> | ||
<div class="col-sm-8 form-check form-switch"> | ||
<%= form.text_field "folders[model_path_template]", value: SiteSettings.model_path_template, class: "form-control" %> | ||
</div> | ||
</div> | ||
<div class="row mb-2"> | ||
<%= form.label nil, t(".parse_metadata_from_path.label"), for: "folders[parse_metadata_from_path]", class: "col-sm-4 col-form-label" %> | ||
<div class="col-sm-8 form-check form-switch"> | ||
<%= form.check_box "folders[parse_metadata_from_path]", checked: SiteSettings.parse_metadata_from_path, class: "form-check-input" %> | ||
<small><%= t ".parse_metadata_from_path.help" %></small> | ||
</div> | ||
</div> | ||
<div class="row mb-2"> | ||
<%= form.label nil, t(".safe_folder_names.label"), for: "folders[safe_folder_names]", class: "col-sm-4 col-form-label" %> | ||
<div class="col-sm-8 form-check form-switch"> | ||
<%= form.check_box "folders[safe_folder_names]", checked: SiteSettings.safe_folder_names, class: "form-check-input" %> | ||
<small><%= t(".safe_folder_names.help_html") %></small> | ||
</div> | ||
</div> |
Oops, something went wrong.