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

Refactor flashes [WIP - Questions] #455

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div class="mx-auto md:w-2/3 w-full">
<%% if alert = flash[:alert] %>
<p class="py-2 px-3 bg-red-50 mb-5 text-red-500 font-medium rounded-lg inline-block" id="alert"><%%= alert %></p>
<%% end %>
<%%= render "flashes" %>

<h1 class="font-bold text-4xl">Update your password</h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div class="mx-auto md:w-2/3 w-full">
<%% if alert = flash[:alert] %>
<p class="py-2 px-3 bg-red-50 mb-5 text-red-500 font-medium rounded-lg inline-block" id="alert"><%%= alert %></p>
<%% end %>
<%%= render "flashes" %>

<h1 class="font-bold text-4xl">Forgot your password?</h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<div class="mx-auto md:w-2/3 w-full">
<%% if alert = flash[:alert] %>
<p class="py-2 px-3 bg-red-50 mb-5 text-red-500 font-medium rounded-lg inline-block" id="alert"><%%= alert %></p>
<%% end %>

<%% if notice = flash[:notice] %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%%= notice %></p>
<%% end %>
<%%= render "flashes" %>

<h1 class="font-bold text-4xl">Sign in</h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<%% content_for :title, "<%= human_name.pluralize %>" %>

<div class="w-full">
<%% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%%= notice %></p>
<%% end %>
<%%= render "flashes" %>

<div class="flex justify-between items-center">
<h1 class="font-bold text-4xl"><%= human_name.pluralize %></h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<%% content_for :title, "Showing <%= human_name.downcase %>" %>

<div class="md:w-2/3 w-full">
<%% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%%= notice %></p>
<%% end %>
<%%= render "flashes" %>

<h1 class="font-bold text-4xl">Showing <%= human_name.downcase %></h1>

Expand Down
7 changes: 7 additions & 0 deletions lib/install/_flashes.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% if notice.present? %>
<p class="inline-block px-3 py-2 mb-5 font-medium text-green-500 rounded-md bg-green-50" id="notice"><%= notice %></p>
<% end %>

<% if alert.present? %>
<p class="inline-block px-3 py-2 mb-5 font-medium text-red-500 rounded-lg bg-red-50" id="alert"><%= alert %></p>
<% end %>
6 changes: 6 additions & 0 deletions lib/install/tailwindcss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
copy_file "#{__dir__}/application.tailwind.css", "app/assets/stylesheets/application.tailwind.css"
end

empty_directory "app/views/application"
unless Rails.root.join("app/views/application/_flashes.html.erb").exist?
say "Add default app/views/application/_flashes.html.erb"
copy_file "#{__dir__}/_flashes.html.erb", "app/views/application/_flashes.html.erb"
end

if Rails.root.join("Procfile.dev").exist?
append_to_file "Procfile.dev", "css: bin/rails tailwindcss:watch\n"
else
Expand Down
Loading