onmotion / yii2-page-assessments
Page assessment feature for your Yii2 application based on Vue2.
Installs: 835
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 0
Open Issues: 12
Language:Vue
Type:yii2-extension
Requires
- php: >=7.0.0
- onmotion/yii2-babel-polyfill-assets: *
- onmotion/yii2-vuejs-assets: >=1.0.1
- yiisoft/yii2: >=2.0.1
- dev-master
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/npm_and_yarn/widget/assets/qs-6.5.3
- dev-dependabot/npm_and_yarn/widget/assets/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/widget/assets/loader-utils-and-loader-utils-and-error-overlay-webpack-plugin-and-webpack-cli-1.4.2
- dev-dependabot/npm_and_yarn/widget/assets/terser-4.8.1
- dev-dependabot/npm_and_yarn/widget/assets/eventsource-1.1.1
- dev-dependabot/npm_and_yarn/widget/assets/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/widget/assets/node-sass-7.0.0
- dev-dependabot/npm_and_yarn/widget/assets/postcss-7.0.36
- dev-dependabot/npm_and_yarn/widget/assets/lodash-4.17.21
- dev-dependabot/npm_and_yarn/widget/assets/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/widget/assets/npm-6.14.6
- dev-dependabot/npm_and_yarn/widget/assets/websocket-extensions-0.1.4
- dev-docs
This package is auto-updated.
Last update: 2024-11-08 05:03:20 UTC
README
The page assessment (polls) module for Yii2 framework based on Vue2.
Fluent view:
Static (embeded in a page) view:
Installation
Just run:
composer require onmotion/yii2-page-assessments
or add
"onmotion/yii2-page-assessments": "*"
to the require section of your composer.json file.
apply migration:
php yii migrate --migrationPath=@vendor/onmotion/yii2-page-assessments/migrations
Usage
You must add to your config:
'modules' => [ //... 'assessments' => [ 'class' => 'onmotion\assessments\Module', ], //... ],
Then you can use the widget somewhere on the page:
Example:
echo \onmotion\assessments\widget\AssessmentWidget::widget([ 'fluent' => false, // static or fluent view // 'timeout' => 1500 // timeout bafore appearance. 'questions' => [ 'Is this page helpful?', // simple question [ 'title' => 'What do you think about it?', 'maxValue' => 6, // 'allowComment' => true // allow optional comment 'allowComment' => [1, 2, 3], // allow comment only if value is 1, 2 or 3. // 'model' => (new SomeActiveRecordModel), // 'repeat' => true, // whether to force repeat the question // 'afterVoteText' => [ // show comment after got a vote (string || array) // 1 => 'It\'s ok! 👌', // 2 => 'Could be better 😎', // 3 => 'So so...', // 4 => 'Very good!', // 5 => 'Perfect!', // ] ] ] ]);
Options
Events
assessment.show - when an assessment item appears.
assessment.end - when all questions are completed.
document.addEventListener('assessment.show', function (e) { console.log(e.detail); }, false);
You can change icons as you want, for example:
echo \onmotion\assessments\widget\AssessmentWidget::widget([ 'fluent' => true, 'questions' => $questions, 'icons' => [ 1 => '<span class="assessment-icon"><span class="assessment-icon__angry"></span></span>', 2 => '<span class="assessment-icon"><span class="assessment-icon__sad"></span></span>', 3 => '<span class="assessment-icon"><span class="assessment-icon__thinking"></span></span>', 4 => '<span class="assessment-icon"><span class="assessment-icon__happy"></span></span>', 5 => '<span class="assessment-icon"><span class="assessment-icon__in-love"></span></span>', ] ]);