Commit 4ef3656169512ec7f3a2d555c5321b2362aaf5e6
Committed by
Macartur Sousa
1 parent
482b8deb
Exists in
elasticsearch_api
Changes style of elasticsearch plugin, add variable to store search types.
Signed-off-by: DylanGuedes <djmgguedes@gmail.com> Signed-off-by: Macartur Sousa <marcartur.sc@gmail.com>
Showing
3 changed files
with
48 additions
and
7 deletions
Show diff stats
plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb
1 | class ElasticsearchPluginController < ApplicationController | 1 | class ElasticsearchPluginController < ApplicationController |
2 | no_design_blocks | 2 | no_design_blocks |
3 | 3 | ||
4 | - SEARCHABLE_TYPES = { :all => { label: "All Results" }, | ||
5 | - :community => { label: "Communities"}, | ||
6 | - :article => { label: "Articles"}, | ||
7 | - :event => { label: "Events"}, | ||
8 | - :person => { label: "People"} | 4 | + SEARCHABLE_TYPES = { :all => { label: _("All Results")}, |
5 | + :community => { label: _("Communities")}, | ||
6 | + :article => { label: _("Articles")}, | ||
7 | + :event => { label: _("Events")}, | ||
8 | + :person => { label: _("People")} | ||
9 | } | 9 | } |
10 | + SEARCH_FILTERS = { :lexical => { label: _("Alphabetical Order")}, | ||
11 | + :recent => { label: _("More Recent Order")}, | ||
12 | + :access => { label: _("More accessed")} | ||
13 | + } | ||
10 | 14 | ||
11 | def index | 15 | def index |
12 | search() | 16 | search() |
@@ -16,6 +20,7 @@ class ElasticsearchPluginController < ApplicationController | @@ -16,6 +20,7 @@ class ElasticsearchPluginController < ApplicationController | ||
16 | def search | 20 | def search |
17 | @searchable_types = SEARCHABLE_TYPES | 21 | @searchable_types = SEARCHABLE_TYPES |
18 | @selected_type = selected_type params | 22 | @selected_type = selected_type params |
23 | + @search_filter_types = SEARCH_FILTERS | ||
19 | 24 | ||
20 | @query = params[:q] | 25 | @query = params[:q] |
21 | @results = [] | 26 | @results = [] |
plugins/elasticsearch/public/style.css
@@ -9,4 +9,31 @@ | @@ -9,4 +9,31 @@ | ||
9 | flex: 1; | 9 | flex: 1; |
10 | } | 10 | } |
11 | 11 | ||
12 | +.controller-elasticsearch_plugin ul { | ||
13 | + list-style: none; | ||
14 | + list-style-position: inside; | ||
15 | + padding-left: 0px; | ||
16 | +} | ||
12 | 17 | ||
18 | +.controller-elasticsearch_plugin .select-search-type { | ||
19 | + padding: 10px; | ||
20 | + margin: 10px; | ||
21 | + font-weight: 900; | ||
22 | + font-family: arial; | ||
23 | + border: 1px solid #ddd; | ||
24 | + margin-top: 0px; | ||
25 | + margin-bottom: 0px; | ||
26 | +} | ||
27 | +.controller-elasticsearch_plugin .select-search-type.active { | ||
28 | + padding: 10px; | ||
29 | + background: #ccc; | ||
30 | + margin-left: 10px; | ||
31 | + margin-right: 10px; | ||
32 | + font-weight: 900; | ||
33 | + font-family: arial; | ||
34 | +} | ||
35 | + | ||
36 | +.controller-elasticsearch_plugin .select-search-type a { | ||
37 | + text-decoration: none; | ||
38 | + color: black; | ||
39 | +} |
plugins/elasticsearch/views/elasticsearch_plugin/search.html.erb
@@ -3,16 +3,25 @@ | @@ -3,16 +3,25 @@ | ||
3 | <div class="sidebar"> | 3 | <div class="sidebar"> |
4 | <%= @results.count %> | 4 | <%= @results.count %> |
5 | <ul> | 5 | <ul> |
6 | + <li class="select-search-type active"><a href="#"> <%= @searchable_types.values[0][:label] %></a></li> | ||
6 | <% for type in @searchable_types.values %> | 7 | <% for type in @searchable_types.values %> |
7 | - <li><a class=""> <%= type[:label] %></a></li> | 8 | + <li class="select-search-type"><a href="#"> <%= type[:label] %></a></li> |
8 | <% end %> | 9 | <% end %> |
9 | </ul> | 10 | </ul> |
11 | + | ||
12 | + <div class="search-filter"> | ||
13 | + <h3><%= _("Filter by") %></h3> | ||
14 | + <ul> | ||
15 | + <% for type in @search_filter_types.values %> | ||
16 | + <li><a href="#"><%= type[:label] %></a></li> | ||
17 | + <% end %> | ||
18 | + </ul> | ||
19 | + </div> | ||
10 | </div> | 20 | </div> |
11 | 21 | ||
12 | <div class="search_form"> | 22 | <div class="search_form"> |
13 | <div class="search_field"> | 23 | <div class="search_field"> |
14 | <%= form_tag controller: "elasticsearch_plugin", action: "search" do %> | 24 | <%= form_tag controller: "elasticsearch_plugin", action: "search" do %> |
15 | - <%= label_tag(:q, _("Search")) %> | ||
16 | <%= text_field_tag(:q, @query) %> | 25 | <%= text_field_tag(:q, @query) %> |
17 | 26 | ||
18 | <%= submit_tag _("Send") %> | 27 | <%= submit_tag _("Send") %> |