Skip to content

demovox is a tool to collect signatures for Swiss popular initiatives by offering the visitor a personalized signature sheet.

License

Notifications You must be signed in to change notification settings

spschweiz/demovox

Repository files navigation

SP Schweiz

Demovox

Demovox (dev readme)

Build Status open bugs WordPress plugin downloads WordPress plugin version WordPress tested version

Description

WordPress plugin demovox is a tool to collect signatures for Swiss popular initiatives by offering the visitor a personalized signature sheet.

This Plugin was developed by the Socialist Party of Switzerland, it was initially built for the popular initiative Prämien-Entlastungs-Initiative in 2019. It has been used for numerous others since, like umverkehR (2020) and AHVx13 (2020) by SGB, to name a few.

Requirements

  • PHP >= 7.4
  • MySQL >= 5.6.5
  • WordPress >= 4.9
  • SSL certificate for HTTPS (non-https is only allowed for development)
  • Optional feature requires the PHP modules "GMP" or "BC Math"

Productive installation

Simply install the WordPress plugin demovox from within the Plugin manager of your WordPress installation. You can find the admin manual or the prebuilt Zip-File for manual installation on demovox.ch.

If this plugin is of help for you, please consider a donation and write a review on the demovox WordPress plugin page.

Development

Please send us a pull request for any improvements on the plugin.

Installation

  1. Pull demovox from git
  2. Use the webserver wordpress container from docker-compose.yaml (for development purposes), which includes a WordPress webserver and mailhog for mail testing. Or use your own webserver (see below).
  3. Install required project packages and generate assets with grunt (see below)
  4. Activate the plugin through the 'Plugins' menu in local WordPress
  5. Place shortcodes [demovox_form] on a page or use the automatically generated page
  6. Optionally use and [demovox_count] to show the number of collected signatures and [demovox_optin] for opt-in edit form
  7. Configure the plugin in WordPress admin. Allow non-https access in the advanced settings of the plugin and disable "Redirect clients to secure HTTPS".

Own webserver

You can use your own webserver (see requirements above) and map the demovox directory to [WordPressDir]/wp-content/plugins/demovox.

While developing, you might want to work on a web server without SSL. Enable WP_DEBUG in wp-config.php and you probably want to disable WP_DEBUG_DISPLAY. Then open the Advanced settings of the plugin in the WordPress backend and disable "Redirect clients to secure HTTPS".

Building assets

Docker container

Start buildserver from docker/docker-compose.yaml. The plugin is monted in /var/demovox/

Manual installation (instead of docker container)

If you don't want to use the docker container, install the following build dependencies: Python, Ruby, node.js (use v9, as po2mo fails with higher versions; tested with v9.11.2 installed with NVM), composer, gettext for translation conversion. Install required NPM packages with npm install grunt-cli sass -g

Install required project packages

Go to demovox directory (e.g. cd /var/demovox/)

npm install
composer install --no-dev

Install required packages for tests:

composer install
chmod +x bin/install-wp-tests.sh
bin/install-wp-tests.sh wordpress_test root root demovox-db

Grunt Commands

Generate assets for development

Generate minified JS and CSS files and compile .mo translation files:

grunt buildAssets
Build for wordpress.org repo

Build plugin snapshot in demovox/buildWpOrg which can be uploaded to the WordPress.org repository:

grunt buildWpOrg
Running the tests

There are just a few PHPUnit tests available yet, feel free to contribute some and send a pull-request to increase the test coverage.

grunt test
Other commands

Build plugin snapshot as ZIP in demovox/demovox.zip, which can be uploaded to a remote WordPress installation:

grunt buildZip

Show all other available commands:

grunt availabletasks

Generate translation files

.po files are used to manage translations. They are generated from source code and converted into .mo files for runtime by the grunt task (you can also use bin/translations-po2mo.sh).

Generate frontend and admin .po files

cd bin && ./translations-generate.sh

Generate admin settings .po files

Enable WP_DEBUG and open the System info (WP backend -> demovox -> System info) to generate the .po file for the setting strings.

Changelog

See README.txt and commit log.

Authors

See also the list of contributors who participated in this project. Thanks to @dbu for code review.

License

This project is licensed under the GPLv3 License - see the LICENSE.txt file for details.

About

demovox is a tool to collect signatures for Swiss popular initiatives by offering the visitor a personalized signature sheet.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages