decidim-pages 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/app/commands/decidim/pages/admin/update_page.rb +1 -0
- data/app/commands/decidim/pages/copy_page.rb +26 -0
- data/app/commands/decidim/pages/create_page.rb +1 -0
- data/app/commands/decidim/pages/destroy_page.rb +1 -0
- data/app/controllers/decidim/pages/admin/pages_controller.rb +1 -0
- data/app/forms/decidim/pages/admin/page_form.rb +1 -0
- data/app/helpers/decidim/pages/application_helper.rb +1 -0
- data/app/models/decidim/pages/application_record.rb +1 -0
- data/app/models/decidim/pages/page.rb +1 -0
- data/config/i18n-tasks.yml +2 -1
- data/config/locales/eu.yml +1 -0
- data/lib/decidim/pages.rb +1 -0
- data/lib/decidim/pages/admin.rb +1 -0
- data/lib/decidim/pages/admin_engine.rb +1 -0
- data/lib/decidim/pages/engine.rb +1 -0
- data/lib/decidim/pages/feature.rb +6 -0
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de56df0dc3a9c281daa4100f5a40f4bd8a4ec91d
|
4
|
+
data.tar.gz: 4a20630f3b1eb1e9473155c6b4faa7fd99abde8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95d1b8bb66afafc374cd235b03414d6c6be6154a0b8567ef80b6fd1946446f56ebada3681ecfa2ed8ca7e2c1261b6360aac96cdb3dbb2ec40f210180f050e97f
|
7
|
+
data.tar.gz: 0e0bafee53b82edf8553886650b66de1163a8711400ef3f92737a13bba660003f4704dce5c43a7d912651f06a4e7042e13fe7dbf260de54e5f64af2ed0ea0ae5
|
data/Rakefile
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Pages
|
5
|
+
# Command that gets called whenever a feature's page has to be duplicated.
|
6
|
+
# It's need a context with the old feature that
|
7
|
+
# is going to be duplicated on the new one
|
8
|
+
class CopyPage < Rectify::Command
|
9
|
+
def initialize(context)
|
10
|
+
@context = context
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
Decidim::Pages::Page.transaction do
|
15
|
+
pages = Decidim::Pages::Page.where(feature: @context[:old_feature])
|
16
|
+
pages.each do |page|
|
17
|
+
Decidim::Pages::Page.create!(feature: @context[:new_feature], body: page.body)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
broadcast(:ok)
|
21
|
+
rescue ActiveRecord::RecordInvalid
|
22
|
+
broadcast(:invalid)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/config/i18n-tasks.yml
CHANGED
data/config/locales/eu.yml
CHANGED
data/lib/decidim/pages.rb
CHANGED
data/lib/decidim/pages/admin.rb
CHANGED
data/lib/decidim/pages/engine.rb
CHANGED
@@ -19,6 +19,12 @@ Decidim.register_feature(:pages) do |feature|
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
feature.on(:copy) do |context|
|
23
|
+
Decidim::Pages::CopyPage.call(context) do
|
24
|
+
on(:invalid) { raise "Can't duplicate page" }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
22
28
|
feature.register_stat :comments_count, tag: :comments do |features, start_at, end_at|
|
23
29
|
pages = Decidim::Pages::Page.where(feature: features)
|
24
30
|
pages = pages.where("created_at >= ?", start_at) if start_at.present?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.2.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: decidim-comments
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.2.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.2.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rectify
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,14 +60,14 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.2.0
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
70
|
+
version: 0.2.0
|
71
71
|
description: A pages component for decidim's participatory processes.
|
72
72
|
email:
|
73
73
|
- josepjaume@gmail.com
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- Rakefile
|
82
82
|
- app/assets/images/decidim/pages/icon.svg
|
83
83
|
- app/commands/decidim/pages/admin/update_page.rb
|
84
|
+
- app/commands/decidim/pages/copy_page.rb
|
84
85
|
- app/commands/decidim/pages/create_page.rb
|
85
86
|
- app/commands/decidim/pages/destroy_page.rb
|
86
87
|
- app/controllers/decidim/pages/admin/application_controller.rb
|