Skip to content

Instantly share code, notes, and snippets.

@kirkconnell
Created December 9, 2011 17:48
Show Gist options
  • Select an option

  • Save kirkconnell/1452571 to your computer and use it in GitHub Desktop.

Select an option

Save kirkconnell/1452571 to your computer and use it in GitHub Desktop.
app/views/template_groups/_form.html.haml
.large_break
.two_col_left
-form_for @template_group, :url => template_group_form_url, :method => template_group_form_method do |f|
%fieldset#template_group
%legend Template Groupd Details
=f.label :name
=f.text_field :name
%br
=f.label :site_id, "Site"
=f.select :site_id, @sites.map { |s| [s.display_name, s.id] }
%br
=f.label :path_name
=f.text_field :path_name
.float_right
=f.submit
-unless @template_group.new_record?
-form_tag link_template_group_path(@template_group.id), :method => :post do
%fieldset#products
%legend Linked Products
=label_tag :pattern
=text_field_tag :pattern
.float_right
=submit_tag "Link Products"
.large_break
-unless @template_group.linked_product_count == 0
%strong= "Linked to " + pluralize(@template_group.linked_product_count, "Product")
|
=link_to "Remove Links", unlink_template_group_path(@template_group.id), :method => :delete, :confirm => "Are you sure?", :class => "red"
-unless @template_group.new_record?
.two_col_right
%fieldset#content_uis
%legend Fields
%table.data
%thead
%tr
%th Position
%th{:colspan => 2} Content UI
%tbody
-@template_group.content_uis.each do |content_ui|
%tr[content_ui]
%td= content_ui.generic_field_number
%td= link_to content_ui.label, edit_template_group_content_ui_path(@template_group, content_ui)
%td= link_to "Delete", template_group_content_ui_path(@template_group, content_ui), :method => :delete, :confirm => "Are you sure?"
.large_break
=link_to "New Field", new_template_group_content_ui_path(@template_group), :class => 'button_link button_green'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment