Git Product home page Git Product logo

yii2-page-guide's Introduction

latest_tag wiki

Page guide extension

Ability to add guide or assistant to pages for better user orientation or explaining functionality to user

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist matejch/yii2-page-guide "^1.0"

or add

"matejch/yii2-page-guide": "^1.0"

to the requirement section of your composer.json file.

Setup

1. First migrate table

It is necessary for saving rules on pages

./yii migrate --migrationPath=@vendor/matejch/yii2-page-guide/src/migrations

2. Add to modules in your web.php

'pageGuide' => [
    'class' => \matejch\pageGuide\PageGuide::class,
]

3. Add widget on pages you want to use page guide on

By default, it is rendered in place you put widget on

 <?= \matejch\pageGuide\widget\PageAssist::widget() ?>

If you want it to be positioned on right top side, use widget option 'btnPositionCss'

<?= \matejch\pageGuide\widget\PageAssist::widget(['btnPositionCss' => 'position: fixed;top: 100px;right: -2px;']) ?>

4. Additional intro options from intro.js library

If you want you can add intro.js option into widget with attribute introOptions

More options here intro.js

<?= \matejch\pageGuide\widget\PageAssist::widget(['introOptions' => ['showProgress' => true] ]) ?>

5. Optional

Widget now also supports intro.js callbacks

Available callbacks are oncomplete onexit onbeforeexit onchange onbeforechange onafterchange

<?= \matejch\pageGuide\widget\PageAssist::widget(['introCallbacks' => [
    'onchange' => new \yii\web\JsExpression("function (targetElement) { alert('next step'); }")]
]) ?>

Usage

Access index and form for creation of rules with

{key_of_module_you_use_in_web.php}/page-guide/index

1. Create new set of rules

Insert url on your yii web page into first input

Press button go to page that opens url in new window

From this window drag and drop elements you want to use into previous window

You can also set it by hand, just add step number, element id and text

check image of page guide form

2. Add widget to the page you want to use it on

When you are in creator mode, every draggable element is highlighted with blue dashed border

By default, in creator mode all visible input elements on page are set as draggable, and if form is detected on page

also, all elements with form-group class are set.


With widget option 'selectors' (array), you can set multiple class names or ids or other valid css selectors

for picking draggable elements in creator mode.

<?= \matejch\pageGuide\widget\PageAssist::widget(['selectors' => ['.guide','#selectable_id']]) ?>

Here is example how it looks, when rules are set and user can display guide/assistant

yii2-page-guide's People

Contributors

matej-ch avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

bobonov

yii2-page-guide's Issues

Automatically adding step problem

At each drag and drop, a step is automatically added
Also when you edit a guide, a new step is added automatically when opening

The problem is that when you save, an empty step is saved and it is not possible to remove it (see also #4)

This can be solved in 2 ways (or both at same time)

  1. discard empty steps at save time
  2. add a steps delete option

visual step ordering

When changing step order, after saving and reopening the guide, the step number are correct, but they are visually mixed.

I made a PR that solve the problem
#6

introjs should be from bower

introjs assets should be a dependency from bower

add to composer

"bower-asset/intro.js": "^2.9"

and then you can either split assets in 2 different file by moving introjs in new one, like

namespace matejch\pageGuide\assets;

use yii\web\AssetBundle;

class IntroJSAssets extends AssetBundle
{

    public $sourcePath = '@vendor/bower-asset/intro.js/minified/';

    public $css = [
        'introjs.min.css',
    ];

    public $js = [
        'intro.min.js',
    ];
}

Or delete $sourcePath row and specify complete path in each file

    public $css = [
        '@matejch/pageGuide/webcss/assist.min.css',
        '@vendor/bower-asset/intro.js/minified/introjs.min.css',
    ];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.