ransack_advanced_search 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18acf6ba76b1063a77f370256be06b835f8163b8
4
- data.tar.gz: 615e325278e36fac5deb9b8d4979d4fe8838a13c
3
+ metadata.gz: 9b4430ab2e41dffc747b12024eef7a28aedc09b1
4
+ data.tar.gz: 281af7a21966b4f0f9303c0f5719f8b34aad12e3
5
5
  SHA512:
6
- metadata.gz: f49634d2bd23a822b0b1334b2047878ed91a12196e0687b51b025803e35be5331cf5be35de847798fc51bf496b86136e5792b936b9e4339052c7582fc5092944
7
- data.tar.gz: f6d3267818bf9da9882ca01635a995af3db2f50a2b17e83f2780aac08c1e1ca5ba0703cb0a0f89240bbd718dff9b9553e39ca1f85d13a4f0d9c8a2ffe349c2c4
6
+ metadata.gz: d2674f59ca3ef29c7a5ab612aa5dd8e55d5209dfd27b193a45aadfec411c6733e3190ce638ccc497d7f74f235c1747dc138c9995c5358d4e88d860027379a0d5
7
+ data.tar.gz: 025200200028ca0e9a8f68e20c6f3a2a38d76dec5456bc44e846e84148c6eea6edea8e7e5a95097ea7d44bcf10a1ab144c334517edda9750e25b0e7494ca16ba
data/README.md CHANGED
@@ -10,7 +10,8 @@ The `ransack_advanced_search` gem provides Bootstrap based templates for the [ra
10
10
  * Full [ransack](https://github.com/activerecord-hackery/ransack) compatibility (you can still use the default [ransack](https://github.com/activerecord-hackery/ransack) features);
11
11
  * Ransack integrated Advanced Search mode with helpers and views - extracted from [ransack-demo](https://github.com/activerecord-hackery/ransack_demo) project;
12
12
  * Saved Searches, scoped by contexts, to persist search params and use it in the future;
13
- * TODO: custom search value inputs based on data type.
13
+ * Custom search value inputs based on data type;
14
+ * TODO: scope by current user or current account (abstract scope).
14
15
 
15
16
  ## Installation
16
17
 
@@ -12,7 +12,8 @@
12
12
  *= require_tree .
13
13
  */
14
14
 
15
- .ransack-advanced-search i.remove_fields {
15
+ .ransack-advanced-search i.remove_fields,
16
+ .ransack-advanced-search i.add_fields {
16
17
  cursor: pointer;
17
18
  }
18
19
 
@@ -26,5 +27,5 @@
26
27
  }
27
28
 
28
29
  .ransack-advanced-search .ransack-saved-search-delete {
29
- margin: 7px;
30
+ margin-top: 1px;
30
31
  }
@@ -11,7 +11,7 @@ module RansackAdvancedSearchHelper
11
11
  fieldName = $(this).find('option:selected')[0].value;
12
12
  search.changeValueInputsType(this, fieldName, search);
13
13
  });
14
- $(document).on("click", "button.add_fields", function() {
14
+ $(document).on("click", "i.add_fields", function() {
15
15
  search.add_fields(this, $(this).data('fieldType'), $(this).data('content'));
16
16
  if($(this).hasClass('ransack-add-attribute')) {
17
17
  fieldName = $(this).parents('.ransack-condition-field').find('select.ransack-attribute-select').find('option:selected')[0].value;
@@ -47,7 +47,7 @@ module RansackAdvancedSearchHelper
47
47
  end
48
48
 
49
49
  def button_to_remove_fields
50
- content_tag :i, nil, class: 'remove_fields glyphicon glyphicon-remove text-danger'
50
+ content_tag :i, nil, class: 'remove_fields glyphicon glyphicon-minus-sign text-danger'
51
51
  end
52
52
 
53
53
  def button_to_add_fields(name, f, type, custom_class='')
@@ -55,7 +55,7 @@ module RansackAdvancedSearchHelper
55
55
  fields = f.send("#{type}_fields", new_object, child_index: "new_#{type}") do |builder|
56
56
  render('ransack_advanced_search/' + type.to_s + "_fields", f: builder)
57
57
  end
58
- content_tag :button, name, :class => custom_class + ' add_fields btn btn-default btn-sm', :type => 'button', 'data-field-type' => type, 'data-content' => "#{fields}"
58
+ content_tag :i, name, :class => custom_class + ' add_fields glyphicon glyphicon-plus-sign text-success', :type => 'button', 'data-field-type' => type, 'data-content' => "#{fields}"
59
59
  end
60
60
 
61
61
  def button_to_nest_fields(name, type)
@@ -3,7 +3,7 @@
3
3
  <div class="row">
4
4
  <% if RansackAdvancedSearch.enable_saved_searches %>
5
5
  <div class="col-md-4">
6
- <%= render 'ransack_advanced_search/saved_searches_list' %>
6
+ <%= render 'ransack_advanced_search/saved_searches_list', redirect_path: redirect_path %>
7
7
  </div>
8
8
  <div class="col-md-8">
9
9
  <% else %>
@@ -29,7 +29,7 @@
29
29
  <%= f.sort_fields do |s| %>
30
30
  <%= render 'ransack_advanced_search/sort_fields', f: s %>
31
31
  <% end %>
32
- <%= button_to_add_fields t('ransack.advanced_search.sort.add'), f, :sort %>
32
+ <%= button_to_add_fields '', f, :sort %>
33
33
  </div>
34
34
 
35
35
  <h4><%= t('ransack.advanced_search.condition_group.title') %></h4>
@@ -37,8 +37,7 @@
37
37
  <%= f.grouping_fields do |g| %>
38
38
  <%= render 'ransack_advanced_search/grouping_fields', f: g %>
39
39
  <% end %>
40
- <%= button_to_add_fields t('ransack.advanced_search.condition_group.add'),
41
- f, :grouping %>
40
+ <%= button_to_add_fields '', f, :grouping %>
42
41
  </div>
43
42
 
44
43
  <!-- <%= label_tag :distinct, 'Return distinct records?' %> -->
@@ -51,18 +50,6 @@
51
50
  <%= f.submit t('ransack.advanced_search.form.save_new_submit_text'), name: 'save_new_search', class: 'btn btn-primary' %>
52
51
  <% end %>
53
52
  <%= link_to t('ransack.advanced_search.form.clear_search_text'), redirect_path, class: 'btn btn-default' %>
54
- <% if RansackAdvancedSearch.enable_saved_searches %>
55
- <% if @saved_search.present? && @saved_search.persisted? %>
56
- <div class="pull-right ransack-saved-search-delete">
57
- <%= link_to saved_search_path(id: @saved_search.id, redirect_to: redirect_path),
58
- { method: :delete, title: t('ransack.advanced_search.form.delete_saved_search'),
59
- data: { confirm: t('ransack.advanced_search.form.delete_saved_search_confirm'),
60
- toggle: 'tooltip', placement: 'bottom' } } do %>
61
- <icon class="glyphicon glyphicon-trash text-danger"></i>
62
- <% end %>
63
- </div>
64
- <% end %>
65
- <% end %>
66
53
  </div>
67
54
  <% end %>
68
55
  </div>
@@ -2,8 +2,7 @@
2
2
  class: 'fields condition ransack-condition-field', 'data-object-name' => f.object_name
3
3
  } do %>
4
4
 
5
- <%= content_tag(:span, button_to_remove_fields,
6
- nil, false) %>
5
+ <%= content_tag(:span, button_to_remove_fields, {}, false) %>
7
6
 
8
7
  <%= f.attribute_fields do |a| %>
9
8
  <%= render 'ransack_advanced_search/attribute_fields', f: a %>
@@ -15,7 +14,6 @@
15
14
  <%= render 'ransack_advanced_search/value_fields', f: v %>
16
15
  <% end %>
17
16
 
18
- <%= button_to_add_fields t('ransack.advanced_search.attribute_value.add'),
19
- f, :value, 'ransack-add-attribute' %>
17
+ <%= button_to_add_fields '', f, :value, 'ransack-add-attribute' %>
20
18
 
21
19
  <% end %>
@@ -1,5 +1,4 @@
1
- <%= content_tag :div, { class: 'fields',
2
- 'data-object-name' => f.object_name } do %>
1
+ <%= content_tag :div, { class: 'fields', 'data-object-name' => f.object_name } do %>
3
2
 
4
3
  <% remove_able = true if local_assigns[:remove_able].nil? %>
5
4
  <% if remove_able == false %>
@@ -22,8 +21,7 @@
22
21
  <% end %>
23
22
  <% end %>
24
23
 
25
- <%= button_to_add_fields t('ransack.advanced_search.attribute_field.add'),
26
- f, :condition %>
24
+ <%= button_to_add_fields '', f, :condition %>
27
25
 
28
26
  <%= f.grouping_fields do |g| %>
29
27
  <%= render partial: 'ransack_advanced_search/grouping_fields',
@@ -3,14 +3,13 @@
3
3
  <div class="row">
4
4
  <% if RansackAdvancedSearch.enable_saved_searches %>
5
5
  <div class="col-md-4">
6
- <%= render 'ransack_advanced_search/saved_searches_list' %>
6
+ <%= render 'ransack_advanced_search/saved_searches_list', redirect_path: redirect_path %>
7
7
  </div>
8
8
  <div class="col-md-8">
9
9
  <% else %>
10
10
  <div class="col-md-12">
11
11
  <% end %>
12
12
  <%= search_form_for(@search, url: search_url, html: { method: :post, class: 'form-inline', role: 'form' }) do |f| %>
13
-
14
13
  <% setup_search_form f, @search %>
15
14
 
16
15
  <% if RansackAdvancedSearch.enable_saved_searches %>
@@ -34,8 +33,7 @@
34
33
  <%= render partial: 'ransack_advanced_search/grouping_fields',
35
34
  locals: { f: f, remove_able: true } %>
36
35
  <% end %>
37
- <%= button_to_add_fields t('ransack.advanced_search.condition_group.add'),
38
- f, :grouping %>
36
+ <%= button_to_add_fields '', f, :grouping %>
39
37
  <% end %>
40
38
  </div>
41
39
 
@@ -47,18 +45,6 @@
47
45
  <%= f.submit t('ransack.advanced_search.form.save_new_submit_text'), name: 'save_new_search', class: 'btn btn-primary' %>
48
46
  <% end %>
49
47
  <%= link_to t('ransack.advanced_search.form.clear_search_text'), redirect_path, class: 'btn btn-default' %>
50
- <% if RansackAdvancedSearch.enable_saved_searches %>
51
- <% if @saved_search.present? && @saved_search.persisted? %>
52
- <div class="pull-right ransack-saved-search-delete">
53
- <%= link_to saved_search_path(id: @saved_search.id, redirect_to: redirect_path),
54
- { method: :delete, title: t('ransack.advanced_search.form.delete_saved_search'),
55
- data: { confirm: t('ransack.advanced_search.form.delete_saved_search_confirm'),
56
- toggle: 'tooltip', placement: 'bottom' } } do %>
57
- <icon class="glyphicon glyphicon-trash text-danger"></i>
58
- <% end %>
59
- </div>
60
- <% end %>
61
- <% end %>
62
48
  </div>
63
49
  <% end %>
64
50
  </div>
@@ -1,15 +1,25 @@
1
1
  <div class="panel panel-primary">
2
2
  <div class="panel-heading"><%= t('ransack.saved_search.title') %></div>
3
- <div class="list-group lista-buscas">
3
+ <ul class="list-group lista-buscas">
4
4
  <% @saved_searches.each do |saved_search| %>
5
- <%= link_to url_for(saved_search: saved_search.id), method: :post, class: 'list-group-item' do %>
6
- <%= saved_search.description %>
7
- <% end %>
5
+ <li class="list-group-item">
6
+ <%= link_to url_for(saved_search: saved_search.id), method: :post do %>
7
+ <%= saved_search.description %>
8
+ <% end %>
9
+ <div class="pull-right ransack-saved-search-delete">
10
+ <%= link_to saved_search_path(id: saved_search.id, redirect_to: redirect_path),
11
+ { method: :delete, title: t('ransack.advanced_search.form.delete_saved_search'),
12
+ data: { confirm: t('ransack.advanced_search.form.delete_saved_search_confirm'),
13
+ toggle: 'tooltip', placement: 'bottom' } } do %>
14
+ <icon class="glyphicon glyphicon-trash text-danger"></i>
15
+ <% end %>
16
+ </div>
17
+ </li>
8
18
  <% end %>
9
19
  <% if @saved_searches.empty? %>
10
- <%= link_to '#', class: 'list-group-item' do %>
20
+ <li class="list-group-item">
11
21
  <em><%= t('ransack.saved_search.empty_list') %></em>
12
- <% end %>
22
+ </li>
13
23
  <% end %>
14
- </div>
24
+ </ul>
15
25
  </div>
@@ -1,3 +1,3 @@
1
- <%= content_tag(:span,
2
- "#{f.sort_select({}, {class: 'form-control input-sm'})} #{button_to_remove_fields}",
1
+ <%= content_tag(:div,
2
+ "#{button_to_remove_fields} #{f.sort_select({}, {class: 'form-control input-sm'})}",
3
3
  { class: 'fields', 'data-object-name' => f.object_name }, false) %>
@@ -1,3 +1,3 @@
1
1
  module RansackAdvancedSearch
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransack_advanced_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Brusius
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-02 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails