Browse Source

get_smart + daisy_ui

main
pvincent 7 days ago
parent
commit
f1a1ab84ba
  1. 1
      Gemfile
  2. 39
      Gemfile.lock
  3. 25
      README.md
  4. 4
      TODO.md
  5. 3
      app/assets/tailwind/application.css
  6. 124
      app/assets/tailwind/daisyui-theme.js
  7. 1031
      app/assets/tailwind/daisyui.js
  8. 7
      app/views/layouts/application.html.erb
  9. 36
      app/views/layouts/components/_flash.html.erb
  10. 15
      app/views/layouts/components/_navbar.html.erb
  11. 25
      app/views/notification/index.html.erb
  12. 12
      config/importmap.rb
  13. 29
      config/initializers/get_smart.rb

1
Gemfile

@ -20,6 +20,7 @@ group :development do
gem 'debug' gem 'debug'
gem 'erb-formatter' gem 'erb-formatter'
gem 'error_highlight' gem 'error_highlight'
gem 'get-smart'
gem 'htmlbeautifier' gem 'htmlbeautifier'
gem 'rails_live_reload' gem 'rails_live_reload'
gem 'rubocop', require: false gem 'rubocop', require: false

39
Gemfile.lock

@ -79,6 +79,7 @@ GEM
bootsnap (1.18.6) bootsnap (1.18.6)
msgpack (~> 1.2) msgpack (~> 1.2)
builder (3.3.0) builder (3.3.0)
colorize (1.1.0)
concurrent-ruby (1.3.5) concurrent-ruby (1.3.5)
connection_pool (2.5.3) connection_pool (2.5.3)
crass (1.0.6) crass (1.0.6)
@ -109,6 +110,12 @@ GEM
fugit (1.11.2) fugit (1.11.2)
et-orbi (~> 1, >= 1.2.11) et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4) raabro (~> 1.4)
get-smart (0.1.0)
colorize
rails
tty-box
tty-markdown
tty-tree
globalid (1.2.1) globalid (1.2.1)
activesupport (>= 6.1) activesupport (>= 6.1)
htmlbeautifier (1.4.3) htmlbeautifier (1.4.3)
@ -124,6 +131,8 @@ GEM
rdoc (>= 4.0.0) rdoc (>= 4.0.0)
reline (>= 0.4.2) reline (>= 0.4.2)
json (2.13.2) json (2.13.2)
kramdown (2.5.1)
rexml (>= 3.3.9)
language_server-protocol (3.17.0.5) language_server-protocol (3.17.0.5)
lint_roller (1.1.0) lint_roller (1.1.0)
listen (3.9.0) listen (3.9.0)
@ -172,6 +181,8 @@ GEM
parser (3.3.9.0) parser (3.3.9.0)
ast (~> 2.4.1) ast (~> 2.4.1)
racc racc
pastel (0.8.0)
tty-color (~> 0.5)
pp (0.6.2) pp (0.6.2)
prettyprint prettyprint
prettier_print (1.2.1) prettier_print (1.2.1)
@ -243,6 +254,8 @@ GEM
regexp_parser (2.11.2) regexp_parser (2.11.2)
reline (0.6.2) reline (0.6.2)
io-console (~> 0.5) io-console (~> 0.5)
rexml (3.4.2)
rouge (4.6.0)
rubocop (1.80.0) rubocop (1.80.0)
json (~> 2.3) json (~> 2.3)
language_server-protocol (~> 3.17.0.2) language_server-protocol (~> 3.17.0.2)
@ -308,6 +321,11 @@ GEM
stimulus-rails (1.3.4) stimulus-rails (1.3.4)
railties (>= 6.0.0) railties (>= 6.0.0)
stringio (3.1.7) stringio (3.1.7)
strings (0.2.1)
strings-ansi (~> 0.2)
unicode-display_width (>= 1.5, < 3.0)
unicode_utils (~> 1.4)
strings-ansi (0.2.0)
syntax_tree (6.3.0) syntax_tree (6.3.0)
prettier_print (>= 1.2.0) prettier_print (>= 1.2.0)
tailwindcss-rails (4.3.0) tailwindcss-rails (4.3.0)
@ -327,14 +345,28 @@ GEM
thruster (0.1.15-x86_64-darwin) thruster (0.1.15-x86_64-darwin)
thruster (0.1.15-x86_64-linux) thruster (0.1.15-x86_64-linux)
timeout (0.4.3) timeout (0.4.3)
tty-box (0.7.0)
pastel (~> 0.8)
strings (~> 0.2.0)
tty-cursor (~> 0.7)
tty-color (0.6.0)
tty-cursor (0.7.1)
tty-markdown (0.7.2)
kramdown (>= 1.16.2, < 3.0)
pastel (~> 0.8)
rouge (>= 3.14, < 5.0)
strings (~> 0.2.0)
tty-color (~> 0.5)
tty-screen (~> 0.8)
tty-screen (0.8.2)
tty-tree (0.4.0)
turbo-rails (2.0.16) turbo-rails (2.0.16)
actionpack (>= 7.1.0) actionpack (>= 7.1.0)
railties (>= 7.1.0) railties (>= 7.1.0)
tzinfo (2.0.6) tzinfo (2.0.6)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
unicode-display_width (3.1.5)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (2.6.0)
unicode_utils (1.4.0)
uri (1.0.3) uri (1.0.3)
useragent (0.16.11) useragent (0.16.11)
websocket-driver (0.8.0) websocket-driver (0.8.0)
@ -361,6 +393,7 @@ DEPENDENCIES
dotenv-rails dotenv-rails
erb-formatter erb-formatter
error_highlight error_highlight
get-smart
htmlbeautifier htmlbeautifier
importmap-rails importmap-rails
propshaft propshaft

25
README.md

@ -1,24 +1,11 @@
# README
# Notification
This README would normally document whatever steps are necessary to get the
application up and running.
quick try-out app for displaying toaster as flash message based on Rails8
Things you may want to cover:
## run (mode dev)
* Ruby version
* bin/dev
* System dependencies
## building process
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
* bin/importmap pin toastify-js

4
TODO.md

@ -0,0 +1,4 @@
TODO
====
* [ ] resolve daisyui and daisyui-theme via importmap

3
app/assets/tailwind/application.css

@ -1 +1,4 @@
@import "tailwindcss"; @import "tailwindcss";
@plugin "./daisyui.js";
@plugin "./daisyui-theme.js";

124
app/assets/tailwind/daisyui-theme.js
File diff suppressed because it is too large
View File

1031
app/assets/tailwind/daisyui.js
File diff suppressed because it is too large
View File

7
app/views/layouts/application.html.erb

@ -22,10 +22,11 @@
<%= javascript_importmap_tags %> <%= javascript_importmap_tags %>
</head> </head>
<body class='dark:bg-gray-800 dark:text-slate-500'>
<%= render 'layouts/components/flash'%>
<main class="container mx-auto mt-28 px-5 flex-col gap-4">
<body >
<%= render 'layouts/components/navbar'%>
<main class="flex flex-col gap-8">
<%= yield %> <%= yield %>
</main> </main>
<%= render 'layouts/components/flash'%>
</body> </body>
</html> </html>

36
app/views/layouts/components/_flash.html.erb

@ -1,16 +1,22 @@
<% if flash.any? %>
<h2 class='bold text-2xl'>FLASH</h2>
<ul>
<li>
<% if flash.key?(:alert) %>
ALERT = <%= flash.alert %>
<% end %>
</li>
<footer class="footer sm:footer-horizontal footer-center bg-base-300 text-base-content p-4">
<aside>
<p>Copyleft AGPLv3</p>
</aside>
<li>
<% if flash.key?(:notice) %>
NOTICE = <%= flash.notice %>
<% end %>
</li>
</ul>
<% end %>
<% if flash.any? %>
<h2 class='bold text-2xl'>FLASH</h2>
<ul>
<li>
<% if flash.key?(:alert) %>
ALERT = <%= flash.alert %>
<% end %>
</li>
<li>
<% if flash.key?(:notice) %>
NOTICE = <%= flash.notice %>
<% end %>
</li>
</ul>
<% end %>
</footer>

15
app/views/layouts/components/_navbar.html.erb

@ -0,0 +1,15 @@
<div class="navbar bg-base-100 shadow-sm">
<div class="flex-none">
<button class="btn btn-square btn-ghost">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block h-5 w-5 stroke-current"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path> </svg>
</button>
</div>
<div class="flex-1">
<a class="btn btn-ghost text-xl"><%= Rails.application.name.upcase %> app</a>
</div>
<div class="flex-none">
<button class="btn btn-square btn-ghost">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block h-5 w-5 stroke-current"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z"></path> </svg>
</button>
</div>
</div>

25
app/views/notification/index.html.erb

@ -1,11 +1,22 @@
<div> <div>
<h1 class="font-bold text-4xl">Notification#index</h1>
<h1 class="font-bold text-4xl">Try out our Toaster Flash rendering</h1>
</div> </div>
<div> <div>
<h2 class="text-bold text-2xl">Links</h2>
<ul>
<li><%= link_to 'Notice', notification_show_notice_path%></li>
<li><%= link_to 'Alert', notification_show_alert_path%></li>
<li><%= link_to 'Nothing', notification_index_path%></li>
</ul>
<h2 class="text-bold text-2xl">
By using
<span class="italic">redirect_to</span>
</h2>
<ul class="list bg-base-100 rounded-box shadow-md">
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">
<%= link_to 'Notice', notification_show_notice_path, class: 'btn btn-primary'%>
</li>
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">
<%= link_to 'Alert', notification_show_alert_path, class: 'btn btn-secondary'%>
</li>
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">
<%= link_to 'Nothing', notification_index_path, class: 'btn btn-accent btn-outline'%>
</li>
</ul>
</div>

12
config/importmap.rb

@ -1,7 +1,9 @@
# Pin npm packages by running ./bin/importmap # Pin npm packages by running ./bin/importmap
pin "application"
pin "@hotwired/turbo-rails", to: "turbo.min.js"
pin "@hotwired/stimulus", to: "stimulus.min.js"
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
pin_all_from "app/javascript/controllers", under: "controllers"
pin 'application'
pin '@hotwired/turbo-rails', to: 'turbo.min.js'
pin '@hotwired/stimulus', to: 'stimulus.min.js'
pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js'
pin_all_from 'app/javascript/controllers', under: 'controllers'
pin 'toastify-js' # @1.12.0

29
config/initializers/get_smart.rb

@ -0,0 +1,29 @@
if defined?(Get::Smart)
Get::Smart.setup do |config|
# Enable or disable Get::Smart. Default: Rails.env.development?
config.enabled = Rails.env.development?
# Specify level, by default it's [:any], you can specify multiple levels
# Available options: [:any, :beginner, :middle, :advanced, :expert]
# Example:
# config.level = [:beginner, :advanced]
# config.level = [:advanced, :expert]
# config.level = :any
config.level = :any
# Frequency for showing tips. Default: :always
# Available options:
# :always, :half_hourly, :hourly, :every_two_hours, :every_three_hours,
# :every_four_hours, :every_five_hours, :every_six_hours, :every_seven_hours,
# :every_eight_hours, :every_nine_hours, :every_ten_hours, :every_eleven_hours,
# :every_twelve_hours, :daily, :every_two_days, :weekly,
config.frequency = :always
# Path to the file that will store the last shown tip. Default: ~/.get-smart-memory
# config.memory_file_path = File.expand_path("~/.get-smart-memory")
#
# Print file details with the tip. Default: false
config.print_file_details = true
end
end
Loading…
Cancel
Save