Skip to content

Commit bc9256d

Browse files
fix: first vote, remove flash notices
1 parent 7b338c1 commit bc9256d

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

app/assets/stylesheets/components/_movie_list.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@
3939
align-items: center;
4040
gap: 0.25rem;
4141
}
42+
}
43+
44+
.no-vote-wrapper {
45+
display: flex;
46+
align-items: center;
47+
justify-content: space-between;
48+
gap: 1rem;
49+
}
4250

51+
.vote-wrapper,
52+
.no-vote-wrapper {
4353
.vote-submit {
4454
background: none;
4555
padding: 0;
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11

22
<% if authenticated? and !current_user.has_submitted?(movie)%>
3-
Be the first to vote for this movie: <a>Like</a> | <a>Hate</a>
3+
<div class="no-vote-wrapper">
4+
<span> Be the first to vote for this movie: </span>
5+
<%= form_with(url: movie_votes_path(movie.id), scope: :vote, method: :post) do |f| %>
6+
<%= f.hidden_field(:vote_type, value: :like) %>
7+
<%= f.submit "Like", class: "vote-submit"%>
8+
<% end %>
9+
|
10+
<%= form_with(url: movie_votes_path(movie.id), scope: :vote, method: :post) do |f| %>
11+
<%= f.hidden_field(:vote_type, value: :dislike) %>
12+
<%= f.submit "Hate", class: "vote-submit"%>
13+
<% end %>
14+
</div>
415
<% end %>

app/views/sessions/new.html.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</div>
66

77
<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
8-
<%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %>
98

109
<%= form_with url: create_session_path, class: 'form' do |form| %>
1110
<div class="form-input">

app/views/users/new.html.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</div>
66

77
<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
8-
<%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %>
98

109
<%= form_with url: users_path, scope: :user, class: 'form' do |form| %>
1110
<div class="form-input">

0 commit comments

Comments
 (0)