udongo 7.5.0 → 7.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc8c7b4bbcf91c6533f4bd2d275a64c63971d114
4
- data.tar.gz: b5f234c45d64860b99918f7ae082fe955d3398c5
3
+ metadata.gz: 4177132fc9f3839266578b24b8bc6fbf4e089668
4
+ data.tar.gz: c162d73c7d75c2548d75e5f4ea373717427300d9
5
5
  SHA512:
6
- metadata.gz: 715f1f441cf1f7dcb94b077ad5f4843473e43316bcfa1db370556fd29ca3b1feea01d303cdcebd3f991a5f9024cc53552641fb56ed567b8f01b71212aaa46c2d
7
- data.tar.gz: 47edb83449ec1052d115c6a53b5420205454540ed8cd92c8e23ce20107abad3d35ee475bedd9274faac6b703128e9bd389483a5fe902fa7d3c99e7968912d96a
6
+ metadata.gz: 63a75acceeae182eed74dd8179808ab06eceb45a2087a5efc225688200bba608ff7d6a9e155e5197f2b6880799511133b67210e57000433c710c6c673527008e
7
+ data.tar.gz: e5ac2f9ccaad7c46a2409cbb57de43eb555c6748bb86806b4709b1e99149bb6e386485edfc3dc2703c37f799011ec00960d6306d9ad39a7e14fbb758e21fb9de
@@ -0,0 +1,14 @@
1
+ class Backend::SearchTermsController < Backend::BaseController
2
+ before_action -> { breadcrumb.add t('b.search_terms'), backend_search_terms_path }
3
+
4
+ def index
5
+ @search_terms = ::SearchTerm.select('*, COUNT(1) as total')
6
+ .group('locale, term')
7
+ .order('COUNT(1) DESC')
8
+ end
9
+
10
+ def destroy_all
11
+ ::SearchTerm.destroy_all
12
+ redirect_to backend_search_terms_path, notice: t('b.msg.search_terms.deleted')
13
+ end
14
+ end
@@ -5,6 +5,6 @@ class SearchModule < ApplicationRecord
5
5
 
6
6
  def indices
7
7
  SearchIndex.joins('INNER JOIN search_modules ON search_indices.searchable_type = search_modules.name')
8
- .where('search_modules.name = ?', name)
8
+ .where('search_modules.name = ?', name)
9
9
  end
10
10
  end
@@ -0,0 +1,3 @@
1
+ class SearchTerm < ApplicationRecord
2
+ validates :locale, :term, presence: true
3
+ end
@@ -9,13 +9,13 @@
9
9
  <div class="card-block">
10
10
  <div class="row">
11
11
  <div class="col-md-6">
12
- <%= f.input :locale, collection: Udongo.config.i18n.cms.interface_locales, include_blank: false %>
12
+ <%= f.input :locale, collection: Udongo.config.i18n.cms.interface_locales, selected: params[:search_locale], include_blank: false %>
13
13
  </div>
14
14
  </div>
15
15
 
16
16
  <div class="row">
17
17
  <div class="col-md-6">
18
- <%= f.input :term %>
18
+ <%= f.input :term, input_html: { value: params[:term] } %>
19
19
  </div>
20
20
 
21
21
  <div class="col-md-6">
@@ -0,0 +1,37 @@
1
+ <%= render 'backend/breadcrumbs' %>
2
+
3
+ <% if @search_terms.any? %>
4
+ <p>
5
+ <%= link_to backend_search_terms_path, class: 'btn btn-danger', method: 'delete', data: { confirm: t('b.msg.confirm') } do %>
6
+ <%= icon :trash %>
7
+ <%= t('b.msg.search_terms.destroy_all') %>
8
+ <% end %>
9
+ </p>
10
+
11
+ <table class="table table-hover table-striped">
12
+ <thead class="thead-inverse">
13
+ <tr>
14
+ <th><%= t 'b.locale' %></th>
15
+ <th><%= t 'b.search_term' %></th>
16
+ <th><%= t 'b.times_used' %></th>
17
+ <th>&nbsp;</th>
18
+ </tr>
19
+ </thead>
20
+
21
+ <tbody>
22
+ <% @search_terms.each do |s| %>
23
+ <tr>
24
+ <td><%= s.locale.upcase %></td>
25
+ <td><%= s.term %></td>
26
+ <td><%= s.total %></td>
27
+ <td class="text-right">
28
+ <%= link_to icon(:clone), new_backend_search_synonym_path(search_locale: s.locale, term: s.term), title: t('b.msg.search_synonyms.create') %>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
34
+
35
+ <% else %>
36
+ <p><%= t 'b.msg.no_items' %></p>
37
+ <% end %>
@@ -29,6 +29,7 @@
29
29
  <li class="nav-item dropdown">
30
30
  <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><%= icon(:search, t('b.search')) %></a>
31
31
  <div class="dropdown-menu">
32
+ <%= link_to t('b.search_terms'), backend_search_terms_path, class: 'dropdown-item' %>
32
33
  <%= link_to t('b.synonyms'), backend_search_synonyms_path, class: 'dropdown-item' %>
33
34
  </div>
34
35
  </li>
data/changelog.md CHANGED
@@ -1,3 +1,9 @@
1
+ 7.5.1 - 2018-07-26
2
+ --
3
+ * Let Udongo search ignore diacritics in search terms.
4
+ * Adds an overview of used search terms to the backend.
5
+
6
+
1
7
  7.5.0 - 2018-06-13
2
8
  --
3
9
  * Make it possible to mark a content picture to be used in the background with a
@@ -76,6 +76,7 @@ en:
76
76
  save: Save
77
77
  search: Search
78
78
  search_term: Search term
79
+ search_terms: Used search terms
79
80
  search_synonym: Search synonym
80
81
  search_synonyms: Search synonyms
81
82
  sender: Sender
@@ -94,6 +95,7 @@ en:
94
95
  tag: Tag
95
96
  tags: Tags
96
97
  telephone: Telephone
98
+ times_used: Times used
97
99
  title: Title
98
100
  to: To
99
101
  type: Type
@@ -175,6 +177,11 @@ en:
175
177
  invisible: Deze pagina is niet zichtbaar op de website.
176
178
  please_select_a_valid_image: Please select a valid image and try again.
177
179
  saved: '%{actor} was saved.'
180
+ search_terms:
181
+ deleted: The list with used search terms was cleared.
182
+ destroy_all: Delete all used search terms
183
+ search_synonyms:
184
+ create: Create a search synonym based on this search term
178
185
  seo: SEO
179
186
  something_went_wrong: Something went wrong!
180
187
  status_codes:
@@ -78,6 +78,7 @@ nl:
78
78
  save: Opslaan
79
79
  search: Zoeken
80
80
  search_term: Zoekterm
81
+ search_terms: Gebruikte zoektermen
81
82
  search_synonym: Zoekterm synoniem
82
83
  search_synonyms: Zoekterm synoniemen
83
84
  sender: Afzender
@@ -96,6 +97,7 @@ nl:
96
97
  tag: Tag
97
98
  tags: Tags
98
99
  telephone: Telefoonnummer
100
+ times_used: Aantal keer gebruikt
99
101
  title: Titel
100
102
  to: Naar
101
103
  type: Type
@@ -177,6 +179,11 @@ nl:
177
179
  invisible: Deze pagina is niet zichtbaar op de website.
178
180
  please_select_a_valid_image: Gelieve een geldige afbeelding te selecteren en opnieuw te proberen.
179
181
  saved: '%{actor} werd bewaard.'
182
+ search_terms:
183
+ deleted: De lijst met gebruikte zoektermen werd gewist
184
+ destroy_all: Verwijder alle gebruikte zoektermen
185
+ search_synonyms:
186
+ create: Maak zoeksyniem aan op basis van deze term
180
187
  seo: SEO
181
188
  something_went_wrong: Er liep iets fout!
182
189
  status_codes:
data/config/routes.rb CHANGED
@@ -19,6 +19,9 @@ Rails.application.routes.draw do
19
19
 
20
20
  resources :sessions, only: [:new, :create, :destroy]
21
21
  resources :admins
22
+ resources :search_terms, only: [:index] do
23
+ collection { delete '/', action: 'destroy_all' }
24
+ end
22
25
  resources :users
23
26
  resources :redirects, except: :show
24
27
  resources :search_synonyms, except: :show
@@ -0,0 +1,10 @@
1
+ class CreateSearches < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :searches do |t|
4
+ t.string :locale
5
+ t.string :term
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class RenameSearchToSearchTerms < ActiveRecord::Migration[5.0]
2
+ def change
3
+ rename_table :searches, :search_terms
4
+ end
5
+ end
@@ -14,7 +14,6 @@ module Udongo
14
14
  background = options[:background].to_s.parameterize
15
15
 
16
16
  str = action.to_s.split('_').last
17
- # TODO: rekening houden met asset updated_at
18
17
  str << "-q#{quality}" if quality.present?
19
18
  str << "-g#{gravity}" if gravity.present?
20
19
  str << "-b#{background}" if background.present?
@@ -47,7 +47,7 @@ module Udongo::Search
47
47
  # a searchable result. Otherwise matches from both an indexed
48
48
  # Page#title and Page#description would be in the result set.
49
49
  stack << m.indices
50
- .where('search_indices.value REGEXP ?', term.value)
50
+ .where('search_indices.value LIKE ?', "%#{term.value}%")
51
51
  .group([:searchable_type, :searchable_id])
52
52
  end.flatten
53
53
  end
@@ -16,6 +16,8 @@ module Udongo::Search
16
16
  # If you return nil in the #url method of a result object, the item
17
17
  # will get filtered out of the search results.
18
18
  def search
19
+ ::SearchTerm.create!(locale: controller.locale, term: term.value) if term
20
+
19
21
  indices.map do |index|
20
22
  result = result_object(index)
21
23
  next if result.hidden? || result.unpublished? || result.url.nil?
@@ -1,3 +1,3 @@
1
1
  module Udongo
2
- VERSION = '7.5.0'
2
+ VERSION = '7.5.1'
3
3
  end
@@ -0,0 +1,6 @@
1
+ FactoryGirl.define do
2
+ factory :search_term do
3
+ locale 'nl'
4
+ term 'foo'
5
+ end
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: udongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.5.0
4
+ version: 7.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davy Hellemans
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-06-13 00:00:00.000000000 Z
12
+ date: 2018-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -489,6 +489,7 @@ files:
489
489
  - app/controllers/backend/redirects_controller.rb
490
490
  - app/controllers/backend/search_controller.rb
491
491
  - app/controllers/backend/search_synonyms_controller.rb
492
+ - app/controllers/backend/search_terms_controller.rb
492
493
  - app/controllers/backend/seo_controller.rb
493
494
  - app/controllers/backend/sessions_controller.rb
494
495
  - app/controllers/backend/snippets_controller.rb
@@ -600,6 +601,7 @@ files:
600
601
  - app/models/search_index.rb
601
602
  - app/models/search_module.rb
602
603
  - app/models/search_synonym.rb
604
+ - app/models/search_term.rb
603
605
  - app/models/setting.rb
604
606
  - app/models/snippet.rb
605
607
  - app/models/store.rb
@@ -713,6 +715,7 @@ files:
713
715
  - app/views/backend/search_synonyms/edit.html.erb
714
716
  - app/views/backend/search_synonyms/index.html.erb
715
717
  - app/views/backend/search_synonyms/new.html.erb
718
+ - app/views/backend/search_terms/index.html.erb
716
719
  - app/views/backend/sessions/new.html.erb
717
720
  - app/views/backend/snippets/_form.html.erb
718
721
  - app/views/backend/snippets/_tabs.html.erb
@@ -868,6 +871,8 @@ files:
868
871
  - db/migrate/20180427144338_add_missing_seo_fields_to_tags.rb
869
872
  - db/migrate/20180427150844_remove_locales_and_seo_locales_from_tags.rb
870
873
  - db/migrate/20180613113816_add_content_picture_bg_image_fields.rb
874
+ - db/migrate/20180719160953_create_searches.rb
875
+ - db/migrate/20180719164016_rename_search_to_search_terms.rb
871
876
  - lib/tasks/task_extras.rb
872
877
  - lib/tasks/udongo_tasks.rake
873
878
  - lib/udongo.rb
@@ -947,6 +952,7 @@ files:
947
952
  - spec/factories/search_indices.rb
948
953
  - spec/factories/search_modules.rb
949
954
  - spec/factories/search_synonyms.rb
955
+ - spec/factories/search_terms.rb
950
956
  - spec/factories/settings.rb
951
957
  - spec/factories/snippets.rb
952
958
  - spec/factories/stores.rb