patternfly-sass 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bowerrc +1 -1
- data/.gitignore +2 -4
- data/.travis.yml +6 -3
- data/README.md +187 -26
- data/Rakefile +21 -17
- data/assets/stylesheets/patternfly/_variables.scss +206 -206
- data/bower.json +11 -12
- data/lib/patternfly-sass/version.rb +2 -2
- data/patternfly-sass.gemspec +1 -1
- data/{tests → spec}/capture.js +0 -0
- data/spec/compare_spec.rb +15 -5
- data/{tests/patternfly → spec/html}/accordions.html +0 -0
- data/{tests/patternfly → spec/html}/alerts.html +0 -0
- data/{tests/patternfly → spec/html}/badges.html +0 -0
- data/{tests/patternfly → spec/html}/basic.html +0 -0
- data/{tests/patternfly → spec/html}/blank-slate.html +0 -0
- data/{tests/patternfly → spec/html}/bootstrap-combobox.html +0 -0
- data/{tests/patternfly → spec/html}/bootstrap-select.html +0 -0
- data/{tests/patternfly → spec/html}/bootstrap-treeview-2.html +0 -0
- data/{tests/patternfly → spec/html}/bootstrap-treeview.html +0 -0
- data/{tests/patternfly → spec/html}/breadcrumbs.html +0 -0
- data/{tests/patternfly → spec/html}/buttons.html +0 -0
- data/{tests/patternfly → spec/html}/code.html +0 -0
- data/{tests/patternfly → spec/html}/dashboard.html +0 -0
- data/{tests/patternfly → spec/html}/datatables-columns.html +0 -0
- data/{tests/patternfly → spec/html}/datatables.html +0 -0
- data/{tests/patternfly → spec/html}/dist/css/patternfly.css +0 -0
- data/{tests/patternfly → spec/html}/dist/css/patternfly.min.css +0 -0
- data/{tests/patternfly → spec/html}/dist/css/styles.css +0 -0
- data/{tests/patternfly → spec/html}/dist/css/styles.min.css +0 -0
- data/{tests/patternfly → spec/html}/dropdowns.html +0 -0
- data/{tests/patternfly → spec/html}/form.html +0 -0
- data/{tests/patternfly → spec/html}/forms.html +0 -0
- data/{tests/patternfly → spec/html}/icons.html +0 -0
- data/{tests/patternfly → spec/html}/img/dashboard-1.png +0 -0
- data/{tests/patternfly → spec/html}/img/dashboard-2.png +0 -0
- data/{tests/patternfly → spec/html}/img/dashboard-3.png +0 -0
- data/{tests/patternfly → spec/html}/img/dashboard-4.png +0 -0
- data/{tests/patternfly → spec/html}/index.html +0 -0
- data/{tests/patternfly → spec/html}/infotip.html +0 -0
- data/{tests/patternfly → spec/html}/labels.html +0 -0
- data/{tests/patternfly → spec/html}/list-group.html +0 -0
- data/{tests/patternfly → spec/html}/login.html +0 -0
- data/{tests/index.html → spec/html/main.html} +0 -0
- data/{tests/patternfly → spec/html}/modals.html +0 -0
- data/{tests/patternfly → spec/html}/navbar.html +0 -0
- data/{tests/patternfly → spec/html}/pagination.html +0 -0
- data/{tests/patternfly → spec/html}/panels.html +0 -0
- data/{tests/patternfly → spec/html}/popovers.html +0 -0
- data/{tests/patternfly → spec/html}/progress-bars.html +0 -0
- data/{tests/patternfly → spec/html}/search.html +0 -0
- data/{tests/patternfly → spec/html}/spinner.html +0 -0
- data/{tests/patternfly → spec/html}/tab.html +0 -0
- data/{tests/patternfly → spec/html}/tables.html +0 -0
- data/{tests/patternfly → spec/html}/tabs.html +0 -0
- data/{tests/patternfly → spec/html}/tests.css +0 -0
- data/{tests/patternfly → spec/html}/tooltip.html +0 -0
- data/{tests/patternfly → spec/html}/typography-2.css +0 -0
- data/{tests/patternfly → spec/html}/typography-2.html +0 -0
- data/{tests/patternfly → spec/html}/typography.html +0 -0
- data/tasks/converter.rb +6 -9
- metadata +103 -626
- data/package.json +0 -28
- data/tests/components/bootstrap-combobox/.bower.json +0 -14
- data/tests/components/bootstrap-combobox/.gitignore +0 -1
- data/tests/components/bootstrap-combobox/README.md +0 -59
- data/tests/components/bootstrap-combobox/css/bootstrap-combobox.css +0 -42
- data/tests/components/bootstrap-combobox/js/bootstrap-combobox.js +0 -438
- data/tests/components/bootstrap-combobox/js/tests/index.html +0 -29
- data/tests/components/bootstrap-combobox/js/tests/unit/bootstrap-combobox.js +0 -323
- data/tests/components/bootstrap-combobox/js/tests/vendor/jquery.js +0 -9597
- data/tests/components/bootstrap-combobox/js/tests/vendor/qunit.css +0 -244
- data/tests/components/bootstrap-combobox/js/tests/vendor/qunit.js +0 -2152
- data/tests/components/bootstrap-combobox/less/combobox.less +0 -55
- data/tests/components/bootstrap-select/.bower.json +0 -38
- data/tests/components/bootstrap-select/CONTRIBUTING.md +0 -87
- data/tests/components/bootstrap-select/README.md +0 -61
- data/tests/components/bootstrap-select/bootstrap-select.css +0 -309
- data/tests/components/bootstrap-select/bootstrap-select.jquery.json +0 -29
- data/tests/components/bootstrap-select/bootstrap-select.js +0 -972
- data/tests/components/bootstrap-select/bootstrap-select.min.css +0 -7
- data/tests/components/bootstrap-select/bootstrap-select.min.js +0 -8
- data/tests/components/bootstrap-select/bower.json +0 -29
- data/tests/components/bootstrap-select/composer.json +0 -17
- data/tests/components/bootstrap-select/i18n/defaults-cs-CZ.js +0 -29
- data/tests/components/bootstrap-select/i18n/defaults-cz-CZ.min.js +0 -6
- data/tests/components/bootstrap-select/i18n/defaults-de_DE.js +0 -29
- data/tests/components/bootstrap-select/i18n/defaults-de_DE.min.js +0 -6
- data/tests/components/bootstrap-select/i18n/defaults-es-CL.js +0 -29
- data/tests/components/bootstrap-select/i18n/defaults-es-CL.min.js +0 -6
- data/tests/components/bootstrap-select/i18n/defaults-eu.js +0 -30
- data/tests/components/bootstrap-select/i18n/defaults-eu.min.js +0 -6
- data/tests/components/bootstrap-select/i18n/defaults-it_IT.js +0 -32
- data/tests/components/bootstrap-select/i18n/defaults-it_IT.min.js +0 -1
- data/tests/components/bootstrap-select/i18n/defaults-nl_NL.js +0 -32
- data/tests/components/bootstrap-select/i18n/defaults-nl_NL.min.js +0 -7
- data/tests/components/bootstrap-select/i18n/defaults-pl_PL.js +0 -29
- data/tests/components/bootstrap-select/i18n/defaults-pl_PL.min.js +0 -6
- data/tests/components/bootstrap-select/i18n/defaults-pt_BR.js +0 -33
- data/tests/components/bootstrap-select/i18n/defaults-pt_BR.min.js +0 -7
- data/tests/components/bootstrap-select/i18n/defaults-ru-RU.js +0 -31
- data/tests/components/bootstrap-select/i18n/defaults-ru_RU.min.js +0 -6
- data/tests/components/bootstrap-select/i18n/defaults-zh_CN.js +0 -30
- data/tests/components/bootstrap-select/i18n/defaults-zh_CN.min.js +0 -6
- data/tests/components/bootstrap-select/package.json +0 -31
- data/tests/components/bootstrap-select/test.html +0 -62
- data/tests/components/bootstrap-treeview/.bower.json +0 -38
- data/tests/components/bootstrap-treeview/Gruntfile.js +0 -62
- data/tests/components/bootstrap-treeview/LICENSE +0 -202
- data/tests/components/bootstrap-treeview/README.md +0 -289
- data/tests/components/bootstrap-treeview/app.js +0 -29
- data/tests/components/bootstrap-treeview/bower.json +0 -29
- data/tests/components/bootstrap-treeview/dist/bootstrap-treeview.min.css +0 -1
- data/tests/components/bootstrap-treeview/dist/bootstrap-treeview.min.js +0 -1
- data/tests/components/bootstrap-treeview/package.json +0 -18
- data/tests/components/bootstrap-treeview/public/css/bootstrap-treeview.css +0 -37
- data/tests/components/bootstrap-treeview/public/example-dom.html +0 -59
- data/tests/components/bootstrap-treeview/public/index.html +0 -333
- data/tests/components/bootstrap-treeview/public/js/bootstrap-treeview.js +0 -455
- data/tests/components/bootstrap-treeview/screenshot/default.PNG +0 -0
- data/tests/components/bootstrap-treeview/src/css/bootstrap-treeview.css +0 -37
- data/tests/components/bootstrap-treeview/src/js/bootstrap-treeview.js +0 -455
- data/tests/components/datatables-colreorder/.bower.json +0 -22
- data/tests/components/datatables-colreorder/License.txt +0 -20
- data/tests/components/datatables-colreorder/Readme.md +0 -39
- data/tests/components/datatables-colreorder/bower.json +0 -12
- data/tests/components/datatables-colreorder/css/dataTables.colReorder.css +0 -14
- data/tests/components/datatables-colreorder/examples/alt_insert.xml +0 -30
- data/tests/components/datatables-colreorder/examples/col_filter.xml +0 -38
- data/tests/components/datatables-colreorder/examples/colvis.xml +0 -26
- data/tests/components/datatables-colreorder/examples/fixedcolumns.xml +0 -43
- data/tests/components/datatables-colreorder/examples/fixedheader.xml +0 -27
- data/tests/components/datatables-colreorder/examples/index.xml +0 -19
- data/tests/components/datatables-colreorder/examples/jqueryui.xml +0 -27
- data/tests/components/datatables-colreorder/examples/new_init.xml +0 -23
- data/tests/components/datatables-colreorder/examples/predefined.xml +0 -30
- data/tests/components/datatables-colreorder/examples/realtime.xml +0 -30
- data/tests/components/datatables-colreorder/examples/reset.xml +0 -41
- data/tests/components/datatables-colreorder/examples/scrolling.xml +0 -27
- data/tests/components/datatables-colreorder/examples/server_side.xml +0 -38
- data/tests/components/datatables-colreorder/examples/simple.xml +0 -25
- data/tests/components/datatables-colreorder/examples/state_save.xml +0 -26
- data/tests/components/datatables-colreorder/images/.DS_Store +0 -0
- data/tests/components/datatables-colreorder/images/insert.png +0 -0
- data/tests/components/datatables-colreorder/js/dataTables.colReorder.js +0 -1372
- data/tests/components/datatables-colreorder/make.sh +0 -31
- data/tests/components/datatables-colvis/.bower.json +0 -22
- data/tests/components/datatables-colvis/License.txt +0 -20
- data/tests/components/datatables-colvis/README.md +0 -38
- data/tests/components/datatables-colvis/bower.json +0 -12
- data/tests/components/datatables-colvis/css/dataTables.colVis.css +0 -185
- data/tests/components/datatables-colvis/css/dataTables.colvis.jqueryui.css +0 -41
- data/tests/components/datatables-colvis/examples/.DS_Store +0 -0
- data/tests/components/datatables-colvis/examples/button_order.xml +0 -26
- data/tests/components/datatables-colvis/examples/exclude_columns.xml +0 -28
- data/tests/components/datatables-colvis/examples/group_columns.xml +0 -40
- data/tests/components/datatables-colvis/examples/index.xml +0 -18
- data/tests/components/datatables-colvis/examples/jqueryui.xml +0 -28
- data/tests/components/datatables-colvis/examples/mouseover.xml +0 -28
- data/tests/components/datatables-colvis/examples/new_init.xml +0 -26
- data/tests/components/datatables-colvis/examples/restore.xml +0 -33
- data/tests/components/datatables-colvis/examples/simple.xml +0 -25
- data/tests/components/datatables-colvis/examples/text.xml +0 -29
- data/tests/components/datatables-colvis/examples/title_callback.xml +0 -30
- data/tests/components/datatables-colvis/examples/two_tables.xml +0 -24
- data/tests/components/datatables-colvis/examples/two_tables_identical.xml +0 -35
- data/tests/components/datatables-colvis/js/dataTables.colVis.js +0 -1123
- data/tests/components/datatables-colvis/make.sh +0 -28
- data/tests/components/datatables/.bower.json +0 -42
- data/tests/components/datatables/Contributing.md +0 -18
- data/tests/components/datatables/Readme.md +0 -53
- data/tests/components/datatables/bower.json +0 -32
- data/tests/components/datatables/license.txt +0 -20
- data/tests/components/datatables/media/css/jquery.dataTables.css +0 -455
- data/tests/components/datatables/media/css/jquery.dataTables.min.css +0 -1
- data/tests/components/datatables/media/css/jquery.dataTables_themeroller.css +0 -416
- data/tests/components/datatables/media/images/Sorting icons.psd +0 -0
- data/tests/components/datatables/media/images/favicon.ico +0 -0
- data/tests/components/datatables/media/images/sort_asc.png +0 -0
- data/tests/components/datatables/media/images/sort_asc_disabled.png +0 -0
- data/tests/components/datatables/media/images/sort_both.png +0 -0
- data/tests/components/datatables/media/images/sort_desc.png +0 -0
- data/tests/components/datatables/media/images/sort_desc_disabled.png +0 -0
- data/tests/components/datatables/media/js/jquery.dataTables.js +0 -14951
- data/tests/components/datatables/media/js/jquery.dataTables.min.js +0 -160
- data/tests/components/datatables/media/js/jquery.js +0 -5
- data/tests/components/google-code-prettify/.bower.json +0 -26
- data/tests/components/google-code-prettify/CHANGES.html +0 -172
- data/tests/components/google-code-prettify/COPYING +0 -191
- data/tests/components/google-code-prettify/README-zh-Hans.html +0 -143
- data/tests/components/google-code-prettify/README.html +0 -233
- data/tests/components/google-code-prettify/README.md +0 -54
- data/tests/components/google-code-prettify/bin/prettify.min.css +0 -1
- data/tests/components/google-code-prettify/bin/prettify.min.js +0 -30
- data/tests/components/google-code-prettify/bin/run_prettify.min.js +0 -34
- data/tests/components/google-code-prettify/bower.json +0 -16
- data/tests/components/google-code-prettify/examples/quine.html +0 -55
- data/tests/components/google-code-prettify/src/lang-apollo.js +0 -51
- data/tests/components/google-code-prettify/src/lang-basic.js +0 -32
- data/tests/components/google-code-prettify/src/lang-clj.js +0 -64
- data/tests/components/google-code-prettify/src/lang-css.js +0 -159
- data/tests/components/google-code-prettify/src/lang-dart.js +0 -88
- data/tests/components/google-code-prettify/src/lang-erlang.js +0 -92
- data/tests/components/google-code-prettify/src/lang-go.js +0 -58
- data/tests/components/google-code-prettify/src/lang-hs.js +0 -101
- data/tests/components/google-code-prettify/src/lang-lisp.js +0 -94
- data/tests/components/google-code-prettify/src/lang-llvm.js +0 -61
- data/tests/components/google-code-prettify/src/lang-lua.js +0 -59
- data/tests/components/google-code-prettify/src/lang-matlab.js +0 -180
- data/tests/components/google-code-prettify/src/lang-ml.js +0 -56
- data/tests/components/google-code-prettify/src/lang-mumps.js +0 -139
- data/tests/components/google-code-prettify/src/lang-n.js +0 -65
- data/tests/components/google-code-prettify/src/lang-pascal.js +0 -32
- data/tests/components/google-code-prettify/src/lang-proto.js +0 -35
- data/tests/components/google-code-prettify/src/lang-r.js +0 -57
- data/tests/components/google-code-prettify/src/lang-rd.js +0 -47
- data/tests/components/google-code-prettify/src/lang-scala.js +0 -54
- data/tests/components/google-code-prettify/src/lang-sql.js +0 -58
- data/tests/components/google-code-prettify/src/lang-tcl.js +0 -62
- data/tests/components/google-code-prettify/src/lang-tex.js +0 -46
- data/tests/components/google-code-prettify/src/lang-vb.js +0 -66
- data/tests/components/google-code-prettify/src/lang-vhdl.js +0 -34
- data/tests/components/google-code-prettify/src/lang-wiki.js +0 -53
- data/tests/components/google-code-prettify/src/lang-xq.js +0 -67
- data/tests/components/google-code-prettify/src/lang-yaml.js +0 -27
- data/tests/components/google-code-prettify/src/prettify.css +0 -52
- data/tests/components/google-code-prettify/src/prettify.js +0 -1655
- data/tests/components/google-code-prettify/src/run_prettify.js +0 -1905
- data/tests/components/google-code-prettify/styles/demo.html +0 -61
- data/tests/components/google-code-prettify/styles/desert.css +0 -34
- data/tests/components/google-code-prettify/styles/doxy.css +0 -64
- data/tests/components/google-code-prettify/styles/index.html +0 -89
- data/tests/components/google-code-prettify/styles/sons-of-obsidian.css +0 -118
- data/tests/components/google-code-prettify/styles/sunburst.css +0 -51
- data/tests/components/jquery/.bower.json +0 -38
- data/tests/components/jquery/MIT-LICENSE.txt +0 -21
- data/tests/components/jquery/bower.json +0 -28
- data/tests/components/jquery/dist/jquery.js +0 -9210
- data/tests/components/jquery/dist/jquery.min.js +0 -5
- data/tests/components/jquery/dist/jquery.min.map +0 -1
- data/tests/components/jquery/src/ajax.js +0 -786
- data/tests/components/jquery/src/ajax/jsonp.js +0 -89
- data/tests/components/jquery/src/ajax/load.js +0 -75
- data/tests/components/jquery/src/ajax/parseJSON.js +0 -13
- data/tests/components/jquery/src/ajax/parseXML.js +0 -28
- data/tests/components/jquery/src/ajax/script.js +0 -64
- data/tests/components/jquery/src/ajax/var/nonce.js +0 -5
- data/tests/components/jquery/src/ajax/var/rquery.js +0 -3
- data/tests/components/jquery/src/ajax/xhr.js +0 -136
- data/tests/components/jquery/src/attributes.js +0 -11
- data/tests/components/jquery/src/attributes/attr.js +0 -141
- data/tests/components/jquery/src/attributes/classes.js +0 -158
- data/tests/components/jquery/src/attributes/prop.js +0 -94
- data/tests/components/jquery/src/attributes/support.js +0 -35
- data/tests/components/jquery/src/attributes/val.js +0 -161
- data/tests/components/jquery/src/callbacks.js +0 -205
- data/tests/components/jquery/src/core.js +0 -502
- data/tests/components/jquery/src/core/access.js +0 -60
- data/tests/components/jquery/src/core/init.js +0 -123
- data/tests/components/jquery/src/core/parseHTML.js +0 -39
- data/tests/components/jquery/src/core/ready.js +0 -97
- data/tests/components/jquery/src/core/var/rsingleTag.js +0 -4
- data/tests/components/jquery/src/css.js +0 -450
- data/tests/components/jquery/src/css/addGetHookIf.js +0 -22
- data/tests/components/jquery/src/css/curCSS.js +0 -57
- data/tests/components/jquery/src/css/defaultDisplay.js +0 -70
- data/tests/components/jquery/src/css/hiddenVisibleSelectors.js +0 -15
- data/tests/components/jquery/src/css/support.js +0 -96
- data/tests/components/jquery/src/css/swap.js +0 -28
- data/tests/components/jquery/src/css/var/cssExpand.js +0 -3
- data/tests/components/jquery/src/css/var/getStyles.js +0 -12
- data/tests/components/jquery/src/css/var/isHidden.js +0 -13
- data/tests/components/jquery/src/css/var/rmargin.js +0 -3
- data/tests/components/jquery/src/css/var/rnumnonpx.js +0 -5
- data/tests/components/jquery/src/data.js +0 -178
- data/tests/components/jquery/src/data/Data.js +0 -181
- data/tests/components/jquery/src/data/accepts.js +0 -20
- data/tests/components/jquery/src/data/var/data_priv.js +0 -5
- data/tests/components/jquery/src/data/var/data_user.js +0 -5
- data/tests/components/jquery/src/deferred.js +0 -149
- data/tests/components/jquery/src/deprecated.js +0 -13
- data/tests/components/jquery/src/dimensions.js +0 -50
- data/tests/components/jquery/src/effects.js +0 -648
- data/tests/components/jquery/src/effects/Tween.js +0 -114
- data/tests/components/jquery/src/effects/animatedSelector.js +0 -13
- data/tests/components/jquery/src/event.js +0 -868
- data/tests/components/jquery/src/event/ajax.js +0 -13
- data/tests/components/jquery/src/event/alias.js +0 -39
- data/tests/components/jquery/src/event/support.js +0 -9
- data/tests/components/jquery/src/exports/amd.js +0 -24
- data/tests/components/jquery/src/exports/global.js +0 -32
- data/tests/components/jquery/src/intro.js +0 -44
- data/tests/components/jquery/src/jquery.js +0 -37
- data/tests/components/jquery/src/manipulation.js +0 -580
- data/tests/components/jquery/src/manipulation/_evalUrl.js +0 -18
- data/tests/components/jquery/src/manipulation/support.js +0 -32
- data/tests/components/jquery/src/manipulation/var/rcheckableType.js +0 -3
- data/tests/components/jquery/src/offset.js +0 -207
- data/tests/components/jquery/src/outro.js +0 -1
- data/tests/components/jquery/src/queue.js +0 -142
- data/tests/components/jquery/src/queue/delay.js +0 -22
- data/tests/components/jquery/src/selector-native.js +0 -172
- data/tests/components/jquery/src/selector-sizzle.js +0 -14
- data/tests/components/jquery/src/selector.js +0 -1
- data/tests/components/jquery/src/serialize.js +0 -111
- data/tests/components/jquery/src/sizzle/dist/sizzle.js +0 -2067
- data/tests/components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
- data/tests/components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
- data/tests/components/jquery/src/traversing.js +0 -199
- data/tests/components/jquery/src/traversing/findFilter.js +0 -100
- data/tests/components/jquery/src/traversing/var/rneedsContext.js +0 -6
- data/tests/components/jquery/src/var/arr.js +0 -3
- data/tests/components/jquery/src/var/class2type.js +0 -4
- data/tests/components/jquery/src/var/concat.js +0 -5
- data/tests/components/jquery/src/var/hasOwn.js +0 -5
- data/tests/components/jquery/src/var/indexOf.js +0 -5
- data/tests/components/jquery/src/var/pnum.js +0 -3
- data/tests/components/jquery/src/var/push.js +0 -5
- data/tests/components/jquery/src/var/rnotwhite.js +0 -3
- data/tests/components/jquery/src/var/slice.js +0 -5
- data/tests/components/jquery/src/var/strundefined.js +0 -3
- data/tests/components/jquery/src/var/support.js +0 -4
- data/tests/components/jquery/src/var/toString.js +0 -5
- data/tests/components/jquery/src/wrap.js +0 -79
@@ -1,455 +0,0 @@
|
|
1
|
-
/* =========================================================
|
2
|
-
* bootstrap-treeview.js v1.0.2
|
3
|
-
* =========================================================
|
4
|
-
* Copyright 2013 Jonathan Miles
|
5
|
-
* Project URL : http://www.jondmiles.com/bootstrap-treeview
|
6
|
-
*
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
* you may not use this file except in compliance with the License.
|
9
|
-
* You may obtain a copy of the License at
|
10
|
-
*
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
*
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
* See the License for the specific language governing permissions and
|
17
|
-
* limitations under the License.
|
18
|
-
* ========================================================= */
|
19
|
-
|
20
|
-
;(function($, window, document, undefined) {
|
21
|
-
|
22
|
-
/*global jQuery, console*/
|
23
|
-
|
24
|
-
'use strict';
|
25
|
-
|
26
|
-
var pluginName = 'treeview';
|
27
|
-
|
28
|
-
var Tree = function(element, options) {
|
29
|
-
|
30
|
-
this.$element = $(element);
|
31
|
-
this._element = element;
|
32
|
-
this._elementId = this._element.id;
|
33
|
-
this._styleId = this._elementId + '-style';
|
34
|
-
|
35
|
-
this.tree = [];
|
36
|
-
this.nodes = [];
|
37
|
-
this.selectedNode = {};
|
38
|
-
|
39
|
-
this._init(options);
|
40
|
-
};
|
41
|
-
|
42
|
-
Tree.defaults = {
|
43
|
-
|
44
|
-
injectStyle: true,
|
45
|
-
|
46
|
-
levels: 2,
|
47
|
-
|
48
|
-
expandIcon: 'glyphicon glyphicon-plus',
|
49
|
-
collapseIcon: 'glyphicon glyphicon-minus',
|
50
|
-
emptyIcon: 'glyphicon',
|
51
|
-
nodeIcon: 'glyphicon glyphicon-stop',
|
52
|
-
|
53
|
-
color: undefined, // '#000000',
|
54
|
-
backColor: undefined, // '#FFFFFF',
|
55
|
-
borderColor: undefined, // '#dddddd',
|
56
|
-
onhoverColor: '#F5F5F5',
|
57
|
-
selectedColor: '#FFFFFF',
|
58
|
-
selectedBackColor: '#428bca',
|
59
|
-
|
60
|
-
enableLinks: false,
|
61
|
-
highlightSelected: true,
|
62
|
-
showBorder: true,
|
63
|
-
showTags: false,
|
64
|
-
|
65
|
-
// Event handler for when a node is selected
|
66
|
-
onNodeSelected: undefined
|
67
|
-
};
|
68
|
-
|
69
|
-
Tree.prototype = {
|
70
|
-
|
71
|
-
remove: function() {
|
72
|
-
|
73
|
-
this._destroy();
|
74
|
-
$.removeData(this, 'plugin_' + pluginName);
|
75
|
-
$('#' + this._styleId).remove();
|
76
|
-
},
|
77
|
-
|
78
|
-
_destroy: function() {
|
79
|
-
|
80
|
-
if (this.initialized) {
|
81
|
-
this.$wrapper.remove();
|
82
|
-
this.$wrapper = null;
|
83
|
-
|
84
|
-
// Switch off events
|
85
|
-
this._unsubscribeEvents();
|
86
|
-
}
|
87
|
-
|
88
|
-
// Reset initialized flag
|
89
|
-
this.initialized = false;
|
90
|
-
},
|
91
|
-
|
92
|
-
_init: function(options) {
|
93
|
-
|
94
|
-
if (options.data) {
|
95
|
-
if (typeof options.data === 'string') {
|
96
|
-
options.data = $.parseJSON(options.data);
|
97
|
-
}
|
98
|
-
this.tree = $.extend(true, [], options.data);
|
99
|
-
delete options.data;
|
100
|
-
}
|
101
|
-
|
102
|
-
this.options = $.extend({}, Tree.defaults, options);
|
103
|
-
|
104
|
-
this._setInitialLevels(this.tree, 0);
|
105
|
-
|
106
|
-
this._destroy();
|
107
|
-
this._subscribeEvents();
|
108
|
-
this._render();
|
109
|
-
},
|
110
|
-
|
111
|
-
_unsubscribeEvents: function() {
|
112
|
-
|
113
|
-
this.$element.off('click');
|
114
|
-
|
115
|
-
if (typeof (this.options.onNodeSelected) === 'function') {
|
116
|
-
this.$element.off('nodeSelected');
|
117
|
-
}
|
118
|
-
},
|
119
|
-
|
120
|
-
_subscribeEvents: function() {
|
121
|
-
|
122
|
-
this._unsubscribeEvents();
|
123
|
-
|
124
|
-
this.$element.on('click', $.proxy(this._clickHandler, this));
|
125
|
-
|
126
|
-
if (typeof (this.options.onNodeSelected) === 'function') {
|
127
|
-
this.$element.on('nodeSelected', this.options.onNodeSelected);
|
128
|
-
}
|
129
|
-
},
|
130
|
-
|
131
|
-
_clickHandler: function(event) {
|
132
|
-
|
133
|
-
if (!this.options.enableLinks) { event.preventDefault(); }
|
134
|
-
|
135
|
-
var target = $(event.target),
|
136
|
-
classList = target.attr('class') ? target.attr('class').split(' ') : [],
|
137
|
-
node = this._findNode(target);
|
138
|
-
|
139
|
-
if ((classList.indexOf('click-expand') != -1) ||
|
140
|
-
(classList.indexOf('click-collapse') != -1)) {
|
141
|
-
// Expand or collapse node by toggling child node visibility
|
142
|
-
this._toggleNodes(node);
|
143
|
-
this._render();
|
144
|
-
}
|
145
|
-
else if (node) {
|
146
|
-
if (this._isSelectable(node)) {
|
147
|
-
this._setSelectedNode(node);
|
148
|
-
} else {
|
149
|
-
this._toggleNodes(node);
|
150
|
-
this._render();
|
151
|
-
}
|
152
|
-
}
|
153
|
-
},
|
154
|
-
|
155
|
-
// Looks up the DOM for the closest parent list item to retrieve the
|
156
|
-
// data attribute nodeid, which is used to lookup the node in the flattened structure.
|
157
|
-
_findNode: function(target) {
|
158
|
-
|
159
|
-
var nodeId = target.closest('li.list-group-item').attr('data-nodeid'),
|
160
|
-
node = this.nodes[nodeId];
|
161
|
-
|
162
|
-
if (!node) {
|
163
|
-
console.log('Error: node does not exist');
|
164
|
-
}
|
165
|
-
return node;
|
166
|
-
},
|
167
|
-
|
168
|
-
// Actually triggers the nodeSelected event
|
169
|
-
_triggerNodeSelectedEvent: function(node) {
|
170
|
-
|
171
|
-
this.$element.trigger('nodeSelected', [$.extend(true, {}, node)]);
|
172
|
-
},
|
173
|
-
|
174
|
-
// Handles selecting and unselecting of nodes,
|
175
|
-
// as well as determining whether or not to trigger the nodeSelected event
|
176
|
-
_setSelectedNode: function(node) {
|
177
|
-
|
178
|
-
if (!node) { return; }
|
179
|
-
|
180
|
-
if (node === this.selectedNode) {
|
181
|
-
this.selectedNode = {};
|
182
|
-
}
|
183
|
-
else {
|
184
|
-
this._triggerNodeSelectedEvent(this.selectedNode = node);
|
185
|
-
}
|
186
|
-
|
187
|
-
this._render();
|
188
|
-
},
|
189
|
-
|
190
|
-
// On initialization recurses the entire tree structure
|
191
|
-
// setting expanded / collapsed states based on initial levels
|
192
|
-
_setInitialLevels: function(nodes, level) {
|
193
|
-
|
194
|
-
if (!nodes) { return; }
|
195
|
-
level += 1;
|
196
|
-
|
197
|
-
var self = this;
|
198
|
-
$.each(nodes, function addNodes(id, node) {
|
199
|
-
|
200
|
-
if (level >= self.options.levels) {
|
201
|
-
self._toggleNodes(node);
|
202
|
-
}
|
203
|
-
|
204
|
-
// Need to traverse both nodes and _nodes to ensure
|
205
|
-
// all levels collapsed beyond levels
|
206
|
-
var nodes = node.nodes ? node.nodes : node._nodes ? node._nodes : undefined;
|
207
|
-
if (nodes) {
|
208
|
-
return self._setInitialLevels(nodes, level);
|
209
|
-
}
|
210
|
-
});
|
211
|
-
},
|
212
|
-
|
213
|
-
// Toggle renaming nodes -> _nodes, _nodes -> nodes
|
214
|
-
// to simulate expanding or collapsing a node.
|
215
|
-
_toggleNodes: function(node) {
|
216
|
-
|
217
|
-
if (!node.nodes && !node._nodes) {
|
218
|
-
return;
|
219
|
-
}
|
220
|
-
|
221
|
-
if (node.nodes) {
|
222
|
-
node._nodes = node.nodes;
|
223
|
-
delete node.nodes;
|
224
|
-
}
|
225
|
-
else {
|
226
|
-
node.nodes = node._nodes;
|
227
|
-
delete node._nodes;
|
228
|
-
}
|
229
|
-
},
|
230
|
-
|
231
|
-
// Returns true if the node is selectable in the tree
|
232
|
-
_isSelectable: function (node) {
|
233
|
-
return node.selectable !== false;
|
234
|
-
},
|
235
|
-
|
236
|
-
_render: function() {
|
237
|
-
|
238
|
-
var self = this;
|
239
|
-
|
240
|
-
if (!self.initialized) {
|
241
|
-
|
242
|
-
// Setup first time only components
|
243
|
-
self.$element.addClass(pluginName);
|
244
|
-
self.$wrapper = $(self._template.list);
|
245
|
-
|
246
|
-
self._injectStyle();
|
247
|
-
|
248
|
-
self.initialized = true;
|
249
|
-
}
|
250
|
-
|
251
|
-
self.$element.empty().append(self.$wrapper.empty());
|
252
|
-
|
253
|
-
// Build tree
|
254
|
-
self.nodes = [];
|
255
|
-
self._buildTree(self.tree, 0);
|
256
|
-
},
|
257
|
-
|
258
|
-
// Starting from the root node, and recursing down the
|
259
|
-
// structure we build the tree one node at a time
|
260
|
-
_buildTree: function(nodes, level) {
|
261
|
-
|
262
|
-
if (!nodes) { return; }
|
263
|
-
level += 1;
|
264
|
-
|
265
|
-
var self = this;
|
266
|
-
$.each(nodes, function addNodes(id, node) {
|
267
|
-
|
268
|
-
node.nodeId = self.nodes.length;
|
269
|
-
self.nodes.push(node);
|
270
|
-
|
271
|
-
var treeItem = $(self._template.item)
|
272
|
-
.addClass('node-' + self._elementId)
|
273
|
-
.addClass((node === self.selectedNode) ? 'node-selected' : '')
|
274
|
-
.attr('data-nodeid', node.nodeId)
|
275
|
-
.attr('style', self._buildStyleOverride(node));
|
276
|
-
|
277
|
-
// Add indent/spacer to mimic tree structure
|
278
|
-
for (var i = 0; i < (level - 1); i++) {
|
279
|
-
treeItem.append(self._template.indent);
|
280
|
-
}
|
281
|
-
|
282
|
-
// Add expand, collapse or empty spacer icons
|
283
|
-
// to facilitate tree structure navigation
|
284
|
-
if (node._nodes) {
|
285
|
-
treeItem
|
286
|
-
.append($(self._template.expandCollapseIcon)
|
287
|
-
.addClass('click-expand')
|
288
|
-
.addClass(self.options.expandIcon)
|
289
|
-
);
|
290
|
-
}
|
291
|
-
else if (node.nodes) {
|
292
|
-
treeItem
|
293
|
-
.append($(self._template.expandCollapseIcon)
|
294
|
-
.addClass('click-collapse')
|
295
|
-
.addClass(self.options.collapseIcon)
|
296
|
-
);
|
297
|
-
}
|
298
|
-
else {
|
299
|
-
treeItem
|
300
|
-
.append($(self._template.expandCollapseIcon)
|
301
|
-
.addClass(self.options.emptyIcon)
|
302
|
-
);
|
303
|
-
}
|
304
|
-
|
305
|
-
// Add node icon
|
306
|
-
treeItem
|
307
|
-
.append($(self._template.icon)
|
308
|
-
.addClass(node.icon ? node.icon : self.options.nodeIcon)
|
309
|
-
);
|
310
|
-
|
311
|
-
// Add text
|
312
|
-
if (self.options.enableLinks) {
|
313
|
-
// Add hyperlink
|
314
|
-
treeItem
|
315
|
-
.append($(self._template.link)
|
316
|
-
.attr('href', node.href)
|
317
|
-
.append(node.text)
|
318
|
-
);
|
319
|
-
}
|
320
|
-
else {
|
321
|
-
// otherwise just text
|
322
|
-
treeItem
|
323
|
-
.append(node.text);
|
324
|
-
}
|
325
|
-
|
326
|
-
// Add tags as badges
|
327
|
-
if (self.options.showTags && node.tags) {
|
328
|
-
$.each(node.tags, function addTag(id, tag) {
|
329
|
-
treeItem
|
330
|
-
.append($(self._template.badge)
|
331
|
-
.append(tag)
|
332
|
-
);
|
333
|
-
});
|
334
|
-
}
|
335
|
-
|
336
|
-
// Add item to the tree
|
337
|
-
self.$wrapper.append(treeItem);
|
338
|
-
|
339
|
-
// Recursively add child ndoes
|
340
|
-
if (node.nodes) {
|
341
|
-
return self._buildTree(node.nodes, level);
|
342
|
-
}
|
343
|
-
});
|
344
|
-
},
|
345
|
-
|
346
|
-
// Define any node level style override for
|
347
|
-
// 1. selectedNode
|
348
|
-
// 2. node|data assigned color overrides
|
349
|
-
_buildStyleOverride: function(node) {
|
350
|
-
|
351
|
-
var style = '';
|
352
|
-
if (this.options.highlightSelected && (node === this.selectedNode)) {
|
353
|
-
style += 'color:' + this.options.selectedColor + ';';
|
354
|
-
}
|
355
|
-
else if (node.color) {
|
356
|
-
style += 'color:' + node.color + ';';
|
357
|
-
}
|
358
|
-
|
359
|
-
if (this.options.highlightSelected && (node === this.selectedNode)) {
|
360
|
-
style += 'background-color:' + this.options.selectedBackColor + ';';
|
361
|
-
}
|
362
|
-
else if (node.backColor) {
|
363
|
-
style += 'background-color:' + node.backColor + ';';
|
364
|
-
}
|
365
|
-
|
366
|
-
return style;
|
367
|
-
},
|
368
|
-
|
369
|
-
// Add inline style into head
|
370
|
-
_injectStyle: function() {
|
371
|
-
|
372
|
-
if (this.options.injectStyle && !document.getElementById(this._styleId)) {
|
373
|
-
$('<style type="text/css" id="' + this._styleId + '"> ' + this._buildStyle() + ' </style>').appendTo('head');
|
374
|
-
}
|
375
|
-
},
|
376
|
-
|
377
|
-
// Construct trees style based on user options
|
378
|
-
_buildStyle: function() {
|
379
|
-
|
380
|
-
var style = '.node-' + this._elementId + '{';
|
381
|
-
if (this.options.color) {
|
382
|
-
style += 'color:' + this.options.color + ';';
|
383
|
-
}
|
384
|
-
if (this.options.backColor) {
|
385
|
-
style += 'background-color:' + this.options.backColor + ';';
|
386
|
-
}
|
387
|
-
if (!this.options.showBorder) {
|
388
|
-
style += 'border:none;';
|
389
|
-
}
|
390
|
-
else if (this.options.borderColor) {
|
391
|
-
style += 'border:1px solid ' + this.options.borderColor + ';';
|
392
|
-
}
|
393
|
-
style += '}';
|
394
|
-
|
395
|
-
if (this.options.onhoverColor) {
|
396
|
-
style += '.node-' + this._elementId + ':hover{' +
|
397
|
-
'background-color:' + this.options.onhoverColor + ';' +
|
398
|
-
'}';
|
399
|
-
}
|
400
|
-
|
401
|
-
return this._css + style;
|
402
|
-
},
|
403
|
-
|
404
|
-
_template: {
|
405
|
-
list: '<ul class="list-group"></ul>',
|
406
|
-
item: '<li class="list-group-item"></li>',
|
407
|
-
indent: '<span class="indent"></span>',
|
408
|
-
expandCollapseIcon: '<span class="expand-collapse"></span>',
|
409
|
-
icon: '<span class="icon"></span>',
|
410
|
-
link: '<a href="#" style="color:inherit;"></a>',
|
411
|
-
badge: '<span class="badge"></span>'
|
412
|
-
},
|
413
|
-
|
414
|
-
_css: '.treeview .list-group-item{cursor:pointer}.treeview span.indent{margin-left:10px;margin-right:10px}.treeview span.expand-collapse{width:1rem;height:1rem}.treeview span.icon{margin-left:10px;margin-right:5px}'
|
415
|
-
// _css: '.list-group-item{cursor:pointer;}.list-group-item:hover{background-color:#f5f5f5;}span.indent{margin-left:10px;margin-right:10px}span.icon{margin-right:5px}'
|
416
|
-
|
417
|
-
};
|
418
|
-
|
419
|
-
var logError = function(message) {
|
420
|
-
if(window.console) {
|
421
|
-
window.console.error(message);
|
422
|
-
}
|
423
|
-
};
|
424
|
-
|
425
|
-
// Prevent against multiple instantiations,
|
426
|
-
// handle updates and method calls
|
427
|
-
$.fn[pluginName] = function(options, args) {
|
428
|
-
return this.each(function() {
|
429
|
-
var self = $.data(this, 'plugin_' + pluginName);
|
430
|
-
if (typeof options === 'string') {
|
431
|
-
if (!self) {
|
432
|
-
logError('Not initialized, can not call method : ' + options);
|
433
|
-
}
|
434
|
-
else if (!$.isFunction(self[options]) || options.charAt(0) === '_') {
|
435
|
-
logError('No such method : ' + options);
|
436
|
-
}
|
437
|
-
else {
|
438
|
-
if (typeof args === 'string') {
|
439
|
-
args = [args];
|
440
|
-
}
|
441
|
-
self[options].apply(self, args);
|
442
|
-
}
|
443
|
-
}
|
444
|
-
else {
|
445
|
-
if (!self) {
|
446
|
-
$.data(this, 'plugin_' + pluginName, new Tree(this, $.extend(true, {}, options)));
|
447
|
-
}
|
448
|
-
else {
|
449
|
-
self._init(options);
|
450
|
-
}
|
451
|
-
}
|
452
|
-
});
|
453
|
-
};
|
454
|
-
|
455
|
-
})(jQuery, window, document);
|