Skip to content

Commit

Permalink
style button, add spec for when signed out
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkby7e committed Nov 12, 2024
1 parent 68b09d0 commit 1a79247
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
*/

.cta-btn {
@apply bg-emerald-400 border border-zinc-300 py-2 px-3 rounded-md
}

.btn {
@apply bg-gray-100 border border-zinc-500 py-1 px-2 rounded-md cursor-pointer
}
4 changes: 1 addition & 3 deletions app/views/home/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
Here are the current tools that we have available
</p>
</div>
<div>
<%= link_to '+ Add Tool', new_tool_path %>
</div>
<%= render 'tools/add_tool_button' %>
</div>
<div>
<%= turbo_frame_tag :tools_index, src: tools_path %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
</div>
<% if current_user.present? %>
<%= link_to "Log Out", destroy_user_session_path, data: { turbo_method: :delete }, class: "text-zinc-300" %>
<%= button_to "Log Out", destroy_user_session_path, data:{ turbo: :false }, method: :delete, class: "text-zinc-300" %>
<% else %>
<%= link_to "Log In", new_user_session_path, class: "text-zinc-300" %>
<% end %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/tools/_add_tool_button.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<%= link_to '+ Add Tool', new_tool_path, class: "cta-btn" %>
</div>
4 changes: 1 addition & 3 deletions app/views/tools/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<div class="flex flex-col mx-auto w-full gap-4">
<div class="flex justify-between">
<h1 class='text-3xl font-bold'>Tools</h1>
<div>
<%= link_to '+ Add Tool', new_tool_path %>
</div>
<%= render 'add_tool_button' %>
</div>
<%= turbo_frame_tag :tools_index do %>
<% if @tools.any? %>
Expand Down
5 changes: 5 additions & 0 deletions spec/system/user/adds_tool_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@
end

it 'redirects you to session new if you are not logged in' do
visit root_path

click_on '+ Add Tool'

expect(page).to have_content 'Log in or Sign up to add a tool!'
end
end

0 comments on commit 1a79247

Please sign in to comment.