rich_table_component 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,10 @@
1
1
  - rtc_controller_name ||= controller_name
2
2
  - the_klass = instance_variable_get("@#{rtc_controller_name}").klass
3
3
  - search_key ||= 'q'
4
+ - search_action ||= search_action
4
5
  - advanced_search_attributes ||= nil
5
6
 
6
- = simple_form_for instance_variable_get("@#{search_key}"), as: search_key.to_sym, url: '#', html: {method: :get, id: "#{rtc_controller_name}_advanced_search", class: 'rtc_advanced_search form-horizontal'}, remote: true do |f|
7
+ = simple_form_for instance_variable_get("@#{search_key}"), as: search_key.to_sym, url: search_action.presence || '#', html: {method: :get, id: "#{rtc_controller_name}_advanced_search", class: 'rtc_advanced_search form-horizontal'}, remote: true do |f|
7
8
  - advanced_search_attributes.compact.each do |att|
8
9
 
9
10
  - # Check attribute type, then breakdown att
@@ -25,7 +26,8 @@
25
26
  - label_name ||= [splitter.last, attribute_name].compact.join('_')
26
27
 
27
28
  - if att_params.present?
28
- = f.input "#{underscore_attribute}_eq".to_sym, att_params.merge!({required: false})
29
+ - ransack_predicate = (att_params[:ransack_predicate].presence || :eq).to_s
30
+ = f.input "#{underscore_attribute}_#{ransack_predicate}".to_sym, att_params.merge!({required: false})
29
31
  - else
30
32
 
31
33
  - case attribute_type
@@ -22,7 +22,8 @@
22
22
  - label_name ||= [splitter.last, attribute_name].compact.join('_')
23
23
 
24
24
  - if att_params.present?
25
- = f.input "#{underscore_attribute}_eq".to_sym, att_params.merge!({required: false})
25
+ - ransack_predicate = (att_params[:ransack_predicate].presence || :eq).to_s
26
+ = f.input "#{underscore_attribute}_#{ransack_predicate}".to_sym, att_params.merge!({required: false})
26
27
  - else
27
28
 
28
29
  - case attribute_type
@@ -1,5 +1,6 @@
1
1
  - rtc_controller_name ||= controller_name
2
2
  - search_constraint ||= nil
3
+ - search_action ||= nil
3
4
  - search_key ||= 'q'
4
5
  - rtc_title = true if rtc_title.nil?
5
6
  - rtc_header = true if rtc_header.nil?
@@ -35,6 +36,7 @@
35
36
 
36
37
  = render "rich_table_component/rtc/component_content",
37
38
  search_constraint: search_constraint,
39
+ search_action: search_action,
38
40
  search_key: search_key,
39
41
  headers: headers,
40
42
  rtc_header: rtc_header,
@@ -1,6 +1,6 @@
1
1
  - rtc_controller_name ||= controller_name
2
2
  - rtc_title = true if rtc_title.nil?
3
- - the_klass = instance_variable_get("@#{rtc_controller_name}").klass
3
+ - the_klass = instance_variable_get("@#{rtc_controller_name}").respond_to?(:klass) ? instance_variable_get("@#{rtc_controller_name}").klass : Array
4
4
  - the_klass_name = the_klass.name
5
5
  - add_form_remote = true if add_form_remote.nil?
6
6
  - rtc_button_new = true if rtc_button_new.nil?
@@ -5,6 +5,7 @@
5
5
  - rtc_partial = rtc_controller_name.singularize if rtc_partial.nil?
6
6
  - toggle_view = false if toggle_view.nil?
7
7
  - rtc_empty_data_message = sanitize "Data #{t(rtc_controller_name)} kosong" if rtc_empty_data_message.nil?
8
+ - search_action ||= nil
8
9
  - search_key ||= 'q'
9
10
  - advanced_search_attributes ||= nil
10
11
  - columns_width = columns_width.presence || []
@@ -14,6 +15,7 @@
14
15
  - if rtc_header.present?
15
16
  = render "rich_table_component/rtc/header",
16
17
  search_constraint: search_constraint.presence || nil,
18
+ search_action: search_action,
17
19
  search_key: search_key,
18
20
  rtc_controller_name: rtc_controller_name,
19
21
  rtc_partial: rtc_partial,
@@ -1,6 +1,7 @@
1
1
  - rtc_controller_name ||= controller_name
2
2
  - toggle_view = false if toggle_view.nil?
3
3
  - rtc_partial = rtc_controller_name.singularize if rtc_partial.nil?
4
+ - search_action ||= search_action
4
5
  - search_key ||= 'q'
5
6
  - advanced_search_attributes ||= nil
6
7
  - table_title ||= nil
@@ -16,8 +17,7 @@
16
17
 
17
18
  - if search_constraint.present?
18
19
  .rtc_item.right
19
- = search_form_for instance_variable_get("@#{search_key}"), as: search_key.to_sym, url: '#', html: {method: :get, class: "rtc_search input-append", style: 'margin-bottom: 0px'}, remote: true do |f|
20
-
20
+ = search_form_for instance_variable_get("@#{search_key}"), as: search_key.to_sym, url: search_action.presence || '#', html: {method: :get, class: "rtc_search input-append", style: 'margin-bottom: 0px'}, remote: true do |f|
21
21
  - new_params = Hash.new
22
22
  - new_params.merge! params
23
23
  - if search_constraint.instance_of?(Hash) && search_constraint[:params].present?
@@ -50,6 +50,7 @@
50
50
  .rtc_header_expanded
51
51
  - if advanced_search_attributes.present?
52
52
  = render "rich_table_component/rtc/advanced_search",
53
+ search_action: search_action,
53
54
  search_key: search_key,
54
55
  rtc_controller_name: rtc_controller_name,
55
56
  advanced_search_attributes: advanced_search_attributes,
@@ -1,3 +1,3 @@
1
1
  module RichTableComponent
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -292,6 +292,7 @@ module RichTableComponent
292
292
  .joins{gd_col[:splitter].inject((gd_col[:splitter].present? ? self : nil), :__send__)}
293
293
 
294
294
 
295
+ params[:q] = params[:q].each_with_object({}){|i, memo| i.first.to_s.end_with?('_present') && i.last.eql?('0') ? memo[(i.first.to_s[0..-9] + '_blank').to_sym] = '1' : memo[i.first] = i.last}
295
296
  @q = q_join_table.search(params[:q])
296
297
  join_table = @q.result
297
298
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rich_table_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-10 00:00:00.000000000 Z
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass-rails