Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dark mode styles on /admin #4370

Merged
merged 29 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
214c365
Fix dark mode styles on /admin
veganstraightedge Mar 2, 2025
bc9db66
Remove duplicate view count note on /articles
veganstraightedge Mar 2, 2025
1ca8d31
Replace #button_tag with form.submit on /signin
veganstraightedge Mar 2, 2025
ec41aaf
Fix right alignment of view counts footer note on /articles
veganstraightedge Mar 2, 2025
dd9bace
Fixed Danger Zone's dark mode colors
veganstraightedge Mar 2, 2025
506142f
Danger Zone layout for lg/xl
veganstraightedge Mar 2, 2025
8ee0baf
Layout and buttons on /redirects
veganstraightedge Mar 2, 2025
f3134f0
Fix /redirects search forms
veganstraightedge Mar 2, 2025
1653abb
Move layout into danger zone partial
veganstraightedge Mar 2, 2025
532999f
Refactor extract articles view_counter_note partial
veganstraightedge Mar 2, 2025
c403546
Fix right align button on /markdown
veganstraightedge Mar 2, 2025
47b2c12
Extract /markdown to its own controller
veganstraightedge Mar 2, 2025
ad587e8
Style refactoring /admin/users
veganstraightedge Mar 2, 2025
f3bd533
Refactor /settings into /admin/users#edit
veganstraightedge Mar 2, 2025
fb1bc7f
Badge bg color
veganstraightedge Mar 2, 2025
a7b866f
Button colors on /categories
veganstraightedge Mar 2, 2025
ab942ae
Pages cleanup (more to delete in its own PR
veganstraightedge Mar 2, 2025
527dc77
Podcast pages bg colors
veganstraightedge Mar 2, 2025
4b0b5b6
Video pages
veganstraightedge Mar 2, 2025
37e8daf
Button bg /books
veganstraightedge Mar 2, 2025
58bb08c
Journals pages
veganstraightedge Mar 2, 2025
07986ae
Journals pages
veganstraightedge Mar 2, 2025
d5c7c57
Episodes/Issues route TODOs
veganstraightedge Mar 2, 2025
a045197
Logos
veganstraightedge Mar 2, 2025
f0cc304
Definitions pages
veganstraightedge Mar 2, 2025
523c65e
Locales pages
veganstraightedge Mar 2, 2025
654e127
Remove pagination from /categories
veganstraightedge Mar 2, 2025
3a7fe8c
Remove pagination from /pages
veganstraightedge Mar 2, 2025
8bb389b
Merge branch 'main' into admin_darkmode_bootstrap
veganstraightedge Mar 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/admin/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class CategoriesController < Admin::AdminController
before_action :set_category, only: %i[show edit update destroy]

def index
@categories = Category.page(params[:page])
@categories = Category.all
@title = admin_title
end

Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin/episodes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: nest this controller's routes under a podcast's route
module Admin
class EpisodesController < Admin::AdminController
before_action :set_episode, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin/issues_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: nest this controller's routes under a journal's route
module Admin
class IssuesController < Admin::ToolsController
before_action :set_journal, only: %i[show edit update destroy]
Expand Down
14 changes: 14 additions & 0 deletions app/controllers/admin/markdown_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Admin
class MarkdownController < Admin::AdminController
# /admin/markdown
def index
@title = 'Markdown Cheatsheet'
@html_id = 'markdown'
@body_id = 'top'
@sections = [
%w[headings links horizontal_rules paragraphs],
%w[lists bold_and_italics]
]
end
end
end
3 changes: 2 additions & 1 deletion app/controllers/admin/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: Delete! NOT used by anything anymore!
module Admin
class PagesController < Admin::AdminController
before_action :set_page, only: %i[show edit update destroy]
Expand All @@ -7,7 +8,7 @@ class PagesController < Admin::AdminController

# /admin/pages
def index
@pages = Page.page(params[:page])
@pages = Page.all
@title = admin_title
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class UsersController < Admin::AdminController
before_action :set_user, only: %i[show edit update destroy]

def index
@users = User.page(params[:page])
@users = User.all
@title = admin_title
end

Expand Down Expand Up @@ -55,7 +55,7 @@ def user_params
end

def authorize_admin_role
redirect_to [:admin] unless Current.user.can_admin_users?
redirect_to :admin unless Current.user.can_admin_users?
end
end
end
10 changes: 4 additions & 6 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PagesController < ApplicationController
before_action :set_page, only: %i[show about contact]
before_action :page_redirects, only: %i[show about contact]
before_action :set_page, only: :show
before_action :page_redirects, only: :show
before_action :set_html_id

# TODO: Delete? Is this used by anything anymore?
Expand All @@ -13,22 +13,19 @@ def show
end

def about
@editable = @page
@title = PageTitle.new I18n.t('page_titles.about.about')

render "#{Current.theme}/pages/about"
end

def contact
@editable = @page
@title = PageTitle.new I18n.t('page_titles.about.contact')

render "#{Current.theme}/pages/contact"
end

def feeds
@title = PageTitle.new I18n.t('page_titles.about.rss_feeds')

@title = PageTitle.new I18n.t('page_titles.about.rss_feeds')
@locales = Locale.unscoped.order(name_in_english: :asc)

render "#{Current.theme}/pages/feeds"
Expand All @@ -48,6 +45,7 @@ def submission_guidelines
end

def pgp_public_key
# TODO: use Rails.root.join 'path/to'
content = File.read [Rails.root, 'app', 'assets', 'pgp_public_key.asc'].join('/')

render plain: content
Expand Down
23 changes: 0 additions & 23 deletions app/controllers/users_controller.rb

This file was deleted.

1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class User < ApplicationRecord
exclusion: {
in: [
'mickey fickie fire cracker soap on a rope',
'mickey fickey fire cracker soap on a rope',
'a long passphrase to meet the minimum length'
],
message: 'The passphrase ‘%<value>{value}’ is prohibited.'
Expand Down
4 changes: 2 additions & 2 deletions app/views/2017/pages/about.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<article id="page-<%= @page.id %>" class="h-entry">
<article id="page-about" class="h-entry">
<div class="e-content">
<%= render_markdown_for page: @page.slug %>
<%= render_markdown_for page: :about %>
</div>
</article>
4 changes: 2 additions & 2 deletions app/views/2017/pages/contact.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<article id="page-<%= @page.id %>" class="h-entry">
<article id="page-contact" class="h-entry">
<div class="e-content">
<%= render_markdown_for page: @page.slug %>
<%= render_markdown_for page: :contact %>
</div>
</article>
1 change: 1 addition & 0 deletions app/views/2017/pages/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%# TODO: Delete? Is this used by anything anymore? %>
<article id="page-<%= @page.id %>" class="h-entry">
<div class="e-content">
<%= render_markdown_for page: @page.slug %>
Expand Down
44 changes: 25 additions & 19 deletions app/views/admin/_danger_zone.html.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
<div class="card text-white bg-danger mb-5" style="margin-top: 10rem">
<div class="card-header h3">The Danger Zone™</div>
<div class="row">
<div class="col-12 col-lg-9 offset-lg-3 col-xl-6 offset-xl-6">

<div class="card-body bg-light text-dark">
<h2 class="card-title text-danger h5">
Want to delete this <%= label.humanize.titleize %>?
</h2>
<div class="card text-white mb-5" style="margin-top: 10rem">
<div class="card-header h3 bg-danger">The Danger Zone™</div>

<p class="card-text">
You can delete this <%= label.humanize.titleize %> at anytime.
All of its associated data will be immediately and permanently deleted.
There is <b>NO UNDO</b>.
</p>
<div class="card-body text-secondary">
<h2 class="card-title text-danger h5">
Want to delete this <%= label.humanize.titleize %>?
</h2>

<div class="text-right">
<%= link_to "Delete",
path,
class: "btn btn-danger btn-sm",
data: {
turbo_method: :delete,
turbo_confirm: "Are you sure you’re sure? There is NO UNDO."
} %>
<p class="card-text">
You can delete this <%= label.humanize.titleize %> at anytime.
All of its associated data will be immediately and permanently deleted.
There is <b>NO UNDO</b>.
</p>

<div class="text-end">
<%= link_to "Delete",
path,
class: "btn btn-danger",
data: {
turbo_method: :delete,
turbo_confirm: "Are you sure you’re sure? There is NO UNDO."
} %>
</div>
</div>
</div>

</div>
</div>
3 changes: 2 additions & 1 deletion app/views/admin/_form_actions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

<div class="my-5 pb-3 border-bottom text-end">
<%= link_to "Cancel", cancel_url, class: "cancel action-cancel" %>
<%= button_tag button_text, class: "btn btn-primary btn-lg" %>

<%= button_tag button_text, class: "btn btn-primary btn-lg ms-2" %>
</div>
6 changes: 3 additions & 3 deletions app/views/admin/articles/_article.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<article class="p-2 mb-3 rounded border-bottom">
<article class="p-2 mb-3 border-bottom">

<%# mobile header… %>
<div class="articles-header row d-md-none mb-3">
Expand All @@ -9,7 +9,7 @@
<%= render "/admin/articles/children_articles_badge", article: article %>
</div>

<div class="col-4 text-right">
<div class="col-4 text-end">
<%= number_with_delimiter article.page_views %> Views

<% if article.english? %>
Expand Down Expand Up @@ -44,7 +44,7 @@
<% end %>
</div>

<div class="col-md-2 d-none d-md-block text-right">
<div class="col-md-2 d-none d-md-block text-end">
<p class="m-0"><%= number_with_delimiter article.page_views %> Views</p>

<% if article.english? %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<b class="badge bg-<%= publication_status_badge_class resource %> text-white">
<b class="badge bg-<%= publication_status_badge_class resource %>">
<%= resource.publication_status.upcase %>
</b>
3 changes: 2 additions & 1 deletion app/views/admin/articles/_table.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%# This is used in admin/articles#show for collection posts (i.e., live blogs) %>
<div class="articles col-12 mb-5">
<div class="articles-header row py-2 bg-dark text-white d-none d-md-flex">
<div class="col-sm-1"></div>
Expand All @@ -8,7 +9,7 @@
<% articles.each do |article| %>
<div class="articles-body row mb-3 py-2 <%= admin_articles_table_row_classes article %>">
<div class="col-md-1 mb-2">
<%= link_to "EDIT", [:edit, :admin, article], class: "btn btn-light border-secondary btn-sm me-2" %>
<%= link_to "EDIT", [:edit, :admin, article], class: "btn btn-outline-primary btn-sm me-2" %>
</div>

<div class="col-md-8">
Expand Down
3 changes: 3 additions & 0 deletions app/views/admin/articles/_view_counter_note.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="articles-footer text-end">
<p class="text-muted pt-1">View counts started on <code>2017-08-23</code></p>
</div>
10 changes: 4 additions & 6 deletions app/views/admin/articles/draft.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<%= render "/admin/articles/publication_status_badge", resource: article %>

<% if article.locale.present? %>
<%= link_to article.locale.upcase, [:admin, :locales], class: "badge bg-dark text-white" %>
<%= link_to article.locale.upcase, [:admin, :locales], class: "badge bg-secondary" %>
<% end %>
</div>

Expand All @@ -56,7 +56,7 @@
<% else %>
<% if article.canonical_id.present? %>
<% if article.canonical_record.locale.present? %>
<%= link_to article.canonical_record.locale.upcase, [:admin, :locales], class: "badge bg-secondary text-white" %>
<%= link_to article.canonical_record.locale.upcase, [:admin, :locales], class: "badge bg-secondary" %>
<% end %>
<span class="text-muted">English Article</span>
<br>
Expand All @@ -72,10 +72,8 @@
</div>
</div>
<% end %>
</div><!-- .articles -->

<div class="articles-footer row">
<p class="col text-right text-muted p2-3">View counts started on <code>2017-08-23</code></p>
</div>
</div>
<%= render 'view_counter_note' %>

<%= paginate @articles, views_prefix: 'admin', theme: 'twitter-bootstrap-4' %>
12 changes: 4 additions & 8 deletions app/views/admin/articles/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

<%= render "form" %>

<div class="row">
<div class="col-12 col-lg-9">
<%= render "admin/danger_zone",
thing: @article,
label: "article",
path: [:admin, @article] if Current.user.can_delete? %>
</div>
</div>
<%= render "admin/danger_zone",
thing: @article,
label: "article",
path: [:admin, @article] if Current.user.can_delete? %>
8 changes: 1 addition & 7 deletions app/views/admin/articles/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
<% end %>
</div><!-- .articles -->

<div class="articles-footer row">
<p class="col text-right text-muted p2-3">View counts started on <code>2017-08-23</code></p>
</div>

<div class="articles-footer text-right mt-5">
<p class="text-muted border-top pt-1">View counts started on <code>2017-08-23</code></p>
</div>
<%= render 'view_counter_note' %>

<%= paginate @articles, views_prefix: 'admin', theme: 'twitter-bootstrap-4' %>
2 changes: 1 addition & 1 deletion app/views/admin/books/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<% @books.each do |book| %>
<tr>
<td>
<%= link_to "EDIT", [:edit, :admin, book], class: "btn btn-light border-secondary btn-sm" %>
<%= link_to "EDIT", [:edit, :admin, book], class: "btn btn-outline-primary btn-sm" %>
</td>

<td>
Expand Down
20 changes: 11 additions & 9 deletions app/views/admin/categories/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<%= form_with(model: [:admin, @category]) do |form| %>
<%= render "admin/form_errors", thing: @category %>
<div class='col-12 col-md-9 col-lg-6'>
<%= form_with(model: [:admin, @category]) do |form| %>
<%= render "admin/form_errors", thing: @category %>

<%= render "admin/label_and_field_form_group", form: form, attr: :name %>
<%= render "admin/label_and_field_form_group", form: form, attr: :name %>

<%= render "admin/label_and_field_form_group", form: form, attr: :slug %>
<p class="form-text text-muted">
Leave blank to auto-generate <code>slug</code> based on <code>name</code>.
</p>
<%= render "admin/label_and_field_form_group", form: form, attr: :slug %>
<p class="form-text text-muted">
Leave blank to auto-generate <code>slug</code> based on <code>name</code>.
</p>

<%= render "admin/form_actions", cancel_url: [:admin, :categories] %>
<% end %>
<%= render "admin/form_actions", cancel_url: [:admin, :categories] %>
<% end %>
</div>
8 changes: 3 additions & 5 deletions app/views/admin/categories/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@
<th></th>
<th>Name</th>
<th>Path</th>
<th>Articles</th>
<th class='text-end'>Articles</th>
</tr>
</thead>

<tbody>
<% @categories.each do |category| %>
<tr>
<td>
<%= link_to "EDIT", [:edit, :admin, category], class: "btn btn-light border-secondary btn-sm" %>
<%= link_to "EDIT", [:edit, :admin, category], class: "btn btn-outline-primary btn-sm" %>
</td>
<td><b><%= category.name %></b></td>
<td><%= link_to category.path, category.path %></td>
<td><%= category.articles.count %></td>
<td class='text-end'><%= category.articles.count %></td>
</tr>
<% end %>
</tbody>
</table>

<%= paginate @categories, views_prefix: "admin", theme: "twitter-bootstrap-4" %>
Loading