decidim-dev 0.19.1 → 0.23.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.
- checksums.yaml +4 -4
- data/app/assets/images/decidim/dummy.svg +1 -4
- data/app/assets/images/decidim/gamification/badges/test.svg +1 -145
- data/app/commands/decidim/dummy_resources/create_dummy_resource.rb +48 -0
- data/app/controllers/decidim/dummy_resources/dummy_resources_controller.rb +1 -0
- data/app/forms/decidim/dummy_resources/dummy_resource_form.rb +3 -0
- data/app/views/decidim/dummy_resources/dummy_resources/show.html.erb +4 -0
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/bg-BG.yml +56 -0
- data/config/locales/bg.yml +56 -0
- data/config/locales/ca.yml +15 -0
- data/config/locales/cs.yml +16 -1
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +16 -0
- data/config/locales/el-GR.yml +1 -0
- data/config/locales/el.yml +56 -0
- data/config/locales/en.yml +15 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +15 -0
- data/config/locales/es-PY.yml +15 -0
- data/config/locales/es.yml +15 -0
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/fi-plain.yml +15 -0
- data/config/locales/fi.yml +15 -0
- data/config/locales/fr-CA.yml +56 -0
- data/config/locales/fr.yml +15 -0
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +11 -2
- data/config/locales/is-IS.yml +21 -0
- data/config/locales/is.yml +21 -0
- data/config/locales/it.yml +17 -2
- data/config/locales/ja-JP.yml +56 -0
- data/config/locales/ja.yml +56 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +54 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +15 -0
- data/config/locales/no.yml +31 -0
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +26 -10
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/pt.yml +26 -10
- data/config/locales/ro-RO.yml +56 -0
- data/config/locales/sk-SK.yml +47 -0
- data/config/locales/sk.yml +47 -0
- data/config/locales/sl.yml +5 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +8 -0
- data/config/locales/sv.yml +15 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +56 -0
- data/config/locales/zh-TW.yml +1 -0
- data/lib/decidim/dev.rb +2 -0
- data/lib/decidim/dev/assets/assemblies.json +816 -0
- data/lib/decidim/dev/assets/assemblies_with_null.json +135 -0
- data/lib/decidim/dev/assets/city.jpeg +0 -0
- data/lib/decidim/dev/assets/city2.jpeg +0 -0
- data/lib/decidim/dev/assets/city3.jpeg +0 -0
- data/lib/decidim/dev/assets/geocoder_result_here.json +72 -0
- data/lib/decidim/dev/assets/geocoder_result_osm.json +150 -0
- data/lib/decidim/dev/assets/import_participatory_space_private_users_nok.csv +2 -0
- data/lib/decidim/dev/assets/participatory_processes.json +434 -0
- data/lib/decidim/dev/assets/participatory_processes_with_null.json +103 -0
- data/lib/decidim/dev/dummy_translator.rb +32 -0
- data/lib/decidim/dev/test/base_spec_helper.rb +14 -0
- data/lib/decidim/dev/test/rspec_support/authorization.rb +3 -0
- data/lib/decidim/dev/test/rspec_support/capybara.rb +6 -2
- data/lib/decidim/dev/test/rspec_support/capybara_data_picker.rb +15 -5
- data/lib/decidim/dev/test/rspec_support/capybara_scopes_picker.rb +5 -5
- data/lib/decidim/dev/test/rspec_support/comments.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/component.rb +104 -5
- data/lib/decidim/dev/test/rspec_support/component_context.rb +1 -2
- data/lib/decidim/dev/test/rspec_support/confirmation_helpers.rb +60 -0
- data/lib/decidim/dev/test/rspec_support/content_processing.rb +4 -4
- data/lib/decidim/dev/test/rspec_support/frontend.rb +20 -0
- data/lib/decidim/dev/test/rspec_support/geocoder.rb +150 -7
- data/lib/decidim/dev/test/rspec_support/helpers.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/organization.rb +7 -0
- data/lib/decidim/dev/test/rspec_support/rake_tasks.rb +75 -0
- data/lib/decidim/dev/test/rspec_support/timezone.rb +7 -0
- data/lib/decidim/dev/test/rspec_support/translation_helpers.rb +2 -0
- data/lib/decidim/dev/version.rb +1 -1
- data/lib/tasks/generators.rake +2 -1
- data/lib/tasks/locale_checker.rake +1 -1
- metadata +94 -16
- data/lib/decidim/dev/test/rspec_support/capybara_proposals_picker.rb +0 -51
@@ -0,0 +1,103 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"title": {
|
5
|
+
"ca": "Laborum totam et nisi autem.",
|
6
|
+
"en": "Tempora esse debitis in ut.",
|
7
|
+
"es": "Eum quia ut maiores officia."
|
8
|
+
},
|
9
|
+
"subtitle": {
|
10
|
+
"ca": "Sit ut.",
|
11
|
+
"en": "Consequatur sed.",
|
12
|
+
"es": "In laudantium."
|
13
|
+
},
|
14
|
+
"slug": "distinctio-cupiditate",
|
15
|
+
"hashtag": "harum",
|
16
|
+
"short_description": {
|
17
|
+
"ca": "<p>Harum magnam id.</p>",
|
18
|
+
"en": "<p>Aut quam doloribus.</p>",
|
19
|
+
"es": "<p>Vel eaque voluptatem.</p>"
|
20
|
+
},
|
21
|
+
"description": {
|
22
|
+
"ca": "<p>Eius velit earum. Dolorem consequuntur ullam. Atque autem non.</p>",
|
23
|
+
"en": "<p>Ad quaerat consequuntur. Voluptas dignissimos eos. Eos saepe et.</p>",
|
24
|
+
"es": "<p>Omnis similique illo. Expedita adipisci qui. Voluptas cupiditate qui.</p>"
|
25
|
+
},
|
26
|
+
"announcement": null,
|
27
|
+
"start_date": "2019-10-02",
|
28
|
+
"end_date": "2019-12-02",
|
29
|
+
"remote_hero_image_url": "http://localhost:3000/uploads/decidim/participatory_process/hero_image/1/city.jpeg",
|
30
|
+
"remote_banner_image_url": "http://localhost:3000/uploads/decidim/participatory_process/banner_image/1/city2.jpeg",
|
31
|
+
"developer_group": {
|
32
|
+
"ca": "Reiciendis.",
|
33
|
+
"en": "Nostrum.",
|
34
|
+
"es": "Aut."
|
35
|
+
},
|
36
|
+
"local_area": {
|
37
|
+
"ca": "Eum necessitatibus.",
|
38
|
+
"en": "Aspernatur perspiciatis.",
|
39
|
+
"es": "A laudantium."
|
40
|
+
},
|
41
|
+
"meta_scope": {
|
42
|
+
"ca": "sint",
|
43
|
+
"en": "voluptas",
|
44
|
+
"es": "ullam"
|
45
|
+
},
|
46
|
+
"participatory_scope": {
|
47
|
+
"ca": "Ad.",
|
48
|
+
"en": "Amet.",
|
49
|
+
"es": "Excepturi."
|
50
|
+
},
|
51
|
+
"participatory_structure": {
|
52
|
+
"ca": "Eos est.",
|
53
|
+
"en": "Quaerat mollitia.",
|
54
|
+
"es": "Vel iusto."
|
55
|
+
},
|
56
|
+
"target": {
|
57
|
+
"ca": "Ratione amet harum.",
|
58
|
+
"en": "Deserunt nulla modi.",
|
59
|
+
"es": "Aut quae ipsa."
|
60
|
+
},
|
61
|
+
"area": {
|
62
|
+
"id": null,
|
63
|
+
"name": {
|
64
|
+
"en": "",
|
65
|
+
"ca": "",
|
66
|
+
"es": ""
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"participatory_process_group": {
|
70
|
+
"id": 1,
|
71
|
+
"name": {
|
72
|
+
"ca": "Molestias pariatur eaque.",
|
73
|
+
"en": "Iure iusto ut.",
|
74
|
+
"es": "Pariatur culpa reprehenderit."
|
75
|
+
},
|
76
|
+
"description": {
|
77
|
+
"ca": "<p>Et accusamus debitis. Sint voluptatem velit. Quia architecto at.</p>",
|
78
|
+
"en": "<p>Sunt eius labore. Odit fugiat numquam. Et consequatur pariatur.</p>",
|
79
|
+
"es": "<p>Rerum aperiam omnis. Optio est quo. Odit est eveniet.</p>"
|
80
|
+
},
|
81
|
+
"remote_hero_image_url": "http://localhost:3000/uploads/decidim/participatory_process_group/hero_image/1/city.jpeg"
|
82
|
+
},
|
83
|
+
"scope": {
|
84
|
+
"id": 1,
|
85
|
+
"name": {
|
86
|
+
"ca": "South Carolina",
|
87
|
+
"en": "South Carolina",
|
88
|
+
"es": "South Carolina"
|
89
|
+
}
|
90
|
+
},
|
91
|
+
"private_space": false,
|
92
|
+
"promoted": true,
|
93
|
+
"scopes_enabled": true,
|
94
|
+
"show_statistics": true,
|
95
|
+
"participatory_process_steps": null,
|
96
|
+
"participatory_process_categories": null,
|
97
|
+
"attachments": {
|
98
|
+
"attachment_collections": null,
|
99
|
+
"files": null
|
100
|
+
},
|
101
|
+
"components": null
|
102
|
+
}
|
103
|
+
]
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Dev
|
5
|
+
# This Dummy translator recieves the field value
|
6
|
+
# and the locale of the field which has to be
|
7
|
+
# translated. It returns the appended value for both.
|
8
|
+
# This is for testing only.
|
9
|
+
class DummyTranslator
|
10
|
+
attr_reader :text, :source_locale, :target_locale, :resource, :field_name
|
11
|
+
|
12
|
+
def initialize(resource, field_name, text, target_locale, source_locale)
|
13
|
+
@resource = resource
|
14
|
+
@field_name = field_name
|
15
|
+
@text = text
|
16
|
+
@target_locale = target_locale
|
17
|
+
@source_locale = source_locale
|
18
|
+
end
|
19
|
+
|
20
|
+
def translate
|
21
|
+
translated_text = "#{target_locale} - #{text}"
|
22
|
+
|
23
|
+
MachineTranslationSaveJob.perform_later(
|
24
|
+
resource,
|
25
|
+
field_name,
|
26
|
+
target_locale,
|
27
|
+
translated_text
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -22,3 +22,17 @@ Dir["#{engine_spec_dir}/shared/**/*.rb"].each { |f| require f }
|
|
22
22
|
require "paper_trail/frameworks/rspec"
|
23
23
|
|
24
24
|
require_relative "spec_helper"
|
25
|
+
|
26
|
+
if ENV["CI"]
|
27
|
+
require "rspec/retry"
|
28
|
+
|
29
|
+
RSpec.configure do |config|
|
30
|
+
# show retry status in spec process
|
31
|
+
config.verbose_retry = true
|
32
|
+
# show exception that triggers a retry if verbose_retry is set to true
|
33
|
+
config.display_try_failure_messages = true
|
34
|
+
|
35
|
+
# Retry failed test, set to 1 for normal behavior
|
36
|
+
config.default_retry_count = ENV.fetch("FAILED_TEST_RETRY_COUNT") { 3 }
|
37
|
+
end
|
38
|
+
end
|
@@ -14,6 +14,7 @@ module Decidim
|
|
14
14
|
routes do
|
15
15
|
root to: proc { [200, {}, ["DUMMY VERIFICATION ENGINE"]] }
|
16
16
|
get :edit_authorization, to: proc { [200, {}, ["CONTINUE YOUR VERIFICATION"]] }
|
17
|
+
get :renew_authorization, to: proc { [200, {}, ["RENEW YOUR VERIFICATION"]] }
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
@@ -23,6 +24,8 @@ end
|
|
23
24
|
Decidim::Verifications.register_workflow(:dummy_authorization_workflow) do |workflow|
|
24
25
|
workflow.engine = Decidim::Verifications::DummyVerification::Engine
|
25
26
|
workflow.expires_in = 1.hour
|
27
|
+
workflow.renewable = true
|
28
|
+
workflow.time_between_renewals = 5.minutes
|
26
29
|
end
|
27
30
|
|
28
31
|
RSpec.configure do |config|
|
@@ -23,7 +23,11 @@ Capybara.register_driver :headless_chrome do |app|
|
|
23
23
|
options = ::Selenium::WebDriver::Chrome::Options.new
|
24
24
|
options.args << "--headless"
|
25
25
|
options.args << "--no-sandbox"
|
26
|
-
options.args << "
|
26
|
+
options.args << if ENV["BIG_SCREEN_SIZE"].present?
|
27
|
+
"--window-size=1920,3000"
|
28
|
+
else
|
29
|
+
"--window-size=1024,768"
|
30
|
+
end
|
27
31
|
|
28
32
|
Capybara::Selenium::Driver.new(
|
29
33
|
app,
|
@@ -62,7 +66,7 @@ RSpec.configure do |config|
|
|
62
66
|
end
|
63
67
|
|
64
68
|
config.around :each, :slow do |example|
|
65
|
-
max_wait_time_for_slow_specs =
|
69
|
+
max_wait_time_for_slow_specs = 30
|
66
70
|
|
67
71
|
using_wait_time(max_wait_time_for_slow_specs) do
|
68
72
|
example.run
|
@@ -6,15 +6,13 @@ module Capybara
|
|
6
6
|
Struct.new(:data_picker, :global_value).new(find_data_picker(id, multiple: multiple), global_value)
|
7
7
|
end
|
8
8
|
|
9
|
-
private
|
10
|
-
|
11
9
|
def find_data_picker(id, multiple: nil)
|
12
10
|
if multiple.nil?
|
13
|
-
expect(page).to have_selector("div.data-picker
|
11
|
+
expect(page).to have_selector("div.data-picker[id$='#{id}']")
|
14
12
|
else
|
15
|
-
expect(page).to have_selector("div.data-picker.picker-#{multiple ? "multiple" : "single"}
|
13
|
+
expect(page).to have_selector("div.data-picker.picker-#{multiple ? "multiple" : "single"}[id$='#{id}']")
|
16
14
|
end
|
17
|
-
|
15
|
+
first("div.data-picker[id$='#{id}']")
|
18
16
|
end
|
19
17
|
|
20
18
|
def data_picker_pick_current
|
@@ -22,5 +20,17 @@ module Capybara
|
|
22
20
|
expect(body).to have_selector("#data_picker-modal .picker-footer a[data-picker-choose]")
|
23
21
|
body.find("#data_picker-modal .picker-footer a[data-picker-choose]").click
|
24
22
|
end
|
23
|
+
|
24
|
+
def data_picker_choose_value(value)
|
25
|
+
body = find(:xpath, "//body")
|
26
|
+
expect(body).to have_selector("#data_picker-modal input[data-picker-choose][type=checkbox][value=\"#{value}\"]")
|
27
|
+
body.find("#data_picker-modal input[data-picker-choose][type=checkbox][value=\"#{value}\"]").click
|
28
|
+
end
|
29
|
+
|
30
|
+
def data_picker_close
|
31
|
+
body = find(:xpath, "//body")
|
32
|
+
expect(body).to have_selector("#data_picker-modal .picker-footer a[data-close]")
|
33
|
+
body.find("#data_picker-modal .picker-footer a[data-close]").click
|
34
|
+
end
|
25
35
|
end
|
26
36
|
end
|
@@ -10,7 +10,7 @@ module Capybara
|
|
10
10
|
match do |scope_picker|
|
11
11
|
data_picker = scope_picker.data_picker
|
12
12
|
scope_name = expected ? translated(expected.name) : t("decidim.scopes.global")
|
13
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible:
|
13
|
+
expect(data_picker).to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible: :all)
|
14
14
|
expect(data_picker).to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,'#{scope_name}')]]")
|
15
15
|
end
|
16
16
|
end
|
@@ -19,7 +19,7 @@ module Capybara
|
|
19
19
|
match do |scope_picker|
|
20
20
|
data_picker = scope_picker.data_picker
|
21
21
|
scope_name = expected ? translated(expected.name) : t("decidim.scopes.global")
|
22
|
-
expect(data_picker).not_to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible:
|
22
|
+
expect(data_picker).not_to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible: :all)
|
23
23
|
expect(data_picker).not_to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,'#{scope_name}')]]")
|
24
24
|
end
|
25
25
|
end
|
@@ -27,7 +27,7 @@ module Capybara
|
|
27
27
|
def scope_pick(scope_picker, scope)
|
28
28
|
data_picker = scope_picker.data_picker
|
29
29
|
# use scope_repick to change single scope picker selected scope
|
30
|
-
expect(data_picker).to have_selector(".picker-values:empty", visible:
|
30
|
+
expect(data_picker).to have_selector(".picker-values:empty", visible: :all) if data_picker.has_css?(".picker-single")
|
31
31
|
|
32
32
|
expect(data_picker).to have_selector(".picker-prompt")
|
33
33
|
data_picker.find(".picker-prompt").click
|
@@ -41,7 +41,7 @@ module Capybara
|
|
41
41
|
def scope_repick(scope_picker, old_scope, new_scope)
|
42
42
|
data_picker = scope_picker.data_picker
|
43
43
|
|
44
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{old_scope&.id || scope_picker.global_value}']", visible:
|
44
|
+
expect(data_picker).to have_selector(".picker-values div input[value='#{old_scope&.id || scope_picker.global_value}']", visible: :all)
|
45
45
|
data_picker.find(:xpath, "//div[contains(@class,'picker-values')]/div/input[@value='#{old_scope&.id || scope_picker.global_value}']/../a").click
|
46
46
|
|
47
47
|
# browse to lowest common parent between old and new scope
|
@@ -57,7 +57,7 @@ module Capybara
|
|
57
57
|
def scope_unpick(scope_picker, scope)
|
58
58
|
data_picker = scope_picker.data_picker
|
59
59
|
|
60
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{scope&.id || scope_picker.global_value}']", visible:
|
60
|
+
expect(data_picker).to have_selector(".picker-values div input[value='#{scope&.id || scope_picker.global_value}']", visible: :all)
|
61
61
|
data_picker.find(".picker-values div input[value='#{scope&.id || scope_picker.global_value}']").click
|
62
62
|
|
63
63
|
expect(scope_picker).to have_scope_not_picked(scope)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module CommentsHelpers
|
4
|
-
def have_comment_from(user, text)
|
4
|
+
def have_comment_from(user, text, opts = {})
|
5
5
|
within "#comments" do
|
6
|
-
have_content(user.name) && have_content(text)
|
6
|
+
have_content(user.name, opts) && have_content(text, opts)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -29,6 +29,7 @@ module Decidim
|
|
29
29
|
root to: proc { [200, {}, ["DUMMY ENGINE"]] }
|
30
30
|
|
31
31
|
resources :dummy_resources do
|
32
|
+
resources :nested_dummy_resources
|
32
33
|
get :foo, on: :member
|
33
34
|
end
|
34
35
|
end
|
@@ -38,6 +39,10 @@ module Decidim
|
|
38
39
|
engine_name "dummy_admin"
|
39
40
|
|
40
41
|
routes do
|
42
|
+
resources :dummy_resources do
|
43
|
+
resources :nested_dummy_resources
|
44
|
+
end
|
45
|
+
|
41
46
|
root to: proc { [200, {}, ["DUMMY ADMIN ENGINE"]] }
|
42
47
|
end
|
43
48
|
end
|
@@ -53,7 +58,7 @@ module Decidim
|
|
53
58
|
include Reportable
|
54
59
|
include Authorable
|
55
60
|
include HasCategory
|
56
|
-
include
|
61
|
+
include ScopableResource
|
57
62
|
include Decidim::Comments::Commentable
|
58
63
|
include Followable
|
59
64
|
include Traceable
|
@@ -63,8 +68,12 @@ module Decidim
|
|
63
68
|
include Paddable
|
64
69
|
include Amendable
|
65
70
|
include Decidim::NewsletterParticipant
|
66
|
-
include
|
71
|
+
include ::Decidim::Endorsable
|
72
|
+
include Decidim::HasAttachments
|
73
|
+
include Decidim::ShareableWithToken
|
74
|
+
include Decidim::TranslatableResource
|
67
75
|
|
76
|
+
translatable_fields :title
|
68
77
|
searchable_fields(
|
69
78
|
scope_id: { scope: :id },
|
70
79
|
participatory_space: { component: :participatory_space },
|
@@ -103,6 +112,44 @@ module Decidim
|
|
103
112
|
.pluck(:decidim_author_id).flatten.compact.uniq
|
104
113
|
end
|
105
114
|
end
|
115
|
+
|
116
|
+
class NestedDummyResource < ApplicationRecord
|
117
|
+
include Decidim::Resourceable
|
118
|
+
belongs_to :dummy_resource
|
119
|
+
end
|
120
|
+
|
121
|
+
class CoauthorableDummyResource < ApplicationRecord
|
122
|
+
include ::Decidim::Coauthorable
|
123
|
+
include HasComponent
|
124
|
+
end
|
125
|
+
|
126
|
+
class OfficialAuthorPresenter
|
127
|
+
def name
|
128
|
+
self.class.name
|
129
|
+
end
|
130
|
+
|
131
|
+
def nickname
|
132
|
+
UserBaseEntity.nicknamize(name)
|
133
|
+
end
|
134
|
+
|
135
|
+
def deleted?
|
136
|
+
false
|
137
|
+
end
|
138
|
+
|
139
|
+
def respond_to_missing?
|
140
|
+
true
|
141
|
+
end
|
142
|
+
|
143
|
+
def method_missing(method, *args)
|
144
|
+
if method.to_s.ends_with?("?")
|
145
|
+
false
|
146
|
+
elsif [:avatar_url, :profile_path, :badge, :followers_count].include?(method)
|
147
|
+
""
|
148
|
+
else
|
149
|
+
super
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
106
153
|
end
|
107
154
|
end
|
108
155
|
|
@@ -128,10 +175,14 @@ Decidim.register_component(:dummy) do |component|
|
|
128
175
|
component.newsletter_participant_entities = ["Decidim::DummyResources::DummyResource"]
|
129
176
|
|
130
177
|
component.settings(:global) do |settings|
|
178
|
+
settings.attribute :scopes_enabled, type: :boolean, default: false
|
179
|
+
settings.attribute :scope_id, type: :scope
|
131
180
|
settings.attribute :comments_enabled, type: :boolean, default: true
|
181
|
+
settings.attribute :comments_max_length, type: :integer, required: false
|
132
182
|
settings.attribute :resources_permissions_enabled, type: :boolean, default: true
|
133
183
|
settings.attribute :dummy_global_attribute_1, type: :boolean
|
134
|
-
settings.attribute :dummy_global_attribute_2, type: :boolean
|
184
|
+
settings.attribute :dummy_global_attribute_2, type: :boolean, readonly: ->(_context) { false }
|
185
|
+
settings.attribute :readonly_attribute, type: :boolean, default: true, readonly: ->(_context) { true }
|
135
186
|
settings.attribute :enable_pads_creation, type: :boolean, default: false
|
136
187
|
settings.attribute :amendments_enabled, type: :boolean, default: false
|
137
188
|
settings.attribute :dummy_global_translatable_text, type: :text, translated: true, editor: true, required: true
|
@@ -140,12 +191,15 @@ Decidim.register_component(:dummy) do |component|
|
|
140
191
|
component.settings(:step) do |settings|
|
141
192
|
settings.attribute :comments_blocked, type: :boolean, default: false
|
142
193
|
settings.attribute :dummy_step_attribute_1, type: :boolean
|
143
|
-
settings.attribute :dummy_step_attribute_2, type: :boolean
|
194
|
+
settings.attribute :dummy_step_attribute_2, type: :boolean, readonly: ->(_context) { false }
|
144
195
|
settings.attribute :dummy_step_translatable_text, type: :text, translated: true, editor: true, required: true
|
196
|
+
settings.attribute :readonly_step_attribute, type: :boolean, default: true, readonly: ->(_context) { true }
|
145
197
|
settings.attribute :amendment_creation_enabled, type: :boolean, default: true
|
146
198
|
settings.attribute :amendment_reaction_enabled, type: :boolean, default: true
|
147
199
|
settings.attribute :amendment_promotion_enabled, type: :boolean, default: true
|
148
200
|
settings.attribute :amendments_visibility, type: :string, default: "all"
|
201
|
+
settings.attribute :endorsements_enabled, type: :boolean, default: false
|
202
|
+
settings.attribute :endorsements_blocked, type: :boolean, default: false
|
149
203
|
end
|
150
204
|
|
151
205
|
component.register_resource(:dummy_resource) do |resource|
|
@@ -156,6 +210,19 @@ Decidim.register_component(:dummy) do |component|
|
|
156
210
|
resource.searchable = true
|
157
211
|
end
|
158
212
|
|
213
|
+
component.register_resource(:nested_dummy_resource) do |resource|
|
214
|
+
resource.name = :nested_dummy
|
215
|
+
resource.model_class_name = "Decidim::DummyResources::NestedDummyResource"
|
216
|
+
end
|
217
|
+
|
218
|
+
component.register_resource(:coauthorable_dummy_resource) do |resource|
|
219
|
+
resource.name = :coauthorable_dummy
|
220
|
+
resource.model_class_name = "Decidim::DummyResources::CoauthorableDummyResource"
|
221
|
+
resource.template = "decidim/coauthorabledummy_resource/linked_dummys"
|
222
|
+
resource.actions = %w(foo-coauthorable)
|
223
|
+
resource.searchable = false
|
224
|
+
end
|
225
|
+
|
159
226
|
component.register_stat :dummies_count_high, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, _start_at, _end_at|
|
160
227
|
components.count * 10
|
161
228
|
end
|
@@ -179,13 +246,15 @@ RSpec.configure do |config|
|
|
179
246
|
unless ActiveRecord::Base.connection.data_source_exists?("decidim_dummy_resources_dummy_resources")
|
180
247
|
ActiveRecord::Migration.create_table :decidim_dummy_resources_dummy_resources do |t|
|
181
248
|
t.jsonb :translatable_text
|
182
|
-
t.
|
249
|
+
t.jsonb :title
|
183
250
|
t.string :body
|
184
251
|
t.text :address
|
185
252
|
t.float :latitude
|
186
253
|
t.float :longitude
|
187
254
|
t.datetime :published_at
|
188
255
|
t.integer :coauthorships_count, null: false, default: 0
|
256
|
+
t.integer :endorsements_count, null: false, default: 0
|
257
|
+
t.integer :comments_count, null: false, default: 0
|
189
258
|
|
190
259
|
t.references :decidim_component, index: false
|
191
260
|
t.integer :decidim_author_id, index: false
|
@@ -195,6 +264,36 @@ RSpec.configure do |config|
|
|
195
264
|
t.references :decidim_scope, index: false
|
196
265
|
t.string :reference
|
197
266
|
|
267
|
+
t.timestamps
|
268
|
+
end
|
269
|
+
end
|
270
|
+
unless ActiveRecord::Base.connection.data_source_exists?("decidim_dummy_resources_nested_dummy_resources")
|
271
|
+
ActiveRecord::Migration.create_table :decidim_dummy_resources_nested_dummy_resources do |t|
|
272
|
+
t.jsonb :translatable_text
|
273
|
+
t.string :title
|
274
|
+
|
275
|
+
t.references :dummy_resource, index: false
|
276
|
+
t.timestamps
|
277
|
+
end
|
278
|
+
end
|
279
|
+
unless ActiveRecord::Base.connection.data_source_exists?("decidim_dummy_resources_coauthorable_dummy_resources")
|
280
|
+
ActiveRecord::Migration.create_table :decidim_dummy_resources_coauthorable_dummy_resources do |t|
|
281
|
+
t.jsonb :translatable_text
|
282
|
+
t.string :title
|
283
|
+
t.string :body
|
284
|
+
t.text :address
|
285
|
+
t.float :latitude
|
286
|
+
t.float :longitude
|
287
|
+
t.datetime :published_at
|
288
|
+
t.integer :coauthorships_count, null: false, default: 0
|
289
|
+
t.integer :endorsements_count, null: false, default: 0
|
290
|
+
t.integer :comments_count, null: false, default: 0
|
291
|
+
|
292
|
+
t.references :decidim_component, index: false
|
293
|
+
t.references :decidim_category, index: false
|
294
|
+
t.references :decidim_scope, index: false
|
295
|
+
t.string :reference
|
296
|
+
|
198
297
|
t.timestamps
|
199
298
|
end
|
200
299
|
end
|