Skip to content

Commit 42fd2ed

Browse files
committed
Update Turbo flow through snippet share screens
1 parent 292b7e1 commit 42fd2ed

File tree

8 files changed

+17
-7
lines changed

8 files changed

+17
-7
lines changed

app/javascript/controllers/snippets/tweet.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Turbo } from '@hotwired/turbo-rails';
12
import { Controller } from '@hotwired/stimulus';
23

34
import debug from '../../utils/debug';
@@ -18,6 +19,7 @@ export default class extends Controller {
1819

1920
if (this.autoValue) {
2021
this.tweet();
22+
Turbo.visit(this.urlValue);
2123
}
2224
}
2325

app/views/share/snippet_screenshots/form.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def view_template
2727
render CodeBlock::Snippet.new(snippet, screenshot: true, data: {snippet_screenshot_target: "snippet"})
2828

2929
fieldset do
30-
plain form.button "Share", class: "button primary", data: {snippet_screenshot_target: "submitButton"}
30+
plain form.button "Share",
31+
class: "button primary",
32+
data: {snippet_screenshot_target: "submitButton"}
3133
end
3234
end
3335
end

app/views/share/snippet_screenshots/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<%= render Pages::Header.new(title: "Share Snippet: Screenshot") %>
22
<div class="section-content container py-gap mb-3xl">
3-
<%= turbo_frame_tag :snippet_form, data: {turbo_action: "advance"} do %>
3+
<%= turbo_frame_tag :snippet_form do %>
44
<%= render Share::SnippetScreenshots::Form.new(@snippet, auto: @auto) %>
55
<% end %>
66

app/views/share/snippet_tweets/new.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<%= render Pages::Header.new(title: "Share Snippet") %>
22
<div class="section-content container py-gap mb-3xl">
3-
<%= turbo_frame_tag :snippet_form, data: {turbo_action: "advance"} do %>
3+
<%= turbo_frame_tag :snippet_form do %>
44
<%= render Share::SnippetTweets::Tweet.new(@snippet, auto: @auto) %>
55
<% end %>
66

7+
<br>
8+
79
<div>
810
<%= link_to "Back to snippets", share_snippets_path %>
911
</div>

app/views/share/snippet_tweets/tweet.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def view_template
2323
)
2424

2525
flex_block do
26-
button_tag "Tweet",
27-
class: class_names("button", "primary", hidden: auto?),
26+
button_tag "Share",
27+
class: class_names("button", "primary"),
2828
data: {action: "click->snippet-tweet#tweet"}
2929
end
3030
end

app/views/share/snippets/edit.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<%= render Share::Snippets::Form.new(@snippet) %>
55
<% end %>
66

7+
<br>
8+
79
<div>
810
<%= link_to "Show this snippet", share_snippet_path(@snippet) %> |
911
<%= link_to "Back to snippets", share_snippets_path %>

app/views/share/snippets/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<%= render Pages::Header.new(title: "Snippet Share") %>
22
<div class="section-content container py-gap mb-3xl">
3-
<%= turbo_frame_tag :snippet_form, data: {turbo_action: "advance"} do %>
3+
<%= turbo_frame_tag :snippet_form, data: {turbo_action: "replace"} do %>
44
<%= render Share::Snippets::Form.new(@snippet) %>
55
<% end %>
66

app/views/share/snippets/show.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212

1313
<%= render Pages::Header.new(title: "Snippet Share") %>
1414
<div class="section-content container py-gap mb-3xl">
15-
<%= turbo_frame_tag :snippet_form, data: {turbo_action: "advance"} do %>
15+
<%= turbo_frame_tag :snippet_form do %>
1616
<%= render CodeBlock::Snippet.new(@snippet) %>
1717
<% end %>
1818

1919
<div>
2020
<%= render Share::Snippets::Toolbar.new(@snippet, current_user: current_user) %>
2121
</div>
2222

23+
<br>
24+
2325
<div>
2426
<%= link_to "Back to snippets", share_snippets_path %>
2527
</div>

0 commit comments

Comments
 (0)