decidim-enhanced_textwork 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd03b51331f0a2832bd33cc372e8e43525b173429e7e01b995272725cf5ac479
4
- data.tar.gz: 99b59e96c6a4e1dfa4ddecefc058f76a82808761c10e927e8841aad0a442434e
3
+ metadata.gz: e50e738133449552794c57d2d7206684929959472339d907b607db25a22161c8
4
+ data.tar.gz: e7827f8503056f34a52e0661e810bcb73cd501fd7651376a6cc24a3bdf90b226
5
5
  SHA512:
6
- metadata.gz: ba7f20ed5ccb967f177d9c737537a89cfceaff66fa0e25ff02a62c9f8c03c5f65272a88124060e51ad3e24efb39c6470c87ed75581017d7b12bfc08314aa0774
7
- data.tar.gz: b9457fe3a96c9b8878bf1020bc90cc108db86f2372eb3c387b30d4c1d50efc12f63f3f4d23a0d0cd4aea1c8693888905a5e25c39b87252ac50670c874f8dfeb2
6
+ metadata.gz: 8b717843a437cb1227be1aa8ddd7cbd2da8b6d926712273493febb53f0909a402f57c79a66d012b406a3f0b3e647fc1f30ec0a778234871364848b6c4c2dc75d
7
+ data.tar.gz: 03a6ce8a6590b71d015baadfc52dfa9e0f0eca75433a325b373b06c09339c4a4e47fc85b9ccb4e3f3e208f778c7e976f432839cb7ca1fe9c83b312434be98b8c
data/README.md CHANGED
@@ -2,9 +2,15 @@
2
2
 
3
3
  The EnhancedTextwork module allows users to contribute to a participatory process with text work by creating paragraphs.
4
4
 
5
+ This module is based on decidim-proposals and was developed to improve the existing participatory_texts functionality to better suite specific needs we found in Austria.
6
+
5
7
  ## Usage
6
8
 
7
- EnhancedTextwork will be available as a Component for a Participatory Process.
9
+ EnhancedTextwork is available as a Component for a Participatory Process.
10
+
11
+ We also extended some javascript code using webpacker.
12
+
13
+ That means it needs at least **Decidim v0.25.0** to work.
8
14
 
9
15
  ## Installation
10
16
 
@@ -20,6 +26,85 @@ And then execute:
20
26
  bundle
21
27
  ```
22
28
 
29
+ ## Improvements
30
+
31
+ Within the scope of our project we improved a few parts of the feature called “participatory_text”, wich is part of the core module “decidim-proposals”.
32
+ Unfortunately after finishing our work the decidim core team in Barcelona did not have available resources to integrate our results in the decidim core. For this reason we created a new module based on “decidim-proposals” including our participatory_text enhancements.
33
+
34
+ We named the base model for participatory texts `Paragraph` (instead of Proposal).
35
+
36
+ Our improvements span 3 areas described in the following sections:
37
+
38
+ * [Participatory Text Frontend](#participatory-text-frontend)
39
+ * [Participatory Text Result Export](#participatory-text-result-export)
40
+ * [Participatory Text Import](#participatory-text-import)
41
+
42
+ ### Participatory Text Frontend
43
+
44
+ To make working with a participatory text easier and more user friendly we rebuilt the design for the overview page and created a sidebar.
45
+
46
+ #### Sidebar
47
+
48
+ We called the page including the sidebar “overview” and added it to the routes of the proposals module:
49
+
50
+ [lib/decidim/enhanced_textwork/engine.rb](lib/decidim/enhanced_textwork/engine.rb#L21)
51
+
52
+ #### Comments
53
+
54
+ To change the style of the comments to better fit the sidebar and to improve user experience we created a new class `Decidim::EnhancedTextwork::CommentsCell` that derives from the global `Decidim::Comments::CommentsCell`.
55
+ That allowed us to overwrite the global comments cell view while still using most of the other views of the global `CommentsCell`.
56
+
57
+ * [comments_cell.rb](app/cells/decidim/enhanced_textwork/comments_cell.rb)
58
+ * [show.erb](app/cells/decidim/enhanced_textwork/comments/show.erb)
59
+
60
+
61
+ #### Adding component settings
62
+
63
+ We added a setting to allow hiding proposal titles, because numbered titles did not make sense for long texts. In our new module we enable this setting by default.
64
+
65
+ In Decidim every component (module) allows you to define settings that get then displayed automatically in the components edit view using the localized texts configured for example under `en.decidim.components.enhanced_textwork.settings.global.hide_participatory_text_titles_enabled`
66
+
67
+ ```rb
68
+ settings.attribute :hide_participatory_text_titles_enabled, type: :boolean, default: true
69
+ ```
70
+
71
+ [see component.rb](lib/decidim/enhanced_textwork/component.rb#L50)
72
+
73
+ ## Participatory Text Result Export
74
+
75
+ Because `enhanced_textwork` is based on `proposals`, the `Paragraph` model is based on the `Proposal` model. For this reason all the features existing for proposals can also be used on enhanced_textwork. One of those features is the export of results. Until now exporting results was optimized for proposals and didn’t make a lot of sense for exporting the results of collaborative work on a big text document consisting of many sections.
76
+
77
+ Existing export formats for proposals were defined in [decidim-core](https://github.com/decidim/decidim/tree/develop/decidim-core/lib/decidim/exporters):
78
+
79
+ * CSV
80
+ * Excel
81
+ * JSON
82
+
83
+ We decided to add a new Word/docx export exclusively in the enhanced_textwork module:
84
+
85
+ [lib/decidim/exporters/word.rb](lib/decidim/exporters/word.rb)
86
+
87
+ To enable it, the export formats need to be defined in the component configuration:
88
+
89
+ [lib/decidim/proposals/component.rb](lib/decidim/enhanced_textwork/component.rb#L144)
90
+
91
+ To export in docx format we decided to use a more recent fork of the [caracal](https://github.com/commonlit/caracal) gem by commonlit.
92
+
93
+ ## Participatory Text Import
94
+
95
+ To add a new page for importing text directly from a rich text editor we had to add some routes in the [admin_engine](lib/decidim/enhanced_textwork/admin_engine.rb#L33)
96
+
97
+ Decidim already uses the [quill](https://github.com/quilljs/quill) richt text editor in many places, so we decided to also use it.
98
+
99
+ We created a new [HtmlToMarkdown](lib/decidim/enhanced_textwork/html_to_markdown.rb) class that uses the [kramdown](https://github.com/gettalong/kramdown) gem to convert the html output of the quill editor to markdown, which is already the supported format for importing documents.
100
+
101
+ The new class had to be autoloaded from the [proposals component](lib/decidim/enhanced_textwork.rb#L21)
102
+
103
+ ### Allow to delete single drafts
104
+
105
+ After importing text it was not possible to delete single proposals/paragraphs of the draft. You could only delete all proposals together.
106
+ Therefore we added a delete button to each draft and added a new [command](app/commands/decidim/enhanced_textwork/destroy_paragraph.rb) and a [destroy_draft controller action](app/controllers/decidim/enhanced_textwork/admin/paragraphs_controller.rb#L147) that we also added to the [routes in the admin_engine](lib/decidim/enhanced_textwork/admin_engine.rb#L25 ):
107
+
23
108
  ### Configuring Similarity
24
109
 
25
110
  `pg_trgm` is a PostgreSQL extension providing simple fuzzy string matching used in the Paragraph wizard to find similar published paragraphs (title and the body).
@@ -57,8 +142,8 @@ When processing participatory text documents three kinds of secions are taken in
57
142
 
58
143
  ## Contributing
59
144
 
60
- See [Decidim](https://github.com/decidim/decidim).
145
+ Feel free to use the issues and pull requests to contribute to this module.
61
146
 
62
147
  ## License
63
148
 
64
- See [Decidim](https://github.com/decidim/decidim).
149
+ AGPL-3.0
@@ -33,3 +33,5 @@
33
33
 
34
34
  <%= cell("decidim/enhanced_textwork/comments", @paragraph) %>
35
35
  </div>
36
+
37
+ <%= javascript_pack_tag "decidim_enhanced_textwork" %>
@@ -48,7 +48,7 @@ Decidim.register_component(:enhanced_textwork) do |component|
48
48
  type: :boolean, default: true,
49
49
  readonly: ->(context) { Decidim::EnhancedTextwork::Paragraph.where(component: context[:component]).any? }
50
50
  settings.attribute :hide_participatory_text_titles_enabled, type: :boolean, default: true
51
- settings.attribute :amendments_enabled, type: :boolean, default: false
51
+ settings.attribute :amendments_enabled, type: :boolean, default: true
52
52
  settings.attribute :amendments_wizard_help_text, type: :text, translated: true, editor: true, required: false
53
53
  settings.attribute :announcement, type: :text, translated: true, editor: true
54
54
  settings.attribute :new_paragraph_body_template, type: :text, translated: true, editor: true, required: false
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds decidim-paragraphs version.
5
5
  module EnhancedTextwork
6
6
  def self.version
7
- "1.0.0"
7
+ "1.0.1"
8
8
  end
9
9
 
10
10
  def self.compat_decidim_version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-enhanced_textwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Rusa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commonlit-caracal