decidim 0.9.3 → 0.10.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.
- checksums.yaml +4 -4
- data/Gemfile +8 -8
- data/Gemfile.lock +143 -145
- data/README.md +42 -62
- data/Rakefile +26 -25
- data/docs/add_authenticable_action.md +20 -0
- data/docs/adding_fixtures_aka_dummy_content.md +7 -0
- data/docs/advanced/activity_log.md +138 -0
- data/docs/{content_processors.md → advanced/content_processors.md} +1 -1
- data/docs/advanced/deploy.md +9 -0
- data/docs/{features_and_components.md → advanced/features.md} +0 -0
- data/docs/{create_followers_from_resource_authors.md → advanced/followers.md} +17 -1
- data/docs/advanced/how_to_create_a_module.md +9 -0
- data/docs/{managing_translations_i18n.md → advanced/managing_translations_i18n.md} +0 -0
- data/docs/{migrate_to_0.8.0.md → advanced/migrate_to_0.8.0.md} +26 -22
- data/docs/advanced/testing.md +29 -0
- data/docs/advanced/tradeoffs.md +14 -0
- data/docs/{view_hooks.md → advanced/view_hooks.md} +18 -5
- data/docs/customization/authorizations.md +13 -1
- data/docs/data-picker.md +48 -0
- data/docs/getting_started.md +28 -17
- data/docs/services/activejob.md +7 -0
- data/docs/{analytics.md → services/analytics.md} +0 -0
- data/docs/{geocoding.md → services/geocoding.md} +0 -0
- data/docs/{social_providers.md → services/social_providers.md} +0 -0
- data/lib/decidim/component_manager.rb +22 -21
- data/lib/decidim/version.rb +1 -1
- data/lib/generators/decidim/app_generator.rb +33 -16
- data/lib/generators/decidim/install_generator.rb +9 -3
- data/lib/generators/decidim/templates/database.yml.erb +2 -2
- data/lib/generators/decidim/templates/initializer.rb +1 -1
- metadata +51 -45
- data/docs/create_followers_from_comment_authors.md +0 -12
- data/docs/how_to_create_a_module.md +0 -170
- data/docs/testing.md +0 -17
@@ -1,12 +0,0 @@
|
|
1
|
-
# Create followers from comment authors
|
2
|
-
|
3
|
-
Run the following script to make all comment authors follow the commented resource:
|
4
|
-
|
5
|
-
```ruby
|
6
|
-
Decidim::Comments::Comment.includes(:author, :root_commentable).find_each do |comment|
|
7
|
-
begin
|
8
|
-
Decidim::Follow.create!(followable: comment.root_commentable, user: comment.author)
|
9
|
-
rescue
|
10
|
-
end
|
11
|
-
end; p 1
|
12
|
-
```
|
@@ -1,170 +0,0 @@
|
|
1
|
-
# How to create a Decidim engine
|
2
|
-
|
3
|
-
## Standard way
|
4
|
-
|
5
|
-
1. Run the following command:
|
6
|
-
|
7
|
-
```
|
8
|
-
rails plugin new decidim-<engine_name> --skip-gemfile --skip-test --skip-gemspec
|
9
|
-
```
|
10
|
-
|
11
|
-
1. Create a `decidim-<engine_name>.gemspec` file with this content:
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
# frozen_string_literal: true
|
15
|
-
|
16
|
-
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
17
|
-
|
18
|
-
require "decidim/<engine_name>/version"
|
19
|
-
|
20
|
-
Gem::Specification.new do |s|
|
21
|
-
s.version = Decidim::<EngineName>.version
|
22
|
-
s.authors = ["Your Name"]
|
23
|
-
s.email = ["your_eamail@example.org"]
|
24
|
-
s.license = "AGPL-3.0"
|
25
|
-
s.homepage = "https://github.com/decidim/decidim"
|
26
|
-
s.required_ruby_version = ">= 2.4.2"
|
27
|
-
|
28
|
-
s.name = "decidim-<engine_name>"
|
29
|
-
s.summary = "<engine_description>"
|
30
|
-
s.description = s.summary
|
31
|
-
|
32
|
-
s.files = Dir["{app,config,db,lib,vendor}/**/*", "Rakefile", "README.md"]
|
33
|
-
|
34
|
-
s.add_dependency "decidim-core", Decidim.version
|
35
|
-
|
36
|
-
s.add_development_dependency "decidim-dev", Decidim.version
|
37
|
-
end
|
38
|
-
```
|
39
|
-
|
40
|
-
1. Remove `bin/test` and add an executable `bin/rails` with this content:
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
#!/usr/bin/env ruby
|
44
|
-
# frozen_string_literal: true
|
45
|
-
|
46
|
-
# This command will automatically be run when you run "rails" with Rails gems
|
47
|
-
# installed from the root of your application.
|
48
|
-
|
49
|
-
ENGINE_ROOT = File.expand_path("..", __dir__)
|
50
|
-
ENGINE_PATH = File.expand_path("../lib/decidim/<engine_name>/engine", __dir__)
|
51
|
-
|
52
|
-
# Set up gems listed in the Gemfile.
|
53
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__)
|
54
|
-
require "bundler/setup"
|
55
|
-
|
56
|
-
require "rails/all"
|
57
|
-
require "rails/engine/commands"
|
58
|
-
```
|
59
|
-
|
60
|
-
1. Replace `lib/decidim/<engine_name>.rb` with this:
|
61
|
-
|
62
|
-
```ruby
|
63
|
-
# frozen_string_literal: true
|
64
|
-
|
65
|
-
require "decidim/<engine_name>/engine"
|
66
|
-
require "decidim/<engine_name>/feature"
|
67
|
-
```
|
68
|
-
|
69
|
-
1. Remove `lib/tasks/decidim/<engine_name>_tasks.rb`.
|
70
|
-
|
71
|
-
1. Add `lib/decidim/<engine_name>/engine.rb` with this:
|
72
|
-
|
73
|
-
```ruby
|
74
|
-
# frozen_string_literal: true
|
75
|
-
|
76
|
-
require "rails"
|
77
|
-
require "active_support/all"
|
78
|
-
|
79
|
-
require "decidim/core"
|
80
|
-
|
81
|
-
module Decidim
|
82
|
-
module <EngineName>
|
83
|
-
# Decidim's <EngineName> Rails Engine.
|
84
|
-
class Engine < ::Rails::Engine
|
85
|
-
isolate_namespace Decidim::<EngineName>
|
86
|
-
|
87
|
-
initializer "decidim_<engine_name>.assets" do |app|
|
88
|
-
app.config.assets.precompile += %w(decidim_<engine_name>_manifest.js)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
```
|
94
|
-
|
95
|
-
1. Add `lib/decidim/<engine_name>/feature.rb` with this:
|
96
|
-
|
97
|
-
```ruby
|
98
|
-
# frozen_string_literal: true
|
99
|
-
|
100
|
-
Decidim.register_feature(:<engine_name>) do |feature|
|
101
|
-
feature.engine = Decidim::<EngineName>::Engine
|
102
|
-
feature.icon = "decidim/<engine_name>/icon.svg"
|
103
|
-
|
104
|
-
feature.on(:before_destroy) do |instance|
|
105
|
-
# Code executed before removing the feature
|
106
|
-
end
|
107
|
-
|
108
|
-
# These actions permissions can be configured in the admin panel
|
109
|
-
feature.actions = %w()
|
110
|
-
|
111
|
-
feature.settings(:global) do |settings|
|
112
|
-
# Add your global settings
|
113
|
-
# Available types: :integer, :boolean
|
114
|
-
# settings.attribute :vote_limit, type: :integer, default: 0
|
115
|
-
end
|
116
|
-
|
117
|
-
feature.settings(:step) do |settings|
|
118
|
-
# Add your settings per step
|
119
|
-
end
|
120
|
-
|
121
|
-
# # Register an optional resource that can be referenced from other resources.
|
122
|
-
# feature.register_resource do |resource|
|
123
|
-
# resource.model_class_name = "Decidim::<EngineName>::<ResourceName>"
|
124
|
-
# resource.template = "decidim/<engine_name>/<resource_view_folder>/linked_<resource_name_plural>"
|
125
|
-
# end
|
126
|
-
|
127
|
-
feature.register_stat :some_stat do |features, start_at, end_at|
|
128
|
-
# Register some stat number to the application
|
129
|
-
end
|
130
|
-
|
131
|
-
feature.seeds do |participatory_space|
|
132
|
-
# Define seeds for a specific participatory_space object
|
133
|
-
end
|
134
|
-
end
|
135
|
-
```
|
136
|
-
|
137
|
-
1. Replace `Rakefile` with:
|
138
|
-
|
139
|
-
```ruby
|
140
|
-
# frozen_string_literal: true
|
141
|
-
|
142
|
-
require "decidim/common_rake"
|
143
|
-
```
|
144
|
-
|
145
|
-
1. Remove `MIT-LICENSE` and change `README`.
|
146
|
-
|
147
|
-
1. Add `spec/spec_helper.rb` with:
|
148
|
-
|
149
|
-
```ruby
|
150
|
-
# frozen_string_literal: true
|
151
|
-
|
152
|
-
require "decidim/dev"
|
153
|
-
|
154
|
-
ENV["ENGINE_NAME"] = File.dirname(__dir__).split("/").last
|
155
|
-
|
156
|
-
Decidim::Dev.dummy_app_path = File.expand_path(File.join("..", "spec", "decidim_dummy_app"))
|
157
|
-
|
158
|
-
require "decidim/dev/test/base_spec_helper"
|
159
|
-
|
160
|
-
```
|
161
|
-
|
162
|
-
1. Upload to GitHub with the naming *decidim-module-<engine_name>*, so it's easier to find on
|
163
|
-
the [dependency graph](https://github.com/decidim/decidim/network/dependents).
|
164
|
-
|
165
|
-
|
166
|
-
## Experimental way
|
167
|
-
|
168
|
-
Plugin creation is being automated in
|
169
|
-
[decidim-generators](https://github.com/codegram/decidim-generators). It's in an
|
170
|
-
early stage, but you might want to give it a try.
|
data/docs/testing.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# How to test Decidim engines
|
2
|
-
|
3
|
-
## Requirements
|
4
|
-
|
5
|
-
You need to create a dummy application to run your tests. Run the following command in the decidim root's folder:
|
6
|
-
|
7
|
-
```bash
|
8
|
-
bundle exec rake test_app
|
9
|
-
```
|
10
|
-
|
11
|
-
## Running the test suite
|
12
|
-
|
13
|
-
A Decidim engine can be tested running the following command inside its folder:
|
14
|
-
|
15
|
-
```bash
|
16
|
-
bundle exec rake
|
17
|
-
```
|