udongo 6.5.2 → 6.6.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/pages/base_controller.rb +11 -0
- data/app/controllers/backend/pages/images_controller.rb +15 -0
- data/app/models/page.rb +1 -0
- data/app/views/backend/pages/_tabs.html.erb +10 -2
- data/app/views/backend/pages/edit.html.erb +1 -1
- data/app/views/backend/pages/edit_translation.html.erb +1 -1
- data/app/views/backend/pages/images/index.html.erb +43 -0
- data/changelog.md +5 -0
- data/config/routes.rb +4 -0
- data/lib/udongo/configs/pages.rb +13 -0
- data/lib/udongo/version.rb +1 -1
- data/readme.md +69 -63
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b44092ed3a002bf2b3e068d7f1507613997b59ed
|
4
|
+
data.tar.gz: 32fdb5697265fae0ab8a5f13b020509a4793e6f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 821caf33fad2b65fc7fc95193e4d374ccbd9071601b9429f3b19e65a1c43500395e16a5ef4c407e7b8ea6674d7f608408e0b3ee1a39e4c572b79d1aa868c3caf
|
7
|
+
data.tar.gz: 2a35b6f92441b7707af739bcc713a588ea79ae1a9ca07f4482187bf08425827f6691b67abef8c76a9a963d160b85b334df48c39c0fca970703d56890f241cd2a
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Backend::Pages::BaseController < Backend::BaseController
|
2
|
+
before_action :find_page
|
3
|
+
before_action do
|
4
|
+
breadcrumb.add t('b.pages'), backend_pages_path
|
5
|
+
breadcrumb.add @page.description, edit_backend_page_path(@page)
|
6
|
+
end
|
7
|
+
|
8
|
+
def find_page
|
9
|
+
@page = Page.find params[:page_id]
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Backend::Pages::ImagesController < Backend::Pages::BaseController
|
2
|
+
include Concerns::Backend::PositionableController
|
3
|
+
|
4
|
+
before_action { breadcrumb.add t('b.images') }
|
5
|
+
|
6
|
+
def index
|
7
|
+
@images = @page.images
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def find_model
|
13
|
+
@model = @page.images.find params[:id]
|
14
|
+
end
|
15
|
+
end
|
data/app/models/page.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
<% klass = %w(nav-link) %>
|
6
6
|
<% klass << 'active' if active == :general %>
|
7
7
|
|
8
|
-
<%= link_to t('b.general'), edit_backend_page_path(
|
8
|
+
<%= link_to t('b.general'), edit_backend_page_path(model), class: klass %>
|
9
9
|
</li>
|
10
10
|
|
11
11
|
<% Udongo.config.i18n.app.locales.each do |locale| %>
|
@@ -13,7 +13,15 @@
|
|
13
13
|
<% klass = %w(nav-link) %>
|
14
14
|
<% klass << 'active' if active == locale.to_sym %>
|
15
15
|
|
16
|
-
<%= link_to locale.upcase, edit_translation_backend_page_path(
|
16
|
+
<%= link_to locale.upcase, edit_translation_backend_page_path(model, locale), class: klass %>
|
17
|
+
</li>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% if Udongo.config.pages.images? %>
|
21
|
+
<li class="nav-item">
|
22
|
+
<% klass = %w(nav-link) %>
|
23
|
+
<% klass << 'active' if active == :images %>
|
24
|
+
<%= link_to icon(:image, t('b.images')), backend_page_images_path(model), class: klass %>
|
17
25
|
</li>
|
18
26
|
<% end %>
|
19
27
|
</ul>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% breadcrumb.add t('b.edit') %>
|
3
3
|
<%= render 'backend/breadcrumbs' %>
|
4
4
|
|
5
|
-
<%= render 'backend/pages/tabs', active: params[:translation_locale].to_sym %>
|
5
|
+
<%= render 'backend/pages/tabs', model: @model, active: params[:translation_locale].to_sym %>
|
6
6
|
<%= render 'backend/general_form_error', object: @translation %>
|
7
7
|
|
8
8
|
<%= simple_form_for([:backend, @translation], url: edit_translation_backend_page_path, html: { class: 'no-focus' }) do |f| %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<% javascript 'backend/sortable' %>
|
2
|
+
<%= render 'backend/breadcrumbs' %>
|
3
|
+
<%= render 'backend/pages/tabs', model: @page, active: :images %>
|
4
|
+
|
5
|
+
<p class="text-right">
|
6
|
+
<%= link_to icon(:plus, t('b.add')), backend_images_path(klass: @page.class.name, id: @page.id), class: 'btn btn-primary btn-sm' %>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<% if @images.any? %>
|
10
|
+
<table class="table table-striped table-hover">
|
11
|
+
<thead class="thead-inverse">
|
12
|
+
<tr>
|
13
|
+
<th><%= t 'b.file' %></th>
|
14
|
+
<th><%= t 'b.type' %></th>
|
15
|
+
<th><%= t 'b.size' %></th>
|
16
|
+
<th><%= t 'b.description' %></th>
|
17
|
+
<th><%= t 'b.last_changed_at' %></th>
|
18
|
+
<th> </th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
|
22
|
+
<tbody>
|
23
|
+
<% @images.each do |img| %>
|
24
|
+
<% a = img.asset %>
|
25
|
+
<tr data-update-position="<%= update_position_backend_page_image_path(@page, img) %>">
|
26
|
+
<td>
|
27
|
+
<%= image_tag a.image.url(150, 150), alt: '', class: 'img-fluid' %>
|
28
|
+
</td>
|
29
|
+
<td><%= a.actual_filename.split('.').last.upcase %></td>
|
30
|
+
<td><%= number_to_human_size a.filesize %></td>
|
31
|
+
<td><%= simple_format a.description %></td>
|
32
|
+
<td><%= l a.updated_at %></td>
|
33
|
+
<td class="text-right">
|
34
|
+
<%= link_to icon(:trash), unlink_backend_images_path(klass: @page.class.name, id: @page.id, asset_id: a.id), data: { confirm: t('b.msg.confirm') }, title: t('b.delete') %>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
<% end %>
|
38
|
+
</tbody>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
<% else %>
|
42
|
+
<p><%= t 'b.msg.no_items' %></p>
|
43
|
+
<% end %>
|
data/changelog.md
CHANGED
data/config/routes.rb
CHANGED
data/lib/udongo/version.rb
CHANGED
data/readme.md
CHANGED
@@ -21,6 +21,12 @@ Udongo.config.base.project_name = 'Udongo'
|
|
21
21
|
Udongo.config.base.time_zone = 'Brussels'
|
22
22
|
```
|
23
23
|
|
24
|
+
## Pages
|
25
|
+
### images
|
26
|
+
```ruby
|
27
|
+
Udongo.config.pages.images = false
|
28
|
+
```
|
29
|
+
|
24
30
|
## Tags
|
25
31
|
### allow_new
|
26
32
|
```ruby
|
@@ -50,69 +56,6 @@ Udongo.config.i18n.app.default_interface_locale = 'nl'
|
|
50
56
|
Udongo.config.i18n.app.interface_locales = %w(nl en)
|
51
57
|
```
|
52
58
|
|
53
|
-
## Forms
|
54
|
-
### Adding SEO fields to your page.
|
55
|
-
You can add SEO fields to your form by rendering a partial:
|
56
|
-
|
57
|
-
```erb
|
58
|
-
<%= simple_form_for([:backend, @your_model]) do |f| %>
|
59
|
-
...
|
60
|
-
<%= render 'backend/seo_form', f: f %>
|
61
|
-
...
|
62
|
-
<% end %>
|
63
|
-
```
|
64
|
-
This partial has support to let you base its SEO slug on whatever is typed in
|
65
|
-
an input element of your choice. In Udongo, this field is called the
|
66
|
-
**sluggable field**.
|
67
|
-
|
68
|
-
By default, the partial looks for a field called **title**. You can override
|
69
|
-
this name by passing ```sluggable_field``` to the partial, like so:
|
70
|
-
|
71
|
-
```erb
|
72
|
-
<%= simple_form_for([:backend, @your_model]) do |f| %>
|
73
|
-
...
|
74
|
-
<%# This will look for #backend_your_model_name as its sluggable field. %>
|
75
|
-
<%= render 'backend/seo_form', f: f, sluggable_field: :name %>
|
76
|
-
...
|
77
|
-
<% end %>
|
78
|
-
```
|
79
|
-
|
80
|
-
### Dirty inputs
|
81
|
-
Sometimes a user enters some data in a form and assumes that everything is
|
82
|
-
magically saved without submitting said form.
|
83
|
-
|
84
|
-
To warn a user that this is not default behaviour, you can trigger a warning
|
85
|
-
to show up whenever a user has changed input contents and clicks on any
|
86
|
-
```<a>``` element on the page.
|
87
|
-
|
88
|
-
Simply call the following helper method within your form tags:
|
89
|
-
|
90
|
-
```erb
|
91
|
-
<%= simple_form_for([:backend, @your_model]) do |f| %>
|
92
|
-
<%= trigger_dirty_inputs_warning %>
|
93
|
-
...
|
94
|
-
<% end %>
|
95
|
-
```
|
96
|
-
|
97
|
-
This renders the following HTML:
|
98
|
-
|
99
|
-
```html
|
100
|
-
<form class="simple_form" id="edit_your_model_1" action="/backend/your_models/1/edit" accept-charset="UTF-8" method="post">
|
101
|
-
...
|
102
|
-
<span data-dirty="false"></span>
|
103
|
-
...
|
104
|
-
</form>
|
105
|
-
```
|
106
|
-
|
107
|
-
You can also override the default message with your own:
|
108
|
-
|
109
|
-
```erb
|
110
|
-
<%= simple_form_for([:backend, @your_model]) do |f| %>
|
111
|
-
<%= trigger_dirty_inputs_warning(message: 'Are you sure you want to leave the page?') %>
|
112
|
-
...
|
113
|
-
<% end %>
|
114
|
-
```
|
115
|
-
|
116
59
|
## Flexible content
|
117
60
|
### types
|
118
61
|
```ruby
|
@@ -569,3 +512,66 @@ Find a navigation from cache by its identifier.
|
|
569
512
|
## Select2
|
570
513
|
This library is loaded by default in the backend.
|
571
514
|
See https://select2.github.io
|
515
|
+
|
516
|
+
# Forms
|
517
|
+
## Adding SEO fields to your page.
|
518
|
+
You can add SEO fields to your form by rendering a partial:
|
519
|
+
|
520
|
+
```erb
|
521
|
+
<%= simple_form_for([:backend, @your_model]) do |f| %>
|
522
|
+
...
|
523
|
+
<%= render 'backend/seo_form', f: f %>
|
524
|
+
...
|
525
|
+
<% end %>
|
526
|
+
```
|
527
|
+
This partial has support to let you base its SEO slug on whatever is typed in
|
528
|
+
an input element of your choice. In Udongo, this field is called the
|
529
|
+
**sluggable field**.
|
530
|
+
|
531
|
+
By default, the partial looks for a field called **title**. You can override
|
532
|
+
this name by passing ```sluggable_field``` to the partial, like so:
|
533
|
+
|
534
|
+
```erb
|
535
|
+
<%= simple_form_for([:backend, @your_model]) do |f| %>
|
536
|
+
...
|
537
|
+
<%# This will look for #backend_your_model_name as its sluggable field. %>
|
538
|
+
<%= render 'backend/seo_form', f: f, sluggable_field: :name %>
|
539
|
+
...
|
540
|
+
<% end %>
|
541
|
+
```
|
542
|
+
|
543
|
+
## Dirty inputs
|
544
|
+
Sometimes a user enters some data in a form and assumes that everything is
|
545
|
+
magically saved without submitting said form.
|
546
|
+
|
547
|
+
To warn a user that this is not default behaviour, you can trigger a warning
|
548
|
+
to show up whenever a user has changed input contents and clicks on any
|
549
|
+
```<a>``` element on the page.
|
550
|
+
|
551
|
+
Simply call the following helper method within your form tags:
|
552
|
+
|
553
|
+
```erb
|
554
|
+
<%= simple_form_for([:backend, @your_model]) do |f| %>
|
555
|
+
<%= trigger_dirty_inputs_warning %>
|
556
|
+
...
|
557
|
+
<% end %>
|
558
|
+
```
|
559
|
+
|
560
|
+
This renders the following HTML:
|
561
|
+
|
562
|
+
```html
|
563
|
+
<form class="simple_form" id="edit_your_model_1" action="/backend/your_models/1/edit" accept-charset="UTF-8" method="post">
|
564
|
+
...
|
565
|
+
<span data-dirty="false"></span>
|
566
|
+
...
|
567
|
+
</form>
|
568
|
+
```
|
569
|
+
|
570
|
+
You can also override the default message with your own:
|
571
|
+
|
572
|
+
```erb
|
573
|
+
<%= simple_form_for([:backend, @your_model]) do |f| %>
|
574
|
+
<%= trigger_dirty_inputs_warning(message: 'Are you sure you want to leave the page?') %>
|
575
|
+
...
|
576
|
+
<% end %>
|
577
|
+
```
|
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.6.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-
|
12
|
+
date: 2017-07-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -483,6 +483,8 @@ files:
|
|
483
483
|
- app/controllers/backend/images_controller.rb
|
484
484
|
- app/controllers/backend/navigation/items_controller.rb
|
485
485
|
- app/controllers/backend/navigations_controller.rb
|
486
|
+
- app/controllers/backend/pages/base_controller.rb
|
487
|
+
- app/controllers/backend/pages/images_controller.rb
|
486
488
|
- app/controllers/backend/pages_controller.rb
|
487
489
|
- app/controllers/backend/redirects_controller.rb
|
488
490
|
- app/controllers/backend/search_controller.rb
|
@@ -701,6 +703,7 @@ files:
|
|
701
703
|
- app/views/backend/pages/_tabs.html.erb
|
702
704
|
- app/views/backend/pages/edit.html.erb
|
703
705
|
- app/views/backend/pages/edit_translation.html.erb
|
706
|
+
- app/views/backend/pages/images/index.html.erb
|
704
707
|
- app/views/backend/pages/index.html.erb
|
705
708
|
- app/views/backend/pages/new.html.erb
|
706
709
|
- app/views/backend/redirects/_filter.html.erb
|
@@ -873,6 +876,7 @@ files:
|
|
873
876
|
- lib/udongo/configs/i18n.rb
|
874
877
|
- lib/udongo/configs/i18ns/app.rb
|
875
878
|
- lib/udongo/configs/i18ns/cms.rb
|
879
|
+
- lib/udongo/configs/pages.rb
|
876
880
|
- lib/udongo/configs/tags.rb
|
877
881
|
- lib/udongo/crypt.rb
|
878
882
|
- lib/udongo/cryptography.rb
|