Skip to content

Instantly share code, notes, and snippets.

@ohayon
Created January 27, 2013 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohayon/4173335bf56275489664 to your computer and use it in GitHub Desktop.
Save ohayon/4173335bf56275489664 to your computer and use it in GitHub Desktop.
.nested-fields
= f.input :label, :wrapper => :inline, :label => false, :hint => 'label' do
= f.input_field :label, :hint => 'label'
= f.input :tab_icon, :wrapper => :inline, :label => false, :hint => 'tab icon' do
= f.input_field :icon_image, :hint => 'icon_image'
= f.input :selector, :wrapper => :inline, :label => false, :hint => 'selector' do
= f.input_field :icon_image, :hint => 'selector'
= f.input :require_login, :as => :boolean
.options
= f.simple_fields_for :options, :wrapper => 'inline' do |option|
= render 'option_fields', :f => option
.links
= link_to_add_association 'add sub-task', f, :options, :render_options => { :wrapper => 'inline' }
= link_to_remove_association "Remove Dashboard Action", f
= simple_form_for @key, :wrapper => 'inline' do |f|
= f.input :name, :label => 'School Name'
= f.input :oid, :label => 'OID'
= f.input :short_name, :label => 'Short Name'
= f.input :app_name, :label => 'App Name'
= f.input :nav_color, :label => 'Nav Color'
= f.input :org_url, :label => 'Org URL'
= f.input :facebook_id, :label => 'Facebook ID'
ul.tabs
li.active
= link_to 'Dashboard Actions', '#dashacts'
.tab-content
#dashacts.active
= f.simple_fields_for :dashacts, :wrapper => 'inline' do |dashact|
= render 'dashact_fields', :f => dashact
.links
= link_to_add_association 'Add Dashboard Action', f, :dashacts, :render_options => { :wrapper => 'inline' }
.actions
= f.button :submit, :disable_with => 'Please wait ...'
.nested-fields
= f.input :title
= f.input :has_tabs
= f.input :has_toolbar
= f.input :has_navi
= f.input :localytics_event
= f.input :feed
= f.input :url
= link_to_remove_association 'Remove Options', f
class Dashact < ActiveRecord::Base
has_many :options
attr_accessible :icon_image, :require_login, :selector, :label
accepts_nested_attributes_for :options, :reject_if => :all_blank, :allow_destroy => true
end
class Key < ActiveRecord::Base
has_many :dashacts
attr_accessible :app_name, :facebook_id, :name, :nav_color, :oid, :org_url, :short_name, :dashacts_attributes
accepts_nested_attributes_for :dashacts, :reject_if => :all_blank, :allow_destroy => true
end
class Option < ActiveRecord::Base
attr_accessible :feed, :has_navi, :has_tabs, :has_toolbar, :localytics_event, :tab_id, :title, :url
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment