-
Notifications
You must be signed in to change notification settings - Fork 99
Pixate support style_class and style_id for rows
Miguel Michelson Martinez edited this page Jun 21, 2013
·
1 revision
Formotion::RowCellBuilder.class_eval do
def self.make_cell(row)
cell, text_field = nil
cell = UITableViewCell.alloc.initWithStyle(row.object.cell_style, reuseIdentifier:row.reuse_identifier)
cell.accessoryType = cell.editingAccessoryType = UITableViewCellAccessoryNone
cell.textLabel.text = row.title
cell.detailTextLabel.text = row.subtitle
edit_field = row.object.build_cell(cell)
#if cell.respond_to?("styleId") && cell.respond_to?("styleClass")
cell.styleId = row.style_id
cell.styleClass = row.style_class
#end
[cell, edit_field]
end
end
Formotion::Row.class_eval do
Formotion::Row.const_set("PROPERTIES", Formotion::Row.const_get("PROPERTIES") + [:style_id, :style_class] )
[:style_id, :style_class].each {|prop|
attr_accessor prop
}
end
###app/some_form.rb
...
rows: [{
type: :button,
title: "Sign Up",
style_class: "submit",
style_id: "submit"
}]
...