visual_condition_builder 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/lib/visual_condition_builder/version.rb +1 -1
- metadata +2 -6
- data/app/models/visual_condition_builder/user.rb +0 -10
- data/app/views/visual_condition_builder/widgets/_widgets_list.html.erb +0 -24
- data/app/views/visual_condition_builder/widgets/index.html.erb +0 -25
- data/config/routes.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c78cc1e6b87b5f54ccace4818ed2c0e82efa7c
|
4
|
+
data.tar.gz: 951b839bdc445aeeca7c739dbc21e0eb67eee10e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 989b711a0ff5d50d3e3c31830fb2ef6ae6d7419bb43d69563f1d0b5861002da827021c755bafe4189b34b76f0a6816912c0da99f5af09d59b4e27bed91712681
|
7
|
+
data.tar.gz: 98e201e9d06285c11a8e87e1cefa8840f1318e31b9c033ed410c7bd4a12b6c92902c0c9dc16c189fdbfc53a1525fd9459c0c7898a647dd049dd34f756913d39f
|
data/README.md
CHANGED
@@ -199,7 +199,7 @@ end
|
|
199
199
|
Dictionary Class have public methods to get informations about self:
|
200
200
|
* fields(dictionary_context_name)
|
201
201
|
* dictionary(dictionary_context_name)
|
202
|
-
*
|
202
|
+
* dictionary(dictionary_context_name, rails_request)
|
203
203
|
* dictionaries
|
204
204
|
|
205
205
|
```ruby
|
@@ -215,7 +215,7 @@ class ExampleDictionary < VisualConditionBuilder::Dictionary
|
|
215
215
|
param :age
|
216
216
|
end
|
217
217
|
|
218
|
-
dictionary :
|
218
|
+
dictionary :app_request do
|
219
219
|
param :cities, values: -> { ajax_cities_path }
|
220
220
|
end
|
221
221
|
|
@@ -237,11 +237,11 @@ ExampleDictionary.dictionary(:complex)
|
|
237
237
|
ExampleDictionary.dictionaries
|
238
238
|
# => {: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}]}
|
239
239
|
|
240
|
-
ExampleDictionary.dictionary(:
|
240
|
+
ExampleDictionary.dictionary(:app_request)
|
241
241
|
# => [{:values=>#<Proc:0x00000008ddffb0@/path_to_project/app/condition_dictionaries/example_dictionary.rb:12 (lambda)>, :type=>"STRING", ...
|
242
242
|
|
243
|
-
ExampleDictionary.
|
244
|
-
# => [{:values=>"/
|
243
|
+
ExampleDictionary.dictionary(:app_request, rails_app_request)
|
244
|
+
# => [{:values=>"/cities/ajax", :type=>"STRING", ...
|
245
245
|
```
|
246
246
|
|
247
247
|
## Helpers
|
@@ -277,7 +277,7 @@ Mas você pode fazer a geração da lista de campos manualmente através do mét
|
|
277
277
|
|
278
278
|
#### (view) build_conditions(name_of_dictionary, *arguments)
|
279
279
|
|
280
|
-
|
280
|
+
How create condition builder in you view:
|
281
281
|
```haml
|
282
282
|
= form_tag obrigacoes_path, method: :get do
|
283
283
|
-# condition builder don't create input field with values, create it:
|
@@ -287,6 +287,7 @@ Cria o gerador de condições na sua view:
|
|
287
287
|
-# Conditions Element
|
288
288
|
= build_conditions :example, input: '#my_conditions', select2Config: {allowClear: true}
|
289
289
|
```
|
290
|
+
|
290
291
|
Por padrão será gerado um elemento com o id no padrão dictionary_name + context_name + condition_container: `example_default_condition_container`
|
291
292
|
|
292
293
|
Para criar baseado em um dicionário de contexto específico use:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visual_condition_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Porto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A great and easy visual condition builder to your rails project
|
14
14
|
email:
|
@@ -81,13 +81,9 @@ files:
|
|
81
81
|
- app/controllers/application_dictionary.rb
|
82
82
|
- app/controllers/visual_condition_builder/application_controller.rb
|
83
83
|
- app/helpers/visual_condition_builder/application_helper.rb
|
84
|
-
- app/models/visual_condition_builder/user.rb
|
85
|
-
- app/views/visual_condition_builder/widgets/_widgets_list.html.erb
|
86
|
-
- app/views/visual_condition_builder/widgets/index.html.erb
|
87
84
|
- config/initializers/assets.rb
|
88
85
|
- config/initializers/visual_condition_builder.rb
|
89
86
|
- config/locales/visual_condition_builder.en.yml
|
90
|
-
- config/routes.rb
|
91
87
|
- lib/generators/templates/generic_dictionary.erb
|
92
88
|
- lib/generators/visual_condition_builder/dictionary_generator.rb
|
93
89
|
- lib/generators/visual_condition_builder/install_generator.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<% ApplicationWidget.widgets.each do |widget| %>
|
2
|
-
<ul>
|
3
|
-
<li>
|
4
|
-
<b><%= widget[:name] %></b>
|
5
|
-
<br><span class="help-block"><%= widget[:description] %></span>
|
6
|
-
<ul>
|
7
|
-
<% widget[:actions].each do |action| %>
|
8
|
-
<% widget_code = "#{widget[:code]}_#{action[:name]}" %>
|
9
|
-
<li>
|
10
|
-
<div class="checkbox">
|
11
|
-
<%= label_tag widget_code do %>
|
12
|
-
<%= check_box_tag 'widgets[]', "#{widget[:code]}|#{action[:name]}", @widgets_code.include?(widget_code), {id: widget_code} %>
|
13
|
-
<b><%= action[:name].to_s.humanize %></b>
|
14
|
-
<% if action[:description].present? %>
|
15
|
-
<br><span class="help-block"><%= action[:description] %></span>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
18
|
-
</div>
|
19
|
-
</li>
|
20
|
-
<% end %>
|
21
|
-
</ul>
|
22
|
-
</li>
|
23
|
-
</ul>
|
24
|
-
<% end %>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<div class="col-md-12">
|
3
|
-
<div class="panel panel-default">
|
4
|
-
<div class="panel-heading">
|
5
|
-
<div class="panel-title">Selecione os Widgets que deseja utilizar:</div>
|
6
|
-
</div>
|
7
|
-
<div class="panel-body">
|
8
|
-
<%= form_tag(visual_condition_builder_save_path, method: :put, class: 'widget_config') do %>
|
9
|
-
|
10
|
-
<div class="form-group">
|
11
|
-
<label class="control-label">Usuário:</label>
|
12
|
-
<%= select_tag :user_id, options_from_collection_for_select(User.all, :id, :email, current_user.id), include_blank: false, class: 'form-control widget-user-control' %>
|
13
|
-
</div>
|
14
|
-
|
15
|
-
<fieldset class="widgets_list">
|
16
|
-
<legend>Widgets</legend>
|
17
|
-
<div class="list"></div>
|
18
|
-
</fieldset>
|
19
|
-
|
20
|
-
<%= submit_tag "Salvar", class: 'btn btn-success' %>
|
21
|
-
<% end %>
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
</div>
|
data/config/routes.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Rails.application.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
namespace :visual_condition_builder do
|
5
|
-
|
6
|
-
get 'widgets/load/:widget_name/:widget_action', to: 'widgets#load', as: 'load'
|
7
|
-
get 'widgets/user(/:id)', to: 'widgets#user', as: 'user'
|
8
|
-
get 'widgets', to: 'widgets#index', as: ''
|
9
|
-
put 'widgets/save', to: 'widgets#save', as: 'save'
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|