diff --git a/Gemfile.lock b/Gemfile.lock index d3f3397c..8c112d93 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,29 +10,29 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (8.0.0) - actionpack (= 8.0.0) - activesupport (= 8.0.0) + actioncable (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.0) - actionpack (= 8.0.0) - activejob (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + actionmailbox (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) - actionmailer (8.0.0) - actionpack (= 8.0.0) - actionview (= 8.0.0) - activejob (= 8.0.0) - activesupport (= 8.0.0) + actionmailer (8.0.1) + actionpack (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.0) - actionview (= 8.0.0) - activesupport (= 8.0.0) + actionpack (8.0.1) + actionview (= 8.0.1) + activesupport (= 8.0.1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -40,35 +40,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.0) - actionpack (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + actiontext (8.0.1) + actionpack (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.0) - activesupport (= 8.0.0) + actionview (8.0.1) + activesupport (= 8.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (8.0.0) - activesupport (= 8.0.0) + activejob (8.0.1) + activesupport (= 8.0.1) globalid (>= 0.3.6) - activemodel (8.0.0) - activesupport (= 8.0.0) - activerecord (8.0.0) - activemodel (= 8.0.0) - activesupport (= 8.0.0) + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) timeout (>= 0.4.0) - activestorage (8.0.0) - actionpack (= 8.0.0) - activejob (= 8.0.0) - activerecord (= 8.0.0) - activesupport (= 8.0.0) + activestorage (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activesupport (= 8.0.1) marcel (~> 1.0) - activesupport (8.0.0) + activesupport (8.0.1) base64 benchmark (>= 0.3) bigdecimal @@ -89,35 +89,36 @@ GEM base64 (0.2.0) bcrypt (3.1.20) benchmark (0.4.0) - bigdecimal (3.1.8) + bigdecimal (3.1.9) bindex (0.8.1) builder (3.3.0) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) crass (1.0.6) - date (3.4.0) + date (3.4.1) drb (2.2.1) - erubi (1.13.0) - ffaker (2.23.0) + erubi (1.13.1) + ffaker (2.24.0) friendly_id (5.5.1) activerecord (>= 4.0.0) globalid (1.2.1) activesupport (>= 6.1) - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) - importmap-rails (2.0.3) + importmap-rails (2.1.0) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) - io-console (0.7.2) - irb (1.14.1) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.8.1) - language_server-protocol (3.17.0.3) + json (2.9.1) + language_server-protocol (3.17.0.4) lint_roller (1.1.0) - logger (1.6.1) - loofah (2.23.1) + logger (1.6.5) + loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -128,76 +129,81 @@ GEM marcel (1.0.4) mini_mime (1.1.5) mini_portile2 (2.8.8) - minitest (5.25.1) + minitest (5.25.4) mysql2 (0.5.6) name_of_person (1.1.3) activesupport (>= 5.2.0) - net-imap (0.5.0) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4) - nokogiri (1.16.8) + nokogiri (1.18.2) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.8-arm64-darwin) + nokogiri (1.18.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-darwin) + nokogiri (1.18.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-linux) + nokogiri (1.18.2-x86_64-linux-gnu) racc (~> 1.4) - pagy (9.2.0) + pagy (9.3.3) parallel (1.26.3) - parser (3.3.6.0) + parser (3.3.7.1) ast (~> 2.4.1) racc pg (1.5.9) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) propshaft (1.1.0) actionpack (>= 7.0.0) activesupport (>= 7.0.0) rack railties (>= 7.0.0) - psych (5.2.0) + psych (5.2.3) + date stringio - puma (6.4.3) + puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.8) - rack-session (2.0.0) + rack (3.1.9) + rack-session (2.1.0) + base64 (>= 0.1.0) rack (>= 3.0.0) - rack-test (2.1.0) + rack-test (2.2.0) rack (>= 1.3) - rackup (2.2.0) + rackup (2.2.1) rack (>= 3) - rails (8.0.0) - actioncable (= 8.0.0) - actionmailbox (= 8.0.0) - actionmailer (= 8.0.0) - actionpack (= 8.0.0) - actiontext (= 8.0.0) - actionview (= 8.0.0) - activejob (= 8.0.0) - activemodel (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + rails (8.0.1) + actioncable (= 8.0.1) + actionmailbox (= 8.0.1) + actionmailer (= 8.0.1) + actionpack (= 8.0.1) + actiontext (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activemodel (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) bundler (>= 1.15.0) - railties (= 8.0.0) + railties (= 8.0.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.1) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (8.0.0) - actionpack (= 8.0.0) - activesupport (= 8.0.0) + railties (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -205,66 +211,69 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.7.0) + rdoc (6.12.0) psych (>= 4.0.0) - regexp_parser (2.9.2) - reline (0.5.11) + regexp_parser (2.10.0) + reline (0.6.0) io-console (~> 0.5) - rubocop (1.66.1) + rubocop (1.70.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.34.1) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.38.0) parser (>= 3.3.1.0) - rubocop-performance (1.22.1) + rubocop-performance (1.23.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - securerandom (0.3.1) - sqlite3 (2.2.0) + securerandom (0.4.1) + sqlite3 (2.5.0) mini_portile2 (~> 2.8.0) - sqlite3 (2.2.0-arm64-darwin) - sqlite3 (2.2.0-x86_64-darwin) - sqlite3 (2.2.0-x86_64-linux-gnu) - standard (1.41.1) + sqlite3 (2.5.0-arm64-darwin) + sqlite3 (2.5.0-x86_64-darwin) + sqlite3 (2.5.0-x86_64-linux-gnu) + standard (1.44.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.66.0) + rubocop (~> 1.70.0) standard-custom (~> 1.0.0) - standard-performance (~> 1.5) + standard-performance (~> 1.6) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.5.0) + standard-performance (1.6.0) lint_roller (~> 1.1) - rubocop-performance (~> 1.22.0) + rubocop-performance (~> 1.23.0) standardrb (1.0.1) standard stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.2) thor (1.3.2) - timeout (0.4.2) + timeout (0.4.3) turbo-rails (2.0.11) actionpack (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.6.0) - uri (1.0.1) - useragent (0.16.10) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + uri (1.0.2) + useragent (0.16.11) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - websocket-driver (0.7.6) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) zeitwerk (2.7.1) @@ -297,4 +306,4 @@ DEPENDENCIES web-console BUNDLED WITH - 2.5.18 + 2.6.3 diff --git a/app/assets/stylesheets/madmin/application-sprockets.css b/app/assets/stylesheets/madmin/application-sprockets.css new file mode 100644 index 00000000..877c0dbf --- /dev/null +++ b/app/assets/stylesheets/madmin/application-sprockets.css @@ -0,0 +1,11 @@ +/* + *= require trix + *= require madmin/actiontext + *= require madmin/reset + *= require madmin/base + *= require madmin/sidebar + *= require madmin/buttons + *= require madmin/forms + *= require madmin/tables + *= require madmin/pagination +*/ diff --git a/app/assets/stylesheets/madmin/application.css b/app/assets/stylesheets/madmin/application.css index 4724e694..93192a92 100644 --- a/app/assets/stylesheets/madmin/application.css +++ b/app/assets/stylesheets/madmin/application.css @@ -1,88 +1,10 @@ -@import url("../trix.css"); -@import url("./actiontext.css"); -@import url("./reset.css"); -@import url("./sidebar.css"); -@import url("./buttons.css"); -@import url("./forms.css"); -@import url("./tables.css"); -@import url("./pagination.css"); +@import url("/trix.css"); +@import url("/madmin/actiontext.css"); +@import url("/madmin/reset.css"); +@import url("/madmin/base.css"); +@import url("/madmin/sidebar.css"); +@import url("/madmin/buttons.css"); +@import url("/madmin/forms.css"); +@import url("/madmin/tables.css"); +@import url("/madmin/pagination.css"); -:root { - --primary-color: rgb(37 99 235); - --border-color: rgb(229 231 235); - --background-color: rgb(249 250 251); - --text-color: rgb(2 6 23); - --light-text-color: rgb(71 85 105); - - --sidebar-width: 16rem; -} - -body { - color: var(--text-color); - font-size: 14px; -} - -a { - color: var(--primary-color); -} - -.search { - display: flex; - align-items: center; -} - -.header { - border-bottom: 1px solid rgb(229 231 235); - display: flex; - justify-content: space-between; - align-items: center; - padding-bottom: 1rem; - margin-bottom: 1rem; - - h1 { - margin: 0; - } - - a { - text-decoration: none; - - &:hover { - text-decoration: underline; - } - } - - .actions { - align-items: center; - display: flex; - gap: 0.5rem; - } -} - -.metrics { - display: flex; - - .metric { - border: 1px solid rgb(229 231 235); - border-radius: 0.25rem; - padding: 1rem; - margin: 1rem; - flex: 1 1 0%; - - h4 { - color: rgb(75 85 99); - font-weight: 600; - margin-top: 0; - margin-bottom: 0.5rem; - } - - p { - font-size: 2rem; - font-weight: 600; - margin: 0; - } - } -} - -.scopes { - margin-bottom: 1rem; -} diff --git a/app/assets/stylesheets/madmin/base.css b/app/assets/stylesheets/madmin/base.css new file mode 100644 index 00000000..21c8c0ae --- /dev/null +++ b/app/assets/stylesheets/madmin/base.css @@ -0,0 +1,117 @@ +:root { + --primary-color: rgb(37 99 235); + --border-color: rgb(229 231 235); + --background-color: rgb(249 250 251); + --text-color: rgb(2 6 23); + --light-text-color: rgb(71 85 105); + --sidebar-width: 16rem; +} + +body { + color: var(--text-color); + font-size: 14px; +} + +a { + color: var(--primary-color); +} + +.alert { + border-radius: 0.5rem; + font-weight: 500; + padding: 1rem; + margin-bottom: 1rem; + + ul { + margin-top: 0.5rem; + margin-bottom: 0; + padding-left: 2rem; + } + + svg { + display: inline-block; + height: 1rem; + margin-right: 0.25rem; + width: 1rem; + vertical-align: text-bottom; + } + + &.alert-danger { + background-color: oklch(.936 .032 17.717); + color: oklch(.444 .177 26.899); + + svg { + color: oklch(.637 .237 25.331); + } + } + + &.alert-notice { + background-color: oklch(.962 .044 156.743); + color: oklch(.448 .119 151.328); + + svg { + color: oklch(.723 .219 149.579); + } + } +} + +.search { + display: flex; + align-items: center; +} + +.header { + border-bottom: 1px solid rgb(229 231 235); + display: flex; + justify-content: space-between; + align-items: center; + padding-bottom: 1rem; + margin-bottom: 1rem; + + h1 { + margin: 0; + } + + a { + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } + + .actions { + align-items: center; + display: flex; + gap: 0.5rem; + } +} + +.metrics { + display: flex; + + .metric { + border: 1px solid rgb(229 231 235); + border-radius: 0.25rem; + padding: 1rem; + margin: 1rem; + flex: 1 1 0%; + + h4 { + color: rgb(75 85 99); + font-weight: 600; + margin-top: 0; + margin-bottom: 0.5rem; + } + + p { + font-size: 2rem; + font-weight: 600; + margin: 0; + } + } +} + +.scopes { + margin-bottom: 1rem; +} diff --git a/app/assets/stylesheets/madmin/forms.css b/app/assets/stylesheets/madmin/forms.css index f9bb7bb0..24399e21 100644 --- a/app/assets/stylesheets/madmin/forms.css +++ b/app/assets/stylesheets/madmin/forms.css @@ -1,21 +1,3 @@ -.alert { - border-radius: 0.25rem; - font-weight: 500; - padding: 1rem; - margin-bottom: 1rem; - - ul { - margin-top: 0.5rem; - margin-bottom: 0; - padding-left: 2rem; - } - - &.alert-danger { - background-color: rgb(254 226 226); - color: rgb(153 27 27); - } -} - .form-hint { font-size: 0.875rem; margin-top: 0.5rem; diff --git a/app/views/layouts/madmin/application.html.erb b/app/views/layouts/madmin/application.html.erb index bee0e14e..fad3f29f 100644 --- a/app/views/layouts/madmin/application.html.erb +++ b/app/views/layouts/madmin/application.html.erb @@ -18,6 +18,7 @@ <%= render "navigation" %>
+ <%= render "flash" %> <%= yield %>
diff --git a/app/views/madmin/application/_flash.html.erb b/app/views/madmin/application/_flash.html.erb new file mode 100644 index 00000000..fa1733a2 --- /dev/null +++ b/app/views/madmin/application/_flash.html.erb @@ -0,0 +1,13 @@ +<% if alert %> +
+ + <%= alert %> +
+<% end %> + +<% if notice %> +
+ + <%= notice %> +
+<% end %> diff --git a/lib/madmin.rb b/lib/madmin.rb index 6c9b0fba..704fca5d 100644 --- a/lib/madmin.rb +++ b/lib/madmin.rb @@ -39,7 +39,7 @@ module Fields mattr_accessor :importmap, default: Importmap::Map.new mattr_accessor :menu, default: Menu.new mattr_accessor :site_name - mattr_accessor :stylesheets, default: [ "madmin/application" ] + mattr_accessor :stylesheets, default: [] class << self def resource_for(object) diff --git a/lib/madmin/engine.rb b/lib/madmin/engine.rb index daf4312d..5391ea42 100644 --- a/lib/madmin/engine.rb +++ b/lib/madmin/engine.rb @@ -19,6 +19,12 @@ class Engine < ::Rails::Engine app.config.assets.paths << root.join("app/assets/stylesheets") app.config.assets.paths << root.join("app/javascript") app.config.assets.precompile += %w[madmin_manifest] + + Madmin.stylesheets << if defined?(::Sprockets) + "madmin/application-sprockets" + else + "madmin/application" + end end end