udongo 1.0.3 → 1.0.4

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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/backend/flexible_content.js +33 -0
  3. data/app/assets/javascripts/backend/sortable.js +1 -1
  4. data/app/assets/stylesheets/backend/pages/_flexible_content.scss +61 -0
  5. data/app/controllers/backend/admins_controller.rb +7 -7
  6. data/app/controllers/backend/content/rows/columns_controller.rb +7 -15
  7. data/app/controllers/backend/content/rows/images_controller.rb +1 -1
  8. data/app/controllers/backend/content/rows/texts_controller.rb +1 -1
  9. data/app/controllers/backend/content/rows_controller.rb +4 -13
  10. data/app/controllers/backend/email_templates_controller.rb +4 -4
  11. data/app/controllers/backend/emails_controller.rb +3 -3
  12. data/app/controllers/backend/forms/base_controller.rb +14 -0
  13. data/app/controllers/backend/forms/submissions_controller.rb +8 -0
  14. data/app/controllers/backend/forms_controller.rb +7 -0
  15. data/app/controllers/backend/navigation/items_controller.rb +8 -5
  16. data/app/controllers/backend/navigations_controller.rb +1 -1
  17. data/app/controllers/backend/pages_controller.rb +5 -5
  18. data/app/controllers/backend/redirects_controller.rb +4 -4
  19. data/app/controllers/backend/sessions_controller.rb +1 -1
  20. data/app/controllers/backend/snippets_controller.rb +6 -5
  21. data/app/controllers/backend/tagbox_controller.rb +4 -4
  22. data/app/controllers/backend_controller.rb +3 -3
  23. data/app/controllers/catch_all_controller.rb +1 -1
  24. data/app/controllers/redirects_controller.rb +1 -1
  25. data/app/decorators/application_decorator.rb +5 -0
  26. data/app/decorators/content_image_decorator.rb +1 -1
  27. data/app/decorators/content_row_decorator.rb +9 -0
  28. data/app/decorators/content_text_decorator.rb +1 -1
  29. data/app/decorators/form_decorator.rb +16 -0
  30. data/app/decorators/form_submission_decorator.rb +3 -0
  31. data/app/decorators/navigation_item_decorator.rb +2 -2
  32. data/app/decorators/page_decorator.rb +2 -2
  33. data/app/decorators/pagination_decorator.rb +4 -0
  34. data/app/decorators/redirect_decorator.rb +1 -1
  35. data/app/decorators/snippet_decorator.rb +1 -1
  36. data/app/forms/backend/snippet_form.rb +4 -18
  37. data/app/helpers/backend/pagination_helper.rb +1 -11
  38. data/app/helpers/icon_helper.rb +1 -1
  39. data/app/helpers/snippet_helper.rb +1 -1
  40. data/app/models/concerns/storable/collection.rb +48 -26
  41. data/app/models/concerns/translatable.rb +1 -1
  42. data/app/models/content_row.rb +4 -0
  43. data/app/models/form.rb +1 -0
  44. data/app/models/store_with_file.rb +2 -0
  45. data/app/views/backend/content/_image.html.erb +1 -8
  46. data/app/views/backend/content/_rows.html.erb +52 -49
  47. data/app/views/backend/emails/index.html.erb +2 -10
  48. data/app/views/backend/forms/index.html.erb +27 -0
  49. data/app/views/backend/forms/submissions/_filter.html.erb +16 -0
  50. data/app/views/backend/forms/submissions/index.html.erb +34 -0
  51. data/app/views/backend/redirects/index.html.erb +2 -10
  52. data/app/views/layouts/backend/_top_navigation.html.erb +1 -0
  53. data/changelog.md +14 -1
  54. data/config/locales/en_backend.yml +5 -5
  55. data/config/locales/nl_backend.yml +10 -10
  56. data/config/routes.rb +6 -6
  57. data/db/migrate/20160711114156_add_description_to_forms.rb +5 -0
  58. data/lib/generators/udongo/form/form_generator.rb +1 -1
  59. data/lib/tasks/udongo_tasks.rake +1 -1
  60. data/lib/udongo/config.rb +2 -1
  61. data/lib/udongo/configs/forms.rb +14 -0
  62. data/lib/udongo/flexible_content/column_width_calculator.rb +32 -0
  63. data/lib/udongo/form.rb +36 -0
  64. data/lib/udongo/forms/config.rb +11 -0
  65. data/lib/udongo/forms/submission_datagrid.rb +29 -0
  66. data/lib/udongo/forms/submission_filter.rb +33 -0
  67. data/lib/udongo/notification.rb +19 -0
  68. data/lib/udongo/object_path.rb +0 -2
  69. data/lib/udongo/version.rb +1 -1
  70. data/lib/udongo/will_paginate/options.rb +40 -0
  71. data/lib/udongo/will_paginate/renderer.rb +8 -4
  72. data/lib/udongo.rb +4 -11
  73. data/readme.md +145 -49
  74. metadata +24 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5dcd9c07952f78c60a0f082968eec84e5df29c0
4
- data.tar.gz: f5b1440aa0920a2794e30cfec54b16ca155f0bc2
3
+ metadata.gz: 9a9d78af6af9e79dc93e988f912f0dc35cf63c32
4
+ data.tar.gz: 77387997bf2df93647585e6a8c980002d688999a
5
5
  SHA512:
6
- metadata.gz: 23358d0c06b06407219f51c732eb695fb3ccd81fa1f3480d6f5932e2df44a7d9cd4017daf85a256d0722a665b22f11c42686aff9c256141d8b93ea12963aaff6
7
- data.tar.gz: 3420ec55347bbd72e41e0ff649ae58c9d8a99eb63f83b66c98f76f64a8977253127d9b7df96546c9e1411de8270c4aea40637f5773843a2f9339b45480b0c1f2
6
+ metadata.gz: ad09958982bbb2913c20486dcce2b295c6c96533199bc1f79d0684e6875dccbc25a09a7d0aa3b25f382f02584bb2e803480989b7c72575503ab248e01b91cc93
7
+ data.tar.gz: 08666441135710beb54f0baa767f14c3c3d5a081ac937eb652cf1e0209dd39a2545be838aa4f826ed132f7009aa029bacb2a0a8c7ac666bcb58221ea3e5776af
@@ -0,0 +1,33 @@
1
+ var flexible_content = flexible_content || {
2
+ init: function() {
3
+ $('#content-rows .cards').sortable({
4
+ axis: 'y',
5
+ handle: '.card-header',
6
+ update: sortable.update_position_listener,
7
+ tolerance: 'pointer',
8
+ placeholder: 'placeholder',
9
+ start: function(e, ui){
10
+ ui.placeholder.height(ui.item.height());
11
+ ui.placeholder.css('margin-bottom', ui.item.css('margin-bottom'));
12
+ }
13
+ });
14
+
15
+ $('.content-columns').sortable({
16
+ axis: 'x',
17
+ handle: '.card',
18
+ update: sortable.update_position_listener,
19
+ tolerance: 'pointer',
20
+ placeholder: 'placeholder',
21
+ start: function(e, ui){
22
+ var classes = ui.item.attr('class').replace('content-column ') + ' placeholder';
23
+ ui.placeholder.attr('class', classes);
24
+ ui.placeholder.height(ui.item.find('.card').height());
25
+ ui.placeholder.width(ui.item.find('.card').width() - 30);
26
+ ui.placeholder.css('margin-left', '15px');
27
+ ui.placeholder.css('margin-right', '15px');
28
+ }
29
+ })
30
+ }
31
+ }
32
+
33
+ $(function(){ flexible_content.init(); });
@@ -26,7 +26,7 @@ var sortable = sortable || {
26
26
  },
27
27
 
28
28
  update_position_listener: function(e, ui) {
29
- var new_position = ui.item[0].rowIndex;
29
+ var new_position = ui.item.index() + 1
30
30
 
31
31
  $.ajax({
32
32
  data: { position: new_position },
@@ -1,5 +1,66 @@
1
1
  #content-rows {
2
2
  margin-bottom: 35px;
3
+
4
+ .placeholder {
5
+ background-color: #ffdc99;
6
+ border: 1px solid #ddba77;
7
+ border-radius: 4px;
8
+ opacity: 0.5;
9
+ }
10
+
11
+ .handle {
12
+ cursor: move;
13
+ }
14
+
15
+ .content-column {
16
+ .card {
17
+ &:hover {
18
+ border: 1px solid #999;
19
+
20
+ .btn-group a {
21
+ border: 1px solid #999 !important;
22
+ border-bottom: none !important;
23
+ color: #333 !important;
24
+ }
25
+ }
26
+
27
+ .card-footer {
28
+ background-color: white;
29
+ padding-bottom: 4px;
30
+ padding-top: 20px;
31
+ border-top: none;
32
+
33
+ .btn-group {
34
+ position: absolute;
35
+ bottom: 0;
36
+ left: 0;
37
+
38
+ a {
39
+ border: 1px solid #e5e5e5;
40
+ border-bottom: none;
41
+ color: #e5e5e5;
42
+
43
+ &:first-child {
44
+ border-left: none !important;
45
+ border-top-left-radius: 0;
46
+ }
47
+
48
+ &:last-child {
49
+ border-bottom-right-radius: 0;
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ a.btn.full-width {
58
+ width: 100%;
59
+ }
60
+
61
+ a.btn.block {
62
+ padding: 25px;
63
+ }
3
64
  }
4
65
 
5
66
  .lightbox {
@@ -3,7 +3,7 @@ class Backend::AdminsController < BackendController
3
3
  before_action -> { breadcrumb.add t('b.admins'), backend_admins_path }
4
4
 
5
5
  def index
6
- @admins = ::Admin.all
6
+ @admins = Admin.all
7
7
  end
8
8
 
9
9
  def show
@@ -11,14 +11,14 @@ class Backend::AdminsController < BackendController
11
11
  end
12
12
 
13
13
  def new
14
- @admin = ::Admin.new
14
+ @admin = Admin.new
15
15
  end
16
16
 
17
17
  def create
18
- @admin = ::Admin.new allowed_params
18
+ @admin = Admin.new allowed_params
19
19
 
20
20
  if @admin.save
21
- redirect_to backend_admins_path, notice: t('b.msg.admins.added')
21
+ redirect_to backend_admins_path, notice: translate_notice(:added, :admin)
22
22
  else
23
23
  render :new
24
24
  end
@@ -26,7 +26,7 @@ class Backend::AdminsController < BackendController
26
26
 
27
27
  def update
28
28
  if @admin.update_attributes allowed_params
29
- redirect_to backend_admins_path, notice: t('b.msg.changes_saved')
29
+ redirect_to backend_admins_path, notice: translate_notice(:changes_saved)
30
30
  else
31
31
  render :edit
32
32
  end
@@ -34,13 +34,13 @@ class Backend::AdminsController < BackendController
34
34
 
35
35
  def destroy
36
36
  @admin.destroy
37
- redirect_to backend_admins_path, notice: t('b.msg.admins.deleted')
37
+ redirect_to backend_admins_path, notice: translate_notice(:deleted, :admin)
38
38
  end
39
39
 
40
40
  private
41
41
 
42
42
  def find_admin
43
- @admin = ::Admin.find params[:id]
43
+ @admin = Admin.find params[:id]
44
44
  end
45
45
 
46
46
  def allowed_params
@@ -1,10 +1,12 @@
1
1
  class Backend::Content::Rows::ColumnsController < BackendController
2
+ include Concerns::Backend::PositionableController
3
+
2
4
  before_action :find_row
3
- before_action :find_column, only: [:edit, :update, :move_up, :move_down, :destroy]
5
+ before_action :find_model, only: [:edit, :update, :update_position, :destroy]
4
6
  layout 'backend/lightbox'
5
7
 
6
8
  def new
7
- @column = @row.columns.new
9
+ @column = @row.columns.new(@row.column_width_calculator.hashed_values)
8
10
  cancel_url
9
11
  end
10
12
 
@@ -29,16 +31,6 @@ class Backend::Content::Rows::ColumnsController < BackendController
29
31
  end
30
32
  end
31
33
 
32
- def move_up
33
- @column.move_higher
34
- redirect_to cancel_url
35
- end
36
-
37
- def move_down
38
- @column.move_lower
39
- redirect_to cancel_url
40
- end
41
-
42
34
  def destroy
43
35
  @column.destroy
44
36
 
@@ -49,11 +41,11 @@ class Backend::Content::Rows::ColumnsController < BackendController
49
41
  private
50
42
 
51
43
  def find_row
52
- @row = ::ContentRow.find params[:row_id]
44
+ @row = ContentRow.find params[:row_id]
53
45
  end
54
46
 
55
- def find_column
56
- @column = ::ContentColumn.find params[:id]
47
+ def find_model
48
+ @column = ContentColumn.find params[:id]
57
49
  end
58
50
 
59
51
  def allowed_params
@@ -1,6 +1,6 @@
1
1
  class Backend::Content::Rows::ImagesController < BackendController
2
2
  include Concerns::Backend::ContentTypeController
3
3
 
4
- model ::ContentImage
4
+ model ContentImage
5
5
  allowed_params :file, :caption, :url
6
6
  end
@@ -1,6 +1,6 @@
1
1
  class Backend::Content::Rows::TextsController < BackendController
2
2
  include Concerns::Backend::ContentTypeController
3
3
 
4
- model ::ContentText
4
+ model ContentText
5
5
  allowed_params :content
6
6
  end
@@ -1,5 +1,6 @@
1
1
  class Backend::Content::RowsController < BackendController
2
- before_action :find_row, only: [:move_up, :move_down, :destroy]
2
+ include Concerns::Backend::PositionableController
3
+ before_action :find_model, only: [:update_position, :destroy]
3
4
 
4
5
  def new
5
6
  if params[:klass] && params[:id] && params[:locale]
@@ -12,16 +13,6 @@ class Backend::Content::RowsController < BackendController
12
13
  end
13
14
  end
14
15
 
15
- def move_up
16
- @row.move_higher
17
- redirect_back_to_content
18
- end
19
-
20
- def move_down
21
- @row.move_lower
22
- redirect_back_to_content
23
- end
24
-
25
16
  def destroy
26
17
  @row.destroy
27
18
  redirect_back_to_content('content-rows')
@@ -29,8 +20,8 @@ class Backend::Content::RowsController < BackendController
29
20
 
30
21
  private
31
22
 
32
- def find_row
33
- @row = ::ContentRow.find params[:id]
23
+ def find_model
24
+ @row = ContentRow.find params[:id]
34
25
  end
35
26
 
36
27
  def content_path(instance, locale, anchor)
@@ -6,15 +6,15 @@ class Backend::EmailTemplatesController < BackendController
6
6
  before_action -> { breadcrumb.add t('b.email_templates'), backend_email_templates_path }
7
7
 
8
8
  def index
9
- @email_templates = ::EmailTemplate.all
9
+ @email_templates = EmailTemplate.all
10
10
  end
11
11
 
12
12
  def new
13
- @model = ::EmailTemplate.new
13
+ @model = EmailTemplate.new
14
14
  end
15
15
 
16
16
  def create
17
- @model = ::EmailTemplate.new allowed_params
17
+ @model = EmailTemplate.new allowed_params
18
18
 
19
19
  if @model.save
20
20
  redirect_to edit_translation_backend_email_template_path(@model, translation_locale: default_locale), notice: translate_notice(:added, :email_template)
@@ -34,7 +34,7 @@ class Backend::EmailTemplatesController < BackendController
34
34
  private
35
35
 
36
36
  def find_model
37
- @model = ::EmailTemplate.find params[:id]
37
+ @model = EmailTemplate.find params[:id]
38
38
  end
39
39
 
40
40
  def translation_form
@@ -4,15 +4,15 @@ class Backend::EmailsController < BackendController
4
4
  before_action -> { breadcrumb.add t('b.emails'), backend_emails_path }
5
5
 
6
6
  def index
7
- @emails = paginate ::Email.all.order('id DESC')
7
+ @emails = paginate Email.all.order('id DESC')
8
8
  end
9
9
 
10
10
  def show
11
- @email = ::Email.find params[:id]
11
+ @email = Email.find params[:id]
12
12
  end
13
13
 
14
14
  def html_content
15
- @email = ::Email.find params[:id]
15
+ @email = Email.find params[:id]
16
16
  render text: @email.html_content
17
17
  end
18
18
  end
@@ -0,0 +1,14 @@
1
+ class Backend::Forms::BaseController < BackendController
2
+ before_action :find_form
3
+
4
+ before_action -> do
5
+ breadcrumb.add t('b.forms'), backend_forms_path
6
+ breadcrumb.add @form.description
7
+ end
8
+
9
+ private
10
+
11
+ def find_form
12
+ @form ||= Form.find(params[:form_id].to_i).decorate
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ class Backend::Forms::SubmissionsController < Backend::Forms::BaseController
2
+ include Concerns::PaginationController
3
+
4
+ def index
5
+ @filter = Udongo::Forms::SubmissionFilter.search(@form, params[:q])
6
+ @submissions = paginate(@filter.result).decorate
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ class Backend::FormsController < BackendController
2
+ before_action -> { breadcrumb.add t('b.forms'), backend_forms_path }
3
+
4
+ def index
5
+ @forms = Form.all
6
+ end
7
+ end
@@ -14,7 +14,8 @@ class Backend::Navigation::ItemsController < BackendController
14
14
  @model = @navigation.items.new(allowed_params).decorate
15
15
 
16
16
  if @model.save
17
- redirect_to backend_navigations_path, notice: t('b.msg.navigation.added')
17
+ redirect_to backend_navigations_path,
18
+ notice: translate_notice(:added, :navigation_item)
18
19
  else
19
20
  render :new
20
21
  end
@@ -22,7 +23,8 @@ class Backend::Navigation::ItemsController < BackendController
22
23
 
23
24
  def update
24
25
  if @model.update_attributes allowed_params
25
- redirect_to backend_navigations_path, notice: t('b.msg.changes_saved')
26
+ redirect_to backend_navigations_path,
27
+ notice: translate_notice(:changes_saved)
26
28
  else
27
29
  render :edit
28
30
  end
@@ -30,17 +32,18 @@ class Backend::Navigation::ItemsController < BackendController
30
32
 
31
33
  def destroy
32
34
  @model.destroy
33
- redirect_to backend_navigations_path, notice: t('b.msg.navigation.deleted')
35
+ redirect_to backend_navigations_path,
36
+ notice: translate_notice(:deleted, :navigation_item)
34
37
  end
35
38
 
36
39
  private
37
40
 
38
41
  def find_navigation
39
- @navigation = ::Navigation.find params[:navigation_id]
42
+ @navigation = Navigation.find params[:navigation_id]
40
43
  end
41
44
 
42
45
  def find_model
43
- @model = ::NavigationItem.find(params[:id]).decorate
46
+ @model = NavigationItem.find(params[:id]).decorate
44
47
  end
45
48
 
46
49
  def allowed_params
@@ -2,6 +2,6 @@ class Backend::NavigationsController < BackendController
2
2
  before_action -> { breadcrumb.add t('b.navigation'), backend_navigations_path }
3
3
 
4
4
  def index
5
- @navigations = ::Navigation.all
5
+ @navigations = Navigation.all
6
6
  end
7
7
  end
@@ -5,7 +5,7 @@ class Backend::PagesController < BackendController
5
5
  before_action -> { breadcrumb.add t('b.pages'), backend_pages_path }
6
6
 
7
7
  def index
8
- @pages = ::Page.all
8
+ @pages = Page.all
9
9
 
10
10
  respond_to do |format|
11
11
  format.html
@@ -16,11 +16,11 @@ class Backend::PagesController < BackendController
16
16
  end
17
17
 
18
18
  def new
19
- @model = ::Page.new.decorate
19
+ @model = Page.new.decorate
20
20
  end
21
21
 
22
22
  def create
23
- @model = ::Page.new(params.require('page').permit(:description, :visible, :parent_id)).decorate
23
+ @model = Page.new(params.require('page').permit(:description, :visible, :parent_id)).decorate
24
24
 
25
25
  if @model.save
26
26
  redirect_to edit_backend_page_path(@model), notice: translate_notice(:added, :page)
@@ -46,7 +46,7 @@ class Backend::PagesController < BackendController
46
46
  end
47
47
 
48
48
  def page_tree_data(parent_id: nil)
49
- ::Page.where(parent_id: parent_id).inject([]) do |data, p|
49
+ Page.where(parent_id: parent_id).inject([]) do |data, p|
50
50
  hash = node_data p
51
51
  hash[:children] = page_tree_data(parent_id: p.id) if p.children.any?
52
52
  data << hash
@@ -56,7 +56,7 @@ class Backend::PagesController < BackendController
56
56
  private
57
57
 
58
58
  def find_model
59
- @model = ::Page.find(params[:id]).decorate
59
+ @model = Page.find(params[:id]).decorate
60
60
  end
61
61
 
62
62
  def translation_form
@@ -5,16 +5,16 @@ class Backend::RedirectsController < BackendController
5
5
  before_action :find_model, only: [:edit, :update, :destroy]
6
6
 
7
7
  def index
8
- @search = ::Redirect.ransack params[:q]
8
+ @search = Redirect.ransack params[:q]
9
9
  @redirects = @search.result(distinct: true).order('times_used DESC').page(page_number).per_page(per_page)
10
10
  end
11
11
 
12
12
  def new
13
- @redirect = ::Redirect.new(status_code: 301).decorate
13
+ @redirect = Redirect.new(status_code: 301).decorate
14
14
  end
15
15
 
16
16
  def create
17
- @redirect = ::Redirect.new(allowed_params).decorate
17
+ @redirect = Redirect.new(allowed_params).decorate
18
18
 
19
19
  if @redirect.save
20
20
  redirect_to backend_redirects_path, notice: translate_notice(:added, :redirect)
@@ -45,6 +45,6 @@ class Backend::RedirectsController < BackendController
45
45
  end
46
46
 
47
47
  def find_model
48
- @redirect = ::Redirect.find(params[:id]).decorate
48
+ @redirect = Redirect.find(params[:id]).decorate
49
49
  end
50
50
  end
@@ -3,7 +3,7 @@ class Backend::SessionsController < BackendController
3
3
  layout 'backend/login'
4
4
 
5
5
  def create
6
- admin = ::Admin.find_by(email: params[:session][:email])
6
+ admin = Admin.find_by(email: params[:session][:email])
7
7
 
8
8
  if admin && admin.authenticate(params[:session][:password])
9
9
  session[:admin_id] = admin.id
@@ -5,19 +5,19 @@ class Backend::SnippetsController < BackendController
5
5
  before_action -> { breadcrumb.add t('b.snippets'), backend_snippets_path }
6
6
 
7
7
  def index
8
- @snippets = ::Snippet.order(:description)
8
+ @snippets = Snippet.order(:description)
9
9
  end
10
10
 
11
11
  def new
12
12
  @form = Backend::SnippetForm.new
13
- # @model = ::Snippet.new
14
13
  end
15
14
 
16
15
  def create
17
16
  @form = Backend::SnippetForm.new
18
17
 
19
18
  if @form.save params[:snippet]
20
- redirect_to edit_translation_backend_snippet_path(@form.snippet, translation_locale: default_locale), notice: translate_notice(:added, :snippet)
19
+ redirect_to edit_translation_backend_snippet_path(@form.snippet, translation_locale: default_locale),
20
+ notice: translate_notice(:added, :snippet)
21
21
  else
22
22
  render :new
23
23
  end
@@ -31,7 +31,8 @@ class Backend::SnippetsController < BackendController
31
31
  @form = Backend::SnippetForm.new(@model)
32
32
 
33
33
  if @form.save params[:snippet]
34
- redirect_to edit_backend_snippet_path(@model), notice: translate_notice(:edited, :snippet)
34
+ redirect_to edit_backend_snippet_path(@model),
35
+ notice: translate_notice(:edited, :snippet)
35
36
  else
36
37
  render :edit
37
38
  end
@@ -40,7 +41,7 @@ class Backend::SnippetsController < BackendController
40
41
  private
41
42
 
42
43
  def find_model
43
- @model = ::Snippet.find params[:id]
44
+ @model = Snippet.find params[:id]
44
45
  end
45
46
 
46
47
  def translation_form
@@ -1,6 +1,6 @@
1
1
  class Backend::TagboxController < BackendController
2
2
  def index
3
- tags = ::Tag.by_locale(locale).pluck(:name).map do |name|
3
+ tags = Tag.by_locale(locale).pluck(:name).map do |name|
4
4
  { label: name, value: name }
5
5
  end
6
6
 
@@ -25,15 +25,15 @@ class Backend::TagboxController < BackendController
25
25
  end
26
26
 
27
27
  def find_tag
28
- ::Tag.find_by locale: params[:locale], name: params[:tag]
28
+ Tag.find_by locale: params[:locale], name: params[:tag]
29
29
  end
30
30
 
31
31
  def tag_creatable?
32
- !::Tag.exists?(tag_params) && Udongo.config.allow_new_tags?
32
+ !Tag.exists?(tag_params) && Udongo.config.allow_new_tags?
33
33
  end
34
34
 
35
35
  def create_tag
36
- ::Tag.create! tag_params
36
+ Tag.create! tag_params
37
37
  end
38
38
 
39
39
  def tag_params
@@ -10,12 +10,12 @@ class BackendController < ActionController::Base
10
10
  helper_method :breadcrumb
11
11
 
12
12
  def current_admin
13
- @current_admin ||= ::Admin.find(session[:admin_id]) if session[:admin_id]
13
+ @current_admin ||= Admin.find(session[:admin_id]) if session[:admin_id]
14
14
  end
15
15
  helper_method :current_admin
16
16
 
17
- def translate_notice(notice, actor)
18
- I18n.t("b.msg.#{notice}") % I18n.t("b.#{actor}")
17
+ def translate_notice(notice, actor = nil)
18
+ Udongo::Notification.new(notice).translate(actor)
19
19
  end
20
20
 
21
21
  def default_locale
@@ -1,6 +1,6 @@
1
1
  class CatchAllController < ActionController::Base
2
2
  def resolve
3
- redirect = ::Redirect.find_by(source_uri: request.path)
3
+ redirect = Redirect.find_by(source_uri: request.path)
4
4
 
5
5
  if redirect && redirect.enabled?
6
6
  redirect.used!
@@ -1,6 +1,6 @@
1
1
  class RedirectsController < ActionController::Base
2
2
  def go
3
- redirect = ::Redirect.find_by(source_uri: source_uri)
3
+ redirect = Redirect.find_by(source_uri: source_uri)
4
4
 
5
5
  if redirect && redirect.enabled?
6
6
  redirect.used!
@@ -0,0 +1,5 @@
1
+ class ApplicationDecorator < Draper::Decorator
2
+ def self.collection_decorator_class
3
+ PaginationDecorator
4
+ end
5
+ end
@@ -1,4 +1,4 @@
1
- class ContentImageDecorator < Draper::Decorator
1
+ class ContentImageDecorator < ApplicationDecorator
2
2
  delegate_all
3
3
 
4
4
  def content_type_is?(value)
@@ -0,0 +1,9 @@
1
+ class ContentRowDecorator < ApplicationDecorator
2
+ delegate_all
3
+
4
+ # If the max. column count for the biggest screen medium is met, we can safely
5
+ # assume no more additional columns are needed.
6
+ def column_limit_reached?
7
+ column_width_calculator.total(:width_xl) >= 12
8
+ end
9
+ end
@@ -1,4 +1,4 @@
1
- class ContentTextDecorator < Draper::Decorator
1
+ class ContentTextDecorator < ApplicationDecorator
2
2
  delegate_all
3
3
 
4
4
  def render
@@ -0,0 +1,16 @@
1
+ class FormDecorator < ApplicationDecorator
2
+ delegate_all
3
+
4
+ def datagrid
5
+ @datagrid ||= Udongo::Forms::SubmissionDatagrid.new(object)
6
+ end
7
+
8
+ def datagrid_fields_configured?
9
+ Udongo.config.forms.send(identifier).datagrid_fields.any?
10
+ end
11
+
12
+ def email_present?
13
+ return false if datagrid_fields_configured?
14
+ data.select('DISTINCT name').map(&:name).include?('email')
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ class FormSubmissionDecorator < ApplicationDecorator
2
+ delegate_all
3
+ end
@@ -1,4 +1,4 @@
1
- class NavigationItemDecorator < Draper::Decorator
1
+ class NavigationItemDecorator < ApplicationDecorator
2
2
  delegate_all
3
3
 
4
4
  def label
@@ -22,7 +22,7 @@ class NavigationItemDecorator < Draper::Decorator
22
22
  end
23
23
 
24
24
  def options_for_page
25
- ::Page.order(:description).map do |p|
25
+ Page.order(:description).map do |p|
26
26
  [p.description, p.id]
27
27
  end
28
28
  end