decidim-pages 0.0.5 → 0.0.6

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: 5c3d233904e106ab91960203e3f4ac4a6869459f
4
- data.tar.gz: 5f20be39206fe2d05d57785372cf44d5ccf45d4b
3
+ metadata.gz: 88bb89278413c1a92dbf2ec9a45bd89accc621bf
4
+ data.tar.gz: d8684f7249a48bf29392faa275f01f5c6780d673
5
5
  SHA512:
6
- metadata.gz: 596cd0d1cfc1dff33a47854f7bc2457c50edcf4bf235a8dc3f3fbfca1f01a5fc86df2b0c98644a9ca28c2b3b13e04093b9d8c502bbabe2051ff520cc9107d5de
7
- data.tar.gz: 4e72b10277de282c07cd85d8427171293cbc7ac3ad3df31b4e8c862f3a303795a940ebf5dd9196c371d21cc2df5b74d652ad55382c5a75b2dff85b51687d2b6c
6
+ metadata.gz: 7d83bc17e074007ac388e850d1efd18715a11be5addcd1b8d5cadb99d85f4bc9d95188aa07b34ae3f001499a148e27fdd1d51906c50b6ad830bc645b2dd15d9d
7
+ data.tar.gz: 37f2e0cf9b8967397be17e1a420f1b3a669f5be9ac0f04cf6159045b261f2b60a2ee39b8e8d0468ad97fa83b6280bda730e39e8496dd2f2c7afbeb687eab55e6
@@ -27,10 +27,7 @@ module Decidim
27
27
  private
28
28
 
29
29
  def update_page
30
- @page.update_attributes!(
31
- title: @form.title,
32
- body: @form.body
33
- )
30
+ @page.update_attributes!(body: @form.body)
34
31
  end
35
32
  end
36
33
  end
@@ -9,10 +9,7 @@ module Decidim
9
9
  end
10
10
 
11
11
  def call
12
- @page = Page.new(
13
- title: @feature.name,
14
- feature: @feature
15
- )
12
+ @page = Page.new(feature: @feature)
16
13
 
17
14
  @page.save ? broadcast(:ok) : broadcast(:invalid)
18
15
  end
@@ -6,10 +6,7 @@ module Decidim
6
6
  class PageForm < Decidim::Form
7
7
  include TranslatableAttributes
8
8
 
9
- translatable_attribute :title, String
10
9
  translatable_attribute :body, String
11
-
12
- validates :title, translatable_presence: true
13
10
  end
14
11
  end
15
12
  end
@@ -4,13 +4,16 @@ module Decidim
4
4
  # The data store for a Page in the Decidim::Pages component. It stores a
5
5
  # title, description and any other useful information to render a custom page.
6
6
  class Page < Pages::ApplicationRecord
7
+ include Decidim::Resourceable
8
+ include Decidim::HasFeature
7
9
  include Decidim::Comments::Commentable
8
10
 
9
- belongs_to :feature, foreign_key: "decidim_feature_id", class_name: Decidim::Feature
10
- has_one :organization, through: :feature
11
+ feature_manifest_name "pages"
11
12
 
12
- validates :title, :feature, presence: true
13
- validate :feature_manifest_matches
13
+ # Public: Pages doesn't have title so we assign the feature one to it.
14
+ def title
15
+ feature.name
16
+ end
14
17
 
15
18
  # Public: Overrides the `commentable?` Commentable concern method.
16
19
  def commentable?
@@ -19,7 +22,7 @@ module Decidim
19
22
 
20
23
  # Public: Overrides the `accepts_new_comments?` Commentable concern method.
21
24
  def accepts_new_comments?
22
- commentable? && !feature.active_step_settings.comments_blocked
25
+ commentable? && !feature.active_step_settings.comments_blocked
23
26
  end
24
27
 
25
28
  # Public: Overrides the `comments_have_alignment?` Commentable concern method.
@@ -31,13 +34,6 @@ module Decidim
31
34
  def comments_have_votes?
32
35
  true
33
36
  end
34
-
35
- private
36
-
37
- def feature_manifest_matches
38
- return unless feature
39
- errors.add(:feature, :invalid) unless feature.manifest_name == "pages"
40
- end
41
37
  end
42
38
  end
43
39
  end
@@ -1,4 +1,3 @@
1
1
  <div class="field">
2
- <%= form.translated :text_field, :title, autofocus: true, label: t("models.components.title", scope: "decidim.pages.admin") %>
3
2
  <%= form.translated :editor, :body, toolbar: :full, lines: 30, label: t("models.components.body", scope: "decidim.pages.admin") %>
4
3
  </div>
@@ -1,5 +1,4 @@
1
1
  <% add_decidim_meta_tags({
2
- title: translated_attribute(@page.title),
3
2
  description: translated_attribute(@page.body),
4
3
  }) %>
5
4
 
@@ -13,7 +13,6 @@ ca:
13
13
  models:
14
14
  components:
15
15
  body: Cos
16
- title: Títol
17
16
  pages:
18
17
  edit:
19
18
  save: Desa la pàgina
@@ -14,7 +14,6 @@ en:
14
14
  models:
15
15
  components:
16
16
  body: Body
17
- title: Title
18
17
  pages:
19
18
  edit:
20
19
  save: Save page
@@ -13,7 +13,6 @@ es:
13
13
  models:
14
14
  components:
15
15
  body: Cuerpo
16
- title: Título
17
16
  pages:
18
17
  edit:
19
18
  save: Guardar página
@@ -1,7 +1,20 @@
1
1
  eu:
2
2
  decidim:
3
+ features:
4
+ pages:
5
+ name: Orrialdea
6
+ settings:
7
+ global:
8
+ comments_enabled: Iruzkin gaituak
3
9
  pages:
4
10
  admin:
5
11
  models:
6
12
  components:
7
- title: Izenburua
13
+ body: Testu-gorputza
14
+ pages:
15
+ edit:
16
+ save: Gorde orria
17
+ title: Editatu orria
18
+ update:
19
+ invalid: Erroreak gertatu dira orria gordetzean.
20
+ success: Orria zuzen gorde da.
@@ -0,0 +1,22 @@
1
+ fi:
2
+ decidim:
3
+ features:
4
+ pages:
5
+ name: Sivu
6
+ settings:
7
+ global:
8
+ comments_enabled: Kommentointi sallittu
9
+ step:
10
+ comments_blocked: Kommentointi estetty
11
+ pages:
12
+ admin:
13
+ models:
14
+ components:
15
+ body: Runko
16
+ pages:
17
+ edit:
18
+ save: Tallenna sivu
19
+ title: Muokkaa sivua
20
+ update:
21
+ invalid: Sivun tallennuksessa oli virheitä.
22
+ success: Sivu tallennettu onnistuneesti.
@@ -0,0 +1,5 @@
1
+ class RemovePageFeatureTitles < ActiveRecord::Migration[5.0]
2
+ def change
3
+ remove_column :decidim_pages_pages, :title
4
+ end
5
+ end
@@ -8,6 +8,7 @@ module Decidim
8
8
  isolate_namespace Decidim::Pages
9
9
 
10
10
  routes do
11
+ resources :pages, only: [:show], controller: :application
11
12
  root to: "application#show"
12
13
  end
13
14
  end
@@ -27,6 +27,10 @@ Decidim.register_feature(:pages) do |feature|
27
27
  settings.attribute :comments_blocked, type: :boolean, default: false
28
28
  end
29
29
 
30
+ feature.register_resource do |resource|
31
+ resource.model_class_name = "Decidim::Pages::Page"
32
+ end
33
+
30
34
  feature.seeds do
31
35
  Decidim::ParticipatoryProcess.all.each do |process|
32
36
  next unless process.steps.any?
@@ -40,7 +44,6 @@ Decidim.register_feature(:pages) do |feature|
40
44
 
41
45
  page = Decidim::Pages::Page.create!(
42
46
  feature: feature,
43
- title: Decidim::Faker::Localized.sentence(2),
44
47
  body: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
45
48
  Decidim::Faker::Localized.paragraph(3)
46
49
  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.5
4
+ version: 0.0.6
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-02-17 00:00:00.000000000 Z
13
+ date: 2017-03-24 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.5
21
+ version: 0.0.6
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.5
28
+ version: 0.0.6
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.5
35
+ version: 0.0.6
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.5
42
+ version: 0.0.6
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.5
63
+ version: 0.0.6
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.5
70
+ version: 0.0.6
71
71
  description: A pages component for decidim's participatory processes.
72
72
  email:
73
73
  - josepjaume@gmail.com
@@ -98,9 +98,11 @@ files:
98
98
  - config/locales/en.yml
99
99
  - config/locales/es.yml
100
100
  - config/locales/eu.yml
101
+ - config/locales/fi.yml
101
102
  - db/migrate/20161116121353_create_decidim_pages.rb
102
103
  - db/migrate/20161214150429_add_commentable_to_pages.rb
103
104
  - db/migrate/20170110145040_remove_commentable_flag_from_pages.rb
105
+ - db/migrate/20170220091402_remove_page_feature_titles.rb
104
106
  - lib/decidim/pages.rb
105
107
  - lib/decidim/pages/admin.rb
106
108
  - lib/decidim/pages/admin_engine.rb