Completed
Branch EDTR/master (50dd13)
by
unknown
25:34 queued 17:04
created

JqueryAssetManager::addAssets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 36

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 36
rs 9.344
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\services\assets;
4
5
use EventEspresso\core\services\assets\AssetManager;
6
7
class JqueryAssetManager extends AssetManager
8
{
9
    const JS_HANDLE_JQUERY = 'jquery';
10
11
    const JS_HANDLE_JQUERY_COOKIE = 'jquery-cookie';
12
13
    const JS_HANDLE_JQUERY_VALIDATE = 'jquery-validate';
14
15
    const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
16
17
    const JS_HANDLE_JQUERY_UI_DATEPICKER = 'jquery-ui-datepicker';
18
19
    const JS_HANDLE_JQUERY_UI_DRAGGABLE = 'jquery-ui-draggable';
20
21
    const JS_HANDLE_JQUERY_UI_SLIDER = 'jquery-ui-slider';
22
23
    const JS_HANDLE_JQUERY_UI_SORTABLE = 'jquery-ui-sortable';
24
25
    const JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON = 'jquery-ui-timepicker-addon';
26
27
28
29
    /**
30
	 * @inheritDoc
31
	 */
32
	public function addAssets()
33
	{
34
        // register cookie script for future dependencies
35
        $this->addJavascript(
36
            JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
37
            EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js',
38
            ['jquery'],
39
            true,
40
            '2.1'
41
        );
42
43
        $this->addJavascript(
44
            JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE,
45
            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
46
            array(JqueryAssetManager::JS_HANDLE_JQUERY),
47
            true,
48
            '1.15.0'
49
        )->setEnqueueImmediately();
50
51
        $this->addJavascript(
52
            JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
53
            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
54
            array(JqueryAssetManager::JS_HANDLE_JQUERY_VALIDATE),
55
            true,
56
            '1.15.0'
57
        );
58
59
        $this->addJavascript(
60
            JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
61
            EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js',
62
            [
63
                JqueryAssetManager::JS_HANDLE_JQUERY_UI_DATEPICKER,
64
                JqueryAssetManager::JS_HANDLE_JQUERY_UI_SLIDER
65
            ]
66
        );
67
	}
68
}