Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newsletter templates #5887

Merged
merged 52 commits into from
Apr 22, 2020
Merged

Add newsletter templates #5887

merged 52 commits into from
Apr 22, 2020

Conversation

mrcasals
Copy link
Contributor

@mrcasals mrcasals commented Mar 23, 2020

🎩 What? Why?

This PR adds a system of newsletter templates to choose from. See #5727 (comment) for a more detailed description of the system, product-wise.

📌 Related Issues

📋 Subtasks

  • Add ID to content blocks scopes, so that each newsletter has related content block(s).
  • Port the current newsletter template to a content block, with the newsletter_template scope. It should have the template and its fields (body, which is i18n HTML).
  • Modify the admin section to create newsletters using a template.
  • Preview newsletters using the template
  • Be able to edit newsletters using templates
  • Fix test suite
  • Migrate old newsletters to the new system
  • Add new template with the requested new fields (see Change design notifications and newsletter #5727 for a definition and [WIP] Add image and CTA to newsletters #5866 for a first draft)
    • Add image
  • Extra: try to preview templates using the content block fields (randomly filling them out)
    • Preview images
    • Improve template gallery layout to include realtime previews
  • Fix form I18n
    • Add missing locales for content block forms
  • Add documentation regarding the feature
  • Add CHANGELOG entry

📷 Screenshots (optional)

Newsletter template gallery:

image

Previewing the old template:

image

Using the old tempalte to send a newsletter:

image

Previewing the new template (I've scrolled the iframe to show how it looks):

image

Using the new template to send newsletters:

image

@mrcasals mrcasals self-assigned this Mar 23, 2020
@mrcasals mrcasals force-pushed the newsletter-templates branch 5 times, most recently from b5e514d to 702c2a5 Compare March 26, 2020 07:50
@mrcasals
Copy link
Contributor Author

mrcasals commented Apr 1, 2020

@agustibr thanks! 👀

@mrcasals
Copy link
Contributor Author

mrcasals commented Apr 2, 2020

@decidim/core everything should be good now! Can you review the PR please?

@mrcasals
Copy link
Contributor Author

@decidim/core this has been approved by @decidim/product, can you review it please? 😄

@mrcasals mrcasals requested review from microstudi and tramuntanal and removed request for tramuntanal April 15, 2020 06:46
Copy link
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buff, huge work here!

I've left some trivial comments and suggestions. 😄

Also I've found that when you preview a template, there's no way to change your mind and go back and select another template. Is it possible to add an "back to all templates" button or similar?

docs/advanced/newsletter_templates.md Show resolved Hide resolved
docs/advanced/newsletter_templates.md Outdated Show resolved Hide resolved
decidim-core/lib/decidim/settings_manifest.rb Show resolved Hide resolved
decidim-blogs/spec/system/explore_posts_spec.rb Outdated Show resolved Hide resolved

class AddIdToContentBlocksScope < ActiveRecord::Migration[5.2]
def change
add_column :decidim_content_blocks, :scope_id, :integer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope_id is very confusing because Decidim has the concept of Sope as a model, but I can't think of an alternative: parent_id, related_id, ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, me neither... 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use container_id so we get rid of the confusion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

container_id makes me think that the container block is contained inside another resource... What about resource_id?

@mrcasals
Copy link
Contributor Author

@tramuntanal all changes addressed, can you check them please?

Also I've found that when you preview a template, there's no way to change your mind and go back and select another template. Is it possible to add an "back to all templates" button or similar?

I intentionally left the "New newsletter" button in the sidebar so you can go back to that page, adding a "back" button seemed redundant to me!

Copy link
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry to insist of the renaming of scope_id but I'm sure it will be a source of confusion when coming back to newsletter templates 🙏


class AddIdToContentBlocksScope < ActiveRecord::Migration[5.2]
def change
add_column :decidim_content_blocks, :scope_id, :integer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use container_id so we get rid of the confusion?

@mrcasals
Copy link
Contributor Author

@tramuntanal I've renamed that field to scoped_resource_id, I think it's clearer this way 😄 Can you rereview it please?

@mrcasals mrcasals added the contract: PAM2020 Barcelona City Council contract label Apr 22, 2020
Copy link
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of using container_id was to avoid relating this field with the concept of Decidim::Scope.
Using scoped_resource_id relates this field with resources. We would have to rename it again if someday we use content blocks in participatory spaces or faqs. 😢

Anyway, I don't want to be a stopper for this feature, so I'm approving.

@tramuntanal tramuntanal merged commit f9112d3 into develop Apr 22, 2020
@tramuntanal tramuntanal deleted the newsletter-templates branch April 22, 2020 14:21
faithngetich pushed a commit to faithngetich/decidim that referenced this pull request Apr 28, 2020
* Add ID to content blocks scope

* Add basic newsletter template

* List templates

* Fix menu highlight

* Create newsletters from template

* Use cells as templates in newsletters

* Update newsletters

* Use public name in newsletter templates list

* Rename `scope` column to `scope_name`

It seems to be a reserved column name

* Fix rubocop complaints

* Fix tests

* Fix lints

* Fix locales

* Fix more specs

* Fix more specs

* Fix specs

* Lint ERB file

* Migrate newsletters to templates

* Preview newsletter templates

* Lint code

* Normalize locales

* Add new newsletter template

* Add locales for newsletter templates forms

* Add image to new newsletter template

* Preview newsletter template images

* Make previews work for multiple images

* Improve templates gallery

* Refactor classes to help implementing new templates

* Add docs

* Fix errors

* Fix specs

* Remove wrong check

* Use correct image extension

* Add changelog

* Improve docs

* Improve message

* Add index on content blocks scope_id

* Remove uniqueness of index

* Add link on docs

* Use lorem ipsum as preview text

* Fix index

* Fix index column name

* Normalize locales

* Fix spec to match expected value

* Fix test

* Improve docs

* Revert "Remove wrong check"

This reverts commit bbbeaa4.

* Rename content block `scope_id` to `scoped_resource_id`

* Fix migration name
ace pushed a commit to aspgems/decidim that referenced this pull request Apr 29, 2020
* develop: (65 commits)
  Add newsletter templates (decidim#5887)
  Send email with order summary on order checkout (decidim#6006)
  Change small details on documentation (decidim#5890)
  feat(budgets): Projects filter by multiple categories (decidim#5992)
  Participant renewable verifications (decidim#5854)
  Update .simplecov (decidim#5949)
  Remove legacy assembly types (decidim#5617)
  Don't follow the header x forwarded host by default (decidim#5899)
  Add two CTA on initiative (decidim#5838)
  Conversations with more than one participant (decidim#5861)
  Fix supported versions in SECURITY.md (decidim#5957)
  Add a parameter to specify a list of whitelist ip on /system (decidim#5669)
  Fix error 500 when showing new debate notifications (decidim#5964)
  Upgrade sassc and sassc-rails dependency (decidim#5910)
  Add minimum projects rule to Budgets (decidim#5865)
  Update changelog with current develop
  Fix bad formatted changelog entries
  fix move proposal endorsements migration (decidim#5953)
  Fix the scopes picker rendereding escaped characters (decidim#5939)
  Revert "Fix the scopes picker rendereding escaped characters (decidim#5793)" (decidim#5937)
  ...
@leio10 leio10 mentioned this pull request May 13, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contract: PAM2020 Barcelona City Council contract in-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change design notifications and newsletter
4 participants