diff --git a/app/assets/stylesheets/advanced_search.scss b/app/assets/stylesheets/advanced_search.scss new file mode 100644 index 000000000..4ea3a5fd1 --- /dev/null +++ b/app/assets/stylesheets/advanced_search.scss @@ -0,0 +1,50 @@ +.advanced-search { + float: left; + margin: $line-height 0; + position: inherit; + + @include breakpoint(medium) { + float: right; + margin-bottom: 0; + margin-top: $line-height / 4; + position: absolute; + right: 0; + } +} + +.advanced-search-form { + + @include breakpoint(large) { + .filter { + @include grid-column; + width: 25%; + } + + .date-filters { + float: left; + width: 50%; + + .filter { + width: 50%; + } + + .custom-date-filters { + clear: both; + } + } + + .submit { + width: 25%; + } + } + + .general-search, + .filter, + .submit { + @include grid-column-gutter; + } + + select { + height: $line-height * 2; + } +} diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 38c4185fc..b03ac1368 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -6,6 +6,7 @@ @import "icons"; @import "mixins"; @import "admin"; +@import "advanced_search"; @import "layout"; @import "participation"; @import "milestones"; diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 4f229794e..6e46858cd 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -8,7 +8,6 @@ // 06. Forms // 07. Callout // 08. User account -// 09. Search // 10. Official levels // 11. Tables // 12. Social @@ -1480,40 +1479,6 @@ form { } } -// 09. Search -// ---------- - -.advanced-search { - float: left; - margin: $line-height 0; - position: inherit; - - @include breakpoint(medium) { - float: right; - margin-bottom: 0; - margin-top: $line-height / 4; - position: absolute; - right: 0; - } -} - -.advanced-search-form { - - @include breakpoint(medium) { - > .column { - padding: 0; - } - } - - select { - height: $line-height * 2; - } - - .column.end.clear { - clear: both; - } -} - // 10. Officials levels // -------------------- diff --git a/app/components/concerns/sdg/goals/options_for_select.rb b/app/components/concerns/sdg/goals/options_for_select.rb new file mode 100644 index 000000000..559168a3a --- /dev/null +++ b/app/components/concerns/sdg/goals/options_for_select.rb @@ -0,0 +1,7 @@ +module SDG::Goals::OptionsForSelect + extend ActiveSupport::Concern + + def goal_options(selected_code = nil) + options_from_collection_for_select(SDG::Goal.order(:code), :code, :code_and_title, selected_code) + end +end diff --git a/app/components/sdg_management/relations/index_component.rb b/app/components/sdg_management/relations/index_component.rb index 170fa7573..4af870992 100644 --- a/app/components/sdg_management/relations/index_component.rb +++ b/app/components/sdg_management/relations/index_component.rb @@ -1,5 +1,6 @@ class SDGManagement::Relations::IndexComponent < ApplicationComponent include Header + include SDG::Goals::OptionsForSelect attr_reader :records @@ -47,7 +48,7 @@ class SDGManagement::Relations::IndexComponent < ApplicationComponent end def goal_options - options_from_collection_for_select(SDG::Goal.all, :code, :code_and_title, params[:goal_code]) + super(params[:goal_code]) end def target_options diff --git a/app/components/shared/advanced_search_component.html.erb b/app/components/shared/advanced_search_component.html.erb new file mode 100644 index 000000000..b03a371fc --- /dev/null +++ b/app/components/shared/advanced_search_component.html.erb @@ -0,0 +1,65 @@ +