Skip to content
Open
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
8 changes: 4 additions & 4 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def new
def edit
respond_to do |format|
format.html
format.js
format.turbo_stream
end
end

Expand All @@ -24,7 +24,7 @@ def create
if @comment.save
format.html { redirect_back fallback_location: root_path, notice: "Comment was successfully created." }
format.json { render :show, status: :created, location: @comment }
format.js
format.turbo_stream
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @comment.errors, status: :unprocessable_entity }
Expand All @@ -38,7 +38,7 @@ def update
if @comment.update(comment_params)
format.html { redirect_to root_url, notice: "Comment was successfully updated." }
format.json { render :show, status: :ok, location: @comment }
format.js
format.turbo_stream
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @comment.errors, status: :unprocessable_entity }
Expand All @@ -52,7 +52,7 @@ def destroy
respond_to do |format|
format.html { redirect_back fallback_location: root_url, notice: "Comment was successfully destroyed." }
format.json { head :no_content }
format.js
format.turbo_stream
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/follow_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def create
if @follow_request.save
format.html { redirect_back fallback_location: root_url, notice: "Follow request was successfully created." }
format.json { render :show, status: :created, location: @follow_request }
format.js
format.turbo_stream
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @follow_request.errors, status: :unprocessable_entity }
Expand All @@ -37,7 +37,7 @@ def destroy
respond_to do |format|
format.html { redirect_back fallback_location: root_url, notice: "Follow request was successfully destroyed." }
format.json { head :no_content }
format.js
format.turbo_stream
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/likes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def create
if @like.save
format.html { redirect_back fallback_location: @like.photo, notice: "Like was successfully created." }
format.json { render :show, status: :created, location: @like }
format.js
format.turbo_stream
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @like.errors, status: :unprocessable_entity }
Expand All @@ -23,7 +23,7 @@ def destroy
respond_to do |format|
format.html { redirect_back fallback_location: @like.photo, notice: "Like was successfully destroyed." }
format.json { head :no_content }
format.js
format.turbo_stream
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/comments/_comment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

<div>
<% if comment.author == current_user %>
<%= link_to edit_comment_path(comment), class: "btn btn-link btn-sm text-muted", remote: true do %>
<%= link_to edit_comment_path(comment), class: "btn btn-link btn-sm text-muted", data: { turbo_stream: true } do %>
<i class="fas fa-edit fa-fw"></i>
<% end %>

<%= button_to comment, method: :delete, class: "btn btn-link btn-sm text-muted", form_class: "btn btn-sm btn-link", remote: true do %>
<%= button_to comment, method: :delete, class: "btn btn-link btn-sm text-muted", form_class: "btn btn-sm btn-link" do %>
<i class="fas fa-trash fa-fw"></i>
<% end %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/comments/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li id="<%= dom_id(comment.photo) %>_<%= dom_id(comment) %>_form" class="list-group-item">
<%= form_with(model: comment, local: false) do |form| %>
<%= form_with(model: comment) do |form| %>
<% if comment.errors.any? %>
<div id="error_explanation">
<ul class="list-unstyled">
Expand Down
9 changes: 0 additions & 9 deletions app/views/comments/create.js.erb

This file was deleted.

7 changes: 7 additions & 0 deletions app/views/comments/create.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%= turbo_stream.before "#{dom_id(@comment.photo)}_new_comment_form" do %>
<%= render @comment %>
<% end %>

<%= turbo_stream.replace "#{dom_id(@comment.photo)}_new_comment_form" do %>
<%= render "form", comment: @comment.photo.comments.build %>
<% end %>
3 changes: 0 additions & 3 deletions app/views/comments/destroy.js.erb

This file was deleted.

1 change: 1 addition & 0 deletions app/views/comments/destroy.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= turbo_stream.remove dom_id(@comment) %>
1 change: 0 additions & 1 deletion app/views/comments/edit.js.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/comments/edit.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= turbo_stream.replace dom_id(@comment) do %>
<%= render "comments/form", comment: @comment %>
<% end %>
1 change: 0 additions & 1 deletion app/views/comments/update.js.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/comments/update.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= turbo_stream.replace "#{dom_id(@comment.photo)}_#{dom_id(@comment)}_form" do %>
<%= render @comment %>
<% end %>
4 changes: 2 additions & 2 deletions app/views/follow_requests/_follow_unfollow.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

<% if follow_request %>
<% if follow_request.pending? %>
<%= link_to follow_request, remote: true, method: :delete, class: "#{dom_id(follow_request)} btn btn-outline-secondary" do %>
<%= button_to follow_request, method: :delete, form_class: dom_id(follow_request), class: "btn btn-outline-secondary" do %>
Un-request
<% end %>
<% elsif follow_request.accepted? %>
<%= link_to follow_request, remote: true, method: :delete, class: "#{dom_id(follow_request)} btn btn-outline-secondary" do %>
<%= button_to follow_request, method: :delete, form_class: dom_id(follow_request), class: "btn btn-outline-secondary" do %>
Un-follow
<% end %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/follow_requests/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= form_with(model: follow_request, local: false, class: "#{dom_id(follow_request.recipient)} d-inline-block") do |form| %>
<%= form_with(model: follow_request, class: "#{dom_id(follow_request.recipient)} d-inline-block") do |form| %>
<% if follow_request.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(follow_request.errors.count, "error") %> prohibited this follow_request from being saved:</h2>
Expand Down
5 changes: 0 additions & 5 deletions app/views/follow_requests/create.js.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/follow_requests/create.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= turbo_stream.replace_all ".#{dom_id(@follow_request.recipient)}" do %>
<%= render "follow_requests/follow_unfollow", sender: @follow_request.sender, recipient: @follow_request.recipient %>
<% end %>
5 changes: 0 additions & 5 deletions app/views/follow_requests/destroy.js.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/follow_requests/destroy.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= turbo_stream.replace_all ".#{dom_id(@follow_request)}" do %>
<%= render "follow_requests/form", follow_request: @follow_request.recipient.received_follow_requests.build %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/likes/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= form_with(model: like, local: false,) do |form| %>
<%= form_with(model: like) do |form| %>
<%= form.hidden_field :fan_id %>

<%= form.hidden_field :photo_id %>
Expand Down
5 changes: 0 additions & 5 deletions app/views/likes/create.js.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/likes/create.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= turbo_stream.replace "#{dom_id(@like.photo)}_likes" do %>
<%= render "photos/likes", photo: @like.photo %>
<% end %>
5 changes: 0 additions & 5 deletions app/views/likes/destroy.js.erb

This file was deleted.

3 changes: 3 additions & 0 deletions app/views/likes/destroy.turbo_stream.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= turbo_stream.replace "#{dom_id(@like.photo)}_likes" do %>
<%= render "photos/likes", photo: @like.photo %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/photos/_likes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<% like = current_user.likes.find_by(photo: photo) %>

<% if like %>
<%= link_to like, class: "btn btn-link link-underline-dark link-underline-opacity-0 link-underline-opacity-100-hover", method: :delete, remote: true do %>
<%= button_to like, method: :delete, class: "btn btn-link link-underline-dark link-underline-opacity-0 link-underline-opacity-100-hover" do %>
<i class="fas fa-heart fa-fw"></i>

Un-like
Expand Down