-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update generated layout to use explicit cased keys (#30)
PropsTemplate will no longer camelize(:lower). Instead we must explicitly case our keys. This commit updates the generated layout to reflect that. The change on PropsTemplate was backward breaking. You can use the following to bring back the previous behavior while you upgrade. ```ruby module PropsTemplateOverride def format_key(key) @key_cache ||= {} @key_cache[key] ||= key.camelize(:lower) @key_cache[key] end def result! result = super @key_cache = {} result end ::Props::BaseWithExtensions.prepend self end ```
- Loading branch information
Showing
8 changed files
with
20 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
13 changes: 6 additions & 7 deletions
13
superglue_rails/lib/generators/rails/templates/index.json.props
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,15 +1,14 @@ | ||
json.<%= plural_table_name %> do | ||
json.<%= plural_table_name.camelize(:lower) %> do | ||
json.array! @<%= plural_table_name %> do |<%= singular_table_name %>| | ||
<%- attributes_list_with_timestamps.each do |attr| -%> | ||
json.<%=attr%> <%= singular_table_name %>.<%=attr%> | ||
json.<%=attr%> <%= singular_table_name.camelize(:lower) %>.<%=attr%> | ||
<%- end -%> | ||
json.edit_<%=singular_table_name%>_path edit_<%=singular_table_name%>_path(<%=singular_table_name%>) | ||
json.<%=singular_table_name%>_path <%=singular_table_name%>_path(<%=singular_table_name%>) | ||
json.delete_form do | ||
json.edit<%=singular_table_name.camelize%>Path edit_<%=singular_table_name%>_path(<%=singular_table_name%>) | ||
json.<%=singular_table_name.camelize(:lower)%>Path <%=singular_table_name%>_path(<%=singular_table_name%>) | ||
json.deleteForm do | ||
form_props(model: <%=singular_table_name%>, method: :delete) | ||
end | ||
end | ||
end | ||
|
||
|
||
json.new_<%= singular_table_name %>_path new_<%= singular_table_name %>_path | ||
json.new<%= singular_table_name.camelize %>Path new_<%= singular_table_name %>_path |
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
7 changes: 3 additions & 4 deletions
7
superglue_rails/lib/generators/rails/templates/show.json.props
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,7 +1,6 @@ | ||
<%- attributes_list_with_timestamps.each do |attr|-%> | ||
json.<%=attr%> @<%= singular_table_name %>.<%=attr%> | ||
json.<%=attr.to_s.camelize(:lower)%> @<%= singular_table_name %>.<%=attr%> | ||
<%- end -%> | ||
|
||
|
||
json.<%= plural_table_name %>_path <%= plural_table_name %>_path | ||
json.edit_<%= singular_table_name %>_path edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) | ||
json.<%= plural_table_name.camelize(:lower) %>Path <%= plural_table_name %>_path | ||
json.edit<%= singular_table_name.camelize %>Path edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) |
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
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