README.md in visual_condition_builder-0.1.3 vs README.md in visual_condition_builder-0.1.4
- old
+ new
@@ -197,11 +197,11 @@
### Methods
Dictionary Class have public methods to get informations about self:
* fields(dictionary_context_name)
* dictionary(dictionary_context_name)
-* .new(rails_context).dictionary(dictionary_context_name)
+* dictionary(dictionary_context_name, rails_request)
* dictionaries
```ruby
#example_dictionary.rb
class ExampleDictionary < VisualConditionBuilder::Dictionary
@@ -213,11 +213,11 @@
dictionary :complex do
param :name
param :age
end
- dictionary :with_app_request do
+ dictionary :app_request do
param :cities, values: -> { ajax_cities_path }
end
end
@@ -235,15 +235,15 @@
# => [{:type=>"STRING", :operators=>[{:operator=>:cont, :multiple=>false, :no_value=>false, :label=>"Contém"}, {:operator=>:eq, :multiple=>false, :no_value=>false, :label=>"Igual"}, {:operator=>:start, :multiple=>false, :no_value=>false, :label=>"Começa com"}, {:operator=>:end, :multiple=>false, :no_value=>false, :label=>"Termina com"}, {:operator=>:present, :no_value=>true, :multiple=>false, :label=>"Presente"}, {:operator=>:blank, :no_value=>true, :multiple=>false, :label=>"Não Presente"}], :values=>[], :group=>"", :label=>"Name", :field=>:name}, {:type=>"STRING", :operators=>[{:operator=>:cont, :multiple=>false, :no_value=>false, :label=>"Contém"}, {:operator=>:eq, :multiple=>false, :no_value=>false, :label=>"Igual"}, {:operator=>:start, :multiple=>false, :no_value=>false, :label=>"Começa com"}, {:operator=>:end, :multiple=>false, :no_value=>false, :label=>"Termina com"}, {:operator=>:present, :no_value=>true, :multiple=>false, :label=>"Presente"}, {:operator=>:blank, :no_value=>true, :multiple=>false, :label=>"Não Presente"}], :values=>[], :group=>"", :label=>"Age", :field=>:age}]
ExampleDictionary.dictionaries
# => {:default=>[{:type=>"STRING", :operators=>[{:operator=>:cont, :multiple=>false, :no_value=>false, :label=>"Contém"}, {:operator=>:eq, :multiple=>false, :no_value=>false, :label=>"Igual"}, {:operator=>:start, :multiple=>false, :no_value=>false, :label=>"Começa com"}, {:operator=>:end, :multiple=>false, :no_value=>false, :label=>"Termina com"}, {:operator=>:present, :no_value=>true, :multiple=>false, :label=>"Presente"}, {:operator=>:blank, :no_value=>true, :multiple=>false, :label=>"Não Presente"}], :values=>[], :group=>"", :label=>"Name", :field=>:name}], :padrao=>[{:type=>"STRING", :operators=>[{:operator=>:cont, :multiple=>false, :no_value=>false, :label=>"Contém"}, {:operator=>:eq, :multiple=>false, :no_value=>false, :label=>"Igual"}, {:operator=>:start, :multiple=>false, :no_value=>false, :label=>"Começa com"}, {:operator=>:end, :multiple=>false, :no_value=>false, :label=>"Termina com"}, {:operator=>:present, :no_value=>true, :multiple=>false, :label=>"Presente"}, {:operator=>:blank, :no_value=>true, :multiple=>false, :label=>"Não Presente"}], :values=>[], :group=>"", :label=>"Name", :field=>:name}, {:type=>"STRING", :operators=>[{:operator=>:cont, :multiple=>false, :no_value=>false, :label=>"Contém"}, {:operator=>:eq, :multiple=>false, :no_value=>false, :label=>"Igual"}, {:operator=>:start, :multiple=>false, :no_value=>false, :label=>"Começa com"}, {:operator=>:end, :multiple=>false, :no_value=>false, :label=>"Termina com"}, {:operator=>:present, :no_value=>true, :multiple=>false, :label=>"Presente"}, {:operator=>:blank, :no_value=>true, :multiple=>false, :label=>"Não Presente"}], :values=>[], :group=>"", :label=>"Age", :field=>:age}]}
-ExampleDictionary.dictionary(:with_app_request)
+ExampleDictionary.dictionary(:app_request)
# => [{:values=>#<Proc:0x00000008ddffb0@/path_to_project/app/condition_dictionaries/example_dictionary.rb:12 (lambda)>, :type=>"STRING", ...
-ExampleDictionary.new(rails_app_request).dictionary(:with_app_context)
-# => [{:values=>"/municipios/ajax", :type=>"STRING", ...
+ExampleDictionary.dictionary(:app_request, rails_app_request)
+# => [{:values=>"/cities/ajax", :type=>"STRING", ...
```
## Helpers
#### (class) dictionary_values(param_id, param_label)
@@ -275,19 +275,20 @@
%a.add-condition-field{href: '#', data: {field: 'example'}} Example Field
```
#### (view) build_conditions(name_of_dictionary, *arguments)
-Cria o gerador de condições na sua view:
+How create condition builder in you view:
```haml
= form_tag obrigacoes_path, method: :get do
-# condition builder don't create input field with values, create it:
= hidden_field_tag('my_conditions', @example_conditions.to_json)
-# DropDown with fields
= conditions_fields :example
-# Conditions Element
= build_conditions :example, input: '#my_conditions', select2Config: {allowClear: true}
```
+
Por padrão será gerado um elemento com o id no padrão dictionary_name + context_name + condition_container: `example_default_condition_container`
Para criar baseado em um dicionário de contexto específico use:
```haml
= build_conditions({:dictionary_name => :context_name}, input: '#my_conditions', select2Config: {allowClear: true})
\ No newline at end of file