discerner 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/app/views/discerner/export_parameters/index.html.haml +8 -8
- data/app/views/discerner/parameters/_values_autocompleter.html.haml +18 -18
- data/app/views/discerner/parameters/values.html.haml +1 -1
- data/app/views/discerner/searches/_form.html.haml +6 -6
- data/app/views/discerner/searches/_form_combined_searches.html.haml +4 -4
- data/app/views/discerner/searches/_form_controls.html.haml +3 -3
- data/app/views/discerner/searches/_form_header.html.haml +6 -6
- data/app/views/discerner/searches/_form_search_parameters.html.haml +4 -4
- data/app/views/discerner/searches/_list.html.haml +4 -4
- data/app/views/discerner/searches/_search_combination_fields.html.haml +4 -4
- data/app/views/discerner/searches/_search_parameter_fields.html.haml +15 -15
- data/app/views/discerner/searches/_search_parameter_value_fields.html.haml +13 -13
- data/app/views/discerner/searches/_summary.html.haml +1 -1
- data/app/views/discerner/searches/edit.html.haml +2 -2
- data/app/views/discerner/searches/index.html.haml +3 -3
- data/app/views/discerner/searches/rename.html.haml +4 -4
- data/app/views/discerner/searches/update.js.haml +1 -1
- data/app/views/discerner/shared/_categorized_autocompleter_items.html.haml +1 -1
- data/app/views/discerner/shared/_error_messages.html.haml +1 -1
- data/app/views/layouts/discerner/searches.html.erb +1 -1
- data/config/routes.rb +1 -1
- data/db/migrate/20140815214547_add_namespace_to_discerner_searches.rb +6 -0
- data/db/migrate/20140815214629_add_namespace_to_discerner_dictionaries.rb +6 -0
- data/lib/discerner/methods/controllers/export_parameters_controller.rb +2 -2
- data/lib/discerner/methods/controllers/parameters_controller.rb +3 -3
- data/lib/discerner/methods/controllers/searches_controller.rb +14 -14
- data/lib/discerner/methods/helpers/searches_helper.rb +9 -9
- data/lib/discerner/methods/models/dictionary.rb +3 -3
- data/lib/discerner/methods/models/export_parameter.rb +3 -3
- data/lib/discerner/methods/models/operator.rb +5 -5
- data/lib/discerner/methods/models/parameter.rb +9 -9
- data/lib/discerner/methods/models/parameter_category.rb +5 -5
- data/lib/discerner/methods/models/parameter_type.rb +3 -3
- data/lib/discerner/methods/models/parameter_value.rb +11 -11
- data/lib/discerner/methods/models/parameter_value_categorization.rb +2 -2
- data/lib/discerner/methods/models/parameter_value_category.rb +4 -4
- data/lib/discerner/methods/models/search.rb +12 -12
- data/lib/discerner/methods/models/search_combination.rb +3 -3
- data/lib/discerner/methods/models/search_parameter.rb +5 -5
- data/lib/discerner/methods/models/search_parameter_value.rb +6 -6
- data/lib/discerner/methods/models/soft_delete.rb +1 -1
- data/lib/discerner/version.rb +1 -1
- data/lib/generators/discerner/dictionary/dictionary_generator.rb +5 -5
- data/lib/generators/discerner/install/install_generator.rb +12 -12
- data/lib/generators/discerner/install/templates/dictionaries.yml +1 -1
- data/lib/generators/discerner/install/templates/models/book.rb +4 -4
- data/lib/generators/discerner/install/templates/views/layouts/searches.html.erb +1 -1
- data/lib/tasks/cucumber.rake +10 -10
- data/lib/tasks/discerner_tasks.rake +5 -5
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2a1f2c77c1b0901c1b1dbd313a8ca37ae47b23c
|
4
|
+
data.tar.gz: eab9fea86140efd34e3c5329e221a388a9dd4842
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe0aab0fcd6943fe7cb6f056f4209eea050690bba725f8a5da5c2edeac15b2af197a76ca5c524d045b6e3dce91f275545986f98ac2908248539cc2d5418d4a55
|
7
|
+
data.tar.gz: 846b57e24bc9880a726f2d8e6064b1f207c771b100f1238a0b7c2c99260906ccc7def81bdaacda694c7d7144574090bd921a37f822e9f9f3eab919f9a142e7c2
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ load 'rails/tasks/engine.rake' if File.exists?(APP_RAKEFILE)
|
|
14
14
|
load 'lib/tasks/discerner_tasks.rake'
|
15
15
|
load 'test/lib/tasks/discerner_test_tasks.rake'
|
16
16
|
RSpec::Core::RakeTask.new(:spec)
|
17
|
-
task :
|
17
|
+
task default: :spec
|
18
18
|
|
19
19
|
namespace :cucumber do
|
20
20
|
Cucumber::Rake::Task.new(:wip, 'Run features that are being worked on') do |t|
|
@@ -26,4 +26,4 @@ namespace :cucumber do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
task :
|
29
|
+
task cucumber: 'cucumber:features'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#discerner_search
|
2
2
|
= render 'discerner/searches/summary'
|
3
3
|
.discerner-buttons
|
4
|
-
= link_to 'Back to search', edit_search_path(@discerner_search), :
|
4
|
+
= link_to 'Back to search', edit_search_path(@discerner_search), class: "discerner-button discerner-button-positive"
|
5
5
|
.clear
|
6
6
|
%hr
|
7
7
|
|
@@ -17,13 +17,13 @@
|
|
17
17
|
- selected_parameters = @discerner_search.export_parameters.ordered.to_a
|
18
18
|
- selected_parameters = @discerner_search.search_parameters.ordered.to_a + @discerner_search.nested_searches.map{|s| s.search_parameters}.flatten if selected_parameters.empty?
|
19
19
|
|
20
|
-
= form_tag assign_export_parameters_path(@discerner_search), :
|
20
|
+
= form_tag assign_export_parameters_path(@discerner_search), url: {action: "assign"} do
|
21
21
|
- exportable_parameter_categories.each do |c|
|
22
22
|
.clear
|
23
|
-
%div{ :
|
23
|
+
%div{ class: "#{c.css_class_name}"}
|
24
24
|
%h4
|
25
25
|
= c.name
|
26
|
-
%a{ :
|
26
|
+
%a{ class: "select_all_parameters", href: "#"}
|
27
27
|
Select all
|
28
28
|
|
29
29
|
- items = exportable_parameters(@discerner_search, c)
|
@@ -38,17 +38,17 @@
|
|
38
38
|
- items_rendered_count = to
|
39
39
|
- (from...to).each do |j|
|
40
40
|
- export_parameter = items[j]
|
41
|
-
%div{ :
|
41
|
+
%div{ class: "export_parameter #{'error' if export_parameter.deleted?}"}
|
42
42
|
- is_checked = selected_parameters.select{ |cp| cp.parameter_id == export_parameter.id }.blank? ? false : true
|
43
|
-
= check_box_tag "parameter_ids[]", export_parameter.id, is_checked, :
|
43
|
+
= check_box_tag "parameter_ids[]", export_parameter.id, is_checked, id: "parameter_ids_#{export_parameter.id}"
|
44
44
|
= label_tag "parameter_ids_#{export_parameter.id}", export_parameter.name
|
45
45
|
|
46
46
|
.clear
|
47
47
|
.discerner-buttons
|
48
48
|
- if @discerner_search.disabled?
|
49
|
-
= submit_tag 'Update and export', :
|
49
|
+
= submit_tag 'Update and export', class: "discerner-button discerner-button-positive"
|
50
50
|
- else
|
51
|
-
= submit_tag 'Export', :
|
51
|
+
= submit_tag 'Export', class: "discerner-button discerner-button-positive"
|
52
52
|
:javascript
|
53
53
|
$(function () {
|
54
54
|
new Discerner.ExportParameters.UI();
|
@@ -3,47 +3,47 @@
|
|
3
3
|
- parameter_values = parameter_value_options(@searchable_parameter_values[parameter.id], search_parameter_value_id)
|
4
4
|
|
5
5
|
- if parameter.parameter_values.categorized.any?
|
6
|
-
%div{:
|
6
|
+
%div{class: 'ui-widget categorized_autocompleter'}
|
7
7
|
|
8
8
|
- if defined?(f)
|
9
|
-
= f.select(:parameter_value_id, parameter_values, { :
|
9
|
+
= f.select(:parameter_value_id, parameter_values, { include_blank: true }, {class: 'parameter_values_combobox_autocompleter'})
|
10
10
|
- else
|
11
|
-
= select_tag(:parameter_value_id, options_for_select(parameter_values), :
|
11
|
+
= select_tag(:parameter_value_id, options_for_select(parameter_values), include_blank: true, class: 'parameter_values_combobox_autocompleter')
|
12
12
|
|
13
|
-
%a{ :
|
13
|
+
%a{ href: 'javascript:void(0);', class: 'categorized_autocompleter_link collapsed_categorized_autocompleter_link' }
|
14
14
|
Select
|
15
|
-
.div-category-popup{ :
|
15
|
+
.div-category-popup{ style: "display: none;"}
|
16
16
|
.div-category-list
|
17
17
|
- parameter.parameter_value_categories.ordered_by_display_order_and_name.each do |parameter_value_category|
|
18
18
|
- unless parameter_value_category.parameter_values.empty?
|
19
|
-
= div_for parameter_value_category, :
|
20
|
-
%p{ :
|
19
|
+
= div_for parameter_value_category, class: "#{parameter_value_category.css_class} categorized-parameter-values" do
|
20
|
+
%p{ class: 'parameter_value_category_name' }
|
21
21
|
= parameter_value_category.name
|
22
22
|
- if parameter_value_category.collapse?
|
23
|
-
%a{ :
|
23
|
+
%a{ class: "show-category-items", href: "#"}
|
24
24
|
more
|
25
25
|
- else
|
26
|
-
%a{ :
|
26
|
+
%a{ class: "hide-category-items", href: "#"}
|
27
27
|
less
|
28
|
-
.category-items{:
|
29
|
-
- items = parameter_value_category.parameter_values.not_deleted.ordered_by_name.to_a.map{ |pv| {:
|
28
|
+
.category-items{style: "#{parameter_value_category.collapse ? 'display:none;' : ''}"}
|
29
|
+
- items = parameter_value_category.parameter_values.not_deleted.ordered_by_name.to_a.map{ |pv| {name: pv.name, rel: searchable_object_index(pv, search_parameter_value_id)}}
|
30
30
|
- unless items.empty?
|
31
|
-
= render :
|
31
|
+
= render partial: 'discerner/shared/categorized_autocompleter_items', locals: { columns_count: 2, items: items }
|
32
32
|
.clear
|
33
33
|
|
34
|
-
- uncategorized_items = parameter.parameter_values.uncategorized.ordered_by_name.to_a.map{ |pv| {:
|
34
|
+
- uncategorized_items = parameter.parameter_values.uncategorized.ordered_by_name.to_a.map{ |pv| {name: pv.name, rel: searchable_object_index(pv, search_parameter_value_id)}}
|
35
35
|
- unless uncategorized_items.empty?
|
36
36
|
.uncategorized-parameter-values.parameter_value_category
|
37
|
-
%p{ :
|
37
|
+
%p{ class: 'parameter_value_category_name' }
|
38
38
|
Uncategorized
|
39
|
-
%a{ :
|
39
|
+
%a{ class: "hide-category-items", href: "#"}
|
40
40
|
less
|
41
41
|
.category-items
|
42
|
-
= render :
|
42
|
+
= render partial: 'discerner/shared/categorized_autocompleter_items', locals: { columns_count: 2, items: uncategorized_items }
|
43
43
|
|
44
44
|
.div-instruction-bar
|
45
45
|
- else
|
46
46
|
- if defined?(f)
|
47
|
-
= f.select(:parameter_value_id, parameter_values, { :
|
47
|
+
= f.select(:parameter_value_id, parameter_values, { include_blank: true },{ class: 'parameter_values_combobox_autocompleter' })
|
48
48
|
- else
|
49
|
-
= select_tag(:parameter_value_id, options_for_select(parameter_values), :
|
49
|
+
= select_tag(:parameter_value_id, options_for_select(parameter_values), include_blank: true, class: 'parameter_values_combobox_autocompleter')
|
@@ -1 +1 @@
|
|
1
|
-
= render :
|
1
|
+
= render partial: 'discerner/parameters/values_autocompleter', locals: {parameter: @parameter, search_parameter_value_id: @search_parameter_value_id}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
- unless @discerner_search.blank?
|
2
|
-
= render 'discerner/shared/error_messages', :
|
2
|
+
= render 'discerner/shared/error_messages', object: @discerner_search
|
3
3
|
|
4
4
|
#discerner_search_form
|
5
|
-
= form_for @discerner_search, :
|
6
|
-
= render :
|
5
|
+
= form_for @discerner_search, html: { id: 'search' } do |f|
|
6
|
+
= render partial: 'form_header', locals: { f: f }
|
7
7
|
- unless enable_combined_searches?.blank?
|
8
|
-
= render :
|
9
|
-
= render :
|
10
|
-
= render :
|
8
|
+
= render partial: 'form_combined_searches', locals: { f: f }
|
9
|
+
= render partial: 'form_search_parameters', locals: { f: f }
|
10
|
+
= render partial: 'form_controls', locals: { f: f }
|
11
11
|
.clear
|
12
12
|
|
13
13
|
:javascript
|
@@ -1,4 +1,4 @@
|
|
1
|
-
%table{ :
|
1
|
+
%table{ class: 'records search_combinations' }
|
2
2
|
%thead
|
3
3
|
%tr
|
4
4
|
%th.combined_search_operator
|
@@ -8,16 +8,16 @@
|
|
8
8
|
%th
|
9
9
|
%tbody.nested_records_search_combinations
|
10
10
|
- if combined_searches_options(@discerner_search).blank?
|
11
|
-
%td{:
|
11
|
+
%td{colspan: '4'}
|
12
12
|
No qualifying searches found
|
13
13
|
- else
|
14
14
|
- @discernerSearchCombinationsTemplate = 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
|
-
= render :
|
16
|
+
= render partial: 'search_combination_fields', locals: { f: search_combination }
|
17
17
|
|
18
18
|
%tfoot
|
19
19
|
%tr
|
20
|
-
%td{ :
|
20
|
+
%td{ colspan: '4', class: 'add_search_combinations_link' }
|
21
21
|
= link_to_add_fields "Add search", :search_combinations
|
22
22
|
.clear
|
23
23
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
.discerner-buttons
|
2
2
|
- if @discerner_search.disabled?
|
3
|
-
= submit_tag 'Update search', :
|
3
|
+
= submit_tag 'Update search', class: "discerner-button discerner-button-positive"
|
4
4
|
- else
|
5
|
-
= submit_tag 'Search', :
|
5
|
+
= submit_tag 'Search', class: "discerner-button discerner-button-positive"
|
6
6
|
- if @discerner_search.persisted? && export_discerner_results? && discerner_export_link
|
7
7
|
= discerner_export_link
|
8
|
-
= link_to 'Clear', new_search_path, :
|
8
|
+
= link_to 'Clear', new_search_path, class: "discerner-button discerner-button-negative"
|
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
.discerner_search_dictionary
|
6
6
|
%b Dictionary:
|
7
|
-
%span{ :
|
7
|
+
%span{ class: "#{@discerner_search.dictionary.css_class_name}"}
|
8
8
|
#{@discerner_search.dictionary.name}
|
9
9
|
- if @discerner_search.dictionary.deleted?
|
10
|
-
%span{ :
|
10
|
+
%span{ style: "color:red;"}
|
11
11
|
%b This dictionary has been deleted. You will not be able to execute or edit this search.
|
12
12
|
|
13
13
|
.discerner_search_name
|
@@ -15,7 +15,7 @@
|
|
15
15
|
%span.discerner_search_name
|
16
16
|
= @discerner_search.display_name
|
17
17
|
%span.discerner_search_name_edit
|
18
|
-
= link_to 'Edit', '#', :
|
18
|
+
= link_to 'Edit', '#', class: "edit_link icon_link"
|
19
19
|
|
20
20
|
- else
|
21
21
|
.discerner_dictionary_required_message
|
@@ -25,11 +25,11 @@
|
|
25
25
|
%div.discerner_search_dictionary
|
26
26
|
- if @searchable_dictionaries.length > 1
|
27
27
|
= f.label :dictionary_id
|
28
|
-
= f.select :dictionary_id, dictionary_options(@searchable_dictionaries), :
|
28
|
+
= f.select :dictionary_id, dictionary_options(@searchable_dictionaries), include_blank: true
|
29
29
|
- else
|
30
30
|
%b Dictionary:
|
31
|
-
= f.hidden_field :dictionary_id, :
|
32
|
-
%span{ :
|
31
|
+
= f.hidden_field :dictionary_id, value: @searchable_dictionaries.last.id
|
32
|
+
%span{ class: "#{@searchable_dictionaries.last.css_class_name}"}
|
33
33
|
= @searchable_dictionaries.last.name
|
34
34
|
|
35
35
|
%div.discerner_search_name
|
@@ -1,4 +1,4 @@
|
|
1
|
-
%table{ :
|
1
|
+
%table{ class: 'records search_parameters' }
|
2
2
|
%thead
|
3
3
|
%tr
|
4
4
|
%th.parameter_boolean_operator
|
@@ -9,17 +9,17 @@
|
|
9
9
|
Selections
|
10
10
|
%tbody.nested_records_search_parameters
|
11
11
|
= f.fields_for :search_parameters, f.object.search_parameters.ordered_by_display_order do |search_parameter|
|
12
|
-
= render :
|
12
|
+
= render partial: 'search_parameter_fields', locals: { f: search_parameter }
|
13
13
|
%tfoot
|
14
14
|
%tr
|
15
|
-
%td{ :
|
15
|
+
%td{ colspan: '4', class: 'add_search_parameters_link' }
|
16
16
|
= link_to_add_fields "Add criteria", :search_parameters
|
17
17
|
.clear
|
18
18
|
|
19
19
|
:javascript
|
20
20
|
$(function () {
|
21
21
|
var discernerSearchParametersTemplate = '#{generate_nested_attributes_template(f, :search_parameters, 'search_parameter')}',
|
22
|
-
parametersUrl = decodeURIComponent('#{values_parameters_url(:
|
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({
|
25
25
|
searchParametersTemplate: discernerSearchParametersTemplate,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
%table{ :
|
1
|
+
%table{ class: 'records' }
|
2
2
|
%thead
|
3
3
|
%tr
|
4
4
|
%th Name
|
@@ -12,6 +12,6 @@
|
|
12
12
|
%td
|
13
13
|
= format_datetime(search.updated_at)
|
14
14
|
%td
|
15
|
-
= link_to 'Open', edit_search_path(search), :
|
16
|
-
= link_to 'Export options', export_parameters_path(search), :
|
17
|
-
= link_to 'Delete', search_path(search), :
|
15
|
+
= link_to 'Open', edit_search_path(search), class: 'show_link icon_link'
|
16
|
+
= link_to 'Export options', export_parameters_path(search), class: 'options_link icon_link' if export_discerner_results?
|
17
|
+
= link_to 'Delete', search_path(search), data: {confirm: 'Are you sure?'}, method: :delete, class: "icon_link delete_link"
|
@@ -1,22 +1,22 @@
|
|
1
1
|
- if f.object.disabled? && f.object.warnings.any?
|
2
2
|
%tr.error
|
3
3
|
%td
|
4
|
-
%td.warnings{:
|
4
|
+
%td.warnings{colspan: "4"}
|
5
5
|
%span
|
6
6
|
= f.object.warnings.full_messages.join(', ')
|
7
7
|
|
8
8
|
- unless f.blank?
|
9
9
|
- search_combination_id = nested_record_id(f, :search_combination)
|
10
|
-
%tr{ :
|
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
|
13
13
|
restrict to
|
14
14
|
%td.combined_search
|
15
15
|
%div.combined_search_combobox
|
16
16
|
= f.hidden_field :display_order
|
17
|
-
= f.hidden_field :operator_id, :
|
17
|
+
= f.hidden_field :operator_id, value: Discerner::Operator.where(symbol: 'include').first.id
|
18
18
|
-#= f.select(:operator_id, operator_options('search'))
|
19
|
-
= f.select(:combined_search_id, combined_searches_options(@discerner_search), { :
|
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
|
= link_to_remove_fields 'Remove', f, :search_combinations
|
22
22
|
%td
|
@@ -3,46 +3,46 @@
|
|
3
3
|
- if f.object.disabled? && f.object.warnings.any?
|
4
4
|
%tr.error
|
5
5
|
%td
|
6
|
-
%td.warnings{:
|
6
|
+
%td.warnings{colspan: "4"}
|
7
7
|
%span
|
8
8
|
= f.object.warnings.full_messages.join(', ')
|
9
9
|
|
10
|
-
%tr{ :
|
10
|
+
%tr{ id: "#{search_parameter_id}", class: "search_parameter fields #{'error' if f.object.warnings.any?}" }
|
11
11
|
%td.parameter_boolean_operator
|
12
12
|
%span
|
13
13
|
where
|
14
14
|
%td.parameter
|
15
|
-
%div{:
|
15
|
+
%div{class: 'ui-widget categorized_autocompleter'}
|
16
16
|
= f.hidden_field :display_order
|
17
|
-
= f.select(:parameter_id, parameter_options(@searchable_parameters, search_parameter_id), { :
|
18
|
-
%a{ :
|
17
|
+
= f.select(:parameter_id, parameter_options(@searchable_parameters, search_parameter_id), { include_blank: true },{ class: 'parameters_combobox_autocompleter' })
|
18
|
+
%a{ href: 'javascript:void(0);', class: 'categorized_autocompleter_link collapsed_categorized_autocompleter_link' }
|
19
19
|
Select
|
20
|
-
.div-category-popup{ :
|
20
|
+
.div-category-popup{ style: "display: none;"}
|
21
21
|
.div-category-list
|
22
22
|
- @searchable_parameter_categories.each do |parameter_category|
|
23
|
-
= div_for parameter_category, :
|
24
|
-
%p{ :
|
23
|
+
= div_for parameter_category, class: "#{parameter_category.dictionary.css_class_name}" do
|
24
|
+
%p{ class: 'parameter_category_name' }
|
25
25
|
= parameter_category.name
|
26
|
-
- items = @searchable_parameters.select{|sp| sp.parameter_category_id == parameter_category.id}.sort{|a,b| a.name <=> b.name}.map{ |p| {:
|
26
|
+
- items = @searchable_parameters.select{|sp| sp.parameter_category_id == parameter_category.id}.sort{|a,b| a.name <=> b.name}.map{ |p| {name: p.name, rel: searchable_object_index(p, search_parameter_id)}}
|
27
27
|
- unless items.empty?
|
28
|
-
= render :
|
28
|
+
= render partial: 'discerner/shared/categorized_autocompleter_items', locals: { columns_count: 4, items: items }
|
29
29
|
|
30
30
|
.div-instruction-bar
|
31
31
|
%td.remove
|
32
32
|
= link_to_remove_fields 'Remove', f, :search_parameters
|
33
33
|
%td.parameter_values
|
34
34
|
.search_parameter_values
|
35
|
-
%table{ :
|
35
|
+
%table{ class: 'records' }
|
36
36
|
%tbody.nested_records_search_parameter_values
|
37
37
|
= f.fields_for :search_parameter_values, f.object.search_parameter_values.ordered_by_display_order do |search_parameter_value_form|
|
38
|
-
= render :
|
39
|
-
%span{ :
|
40
|
-
= link_to_add_fields "Add selection", :search_parameter_values, {:
|
38
|
+
= render partial: 'search_parameter_value_fields', locals: { f: search_parameter_value_form }
|
39
|
+
%span{ class: 'add_header'}
|
40
|
+
= link_to_add_fields "Add selection", :search_parameter_values, {style: "display:none;"}
|
41
41
|
|
42
42
|
:javascript
|
43
43
|
$(function () {
|
44
44
|
var searchParameterValuesTemplate = '#{generate_nested_attributes_template(f, :search_parameter_values, "search_parameter_value")}',
|
45
45
|
container = $('##{search_parameter_id}'),
|
46
|
-
parametersUrl = decodeURIComponent('#{values_parameters_url(:
|
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 });
|
48
48
|
});
|
@@ -2,23 +2,23 @@
|
|
2
2
|
- if f.object.disabled? && f.object.warnings.any?
|
3
3
|
%tr.error
|
4
4
|
%td
|
5
|
-
%td.warnings{:
|
5
|
+
%td.warnings{colspan: "6"}
|
6
6
|
%span
|
7
7
|
= f.object.warnings.full_messages.join(', ')
|
8
8
|
|
9
|
-
%tr{ :
|
9
|
+
%tr{ id: "#{search_parameter_value_id}", class: "search_parameter_value fields #{'error' if f.object.warnings.any?} search_parameter_value_new" }
|
10
10
|
%td.parameter_values_boolean_operator
|
11
11
|
= f.hidden_field :display_order
|
12
12
|
%span
|
13
13
|
|
14
14
|
- if f.object.new_record? # this part is used for rendering newly added parameter values
|
15
15
|
%td.operator
|
16
|
-
= f.select(:operator_id, operator_options, { :
|
16
|
+
= f.select(:operator_id, operator_options, { include_blank: true })
|
17
17
|
%td.chosen
|
18
18
|
= f.check_box :chosen
|
19
19
|
%td.parameter_value
|
20
|
-
= f.hidden_field :parameter_value_id, :
|
21
|
-
%span{ :
|
20
|
+
= f.hidden_field :parameter_value_id, class: 'parameter_value_id'
|
21
|
+
%span{ class: 'parameter_value_text' }
|
22
22
|
%td.value
|
23
23
|
= f.text_field :value
|
24
24
|
%td.additional_value
|
@@ -35,15 +35,15 @@
|
|
35
35
|
%td.chosen
|
36
36
|
= f.check_box :chosen
|
37
37
|
%td.parameter_value
|
38
|
-
= f.hidden_field :parameter_value_id, :
|
39
|
-
%span{ :
|
38
|
+
= f.hidden_field :parameter_value_id, class: 'parameter_value_id'
|
39
|
+
%span{ class: 'parameter_value_text' }
|
40
40
|
= f.object.parameter_value.name
|
41
|
-
%td{:
|
41
|
+
%td{class: "remove", class: "invisible"}
|
42
42
|
= link_to_remove_fields 'Remove', f, :search_parameter_values
|
43
43
|
|
44
44
|
- when 'combobox'
|
45
45
|
%td.parameter_value
|
46
|
-
= render :
|
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
|
= link_to_remove_fields 'Remove', f, :search_parameter_values
|
49
49
|
|
@@ -52,11 +52,11 @@
|
|
52
52
|
- selected = f.object.operator.blank? ? nil : f.object.operator.id
|
53
53
|
= f.select(:operator_id, options_for_select([["", ""]] + operator_options(type), selected))
|
54
54
|
|
55
|
-
%td{:
|
56
|
-
= f.text_field :value, :
|
55
|
+
%td{class: "value #{'invisible' if f.object.operator && f.object.operator.operator_type == 'presence'}"}
|
56
|
+
= f.text_field :value, class: "#{type == 'date' ? 'datepicker' : nil}"
|
57
57
|
|
58
|
-
%td{:
|
59
|
-
= f.text_field :additional_value, :
|
58
|
+
%td{class: "additional_value #{'invisible' unless f.object.operator && f.object.operator.operator_type == 'range'}"}
|
59
|
+
= f.text_field :additional_value, class: "#{type == 'date' ? 'datepicker' : nil}"
|
60
60
|
%td.remove
|
61
61
|
= link_to_remove_fields 'Remove', f, :search_parameter_values
|
62
62
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
- search_parameters = search_parameters.by_parameter_category(category) if category
|
14
14
|
- unless search_parameters.blank?
|
15
15
|
%tr.parameter_category
|
16
|
-
%th{:
|
16
|
+
%th{colspan: "2"}
|
17
17
|
= category.name
|
18
18
|
- search_parameters.each do |sp|
|
19
19
|
%tr.search_parameter_summary
|