decidim-admin 0.21.0 → 0.22.0

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 (134) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/admin/application.js.es6 +4 -0
  3. data/app/assets/javascripts/decidim/admin/budget_rule_toggler.component.js.es6 +52 -0
  4. data/app/assets/javascripts/decidim/admin/bundle.js +7 -7
  5. data/app/assets/javascripts/decidim/admin/bundle.js.map +1 -1
  6. data/app/assets/javascripts/decidim/admin/dynamic_fields.component.js.es6 +24 -5
  7. data/app/assets/javascripts/decidim/admin/form.js.es6 +23 -10
  8. data/app/assets/javascripts/decidim/admin/gallery.js.es6 +5 -0
  9. data/app/assets/javascripts/decidim/admin/officializations.js.es6 +20 -0
  10. data/app/assets/stylesheets/decidim/admin/_decidim.scss +2 -0
  11. data/app/assets/stylesheets/decidim/admin/_variables.scss +1 -1
  12. data/app/assets/stylesheets/decidim/admin/extra/_newsletter-templates-gallery.scss +3 -0
  13. data/app/assets/stylesheets/decidim/admin/extra/_organization-appearance.scss +141 -0
  14. data/app/assets/stylesheets/decidim/admin/extra/_show_email.scss +31 -0
  15. data/app/assets/stylesheets/decidim/admin/extra/_title_bar.scss +4 -0
  16. data/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +10 -1
  17. data/app/assets/stylesheets/decidim/admin/modules/_cards.scss +2 -2
  18. data/app/assets/stylesheets/decidim/admin/modules/_filters.scss +2 -2
  19. data/app/assets/stylesheets/decidim/admin/modules/_forms.scss +2 -2
  20. data/app/assets/stylesheets/decidim/admin/modules/_import_result.scss +10 -0
  21. data/app/assets/stylesheets/decidim/admin/modules/_loading-spinner.scss +11 -0
  22. data/app/assets/stylesheets/decidim/admin/modules/_main-nav.scss +0 -1
  23. data/app/assets/stylesheets/decidim/admin/modules/_modules.scss +5 -1
  24. data/app/assets/stylesheets/decidim/admin/modules/_process-header.scss +0 -1
  25. data/app/assets/stylesheets/decidim/admin/modules/_secondary-nav.scss +0 -1
  26. data/app/assets/stylesheets/decidim/admin/modules/_table-list.scss +0 -5
  27. data/app/assets/stylesheets/decidim/admin/modules/_users_statistics.scss +18 -0
  28. data/app/assets/stylesheets/decidim/admin/utils/_mixins.scss +42 -0
  29. data/app/assets/stylesheets/decidim/admin/utils/_settings.scss +4 -1
  30. data/app/cells/decidim/admin/content_block/show.erb +2 -2
  31. data/app/commands/decidim/admin/create_newsletter.rb +34 -9
  32. data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
  33. data/app/commands/decidim/admin/update_component.rb +27 -3
  34. data/app/commands/decidim/admin/update_content_block.rb +2 -1
  35. data/app/commands/decidim/admin/update_newsletter.rb +31 -9
  36. data/app/commands/decidim/admin/update_organization_appearance.rb +3 -1
  37. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +6 -0
  38. data/app/controllers/decidim/admin/components_controller.rb +6 -5
  39. data/app/controllers/decidim/admin/dashboard_controller.rb +33 -1
  40. data/app/controllers/decidim/admin/metrics_controller.rb +22 -0
  41. data/app/controllers/decidim/admin/newsletter_templates_controller.rb +41 -0
  42. data/app/controllers/decidim/admin/newsletters_controller.rb +22 -4
  43. data/app/controllers/decidim/admin/officializations_controller.rb +8 -0
  44. data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -0
  45. data/app/controllers/decidim/admin/organization_controller.rb +4 -3
  46. data/app/controllers/decidim/admin/organization_homepage_content_blocks_controller.rb +1 -1
  47. data/app/forms/decidim/admin/component_form.rb +0 -23
  48. data/app/forms/decidim/admin/newsletter_form.rb +15 -3
  49. data/app/forms/decidim/admin/organization_appearance_form.rb +2 -0
  50. data/app/helpers/decidim/admin/filterable_helper.rb +35 -27
  51. data/app/helpers/decidim/admin/icon_link_helper.rb +1 -1
  52. data/app/helpers/decidim/admin/settings_helper.rb +47 -59
  53. data/app/helpers/decidim/admin/uploader_image_dimensions_helper.rb +30 -0
  54. data/app/models/decidim/admin/fake_newsletter.rb +49 -0
  55. data/app/permissions/decidim/admin/permissions.rb +6 -0
  56. data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +57 -0
  57. data/app/queries/decidim/admin/active_users_counter.rb +35 -0
  58. data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
  59. data/app/views/decidim/admin/authorization_workflows/index.html.erb +1 -0
  60. data/app/views/decidim/admin/categories/index.html.erb +1 -1
  61. data/app/views/decidim/admin/components/_settings_fields.html.erb +2 -2
  62. data/app/views/decidim/admin/dashboard/show.html.erb +35 -10
  63. data/app/views/decidim/admin/impersonatable_users/index.html.erb +2 -2
  64. data/app/views/decidim/admin/metrics/_metrics.html.erb +21 -0
  65. data/app/views/decidim/admin/metrics/index.html.erb +7 -0
  66. data/app/views/decidim/admin/newsletter_templates/index.html.erb +28 -0
  67. data/app/views/decidim/admin/newsletter_templates/show.html.erb +12 -0
  68. data/app/views/decidim/admin/newsletters/_form.html.erb +1 -7
  69. data/app/views/decidim/admin/newsletters/edit.html.erb +1 -1
  70. data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
  71. data/app/views/decidim/admin/newsletters/new.html.erb +1 -1
  72. data/app/views/decidim/admin/officializations/_show_email_modal.html.erb +31 -0
  73. data/app/views/decidim/admin/officializations/index.html.erb +7 -3
  74. data/app/views/decidim/admin/officializations/show_email.html.erb +2 -0
  75. data/app/views/decidim/admin/organization_appearance/_form.html.erb +2 -72
  76. data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +23 -0
  77. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +38 -0
  78. data/app/views/decidim/admin/organization_appearance/form/_minimap.html.erb +46 -0
  79. data/app/views/decidim/admin/resource_permissions/_options_form.html.erb +1 -1
  80. data/app/views/decidim/admin/shared/_filters.html.erb +3 -3
  81. data/app/views/decidim/admin/shared/_gallery.html.erb +21 -0
  82. data/app/views/decidim/admin/user_groups/index.html.erb +4 -4
  83. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +39 -0
  84. data/app/views/layouts/decidim/admin/_application.html.erb +1 -0
  85. data/app/views/layouts/decidim/admin/_header.html.erb +2 -0
  86. data/app/views/layouts/decidim/admin/_title_bar.html.erb +20 -10
  87. data/app/views/layouts/decidim/admin/newsletters.erb +1 -1
  88. data/config/locales/ar.yml +12 -6
  89. data/config/locales/bg-BG.yml +16 -0
  90. data/config/locales/ca.yml +46 -6
  91. data/config/locales/cs.yml +89 -49
  92. data/config/locales/da-DK.yml +1 -0
  93. data/config/locales/de.yml +102 -6
  94. data/config/locales/el.yml +848 -0
  95. data/config/locales/en.yml +46 -6
  96. data/config/locales/eo-UY.yml +0 -1
  97. data/config/locales/es-MX.yml +46 -6
  98. data/config/locales/es-PY.yml +46 -6
  99. data/config/locales/es.yml +46 -6
  100. data/config/locales/et-EE.yml +1 -0
  101. data/config/locales/eu.yml +12 -6
  102. data/config/locales/fi-plain.yml +46 -6
  103. data/config/locales/fi.yml +61 -21
  104. data/config/locales/fr-CA.yml +849 -0
  105. data/config/locales/fr.yml +83 -6
  106. data/config/locales/ga-IE.yml +1 -0
  107. data/config/locales/gl.yml +12 -6
  108. data/config/locales/hr-HR.yml +1 -0
  109. data/config/locales/hu.yml +46 -6
  110. data/config/locales/id-ID.yml +12 -6
  111. data/config/locales/is-IS.yml +10 -5
  112. data/config/locales/it.yml +78 -38
  113. data/config/locales/ja-JP.yml +849 -0
  114. data/config/locales/lt-LT.yml +1 -0
  115. data/config/locales/lv-LV.yml +835 -0
  116. data/config/locales/mt-MT.yml +1 -0
  117. data/config/locales/nl.yml +63 -6
  118. data/config/locales/no.yml +80 -43
  119. data/config/locales/pl.yml +309 -185
  120. data/config/locales/pt-BR.yml +13 -7
  121. data/config/locales/pt.yml +331 -207
  122. data/config/locales/ro-RO.yml +844 -0
  123. data/config/locales/ru.yml +11 -5
  124. data/config/locales/sk-SK.yml +823 -0
  125. data/config/locales/sk.yml +842 -0
  126. data/config/locales/sl.yml +175 -0
  127. data/config/locales/sr-CS.yml +625 -0
  128. data/config/locales/sv.yml +94 -12
  129. data/config/locales/tr-TR.yml +12 -6
  130. data/config/locales/uk.yml +10 -5
  131. data/config/routes.rb +13 -2
  132. data/lib/decidim/admin/engine.rb +2 -1
  133. data/lib/decidim/admin/version.rb +1 -1
  134. metadata +53 -18
@@ -0,0 +1,31 @@
1
+ .show_email{
2
+ padding: 0 $global-padding;
3
+
4
+ h4{
5
+ padding-top: $global-padding;
6
+
7
+ @include smallcaps;
8
+
9
+ color: $muted;
10
+ }
11
+
12
+ > div{
13
+ padding: $global-padding;
14
+ background-color: $medium-gray;
15
+ }
16
+
17
+ p{
18
+ text-align: center;
19
+ margin: 0;
20
+ }
21
+
22
+ #user_email + p{
23
+ display: none;
24
+ color: $muted;
25
+ font-style: italic;
26
+ }
27
+
28
+ #user_email:empty + p{
29
+ display: block;
30
+ }
31
+ }
@@ -18,6 +18,10 @@
18
18
  position: initial;
19
19
  }
20
20
 
21
+ .dropdown.menu > li > a{
22
+ background: transparent;
23
+ }
24
+
21
25
  .is-dropdown-submenu{
22
26
  z-index: 2;
23
27
  }
@@ -24,7 +24,16 @@
24
24
 
25
25
  &.reverse{
26
26
  @include modifiers(color);
27
- @include modifiers(background-color, (primary: $white, secondary: $white, success: $white, warning: $white, alert: $white));
27
+ @include modifiers(
28
+ background-color,
29
+ (
30
+ primary: $white,
31
+ secondary: $white,
32
+ success: $white,
33
+ warning: $white,
34
+ alert: $white,
35
+ )
36
+ );
28
37
  }
29
38
  }
30
39
 
@@ -1,10 +1,10 @@
1
1
  $card-padding-small: 1rem;
2
2
 
3
3
  .card-title{
4
- @include smallcaps;
4
+ @include smallemphasis;
5
5
 
6
6
  button:not(.clear){
7
- @include smallcaps;
7
+ @include smallemphasis;
8
8
  }
9
9
 
10
10
  // clearfix if there is no flex--* class in the same element
@@ -18,7 +18,6 @@
18
18
  }
19
19
 
20
20
  .button.dropdown{
21
- text-transform: uppercase;
22
21
  font-weight: 600;
23
22
  letter-spacing: .1em;
24
23
  }
@@ -28,6 +27,8 @@
28
27
 
29
28
  & > li.is-dropdown-submenu-parent > a{
30
29
  padding-right: 1rem;
30
+ background-color: $button-background;
31
+ color: $white;
31
32
 
32
33
  &::after{
33
34
  border-top-color: $white;
@@ -58,7 +59,6 @@
58
59
 
59
60
  .label{
60
61
  font-weight: 600;
61
- text-transform: uppercase;
62
62
  margin-top: .5rem;
63
63
 
64
64
  .type-icon{
@@ -58,7 +58,7 @@ textarea{
58
58
  }
59
59
 
60
60
  .legend{
61
- @include smallcaps;
61
+ @include smallemphasis;
62
62
 
63
63
  margin-bottom: 1rem;
64
64
  }
@@ -130,7 +130,7 @@ textarea{
130
130
  }
131
131
  }
132
132
 
133
- .participatory_texts_disabled{
133
+ .readonly_container{
134
134
  cursor: not-allowed;
135
135
  opacity: .5;
136
136
  }
@@ -0,0 +1,10 @@
1
+ .new_import .import-process-info{
2
+ margin-top: 1em;
3
+ font-style: italic;
4
+
5
+ span.attribute-name{
6
+ background-color: lightgrey;
7
+ font-style: normal;
8
+ padding: 1px 4px;
9
+ }
10
+ }
@@ -0,0 +1,11 @@
1
+ .loading-spinner{
2
+ height: 25px;
3
+ text-align: center;
4
+
5
+ &::before{
6
+ @include spinner(25px, $medium-gray, var(--primary), 800ms);
7
+
8
+ content: "";
9
+ vertical-align: middle;
10
+ }
11
+ }
@@ -22,7 +22,6 @@
22
22
  display: block;
23
23
  color: $medium-gray;
24
24
  font-size: .7rem;
25
- text-transform: uppercase;
26
25
 
27
26
  &:hover{
28
27
  background-color: lighten($dark-gray, 10);
@@ -28,10 +28,14 @@
28
28
  @import "dropdown";
29
29
  @import "agenda";
30
30
  @import "draggable-list";
31
+ @import "loading-spinner";
32
+ @import "import_result";
31
33
 
32
34
  // mentions__container
33
35
  @import "decidim/modules/tags";
34
36
  @import "decidim/modules/input-tags";
35
37
  @import "decidim/modules/input-mentions";
36
- @import "decidim/modules/input-hashtags";
37
38
  @import "decidim/modules/input-gallery";
39
+
40
+ //Admin dashboard
41
+ @import "users_statistics";
@@ -1,6 +1,5 @@
1
1
  .assembly-header__title,
2
2
  .process-header__title{
3
- text-transform: uppercase;
4
3
  font-size: .8rem;
5
4
  margin-bottom: 1rem;
6
5
  color: $muted;
@@ -64,7 +64,6 @@ $process-title-height: 3rem;
64
64
  .secondary-nav__title,
65
65
  .process-title-content{
66
66
  margin-bottom: 1.5rem;
67
- text-transform: uppercase;
68
67
  font-size: .8rem;
69
68
  letter-spacing: .1em;
70
69
  font-weight: bold;
@@ -9,10 +9,6 @@
9
9
  border-collapse: collapse;
10
10
  border-spacing: 0;
11
11
 
12
- th{
13
- text-transform: uppercase;
14
- }
15
-
16
12
  th,
17
13
  td{
18
14
  border-bottom: 1px solid rgba(black, .05);
@@ -130,7 +126,6 @@
130
126
  margin-left: -1.5 * $global-padding;
131
127
  font-size: 80%;
132
128
  font-weight: 600;
133
- text-transform: uppercase;
134
129
 
135
130
  &.expanded{
136
131
  display: inline-block;
@@ -0,0 +1,18 @@
1
+ .table-list.users_count tbody tr td.title{
2
+ text-align: center;
3
+ color: $medium-gray;
4
+ }
5
+
6
+ .table-list.users_count th:not(:first-child),
7
+ .table-list.users_count td:not(:first-child){
8
+ text-align: center;
9
+ }
10
+
11
+ .table-list.users_count th:last-child,
12
+ .table-list.users_count td:last-child{
13
+ text-align: center;
14
+ }
15
+
16
+ .table-list.users_count th{
17
+ text-transform: capitalize;
18
+ }
@@ -18,6 +18,13 @@
18
18
  font-size: .9em;
19
19
  }
20
20
 
21
+ //Small emphasis
22
+ @mixin smallemphasis{
23
+ font-weight: 600;
24
+ letter-spacing: .1em;
25
+ font-size: .9em;
26
+ }
27
+
21
28
  // Status modifier mixin
22
29
  $palette: $foundation-palette;
23
30
 
@@ -80,3 +87,38 @@ $side:(
80
87
  }
81
88
 
82
89
  @include make-spaces()
90
+
91
+ @mixin animation($animation){
92
+ -webkit-animation: $animation;
93
+ -o-animation: $animation;
94
+ animation: $animation;
95
+ }
96
+
97
+ @mixin spinner($size, $orbit, $satellite, $time){
98
+ @include animation( animation-spin $time infinite linear );
99
+ @include square($size);
100
+
101
+ box-sizing: border-box;
102
+ border-radius: 50%;
103
+ border: floor(($size / 8)) solid $orbit;
104
+ border-right-color: $satellite;
105
+ display: inline-block;
106
+ position: relative;
107
+ }
108
+
109
+ @mixin size($width, $height){
110
+ width: $width;
111
+ height: $height;
112
+ }
113
+
114
+ @mixin square($size){
115
+ @include size($size, $size);
116
+ }
117
+
118
+ @keyframes animation-spin{
119
+ to{ transform: rotate(1turn); }
120
+ }
121
+
122
+ @-webkit-keyframes animation-spin{
123
+ to{ -webkit-transform: rotate(1turn); }
124
+ }
@@ -276,7 +276,7 @@ $breadcrumbs-item-color: $primary-color;
276
276
  $breadcrumbs-item-color-current: $black;
277
277
  $breadcrumbs-item-color-disabled: $medium-gray;
278
278
  $breadcrumbs-item-margin: .75rem;
279
- $breadcrumbs-item-uppercase: true;
279
+ $breadcrumbs-item-uppercase: false;
280
280
  $breadcrumbs-item-separator: true;
281
281
  $breadcrumbs-item-separator-color: $medium-gray;
282
282
 
@@ -443,6 +443,9 @@ $input-background-focus: $white;
443
443
  $input-background-disabled: $light-gray;
444
444
  $input-border: 1px solid $light-gray;
445
445
  $input-border-focus: 1px solid map-get($foundation-palette, primary);
446
+ $input-outline: 0;
447
+ $input-outline-focus: 2px solid $primary-color;
448
+ $input-outline-offset: 2px;
446
449
  $input-padding: $form-spacing / 2;
447
450
  $input-shadow: inset 0 1px 2px rgba($black, .1);
448
451
  $input-shadow-focus: 0 0 5px $medium-gray;
@@ -4,10 +4,10 @@
4
4
  <div>
5
5
  <% if has_settings? %>
6
6
  <%= link_to decidim_admin.edit_organization_homepage_content_block_path(manifest_name), class: "mr-s text-muted" do %>
7
- <%= icon "pencil" %>
7
+ <%= icon "pencil", role: "img" %>
8
8
  <% end %>
9
9
  <% end %>
10
- <%= icon "menu" %>
10
+ <%= icon "menu", role: "img" %>
11
11
  </div>
12
12
  </div>
13
13
  </li>
@@ -8,25 +8,50 @@ module Decidim
8
8
  # Initializes the command.
9
9
  #
10
10
  # form - The source fo data for this newsletter.
11
+ # content_block - An instance of `Decidim::ContentBlock` that holds the
12
+ # newsletter attributes.
11
13
  # user - The User that authored this newsletter.
12
- def initialize(form, user)
14
+ def initialize(form, content_block, user)
13
15
  @form = form
16
+ @content_block = content_block
14
17
  @user = user
15
18
  end
16
19
 
17
20
  def call
18
- return broadcast(:invalid) unless @form.valid?
21
+ return broadcast(:invalid) unless form.valid?
19
22
 
20
- newsletter = Decidim.traceability.create!(
23
+ transaction do
24
+ create_newsletter
25
+ create_content_block
26
+ end
27
+
28
+ broadcast(:ok, newsletter)
29
+ end
30
+
31
+ private
32
+
33
+ attr_reader :user, :form, :newsletter, :content_block
34
+
35
+ def create_newsletter
36
+ @newsletter = Decidim.traceability.create!(
21
37
  Newsletter,
22
- @user,
23
- subject: @form.subject,
24
- body: @form.body,
25
- author: @user,
26
- organization: @user.organization
38
+ user,
39
+ subject: form.subject,
40
+ author: user,
41
+ organization: user.organization
27
42
  )
43
+ end
28
44
 
29
- broadcast(:ok, newsletter)
45
+ def create_content_block
46
+ UpdateContentBlock.call(form, content_block, user) do
47
+ on(:ok) do |content_block|
48
+ content_block.update(scoped_resource_id: newsletter.id)
49
+ @content_block = content_block
50
+ end
51
+ on(:invalid) do
52
+ raise "There was a problem persisting the changes to the content block"
53
+ end
54
+ end
30
55
  end
31
56
  end
32
57
  end
@@ -77,7 +77,7 @@ module Decidim
77
77
  def create_content_block(manifest_name, weight)
78
78
  Decidim::ContentBlock.create!(
79
79
  organization: organization,
80
- scope: scope,
80
+ scope_name: scope,
81
81
  weight: weight,
82
82
  manifest_name: manifest_name
83
83
  )
@@ -33,13 +33,15 @@ module Decidim
33
33
  private
34
34
 
35
35
  def update_component
36
- @previous_settings = @component.attributes["settings"].dup
37
-
36
+ @previous_settings = @component.attributes["settings"].with_indifferent_access
38
37
  @component.name = form.name
38
+ @component.weight = form.weight
39
+
40
+ restore_readonly_settings!
41
+
39
42
  @component.settings = form.settings
40
43
  @component.default_step_settings = form.default_step_settings
41
44
  @component.step_settings = form.step_settings
42
- @component.weight = form.weight
43
45
 
44
46
  @settings_changed = @component.settings_changed?
45
47
 
@@ -57,6 +59,28 @@ module Decidim
57
59
  def current_settings
58
60
  @component.attributes["settings"]
59
61
  end
62
+
63
+ # Keep previous values for readonly settings
64
+ def restore_readonly_settings!
65
+ browse_readonly_settings("global") do |attribute|
66
+ form.settings[attribute] = @previous_settings.dig("global", attribute)
67
+ end
68
+
69
+ browse_readonly_settings("step") do |attribute|
70
+ form.default_step_settings[attribute] = @previous_settings.dig("default_step", attribute) if form.default_step_settings.present?
71
+ if form.step_settings.present?
72
+ form.step_settings.each do |step_name, step|
73
+ step[attribute] = @previous_settings.dig("steps", step_name, attribute)
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+ def browse_readonly_settings(settings_name)
80
+ @component.manifest.settings(settings_name).attributes
81
+ .select { |_attribute, obj| obj.readonly?(component: @component) }
82
+ .each { |attribute, _obj| yield(attribute) }
83
+ end
60
84
  end
61
85
  end
62
86
  end
@@ -26,11 +26,12 @@ module Decidim
26
26
 
27
27
  transaction do
28
28
  update_content_block_settings
29
+ content_block.save!
29
30
  update_content_block_images
30
31
  content_block.save!
31
32
  end
32
33
 
33
- broadcast(:ok)
34
+ broadcast(:ok, content_block)
34
35
  end
35
36
 
36
37
  private
@@ -11,25 +11,47 @@ module Decidim
11
11
  # user - The user that updates the newsletter.
12
12
  def initialize(newsletter, form, user)
13
13
  @newsletter = newsletter
14
+ @content_block = newsletter.template
14
15
  @form = form
15
16
  @user = user
16
17
  @organization = user.organization
17
18
  end
18
19
 
19
20
  def call
20
- return broadcast(:invalid) unless @form.valid?
21
- return broadcast(:invalid) if @newsletter.sent?
22
- return broadcast(:invalid) unless @organization == @newsletter.organization
21
+ return broadcast(:invalid) unless form.valid?
22
+ return broadcast(:invalid) if newsletter.sent?
23
+ return broadcast(:invalid) unless organization == newsletter.organization
23
24
 
25
+ transaction do
26
+ update_newsletter
27
+ update_content_block
28
+ end
29
+
30
+ broadcast(:ok, newsletter)
31
+ end
32
+
33
+ private
34
+
35
+ attr_reader :user, :newsletter, :content_block, :organization, :form
36
+
37
+ def update_newsletter
24
38
  @newsletter = Decidim.traceability.update!(
25
- @newsletter,
26
- @user,
27
- subject: @form.subject,
28
- body: @form.body,
29
- author: @user
39
+ newsletter,
40
+ user,
41
+ subject: form.subject,
42
+ author: user
30
43
  )
44
+ end
31
45
 
32
- broadcast(:ok, @newsletter)
46
+ def update_content_block
47
+ UpdateContentBlock.call(form, content_block, user) do
48
+ on(:ok) do |content_block|
49
+ @content_block = content_block
50
+ end
51
+ on(:invalid) do
52
+ raise "There was a problem persisting the changes to the content block"
53
+ end
54
+ end
33
55
  end
34
56
  end
35
57
  end