Skip to content

Commit ae73017

Browse files
committed
Add more context to resource generator
1 parent e421076 commit ae73017

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

tasks/gen/templates/resource/pages/{{folder_name}}/edit_page.cr.ecr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
class <%= pluralized_resource %>::EditPage < MainLayout
22
needs operation : <%= operation_class %>
33
needs <%= underscored_resource %> : <%= resource %>
4-
quick_def page_title, "Edit"
4+
quick_def page_title, "Edit <%= resource %> with id: #{@<%= underscored_resource %>.id}"
55

66
def content
7-
h1 "Edit"
7+
link "Back to all <%= pluralized_resource %>", <%= pluralized_resource %>::Index
8+
h1 "Edit <%= resource %> with id: #{@<%= underscored_resource %>.id}"
89
render_<%= underscored_resource %>_form(@operation)
910
end
1011

tasks/gen/templates/resource/pages/{{folder_name}}/index_page.cr.ecr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class <%= pluralized_resource %>::IndexPage < MainLayout
22
needs <%= pluralized_resource.underscore %> : <%= query_class %>
3-
quick_def page_title, "All"
3+
quick_def page_title, "All <%= pluralized_resource %>"
44

55
def content
66
h1 "All <%= pluralized_resource %>"

tasks/gen/templates/resource/pages/{{folder_name}}/new_page.cr.ecr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
class <%= pluralized_resource %>::NewPage < MainLayout
22
needs operation : <%= operation_class %>
3-
quick_def page_title, "New"
3+
quick_def page_title, "New <%= pluralized_resource %>"
44

55
def content
6-
h1 "New"
6+
h1 "New <%= pluralized_resource %>"
77
render_<%= underscored_resource %>_form(@operation)
88
end
99

tasks/gen/templates/resource/pages/{{folder_name}}/show_page.cr.ecr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
class <%= pluralized_resource %>::ShowPage < MainLayout
22
needs <%= underscored_resource %> : <%= resource %>
3-
quick_def page_title, @<%= underscored_resource %>.<%= columns.first.name %>
3+
quick_def page_title, "<%= resource %> with id: #{@<%= underscored_resource %>.id}"
44

55
def content
66
link "Back to all <%= pluralized_resource %>", <%= pluralized_resource %>::Index
7-
h1 @<%= underscored_resource %>.<%= columns.first.name %>
7+
h1 "<%= resource %> with id: #{@<%= underscored_resource %>.id}"
88
render_actions
99
render_<%= underscored_resource %>_fields
1010
end

0 commit comments

Comments
 (0)