decidim-pages 0.29.2 → 0.30.0.rc1

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
  SHA256:
3
- metadata.gz: 87c9b9022c5740d992b66d0dbef84e6ef5acc895f08621b9811b188e05d091d7
4
- data.tar.gz: e499bcbb7cdc02c122c23773983c33e7d99bb15ce60efa3294512f6f1d76fc28
3
+ metadata.gz: 4d57802de4318336eccd86b14427d5987d7a5f4156218bc899974ad4d89135cf
4
+ data.tar.gz: 5042f4bcf4e8f5bbe691df4c9f6a985bebc43a3533bc31588425498d38924532
5
5
  SHA512:
6
- metadata.gz: f64748e4d1766d17ecc3b6c9af114fc489cdb2fc31b34adb2da752d220f8b079e6b7182981ef784d121b0f04d1066f8f64e1e3d193d89bad991577af78c866c5
7
- data.tar.gz: 04b4da64aa39752f40148541c7d220c94c5c6822fcab6abba2cea7e8fdd4e756b3245d8b43a643c080027e0dbc07f4f3e80b712a99600e01ab8dfae766485db9
6
+ metadata.gz: 579e6f47310ed5891cc2d0cea4377481d2a8b83277ad0669cbd511aa7126190b4383411bf9800875d76776ef0c6830154da8fd36c123df5c3d05a529734c0f6d
7
+ data.tar.gz: d013f69bf9063a281440b1c44cfb52252440ffd4e55ebe8aaaedee52327aed20077eaaa096e44941baa50469ad18ecc28d8f8570eaec06df5524f9df896e9499
@@ -5,6 +5,8 @@ module Decidim
5
5
  module Admin
6
6
  # This controller allows the user to update a Page.
7
7
  class PagesController < Admin::ApplicationController
8
+ include Decidim::Admin::HasTrashableResources
9
+
8
10
  def edit
9
11
  enforce_permission_to :update, :page
10
12
 
@@ -31,9 +33,15 @@ module Decidim
31
33
 
32
34
  private
33
35
 
36
+ def trashable_deleted_resource_type
37
+ :page
38
+ end
39
+
34
40
  def page
35
41
  @page ||= Pages::Page.find_by(component: current_component)
36
42
  end
43
+
44
+ alias trashable_deleted_resource current_component
37
45
  end
38
46
  end
39
47
  end
@@ -1,7 +1,7 @@
1
- <% add_decidim_page_title(translated_attribute(@page.title)) %>
2
- <% add_decidim_meta_tags({
3
- description: translated_attribute(@page.body)
4
- }) %>
1
+ <% add_decidim_meta_tags(
2
+ title: translated_attribute(@page.title),
3
+ description: translated_attribute(@page.body),
4
+ resource: @page) %>
5
5
 
6
6
  <%= render layout:"layouts/decidim/shared/layout_center" do %>
7
7
  <div class="py-12 space-y-12">
@@ -17,6 +17,17 @@ ca:
17
17
  announcement: Avís
18
18
  step:
19
19
  announcement: Avís
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: El contingut de la pàgina
24
+ component: El component al qual pertany la pàgina
25
+ created_at: La data en què es va crear aquesta pàgina
26
+ id: L'identificador únic d'aquesta pàgina
27
+ participatory_space: A quin espai pertany aquesta pàgina (procés participatiu, assemblea, etc.)
28
+ title: El títol de la pàgina
29
+ updated_at: La data de la darrera actualització d'aquesta pàgina
30
+ url: L'URL d'aquesta pàgina
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -19,6 +19,17 @@ cs:
19
19
  announcement: Oznámení
20
20
  step:
21
21
  announcement: Oznámení
22
+ open_data:
23
+ help:
24
+ pages:
25
+ body: Tělo stránky
26
+ component: Komponenta, ke které stránka patří,
27
+ created_at: Datum, kdy byla stránka vytvořena
28
+ id: Jedinečný identifikátor této stránky
29
+ participatory_space: Do kterého prostoru (např. účastnický proces nebo Shromáždění) patří tato schůzka
30
+ title: Název stránky
31
+ updated_at: Poslední datum aktualizace této stránky
32
+ url: URL pro tuto stránku
22
33
  pages:
23
34
  admin:
24
35
  models:
@@ -17,6 +17,17 @@ de:
17
17
  announcement: Ankündigung
18
18
  step:
19
19
  announcement: Ankündigung
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: Der Inhalt der Seite
24
+ component: Die Komponente, zu der die Seite gehört
25
+ created_at: Erstellungsdatum dieser Seite
26
+ id: Die eindeutige Bezeichnung des Seite
27
+ participatory_space: Zu welchem Bereich diese Seite gehört (z.B. Partizipationsprozesse oder Gremien)
28
+ title: Der Seitentitel
29
+ updated_at: Letztes Aktualisierungsdatum dieser Seite
30
+ url: Die URL für diese Seite
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ en:
17
17
  announcement: Announcement
18
18
  step:
19
19
  announcement: Announcement
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: The body of the page
24
+ component: The component that the page belongs to
25
+ created_at: The date this page was created
26
+ id: The unique identifier of this page
27
+ participatory_space: To which space (e.g. Participatory Process, or Assembly) this page belongs to
28
+ title: The page title
29
+ updated_at: The last date this page was updated
30
+ url: The URL for this page
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ es-MX:
17
17
  announcement: Aviso
18
18
  step:
19
19
  announcement: Aviso
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: El contenido de la página
24
+ component: El componente al que pertenece la página
25
+ created_at: La fecha en la que se creó esta página
26
+ id: El identificador único de esta página
27
+ participatory_space: A qué espacio pertenece esta página (proceso participativo, asamblea, etc.)
28
+ title: El título de la página
29
+ updated_at: La fecha de la última actualización de esta página
30
+ url: La URL para esta página
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ es-PY:
17
17
  announcement: Aviso
18
18
  step:
19
19
  announcement: Aviso
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: El contenido de la página
24
+ component: El componente al que pertenece la página
25
+ created_at: La fecha en la que se creó esta página
26
+ id: El identificador único de esta página
27
+ participatory_space: A qué espacio pertenece esta página (proceso participativo, asamblea, etc.)
28
+ title: El título de la página
29
+ updated_at: La fecha de la última actualización de esta página
30
+ url: La URL para esta página
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ es:
17
17
  announcement: Aviso
18
18
  step:
19
19
  announcement: Aviso
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: El contenido de la página
24
+ component: El componente al que pertenece la página
25
+ created_at: La fecha en la que se creó esta página
26
+ id: El identificador único de esta página
27
+ participatory_space: A qué espacio pertenece esta página (proceso participativo, asamblea, etc.)
28
+ title: El título de la página
29
+ updated_at: La fecha de la última actualización de esta página
30
+ url: La URL para esta página
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ eu:
17
17
  announcement: Oharra
18
18
  step:
19
19
  announcement: Oharra
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: Orriaren gorputza
24
+ component: Orriaren osagaia honi dagokio
25
+ created_at: Zein datatan sortu zen orri hau
26
+ id: Orri honen identifikatzaile bakarra
27
+ participatory_space: Zein espaziori dagokio (adibidez, Prozesu Parte-hartzailea edo Batzarra) orri hau
28
+ title: Orriaren izenburua
29
+ updated_at: Zein egunetan eguneratu zen azken aldiz orri hau
30
+ url: Orri honetarakko URLa
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ fi-pl:
17
17
  announcement: Ilmoitus
18
18
  step:
19
19
  announcement: Ilmoitus
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: Sivun tekstisisältö
24
+ component: Sivun komponentti
25
+ created_at: Sivun laatimisaika
26
+ id: Sivun yksilöivä tunniste
27
+ participatory_space: Mihin osallistumistilaan (esim. prosessi tai ryhmä) tämä sivu kuuluu
28
+ title: Sivun otsikko
29
+ updated_at: Sivun viimeisimmän päivityksen ajankohta
30
+ url: Sivun URL-osoite
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ fi:
17
17
  announcement: Ilmoitus
18
18
  step:
19
19
  announcement: Ilmoitus
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: Sivun tekstisisältö
24
+ component: Sivun komponentti
25
+ created_at: Sivun laatimisaika
26
+ id: Sivun yksilöivä tunniste
27
+ participatory_space: Mihin osallistumistilaan (esim. prosessi tai ryhmä) tämä sivu kuuluu
28
+ title: Sivun otsikko
29
+ updated_at: Sivun viimeisimmän päivityksen ajankohta
30
+ url: Sivun URL-osoite
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ fr-CA:
17
17
  announcement: Message d'annonce
18
18
  step:
19
19
  announcement: Message d'annonce
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: Le corps de la page
24
+ component: Le composant auquel appartient la page
25
+ created_at: La date de création de cette page
26
+ id: L'identifiant unique de cette page
27
+ participatory_space: À quel espace appartient la page (par exemple Processus participatif, ou Assemblée)
28
+ title: Le titre de la page
29
+ updated_at: La dernière date de mise à jour de cette page
30
+ url: L'URL de cette page
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -17,6 +17,17 @@ fr:
17
17
  announcement: Message d'annonce
18
18
  step:
19
19
  announcement: Message d'annonce
20
+ open_data:
21
+ help:
22
+ pages:
23
+ body: Le corps de la page
24
+ component: Le composant auquel appartient la page
25
+ created_at: La date de création de cette page
26
+ id: L'identifiant unique de cette page
27
+ participatory_space: À quel espace appartient la page (par exemple Processus participatif, ou Assemblée)
28
+ title: Le titre de la page
29
+ updated_at: La dernière date de mise à jour de cette page
30
+ url: L'URL de cette page
20
31
  pages:
21
32
  admin:
22
33
  models:
@@ -16,6 +16,17 @@ ja:
16
16
  announcement: お知らせ
17
17
  step:
18
18
  announcement: お知らせ
19
+ open_data:
20
+ help:
21
+ pages:
22
+ body: ページの本文
23
+ component: ページが属するコンポーネント
24
+ created_at: このページの作成日時
25
+ id: ページの固有ID
26
+ participatory_space: このページが所属するスペース(参加型プロセス、参加スペースなど)
27
+ title: ページタイトル
28
+ updated_at: このページの最終更新日時
29
+ url: このページの URL
19
30
  pages:
20
31
  admin:
21
32
  models:
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDeletedAtToDecidimPagesPages < ActiveRecord::Migration[7.0]
4
+ def change
5
+ add_column :decidim_pages_pages, :deleted_at, :datetime
6
+ add_index :decidim_pages_pages, :deleted_at
7
+ end
8
+ end
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  "homepage_uri" => "https://decidim.org",
20
20
  "source_code_uri" => "https://github.com/decidim/decidim"
21
21
  }
22
- s.required_ruby_version = "~> 3.2.0"
22
+ s.required_ruby_version = "~> 3.3.0"
23
23
 
24
24
  s.name = "decidim-pages"
25
25
  s.summary = "Decidim pages module"
@@ -3,13 +3,13 @@
3
3
  module Decidim
4
4
  module Pages
5
5
  class PageType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::TimestampsInterface
7
+
6
8
  description "A page"
7
9
 
8
- field :id, GraphQL::Types::ID, null: false
9
- field :title, Decidim::Core::TranslatedFieldType, "The title of this page (same as the component name).", null: false
10
10
  field :body, Decidim::Core::TranslatedFieldType, "The body of this page.", null: true
11
- field :created_at, Decidim::Core::DateTimeType, "The time this page was created", null: false
12
- field :updated_at, Decidim::Core::DateTimeType, "The time this page was updated", null: false
11
+ field :id, GraphQL::Types::ID, "The id of the page", null: false
12
+ field :title, Decidim::Core::TranslatedFieldType, "The title of this page (same as the component name).", null: false
13
13
  end
14
14
  end
15
15
  end
@@ -6,16 +6,15 @@ module Decidim
6
6
  graphql_name "Pages"
7
7
  description "A pages component of a participatory space."
8
8
 
9
- field :pages, Decidim::Pages::PageType.connection_type, null: true, connection: true
9
+ field :page, Decidim::Pages::PageType, "A single Page object", null: true do
10
+ argument :id, GraphQL::Types::ID, "The id of the Page requested", required: true
11
+ end
12
+ field :pages, Decidim::Pages::PageType.connection_type, "A collection of Pages", null: true, connection: true
10
13
 
11
14
  def pages
12
15
  Page.where(component: object).includes(:component)
13
16
  end
14
17
 
15
- field :page, Decidim::Pages::PageType, null: true do
16
- argument :id, GraphQL::Types::ID, required: true
17
- end
18
-
19
18
  def page(**args)
20
19
  Page.where(component: object).find_by(id: args[:id])
21
20
  end
@@ -32,8 +32,8 @@ Decidim.register_component(:pages) do |component|
32
32
 
33
33
  component.register_stat :pages_count do |components, start_at, end_at|
34
34
  pages = Decidim::Pages::Page.where(component: components)
35
- pages = pages.where("created_at >= ?", start_at) if start_at.present?
36
- pages = pages.where("created_at <= ?", end_at) if end_at.present?
35
+ pages = pages.where(created_at: start_at..) if start_at.present?
36
+ pages = pages.where(created_at: ..end_at) if end_at.present?
37
37
  pages.count
38
38
  end
39
39
 
@@ -49,6 +49,18 @@ Decidim.register_component(:pages) do |component|
49
49
  resource.model_class_name = "Decidim::Pages::Page"
50
50
  end
51
51
 
52
+ component.exports :pages do |exports|
53
+ exports.collection do |component_instance|
54
+ Decidim::Pages::Page
55
+ .where(component: component_instance)
56
+ .includes(component: { participatory_space: :organization })
57
+ end
58
+
59
+ exports.include_in_open_data = true
60
+
61
+ exports.serializer Decidim::Pages::PageSerializer
62
+ end
63
+
52
64
  component.seeds do |participatory_space|
53
65
  require "decidim/pages/seeds"
54
66
 
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Pages
5
+ # This class serializes a Page so can be exported to CSV, JSON or other
6
+ # formats.
7
+ class PageSerializer < Decidim::Exporters::Serializer
8
+ include Decidim::ApplicationHelper
9
+ include Decidim::ResourceHelper
10
+
11
+ # Public: Initializes the serializer with a page.
12
+ def initialize(page)
13
+ @page = page
14
+ end
15
+
16
+ # Public: Exports a hash with the serialized data for this page.
17
+ def serialize
18
+ {
19
+ id: page.id,
20
+ title: page.title,
21
+ body: page.body,
22
+ created_at: page.created_at,
23
+ updated_at: page.updated_at,
24
+ participatory_space: {
25
+ id: page.participatory_space.id,
26
+ url: Decidim::ResourceLocatorPresenter.new(page.participatory_space).url
27
+ },
28
+ component: { id: component.id },
29
+ url:
30
+ }
31
+ end
32
+
33
+ private
34
+
35
+ attr_reader :page
36
+ alias resource page
37
+
38
+ def url
39
+ Decidim::ResourceLocatorPresenter.new(page).url
40
+ end
41
+
42
+ def author_fields
43
+ {
44
+ id: resource.author.id,
45
+ name: author_name(resource.author),
46
+ url: author_url(resource.author)
47
+ }
48
+ end
49
+
50
+ def author_name(author)
51
+ translated_attribute(author.name)
52
+ end
53
+
54
+ def author_url(author)
55
+ if author.respond_to?(:nickname)
56
+ profile_url(author) # is a Decidim::User or Decidim::UserGroup
57
+ else
58
+ root_url # is a Decidim::Organization
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-pages version.
5
5
  module Pages
6
6
  def self.version
7
- "0.29.2"
7
+ "0.30.0.rc1"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/pages.rb CHANGED
@@ -10,5 +10,6 @@ module Decidim
10
10
  # This namespace holds the logic of the `Pages` component. This component
11
11
  # allows the admins to create a custom page for a participatory process.
12
12
  module Pages
13
+ autoload :PageSerializer, "decidim/pages/page_serializer"
13
14
  end
14
15
  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.29.2
4
+ version: 0.30.0.rc1
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: 2025-02-12 00:00:00.000000000 Z
13
+ date: 2025-02-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.29.2
21
+ version: 0.30.0.rc1
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.29.2
28
+ version: 0.30.0.rc1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-dev
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.29.2
35
+ version: 0.30.0.rc1
36
36
  type: :development
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.29.2
42
+ version: 0.30.0.rc1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: decidim-participatory_processes
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.29.2
49
+ version: 0.30.0.rc1
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.29.2
56
+ version: 0.30.0.rc1
57
57
  description: A pages component for decidim's participatory processes.
58
58
  email:
59
59
  - josepjaume@gmail.com
@@ -173,6 +173,7 @@ files:
173
173
  - db/migrate/20170110145040_remove_commentable_flag_from_pages.rb
174
174
  - db/migrate/20170220091402_remove_page_feature_titles.rb
175
175
  - db/migrate/20180305133658_rename_features_to_components_at_pages.rb
176
+ - db/migrate/20240828103537_add_deleted_at_to_decidim_pages_pages.rb
176
177
  - decidim-pages.gemspec
177
178
  - lib/decidim/api/page_type.rb
178
179
  - lib/decidim/api/pages_type.rb
@@ -182,6 +183,7 @@ files:
182
183
  - lib/decidim/pages/api.rb
183
184
  - lib/decidim/pages/component.rb
184
185
  - lib/decidim/pages/engine.rb
186
+ - lib/decidim/pages/page_serializer.rb
185
187
  - lib/decidim/pages/seeds.rb
186
188
  - lib/decidim/pages/version.rb
187
189
  homepage: https://decidim.org
@@ -201,14 +203,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
203
  requirements:
202
204
  - - "~>"
203
205
  - !ruby/object:Gem::Version
204
- version: 3.2.0
206
+ version: 3.3.0
205
207
  required_rubygems_version: !ruby/object:Gem::Requirement
206
208
  requirements:
207
209
  - - ">="
208
210
  - !ruby/object:Gem::Version
209
211
  version: '0'
210
212
  requirements: []
211
- rubygems_version: 3.4.10
213
+ rubygems_version: 3.5.11
212
214
  signing_key:
213
215
  specification_version: 4
214
216
  summary: Decidim pages module