Skip to content

Commit 4a858b0

Browse files
committed
case/live_render/live_patch
1 parent 53a8dfd commit 4a858b0

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

snippets/eex.code-snippets

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@
66
"description": "<%= %>"
77
},
88

9+
"html-eex case": {
10+
"prefix": "case",
11+
"body": [
12+
"<%= case ${1:@expression} do %>",
13+
"\t<% $2 -> %>",
14+
"\t\t$3",
15+
"\t<% true -> %>",
16+
"\t\t$4",
17+
"<% end %>$0"
18+
],
19+
"description": "<%= case do %>"
20+
},
21+
922
"html-eex cond": {
1023
"prefix": "cond",
1124
"body": [
@@ -114,5 +127,43 @@
114127
"</form>$0"
115128
],
116129
"description": "<%= f = form_for %>"
130+
},
131+
132+
"LiveView live_patch": {
133+
"prefix": "lp",
134+
"body": [
135+
"<%= live_patch \"$1\", to: Routes.${2:resource}_path(@socket, :${2:show}) %>%0",
136+
"$2"
137+
],
138+
"description": "<%= live_redirect %>"
139+
},
140+
141+
"LiveView live_patch block": {
142+
"prefix": "lpb",
143+
"body": [
144+
"<%= live_patch to: Routes.${1:resource}_path(@socket, :${2:show}) do %>",
145+
"\t$3",
146+
"<% end %>$0"
147+
],
148+
"description": "<%= live_redirect %> block"
149+
},
150+
151+
"LiveView live_redirect": {
152+
"prefix": "lr",
153+
"body": [
154+
"<%= live_redirect \"$1\", to: Routes.${2:resource}_path(@socket, :${2:show}) %>%0",
155+
"$2"
156+
],
157+
"description": "<%= live_redirect %>"
158+
},
159+
160+
"LiveView live_redirect block": {
161+
"prefix": "lrb",
162+
"body": [
163+
"<%= live_redirect to: Routes.${1:resource}_path(@socket, :${2:show}) do %>",
164+
"\t$3",
165+
"<% end %>$0"
166+
],
167+
"description": "<%= live_redirect %> block"
117168
}
118169
}

snippets/elixir.code-snippets

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@
8181
],
8282
"description": "def handle_event"
8383
},
84+
85+
"LiveView handle_params": {
86+
"prefix": "hp",
87+
"body": [
88+
"@impl true",
89+
"def handle_params(params, _url, socket) do",
90+
"\t{:noreply, socket}",
91+
"end$0"
92+
],
93+
"description": "Log output to console"
94+
},
95+
8496
"LiveView render": {
8597
"prefix": "re",
8698
"body": [

0 commit comments

Comments
 (0)