udongo 6.2.1 → 6.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/backend/tagbox_controller.rb +1 -1
- data/app/controllers/backend/tags_controller.rb +52 -0
- data/app/helpers/link_helper.rb +24 -2
- data/app/models/concerns/imageable.rb +1 -1
- data/app/models/concerns/taggable.rb +1 -1
- data/app/models/tag.rb +2 -0
- data/app/views/backend/assets/_asset_usages.html.erb +36 -0
- data/app/views/backend/assets/index.html.erb +8 -0
- data/app/views/backend/tags/_filter.html.erb +24 -0
- data/app/views/backend/tags/_form.html.erb +21 -0
- data/app/views/backend/tags/_tag_usages.html.erb +25 -0
- data/app/views/backend/tags/edit.html.erb +4 -0
- data/app/views/backend/tags/index.html.erb +47 -0
- data/app/views/backend/tags/new.html.erb +3 -0
- data/app/views/layouts/backend/_top_navigation.html.erb +1 -0
- data/changelog.md +10 -0
- data/config/locales/en_backend.yml +5 -0
- data/config/locales/en_forms.yml +2 -0
- data/config/locales/nl_backend.yml +5 -0
- data/config/locales/nl_forms.yml +1 -0
- data/config/routes.rb +1 -1
- data/lib/udongo/version.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e38f8e29debafdfa34fa918c39c0b455a98fdfe3
|
4
|
+
data.tar.gz: 86ad83a3e6098a11ab2a415a47a0ddc17e312950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aa4bee65d5e3855210ec61792837f9491bb86cc57e14bfc4a6b5480fe5ca344f3363b737b77582c80e63e747a395a4358874892e634ad5b82db3d6ff16ede45
|
7
|
+
data.tar.gz: 92ff03bbd6e0ca03dd8e65e3f67971b767d472dbdc1335015db7ed7455b55c7590f6e55827ef9cb4fc9f775987c7e229bbb9a2ded6b067404cb2a8d9b2f59ee5
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class Backend::TagsController < Backend::BaseController
|
2
|
+
include Concerns::PaginationController
|
3
|
+
|
4
|
+
before_action -> { breadcrumb.add t('b.tags'), backend_tags_path }
|
5
|
+
before_action :find_model, only: [:show, :edit, :update, :destroy]
|
6
|
+
|
7
|
+
def index
|
8
|
+
@search = Tag.ransack params[:q]
|
9
|
+
@tags = @search.result(distinct: true).order(:name).page(page_number).per_page(15)
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
redirect_to edit_backend_tag_path(@tag)
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
@tag = Tag.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def create
|
21
|
+
@tag = Tag.new(allowed_params)
|
22
|
+
|
23
|
+
if @tag.save
|
24
|
+
redirect_to backend_tags_path, notice: translate_notice(:added, :tag)
|
25
|
+
else
|
26
|
+
render :new
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy
|
31
|
+
@tag.destroy
|
32
|
+
redirect_to backend_tags_path, notice: translate_notice(:deleted, :tag)
|
33
|
+
end
|
34
|
+
|
35
|
+
def update
|
36
|
+
if @tag.update_attributes allowed_params
|
37
|
+
redirect_to backend_tags_path, notice: translate_notice(:edited, :tag)
|
38
|
+
else
|
39
|
+
render :edit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def allowed_params
|
46
|
+
params.require(:tag).permit(:locale, :name, :slug)
|
47
|
+
end
|
48
|
+
|
49
|
+
def find_model
|
50
|
+
@tag = Tag.find params[:id]
|
51
|
+
end
|
52
|
+
end
|
data/app/helpers/link_helper.rb
CHANGED
@@ -7,6 +7,17 @@ module LinkHelper
|
|
7
7
|
)
|
8
8
|
end
|
9
9
|
|
10
|
+
# Say you have a page with a title: 'Foo'. When calling this method with that
|
11
|
+
# page object, you would get a link to /backend/pages/edit/1 with the title
|
12
|
+
# as label.
|
13
|
+
def link_to_edit_with_label(value, locale)
|
14
|
+
link_to(
|
15
|
+
object_label(value, locale),
|
16
|
+
path_from_string_or_object(value, 'edit_'),
|
17
|
+
title: t('b.edit')
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
10
21
|
def link_to_edit(value)
|
11
22
|
link_to(
|
12
23
|
icon(:pencil_square_o),
|
@@ -32,12 +43,23 @@ module LinkHelper
|
|
32
43
|
)
|
33
44
|
end
|
34
45
|
|
35
|
-
private
|
36
|
-
|
37
46
|
def path_from_string_or_object(value, prefix = nil)
|
38
47
|
return value if value.is_a?(String)
|
39
48
|
|
40
49
|
str = "#{prefix}#{Udongo::ObjectPath.find(value)}"
|
41
50
|
send(str, *Udongo::ObjectPath.remove_symbols(value))
|
42
51
|
end
|
52
|
+
|
53
|
+
def object_label(value, locale)
|
54
|
+
obj = Udongo::ObjectPath.remove_symbols(value)
|
55
|
+
obj = obj.last if obj.is_a?(Array)
|
56
|
+
|
57
|
+
I18n.with_locale(locale) do
|
58
|
+
return obj.title if obj.respond_to?(:title)
|
59
|
+
return obj.name if obj.respond_to?(:name)
|
60
|
+
return obj.description if obj.respond_to?(:description)
|
61
|
+
end
|
62
|
+
|
63
|
+
"#{I18n.t("b.#{obj.class.name.underscore}")}: #{obj.id}"
|
64
|
+
end
|
43
65
|
end
|
data/app/models/tag.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
<% count = asset.images.count + asset.content_pictures.count %>
|
2
|
+
<% lbl = "#{t(true.to_s)} (#{count})" %>
|
3
|
+
<%= link_to icon(:search, lbl), '#', data: { toggle: 'modal', target: "#asset-usages-#{asset.id}" }%>
|
4
|
+
|
5
|
+
<div class="modal fade" id="asset-usages-<%= asset.id %>" tabindex="-1" role="dialog" aria-labelledby="asset-usages-title" aria-hidden="true">
|
6
|
+
<div class="modal-dialog modal-lg" role="document">
|
7
|
+
<div class="modal-content">
|
8
|
+
<div class="modal-header">
|
9
|
+
<h5 class="modal-title" id="asset-usages-title"><%= asset.description %></h5>
|
10
|
+
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t 'b.close' %>">
|
11
|
+
<span aria-hidden="true">×</span>
|
12
|
+
</button>
|
13
|
+
</div>
|
14
|
+
<div class="modal-body">
|
15
|
+
<ul>
|
16
|
+
<% asset.images.each do |img| %>
|
17
|
+
<li>
|
18
|
+
<%= t "b.#{img.imageable.class.name.underscore}" %> >
|
19
|
+
<%= link_to_edit_with_label [:backend, img.imageable], default_app_locale %>
|
20
|
+
</li>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<% asset.content_pictures.each do |picture| %>
|
24
|
+
<li>
|
25
|
+
<%= t "b.#{picture.parent.class.name.underscore}" %> > <%= t 'b.flexible_content' %> >
|
26
|
+
<%= link_to_edit_with_label [:backend, picture.parent], default_app_locale %>
|
27
|
+
</li>
|
28
|
+
<% end %>
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
<div class="modal-footer">
|
32
|
+
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%= t 'b.close' %></button>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
@@ -13,6 +13,7 @@
|
|
13
13
|
<th><%= t 'b.type' %></th>
|
14
14
|
<th><%= t 'b.size' %></th>
|
15
15
|
<th><%= t 'b.description' %></th>
|
16
|
+
<th><%= t 'b.used' %></th>
|
16
17
|
<th><%= t 'b.last_changed_at' %></th>
|
17
18
|
<th> </th>
|
18
19
|
</tr>
|
@@ -31,6 +32,13 @@
|
|
31
32
|
<td><%= a.actual_filename.split('.').last.upcase %></td>
|
32
33
|
<td><%= number_to_human_size a.filesize %></td>
|
33
34
|
<td><%= simple_format a.description %></td>
|
35
|
+
<td>
|
36
|
+
<% if a.deletable? %>
|
37
|
+
<%= t false.to_s %>
|
38
|
+
<% else %>
|
39
|
+
<%= render 'asset_usages', asset: a %>
|
40
|
+
<% end %>
|
41
|
+
</td>
|
34
42
|
<td><%= l a.updated_at, format: :short %></td>
|
35
43
|
<td class="text-right">
|
36
44
|
<%= link_to_edit [:backend, a] %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="card filter">
|
2
|
+
<div class="card-block">
|
3
|
+
<%= search_form_for [:backend, @search] do |f| %>
|
4
|
+
<div class="row">
|
5
|
+
<div class="col-md-4 form-group">
|
6
|
+
<%= f.search_field :name_cont, placeholder: t('b.name'), class: 'form-control' %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="col-md-4 form-group">
|
10
|
+
<% selected_locale = params[:q] ? params[:q][:locale_eq] : nil %>
|
11
|
+
<% options = Udongo.config.i18n.app.locales %>
|
12
|
+
<%= f.select :locale_eq, options_for_select(options, selected_locale), { prompt: t('b.locale') }, class: 'form-control' %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="row">
|
17
|
+
<div class="col-md-6">
|
18
|
+
<%= f.submit class: 'btn btn-primary btn-sm' %>
|
19
|
+
<%= link_to t('b.erase_filters'), backend_tags_path, class: 'btn btn-link' %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= render 'backend/general_form_error', object: model %>
|
2
|
+
|
3
|
+
<%= simple_form_for [:backend, model] do |f| %>
|
4
|
+
<div class="row">
|
5
|
+
<div class="col-md-6">
|
6
|
+
<div class="card">
|
7
|
+
<div class="card-header">
|
8
|
+
<%= t 'b.general' %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="card-block">
|
12
|
+
<%= f.input :locale, collection: Udongo.config.i18n.app.locales, include_blank: false %>
|
13
|
+
<%= f.input :name %>
|
14
|
+
<%= f.input :slug %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<%= render 'backend/form_actions', cancel_url: backend_tags_path %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div class="modal fade" id="tag-usages-<%= tag.id %>" tabindex="-1" role="dialog" aria-labelledby="tag-usages-title" aria-hidden="true">
|
2
|
+
<div class="modal-dialog modal-lg" role="document">
|
3
|
+
<div class="modal-content">
|
4
|
+
<div class="modal-header">
|
5
|
+
<h5 class="modal-title" id="tag-usages-title"><%= tag.name %></h5>
|
6
|
+
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t 'b.close' %>">
|
7
|
+
<span aria-hidden="true">×</span>
|
8
|
+
</button>
|
9
|
+
</div>
|
10
|
+
<div class="modal-body">
|
11
|
+
<ul>
|
12
|
+
<% tag.tagged_items.order(:taggable_type).each do |obj| %>
|
13
|
+
<li>
|
14
|
+
<%= t "b.#{obj.taggable.class.name.underscore}" %> >
|
15
|
+
<%= link_to_edit_with_label [:backend, obj.taggable], tag.locale %>
|
16
|
+
</li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
<div class="modal-footer">
|
21
|
+
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%= t 'b.close' %></button>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<%= render 'backend/breadcrumbs' %>
|
2
|
+
<%= render 'filter' %>
|
3
|
+
|
4
|
+
<p class="text-right">
|
5
|
+
<%= link_to icon(:plus, t('b.add')), new_backend_tag_path, class: 'btn btn-primary btn-sm' %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<% if @tags.any? %>
|
9
|
+
<table class="table table-striped table-hover">
|
10
|
+
<thead class="thead-inverse">
|
11
|
+
<tr>
|
12
|
+
<th><%= t 'b.name' %></th>
|
13
|
+
<th><%= t 'b.locale' %></th>
|
14
|
+
<th><%= t 'b.used' %></th>
|
15
|
+
<th> </th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
|
19
|
+
<tbody>
|
20
|
+
<% @tags.each do |tag| %>
|
21
|
+
<tr>
|
22
|
+
<td><%= tag.name %></td>
|
23
|
+
<td><%= tag.locale.to_s.upcase %></td>
|
24
|
+
<td>
|
25
|
+
<% if tag.tagged_items.any? %>
|
26
|
+
<% lbl = "#{t(true.to_s)} (#{tag.tagged_items.count})" %>
|
27
|
+
<%= link_to icon(:search, lbl), '#', data: { toggle: 'modal', target: "#tag-usages-#{tag.id}" }%>
|
28
|
+
|
29
|
+
<%= render 'tag_usages', tag: tag %>
|
30
|
+
|
31
|
+
<% else %>
|
32
|
+
<%= t false.to_s %>
|
33
|
+
<% end %>
|
34
|
+
</td>
|
35
|
+
<td class="text-right">
|
36
|
+
<%= link_to_edit [:backend, tag] %>
|
37
|
+
<%= link_to_delete [:backend, tag] %>
|
38
|
+
</td>
|
39
|
+
</tr>
|
40
|
+
<% end %>
|
41
|
+
</tbody>
|
42
|
+
</table>
|
43
|
+
|
44
|
+
<%= udongo_paginate @tags %>
|
45
|
+
<% else %>
|
46
|
+
<p><%= t 'b.msg.no_items' %></p>
|
47
|
+
<% end %>
|
@@ -8,6 +8,7 @@
|
|
8
8
|
<%= link_to t('b.snippets'), backend_snippets_path, class: 'dropdown-item' %>
|
9
9
|
<%= link_to t('b.files'), backend_assets_path, class: 'dropdown-item' %>
|
10
10
|
<%= link_to t('b.forms'), backend_forms_path, class: 'dropdown-item' %>
|
11
|
+
<%= link_to t('b.tags'), backend_tags_path, class: 'dropdown-item' %>
|
11
12
|
</div>
|
12
13
|
</li>
|
13
14
|
|
data/changelog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
6.3.0 - 2017-06-05
|
2
|
+
--
|
3
|
+
* The tagbox autocomplete now orders its results alphabetically.
|
4
|
+
* A general tag module was added. This allows you to see which tags have been
|
5
|
+
used throughout the system and add new ones.
|
6
|
+
* Bugfix: when a taggable item is deleted, it's tagged items are now destroyed.
|
7
|
+
* When checking the overview of files, you can now see if those assets are used.
|
8
|
+
* Bugfix: the images relation was not dependent destroy.
|
9
|
+
|
10
|
+
|
1
11
|
6.2.1 - 2017-06-04
|
2
12
|
--
|
3
13
|
* Added email and tel as valid form types for FormField.
|
@@ -8,9 +8,12 @@ en:
|
|
8
8
|
advanced: Advanced
|
9
9
|
article: Article
|
10
10
|
articles: Articles
|
11
|
+
asset: Asset
|
12
|
+
assets: Assets
|
11
13
|
author: Author
|
12
14
|
cancel: Cancel
|
13
15
|
choose_an_existing_image: Choose an existing image
|
16
|
+
close: Close
|
14
17
|
content: Content
|
15
18
|
current_image: Current image
|
16
19
|
custom_title: Custom title
|
@@ -27,6 +30,7 @@ en:
|
|
27
30
|
email_template: E-mail template
|
28
31
|
email_templates: E-mail templates
|
29
32
|
enabled: Enabled
|
33
|
+
erase_filters: Erase filters
|
30
34
|
extra: Extra
|
31
35
|
file: File
|
32
36
|
files: Files
|
@@ -84,6 +88,7 @@ en:
|
|
84
88
|
status_code: Status code
|
85
89
|
subject: Subject
|
86
90
|
synonyms: Synonyms
|
91
|
+
tag: Tag
|
87
92
|
tags: Tags
|
88
93
|
telephone: Telephone
|
89
94
|
title: Title
|
data/config/locales/en_forms.yml
CHANGED
@@ -8,9 +8,12 @@ nl:
|
|
8
8
|
advanced: Geavanceerd
|
9
9
|
article: Artikel
|
10
10
|
articles: Artikels
|
11
|
+
asset: Bestand
|
12
|
+
assets: Bestanden
|
11
13
|
author: Auteur
|
12
14
|
cancel: Annuleren
|
13
15
|
choose_an_existing_image: Kies bestaande afbeelding
|
16
|
+
close: Sluiten
|
14
17
|
content: Inhoud
|
15
18
|
current_image: Huidige afbeelding
|
16
19
|
custom_title: Aangepaste titel
|
@@ -27,6 +30,7 @@ nl:
|
|
27
30
|
email_template: E-mail template
|
28
31
|
email_templates: E-mail templates
|
29
32
|
enabled: Ingeschakeld
|
33
|
+
erase_filters: Wis filters
|
30
34
|
extra: Extra
|
31
35
|
file: Bestand
|
32
36
|
files: Bestanden
|
@@ -84,6 +88,7 @@ nl:
|
|
84
88
|
status_code: Statuscode
|
85
89
|
subject: Onderwerp
|
86
90
|
synonyms: Synoniemen
|
91
|
+
tag: Tag
|
87
92
|
tags: Tags
|
88
93
|
telephone: Telefoonnummer
|
89
94
|
title: Titel
|
data/config/locales/nl_forms.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -17,12 +17,12 @@ Rails.application.routes.draw do
|
|
17
17
|
get 'search' => 'search#query'
|
18
18
|
get 'seo/slugify' => 'seo#slugify'
|
19
19
|
|
20
|
-
|
21
20
|
resources :sessions, only: [:new, :create, :destroy]
|
22
21
|
resources :admins
|
23
22
|
resources :users
|
24
23
|
resources :redirects, except: :show
|
25
24
|
resources :search_synonyms, except: :show
|
25
|
+
resources :tags
|
26
26
|
|
27
27
|
resources :pages, except: [:show] do
|
28
28
|
concerns :translatable
|
data/lib/udongo/version.rb
CHANGED
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: 6.
|
4
|
+
version: 6.3.0
|
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: 2017-06-
|
12
|
+
date: 2017-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -486,6 +486,7 @@ files:
|
|
486
486
|
- app/controllers/backend/sessions_controller.rb
|
487
487
|
- app/controllers/backend/snippets_controller.rb
|
488
488
|
- app/controllers/backend/tagbox_controller.rb
|
489
|
+
- app/controllers/backend/tags_controller.rb
|
489
490
|
- app/controllers/backend/users/base_controller.rb
|
490
491
|
- app/controllers/backend/users_controller.rb
|
491
492
|
- app/controllers/catch_all_controller.rb
|
@@ -621,6 +622,7 @@ files:
|
|
621
622
|
- app/views/backend/articles/images/index.html.erb
|
622
623
|
- app/views/backend/articles/index.html.erb
|
623
624
|
- app/views/backend/articles/new.html.erb
|
625
|
+
- app/views/backend/assets/_asset_usages.html.erb
|
624
626
|
- app/views/backend/assets/_filter.html.erb
|
625
627
|
- app/views/backend/assets/_form.html.erb
|
626
628
|
- app/views/backend/assets/edit.html.erb
|
@@ -700,6 +702,12 @@ files:
|
|
700
702
|
- app/views/backend/snippets/edit_translation.html.erb
|
701
703
|
- app/views/backend/snippets/index.html.erb
|
702
704
|
- app/views/backend/snippets/new.html.erb
|
705
|
+
- app/views/backend/tags/_filter.html.erb
|
706
|
+
- app/views/backend/tags/_form.html.erb
|
707
|
+
- app/views/backend/tags/_tag_usages.html.erb
|
708
|
+
- app/views/backend/tags/edit.html.erb
|
709
|
+
- app/views/backend/tags/index.html.erb
|
710
|
+
- app/views/backend/tags/new.html.erb
|
703
711
|
- app/views/backend/users/_filter.html.erb
|
704
712
|
- app/views/backend/users/_form.html.erb
|
705
713
|
- app/views/backend/users/_tabs.html.erb
|