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
@@ -9,8 +9,8 @@ require_relative "../decidim-core/lib/decidim/core/version"
9
9
  Gem::Specification.new do |s|
10
10
  Decidim.add_default_gemspec_properties(s)
11
11
 
12
- s.name = "decidim-surveys"
13
- s.summary = "A component for decidim's participatory processes."
12
+ s.name = "decidim-surveys"
13
+ s.summary = "A component for decidim's participatory processes."
14
14
  s.description = s.summary
15
15
 
16
16
  s.files = Dir["{app,config,db,lib}/**/*", "Rakefile", "README.md"]
@@ -53,7 +53,7 @@ Decidim.register_feature(:surveys) do |feature|
53
53
  end
54
54
 
55
55
  feature.seeds do
56
- Decidim::ParticipatoryProcess.all.each do |process|
56
+ Decidim::ParticipatoryProcess.find_each do |process|
57
57
  next unless process.steps.any?
58
58
 
59
59
  feature = Decidim::Feature.create!(
@@ -77,7 +77,8 @@ Decidim.register_feature(:surveys) do |feature|
77
77
  3.times do
78
78
  Decidim::Surveys::SurveyQuestion.create!(
79
79
  survey: survey,
80
- body: Decidim::Faker::Localized.paragraph
80
+ body: Decidim::Faker::Localized.paragraph,
81
+ question_type: "short_answer"
81
82
  )
82
83
  end
83
84
  end
@@ -9,7 +9,7 @@ module Decidim
9
9
  let!(:survey) { create(:survey) }
10
10
  let!(:position) { 0 }
11
11
  let!(:question_type) { SurveyQuestion::TYPES.first }
12
- let!(:survey_question) { create(:survey_question, survey: survey, position: position, question_type: question_type) }
12
+ let!(:survey_question) { build(:survey_question, survey: survey, position: position, question_type: question_type) }
13
13
 
14
14
  subject do
15
15
  described_class.from_model(survey_question).with_context(current_feature: survey.feature)
@@ -6,7 +6,8 @@ module Decidim
6
6
  module Surveys
7
7
  describe SurveyQuestion do
8
8
  let(:survey) { create(:survey) }
9
- let(:survey_question) { create(:survey_question, survey: survey) }
9
+ let(:question_type) { "short_answer" }
10
+ let(:survey_question) { build(:survey_question, survey: survey, question_type: question_type) }
10
11
  subject { survey_question }
11
12
 
12
13
  it { is_expected.to be_valid }
@@ -14,6 +15,11 @@ module Decidim
14
15
  it "has an association of survey" do
15
16
  expect(subject.survey).to eq(survey)
16
17
  end
18
+
19
+ context "when question type doesn't exists in allowed types" do
20
+ let(:question_type) { "foo" }
21
+ it { is_expected.not_to be_valid }
22
+ end
17
23
  end
18
24
  end
19
25
  end
@@ -1,4 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/dev"
4
+
3
5
  ENV["ENGINE_NAME"] = File.dirname(__dir__).split("/").last
6
+
7
+ Decidim::Dev.dummy_app_path = File.expand_path(File.join("..", "spec", "decidim_dummy_app"))
8
+
4
9
  require "decidim/dev/test/base_spec_helper"
@@ -6,12 +6,12 @@ module Decidim
6
6
  class ApplicationController < ActionController::Base
7
7
  include FormFactory
8
8
  include PayloadInfo
9
+
9
10
  protect_from_forgery with: :exception, prepend: true
10
11
 
11
12
  helper Decidim::TranslationsHelper
12
13
  helper Decidim::DecidimFormHelper
13
14
  helper Decidim::ReplaceButtonsHelper
14
-
15
15
  helper Decidim::System::MenuHelper
16
16
  end
17
17
  end
@@ -7,6 +7,7 @@ module Decidim
7
7
  # and views.
8
8
  class SessionsController < ::Devise::SessionsController
9
9
  helper Decidim::DecidimFormHelper
10
+
10
11
  layout "decidim/system/login"
11
12
  end
12
13
  end
@@ -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(:system_menu, self)
9
+ @main_menu ||= ::Decidim::MenuPresenter.new(:system_menu, self)
10
10
  end
11
11
  end
12
12
  end
@@ -0,0 +1,11 @@
1
+ <%= display_flash_messages %>
2
+
3
+ <% if Decidim::Organization.none? %>
4
+ <div class="flash callout warning">
5
+ <% guide = link_to t(".our_getting_started_guide"),
6
+ "https://github.com/decidim/decidim/blob/master/docs/getting_started.md",
7
+ target: :blank %>
8
+
9
+ <%= t(".no_organization_warning_html", guide: guide) %>
10
+ </div>
11
+ <% end %>
@@ -29,7 +29,7 @@
29
29
  </section>
30
30
  <% end %>
31
31
 
32
- <%= display_flash_messages %>
32
+ <%= render "decidim/system/shared/notices" %>
33
33
  <%= yield %>
34
34
  </div>
35
35
  </div>
@@ -9,7 +9,7 @@
9
9
  <div class="login-form-wrapper">
10
10
  <div class="login-form">
11
11
  <h1>Decidim</h1>
12
- <%= display_flash_messages %>
12
+ <%= render "decidim/system/shared/notices" %>
13
13
  <div class="login-form-inner">
14
14
  <%= yield %>
15
15
  </div>
@@ -8,8 +8,8 @@ ENGINE_ROOT = File.expand_path("..", __dir__)
8
8
  ENGINE_PATH = File.expand_path("../lib/decidim/system/engine", __dir__)
9
9
 
10
10
  # Set up gems listed in the Gemfile.
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
- require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__)
12
+ require "bundler/setup"
13
13
 
14
14
  require "rails/all"
15
15
  require "rails/engine/commands"
@@ -64,5 +64,9 @@ ca:
64
64
  update:
65
65
  error: S'ha produït un error en actualitzar aquesta organització.
66
66
  success: L'organització s'ha actualitzat correctament.
67
+ shared:
68
+ notices:
69
+ no_organization_warning_html: Has de crear una organització per començar. Assegura't de llegir %{guide} abans.
70
+ our_getting_started_guide: la guia d'introducció
67
71
  titles:
68
72
  dashboard: Tauler de control
@@ -65,5 +65,9 @@ en:
65
65
  update:
66
66
  error: There was an error when updating this organization.
67
67
  success: Organization updated successfully.
68
+ shared:
69
+ notices:
70
+ no_organization_warning_html: You must create an organization to get started. Make sure you read %{guide} before proceeding.
71
+ our_getting_started_guide: our getting started guide
68
72
  titles:
69
73
  dashboard: Dashboard
@@ -64,5 +64,9 @@ es:
64
64
  update:
65
65
  error: Se ha producido un error al actualizar esta organización.
66
66
  success: Organización actualizada correctamente.
67
+ shared:
68
+ notices:
69
+ no_organization_warning_html: Debes crear una organización para comenzar. Asegúrate de leer %{guide} antes de continuar.
70
+ our_getting_started_guide: nuestra guía de inicio
67
71
  titles:
68
72
  dashboard: Panel de control
@@ -4,25 +4,25 @@ class DeviseCreateDecidimAdmins < ActiveRecord::Migration[5.0]
4
4
  def change
5
5
  create_table :decidim_system_admins do |t|
6
6
  ## Database authenticatable
7
- t.string :email, null: false, default: ""
7
+ t.string :email, null: false, default: ""
8
8
  t.string :encrypted_password, null: false, default: ""
9
9
 
10
10
  ## Recoverable
11
- t.string :reset_password_token
11
+ t.string :reset_password_token
12
12
  t.datetime :reset_password_sent_at
13
13
 
14
14
  ## Rememberable
15
15
  t.datetime :remember_created_at
16
16
 
17
17
  ## Lockable
18
- t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
19
- t.string :unlock_token # Only if unlock strategy is :email or :both
18
+ t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
19
+ t.string :unlock_token # Only if unlock strategy is :email or :both
20
20
  t.datetime :locked_at
21
21
 
22
22
  t.timestamps null: false
23
23
  end
24
24
 
25
- add_index :decidim_system_admins, :email, unique: true
25
+ add_index :decidim_system_admins, :email, unique: true
26
26
  add_index :decidim_system_admins, :reset_password_token, unique: true
27
27
  end
28
28
  end
@@ -7,7 +7,7 @@ if !Rails.env.production? || ENV["SEED"]
7
7
  password_confirmation: "decidim123456"
8
8
  )
9
9
 
10
- Decidim::Organization.all.each do |organization|
10
+ Decidim::Organization.find_each do |organization|
11
11
  Decidim::System::CreateDefaultPages.call(organization)
12
12
  end
13
13
  end
@@ -9,8 +9,8 @@ require_relative "../decidim-core/lib/decidim/core/version"
9
9
  Gem::Specification.new do |s|
10
10
  Decidim.add_default_gemspec_properties(s)
11
11
 
12
- s.name = "decidim-system"
13
- s.summary = "System administration"
12
+ s.name = "decidim-system"
13
+ s.summary = "System administration"
14
14
  s.description = "System administration to create new organization in an installation."
15
15
 
16
16
  s.files = Dir["{app,config,db,lib,vendor}/**/*", "Rakefile", "README.md"]
@@ -4,8 +4,8 @@ require "decidim/core/test/factories"
4
4
 
5
5
  FactoryGirl.define do
6
6
  factory :admin, class: Decidim::System::Admin do
7
- sequence(:email) { |n| "admin#{n}@citizen.corp" }
8
- password "password1234"
7
+ sequence(:email) { |n| "admin#{n}@citizen.corp" }
8
+ password "password1234"
9
9
  password_confirmation "password1234"
10
10
  end
11
11
  end
@@ -22,7 +22,7 @@ describe "Manage admins", type: :feature do
22
22
  find("*[type=submit]").click
23
23
  end
24
24
 
25
- within ".flash" do
25
+ within ".success.flash" do
26
26
  expect(page).to have_content("successfully")
27
27
  end
28
28
 
@@ -42,7 +42,7 @@ describe "Manage admins", type: :feature do
42
42
  find("*[type=submit]").click
43
43
  end
44
44
 
45
- within ".flash" do
45
+ within ".success.flash" do
46
46
  expect(page).to have_content("successfully")
47
47
  end
48
48
 
@@ -56,7 +56,7 @@ describe "Manage admins", type: :feature do
56
56
  click_link "Destroy"
57
57
  end
58
58
 
59
- within ".flash" do
59
+ within ".success.flash" do
60
60
  expect(page).to have_content("successfully")
61
61
  end
62
62
 
@@ -1,7 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/dev"
4
+
3
5
  ENV["ENGINE_NAME"] = File.dirname(__dir__).split("/").last
4
6
 
7
+ Decidim::Dev.dummy_app_path = File.expand_path(File.join("..", "spec", "decidim_dummy_app"))
8
+
5
9
  require "decidim/dev/test/base_spec_helper"
6
10
 
7
11
  Dir["#{__dir__}/support/**/*.rb"].each { |f| require f }
data/decidim.gemspec CHANGED
@@ -9,14 +9,14 @@ require_relative "decidim-core/lib/decidim/core/version"
9
9
  Gem::Specification.new do |spec|
10
10
  Decidim.add_default_gemspec_properties(spec)
11
11
 
12
- spec.name = "decidim"
12
+ spec.name = "decidim"
13
13
 
14
- spec.summary = "Citizen participation framework for Ruby on Rails."
15
- spec.description = "Citizen participation framework for Ruby on Rails."
14
+ spec.summary = "Citizen participation framework for Ruby on Rails."
15
+ spec.description = "Citizen participation framework for Ruby on Rails."
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|decidim-core)/}) }
18
- spec.bindir = "bin"
19
- spec.executables = ["decidim"]
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|decidim-core)/}) }
18
+ spec.bindir = "bin"
19
+ spec.executables = ["decidim"]
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_dependency "decidim-core", Decidim.version
@@ -44,8 +44,8 @@
44
44
  ENGINE_PATH = File.expand_path("..lib/decidim/<engine_name>/engine", __dir__)
45
45
 
46
46
  # Set up gems listed in the Gemfile.
47
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
48
- require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
47
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__)
48
+ require "bundler/setup"
49
49
 
50
50
  require "rails/all"
51
51
  require "rails/engine/commands"
@@ -96,7 +96,7 @@ module Decidim
96
96
 
97
97
  def set_locales
98
98
  inject_into_file "config/application.rb", after: "class Application < Rails::Application" do
99
- "\n config.i18n.available_locales = %w(en ca es)\n config.i18n.default_locale = :en"
99
+ "\n config.i18n.available_locales = Decidim.available_locales\n config.i18n.default_locale = Decidim.default_locale"
100
100
  end
101
101
  end
102
102
 
@@ -67,39 +67,47 @@ module Decidim
67
67
  def smtp_environment
68
68
  inject_into_file "config/environments/production.rb",
69
69
  after: "config.log_formatter = ::Logger::Formatter.new" do
70
- %(
71
-
72
- config.action_mailer.smtp_settings = {
73
- :address => Rails.application.secrets.smtp_address,
74
- :port => Rails.application.secrets.smtp_port,
75
- :authentication => Rails.application.secrets.smtp_authentication,
76
- :user_name => Rails.application.secrets.smtp_username,
77
- :password => Rails.application.secrets.smtp_password,
78
- :domain => Rails.application.secrets.smtp_domain,
79
- :enable_starttls_auto => Rails.application.secrets.smtp_starttls_auto,
80
- :openssl_verify_mode => 'none'
81
- }
82
-
83
- if Rails.application.secrets.sendgrid
84
- config.action_mailer.default_options = {
85
- "X-SMTPAPI" => {
86
- filters: {
87
- clicktrack: { settings: { enable: 0 } },
88
- opentrack: { settings: { enable: 0 } }
89
- }
90
- }.to_json
91
- }
92
- end
93
- )
70
+ <<~RUBY.gsub(/^ *\|/, "")
71
+ |
72
+ | config.action_mailer.smtp_settings = {
73
+ | :address => Rails.application.secrets.smtp_address,
74
+ | :port => Rails.application.secrets.smtp_port,
75
+ | :authentication => Rails.application.secrets.smtp_authentication,
76
+ | :user_name => Rails.application.secrets.smtp_username,
77
+ | :password => Rails.application.secrets.smtp_password,
78
+ | :domain => Rails.application.secrets.smtp_domain,
79
+ | :enable_starttls_auto => Rails.application.secrets.smtp_starttls_auto,
80
+ | :openssl_verify_mode => 'none'
81
+ | }
82
+ |
83
+ | if Rails.application.secrets.sendgrid
84
+ | config.action_mailer.default_options = {
85
+ | "X-SMTPAPI" => {
86
+ | filters: {
87
+ | clicktrack: { settings: { enable: 0 } },
88
+ | opentrack: { settings: { enable: 0 } }
89
+ | }
90
+ | }.to_json
91
+ | }
92
+ | end
93
+ RUBY
94
94
  end
95
95
  end
96
96
 
97
97
  def letter_opener_web
98
+ route <<~RUBY.gsub(/^ *\|/, "")
99
+ |
100
+ | if Rails.env.development?
101
+ | mount LetterOpenerWeb::Engine, at: "/letter_opener"
102
+ | end
103
+ RUBY
104
+
98
105
  inject_into_file "config/environments/development.rb",
99
106
  after: "config.action_mailer.raise_delivery_errors = false" do
100
- %(
101
-
102
- config.action_mailer.delivery_method = :letter_opener_web)
107
+ <<~RUBY.gsub(/^ *\|/, "")
108
+ |
109
+ | config.action_mailer.delivery_method = :letter_opener_web
110
+ RUBY
103
111
  end
104
112
  end
105
113
 
@@ -32,6 +32,7 @@ group :development do
32
32
  gem 'listen', '~> 3.1.0'
33
33
  gem 'spring'
34
34
  gem 'spring-watcher-listen', '~> 2.0.0'
35
+ gem 'letter_opener_web', '~> 1.3.0'
35
36
  end
36
37
 
37
38
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
@@ -3,7 +3,7 @@
3
3
 
4
4
  Decidim.configure do |config|
5
5
  config.application_name = "My Application Name"
6
- config.mailer_sender = "change-me@domain.org"
6
+ config.mailer_sender = "change-me@domain.org"
7
7
  config.authorization_handlers = [ExampleAuthorizationHandler]
8
8
 
9
9
  # Uncomment this lines to set your preferred locales
@@ -16,6 +16,12 @@ Decidim.configure do |config|
16
16
  # here_app_code: Rails.application.secrets.geocoder[:here_app_code]
17
17
  # }
18
18
 
19
+ # Custom calculate reference method
20
+ # config.calculate_reference_method = lambda do |resource|
21
+ # # Implement your custom method to generate resources references
22
+ # "1234-#{resource.id}"
23
+ # end
24
+
19
25
  # Currency unit
20
26
  # config.currency_unit = "€"
21
27