Skip to content

Commit

Permalink
changed syntax to use semantic instead of standard and enhanced helpe…
Browse files Browse the repository at this point in the history
…r naming consistency
  • Loading branch information
nesquena committed Apr 25, 2008
1 parent 87f195f commit 5dcc62c
Show file tree
Hide file tree
Showing 26 changed files with 995 additions and 96 deletions.
102 changes: 102 additions & 0 deletions .svn/entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
8

dir
860
svn+ssh://nate@74.205.71.69/home/svnowner/repository/openPresenceRubyOnRails/trunk/vendor/plugins/semantic_form_builder
svn+ssh://nate@74.205.71.69/home/svnowner/repository



2008-04-14T04:36:21.422973Z
795
nate


svn:special svn:externals svn:needs-lock











75e973b7-daca-42f5-98ca-6c0bed327aa9

.git
dir

MIT-LICENSE
file




2008-04-14T04:27:50.000000Z
ef8a8411d1f142aee549cd9a00a720d5
2008-04-14T04:36:21.422973Z
795
nate

README
file




2008-04-14T04:28:57.000000Z
c7b90e76696dbea2cacf887aac4c1ddf
2008-04-14T04:36:21.422973Z
795
nate

Rakefile
file




2008-04-14T04:27:50.000000Z
3ac693f850bd232d80f07057e2adfa05
2008-04-14T04:36:21.422973Z
795
nate

init.rb
file




2008-04-14T04:27:50.000000Z
b1cb018155b176780c6105f4a47ba407
2008-04-14T04:36:21.422973Z
795
nate
has-props

lib
dir

tasks
dir

test
dir

uninstall.rb
file




2008-04-14T04:27:50.000000Z
2a5fc883fe7f8dfe22ced24643d59ad4
2008-04-14T04:36:21.422973Z
795
nate
has-props

1 change: 1 addition & 0 deletions .svn/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
5 changes: 5 additions & 0 deletions .svn/prop-base/init.rb.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
K 13
svn:mime-type
V 10
text/plain
END
5 changes: 5 additions & 0 deletions .svn/prop-base/uninstall.rb.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
K 13
svn:mime-type
V 10
text/plain
END
20 changes: 20 additions & 0 deletions .svn/text-base/MIT-LICENSE.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2008 [name of plugin creator]

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
68 changes: 68 additions & 0 deletions .svn/text-base/README.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
SemanticFormBuilder
===================

Installation
============

To install, simply add a clone of the git repository to the vendor/plugins directory

$ cd /path/to/rails/app
$ git clone git@github.com:xgamerx/semantic_form_builder.git vendor/plugins/semantic_form_builder

Overview
========

This class is a standardized form builder which works to create semantically correct forms,
each field with the appropriate label and wrapped within a definition list item in order to
represent a list of items using proper xhtml markup.

The tags allowed are as follows:

* fieldset(name:string, &block) - wraps the rest of the form items in a definition list
* text_field_item (attribute:symbol, options_hash:hash)
* password_field_item (attribute:symbol, options_hash:hash)
* file_field_item (attribute:symbol, options_hash:hash)
* text_area_item (attribute:symbol, options_hash:hash)
* check_box_item (attribute:symbol, options_hash:hash)
* radio_button_group (attribute:symbol, options_hash:hash)
* submit_button (label:string) - create a submit button in a definition item

Example
=======

This form builder is rather easy to use as the example illustrates:

- standard_form_for :user, :url => users_path do |f|
- f.fieldset 'Register' do
= f.text_field_item :login, :label => 'Login'
= f.text_field_item :email, :label => 'Email'
= f.password_field_item :password, :label => 'Password'
= f.password_field_item :password_confirmation, :label => 'Password Confirmation'
= f.submit_button 'Sign up'

which generates the following semantically valid markup:

<form method="post" action="/users">
<fieldset>
<legend>Register</legend>
<dl class = "standard-form">
<dt><label for="user_login">Login:</label></dt>
<dd><input type="text" size="30" name="user[login]" id="user_login"/></dd>

<dt><label for="user_email">Email:</label></dt>
<dd><input type="text" size="30" name="user[email]" id="user_email"/></dd>

<dt><label for="user_password">Password:</label></dt>
<dd><input type="password" size="30" name="user[password]" id="user_password"/></dd>

<dt><label for="user_password_confirmation">Password Confirmation:</label></dt>
<dd><input type="password" size="30" name="user[password_confirmation]" id="user_password_confirmation"/></dd>

<dt class="button"/>
<dd class="button"><input type="submit" value="Sign up" name="commit"/></dd>
</dl>
</fieldset>
</form>


Copyright (c) 2008 Nathan Esquenazi, released under the MIT license
22 changes: 22 additions & 0 deletions .svn/text-base/Rakefile.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

desc 'Default: run unit tests.'
task :default => :test

desc 'Test the semantic_form_builder plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end

desc 'Generate documentation for the semantic_form_builder plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'SemanticFormBuilder'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
3 changes: 3 additions & 0 deletions .svn/text-base/init.rb.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require 'semantic_form_builder'
require 'semantic_form_helpers'
ActionView::Base.send :include, SemanticFormBuilder::Helpers
1 change: 1 addition & 0 deletions .svn/text-base/uninstall.rb.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Uninstall hook code here
61 changes: 46 additions & 15 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,40 @@ Overview
========

This class is a standardized form builder which works to create semantically correct forms,
each field with the appropriate label and wrapped within a definition list item in order to
represent a list of items using proper xhtml markup.
each field with the appropriate label and wrapped within a definition list item in order to
represent a list of items using proper xhtml markup.

The tags allowed are as follows:

* fieldset(name:string, &block) - wraps the rest of the form items in a definition list
* text_field_item (attribute:symbol, options_hash:hash)
* password_field_item (attribute:symbol, options_hash:hash)
* file_field_item (attribute:symbol, options_hash:hash)
* text_area_item (attribute:symbol, options_hash:hash)
* check_box_item (attribute:symbol, options_hash:hash)
* radio_button_group (attribute:symbol, options_hash:hash)
* submit_button (label:string) - create a submit button in a definition item
* text_field (attribute:symbol, options_hash:hash)
* password_field (attribute:symbol, options_hash:hash)
* file_field (attribute:symbol, options_hash:hash)
* text_area (attribute:symbol, options_hash:hash)
* check_box (attribute:symbol, options_hash:hash)
* radio_buttons (attribute:symbol, options_hash:hash)
* submit_button (label:string) - create a submit button in a definition item

These methods can be used within the context of a form builder or within any form as simple helper tags:

* semantic_form_for [ model-backed forms ]
* semantic_remote_form_for [ remote model-backed forms ]
* semantic_fields_for [ model-backed fields ]
* semantic_ajaxy_form_for [ ajax model-backed forms ]
* semantic_fieldset_tag [ non-model-backed forms ]

Example
=======

This form builder is rather easy to use as the example illustrates:

- standard_form_for :user, :url => users_path do |f|
- semantic_form_for :user, :url => users_path do |f|
- f.fieldset 'Register' do
= f.text_field_item :login, :label => 'Login'
= f.text_field_item :email, :label => 'Email'
= f.password_field_item :password, :label => 'Password'
= f.password_field_item :password_confirmation, :label => 'Password Confirmation'
= f.submit_button 'Sign up'
= f.text_field :login, :label => 'Login'
= f.text_field :email, :label => 'Email'
= f.password_field :password, :label => 'Password'
= f.password_field :password_confirmation, :label => 'Password Confirmation'
= f.submit_button 'Sign up'

which generates the following semantically valid markup:

Expand All @@ -64,5 +72,28 @@ This form builder is rather easy to use as the example illustrates:
</fieldset>
</form>

Other Examples
==============

Non-Model Backed Form

- form_tag some_url do
- semantic_fieldset_tag "Name" do
= semantic_text_field_tag :username, :label => "Username"
= semantic_password_field_tag :password, :label => "Password"
= semantic_check_box_tag :is_admin, :label => "Administrator?"
= semantic_select_tag :category, @option_values
= semantic_submit_tag "Submit"

Remote Model Backed Form

- semantic_remote_form_for :user, :url => register_url do |u|
- u.fieldset do
= u.text_field "login"
= u.password_field "password"
= u.text_field "email"
= u.text_field "mobile_number", :label => "Mobile No"
= u.password_field "invite_code", :label => 'Invite'
= u.submit_button

Copyright (c) 2008 Nathan Esquenazi, released under the MIT license
54 changes: 54 additions & 0 deletions lib/.svn/entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
8

dir
860
svn+ssh://nate@74.205.71.69/home/svnowner/repository/openPresenceRubyOnRails/trunk/vendor/plugins/semantic_form_builder/lib
svn+ssh://nate@74.205.71.69/home/svnowner/repository



2008-04-14T04:36:21.422973Z
795
nate


svn:special svn:externals svn:needs-lock











75e973b7-daca-42f5-98ca-6c0bed327aa9

semantic_form_builder.rb
file




2008-04-14T04:27:50.000000Z
9a3c475f406067192ea5a5e033ac6070
2008-04-14T04:36:21.422973Z
795
nate
has-props

semantic_form_helpers.rb
file




2008-04-14T04:27:50.000000Z
3a949a79d57c3ec03c3b9ccffad57d5e
2008-04-14T04:36:21.422973Z
795
nate
has-props

1 change: 1 addition & 0 deletions lib/.svn/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
5 changes: 5 additions & 0 deletions lib/.svn/prop-base/semantic_form_builder.rb.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
K 13
svn:mime-type
V 10
text/plain
END
5 changes: 5 additions & 0 deletions lib/.svn/prop-base/semantic_form_helpers.rb.svn-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
K 13
svn:mime-type
V 10
text/plain
END
Loading

0 comments on commit 5dcc62c

Please sign in to comment.