decidim-pages 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab78619392592e129e5832c0a779ef5283722b6a
4
- data.tar.gz: 32f49164085f41b9f788ff173ddb1b1f1339726f
3
+ metadata.gz: 6d4f91509718700bba96bb88a5ea4699924256e9
4
+ data.tar.gz: f4852700fc682d785e646f0d70037700214bad83
5
5
  SHA512:
6
- metadata.gz: cabddfa8a9fc6812b2bc7f41580bb2e01d5fc48307fb56f959295667bf4dd5cd04ac412606284151dc2db15c31a95088ea89e80719d42b1c6ff9a52fbc254778
7
- data.tar.gz: 7553a56a6e9268c7f2bf87fd009b3a46b3edd99d905762deda8abb6443200ce4e978fa78fb0fc9777c43af179f92d59d17d40bb0489432c465c49b5d62026623
6
+ metadata.gz: 60ad78cc25ad9cb936d21c8ec41c60b61fed3ac39f190322e56ce144af173f3ee9d2e37f21def010d37bc4acac75408cc30c6c68c252795bcaae83a4eaa0fa1b
7
+ data.tar.gz: 51b6191f76068e592d06e4f3019433bd56a5456fc42fe242cde032a7b7295c35f38e11f38b89e72f7595c51d17fa395bd68ecc94d8d41b6db2cb0f18f8f1e929
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
1
  # frozen_string_literal: true
2
- require "decidim/common_rake"
2
+ require "decidim/dev/common_rake"
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
2
+ <path d="M0 0v8h7v-4h-4v-4h-3zm4 0v3h3l-3-3zm-3 2h1v1h-1v-1zm0 2h1v1h-1v-1zm0 2h4v1h-4v-1z" />
3
+ </svg>
@@ -29,8 +29,7 @@ module Decidim
29
29
  def update_page
30
30
  @page.update_attributes!(
31
31
  title: @form.title,
32
- body: @form.body,
33
- commentable: @form.commentable
32
+ body: @form.body
34
33
  )
35
34
  end
36
35
  end
@@ -8,7 +8,6 @@ module Decidim
8
8
 
9
9
  translatable_attribute :title, String
10
10
  translatable_attribute :body, String
11
- attribute :commentable, Boolean
12
11
 
13
12
  validates :title, translatable_presence: true
14
13
  end
@@ -1,5 +1,4 @@
1
1
  <div class="field">
2
2
  <%= form.translated :text_field, :title, autofocus: true, label: t("models.components.title", scope: "decidim.pages.admin") %>
3
3
  <%= form.translated :editor, :body, toolbar: :full, lines: 30, label: t("models.components.body", scope: "decidim.pages.admin") %>
4
- <%= form.check_box :commentable, label: t("models.components.commentable", scope: "decidim.pages.admin") %>
5
4
  </div>
@@ -9,8 +9,8 @@
9
9
  </div>
10
10
  </div>
11
11
 
12
- <%= content_for :expanded do %>
13
- <% if @page.commentable? %>
14
- <%= comments_for @page, arguable: true %>
12
+ <% if feature_settings.comments_always_enabled || current_settings.comments_enabled %>
13
+ <%= content_for :expanded do %>
14
+ <%= comments_for @page, arguable: true, votable: true %>
15
15
  <% end %>
16
16
  <% end %>
@@ -2,3 +2,4 @@ base_locale: en
2
2
  locales: [en]
3
3
  ignore_unused:
4
4
  - "decidim.features.pages.name"
5
+ - "decidim.features.pages.settings.*"
@@ -3,12 +3,16 @@ ca:
3
3
  features:
4
4
  pages:
5
5
  name: Pàgina
6
+ settings:
7
+ global:
8
+ comments_always_enabled: Comentaris sempre habilitats
9
+ step:
10
+ comments_enabled: Comentaris habilitats
6
11
  pages:
7
12
  admin:
8
13
  models:
9
14
  components:
10
15
  body: Cos
11
- commentable: Habilitar comentaris per a aquesta pàgina
12
16
  title: Títol
13
17
  pages:
14
18
  edit:
@@ -4,12 +4,16 @@ en:
4
4
  features:
5
5
  pages:
6
6
  name: Page
7
+ settings:
8
+ global:
9
+ comments_always_enabled: Comments always enabled
10
+ step:
11
+ comments_enabled: Comments enabled
7
12
  pages:
8
13
  admin:
9
14
  models:
10
15
  components:
11
16
  body: Body
12
- commentable: Enable comments for this page
13
17
  title: Title
14
18
  pages:
15
19
  edit:
@@ -3,12 +3,16 @@ es:
3
3
  features:
4
4
  pages:
5
5
  name: Página
6
+ settings:
7
+ global:
8
+ comments_always_enabled: Comentarios siempre habilitados
9
+ step:
10
+ comments_enabled: Comentarios habilitados
6
11
  pages:
7
12
  admin:
8
13
  models:
9
14
  components:
10
15
  body: Cuerpo
11
- commentable: Habilitar comentarios para esta página
12
16
  title: Título
13
17
  pages:
14
18
  edit:
@@ -0,0 +1,5 @@
1
+ class RemoveCommentableFlagFromPages < ActiveRecord::Migration[5.0]
2
+ def change
3
+ remove_column :decidim_pages_pages, :commentable
4
+ end
5
+ end
@@ -5,6 +5,7 @@ require_dependency "decidim/features/namer"
5
5
  Decidim.register_feature(:pages) do |feature|
6
6
  feature.engine = Decidim::Pages::Engine
7
7
  feature.admin_engine = Decidim::Pages::AdminEngine
8
+ feature.icon = "decidim/pages/icon.svg"
8
9
 
9
10
  feature.on(:create) do |instance|
10
11
  Decidim::Pages::CreatePage.call(instance) do
@@ -18,6 +19,14 @@ Decidim.register_feature(:pages) do |feature|
18
19
  end
19
20
  end
20
21
 
22
+ feature.settings(:global) do |settings|
23
+ settings.attribute :comments_always_enabled, type: :boolean
24
+ end
25
+
26
+ feature.settings(:step) do |settings|
27
+ settings.attribute :comments_enabled, type: :boolean
28
+ end
29
+
21
30
  feature.seeds do
22
31
  Decidim::ParticipatoryProcess.all.each do |process|
23
32
  next unless process.steps.any?
@@ -28,14 +37,15 @@ Decidim.register_feature(:pages) do |feature|
28
37
  participatory_process: process
29
38
  )
30
39
 
31
- Decidim::Pages::Page.create!(
40
+ page = Decidim::Pages::Page.create!(
32
41
  feature: feature,
33
42
  title: Decidim::Faker::Localized.sentence(2),
34
43
  body: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
35
44
  Decidim::Faker::Localized.paragraph(3)
36
- end,
37
- commentable: true
45
+ end
38
46
  )
47
+
48
+ Decidim::Comments::Seed.comments_for(page)
39
49
  end
40
50
  end
41
51
  end
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.0.1
4
+ version: 0.0.2
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: 2016-12-21 00:00:00.000000000 Z
13
+ date: 2017-01-23 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.0.1
21
+ version: 0.0.2
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.0.1
28
+ version: 0.0.2
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.0.1
35
+ version: 0.0.2
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.0.1
42
+ version: 0.0.2
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.0.1
63
+ version: 0.0.2
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.0.1
70
+ version: 0.0.2
71
71
  description: A pages component for decidim's participatory processes.
72
72
  email:
73
73
  - josepjaume@gmail.com
@@ -79,6 +79,7 @@ extra_rdoc_files: []
79
79
  files:
80
80
  - README.md
81
81
  - Rakefile
82
+ - app/assets/images/decidim/pages/icon.svg
82
83
  - app/commands/decidim/pages/admin/update_page.rb
83
84
  - app/commands/decidim/pages/create_page.rb
84
85
  - app/commands/decidim/pages/destroy_page.rb
@@ -98,6 +99,7 @@ files:
98
99
  - config/locales/es.yml
99
100
  - db/migrate/20161116121353_create_decidim_pages.rb
100
101
  - db/migrate/20161214150429_add_commentable_to_pages.rb
102
+ - db/migrate/20170110145040_remove_commentable_flag_from_pages.rb
101
103
  - lib/decidim/pages.rb
102
104
  - lib/decidim/pages/admin.rb
103
105
  - lib/decidim/pages/admin_engine.rb
@@ -124,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
126
  version: '0'
125
127
  requirements: []
126
128
  rubyforge_project:
127
- rubygems_version: 2.5.2
129
+ rubygems_version: 2.6.8
128
130
  signing_key:
129
131
  specification_version: 4
130
132
  summary: A pages component for decidim's participatory processes.