decidim 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim might be problematic. Click here for more details.

Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Gemfile.lock +49 -55
  4. data/README.md +2 -1
  5. data/Rakefile +4 -4
  6. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_label-required.scss +3 -0
  7. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_title_bar.scss +57 -1
  8. data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +28 -7
  9. data/decidim-admin/app/commands/decidim/admin/create_participatory_process_step.rb +2 -1
  10. data/decidim-admin/app/commands/decidim/admin/destroy_participatory_process_step.rb +5 -2
  11. data/decidim-admin/app/commands/decidim/admin/update_feature.rb +1 -0
  12. data/decidim-admin/app/commands/decidim/admin/update_organization.rb +10 -5
  13. data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +4 -2
  14. data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +2 -0
  15. data/decidim-admin/app/controllers/decidim/admin/concerns/has_attachments.rb +10 -1
  16. data/decidim-admin/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +0 -5
  17. data/decidim-admin/app/controllers/decidim/admin/features/base_controller.rb +0 -1
  18. data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +7 -4
  19. data/decidim-admin/app/controllers/decidim/admin/organization_controller.rb +9 -3
  20. data/decidim-admin/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +17 -0
  21. data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +11 -3
  22. data/decidim-admin/app/forms/decidim/admin/feature_form.rb +6 -0
  23. data/decidim-admin/app/forms/decidim/admin/organization_form.rb +5 -0
  24. data/decidim-admin/app/forms/decidim/admin/participatory_process_copy_form.rb +2 -3
  25. data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +2 -0
  26. data/decidim-admin/app/forms/decidim/admin/static_page_form.rb +6 -0
  27. data/decidim-admin/app/helpers/decidim/admin/menu_helper.rb +1 -1
  28. data/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb +9 -5
  29. data/decidim-admin/app/views/decidim/admin/attachments/_form.html.erb +1 -12
  30. data/decidim-admin/app/views/decidim/admin/features/_feature.html.erb +2 -2
  31. data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +18 -0
  32. data/decidim-admin/app/views/decidim/admin/moderations/_report.html.erb +2 -2
  33. data/decidim-admin/app/views/decidim/admin/organization/_form.html.erb +5 -35
  34. data/decidim-admin/app/views/decidim/admin/participatory_process_groups/_form.html.erb +1 -1
  35. data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +16 -0
  36. data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +2 -14
  37. data/decidim-admin/app/views/layouts/decidim/admin/_title_bar.html.erb +26 -19
  38. data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +2 -2
  39. data/decidim-admin/bin/rails +2 -2
  40. data/decidim-admin/config/i18n-tasks.yml +2 -0
  41. data/decidim-admin/config/locales/ca.yml +9 -5
  42. data/decidim-admin/config/locales/en.yml +9 -5
  43. data/decidim-admin/config/locales/es.yml +11 -5
  44. data/decidim-admin/config/locales/eu.yml +0 -5
  45. data/decidim-admin/config/locales/fr.yml +18 -23
  46. data/decidim-admin/config/locales/it.yml +0 -5
  47. data/decidim-admin/config/routes.rb +5 -3
  48. data/decidim-admin/decidim-admin.gemspec +2 -2
  49. data/decidim-admin/lib/decidim/admin/test/manage_attachments_examples.rb +1 -2
  50. data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +42 -26
  51. data/decidim-admin/spec/commands/create_participatory_process_spec.rb +2 -1
  52. data/decidim-admin/spec/commands/create_participatory_process_step_spec.rb +56 -0
  53. data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +2 -2
  54. data/decidim-admin/spec/commands/update_feature_spec.rb +6 -0
  55. data/decidim-admin/spec/controllers/participatory_processes_controller_spec.rb +3 -6
  56. data/decidim-admin/spec/features/admin_copy_participatory_process_spec.rb +9 -9
  57. data/decidim-admin/spec/features/admin_manages_features_spec.rb +32 -0
  58. data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +3 -4
  59. data/decidim-admin/spec/forms/static_page_form_spec.rb +12 -0
  60. data/decidim-admin/spec/jobs/newsletter_job_spec.rb +3 -0
  61. data/decidim-admin/spec/shared/manage_process_admins_examples.rb +22 -0
  62. data/decidim-admin/spec/shared/manage_processes_examples.rb +6 -0
  63. data/decidim-admin/spec/spec_helper.rb +4 -0
  64. data/decidim-api/bin/rails +2 -2
  65. data/decidim-api/decidim-api.gemspec +3 -3
  66. data/decidim-api/spec/spec_helper.rb +4 -0
  67. data/decidim-api/spec/types/query_type_spec.rb +2 -2
  68. data/decidim-budgets/app/models/decidim/budgets/project.rb +5 -0
  69. data/decidim-budgets/bin/rails +2 -2
  70. data/decidim-budgets/config/locales/fr.yml +2 -2
  71. data/decidim-budgets/decidim-budgets.gemspec +2 -2
  72. data/decidim-budgets/lib/decidim/budgets/feature.rb +1 -1
  73. data/decidim-budgets/spec/spec_helper.rb +4 -0
  74. data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
  75. data/decidim-comments/app/commands/decidim/comments/create_comment.rb +10 -14
  76. data/decidim-comments/app/frontend/application/application.component.tsx +1 -1
  77. data/decidim-comments/app/frontend/comments/add_comment_form.component.test.tsx +33 -26
  78. data/decidim-comments/app/frontend/comments/add_comment_form.component.tsx +109 -83
  79. data/decidim-comments/app/frontend/comments/comment.component.test.tsx +29 -24
  80. data/decidim-comments/app/frontend/comments/comment.component.tsx +12 -5
  81. data/decidim-comments/app/frontend/comments/comment_thread.component.test.tsx +12 -7
  82. data/decidim-comments/app/frontend/comments/comment_thread.component.tsx +7 -2
  83. data/decidim-comments/app/frontend/comments/comments.component.tsx +26 -15
  84. data/decidim-comments/app/frontend/comments/down_vote_button.component.test.tsx +9 -4
  85. data/decidim-comments/app/frontend/comments/down_vote_button.component.tsx +56 -37
  86. data/decidim-comments/app/frontend/comments/up_vote_button.component.test.tsx +9 -4
  87. data/decidim-comments/app/frontend/comments/up_vote_button.component.tsx +31 -16
  88. data/decidim-comments/app/frontend/comments/vote_button.component.tsx +3 -0
  89. data/decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb +8 -6
  90. data/decidim-comments/app/models/decidim/comments/comment.rb +13 -1
  91. data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb +1 -1
  92. data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +1 -1
  93. data/decidim-comments/bin/rails +2 -2
  94. data/decidim-comments/config/locales/ca.yml +2 -0
  95. data/decidim-comments/config/locales/en.yml +2 -0
  96. data/decidim-comments/config/locales/es.yml +2 -0
  97. data/decidim-comments/config/locales/fr.yml +2 -2
  98. data/decidim-comments/decidim-comments.gemspec +3 -3
  99. data/decidim-comments/lib/decidim/comments/commentable.rb +1 -0
  100. data/decidim-comments/spec/commands/create_comment_spec.rb +22 -54
  101. data/decidim-comments/spec/features/notifications_spec.rb +2 -6
  102. data/decidim-comments/spec/mailers/comment_notification_mailer_spec.rb +5 -4
  103. data/decidim-comments/spec/models/comment_spec.rb +32 -2
  104. data/decidim-comments/spec/shared/author_localised_email.rb +2 -3
  105. data/decidim-comments/spec/spec_helper.rb +4 -0
  106. data/decidim-dev/decidim-dev.gemspec +3 -4
  107. data/decidim-dev/lib/decidim/dev.rb +23 -1
  108. data/decidim-dev/lib/decidim/dev/common_rake.rb +3 -0
  109. data/decidim-dev/lib/decidim/dev/railtie.rb +3 -3
  110. data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +4 -3
  111. data/decidim-dev/lib/decidim/dev/test/rspec_support/capybara.rb +3 -0
  112. data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +8 -0
  113. data/decidim-dev/lib/decidim/dev/test/rspec_support/feature_context.rb +4 -2
  114. data/decidim-dev/lib/decidim/dev/test/rspec_support/geocoder.rb +7 -2
  115. data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-getOwnPropertyNames.js +16 -0
  116. data/decidim-dev/lib/decidim/dev/test/rspec_support/warden.rb +17 -1
  117. data/decidim-meetings/app/helpers/decidim/meetings/application_helper.rb +1 -0
  118. data/decidim-meetings/app/helpers/decidim/meetings/meetings_helper.rb +24 -0
  119. data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +1 -1
  120. data/decidim-meetings/bin/rails +2 -2
  121. data/decidim-meetings/config/locales/ca.yml +1 -0
  122. data/decidim-meetings/config/locales/en.yml +2 -1
  123. data/decidim-meetings/config/locales/es.yml +1 -0
  124. data/decidim-meetings/config/locales/fr.yml +5 -5
  125. data/decidim-meetings/decidim-meetings.gemspec +2 -2
  126. data/decidim-meetings/lib/decidim/meetings/feature.rb +1 -1
  127. data/decidim-meetings/spec/features/admin_manages_meetings_attachments_spec.rb +1 -1
  128. data/decidim-meetings/spec/features/admin_manages_meetings_spec.rb +1 -1
  129. data/decidim-meetings/spec/features/explore_meetings_spec.rb +1 -1
  130. data/decidim-meetings/spec/features/process_admin_manages_meetings_attachments_spec.rb +1 -1
  131. data/decidim-meetings/spec/features/process_admin_manages_meetings_spec.rb +1 -1
  132. data/decidim-meetings/spec/helpers/meetings_helper_spec.rb +16 -0
  133. data/decidim-meetings/spec/spec_helper.rb +4 -0
  134. data/decidim-pages/app/models/decidim/pages/page.rb +5 -0
  135. data/decidim-pages/bin/rails +2 -2
  136. data/decidim-pages/decidim-pages.gemspec +2 -2
  137. data/decidim-pages/lib/decidim/pages/feature.rb +1 -1
  138. data/decidim-pages/spec/commands/destroy_page_spec.rb +1 -1
  139. data/decidim-pages/spec/spec_helper.rb +4 -0
  140. data/decidim-proposals/app/assets/config/decidim_proposals_manifest.js +1 -0
  141. data/decidim-proposals/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +23 -0
  142. data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +7 -1
  143. data/decidim-proposals/app/models/decidim/proposals/proposal.rb +14 -2
  144. data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +1 -0
  145. data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +5 -0
  146. data/decidim-proposals/bin/rails +2 -2
  147. data/decidim-proposals/config/locales/fr.yml +11 -11
  148. data/decidim-proposals/db/migrate/20170307085300_migrate_proposal_reports_data_to_reports.rb +1 -1
  149. data/decidim-proposals/decidim-proposals.gemspec +2 -2
  150. data/decidim-proposals/lib/decidim/proposals/feature.rb +1 -1
  151. data/decidim-proposals/spec/features/proposals_spec.rb +8 -2
  152. data/decidim-proposals/spec/models/decidim/proposals/proposal_spec.rb +35 -0
  153. data/decidim-proposals/spec/shared/create_proposal_examples.rb +20 -14
  154. data/decidim-proposals/spec/shared/manage_proposals_examples.rb +13 -16
  155. data/decidim-proposals/spec/shared/proposal_form_examples.rb +22 -16
  156. data/decidim-proposals/spec/spec_helper.rb +4 -0
  157. data/decidim-results/app/models/decidim/results/result.rb +10 -0
  158. data/decidim-results/bin/rails +2 -2
  159. data/decidim-results/config/locales/fr.yml +2 -2
  160. data/decidim-results/decidim-results.gemspec +2 -2
  161. data/decidim-results/lib/decidim/results/feature.rb +1 -1
  162. data/decidim-results/spec/features/comments_spec.rb +10 -0
  163. data/decidim-results/spec/spec_helper.rb +4 -0
  164. data/decidim-surveys/app/models/decidim/surveys/survey_question.rb +2 -0
  165. data/decidim-surveys/bin/rails +2 -2
  166. data/decidim-surveys/decidim-surveys.gemspec +2 -2
  167. data/decidim-surveys/lib/decidim/surveys/feature.rb +3 -2
  168. data/decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb +1 -1
  169. data/decidim-surveys/spec/models/decidim/surveys/survey_question_spec.rb +7 -1
  170. data/decidim-surveys/spec/spec_helper.rb +5 -0
  171. data/decidim-system/app/controllers/decidim/system/application_controller.rb +1 -1
  172. data/decidim-system/app/controllers/decidim/system/devise/sessions_controller.rb +1 -0
  173. data/decidim-system/app/helpers/decidim/system/menu_helper.rb +1 -1
  174. data/decidim-system/app/views/decidim/system/shared/_notices.html.erb +11 -0
  175. data/decidim-system/app/views/layouts/decidim/system/application.html.erb +1 -1
  176. data/decidim-system/app/views/layouts/decidim/system/login.html.erb +1 -1
  177. data/decidim-system/bin/rails +2 -2
  178. data/decidim-system/config/locales/ca.yml +4 -0
  179. data/decidim-system/config/locales/en.yml +4 -0
  180. data/decidim-system/config/locales/es.yml +4 -0
  181. data/decidim-system/db/migrate/20160919105637_devise_create_decidim_admins.rb +5 -5
  182. data/decidim-system/db/seeds.rb +1 -1
  183. data/decidim-system/decidim-system.gemspec +2 -2
  184. data/decidim-system/spec/factories.rb +2 -2
  185. data/decidim-system/spec/features/manage_admins_spec.rb +3 -3
  186. data/decidim-system/spec/spec_helper.rb +4 -0
  187. data/decidim.gemspec +6 -6
  188. data/docs/how_to_create_a_plugin.md +2 -2
  189. data/lib/generators/decidim/app_generator.rb +1 -1
  190. data/lib/generators/decidim/install_generator.rb +35 -27
  191. data/lib/generators/decidim/templates/Gemfile.erb +1 -0
  192. data/lib/generators/decidim/templates/initializer.rb +7 -1
  193. data/logo.svg +62 -0
  194. data/package.json +37 -35
  195. data/tsconfig.json +3 -0
  196. data/yarn.lock +1017 -486
  197. metadata +32 -25
  198. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_language-chooser.scss +0 -4
@@ -53,12 +53,17 @@ module Decidim
53
53
  github_handler: form.github_handler,
54
54
  description: form.description,
55
55
  welcome_text: form.welcome_text,
56
- homepage_image: form.homepage_image || organization.homepage_image,
57
- logo: form.logo || organization.logo,
58
- favicon: form.favicon || organization.favicon,
56
+ homepage_image: form.homepage_image,
57
+ remove_homepage_image: form.remove_homepage_image,
58
+ logo: form.logo,
59
+ remove_logo: form.remove_logo,
60
+ favicon: form.favicon,
61
+ remove_favicon: form.remove_favicon,
59
62
  default_locale: form.default_locale,
60
- official_img_header: form.official_img_header || organization.official_img_header,
61
- official_img_footer: form.official_img_footer || organization.official_img_footer,
63
+ official_img_header: form.official_img_header,
64
+ remove_official_img_header: form.remove_official_img_header,
65
+ official_img_footer: form.official_img_footer,
66
+ remove_official_img_footer: form.remove_official_img_footer,
62
67
  official_url: form.official_url,
63
68
  show_statistics: form.show_statistics
64
69
  }
@@ -48,8 +48,10 @@ module Decidim
48
48
  subtitle: form.subtitle,
49
49
  slug: form.slug,
50
50
  hashtag: form.hashtag,
51
- hero_image: form.hero_image || participatory_process.hero_image,
52
- banner_image: form.banner_image || participatory_process.banner_image,
51
+ hero_image: form.hero_image,
52
+ remove_hero_image: form.remove_hero_image,
53
+ banner_image: form.banner_image,
54
+ remove_banner_image: form.remove_banner_image,
53
55
  promoted: form.promoted,
54
56
  description: form.description,
55
57
  short_description: form.short_description,
@@ -9,6 +9,7 @@ module Decidim
9
9
  include FormFactory
10
10
  include LocaleSwitcher
11
11
  include PayloadInfo
12
+
12
13
  helper Decidim::Admin::ApplicationHelper
13
14
  helper Decidim::Admin::AttributesDisplayHelper
14
15
  helper Decidim::Admin::FeatureSettingsHelper
@@ -21,6 +22,7 @@ module Decidim
21
22
  helper Decidim::OrganizationScopesHelper
22
23
  helper Decidim::TranslationsHelper
23
24
  helper Decidim::LanguageChooserHelper
25
+ helper Decidim::FeaturePathHelper
24
26
 
25
27
  protect_from_forgery with: :exception, prepend: true
26
28
 
@@ -54,7 +54,7 @@ module Decidim
54
54
  def update
55
55
  @attachment = collection.find(params[:id])
56
56
  authorize! :update, authorization_object
57
- @form = form(AttachmentForm).from_params(params)
57
+ @form = form(AttachmentForm).from_params(attachment_params)
58
58
 
59
59
  UpdateAttachment.call(@attachment, @form) do
60
60
  on(:ok) do
@@ -110,6 +110,15 @@ module Decidim
110
110
  def collection
111
111
  @collection ||= attached_to.attachments
112
112
  end
113
+
114
+ private
115
+
116
+ def attachment_params
117
+ {
118
+ id: params[:id],
119
+ file: @attachment.file
120
+ }.merge(params[:attachment].to_unsafe_h)
121
+ end
113
122
  end
114
123
  end
115
124
  end
@@ -11,7 +11,6 @@ module Decidim
11
11
 
12
12
  included do
13
13
  helper_method :participatory_process
14
- before_action :ensure_participatory_process
15
14
 
16
15
  layout "decidim/admin/participatory_process"
17
16
  end
@@ -22,10 +21,6 @@ module Decidim
22
21
  @participatory_process ||=
23
22
  current_organization.participatory_processes.find(params[:participatory_process_id])
24
23
  end
25
-
26
- def ensure_participatory_process
27
- raise ActionController::RoutingError, "Not Found" unless participatory_process
28
- end
29
24
  end
30
25
  end
31
26
  end
@@ -8,7 +8,6 @@ module Decidim
8
8
  class BaseController < Admin::ApplicationController
9
9
  skip_authorize_resource
10
10
  include Concerns::ParticipatoryProcessAdmin
11
- include NeedsParticipatoryProcess
12
11
  include FeatureSettings
13
12
 
14
13
  helper Decidim::Admin::ExportsHelper
@@ -48,17 +48,20 @@ module Decidim
48
48
 
49
49
  def moderations
50
50
  @moderations ||= begin
51
- moderations = Decidim::Moderation.where(participatory_process: participatory_process)
52
51
  if params[:hidden]
53
- moderations.where.not(hidden_at: nil)
52
+ participatory_process_moderations.where.not(hidden_at: nil)
54
53
  else
55
- moderations.where(hidden_at: nil)
54
+ participatory_process_moderations.where(hidden_at: nil)
56
55
  end
57
56
  end
58
57
  end
59
58
 
60
59
  def reportable
61
- @reportable ||= Decidim::Moderation.where(participatory_process: participatory_process).find(params[:id]).reportable
60
+ @reportable ||= participatory_process_moderations.find(params[:id]).reportable
61
+ end
62
+
63
+ def participatory_process_moderations
64
+ @participatory_process_moderations ||= Decidim::Moderation.where(participatory_process: participatory_process)
62
65
  end
63
66
  end
64
67
  end
@@ -16,7 +16,7 @@ module Decidim
16
16
 
17
17
  def update
18
18
  authorize! :update, current_organization
19
- @form = form(OrganizationForm).from_params(form_params)
19
+ @form = form(OrganizationForm).from_params(organization_params)
20
20
 
21
21
  UpdateOrganization.call(current_organization, @form) do
22
22
  on(:ok) do
@@ -33,10 +33,16 @@ module Decidim
33
33
 
34
34
  private
35
35
 
36
- def form_params
36
+ def organization_params
37
37
  params[:organization] ||= {}
38
38
  params[:organization][:id] ||= current_organization.id
39
- params
39
+ {
40
+ homepage_image: current_organization.homepage_image,
41
+ logo: current_organization.logo,
42
+ favicon: current_organization.favicon,
43
+ official_img_header: current_organization.official_img_header,
44
+ official_img_footer: current_organization.official_img_footer
45
+ }.merge(params[:organization].to_unsafe_h)
40
46
  end
41
47
  end
42
48
  end
@@ -70,6 +70,23 @@ module Decidim
70
70
  redirect_to participatory_process_user_roles_path(@participatory_process_user_role.participatory_process)
71
71
  end
72
72
 
73
+ def resend_invitation
74
+ @user_role = collection.find(params[:id])
75
+ authorize! :invite, @user_role
76
+
77
+ InviteUserAgain.call(@user_role.user, "invite_admin") do
78
+ on(:ok) do
79
+ flash[:notice] = I18n.t("users.resend_invitation.success", scope: "decidim.admin")
80
+ end
81
+
82
+ on(:invalid) do
83
+ flash[:alert] = I18n.t("users.resend_invitation.error", scope: "decidim.admin")
84
+ end
85
+ end
86
+
87
+ redirect_to participatory_process_user_roles_path(participatory_process)
88
+ end
89
+
73
90
  private
74
91
 
75
92
  def collection
@@ -27,7 +27,7 @@ module Decidim
27
27
  CreateParticipatoryProcess.call(@form) do
28
28
  on(:ok) do |participatory_process|
29
29
  flash[:notice] = I18n.t("participatory_processes.create.success", scope: "decidim.admin")
30
- redirect_to edit_participatory_process_path(participatory_process)
30
+ redirect_to participatory_process_steps_path(participatory_process)
31
31
  end
32
32
 
33
33
  on(:invalid) do
@@ -47,7 +47,7 @@ module Decidim
47
47
  def update
48
48
  @participatory_process = collection.find(params[:id])
49
49
  authorize! :update, @participatory_process
50
- @form = form(ParticipatoryProcessForm).from_params(params)
50
+ @form = form(ParticipatoryProcessForm).from_params(participatory_process_params)
51
51
 
52
52
  UpdateParticipatoryProcess.call(@participatory_process, @form) do
53
53
  on(:ok) do |participatory_process|
@@ -57,7 +57,7 @@ module Decidim
57
57
 
58
58
  on(:invalid) do
59
59
  flash.now[:alert] = I18n.t("participatory_processes.update.error", scope: "decidim.admin")
60
- render :edit
60
+ render :edit, layout: "decidim/admin/participatory_process"
61
61
  end
62
62
  end
63
63
  end
@@ -88,6 +88,14 @@ module Decidim
88
88
  def collection
89
89
  @collection ||= ManageableParticipatoryProcessesForUser.for(current_user)
90
90
  end
91
+
92
+ def participatory_process_params
93
+ {
94
+ id: params[:id],
95
+ hero_image: @participatory_process.hero_image,
96
+ banner_image: @participatory_process.banner_image
97
+ }.merge(params[:participatory_process].to_unsafe_h)
98
+ end
91
99
  end
92
100
  end
93
101
  end
@@ -14,6 +14,7 @@ module Decidim
14
14
  validates :name, translatable_presence: true
15
15
 
16
16
  attribute :settings, Object
17
+ attribute :default_step_settings, Object
17
18
  attribute :manifest
18
19
  attribute :weight, Integer, default: 0
19
20
 
@@ -23,12 +24,17 @@ module Decidim
23
24
  def map_model(model)
24
25
  self.attributes = model.attributes
25
26
  self.settings = model.settings
27
+ self.default_step_settings = model.default_step_settings
26
28
  end
27
29
 
28
30
  def settings?
29
31
  settings.manifest.attributes.any?
30
32
  end
31
33
 
34
+ def default_step_settings?
35
+ default_step_settings.manifest.attributes.any?
36
+ end
37
+
32
38
  def step_settings?
33
39
  return false unless participatory_process.steps.any?
34
40
 
@@ -19,11 +19,16 @@ module Decidim
19
19
  attribute :github_handler, String
20
20
  attribute :default_locale, String
21
21
  attribute :homepage_image
22
+ attribute :remove_homepage_image
22
23
  attribute :logo
24
+ attribute :remove_logo
23
25
  attribute :favicon
26
+ attribute :remove_favicon
24
27
  attribute :official_url
25
28
  attribute :official_img_header
29
+ attribute :remove_official_img_header
26
30
  attribute :official_img_footer
31
+ attribute :remove_official_img_footer
27
32
  attribute :show_statistics
28
33
 
29
34
  translatable_attribute :description, String
@@ -10,12 +10,11 @@ module Decidim
10
10
 
11
11
  translatable_attribute :title, String
12
12
 
13
+ mimic :participatory_process
14
+
13
15
  attribute :slug, String
14
16
  attribute :copy_steps, Boolean
15
17
  attribute :copy_categories, Boolean
16
- attribute :copy_process_users, Boolean
17
- attribute :copy_moderations, Boolean
18
- attribute :copy_pages, Boolean
19
18
  attribute :copy_features, Boolean
20
19
 
21
20
  validates :slug, presence: true
@@ -27,7 +27,9 @@ module Decidim
27
27
  attribute :promoted, Boolean
28
28
  attribute :scope_id, Integer
29
29
  attribute :hero_image
30
+ attribute :remove_hero_image
30
31
  attribute :banner_image
32
+ attribute :remove_banner_image
31
33
  attribute :participatory_process_group_id, Integer
32
34
 
33
35
  validates :slug, presence: true
@@ -14,10 +14,16 @@ module Decidim
14
14
 
15
15
  validates :slug, presence: true
16
16
  validates :title, :content, translatable_presence: true
17
+ validates :slug, format: { with: /\A[a-z0-9-]+/ }
18
+
17
19
  validate :slug, :slug_uniqueness
18
20
 
19
21
  alias organization current_organization
20
22
 
23
+ def slug
24
+ super.to_s.downcase
25
+ end
26
+
21
27
  private
22
28
 
23
29
  def slug_uniqueness
@@ -6,7 +6,7 @@ module Decidim
6
6
  module MenuHelper
7
7
  # Public: Returns the main menu presenter object
8
8
  def main_menu
9
- @main_menu ||= MenuPresenter.new(
9
+ @main_menu ||= ::Decidim::MenuPresenter.new(
10
10
  :admin_menu,
11
11
  self,
12
12
  active_class: "is-active"
@@ -8,10 +8,12 @@ module Decidim
8
8
  queue_as :newsletter
9
9
 
10
10
  def perform(newsletter)
11
- newsletter.with_lock do
12
- raise "Newsletter already sent" if newsletter.sent?
11
+ @newsletter = newsletter
13
12
 
14
- newsletter.update_attributes!(
13
+ @newsletter.with_lock do
14
+ raise "Newsletter already sent" if @newsletter.sent?
15
+
16
+ @newsletter.update_attributes!(
15
17
  sent_at: Time.current,
16
18
  total_recipients: recipients.count,
17
19
  total_deliveries: 0
@@ -19,14 +21,16 @@ module Decidim
19
21
  end
20
22
 
21
23
  recipients.find_each do |user|
22
- NewsletterDeliveryJob.perform_later(user, newsletter)
24
+ NewsletterDeliveryJob.perform_later(user, @newsletter)
23
25
  end
24
26
  end
25
27
 
26
28
  private
27
29
 
28
30
  def recipients
29
- @recipients ||= User.where(newsletter_notifications: true).where.not(email: nil, confirmed_at: nil)
31
+ @recipients ||= User.where(newsletter_notifications: true, organization: @newsletter.organization)
32
+ .where.not(email: nil, confirmed_at: nil)
33
+ .not_deleted
30
34
  end
31
35
  end
32
36
  end
@@ -15,18 +15,7 @@
15
15
  </div>
16
16
 
17
17
  <div class="row column">
18
- <%= form.file_field :file %>
18
+ <%= form.upload :file, optional: false %>
19
19
  </div>
20
-
21
- <% if @attachment && @attachment.file.present? %>
22
- <div class="row column">
23
- <label><%= t('.current_file') %></label>
24
- <% if @attachment.photo? %>
25
- <%= image_tag form.object.file.url(:thumbnail) %>
26
- <% end %>
27
- <label><%= t('.url') %></label>
28
- <%= link_to @attachment.file.url, @attachment.file.url, target: "_blank" %>
29
- </div>
30
- <% end %>
31
20
  </div>
32
21
  </div>
@@ -1,6 +1,6 @@
1
1
  <tr class="feature-<%= feature.id %>">
2
2
  <td>
3
- <%= link_to decidim.feature_path(participatory_process, feature), target: "_blank" do %>
3
+ <%= link_to feature_path(feature), target: "_blank" do %>
4
4
  <%= translated_attribute feature.name %>
5
5
  <% end %>
6
6
  </td>
@@ -9,7 +9,7 @@
9
9
  </td>
10
10
  <td class="table-list__actions">
11
11
  <% if feature.manifest.admin_engine %>
12
- <%= icon_link_to "pencil", manage_feature_path(participatory_process, feature), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
12
+ <%= icon_link_to "pencil", manage_feature_path(feature), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
13
13
  <% end %>
14
14
 
15
15
  <% if can?(:update, feature) %>
@@ -55,6 +55,24 @@
55
55
  </div>
56
56
  </div>
57
57
  </fieldset>
58
+ <% elsif form.object.default_step_settings? %>
59
+ <fieldset class="default-step-settings">
60
+ <div class="card">
61
+ <div class="card-divider">
62
+ <legend><%= t ".default_step_settings" %></legend>
63
+ </div>
64
+ <div class="card-section">
65
+ <%= form.fields_for :default_step_settings, form.object.default_step_settings do |settings_fields| %>
66
+ <%= render partial: "decidim/admin/features/settings_fields",
67
+ locals: {
68
+ form: settings_fields,
69
+ feature: @feature,
70
+ settings_name: "step"
71
+ } %>
72
+ <% end %>
73
+ </div>
74
+ </div>
75
+ </fieldset>
58
76
  <% end %>
59
77
  </div>
60
78
  </div>
@@ -1,11 +1,11 @@
1
1
  <% if report.details.blank? %>
2
- <%= report.reason %>
2
+ <%= t(".reasons.#{report.reason}") %>
3
3
  <% else %>
4
4
  <span
5
5
  data-tooltip
6
6
  aria-haspopup="true"
7
7
  class="has-tip"
8
8
  title="<%= report.details %>">
9
- <%= report.reason %>
9
+ <%= t(".reasons.#{report.reason}") %>
10
10
  </span>
11
11
  <% end %>
@@ -42,55 +42,25 @@
42
42
 
43
43
  <div class="row">
44
44
  <div class="columns xlarge-4">
45
- <%= form.file_field :homepage_image %>
46
- <% if current_organization.homepage_image.present? %>
47
- <label><%= t('.current_image') %></label>
48
- <%= image_tag current_organization.homepage_image.big.url %>
49
- <label><%= t('.url') %></label>
50
- <%= link_to current_organization.homepage_image.file.filename, current_organization.homepage_image.url, target: "_blank" %>
51
- <% end %>
45
+ <%= form.upload :homepage_image %>
52
46
  </div>
53
47
 
54
48
  <div class="columns xlarge-4">
55
- <%= form.file_field :logo %>
56
- <% if current_organization.logo.present? %>
57
- <label><%= t('.current_image') %></label>
58
- <%= image_tag current_organization.logo.medium.url %>
59
- <label><%= t('.url') %></label>
60
- <%= link_to current_organization.logo.file.filename, current_organization.logo.url, target: "_blank" %>
61
- <% end %>
49
+ <%= form.upload :logo %>
62
50
  </div>
63
51
 
64
52
  <div class="columns xlarge-4">
65
- <%= form.file_field :favicon %>
66
- <% if current_organization.favicon.present? %>
67
- <label><%= t('.current_image') %></label>
68
- <%= image_tag current_organization.favicon.big.url %>
69
- <label><%= t('.url') %></label>
70
- <%= link_to current_organization.favicon.file.filename, current_organization.favicon.url, target: "_blank" %>
71
- <% end %>
53
+ <%= form.upload :favicon %>
72
54
  </div>
73
55
  </div>
74
56
 
75
57
  <div class="row">
76
58
  <div class="columns xlarge-6">
77
- <%= form.file_field :official_img_header %>
78
- <% if current_organization.official_img_header.present? %>
79
- <label><%= t('.current_image') %></label>
80
- <%= image_tag current_organization.official_img_header.url %>
81
- <label><%= t('.url') %></label>
82
- <%= link_to current_organization.official_img_header.file.filename, current_organization.official_img_header.url, target: "_blank" %>
83
- <% end %>
59
+ <%= form.upload :official_img_header %>
84
60
  </div>
85
61
 
86
62
  <div class="columns xlarge-6">
87
- <%= form.file_field :official_img_footer %>
88
- <% if current_organization.official_img_footer.present? %>
89
- <label><%= t('.current_image') %></label>
90
- <%= image_tag current_organization.official_img_footer.url %>
91
- <label><%= t('.url') %></label>
92
- <%= link_to current_organization.official_img_footer.file.filename, current_organization.official_img_footer.url, target: "_blank" %>
93
- <% end %>
63
+ <%= form.upload :official_img_footer %>
94
64
  </div>
95
65
  </div>
96
66