-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
Templates module #6247
Templates module #6247
Conversation
Hi @decidim/product , is it ok to merge this PR, did you find the time to check it? |
sorry, the window I had open from days ago for this PR needed to be refreshed. @microstudi is is now ready for @decidim/product 's review? |
@tramuntanal I've resolved conflicts. It seems the bug @andreslucena had bumped into is still happening, though. I'm checking it now, I'll tell you both when it's solved. |
Done :) |
Thanks for the update @verarojman ! I've tested in your demo environment and after trying to add a question here of type "short answer" I get a form error but I can't see where the error is because the question can not be open anymore. I guess it was because I was only filling the content in catalan and english is required. |
That staging instance wasn't updated. I had to reset the seeds to put the last version. We will check this, thanks! |
@verarojman to put more context on this, when creating a new question in a template. If there's some error you can't expand the question to see the error. It just doesn't work. |
@microstudi @tramuntanal this seems to be a bug related to the collapsible questions feature, not with the templates module. I'll submit a new PR fixing this. |
Ok, @verarojman so we wait for your bugfix to merge this PR as it is buggy as it is now, thanks! |
The PR fixing the collapsible questions bug is #6565 |
Thanks @verarojman for the persistence 👍 |
@@ -22,6 +22,7 @@ Gem::Specification.new do |s| | |||
|
|||
s.add_dependency "decidim-core", Decidim::Surveys.version | |||
s.add_dependency "decidim-forms", Decidim::Surveys.version | |||
s.add_dependency "decidim-templates", Decidim::Surveys.version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @decidim/core! Should this dependency be moved to decidim-forms
?
As other modules like decidim-meetings
or decidim-elections
also use questionnaires from decidim-forms
or should it be added to each module that has a dependency with decidim-forms
?
s.add_dependency "decidim-forms", Decidim::Meetings.version |
s.add_dependency "decidim-forms", Decidim::Elections.version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, you could used decidim-forms
without templates if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @microstudi 😄, I found this line, in decidim-forms
, that raised an error without decidim-templates
in decidim-elections
:
<% unless questionnaire.questionnaire_for.class == Decidim::Templates::Template %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I'd say that's a bug, we should check for Template to be defined. But you may also be right and just made forms depedant on Templates whether you use it or not. We'll look at it, thanks for pointing that out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, nice feature by the way!
* Update module version * Add module dependency to surveys gemspec * Start modules template * gemspec * Add templates to Gemfile * Show templates index * Update readme * Layout for templates index * Put template model inside Templates module * Setup layout for templates application controller * Add decidim-templates to Gemfile * Update templates table * Create templatable concern * Create basic permissions and permission specs * Create has_templates controller concern * Update views * Add attributes in commands * Create basic template model spec * Remove templates from gemfile * Fix permissions * Simplify views * Add questionnaires controller for questionnaire_templates * Edit questionnaire templates * Update templates layout * Add stylesheet and remove unused concern * Refactor routing * Add templates to generator * Cleanup Create template command * Add action messages * Copy template command * Destroy command * Add decidim-templates to root Gemfile * Add templates migrations to the main generator. Set github workflow * Move template spec * Delete unused file * Add factory for questionnaire template * Add example for resource_name * Add template form spec * Add permissions specs * Add system spec for create questionnaire template * Add examples for edit a template questionnaire * Add system specs for updating questionnaire_template * Add example for listing templates * Destroy templatable when template is destroyed * More intelligible titles * Remove templates controller, root to questionnaire templates * Remove unused file * Update routes and permissions for preview * Embed preview in edit template view * Remove permission for preview * Add specs for copy and destroy template * Add spec for #resource_name in template model * Clean up #resource_name * Spec for template name validation * Spec for error in copy template action * Always include templates in admin menu * Menu item links to templates/questionnaire_templates * Remove unused invalid broadcast from destroy in controller * Fix title for questionnaire form * Show questionnaire preview with frontend styles * Move questionnaire preview outside of form * Fix typo in locale * Normalize locales * Lint erb * Make rubocop happy * Add spec for preview questionnaire * Revert has_questionnaire to previous state * Decouple templates from organization * Hide export dropdown if editing a questionnaire template * Add search for templates autocomplete * Load default options in autocomplete_select * Skip template action * WIP on preview action for templates * More WIP on autocomplete changeURL * More WIP on autocomplete changeURL * Setup cancelTokenSource in autocomplete handleChange * Autocomplete calling changeURL * Load questionnaire in preview action * Load script on autocomplete change * Load preview when choosing questionnaire template * Improve create-from-template flow * Apply questionnaire template action * Fix specs * Allow using template for creating template * remove byebug * WIP on spec for choose template * Check for template preview in spec * Add spec for select options count in choose template * Specs for when template choose screen isn't shown * Rubocop corrections * Rubocop corrections * Spec for applying a template to a questionnaire * Fix some specs * Normalize locales * Update decidim_app-design gemfile * Fix errors in views * Remove unused keys from locales * Lint js * Style lint * Rubocop corrections * Use trait for questionnaire in system spec * Update bundle.js * Remove trailing whitespace * Fix form builder spec * Add route for answer_options * Fix spec failing due to translation * Add 'wait: 5' to prevent failure in spec * Lint * Fix typo * Add newline at end of file * Change naming in spec * Make table headers more descriptive * Fix formbuilder spec with change_url * Add class to "create from template" button wrapper * Lint erb * Fix admin menu spec * Normalize locales * Fix rubocop offenses * Add documentation in template model * Rename `resource` to more specific `questionnaire` in command * Add inline documentation to admin_engine * Inline docs * Remove empty block * Use symbol for routes module * Add documentation .md file for templates * Lint markdown * Implement public_url method in questionnaires controller * Remove trailing whitespace * Review changes and suggestions * Remove parentheses * Update required ruby version for decidim-templates * Use accept_confirm in spec * Refactor translations in helper * Update CI config for templates * Remove spec setting nil name and failing for db constraint * Templatable questionnaire is pristine if no questions answered * Add seeds for templates * Add specs for questionnaire's #pristine? method * Remove superfluous stylesheet includes * Revert "Remove superfluous stylesheet includes" This reverts commit 8c779ea. * Remove superfluous stylesheet includes * add templates css manifest for compilation * Hide preview and answers buttons when editing a questionnaire template * Prevent choosing templates when creating a template * Prevent overriding template variable in templatable.rb * Move helper include to has_questionnaire controller concern * Add test for editing questionnaire for new template * Fix rubocop offenses Co-authored-by: Ivan Vergés <ivan@platoniq.net>
* Remove Markdown doc * Add documentation with Antora (AsciiDoc format - .adoc) Adds sections: * configure * customize * develop * install * services Also adds: * a README explaining the relationship with the documentation repository available in https://github.com/decidim/documentation * antora metadata file so we can build these sections in the same website * Fix Antora name for docs * Rename advanced pages to Concerns * Add Authorizations customize from module's README * Move 'add_authorizable_action' to 'permissions' * Move 'adding_fixtures_aka_dummy_content' to 'components' * Move 'how_to_create_a_module' to 'components' * Remove 'upgrading', now it's in 'update' * Install guide: fix error in 'whatever' gem (it's 'whenever') * Install guide: fix error in RAILS_ENV order in commands * Install guide: fix command for open_data export * Install guide: fix link to Contribution guide * Develop guide: add example apps * Architecture docs Add first version of c4model diagrams with PlantUML * https://c4model.com/ * https://plantuml.com/ * https://github.com/RicardoNiepel/C4-PlantUML * Add some explanation of modules types (with Components link) * Configure: ENV VARS and Initializer This moves ENV VARS configuration docs to its own page. We also create a new page for explaining Decidim's initializer settings (config/initializer/decidim.rb). For the moment is mostly a copy paste with nice formating, but the idea is to expand it. * Sync "Make maps actually configurable" by @ahukkanen Extracted from #6340 * Sync "Templates module" by @verarojman Extracted from #6247 * Sync "Configure Decidim Bulletin Board" by @leio10 Extracted from #6420 * Sync "Add a task to fix locale issues" by @microstudi Extracted from #6510 * Update versions in SECURITY.adoc * Convert CONTRIBUTING.md to AsciiDoc * Convert README.md to AsciiDoc * Clarify CONTRIBUTING and links to docs site * Remove Markdown linter CI * Sync "Update documentation for `decidim` OAuth social provider" by @tramuntanal Extracted from #6607 * Sync "Generate changelog entries" by @tramuntanal Extracted from #6794 * Fix link in oauth.adoc * Sync "Improve moderation panel" by @beagleknight Extracted from #6677 * Removes trailing whitespaces Co-authored-by: Oliver Valls <199462+tramuntanal@users.noreply.github.com>
🎩 What? Why?
This new module provides functionality to create templates for virtually any Decidim model from a new section in the admin panel.
The current implementation allows to create Questionnaire templates which can be managed (CRUD) and used whenever a questionnaire is created, to provide default values which can be changed afterwards.
📌 Related Issues
📋 Subtasks
📷 Screenshots
Create questionnaire template
Edit questionnaire template
Create survey from questionnaire template
Create meeting registration form without a questionnaire template