discerner 1.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +97 -0
  4. data/Rakefile +29 -0
  5. data/app/assets/images/discerner/add.png +0 -0
  6. data/app/assets/images/discerner/ajax-loader.gif +0 -0
  7. data/app/assets/images/discerner/bar.gif +0 -0
  8. data/app/assets/images/discerner/bullet_arrow_down.png +0 -0
  9. data/app/assets/images/discerner/bullet_arrow_up.png +0 -0
  10. data/app/assets/images/discerner/cog.png +0 -0
  11. data/app/assets/images/discerner/delete.png +0 -0
  12. data/app/assets/images/discerner/edit.png +0 -0
  13. data/app/assets/images/discerner/excel.png +0 -0
  14. data/app/assets/images/discerner/greencheck.gif +0 -0
  15. data/app/assets/images/discerner/rails.png +0 -0
  16. data/app/assets/images/discerner/show.png +0 -0
  17. data/app/assets/images/discerner/switch_minus.gif +0 -0
  18. data/app/assets/images/discerner/switch_plus.gif +0 -0
  19. data/app/assets/javascripts/discerner/application.js +20 -0
  20. data/app/assets/javascripts/discerner/combobox.js +301 -0
  21. data/app/assets/javascripts/discerner/discerner.js +19 -0
  22. data/app/assets/javascripts/discerner/export_parameters.js +13 -0
  23. data/app/assets/javascripts/discerner/jquery/jquery.blockUI.js +576 -0
  24. data/app/assets/javascripts/discerner/jquery/jquery.form.js +1074 -0
  25. data/app/assets/javascripts/discerner/nested_attributes.js +69 -0
  26. data/app/assets/javascripts/discerner/search_combinations.js +49 -0
  27. data/app/assets/javascripts/discerner/search_parameter.js +131 -0
  28. data/app/assets/javascripts/discerner/search_parameter_value.js +172 -0
  29. data/app/assets/javascripts/discerner/searches.js +93 -0
  30. data/app/assets/javascripts/discerner/url.js +42 -0
  31. data/app/assets/stylesheets/discerner/application.css +16 -0
  32. data/app/assets/stylesheets/discerner/buttons.sass +13 -0
  33. data/app/assets/stylesheets/discerner/categorized_autocompleter.sass +53 -0
  34. data/app/assets/stylesheets/discerner/discerner.sass +51 -0
  35. data/app/assets/stylesheets/discerner/export_parameters.sass +43 -0
  36. data/app/assets/stylesheets/discerner/links.sass +29 -0
  37. data/app/assets/stylesheets/discerner/searches.sass +205 -0
  38. data/app/assets/stylesheets/discerner/tables.sass +32 -0
  39. data/app/controllers/discerner/application_controller.rb +2 -0
  40. data/app/controllers/discerner/export_parameters_controller.rb +5 -0
  41. data/app/controllers/discerner/parameters_controller.rb +5 -0
  42. data/app/controllers/discerner/searches_controller.rb +5 -0
  43. data/app/helpers/discerner/application_helper.rb +4 -0
  44. data/app/helpers/discerner/parameters_helper.rb +5 -0
  45. data/app/helpers/discerner/searches_helper.rb +5 -0
  46. data/app/models/discerner/dictionary.rb +5 -0
  47. data/app/models/discerner/export_parameter.rb +5 -0
  48. data/app/models/discerner/operator.rb +5 -0
  49. data/app/models/discerner/parameter.rb +5 -0
  50. data/app/models/discerner/parameter_category.rb +5 -0
  51. data/app/models/discerner/parameter_type.rb +5 -0
  52. data/app/models/discerner/parameter_value.rb +5 -0
  53. data/app/models/discerner/parameter_value_categorization.rb +5 -0
  54. data/app/models/discerner/parameter_value_category.rb +5 -0
  55. data/app/models/discerner/search.rb +5 -0
  56. data/app/models/discerner/search_combination.rb +5 -0
  57. data/app/models/discerner/search_parameter.rb +5 -0
  58. data/app/models/discerner/search_parameter_value.rb +5 -0
  59. data/app/views/discerner/export_parameters/index.html.haml +55 -0
  60. data/app/views/discerner/parameters/_values_autocompleter.html.haml +49 -0
  61. data/app/views/discerner/parameters/values.html.haml +1 -0
  62. data/app/views/discerner/searches/_form.html.haml +21 -0
  63. data/app/views/discerner/searches/_form_combined_searches.html.haml +32 -0
  64. data/app/views/discerner/searches/_form_controls.html.haml +8 -0
  65. data/app/views/discerner/searches/_form_header.html.haml +39 -0
  66. data/app/views/discerner/searches/_form_search_parameters.html.haml +28 -0
  67. data/app/views/discerner/searches/_list.html.haml +17 -0
  68. data/app/views/discerner/searches/_search_combination_fields.html.haml +22 -0
  69. data/app/views/discerner/searches/_search_parameter_fields.html.haml +48 -0
  70. data/app/views/discerner/searches/_search_parameter_value_fields.html.haml +62 -0
  71. data/app/views/discerner/searches/_summary.html.haml +25 -0
  72. data/app/views/discerner/searches/edit.html.haml +8 -0
  73. data/app/views/discerner/searches/index.html.haml +13 -0
  74. data/app/views/discerner/searches/index.js.haml +1 -0
  75. data/app/views/discerner/searches/new.html.haml +3 -0
  76. data/app/views/discerner/searches/rename.html.haml +6 -0
  77. data/app/views/discerner/searches/update.js.haml +7 -0
  78. data/app/views/discerner/shared/_categorized_autocompleter_items.html.haml +15 -0
  79. data/app/views/discerner/shared/_error_messages.html.haml +5 -0
  80. data/app/views/layouts/discerner/searches.html.erb +17 -0
  81. data/config/cucumber.yml +8 -0
  82. data/config/routes.rb +17 -0
  83. data/db/migrate/20121004040716_create_discerner_dictionaries.rb +11 -0
  84. data/db/migrate/20121004153043_create_discerner_parameter_categories.rb +12 -0
  85. data/db/migrate/20121005194843_create_discerner_parameter_types.rb +11 -0
  86. data/db/migrate/20121005203223_create_discerner_parameters.rb +14 -0
  87. data/db/migrate/20121008154855_create_discerner_operators.rb +13 -0
  88. data/db/migrate/20121008160313_create_discerner_operators_parameter_types.rb +8 -0
  89. data/db/migrate/20121008161455_create_discerner_parameter_values.rb +13 -0
  90. data/db/migrate/20121008180829_create_discerner_searches.rb +11 -0
  91. data/db/migrate/20121008182443_create_discerner_search_parameters.rb +11 -0
  92. data/db/migrate/20121011205130_create_discerner_search_parameter_values.rb +15 -0
  93. data/db/migrate/20121211213215_add_dictionary_id_to_discerner_searches.rb +5 -0
  94. data/db/migrate/20130205193602_create_discerner_search_combinations.rb +12 -0
  95. data/db/migrate/20130211230636_create_discerner_export_parameters.rb +9 -0
  96. data/db/migrate/20130213185818_add_search_columns_to_discerner_parameters.rb +38 -0
  97. data/db/migrate/20130213205255_rename_database_name_to_search_value_in_discerner_parameter_values.rb +5 -0
  98. data/db/migrate/20130215165416_add_searchable_to_discerner_parameters.rb +5 -0
  99. data/db/migrate/20130218230257_add_exclusive_to_discerner_parameters.rb +5 -0
  100. data/db/migrate/20130220163015_replace_integer_type_with_numeric.rb +22 -0
  101. data/db/migrate/20130221172826_add_unique_identifier_to_discerner_parameters.rb +5 -0
  102. data/db/migrate/20130222052924_change_search_attribute_to_method.rb +29 -0
  103. data/db/migrate/20130222070959_add_export_columns_to_discerner_parameters.rb +6 -0
  104. data/db/migrate/20130227031747_add_unique_identifier_to_discerner_operators.rb +16 -0
  105. data/db/migrate/20130306015019_change_discerner_parameter_values_name.rb +9 -0
  106. data/db/migrate/20130306212430_add_deleted_at_to_discerner_search_parameters.rb +5 -0
  107. data/db/migrate/20130306212504_add_deleted_at_to_discerner_search_parameter_values.rb +5 -0
  108. data/db/migrate/20130306212527_add_deleted_at_to_discerner_search_combinations.rb +5 -0
  109. data/db/migrate/20130306212818_add_deleted_at_to_discerner_export_parameters.rb +5 -0
  110. data/db/migrate/20130311190717_add_operator_type_to_discerner_operators.rb +5 -0
  111. data/db/migrate/20131212175110_remove_extra_search_parameter_values.rb +10 -0
  112. data/db/migrate/20140204170625_create_discerner_parameter_value_categories.rb +16 -0
  113. data/db/migrate/20140204170646_create_discerner_parameter_value_categorizations.rb +12 -0
  114. data/db/migrate/20140227191827_remove_blank_parameter_values_from_export_parameters.rb +10 -0
  115. data/db/seeds.rb +0 -0
  116. data/lib/discerner/engine.rb +16 -0
  117. data/lib/discerner/methods/controllers/export_parameters_controller.rb +38 -0
  118. data/lib/discerner/methods/controllers/parameters_controller.rb +30 -0
  119. data/lib/discerner/methods/controllers/searches_controller.rb +204 -0
  120. data/lib/discerner/methods/helpers/searches_helper.rb +145 -0
  121. data/lib/discerner/methods/models/dictionary.rb +54 -0
  122. data/lib/discerner/methods/models/export_parameter.rb +35 -0
  123. data/lib/discerner/methods/models/operator.rb +42 -0
  124. data/lib/discerner/methods/models/parameter.rb +90 -0
  125. data/lib/discerner/methods/models/parameter_category.rb +60 -0
  126. data/lib/discerner/methods/models/parameter_type.rb +33 -0
  127. data/lib/discerner/methods/models/parameter_value.rb +87 -0
  128. data/lib/discerner/methods/models/parameter_value_categorization.rb +21 -0
  129. data/lib/discerner/methods/models/parameter_value_category.rb +45 -0
  130. data/lib/discerner/methods/models/search.rb +147 -0
  131. data/lib/discerner/methods/models/search_combination.rb +50 -0
  132. data/lib/discerner/methods/models/search_parameter.rb +128 -0
  133. data/lib/discerner/methods/models/search_parameter_value.rb +130 -0
  134. data/lib/discerner/methods/models/soft_delete.rb +35 -0
  135. data/lib/discerner/methods/models/warning.rb +15 -0
  136. data/lib/discerner/parser.rb +497 -0
  137. data/lib/discerner/version.rb +3 -0
  138. data/lib/discerner.rb +4 -0
  139. data/lib/generators/discerner/dictionary/dictionary_generator.rb +38 -0
  140. data/lib/generators/discerner/dictionary/templates/model.rb +15 -0
  141. data/lib/generators/discerner/dictionary/templates/show.xls.erb +37 -0
  142. data/lib/generators/discerner/dictionary/templates/view.html.haml +2 -0
  143. data/lib/generators/discerner/install/install_generator.rb +153 -0
  144. data/lib/generators/discerner/install/templates/controllers/export_parameters_controller.rb +20 -0
  145. data/lib/generators/discerner/install/templates/controllers/parameters_controller.rb +15 -0
  146. data/lib/generators/discerner/install/templates/controllers/searches_controller.rb +39 -0
  147. data/lib/generators/discerner/install/templates/dictionaries.yml +236 -0
  148. data/lib/generators/discerner/install/templates/helpers/searches_helper.rb +9 -0
  149. data/lib/generators/discerner/install/templates/models/book.rb +15 -0
  150. data/lib/generators/discerner/install/templates/models/dictionary.rb +9 -0
  151. data/lib/generators/discerner/install/templates/models/export_parameter.rb +9 -0
  152. data/lib/generators/discerner/install/templates/models/operator.rb +9 -0
  153. data/lib/generators/discerner/install/templates/models/parameter.rb +10 -0
  154. data/lib/generators/discerner/install/templates/models/parameter_category.rb +9 -0
  155. data/lib/generators/discerner/install/templates/models/parameter_type.rb +9 -0
  156. data/lib/generators/discerner/install/templates/models/parameter_value.rb +9 -0
  157. data/lib/generators/discerner/install/templates/models/parameter_value_categorization.rb +9 -0
  158. data/lib/generators/discerner/install/templates/models/parameter_value_category.rb +9 -0
  159. data/lib/generators/discerner/install/templates/models/search.rb +9 -0
  160. data/lib/generators/discerner/install/templates/models/search_combination.rb +9 -0
  161. data/lib/generators/discerner/install/templates/models/search_parameter.rb +9 -0
  162. data/lib/generators/discerner/install/templates/models/search_parameter_value.rb +9 -0
  163. data/lib/generators/discerner/install/templates/views/layouts/searches.html.erb +17 -0
  164. data/lib/setup/operators.yml +91 -0
  165. data/lib/tasks/cucumber.rake +65 -0
  166. data/lib/tasks/discerner_tasks.rake +30 -0
  167. metadata +531 -0
@@ -0,0 +1,51 @@
1
+ .discerner
2
+ :overflow visible !important
3
+ :font-size 13px
4
+ :font-family Helvetica Neue,​Arial,​Helvetica,​sans-serif
5
+ :font-weight 400
6
+
7
+ .ui-widget
8
+ :font-size 13px
9
+ :font-family Helvetica Neue,​Arial,​Helvetica,​sans-serif
10
+ :font-weight 400
11
+
12
+ .message
13
+ :padding 0.5em
14
+ :text-align center
15
+ :margin .75em auto
16
+ :width 80%
17
+ :border-radius 20px
18
+ :border-radius 20px
19
+
20
+ #error, .error
21
+ :border 1px solid maroon
22
+ :color maroon
23
+ :background-color lavenderblush
24
+
25
+ #notice
26
+ :border 1px solid green
27
+ :color darkgreen
28
+ :background-color #cfc
29
+ .clear
30
+ :clear both
31
+
32
+ tr.error
33
+ :border 1px solid lightgray
34
+ :background-color lavenderblush
35
+ td
36
+ :padding-top 2px
37
+ tr.error
38
+ :border none
39
+ .invisible
40
+ :visibility hidden
41
+
42
+ .ui-autocomplete
43
+ :max-height 200px
44
+ :max-width 410px
45
+ :overflow-y auto
46
+ :overflow-x hidden
47
+
48
+ * html .ui-autocomplete
49
+ :height 200px
50
+ :width 410px
51
+
@@ -0,0 +1,43 @@
1
+ #discerner_search
2
+ #discerner_exportable_fields, #discerner_search_summary
3
+ h4
4
+ :color #696969
5
+ :font-size 1em
6
+ :font-weight bold
7
+ :padding-bottom 0.5em
8
+ :padding-top 1.5em
9
+ :margin 0
10
+ h3
11
+ :font-size 1.2em
12
+ :font-weight bold
13
+ :padding-bottom 0.5em
14
+ :margin 0
15
+
16
+ #discerner_search_summary
17
+ :margin-bottom -1em
18
+ table
19
+ :width auto
20
+ th
21
+ :text-align left
22
+ :color #696969
23
+ :background-color #fff
24
+ :padding-top 1.5em
25
+ th, td
26
+ :padding-left 0
27
+ .parameter_name
28
+ :width 18em
29
+ :display block
30
+ :float left
31
+
32
+ #discerner_exportable_fields
33
+ .column
34
+ :float left
35
+ :width 27em
36
+ .error
37
+ :margin -1px 0
38
+ .select_all_parameters, .deselect_all_parameters
39
+ :text-decoration none
40
+ :font-weight normal
41
+ :font-size 0.8em
42
+ .export_parameter
43
+ :margin-bottom 0.25em
@@ -0,0 +1,29 @@
1
+ /* Link styles */
2
+ #discerner_searches, #discerner_search
3
+ .icon_link
4
+ :padding 2px 2px 2px 20px
5
+ :text-decoration none !important
6
+
7
+ .add_link, .add_link:hover
8
+ :background url(add.png) 0 2px no-repeat !important
9
+
10
+ .add_person_link, .add_person_link:hover
11
+ :background url(user_add.png) 0 2px no-repeat !important
12
+
13
+ .edit_link, .edit_link:hover
14
+ :background url(edit.png) 0 2px no-repeat !important
15
+
16
+ .search_link, .search_link:hover
17
+ :background url(find.png) 0 2px no-repeat !important
18
+
19
+ .show_link, .show_link:hover
20
+ :background url(show.png) 0 2px no-repeat !important
21
+
22
+ .list_link, .list_link:hover
23
+ :background url(list.png) 0 2px no-repeat !important
24
+
25
+ .delete_link, .delete_link:hover
26
+ :background url(delete.png) 0 2px no-repeat !important
27
+
28
+ .options_link, .options_link:hover
29
+ :background url(cog.png) 0 2px no-repeat !important
@@ -0,0 +1,205 @@
1
+ #discerner_searches, #discerner_search
2
+ :width 1110px
3
+ :margin 1em
4
+
5
+ .discerner-buttons
6
+ :float right
7
+
8
+ #discerner_searches_filter
9
+ :margin-bottom 1em
10
+
11
+ #discerner_search
12
+ form.new_search
13
+ label, input, select
14
+ :display inline
15
+ :width auto
16
+
17
+ #discerner_search_header
18
+ div.discerner_search_name, div.discerner_search_dictionary, .discerner_dictionary_required_message
19
+ :margin 1em 0.5em
20
+ :height 2em
21
+ :padding 0.25em
22
+ :float left
23
+
24
+ div.discerner_search_name
25
+ form
26
+ :display inline
27
+ :width 10em
28
+
29
+ a, input
30
+ :margin-top -10px
31
+ :margin-bottom 0
32
+
33
+ input[type="text"]
34
+ :width 30em
35
+ .discerner_dictionary_required_message
36
+ color: red
37
+
38
+ #discerner_search_form
39
+ :border 1px solid #D1DAE3
40
+
41
+ table
42
+ :margin-bottom 0
43
+
44
+ table.records tr
45
+ :border none
46
+
47
+ .ui-widget
48
+ :font-size 1em !important
49
+
50
+ .fields td
51
+ :vertical-align top
52
+ :border-bottom 1px solid lightgrey
53
+ :padding-top 0.5em
54
+ :padding-top 0.5em
55
+
56
+ .search_combinations td
57
+ :border none
58
+ .parameter_boolean_operator, td.remove, th.remove,
59
+ .combined_search_operator, .combined_search_operator
60
+ :width 68px
61
+
62
+ .parameter_values
63
+ :padding-right 0 !important
64
+ table
65
+ :margin-bottom 0
66
+ :width 100%
67
+
68
+ td
69
+ :border none
70
+ :padding-top 0
71
+
72
+ .records
73
+ input[type="text"]
74
+ :width 143px
75
+ td.operator, td.value, td.additional_value
76
+ :width 113px
77
+
78
+ td.operator select, td.value input, td.additional_value input
79
+ :margin-top 0
80
+ :padding-top 0
81
+
82
+ .parameter_values_boolean_operator, .chosen
83
+ :width 1.5em
84
+
85
+ button.ui-button
86
+ :margin-bottom 0
87
+
88
+ input.ui-autocomplete-input
89
+ :border 1px solid #CCCCCC
90
+ :border-radius 0px
91
+ :padding-left 0.25em
92
+
93
+ button.ui-widget, input.ui-autocomplete-input
94
+ :font-size 13px !important
95
+ .ui-button-text
96
+ :padding 0 !important
97
+
98
+ .categorized_autocompleter button, .parameter_value button, .combined_search button
99
+ :border-left-width 0
100
+ :background-color #FFFFFF
101
+ :background-image none
102
+ :border-radius 0px
103
+ :margin-top 0 !important
104
+ :padding-top 0 !important
105
+ :padding-bottom 0 !important
106
+ :vertical-align bottom
107
+ :height 1.6em
108
+
109
+ .combined_search_combobox button
110
+ :border-width 0
111
+ :padding 0 !important
112
+
113
+ .parameter, .combined_search, .parameter_value
114
+ .div-category-popup
115
+ ul
116
+ :padding 0
117
+ :margin 0
118
+ li
119
+ :list-style none outside none
120
+ :padding-bottom .25em
121
+
122
+ .parameter, .combined_search
123
+ :width 395px
124
+
125
+ .div-category-popup
126
+ :width 70em
127
+
128
+ input.ui-autocomplete-input
129
+ :width 24em
130
+ .column
131
+ :width 16em
132
+
133
+ .parameter_value
134
+ .div-category-popup
135
+ :width 40em
136
+ input.ui-autocomplete-input
137
+ :width 28em
138
+ .column
139
+ :width 12em
140
+
141
+ .parameter, .combined_search, .parameter_value
142
+ .categorized_autocompleter, .combined_search_combobox
143
+ :border 1px solid #CCCCCC
144
+ :background-color #FFFFFF
145
+ :position relative
146
+
147
+ input.ui-autocomplete-input
148
+ :border none
149
+ :border-right 1px solid #CCCCCC
150
+ :padding-left 0.2em
151
+
152
+ .div-category-popup
153
+ :border-style solid
154
+ :border-color #CCCCCC #999999 #999999 #CCCCCC
155
+ :border-width 1px 3px 3px 1px
156
+ :padding 0.1em 0.1em 1em 0.1em
157
+
158
+ .div-category-list
159
+ :overflow auto
160
+
161
+ .parameter_category, .parameter_value_category
162
+ :padding-bottom 5px
163
+ :padding-left 5px
164
+ :padding-right 5px
165
+ :padding-top 15px
166
+ :clear both
167
+
168
+ .parameter_category_name, .parameter_value_category_name
169
+ :font-weight bold
170
+ :margin-bottom 0
171
+ :margin-left 0
172
+ :margin-right 0
173
+ :margin-top 0
174
+ :padding-bottom 0
175
+ :padding-left 0
176
+ :padding-right 0
177
+ :padding-top 0
178
+
179
+ .column
180
+ :float left
181
+ :margin-right 5px
182
+
183
+ .criteria
184
+ :margin-bottom 3px
185
+ :margin-left 0
186
+ :margin-right 0
187
+ :margin-top 3px
188
+ a
189
+ :text-decoration none
190
+ a:hover
191
+ :border-bottom 1px dotted
192
+
193
+
194
+ .selection_disabled
195
+ :color #cccccc
196
+
197
+ .combined_search_combobox
198
+ button.ui-button
199
+ :margin-bottom 0
200
+ .discerner
201
+ input.ui-autocomplete-input
202
+ :width 20em
203
+
204
+ .ui-menu .ui-menu-item a
205
+ :text-align left
@@ -0,0 +1,32 @@
1
+ /* Tabular Data */
2
+ #discerner_searches, #discerner_search
3
+ table.records, table.repeater
4
+ :width 100%
5
+ :border-collapse collapse
6
+ :border none
7
+
8
+ table.records td, table.repeater td
9
+ :padding 0.125em 0.25em
10
+
11
+ table.records td.action, table.repeater td.action
12
+ :width 5em
13
+
14
+ table.records thead th, table.repeater thead th, table.records tr.labels th
15
+ :background-color #f0f0f0
16
+
17
+ table.records tr, table.repeater tr
18
+ :border 1px solid lightgray
19
+ :background none
20
+
21
+ table.records tbody tr.odd_record, table.repeater tbody tr.odd_record
22
+ :background-color white
23
+
24
+ table.records tr.even_record, table.repeater tr.even_record
25
+ :background-color whitesmoke
26
+
27
+ table.nested
28
+ :width 50%
29
+ :margin-top 1em
30
+
31
+ table tfoot
32
+ :background none
@@ -0,0 +1,2 @@
1
+ class Discerner::ApplicationController < ApplicationController
2
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class ExportParametersController < Discerner::ApplicationController
3
+ include Discerner::Methods::Controllers::ExportParametersController
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class ParametersController < Discerner::ApplicationController
3
+ include Discerner::Methods::Controllers::ParametersController
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class SearchesController < Discerner::ApplicationController
3
+ include Discerner::Methods::Controllers::SearchesController
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module Discerner
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ module ParametersHelper
3
+ include Discerner::Methods::Helpers::SearchesHelper
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ module SearchesHelper
3
+ include Discerner::Methods::Helpers::SearchesHelper
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class Dictionary < ActiveRecord::Base
3
+ include Discerner::Methods::Models::Dictionary
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class ExportParameter < ActiveRecord::Base
3
+ include Discerner::Methods::Models::ExportParameter
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class Operator < ActiveRecord::Base
3
+ include Discerner::Methods::Models::Operator
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class Parameter < ActiveRecord::Base
3
+ include Discerner::Methods::Models::Parameter
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class ParameterCategory < ActiveRecord::Base
3
+ include Discerner::Methods::Models::ParameterCategory
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class ParameterType < ActiveRecord::Base
3
+ include Discerner::Methods::Models::ParameterType
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class ParameterValue < ActiveRecord::Base
3
+ include Discerner::Methods::Models::ParameterValue
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class ParameterValueCategorization < ActiveRecord::Base
3
+ include Discerner::Methods::Models::ParameterValueCategorization
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class ParameterValueCategory < ActiveRecord::Base
3
+ include Discerner::Methods::Models::ParameterValueCategory
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class Search < ActiveRecord::Base
3
+ include Discerner::Methods::Models::Search
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class SearchCombination < ActiveRecord::Base
3
+ include Discerner::Methods::Models::SearchCombination
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class SearchParameter < ActiveRecord::Base
3
+ include Discerner::Methods::Models::SearchParameter
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Discerner
2
+ class SearchParameterValue < ActiveRecord::Base
3
+ include Discerner::Methods::Models::SearchParameterValue
4
+ end
5
+ end
@@ -0,0 +1,55 @@
1
+ #discerner_search
2
+ = render 'discerner/searches/summary'
3
+ .discerner-buttons
4
+ = link_to 'Back to search', edit_search_path(@discerner_search), :class => "discerner-button discerner-button-positive"
5
+ .clear
6
+ %hr
7
+
8
+ - unless @discerner_search.disabled? && @discerner_search.export_parameters && @discerner_search.export_parameters.select{|ep| ep.disabled?}.empty?
9
+ #discerner_exportable_fields
10
+ %h3
11
+ Fields to be exported
12
+
13
+ - exportable_parameter_categories = exportable_parameter_categories(@discerner_search)
14
+ - if exportable_parameter_categories.blank?
15
+ = "-- No exportable parameters detected --"
16
+ - else
17
+ - selected_parameters = @discerner_search.export_parameters.ordered.to_a
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
+
20
+ = form_tag assign_export_parameters_path(@discerner_search), :url => {:action => "assign"} do
21
+ - exportable_parameter_categories.each do |c|
22
+ .clear
23
+ %div{ :class => "#{c.css_class_name}"}
24
+ %h4
25
+ = c.name
26
+ %a{ :class => "select_all_parameters", :href => "#"}
27
+ Select all
28
+
29
+ - items = exportable_parameters(@discerner_search, c)
30
+ - columns_count = 3
31
+ - items_rendered_count = 0
32
+ - (0...columns_count).each do |i|
33
+ .column
34
+ - column_items_count = ((items.size - items_rendered_count).to_f/(columns_count-i)).ceil
35
+ - from = items_rendered_count
36
+ - to = items_rendered_count + column_items_count
37
+ - to = items.size if to > items.size
38
+ - items_rendered_count = to
39
+ - (from...to).each do |j|
40
+ - export_parameter = items[j]
41
+ %div{ :class => "export_parameter #{'error' if export_parameter.deleted?}"}
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, :id => "parameter_ids_#{export_parameter.id}"
44
+ = label_tag "parameter_ids_#{export_parameter.id}", export_parameter.name
45
+
46
+ .clear
47
+ .discerner-buttons
48
+ - if @discerner_search.disabled?
49
+ = submit_tag 'Update and export', :class => "discerner-button discerner-button-positive"
50
+ - else
51
+ = submit_tag 'Export', :class => "discerner-button discerner-button-positive"
52
+ :javascript
53
+ $(function () {
54
+ new Discerner.ExportParameters.UI();
55
+ });
@@ -0,0 +1,49 @@
1
+ - parameter ||= @parameter
2
+ - search_parameter_value_id ||= @search_parameter_value_id
3
+ - parameter_values = parameter_value_options(@searchable_parameter_values[parameter.id], search_parameter_value_id)
4
+
5
+ - if parameter.parameter_values.categorized.any?
6
+ %div{:class => 'ui-widget categorized_autocompleter'}
7
+
8
+ - if defined?(f)
9
+ = f.select(:parameter_value_id, parameter_values, { :include_blank => true }, {:class => 'parameter_values_combobox_autocompleter'})
10
+ - else
11
+ = select_tag(:parameter_value_id, options_for_select(parameter_values), :include_blank => true, :class => 'parameter_values_combobox_autocompleter')
12
+
13
+ %a{ :href => 'javascript:void(0);', :class => 'categorized_autocompleter_link collapsed_categorized_autocompleter_link' }
14
+ Select
15
+ .div-category-popup{ :style => "display: none;"}
16
+ .div-category-list
17
+ - parameter.parameter_value_categories.ordered_by_display_order_and_name.each do |parameter_value_category|
18
+ - unless parameter_value_category.parameter_values.empty?
19
+ = div_for parameter_value_category, :class => "#{parameter_value_category.css_class} categorized-parameter-values" do
20
+ %p{ :class => 'parameter_value_category_name' }
21
+ = parameter_value_category.name
22
+ - if parameter_value_category.collapse?
23
+ %a{ :class => "show-category-items", :href => "#"}
24
+ more
25
+ - else
26
+ %a{ :class => "hide-category-items", :href => "#"}
27
+ less
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
+ - unless items.empty?
31
+ = render :partial => 'discerner/shared/categorized_autocompleter_items', :locals => { :columns_count => 2, :items => items }
32
+ .clear
33
+
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
+ - unless uncategorized_items.empty?
36
+ .uncategorized-parameter-values.parameter_value_category
37
+ %p{ :class => 'parameter_value_category_name' }
38
+ Uncategorized
39
+ %a{ :class => "hide-category-items", :href => "#"}
40
+ less
41
+ .category-items
42
+ = render :partial => 'discerner/shared/categorized_autocompleter_items', :locals => { :columns_count => 2, :items => uncategorized_items }
43
+
44
+ .div-instruction-bar
45
+ - else
46
+ - if defined?(f)
47
+ = f.select(:parameter_value_id, parameter_values, { :include_blank => true },{ :class => 'parameter_values_combobox_autocompleter' })
48
+ - else
49
+ = select_tag(:parameter_value_id, options_for_select(parameter_values), :include_blank => true, :class => 'parameter_values_combobox_autocompleter')
@@ -0,0 +1 @@
1
+ = render :partial => 'discerner/parameters/values_autocompleter', :locals => {:parameter => @parameter, :search_parameter_value_id => @search_parameter_value_id}
@@ -0,0 +1,21 @@
1
+ - unless @discerner_search.blank?
2
+ = render 'discerner/shared/error_messages', :object => @discerner_search
3
+
4
+ #discerner_search_form
5
+ = form_for @discerner_search, :html => { :id => 'search' } do |f|
6
+ = render :partial => 'form_header', :locals => { :f => f }
7
+ - unless enable_combined_searches?.blank?
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
+ .clear
12
+
13
+ :javascript
14
+ $(function () {
15
+ var yearRange = '#{DateTime.now.year - 100}:#{DateTime.now.year}',
16
+ renameUrl = '#{@discerner_search.persisted? ? rename_search_path(@discerner_search) : ""}';
17
+ new Discerner.Search.UI({
18
+ yearRange: yearRange,
19
+ renameUrl: renameUrl
20
+ })
21
+ });
@@ -0,0 +1,32 @@
1
+ %table{ :class => 'records search_combinations' }
2
+ %thead
3
+ %tr
4
+ %th.combined_search_operator
5
+ %th.combined_search
6
+ Searches
7
+ %th.remove
8
+ %th
9
+ %tbody.nested_records_search_combinations
10
+ - if combined_searches_options(@discerner_search).blank?
11
+ %td{:colspan => '4'}
12
+ No qualifying searches found
13
+ - else
14
+ - @discernerSearchCombinationsTemplate = generate_nested_attributes_template(f, :search_combinations, 'search_combination')
15
+ = f.fields_for :search_combinations, f.object.search_combinations.ordered_by_display_order do |search_combination|
16
+ = render :partial => 'search_combination_fields', :locals => { :f => search_combination }
17
+
18
+ %tfoot
19
+ %tr
20
+ %td{ :colspan => '4', :class => 'add_search_combinations_link' }
21
+ = link_to_add_fields "Add search", :search_combinations
22
+ .clear
23
+
24
+ :javascript
25
+ $(function () {
26
+ var discernerSearchCombinationsTemplate = '#{@discernerSearchCombinationsTemplate}';
27
+ if (discernerSearchCombinationsTemplate) {
28
+ new Discerner.SearchCombination.UI({
29
+ searchCombinationsTemplate: discernerSearchCombinationsTemplate
30
+ })
31
+ }
32
+ });
@@ -0,0 +1,8 @@
1
+ .discerner-buttons
2
+ - if @discerner_search.disabled?
3
+ = submit_tag 'Update search', :class => "discerner-button discerner-button-positive"
4
+ - else
5
+ = submit_tag 'Search', :class => "discerner-button discerner-button-positive"
6
+ - if @discerner_search.persisted? && export_discerner_results? && discerner_export_link
7
+ = discerner_export_link
8
+ = link_to 'Clear', new_search_path, :class => "discerner-button discerner-button-negative"