decidim-core 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim.js.es6 +2 -0
- data/app/assets/javascripts/decidim/account_form.js.es6 +27 -0
- data/app/assets/javascripts/decidim/editor.js.es6 +9 -2
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +1 -1
- data/app/assets/javascripts/decidim/form_filter.component.test.js +2 -2
- data/app/assets/javascripts/decidim/history.js.es6 +7 -4
- data/app/commands/decidim/create_registration.rb +2 -1
- data/app/commands/decidim/destroy_account.rb +47 -0
- data/app/constraints/decidim/current_feature.rb +4 -5
- data/app/controllers/concerns/decidim/needs_participatory_process.rb +6 -1
- data/app/controllers/decidim/account_controller.rb +25 -2
- data/app/controllers/decidim/authorizations_controller.rb +2 -2
- data/app/controllers/decidim/pages_controller.rb +4 -2
- data/app/forms/decidim/delete_account_form.rb +8 -0
- data/app/forms/decidim/registration_form.rb +13 -0
- data/app/helpers/decidim/action_authorization_helper.rb +10 -4
- data/app/helpers/decidim/decidim_form_helper.rb +96 -0
- data/app/helpers/decidim/omniauth_helper.rb +1 -1
- data/app/helpers/decidim/resource_helper.rb +3 -36
- data/app/mailers/decidim/reported_mailer.rb +5 -3
- data/app/models/decidim/attachment.rb +1 -1
- data/app/models/decidim/authorization.rb +1 -1
- data/app/models/decidim/categorization.rb +8 -0
- data/app/models/decidim/category.rb +7 -2
- data/app/models/decidim/feature.rb +3 -5
- data/app/models/decidim/identity.rb +0 -1
- data/app/models/decidim/moderation.rb +0 -2
- data/app/models/decidim/participatory_process.rb +4 -2
- data/app/models/decidim/report.rb +1 -1
- data/app/models/decidim/resource_link.rb +1 -2
- data/app/models/decidim/static_page.rb +1 -2
- data/app/models/decidim/user.rb +16 -3
- data/app/models/decidim/user_group.rb +5 -3
- data/app/presenters/decidim/resource_locator_presenter.rb +48 -0
- data/app/services/decidim/authorization_handler.rb +4 -7
- data/app/services/decidim/resource_search.rb +3 -1
- data/app/uploaders/decidim/avatar_uploader.rb +2 -2
- data/app/uploaders/decidim/image_uploader.rb +1 -1
- data/app/uploaders/decidim/official_image_footer_uploader.rb +1 -5
- data/app/uploaders/decidim/official_image_header_uploader.rb +1 -5
- data/app/uploaders/decidim/organization_logo_uploader.rb +1 -1
- data/app/views/decidim/account/delete.html.erb +30 -0
- data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +2 -2
- data/app/views/decidim/reported_mailer/hide.html.erb +5 -1
- data/app/views/decidim/reported_mailer/report.html.erb +5 -1
- data/app/views/layouts/decidim/user_profile.html.erb +2 -1
- data/config/initializers/devise.rb +9 -9
- data/config/locales/ca.yml +20 -3
- data/config/locales/en.yml +20 -3
- data/config/locales/es.yml +20 -3
- data/config/locales/eu.yml +0 -3
- data/config/locales/fi.yml +0 -2
- data/config/locales/fr.yml +0 -3
- data/config/locales/it.yml +350 -0
- data/config/locales/nl.yml +0 -2
- data/config/routes.rb +5 -1
- data/db/migrate/20160817115213_devise_create_decidim_users.rb +1 -0
- data/db/migrate/20160919104837_create_decidim_organizations.rb +2 -0
- data/db/migrate/20160920140207_devise_invitable_add_to_decidim_users.rb +2 -0
- data/db/migrate/20160920141039_user_belongs_to_organization.rb +2 -0
- data/db/migrate/20160920141151_user_has_roles.rb +2 -0
- data/db/migrate/20161005130108_add_participatory_processes.rb +4 -2
- data/db/migrate/20161005153007_add_description_to_organizations.rb +2 -0
- data/db/migrate/20161006085629_add_confirmable_to_devise.rb +2 -0
- data/db/migrate/20161010085443_add_name_to_users.rb +2 -0
- data/db/migrate/20161010102356_translate_processes.rb +2 -0
- data/db/migrate/20161010131544_add_locale_to_users.rb +2 -0
- data/db/migrate/20161011125616_add_hero_image_to_processes.rb +2 -0
- data/db/migrate/20161011141033_add_banner_image_to_processes.rb +2 -0
- data/db/migrate/20161013134732_add_promoted_flag_to_processes.rb +2 -0
- data/db/migrate/20161017085822_add_participatory_process_steps.rb +4 -2
- data/db/migrate/20161018091013_create_decidim_authorizations.rb +2 -0
- data/db/migrate/20161019072016_add_active_flag_to_step.rb +7 -1
- data/db/migrate/20161020080756_add_position_to_steps.rb +2 -0
- data/db/migrate/20161025125300_add_published_at_to_processes.rb +2 -0
- data/db/migrate/20161107152228_remove_not_null_on_step_position.rb +2 -0
- data/db/migrate/20161108093802_create_decidim_static_pages.rb +2 -0
- data/db/migrate/20161110092735_add_index_for_process_slug_organization.rb +5 -3
- data/db/migrate/20161110105712_create_decidim_features.rb +2 -0
- data/db/migrate/20161116115156_create_attachments.rb +4 -2
- data/db/migrate/20161123085134_add_categories.rb +2 -0
- data/db/migrate/20161130105257_create_decidim_scopes.rb +2 -0
- data/db/migrate/20161209134715_make_organization_description_optional.rb +2 -0
- data/db/migrate/20161213094244_add_avatar_to_users.rb +2 -0
- data/db/migrate/20161214152811_add_logo_to_organizations.rb +2 -0
- data/db/migrate/20170110133113_add_configuration_to_features.rb +2 -0
- data/db/migrate/20170110153807_add_handler_to_organization.rb +2 -0
- data/db/migrate/20170113150627_create_resource_links.rb +2 -0
- data/db/migrate/20170116110851_create_identities.rb +2 -0
- data/db/migrate/20170116135237_loosen_step_requirements.rb +2 -0
- data/db/migrate/20170117142904_add_uniqueness_field_to_authorizations.rb +2 -0
- data/db/migrate/20170119145359_create_user_groups.rb +2 -0
- data/db/migrate/20170119150255_create_user_group_memberships.rb +2 -0
- data/db/migrate/20170119150649_add_show_statistics_to_organization.rb +3 -1
- data/db/migrate/20170120120733_add_user_groups_verified.rb +2 -0
- data/db/migrate/20170123134023_make_attachments_polymorphic.rb +2 -0
- data/db/migrate/20170123140857_add_avatar_to_user_groups.rb +2 -0
- data/db/migrate/20170125135937_rename_attachable_to_attached_to.rb +3 -1
- data/db/migrate/20170125152026_add_weight_to_features.rb +2 -0
- data/db/migrate/20170126151123_add_extra_info_to_processes.rb +6 -4
- data/db/migrate/20170128140553_add_timestamps_to_identities.rb +2 -0
- data/db/migrate/20170130132833_add_favicon_to_decidim_organizations.rb +2 -0
- data/db/migrate/20170131134349_add_action_permissions_to_decidim_features.rb +2 -0
- data/db/migrate/20170202084913_add_comments_and_replies_notifications_to_users.rb +2 -0
- data/db/migrate/20170203150545_add_newsletter_notifications_to_users.rb +2 -0
- data/db/migrate/20170206083118_rename_extra_info_on_processes.rb +2 -0
- data/db/migrate/20170206142116_add_published_at_to_decidim_features.rb +2 -0
- data/db/migrate/20170207091021_add_social_media_handlers_to_organization.rb +2 -0
- data/db/migrate/20170207093048_add_organization_logo_and_url.rb +3 -1
- data/db/migrate/20170213081133_create_decidim_newsletters.rb +2 -0
- data/db/migrate/20170215115407_add_organization_custom_reference.rb +2 -0
- data/db/migrate/20170220110740_remove_steps_short_description.rb +2 -0
- data/db/migrate/20170221094835_add_scopes_to_processes.rb +2 -0
- data/db/migrate/20170228142440_add_participatory_process_groups.rb +2 -0
- data/db/migrate/20170306144354_add_secondary_hosts_to_organizations.rb +2 -0
- data/db/migrate/20170307084957_create_reports.rb +2 -0
- data/db/migrate/20170308091316_create_moderations.rb +2 -0
- data/db/migrate/20170313095436_add_available_authorizations_to_organization.rb +2 -0
- data/db/migrate/20170404132616_change_steps_end_and_start_date_to_date.rb +2 -0
- data/db/migrate/20170405091801_change_decidim_user_email_index_uniqueness.rb +2 -0
- data/db/migrate/20170405094028_add_organization_to_identities.rb +2 -0
- data/db/migrate/20170405094258_change_decidim_identities_provider_uid_index_uniqueness.rb +3 -1
- data/db/migrate/20170529150743_add_rejected_at_to_user_groups.rb +2 -0
- data/db/migrate/20170605140421_add_deleted_fields_to_users.rb +8 -0
- data/db/migrate/20170606102659_set_email_unique_in_organization_conditional.rb +8 -0
- data/db/migrate/20170608142521_add_organization_to_user_groups.rb +14 -0
- data/db/migrate/20170612070905_add_uniqueness_to_name_and_document_number_to_user_groups.rb +8 -0
- data/db/migrate/20170612100253_create_decidim_categorizations.rb +12 -0
- data/db/seeds.rb +10 -8
- data/lib/decidim/authorable.rb +2 -2
- data/lib/decidim/core.rb +1 -1
- data/lib/decidim/core/api/author_interface.rb +6 -0
- data/lib/decidim/core/api/user_group_type.rb +14 -0
- data/lib/decidim/core/api/user_type.rb +10 -0
- data/lib/decidim/core/engine.rb +1 -1
- data/lib/decidim/core/test/factories.rb +12 -0
- data/lib/decidim/core/test/shared_examples/manage_moderations_examples.rb +3 -3
- data/lib/decidim/core/version.rb +2 -2
- data/lib/decidim/feature_manifest.rb +2 -3
- data/lib/decidim/form_builder.rb +3 -2
- data/lib/decidim/has_category.rb +3 -1
- data/lib/decidim/has_scope.rb +5 -2
- data/lib/decidim/query_extensions.rb +2 -2
- data/lib/decidim/reportable.rb +3 -3
- data/lib/decidim/stats_registry.rb +2 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fr.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.it.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.nl.js +14 -0
- metadata +45 -17
- data/app/models/decidim/component.rb +0 -52
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class AddOrganizationLogoAndUrl < ActiveRecord::Migration[5.0]
|
2
|
-
|
4
|
+
def change
|
3
5
|
add_column :decidim_organizations, :official_img_header, :string
|
4
6
|
add_column :decidim_organizations, :official_img_footer, :string
|
5
7
|
add_column :decidim_organizations, :official_url, :string
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ChangeDecidimIdentitiesProviderUidIndexUniqueness < ActiveRecord::Migration[5.0]
|
2
4
|
def change
|
3
5
|
remove_index :decidim_identities, [:provider, :uid]
|
4
6
|
add_index :decidim_identities, [:provider, :uid, :decidim_organization_id], unique: true,
|
5
|
-
|
7
|
+
name: "decidim_identities_provider_uid_organization_unique"
|
6
8
|
|
7
9
|
Decidim::Identity.includes(:user).find_each do |identity|
|
8
10
|
identity.organization = identity.user.organization
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SetEmailUniqueInOrganizationConditional < ActiveRecord::Migration[5.0]
|
4
|
+
def change
|
5
|
+
remove_index :decidim_users, %w(email decidim_organization_id)
|
6
|
+
add_index :decidim_users, %w(email decidim_organization_id), where: "(deleted_at IS NULL)", name: "index_decidim_users_on_email_and_decidim_organization_id", unique: true
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddOrganizationToUserGroups < ActiveRecord::Migration[5.0]
|
4
|
+
def change
|
5
|
+
add_column :decidim_user_groups, :decidim_organization_id, :integer
|
6
|
+
|
7
|
+
Decidim::UserGroup.includes(:users).find_each do |user_group|
|
8
|
+
user_group.organization = user_group.users.first.organization
|
9
|
+
user_group.save!
|
10
|
+
end
|
11
|
+
|
12
|
+
change_column :decidim_user_groups, :decidim_organization_id, :integer, null: false
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddUniquenessToNameAndDocumentNumberToUserGroups < ActiveRecord::Migration[5.0]
|
4
|
+
def change
|
5
|
+
add_index :decidim_user_groups, [:decidim_organization_id, :name], unique: true, name: "index_decidim_user_groups_names_on_organization_id"
|
6
|
+
add_index :decidim_user_groups, [:decidim_organization_id, :document_number], unique: true, name: "index_decidim_user_groups_document_number_on_organization_id"
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimCategorizations < ActiveRecord::Migration[5.1]
|
4
|
+
def change
|
5
|
+
create_table :decidim_categorizations do |t|
|
6
|
+
t.references :decidim_category, foreign_key: true, null: false
|
7
|
+
t.references :categorizable, polymorphic: true, null: false, index: { name: "decidim_categorizations_categorizable_id_and_type" }
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/db/seeds.rb
CHANGED
@@ -15,7 +15,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
15
15
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
16
16
|
Decidim::Faker::Localized.sentence(15)
|
17
17
|
end,
|
18
|
-
homepage_image: File.new(File.join(
|
18
|
+
homepage_image: File.new(File.join(__dir__, "seeds", "homepage_image.jpg")),
|
19
19
|
default_locale: I18n.default_locale,
|
20
20
|
available_locales: Decidim.available_locales,
|
21
21
|
reference_prefix: Faker::Name.suffix
|
@@ -75,7 +75,8 @@ if !Rails.env.production? || ENV["SEED"]
|
|
75
75
|
name: Faker::Company.name,
|
76
76
|
document_number: Faker::Number.number(10),
|
77
77
|
phone: Faker::PhoneNumber.phone_number,
|
78
|
-
verified_at: Time.current
|
78
|
+
verified_at: Time.current,
|
79
|
+
decidim_organization_id: user.organization.id
|
79
80
|
)
|
80
81
|
|
81
82
|
Decidim::UserGroupMembership.create!(
|
@@ -86,7 +87,8 @@ if !Rails.env.production? || ENV["SEED"]
|
|
86
87
|
user_group = Decidim::UserGroup.create!(
|
87
88
|
name: Faker::Company.name,
|
88
89
|
document_number: Faker::Number.number(10),
|
89
|
-
phone: Faker::PhoneNumber.phone_number
|
90
|
+
phone: Faker::PhoneNumber.phone_number,
|
91
|
+
decidim_organization_id: user.organization.id
|
90
92
|
)
|
91
93
|
|
92
94
|
Decidim::UserGroupMembership.create!(
|
@@ -103,7 +105,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
103
105
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
104
106
|
Decidim::Faker::Localized.paragraph(3)
|
105
107
|
end,
|
106
|
-
hero_image: File.new(File.join(
|
108
|
+
hero_image: File.new(File.join(__dir__, "seeds", "city.jpeg")),
|
107
109
|
organization: organization
|
108
110
|
)
|
109
111
|
end
|
@@ -120,8 +122,8 @@ if !Rails.env.production? || ENV["SEED"]
|
|
120
122
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
121
123
|
Decidim::Faker::Localized.paragraph(3)
|
122
124
|
end,
|
123
|
-
hero_image: File.new(File.join(
|
124
|
-
banner_image: File.new(File.join(
|
125
|
+
hero_image: File.new(File.join(__dir__, "seeds", "city.jpeg")),
|
126
|
+
banner_image: File.new(File.join(__dir__, "seeds", "city2.jpeg")),
|
125
127
|
promoted: true,
|
126
128
|
published_at: 2.weeks.ago,
|
127
129
|
organization: organization,
|
@@ -153,13 +155,13 @@ if !Rails.env.production? || ENV["SEED"]
|
|
153
155
|
Decidim::Attachment.create!(
|
154
156
|
title: Decidim::Faker::Localized.sentence(2),
|
155
157
|
description: Decidim::Faker::Localized.sentence(5),
|
156
|
-
file: File.new(File.join(
|
158
|
+
file: File.new(File.join(__dir__, "seeds", "city.jpeg")),
|
157
159
|
attached_to: process
|
158
160
|
)
|
159
161
|
Decidim::Attachment.create!(
|
160
162
|
title: Decidim::Faker::Localized.sentence(2),
|
161
163
|
description: Decidim::Faker::Localized.sentence(5),
|
162
|
-
file: File.new(File.join(
|
164
|
+
file: File.new(File.join(__dir__, "seeds", "Exampledocument.pdf")),
|
163
165
|
attached_to: process
|
164
166
|
)
|
165
167
|
2.times do
|
data/lib/decidim/authorable.rb
CHANGED
@@ -6,8 +6,8 @@ module Decidim
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
included do
|
9
|
-
belongs_to :author, foreign_key: "decidim_author_id", class_name: "Decidim::User"
|
10
|
-
belongs_to :user_group, foreign_key: "decidim_user_group_id", class_name: "Decidim::UserGroup"
|
9
|
+
belongs_to :author, foreign_key: "decidim_author_id", class_name: "Decidim::User", optional: true
|
10
|
+
belongs_to :user_group, foreign_key: "decidim_user_group_id", class_name: "Decidim::UserGroup", optional: true
|
11
11
|
|
12
12
|
validate :verified_user_group, :user_group_membership
|
13
13
|
validate :author_belongs_to_organization
|
data/lib/decidim/core.rb
CHANGED
@@ -86,7 +86,7 @@ module Decidim
|
|
86
86
|
|
87
87
|
# Exposes a configuration option: The application name String.
|
88
88
|
config_accessor :available_locales do
|
89
|
-
%w(en ca es eu fi fr nl)
|
89
|
+
%w(en ca es eu it fi fr nl)
|
90
90
|
end
|
91
91
|
|
92
92
|
# Exposes a configuration option: an object to configure geocoder
|
@@ -7,6 +7,12 @@ module Decidim
|
|
7
7
|
description "An author"
|
8
8
|
|
9
9
|
field :name, !types.String, "The author's name"
|
10
|
+
|
10
11
|
field :avatarUrl, !types.String, "The author's avatar url"
|
12
|
+
|
13
|
+
field :isVerified, !types.Boolean, "Whether the author is verified or not"
|
14
|
+
|
15
|
+
field :deleted, !types.Boolean, "Whether the author's account has been deleted or not"
|
16
|
+
field :isUser, !types.Boolean, "Whether the author is a user or another kind of author (User Group)"
|
11
17
|
end
|
12
18
|
end
|
@@ -17,5 +17,19 @@ module Decidim
|
|
17
17
|
field :avatarUrl, !types.String, "The user's avatar url" do
|
18
18
|
resolve ->(obj, _args, _ctx) { obj.avatar.url }
|
19
19
|
end
|
20
|
+
|
21
|
+
field :isVerified, !types.Boolean, "Whether the user group is verified or not" do
|
22
|
+
resolve lambda { |obj, _args, _ctx|
|
23
|
+
obj.verified?
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
field :deleted, !types.Boolean, "Whether the user group's has been deleted or not" do
|
28
|
+
resolve ->(_obj, _args, _ctx) { false }
|
29
|
+
end
|
30
|
+
|
31
|
+
field :isUser, !types.Boolean, "User groups are not users" do
|
32
|
+
resolve ->(_obj, _args, _ctx) { false }
|
33
|
+
end
|
20
34
|
end
|
21
35
|
end
|
@@ -19,5 +19,15 @@ module Decidim
|
|
19
19
|
field :organizationName, !types.String, "The user's organization name" do
|
20
20
|
resolve ->(obj, _args, _ctx) { obj.organization.name }
|
21
21
|
end
|
22
|
+
|
23
|
+
field :isVerified, !types.Boolean, "Whether the author is verified or not" do
|
24
|
+
resolve ->(_obj, _args, _ctx) { false }
|
25
|
+
end
|
26
|
+
|
27
|
+
field :deleted, !types.Boolean, "Whether the user's account has been deleted or not", property: :deleted?
|
28
|
+
|
29
|
+
field :isUser, !types.Boolean, "User groups are not users" do
|
30
|
+
resolve ->(_obj, _args, _ctx) { true }
|
31
|
+
end
|
22
32
|
end
|
23
33
|
end
|
data/lib/decidim/core/engine.rb
CHANGED
@@ -77,7 +77,7 @@ module Decidim
|
|
77
77
|
app.config.exceptions_app = Decidim::Core::Engine.routes
|
78
78
|
end
|
79
79
|
|
80
|
-
initializer "
|
80
|
+
initializer "decidim.inject_abilities_to_user" do |_app|
|
81
81
|
Decidim.configure do |config|
|
82
82
|
config.abilities << "Decidim::Abilities::Everyone"
|
83
83
|
end
|
@@ -145,6 +145,16 @@ FactoryGirl.define do
|
|
145
145
|
roles ["admin"]
|
146
146
|
end
|
147
147
|
|
148
|
+
trait :process_admin do
|
149
|
+
transient { participatory_process nil }
|
150
|
+
|
151
|
+
after(:create) do |user, evaluator|
|
152
|
+
create :participatory_process_user_role,
|
153
|
+
user: user,
|
154
|
+
participatory_process: evaluator.participatory_process
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
148
158
|
trait :moderator do
|
149
159
|
roles ["moderator"]
|
150
160
|
end
|
@@ -163,6 +173,7 @@ FactoryGirl.define do
|
|
163
173
|
document_number { Faker::Number.number(8) + "X" }
|
164
174
|
phone { Faker::PhoneNumber.phone_number }
|
165
175
|
avatar { test_file("avatar.jpg", "image/jpeg") }
|
176
|
+
organization
|
166
177
|
|
167
178
|
transient do
|
168
179
|
users []
|
@@ -266,6 +277,7 @@ FactoryGirl.define do
|
|
266
277
|
title { generate(:name) }
|
267
278
|
feature { create(:feature, manifest_name: "dummy") }
|
268
279
|
author { create(:user, :confirmed, organization: feature.organization) }
|
280
|
+
category { create(:category, participatory_process: feature.participatory_process) }
|
269
281
|
end
|
270
282
|
|
271
283
|
factory :resource_link, class: Decidim::ResourceLink do
|
@@ -29,7 +29,7 @@ RSpec.shared_examples "manage moderations" do
|
|
29
29
|
|
30
30
|
moderations.each do |moderation|
|
31
31
|
within "tr[data-id=\"#{moderation.id}\"]" do
|
32
|
-
expect(page).to have_content moderation.reportable.
|
32
|
+
expect(page).to have_content moderation.reportable.reported_content_url
|
33
33
|
expect(page).to have_content moderation.reports.first.reason
|
34
34
|
end
|
35
35
|
end
|
@@ -58,7 +58,7 @@ RSpec.shared_examples "manage moderations" do
|
|
58
58
|
expect(page).to have_content("Resource successfully hidden")
|
59
59
|
end
|
60
60
|
|
61
|
-
expect(page).to have_no_content(moderation.reportable.
|
61
|
+
expect(page).to have_no_content(moderation.reportable.reported_content_url)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -68,7 +68,7 @@ RSpec.shared_examples "manage moderations" do
|
|
68
68
|
|
69
69
|
hidden_moderations.each do |moderation|
|
70
70
|
within "tr[data-id=\"#{moderation.id}\"]" do
|
71
|
-
expect(page).to have_content moderation.reportable.
|
71
|
+
expect(page).to have_content moderation.reportable.reported_content_url
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/decidim/core/version.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
# This holds Decidim's version and the Rails version on which it depends.
|
4
4
|
module Decidim
|
5
5
|
def self.version
|
6
|
-
"0.
|
6
|
+
"0.3.0"
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.rails_version
|
10
|
-
["~> 5.
|
10
|
+
["~> 5.1.1"]
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.add_default_gemspec_properties(spec)
|
@@ -64,8 +64,7 @@ module Decidim
|
|
64
64
|
#
|
65
65
|
# event_name - A String or Symbol with the event name.
|
66
66
|
# context - An optional context that will be provided to the block as a
|
67
|
-
# parameter. Usually the subject of the hook
|
68
|
-
# Component.
|
67
|
+
# parameter. Usually the subject of the hook.
|
69
68
|
#
|
70
69
|
# Returns nothing.
|
71
70
|
def run_hooks(event_name, context = nil)
|
@@ -182,7 +181,7 @@ module Decidim
|
|
182
181
|
#
|
183
182
|
# name - The name of the stat
|
184
183
|
# options - A hash of options
|
185
|
-
# * primary:
|
184
|
+
# * primary: Whether the stat is primary or not.
|
186
185
|
# * priority: The priority of the stat used for render issues.
|
187
186
|
# block - A block that receive the features to filter out the stat.
|
188
187
|
#
|
data/lib/decidim/form_builder.rb
CHANGED
@@ -47,7 +47,7 @@ module Decidim
|
|
47
47
|
|
48
48
|
tabs_panels = "".html_safe
|
49
49
|
if options[:label] != false
|
50
|
-
tabs_panels = content_tag(:ul, class: "tabs tabs--lang", id: "#{name}-tabs", data: { tabs: true }) do
|
50
|
+
tabs_panels = content_tag(:ul, class: "tabs tabs--lang", id: "#{@object_name}-#{name}-tabs", data: { tabs: true }) do
|
51
51
|
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
|
52
52
|
string + content_tag(:li, class: tab_element_class_for("title", index)) do
|
53
53
|
title = I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
|
@@ -62,7 +62,7 @@ module Decidim
|
|
62
62
|
safe_join [field_label, tabs_panels]
|
63
63
|
end
|
64
64
|
|
65
|
-
tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: "#{name}-tabs" }) do
|
65
|
+
tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: "#{@object_name}-#{name}-tabs" }) do
|
66
66
|
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
|
67
67
|
string + content_tag(:div, class: tab_element_class_for("panel", index), id: "#{name}-panel-#{index}") do
|
68
68
|
send(type, name_with_locale(name, locale), options.merge(label: false))
|
@@ -243,6 +243,7 @@ module Decidim
|
|
243
243
|
validation_options = {}
|
244
244
|
validation_options[:pattern] = "^(.|[\n\r]){#{min_length},#{max_length}}$" if min_length.to_i.positive? || max_length.to_i.positive?
|
245
245
|
validation_options[:required] = options[:required] || attribute_required?(attribute)
|
246
|
+
validation_options[:maxlength] ||= max_length if max_length.to_i.positive?
|
246
247
|
validation_options
|
247
248
|
end
|
248
249
|
|