summaryrefslogtreecommitdiff
path: root/lib/generators/nifty/scaffold/templates/views/haml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generators/nifty/scaffold/templates/views/haml')
-rw-r--r--lib/generators/nifty/scaffold/templates/views/haml/_form.html.haml7
-rw-r--r--lib/generators/nifty/scaffold/templates/views/haml/_form_core.html.haml4
-rw-r--r--lib/generators/nifty/scaffold/templates/views/haml/_index_core.html.haml13
-rw-r--r--lib/generators/nifty/scaffold/templates/views/haml/edit.html.haml3
-rw-r--r--lib/generators/nifty/scaffold/templates/views/haml/index.html.haml6
-rw-r--r--lib/generators/nifty/scaffold/templates/views/haml/new.html.haml3
-rw-r--r--lib/generators/nifty/scaffold/templates/views/haml/show.html.haml9
7 files changed, 45 insertions, 0 deletions
diff --git a/lib/generators/nifty/scaffold/templates/views/haml/_form.html.haml b/lib/generators/nifty/scaffold/templates/views/haml/_form.html.haml
new file mode 100644
index 0000000..57cb828
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/views/haml/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(<%= item_path :instance_variable => true %>) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .actions
+ = f.button :submit, conditional_t('<%= plural_name %>.form.submit') \ No newline at end of file
diff --git a/lib/generators/nifty/scaffold/templates/views/haml/_form_core.html.haml b/lib/generators/nifty/scaffold/templates/views/haml/_form_core.html.haml
new file mode 100644
index 0000000..ca7f253
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/views/haml/_form_core.html.haml
@@ -0,0 +1,4 @@
+.inputs
+<%- model_attributes.each do |attribute| -%>
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>, :label => t('<%= plural_name %>.form.<%= attribute.name %>.label'), :hint => conditional_hint('<%= plural_name %>.form.<%= attribute.name %>.hint')
+<%- end -%>
diff --git a/lib/generators/nifty/scaffold/templates/views/haml/_index_core.html.haml b/lib/generators/nifty/scaffold/templates/views/haml/_index_core.html.haml
new file mode 100644
index 0000000..9cbea63
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/views/haml/_index_core.html.haml
@@ -0,0 +1,13 @@
+%table
+ %tr
+ <%- for attribute in model_attributes -%>
+ %th= t('<%= plural_name %>.index.<%= attribute.name %>')
+ <%- end -%>
+
+ - reset_cycle
+ - for <%= instance_name %> in <%= instances_name %>
+ %tr{:class => cycle('odd', 'even')}
+ <%- for attribute in model_attributes -%>
+ %td= <%= instance_name %>.<%= attribute.name %>
+ <%- end -%>
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => <%= instance_name %>} \ No newline at end of file
diff --git a/lib/generators/nifty/scaffold/templates/views/haml/edit.html.haml b/lib/generators/nifty/scaffold/templates/views/haml/edit.html.haml
new file mode 100644
index 0000000..dc7de62
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/views/haml/edit.html.haml
@@ -0,0 +1,3 @@
+- title t("<%= plural_name %>.edit.page_title")
+
+<%= render_form %> \ No newline at end of file
diff --git a/lib/generators/nifty/scaffold/templates/views/haml/index.html.haml b/lib/generators/nifty/scaffold/templates/views/haml/index.html.haml
new file mode 100644
index 0000000..86c6b9e
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/views/haml/index.html.haml
@@ -0,0 +1,6 @@
+- title t("<%= plural_name %>.index.page_title")
+
+- if @<%= instances_name %> && @<%= instances_name %>.count > 0
+ = render "index_core", :<%= instances_name %> => @<%= instances_name %>
+
+= render :partial => 'shared/create_link', :locals => {:child_class => <%= instances_name.classify %>} \ No newline at end of file
diff --git a/lib/generators/nifty/scaffold/templates/views/haml/new.html.haml b/lib/generators/nifty/scaffold/templates/views/haml/new.html.haml
new file mode 100644
index 0000000..4e7f871
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/views/haml/new.html.haml
@@ -0,0 +1,3 @@
+- title t("<%= plural_name %>.new.page_title")
+
+<%= render_form %> \ No newline at end of file
diff --git a/lib/generators/nifty/scaffold/templates/views/haml/show.html.haml b/lib/generators/nifty/scaffold/templates/views/haml/show.html.haml
new file mode 100644
index 0000000..3d01340
--- /dev/null
+++ b/lib/generators/nifty/scaffold/templates/views/haml/show.html.haml
@@ -0,0 +1,9 @@
+- title t("<%= plural_name %>.show.page_title")
+
+<%- for attribute in model_attributes -%>
+%p
+ %strong= t('<%= plural_name %>.show.<%= attribute.name %>') + ":"
+ = @<%= instance_name %>.<%= attribute.name %>
+<%- end -%>
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @<%= instance_name %> } \ No newline at end of file