discerner 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/discerner/search_namespace.rb +5 -0
- data/app/views/discerner/searches/_form_combined_searches.html.haml +2 -2
- data/app/views/discerner/searches/_form_search_parameters.html.haml +2 -2
- data/app/views/discerner/searches/_list.html.haml +1 -1
- data/app/views/discerner/searches/_search_combination_fields.html.haml +2 -2
- data/app/views/discerner/searches/_search_parameter_fields.html.haml +4 -4
- data/app/views/discerner/searches/_search_parameter_value_fields.html.haml +5 -5
- data/db/migrate/20140915032427_create_discerner_search_namespaces.rb +9 -0
- data/db/migrate/20140915032608_replace_namespace_columns_with_label_for_searches.rb +37 -0
- data/lib/discerner/methods/helpers/searches_helper.rb +6 -10
- data/lib/discerner/methods/models/search.rb +1 -0
- data/lib/discerner/methods/models/search_namespace.rb +12 -0
- data/lib/discerner/version.rb +1 -1
- data/lib/generators/discerner/install/install_generator.rb +1 -0
- data/lib/generators/discerner/install/templates/models/search_namespace.rb +5 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d003dc673d344a81ba57493c85359cb204d4ec25
|
4
|
+
data.tar.gz: e640b76a3ac01c8651a0daf029fbced903dccac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 965d91c637899dd9d029de35bb03181605bccc6ae5bd76c0742a41f179ebb3b0fc2f747d4e0f853d158ffbd685a253c0edae7fab75f55d097733bea966c7ee23
|
7
|
+
data.tar.gz: 218fb8fdcc5d94e91bb2056214f86f137749ab79d8f157ebb468abd50b230aed202659a61a4209f3b32f297f7e46ae68124df42a7bb4ba96fb54bf37bcd4880b
|
@@ -11,14 +11,14 @@
|
|
11
11
|
%td{colspan: '4'}
|
12
12
|
No qualifying searches found
|
13
13
|
- else
|
14
|
-
- @discernerSearchCombinationsTemplate =
|
14
|
+
- @discernerSearchCombinationsTemplate = discerner_generate_nested_attributes_template(f, :search_combinations, 'search_combination')
|
15
15
|
= f.fields_for :search_combinations, f.object.search_combinations.ordered_by_display_order do |search_combination|
|
16
16
|
= render partial: 'search_combination_fields', locals: { f: search_combination }
|
17
17
|
|
18
18
|
%tfoot
|
19
19
|
%tr
|
20
20
|
%td{ colspan: '4', class: 'add_search_combinations_link' }
|
21
|
-
=
|
21
|
+
= discerner_link_to_add_fields "Add search", :search_combinations
|
22
22
|
.clear
|
23
23
|
|
24
24
|
:javascript
|
@@ -13,12 +13,12 @@
|
|
13
13
|
%tfoot
|
14
14
|
%tr
|
15
15
|
%td{ colspan: '4', class: 'add_search_parameters_link' }
|
16
|
-
=
|
16
|
+
= discerner_link_to_add_fields "Add criteria", :search_parameters
|
17
17
|
.clear
|
18
18
|
|
19
19
|
:javascript
|
20
20
|
$(function () {
|
21
|
-
var discernerSearchParametersTemplate = '#{
|
21
|
+
var discernerSearchParametersTemplate = '#{discerner_generate_nested_attributes_template(f, :search_parameters, 'search_parameter')}',
|
22
22
|
parametersUrl = decodeURIComponent('#{values_parameters_url(parameter_id: ':question_id', format: 'json')}'); // used to generate parameter values for list parameters
|
23
23
|
|
24
24
|
new Discerner.SearchParameter.UI({
|
@@ -10,7 +10,7 @@
|
|
10
10
|
%td
|
11
11
|
= search.display_name
|
12
12
|
%td
|
13
|
-
=
|
13
|
+
= discerner_format_datetime(search.updated_at)
|
14
14
|
%td
|
15
15
|
= link_to 'Open', edit_search_path(search), class: 'show_link icon_link'
|
16
16
|
= link_to 'Export options', export_parameters_path(search), class: 'options_link icon_link' if export_discerner_results?
|
@@ -6,7 +6,7 @@
|
|
6
6
|
= f.object.warnings.full_messages.join(', ')
|
7
7
|
|
8
8
|
- unless f.blank?
|
9
|
-
- search_combination_id =
|
9
|
+
- search_combination_id = discerner_nested_record_id(f, :search_combination)
|
10
10
|
%tr{ id: "#{search_combination_id}", class: "search_combination fields #{'error' if f.object.warnings.any?}" }
|
11
11
|
%td.combined_search_operator
|
12
12
|
%span
|
@@ -18,5 +18,5 @@
|
|
18
18
|
-#= f.select(:operator_id, operator_options('search'))
|
19
19
|
= f.select(:combined_search_id, combined_searches_options(@discerner_search), { include_blank: true },{ class: 'search_combinations_combobox_autocompleter' })
|
20
20
|
%td.remove
|
21
|
-
=
|
21
|
+
= discerner_link_to_remove_fields 'Remove', f, :search_combinations
|
22
22
|
%td
|
@@ -1,4 +1,4 @@
|
|
1
|
-
- search_parameter_id =
|
1
|
+
- search_parameter_id = discerner_nested_record_id(f, :search_parameter)
|
2
2
|
|
3
3
|
- if f.object.disabled? && f.object.warnings.any?
|
4
4
|
%tr.error
|
@@ -29,7 +29,7 @@
|
|
29
29
|
|
30
30
|
.div-instruction-bar
|
31
31
|
%td.remove
|
32
|
-
=
|
32
|
+
= discerner_link_to_remove_fields 'Remove', f, :search_parameters
|
33
33
|
%td.parameter_values
|
34
34
|
.search_parameter_values
|
35
35
|
%table{ class: 'records' }
|
@@ -37,11 +37,11 @@
|
|
37
37
|
= f.fields_for :search_parameter_values, f.object.search_parameter_values.ordered_by_display_order do |search_parameter_value_form|
|
38
38
|
= render partial: 'search_parameter_value_fields', locals: { f: search_parameter_value_form }
|
39
39
|
%span{ class: 'add_header'}
|
40
|
-
=
|
40
|
+
= discerner_link_to_add_fields "Add selection", :search_parameter_values, {style: "display:none;"}
|
41
41
|
|
42
42
|
:javascript
|
43
43
|
$(function () {
|
44
|
-
var searchParameterValuesTemplate = '#{
|
44
|
+
var searchParameterValuesTemplate = '#{discerner_generate_nested_attributes_template(f, :search_parameter_values, "search_parameter_value")}',
|
45
45
|
container = $('##{search_parameter_id}'),
|
46
46
|
parametersUrl = decodeURIComponent('#{values_parameters_url(parameter_id: ':question_id', search_parameter_value_id: ':search_parameter_value_id')}'), // used to generate parameter values for combobox parameters
|
47
47
|
searchParameterUI = new Discerner.SearchParameterValue.UI({ container: container, searchParameterValuesTemplate: searchParameterValuesTemplate, parametersUrl: parametersUrl });
|
@@ -1,4 +1,4 @@
|
|
1
|
-
- search_parameter_value_id =
|
1
|
+
- search_parameter_value_id = discerner_nested_record_id(f, :search_parameter_value)
|
2
2
|
- if f.object.disabled? && f.object.warnings.any?
|
3
3
|
%tr.error
|
4
4
|
%td
|
@@ -24,7 +24,7 @@
|
|
24
24
|
%td.additional_value
|
25
25
|
= f.text_field :additional_value
|
26
26
|
%td.remove
|
27
|
-
=
|
27
|
+
= discerner_link_to_remove_fields 'Remove', f, :search_parameter_values
|
28
28
|
|
29
29
|
- else # this part is used for rendering existing parameter values
|
30
30
|
- parameter = f.object.search_parameter.parameter
|
@@ -39,13 +39,13 @@
|
|
39
39
|
%span{ class: 'parameter_value_text' }
|
40
40
|
= f.object.parameter_value.name
|
41
41
|
%td{class: "remove", class: "invisible"}
|
42
|
-
=
|
42
|
+
= discerner_link_to_remove_fields 'Remove', f, :search_parameter_values
|
43
43
|
|
44
44
|
- when 'combobox'
|
45
45
|
%td.parameter_value
|
46
46
|
= render partial: 'discerner/parameters/values_autocompleter', locals: {parameter: parameter, f: f, search_parameter_value_id: search_parameter_value_id}
|
47
47
|
%td.remove
|
48
|
-
=
|
48
|
+
= discerner_link_to_remove_fields 'Remove', f, :search_parameter_values
|
49
49
|
|
50
50
|
- else
|
51
51
|
%td.operator
|
@@ -58,5 +58,5 @@
|
|
58
58
|
%td{class: "additional_value #{'invisible' unless f.object.operator && f.object.operator.operator_type == 'range'}"}
|
59
59
|
= f.text_field :additional_value, class: "#{type == 'date' ? 'datepicker' : nil}"
|
60
60
|
%td.remove
|
61
|
-
=
|
61
|
+
= discerner_link_to_remove_fields 'Remove', f, :search_parameter_values
|
62
62
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class ReplaceNamespaceColumnsWithLabelForSearches < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :discerner_searches, :label, :string
|
4
|
+
|
5
|
+
Discerner::Search.transaction do
|
6
|
+
Discerner::Search.all.each do |search|
|
7
|
+
if !search.namespace_id.blank?
|
8
|
+
search.search_namespaces << Discerner::SearchNamespace.create(namespace_type: search.namespace_type, namespace_id: search.namespace_id)
|
9
|
+
elsif !search.namespace_type.blank?
|
10
|
+
search.label = search.namespace_type
|
11
|
+
end
|
12
|
+
search.save!
|
13
|
+
end
|
14
|
+
remove_column :discerner_searches, :namespace_type
|
15
|
+
remove_column :discerner_searches, :namespace_id
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def down
|
20
|
+
add_column :discerner_searches, :namespace_id, :integer
|
21
|
+
add_column :discerner_searches, :namespace_type, :string
|
22
|
+
|
23
|
+
Discerner::Search.transaction do
|
24
|
+
Discerner::Search.all.each do |search|
|
25
|
+
if search.search_namespaces.any?
|
26
|
+
search.namespace_id = search.search_namespaces.first.namespace_id
|
27
|
+
search.namespace_type = search.search_namespaces.first.namespace_type
|
28
|
+
elsif !search.label.blank?
|
29
|
+
search.namespace_type = search.label
|
30
|
+
end
|
31
|
+
search.save!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
remove_column :discerner_searches, :label
|
36
|
+
end
|
37
|
+
end
|
@@ -6,7 +6,7 @@ module Discerner
|
|
6
6
|
"discerner/dictionaries/#{@discerner_search.dictionary.parameterized_name}/results"
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def discerner_generate_nested_attributes_template(f, association, association_prefix = nil )
|
10
10
|
if association_prefix.nil?
|
11
11
|
association_prefix = association.to_s.singularize
|
12
12
|
end
|
@@ -17,22 +17,18 @@ module Discerner
|
|
17
17
|
escape_javascript(fields)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def discerner_link_to_add_fields(name, association, html_options={})
|
21
21
|
css_class = html_options[:class] || ' '
|
22
22
|
css_class += "add_#{association.to_s} add add_link icon_link"
|
23
23
|
html_options[:class] = css_class
|
24
24
|
link_to(name, 'javascript:void(0);', html_options)
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def discerner_link_to_remove_fields(name, f, association)
|
28
28
|
f.hidden_field(:_destroy) + link_to(name, "javascript:void(0);", class: "delete_#{association.to_s} delete_link icon_link")
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
f.hidden_field(:soft_delete) + link_to(name, "javascript:void(0);", class: "delete_#{association.to_s} delete_link icon_link")
|
33
|
-
end
|
34
|
-
|
35
|
-
def nested_record_id(builder, assocation)
|
31
|
+
def discerner_nested_record_id(builder, assocation)
|
36
32
|
builder.object.id.nil? ? "new_nested_record" : "#{assocation.to_s.singularize}_#{builder.object.id}"
|
37
33
|
end
|
38
34
|
|
@@ -131,11 +127,11 @@ module Discerner
|
|
131
127
|
link_to "Export options", export_parameters_path(@discerner_search), class: "discerner-button discerner-button-positive"
|
132
128
|
end
|
133
129
|
|
134
|
-
def
|
130
|
+
def discerner_format_datetime(datetime)
|
135
131
|
datetime.strftime("%m/%d/%Y %I:%M %p") if datetime
|
136
132
|
end
|
137
133
|
|
138
|
-
def
|
134
|
+
def discerner_format_date(date)
|
139
135
|
date.strftime("%m/%d/%Y") if date
|
140
136
|
end
|
141
137
|
end
|
@@ -12,6 +12,7 @@ module Discerner
|
|
12
12
|
base.send :has_many, :search_combinations, inverse_of: :search
|
13
13
|
base.send :has_many, :combined_searches, through: :search_combinations
|
14
14
|
base.send :has_many, :export_parameters, inverse_of: :search
|
15
|
+
base.send :has_many, :search_namespaces, inverse_of: :search
|
15
16
|
|
16
17
|
# Validations
|
17
18
|
base.send :validates, :dictionary, presence: { message: "for search can't be blank" }
|
data/lib/discerner/version.rb
CHANGED
@@ -120,6 +120,7 @@ module Discerner
|
|
120
120
|
copy_file "models/search_combination.rb", "#{path}/search_combination.rb"
|
121
121
|
copy_file "models/search_parameter_value.rb", "#{path}/search_parameter_value.rb"
|
122
122
|
copy_file "models/search_parameter.rb", "#{path}/search_parameter.rb"
|
123
|
+
copy_file "models/search_namespace.rb", "#{path}/search_namespace.rb"
|
123
124
|
copy_file "models/search.rb", "#{path}/search.rb"
|
124
125
|
end
|
125
126
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discerner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Gurley, Yulia Bushmanova
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -375,6 +375,7 @@ files:
|
|
375
375
|
- app/models/discerner/parameter_value_category.rb
|
376
376
|
- app/models/discerner/search.rb
|
377
377
|
- app/models/discerner/search_combination.rb
|
378
|
+
- app/models/discerner/search_namespace.rb
|
378
379
|
- app/models/discerner/search_parameter.rb
|
379
380
|
- app/models/discerner/search_parameter_value.rb
|
380
381
|
- app/views/discerner/export_parameters/index.html.haml
|
@@ -434,6 +435,8 @@ files:
|
|
434
435
|
- db/migrate/20140227191827_remove_blank_parameter_values_from_export_parameters.rb
|
435
436
|
- db/migrate/20140815214547_add_namespace_to_discerner_searches.rb
|
436
437
|
- db/migrate/20140815214629_add_namespace_to_discerner_dictionaries.rb
|
438
|
+
- db/migrate/20140915032427_create_discerner_search_namespaces.rb
|
439
|
+
- db/migrate/20140915032608_replace_namespace_columns_with_label_for_searches.rb
|
437
440
|
- db/seeds.rb
|
438
441
|
- lib/discerner.rb
|
439
442
|
- lib/discerner/engine.rb
|
@@ -452,6 +455,7 @@ files:
|
|
452
455
|
- lib/discerner/methods/models/parameter_value_category.rb
|
453
456
|
- lib/discerner/methods/models/search.rb
|
454
457
|
- lib/discerner/methods/models/search_combination.rb
|
458
|
+
- lib/discerner/methods/models/search_namespace.rb
|
455
459
|
- lib/discerner/methods/models/search_parameter.rb
|
456
460
|
- lib/discerner/methods/models/search_parameter_value.rb
|
457
461
|
- lib/discerner/methods/models/soft_delete.rb
|
@@ -480,6 +484,7 @@ files:
|
|
480
484
|
- lib/generators/discerner/install/templates/models/parameter_value_category.rb
|
481
485
|
- lib/generators/discerner/install/templates/models/search.rb
|
482
486
|
- lib/generators/discerner/install/templates/models/search_combination.rb
|
487
|
+
- lib/generators/discerner/install/templates/models/search_namespace.rb
|
483
488
|
- lib/generators/discerner/install/templates/models/search_parameter.rb
|
484
489
|
- lib/generators/discerner/install/templates/models/search_parameter_value.rb
|
485
490
|
- lib/generators/discerner/install/templates/views/layouts/searches.html.erb
|
@@ -506,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
506
511
|
version: '0'
|
507
512
|
requirements: []
|
508
513
|
rubyforge_project:
|
509
|
-
rubygems_version: 2.
|
514
|
+
rubygems_version: 2.4.1
|
510
515
|
signing_key:
|
511
516
|
specification_version: 4
|
512
517
|
summary: Rails engine that provides dictionary-based search functionality
|