piedweb / conversation
Conversation Extension for PiedWeb/CMS
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
Requires (Dev)
- phpunit/phpunit: ^9
- squizlabs/php_codesniffer: ^3.5
- symfony/phpunit-bridge: ^5.0
This package is auto-updated.
Last update: 2022-02-24 23:59:32 UTC
README
Conversation
Extending a page with comments, a contact form or just an user input...
Add conversation on a static website.
Initially dev to be use with PiedWeb/CMS.
Installation
Via Packagist :
# Get the Bundle
composer require piedweb/conversation
# Add the route to your Routes:
conversation:
resource: '@PiedWebConversationBundle/Resources/config/routes/conversation.yaml'
Update sonata_admin config file to add an navlink :
groups:
app.admin.group.page:
label: admin.label.content
label_catalogue: messages
items:
- piedweb.admin.page
- piedweb.admin.media
- piedweb.admin.conversation
(or ln -s -f vendor/piedweb/cms-bundle/src/Resources/config/packages/sonata_admin.fullFeatured.yaml config/packages/sonata_admin.yaml
)
Usage
You can use it as is and include it in your Page with two manners :
# Load form via fetch (javascript) <div data-live="{{ path('piedweb_cms_conversation', {'type': 'newsletter', 'referring': 'nslttr-'~page.slug}) }}"></div> # Render form in Controller {{ render(controller('PiedWeb\\ConversationBundle\\Controller\\ConversationFormController::show')) }} # Or add a button to click before loading block <button src-data-live="{{ path('piedweb_cms_conversation', {'type': 'newsletter', 'referring': 'nslttr-'~page.slug}) }}" class="btn btn-primary">Register</button>
Activate the data-live
element with piedweb-cms-js-helper :
import { liveForm } from "piedweb-cms-js-helpers/src/helpers";
// on dom changed and on page loaded :
liveBlock();
```
### Render published comment
```twig
{{ showConversation(referring[, orderBy, limit, template]) }}
Get mail notification for new message
Configure the bundle (piedweb_conversation.notification_emailTo
) and programm a cron :
bin/console conversation:notify
Customization
Small rendering customization
By overriding @PiedWebConversation/_conversation.html.twig
(or '@PiedWebConversation/_'.$type.'Step'.$step.'.html.twig
or '@PiedWebConversation/_'.$type.$referring.'Step'.$step.'.html.twig
).
Create a new form
Per default, there is 3 form types : newsletter
, message
and multiStepMessage
.
Add a new class in config piedweb_conversation.form.myNewType: myNewFormClass
.
TODO
- Test
- Remove bootstrap class from default view files (by moving them to PiedWebThemeComponent)
- Email validator for new message
Contributors
License
MIT (see the LICENSE file for details)