Class: Kablam::Forms
- Inherits:
-
Object
- Object
- Kablam::Forms
- Defined in:
- lib/kablam/forms.rb
Class Method Summary collapse
- .default_classes ⇒ Object
- .render_destroy(obj, opt = {}) ⇒ Object
- .render_edit(obj, target_id, table_id, opt = {}) ⇒ Object
Class Method Details
.default_classes ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kablam/forms.rb', line 11 def self.default_classes { # Generally used classes for everything. form_wrapper: Kablam.form_wrapper, submit_button: Kablam., form_group: Kablam.form_group, field_label: Kablam.field_label, field_hint: Kablam.field_hint, pretext_wrapper: Kablam.pretext_wrapper, pretext: Kablam.pretext, # Classes for the acutal from field input/select html items: input: Kablam.input, textarea: Kablam.textarea, select: Kablam.dropdown_select, file_upload: Kablam.file_upload, file_upload_icon: Kablam.file_upload_icon, # Classes for checkboxes checkbox_group_wrapper: Kablam.checkbox_group_wrapper, checkbox_wrapper: Kablam.checkbox_wrapper, checkbox_label: Kablam.checkbox_label, checkbox: Kablam.checkbox, # Classes for Multi-Inputs multi_input_group: Kablam.multi_input_group, multi_add_button: Kablam., multi_remove_button: Kablam., multi_add_icon: Kablam.multi_add_icon, multi_remove_icon: Kablam.multi_remove_icon } end |
.render_destroy(obj, opt = {}) ⇒ Object
7 8 9 |
# File 'lib/kablam/forms.rb', line 7 def self.render_destroy(obj, opt={}) "<a data-disable-with=\'…\' class=\'#{opt[:class]}\' data-remote=\'true\' rel=\'nofollow\' data-method=\'delete\' href=\'/kablam/#{obj.class.table_name}/#{obj.id}\'>#{opt[:text] || "Remove"}</a>" end |
.render_edit(obj, target_id, table_id, opt = {}) ⇒ Object
3 4 5 |
# File 'lib/kablam/forms.rb', line 3 def self.render_edit(obj, target_id, table_id, opt={}) "<a class=\'#{opt[:class]}\' onclick=\'event.preventDefault();load(\"#{target_id}\", \"/kablam/#{obj.class.table_name}/form?id=#{obj.id}&target=#{table_id}\")\' href=\'#\'>#{opt[:text] || "Edit"}</a>" end |