Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix scaffold template

  • Loading branch information...
commit cddeafff4ee62786af96835c764a2af60aa170eb 1 parent d1126e6
@weijen authored
View
2  .gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+*.swp
View
13 handicraft-theme/templates/erb/scaffold/_form.html.erb
@@ -0,0 +1,13 @@
+<%%= simple_form_for(@<%= singular_name %>) do |f| %>
+ <%%= f.error_notification %>
+
+ <div class="inputs">
+ <%- attributes.each do |attribute| -%>
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
+ <%- end -%>
+ </div>
+
+ <div class="actions">
+ <%%= f.button :submit, :name => nil %>
+ </div>
+<%% end %>
View
6 handicraft-theme/templates/erb/scaffold/edit.html.erb
@@ -0,0 +1,6 @@
+<%% title :model => <%= class_name %>.model_name.human, :name => @<%= singular_name %>.<%= attributes.first.name %> %>
+
+<%%= render 'form' %>
+
+<%%= link_to t('links.show'), @<%= singular_name %> %> |
+<%%= link_to t('links.index'), <%= plural_name %>_path %>
View
30 handicraft-theme/templates/erb/scaffold/index.html.erb
@@ -0,0 +1,30 @@
+<%% title :model => <%= class_name %>.model_name.human %>
+
+<table class="table">
+ <tr>
+ <%- for attribute in attributes -%>
+ <th><%%= <%= class_name %>.human_attribute_name(:<%= attribute.name %>) %></th>
+ <%- end -%>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+ <%% @<%= plural_name %>.each do |<%= singular_name %>| -%>
+ <tr>
+ <%- for attribute in attributes -%>
+ <td><%%= <%= singular_name %>.<%= attribute.name %> %></td>
+ <%- end -%>
+ <td>
+ <ul>
+ <li><%%= link_to t('links.show'), <%= singular_name %> %></li>
+ <li><%%= link_to t('links.edit'), edit_<%= singular_name %>_path(<%= singular_name %>) %></li>
+ <li><%%= link_to t('links.destroy'), <%= singular_name %>, :confirm => t('links.are_you_sure'), :method => :delete %></li>
+ </ul>
+ </td>
+ </tr>
+ <%% end %>
+</table>
+
+<br>
+
+<%%= link_to t('links.new', :model => <%= class_name %>.model_name.human), new_<%= singular_name %>_path %>
View
5 handicraft-theme/templates/erb/scaffold/new.html.erb
@@ -0,0 +1,5 @@
+<%% title :model => <%= class_name %>.model_name.human %>
+
+<%%= render 'form' %>
+
+<%%= link_to t('links.index'), <%= plural_name %>_path %>
View
12 handicraft-theme/templates/erb/scaffold/show.html.erb
@@ -0,0 +1,12 @@
+<%% title :model => <%= class_name %>.model_name.human, :name => @<%= singular_name %>.<%= attributes.first.name %> %>
+
+<% for attribute in attributes -%>
+<p>
+ <b><%%= <%= class_name %>.human_attribute_name(:<%= attribute.name %>) %>:</b>
+ <%%= @<%= singular_name %>.<%= attribute.name %> %>
+</p>
+
+<% end -%>
+
+<%%= link_to t('links.edit'), edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
+<%%= link_to t('links.index'), <%= plural_name %>_path %>
Please sign in to comment.
Something went wrong with that request. Please try again.