Sha256: 35178409eebfaa588af0d7c4631c1cf5222391dc4fcbaa8a36206d2c3bd62fcd
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 KB
Contents
# encoding: utf-8 # text_field, text_area -> value = raw_data[key] # raw_data == user: {}, tags: [{name: "Ruby"}] # form = PostForm.new(@post.values, Author.all) class PostForm < Formidable::Form namespace :post def initialize(raw_data, authors) super(raw_data) @authors = authors end text_field(:title) .validate_presence. text_field(:title) do validate_presence end check_box(:published) text_area group(:tydenni_menu) do check_box :svickova check_box :knedlo_zelo validate do self.fields.inject(0) do |sum, check_box| sum += 1 if check_box.selected? sum end end end select(:author) do @authors.each do |author| option selected: (author == raw_data[:author]) end end submit(value: "Save") button(type: "submit") { "Save" } field(:password, id: "sdf") do validate_length (0..10) validate do form.password_confirmation == value end end field(:password_confirmation) do validate { form.password == value } end fields_for(:author) do field() end # <fieldset> # <legend>User</legend> # </fieldset> fieldset("User") do field(:name) end field(:tags, id: -> { |tag| "tag-#{tag.id}"}, array: true) end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
formidable-0.1.2 | examples/post.rb |
formidable-0.1.1 | examples/post.rb |
formidable-0.1 | examples/post.rb |
formidable-0.0.1 | examples/post.rb |