This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Puts generated files in line with anticipated template handler
Removes references to 'view' object; Module-scopes view classes; Adds detail link to index view; Cleans up layout;
- Loading branch information
Showing
4 changed files
with
22 additions
and
13 deletions.
There are no files selected for viewing
13 changes: 8 additions & 5 deletions
13
lib/generators/mustache_generator/scaffold/templates/index.html.mustache.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
<p>Listing {{#<%= plural_name %>}}</p> | ||
<p>Listing <%= plural_name.capitalize %></p> | ||
|
||
<% for attribute in attributes -%> | ||
<p><b><%= attribute.human_name %></b>: {{<%= attribute.name %>}}</p> | ||
<% end -%> | ||
{{#listing}} | ||
|
||
{{/<%= plural_name %>}} | ||
<p> | ||
<% attributes.collect do |attribute| -%> | ||
<b><%= attribute.human_name %></b>: {{<%= attribute.name %>}} | ||
<% end.join(" | ") -%> | ||
| <a href="{{show_path}}">Details</a></p> | ||
|
||
{{/listing}} | ||
|
||
<p><a href="{{new_path}}">New</a></p> |
16 changes: 11 additions & 5 deletions
16
lib/generators/mustache_generator/scaffold/templates/index.rb.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
class <%= plural_name %>Index < Mustache::Rails | ||
|
||
def <%= plural_name %> | ||
view.<%= plural_name %> | ||
end | ||
class <%= plural_name.camelize %>::Index < Mustache::Rails | ||
|
||
def new_path | ||
new_<%= singular_name %>_path() | ||
end | ||
|
||
def listing | ||
<%= plural_name %>.collect do |record| | ||
{ | ||
<% for attribute in attributes -%> | ||
:<%= attribute.name %> => record.<%= attribute.name %>, | ||
<% end -%> | ||
:show_path => <%= singular_name %>_path(record) | ||
} | ||
end | ||
end | ||
|
||
end |
2 changes: 1 addition & 1 deletion
2
lib/generators/mustache_generator/scaffold/templates/show.html.mustache.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
lib/generators/mustache_generator/scaffold/templates/show.rb.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters