lib/lotus/helpers/form_helper.rb in lotus-helpers-0.2.0 vs lib/lotus/helpers/form_helper.rb in lotus-helpers-0.2.5
- old
+ new
@@ -36,17 +36,18 @@
# * <tt>hidden_field</tt>
# * <tt>file_field</tt>
# * <tt>fields_for</tt>
# * <tt>form_for</tt>
# * <tt>label</tt>
+ # * <tt>text_area</tt>
# * <tt>text_field</tt>
# * <tt>password_field</tt>
# * <tt>radio_button</tt>
# * <tt>select</tt>
# * <tt>submit</tt>
#
- # @since x.x.x
+ # @since 0.2.0
#
# @see Lotus::Helpers::FormHelper#form_for
# @see Lotus::Helpers::HtmlHelper
#
# @example One output block (template)
@@ -75,47 +76,47 @@
# #
# # <%= my_form %>
module FormHelper
# Default HTTP method for form
#
- # @since x.x.x
+ # @since 0.2.0
# @api private
DEFAULT_METHOD = 'POST'.freeze
# Default charset
#
- # @since x.x.x
+ # @since 0.2.0
# @api private
DEFAULT_CHARSET = 'utf-8'.freeze
# CSRF Token session key
#
# This key is shared with <tt>lotusrb</tt>, <tt>lotus-controller</tt>.
#
- # @since x.x.x
+ # @since 0.2.0
# @api private
CSRF_TOKEN = :_csrf_token
# Form object
#
- # @since x.x.x
+ # @since 0.2.0
class Form
# @return [Symbol] the form name
#
- # @since x.x.x
+ # @since 0.2.0
# @api private
attr_reader :name
# @return [String] the form action
#
- # @since x.x.x
+ # @since 0.2.0
# @api private
attr_reader :url
# @return [::Hash] the form values
#
- # @since x.x.x
+ # @since 0.2.0
# @api private
attr_reader :values
# Initialize a form
#
@@ -140,11 +141,11 @@
# @param values [Hash,NilClass] a Hash of values to be used to autofill
# <tt>value</tt> attributes for fields
# @param attributes [Hash,NilClass] a Hash of attributes to pass to the
# <tt>form</tt> tag
#
- # @since x.x.x
+ # @since 0.2.0
#
# @example Pass A Value
# # Given the following view
#
# module Web::Views::Deliveries
@@ -204,11 +205,11 @@
# Return the method specified by the given attributes or fall back to
# the default value
#
# @return [String] the method for the action
#
- # @since x.x.x
+ # @since 0.2.0
# @api private
#
# @see Lotus::Helpers::FormHelper::DEFAULT_METHOD
def verb
@attributes.fetch(:method, DEFAULT_METHOD)
@@ -232,11 +233,11 @@
# @param attributes [Hash] HTML attributes to pass to the form tag and form values
# @param blk [Proc] A block that describes the contents of the form
#
# @return [Lotus::Helpers::FormHelper::FormBuilder] the form builder
#
- # @since x.x.x
+ # @since 0.2.0
#
# @see Lotus::Helpers::FormHelper
# @see Lotus::Helpers::FormHelper::Form
# @see Lotus::Helpers::FormHelper::FormBuilder
#
@@ -408,10 +409,10 @@
#
# It returns <tt>nil</tt> if sessions aren't enabled or the value is missing.
#
# @return [String,NilClass] token, if present
#
- # @since x.x.x
+ # @since 0.2.0
def csrf_token
if defined?(session)
session[CSRF_TOKEN]
elsif defined?(locals) && locals[:session]
locals[:session][CSRF_TOKEN]