Badsender-com / LePatron.email

LePatron is an opensource email builder allowing to industrialize your email template production. Build tailor made email templates and make them available to your non-technical users.
https://www.lepatron.email
GNU General Public License v3.0
73 stars 12 forks source link

Save Customized Block in LePatron #712

Closed omar-bear closed 1 year ago

omar-bear commented 1 year ago

Feature: Save Customized Block in LePatron

Description:

The primary goal of this feature is to allow users of LePatron to save an existing block after customizing it. This will enable them to add it to their predefined block library for future reuse.

Implementation Details:

Directory:

packages/editor/src/js/ext

Steps:

  1. Modal for Saving Block Attributes: create a new file save-block-modal based on the other modals in the editor, for example: packages/editor/src/js/vue/components/send-test/test-modal.js

    • Path: packages/editor/src/js/ext/save-block-modal.js
    • Task:
      • Upon clicking the save button, a modal will pop up.
      • The modal will have two text input fields:
      • Name (mandatory)
      • Category (optional)
      • The "Save" button within the modal will be disabled initially.
  2. Integrate Save Button in block-wysiwyg.tmpl.html:

    • Path: packages/editor/src/tmpl/block-wysiwyg.tmpl.html
    • Task:
      • Add a new button with a Font Awesome icon for saving the block.
      • This button will be placed alongside other block tools like delete, duplicate, etc.
  3. Control Button Behavior in viewmodel.js: in this file we already defined the role of the buttons duplicate and delete and here we need to define the behavior of save block button

    • Path: packages/editor/src/js/viewmodel.js
    • Task:
      • Define the behavior of the save button.
      • When clicked, it should trigger the modal from save-block-modal.js.

Acceptance Criteria:

Result:

Example after saving the block:

Save Block Example

FlorianGille commented 1 year ago

If you can also add the translation for the text when we are hovering the button to save (with the download icon), check the public/lang/mosaico-fr.json file.

sonarcloud[bot] commented 1 year ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
45.0% 45.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint