README.md in visual_condition_builder-2.1.2 vs README.md in visual_condition_builder-2.1.3

- old
+ new

@@ -258,19 +258,18 @@ ``` #### (view) conditions_fields(name_of_dictionary) Creates a field selector in a dropdown element (bootstrap). -Cria um seletor de campos em um elemento dropdown (bootstrap). - ```haml = conditions_fields :example -# with context: = conditions_fields({:dictionary_name => :context_name}) ``` -Mas você pode fazer a geração da lista de campos manualmente através do método `ExampleDictionary.fields(dictionary_name)` *(example_dictionary.rb)*, nesse caso você deve ter elementos "clicáveis" com a classe `add-condition-field` e atributo `data-field: field_name` +You can create the list item manually `ExampleDictionary.fields (dictionary_name)` *(example_dictionary.rb)*, +you must have 'clickable' elements with an `add-condition-field` class and `data-field: field_name` attribute ```haml %a.add-condition-field{href: '#', data: {field: 'name'}} Name %a.add-condition-field{href: '#', data: {field: 'age'}} Age %a.add-condition-field{href: '#', data: {field: 'example'}} Example Field ``` @@ -285,28 +284,34 @@ -# DropDown with fields = conditions_fields :example -# Conditions Element = build_conditions :example, input: '#my_conditions', select2Config: {allowClear: true} ``` +Default element id: dictionary_name + context_name + condition_container: `example_default_condition_container` -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: +To create based on a specific context dictionary use: ```haml = build_conditions({:dictionary_name => :context_name}, input: '#my_conditions', select2Config: {allowClear: true}) ``` -Os argumentos possíveis para o build_conditions são: +Its possible change `conditions_fields` title: +```haml += conditions_fields :example, title: 'Click here to select a field' +``` + + +Possible arguments for build_conditions are: + Param | Description --- | --- placeholder | Placeholder for inputs {operators: 'Select a operator...', values: 'Enter a value...'}, values | initial values to fill conditions, format: [[field, operator, value], [field, operator, [value1, value2]]] input | to get initial values and save values on change from a html element, like: #my_input_element debug | to see debugs flags. default: false numericConfig | When the field is decimal type then the generator will create an input with numeric mask. Default {aSep: '', aDec: '.', aSign: ''}. See [Auto Numeric Plugin](https://github.com/BobKnothe/autoNumeric#default-settings--supported-options) select2Config: | Select2 Configuration. Default {theme: "bootstrap", width: 'auto', placeholder: '', allowClear: false, dropdownAutoWidth: 'true', tags: false, language: "en"}, but some parameters can be overwritten by condition builder. See [Select2 Plugin](https://github.com/select2/select2) -Também é possível criar o builder manualmente chamando o plugin jquery diretamente: +You can also create the builder manually by calling the jquery plugin: ```javascript //my_dictionary_json = ExampleDictionary.dictionary(:example).to_json //my_initial_values = [['name','eq','My Name']] var builder = $('#div-container').conditionBuilder({ placeholder: {values: 'Select a Value'}, \ No newline at end of file