adminlte2-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/README.md +19 -0
  4. data/lib/adminlte2/rails/version.rb +1 -1
  5. data/lib/generators/admin_lte_plugins/USAGE +28 -0
  6. data/lib/generators/admin_lte_plugins/admin_lte_plugins_generator.rb +100 -0
  7. data/lib/generators/admin_lte_plugins/templates/ChartJS/Chart.js +3457 -0
  8. data/lib/generators/admin_lte_plugins/templates/Sparkline/jquery.sparkline.js +3054 -0
  9. data/lib/generators/admin_lte_plugins/templates/bootstrap-slider/bootstrap-slider.js +1167 -0
  10. data/lib/generators/admin_lte_plugins/templates/bootstrap-slider/slider.css +169 -0
  11. data/lib/generators/admin_lte_plugins/templates/bootstrap-wysihtml5/bootstrap3-wysihtml5.css +102 -0
  12. data/lib/generators/admin_lte_plugins/templates/bootstrap-wysihtml5/bootstrap3-wysihtml5.js +350 -0
  13. data/lib/generators/admin_lte_plugins/templates/colorpicker/bootstrap-colorpicker.css +214 -0
  14. data/lib/generators/admin_lte_plugins/templates/colorpicker/bootstrap-colorpicker.js +949 -0
  15. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/alpha-horizontal.png +0 -0
  16. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/alpha.png +0 -0
  17. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/hue-horizontal.png +0 -0
  18. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/hue.png +0 -0
  19. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/saturation.png +0 -0
  20. data/lib/generators/admin_lte_plugins/templates/datepicker/bootstrap-datepicker.js +1671 -0
  21. data/lib/generators/admin_lte_plugins/templates/datepicker/datepicker3.css +790 -0
  22. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ar.js +15 -0
  23. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.az.js +12 -0
  24. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.bg.js +14 -0
  25. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ca.js +14 -0
  26. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.cs.js +15 -0
  27. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.cy.js +14 -0
  28. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.da.js +15 -0
  29. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.de.js +17 -0
  30. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.el.js +13 -0
  31. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.es.js +14 -0
  32. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.et.js +18 -0
  33. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.fa.js +17 -0
  34. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.fi.js +16 -0
  35. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.fr.js +17 -0
  36. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.gl.js +11 -0
  37. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.he.js +15 -0
  38. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.hr.js +13 -0
  39. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.hu.js +16 -0
  40. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.id.js +15 -0
  41. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.is.js +14 -0
  42. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.it.js +17 -0
  43. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ja.js +15 -0
  44. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ka.js +17 -0
  45. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.kk.js +15 -0
  46. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.kr.js +13 -0
  47. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.lt.js +16 -0
  48. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.lv.js +16 -0
  49. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.mk.js +15 -0
  50. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ms.js +14 -0
  51. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.nb.js +14 -0
  52. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.nl-BE.js +17 -0
  53. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.nl.js +14 -0
  54. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.no.js +16 -0
  55. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.pl.js +15 -0
  56. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.pt-BR.js +15 -0
  57. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.pt.js +16 -0
  58. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ro.js +16 -0
  59. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.rs-latin.js +14 -0
  60. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.rs.js +14 -0
  61. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ru.js +15 -0
  62. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sk.js +15 -0
  63. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sl.js +14 -0
  64. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sq.js +15 -0
  65. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sv.js +16 -0
  66. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sw.js +15 -0
  67. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.th.js +14 -0
  68. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.tr.js +16 -0
  69. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ua.js +15 -0
  70. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.vi.js +16 -0
  71. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.zh-CN.js +16 -0
  72. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.zh-TW.js +17 -0
  73. data/lib/generators/admin_lte_plugins/templates/daterangepicker/daterangepicker-bs3.css +245 -0
  74. data/lib/generators/admin_lte_plugins/templates/daterangepicker/daterangepicker.js +883 -0
  75. data/lib/generators/admin_lte_plugins/templates/fullcalendar/fullcalendar.css +977 -0
  76. data/lib/generators/admin_lte_plugins/templates/fullcalendar/fullcalendar.js +9732 -0
  77. data/lib/generators/admin_lte_plugins/templates/fullcalendar/fullcalendar.print.css +202 -0
  78. data/lib/generators/admin_lte_plugins/templates/jVectorMap/jquery-jvectormap-1.2.2.css +40 -0
  79. data/lib/generators/admin_lte_plugins/templates/jVectorMap/jquery-jvectormap-1.2.2.min.js +8 -0
  80. data/lib/generators/admin_lte_plugins/templates/jVectorMap/jquery-jvectormap-world-mill-en.js +1 -0
  81. data/lib/generators/admin_lte_plugins/templates/knob/jquery.knob.js +805 -0
  82. data/lib/generators/admin_lte_plugins/templates/morris/morris.css +2 -0
  83. data/lib/generators/admin_lte_plugins/templates/morris/morris.js +1892 -0
  84. data/lib/generators/admin_lte_plugins/templates/pace/pace.js +2 -0
  85. data/lib/generators/admin_lte_plugins/templates/timepicker/bootstrap-timepicker.css +121 -0
  86. data/lib/generators/admin_lte_plugins/templates/timepicker/bootstrap-timepicker.js +903 -0
  87. metadata +83 -1
@@ -0,0 +1,169 @@
1
+ /*!
2
+ * Slider for Bootstrap
3
+ *
4
+ * Copyright 2012 Stefan Petre
5
+ * Licensed under the Apache License v2.0
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ */
9
+ .slider {
10
+ display: block;
11
+ vertical-align: middle;
12
+ position: relative;
13
+
14
+ }
15
+ .slider.slider-horizontal {
16
+ width: 100%;
17
+ height: 20px;
18
+ margin-bottom: 20px;
19
+ }
20
+ .slider.slider-horizontal:last-of-type {
21
+ margin-bottom: 0;
22
+ }
23
+ .slider.slider-horizontal .slider-track {
24
+ height: 10px;
25
+ width: 100%;
26
+ margin-top: -5px;
27
+ top: 50%;
28
+ left: 0;
29
+ }
30
+ .slider.slider-horizontal .slider-selection {
31
+ height: 100%;
32
+ top: 0;
33
+ bottom: 0;
34
+ }
35
+ .slider.slider-horizontal .slider-handle {
36
+ margin-left: -10px;
37
+ margin-top: -5px;
38
+ }
39
+ .slider.slider-horizontal .slider-handle.triangle {
40
+ border-width: 0 10px 10px 10px;
41
+ width: 0;
42
+ height: 0;
43
+ border-bottom-color: #0480be;
44
+ margin-top: 0;
45
+ }
46
+ .slider.slider-vertical {
47
+ height: 230px;
48
+ width: 20px;
49
+ margin-right: 20px;
50
+ display: inline-block;
51
+ }
52
+ .slider.slider-vertical:last-of-type {
53
+ margin-right: 0;
54
+ }
55
+ .slider.slider-vertical .slider-track {
56
+ width: 10px;
57
+ height: 100%;
58
+ margin-left: -5px;
59
+ left: 50%;
60
+ top: 0;
61
+ }
62
+ .slider.slider-vertical .slider-selection {
63
+ width: 100%;
64
+ left: 0;
65
+ top: 0;
66
+ bottom: 0;
67
+ }
68
+ .slider.slider-vertical .slider-handle {
69
+ margin-left: -5px;
70
+ margin-top: -10px;
71
+ }
72
+ .slider.slider-vertical .slider-handle.triangle {
73
+ border-width: 10px 0 10px 10px;
74
+ width: 1px;
75
+ height: 1px;
76
+ border-left-color: #0480be;
77
+ margin-left: 0;
78
+ }
79
+ .slider input {
80
+ display: none;
81
+ }
82
+ .slider .tooltip-inner {
83
+ white-space: nowrap;
84
+ }
85
+ .slider-track {
86
+ position: absolute;
87
+ cursor: pointer;
88
+ background-color: #f7f7f7;
89
+ background-image: -moz-linear-gradient(top, #f0f0f0, #f9f9f9);
90
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f0f0f0), to(#f9f9f9));
91
+ background-image: -webkit-linear-gradient(top, #f0f0f0, #f9f9f9);
92
+ background-image: -o-linear-gradient(top, #f0f0f0, #f9f9f9);
93
+ background-image: linear-gradient(to bottom, #f0f0f0, #f9f9f9);
94
+ background-repeat: repeat-x;
95
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0f0f0', endColorstr='#fff9f9f9', GradientType=0);
96
+ -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
97
+ -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
98
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
99
+ -webkit-border-radius: 4px;
100
+ -moz-border-radius: 4px;
101
+ border-radius: 4px;
102
+ }
103
+ .slider-selection {
104
+ position: absolute;
105
+ background-color: #f7f7f7;
106
+ background-image: -moz-linear-gradient(top, #f9f9f9, #f5f5f5);
107
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f9f9f9), to(#f5f5f5));
108
+ background-image: -webkit-linear-gradient(top, #f9f9f9, #f5f5f5);
109
+ background-image: -o-linear-gradient(top, #f9f9f9, #f5f5f5);
110
+ background-image: linear-gradient(to bottom, #f9f9f9, #f5f5f5);
111
+ background-repeat: repeat-x;
112
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0);
113
+ -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
114
+ -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
115
+ box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
116
+ -webkit-box-sizing: border-box;
117
+ -moz-box-sizing: border-box;
118
+ box-sizing: border-box;
119
+ -webkit-border-radius: 4px;
120
+ -moz-border-radius: 4px;
121
+ border-radius: 4px;
122
+ }
123
+ .slider-handle {
124
+ position: absolute;
125
+ width: 20px;
126
+ height: 20px;
127
+ background-color: #444;
128
+ -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
129
+ -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
130
+ box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
131
+ opacity: 1;
132
+ border: 0px solid transparent;
133
+ }
134
+ .slider-handle.round {
135
+ -webkit-border-radius: 20px;
136
+ -moz-border-radius: 20px;
137
+ border-radius: 20px;
138
+ }
139
+ .slider-handle.triangle {
140
+ background: transparent none;
141
+ }
142
+
143
+ .slider-disabled .slider-selection {
144
+ opacity: 0.5;
145
+ }
146
+
147
+ #red .slider-selection {
148
+ background: #f56954;
149
+ }
150
+
151
+ #blue .slider-selection {
152
+ background: #3c8dbc;
153
+ }
154
+
155
+ #green .slider-selection {
156
+ background: #00a65a;
157
+ }
158
+
159
+ #yellow .slider-selection {
160
+ background: #f39c12;
161
+ }
162
+
163
+ #aqua .slider-selection {
164
+ background: #00c0ef;
165
+ }
166
+
167
+ #purple .slider-selection {
168
+ background: #932ab6;
169
+ }
@@ -0,0 +1,102 @@
1
+ ul.wysihtml5-toolbar {
2
+ margin: 0;
3
+ padding: 0;
4
+ display: block;
5
+ }
6
+
7
+ ul.wysihtml5-toolbar::after {
8
+ clear: both;
9
+ display: table;
10
+ content: "";
11
+ }
12
+
13
+ ul.wysihtml5-toolbar > li {
14
+ float: left;
15
+ display: list-item;
16
+ list-style: none;
17
+ margin: 0 5px 10px 0;
18
+ }
19
+
20
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=bold] {
21
+ font-weight: bold;
22
+ }
23
+
24
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=italic] {
25
+ font-style: italic;
26
+ }
27
+
28
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=underline] {
29
+ text-decoration: underline;
30
+ }
31
+
32
+ ul.wysihtml5-toolbar a.btn.wysihtml5-command-active {
33
+ background-image: none;
34
+ -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
35
+ -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
36
+ box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
37
+ background-color: #E6E6E6;
38
+ background-color: #D9D9D9;
39
+ outline: 0;
40
+ }
41
+
42
+ ul.wysihtml5-commands-disabled .dropdown-menu {
43
+ display: none !important;
44
+ }
45
+
46
+ ul.wysihtml5-toolbar div.wysihtml5-colors {
47
+ display:block;
48
+ width: 50px;
49
+ height: 20px;
50
+ margin-top: 2px;
51
+ margin-left: 5px;
52
+ position: absolute;
53
+ pointer-events: none;
54
+ }
55
+
56
+ ul.wysihtml5-toolbar a.wysihtml5-colors-title {
57
+ padding-left: 70px;
58
+ }
59
+
60
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="black"] {
61
+ background: black !important;
62
+ }
63
+
64
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="silver"] {
65
+ background: silver !important;
66
+ }
67
+
68
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="gray"] {
69
+ background: gray !important;
70
+ }
71
+
72
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="maroon"] {
73
+ background: maroon !important;
74
+ }
75
+
76
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="red"] {
77
+ background: red !important;
78
+ }
79
+
80
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="purple"] {
81
+ background: purple !important;
82
+ }
83
+
84
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="green"] {
85
+ background: green !important;
86
+ }
87
+
88
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="olive"] {
89
+ background: olive !important;
90
+ }
91
+
92
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="navy"] {
93
+ background: navy !important;
94
+ }
95
+
96
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="blue"] {
97
+ background: blue !important;
98
+ }
99
+
100
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="orange"] {
101
+ background: orange !important;
102
+ }
@@ -0,0 +1,350 @@
1
+ /* jshint expr: true */
2
+ !(function($, wysi) {
3
+ 'use strict';
4
+
5
+ var templates = function(key, locale, options) {
6
+ return wysi.tpl[key]({locale: locale, options: options});
7
+ };
8
+
9
+ var Wysihtml5 = function(el, options) {
10
+ this.el = el;
11
+ var toolbarOpts = options || defaultOptions;
12
+ for(var t in toolbarOpts.customTemplates) {
13
+ wysi.tpl[t] = toolbarOpts.customTemplates[t];
14
+ }
15
+ this.toolbar = this.createToolbar(el, toolbarOpts);
16
+ this.editor = this.createEditor(options);
17
+
18
+ window.editor = this.editor;
19
+
20
+ $('iframe.wysihtml5-sandbox').each(function(i, el){
21
+ $(el.contentWindow).off('focus.wysihtml5').on({
22
+ 'focus.wysihtml5' : function(){
23
+ $('li.dropdown').removeClass('open');
24
+ }
25
+ });
26
+ });
27
+ };
28
+
29
+ Wysihtml5.prototype = {
30
+
31
+ constructor: Wysihtml5,
32
+
33
+ createEditor: function(options) {
34
+ options = options || {};
35
+
36
+ // Add the toolbar to a clone of the options object so multiple instances
37
+ // of the WYISYWG don't break because 'toolbar' is already defined
38
+ options = $.extend(true, {}, options);
39
+ options.toolbar = this.toolbar[0];
40
+
41
+ var editor = new wysi.Editor(this.el[0], options);
42
+
43
+ if(options && options.events) {
44
+ for(var eventName in options.events) {
45
+ editor.on(eventName, options.events[eventName]);
46
+ }
47
+ }
48
+ return editor;
49
+ },
50
+
51
+ createToolbar: function(el, options) {
52
+ var self = this;
53
+ var toolbar = $('<ul/>', {
54
+ 'class' : 'wysihtml5-toolbar',
55
+ 'style': 'display:none'
56
+ });
57
+ var culture = options.locale || defaultOptions.locale || 'en';
58
+ for(var key in defaultOptions) {
59
+ var value = false;
60
+
61
+ if(options[key] !== undefined) {
62
+ if(options[key] === true) {
63
+ value = true;
64
+ }
65
+ } else {
66
+ value = defaultOptions[key];
67
+ }
68
+
69
+ if(value === true) {
70
+ toolbar.append(templates(key, locale[culture], options));
71
+
72
+ if(key === 'html') {
73
+ this.initHtml(toolbar);
74
+ }
75
+
76
+ if(key === 'link') {
77
+ this.initInsertLink(toolbar);
78
+ }
79
+
80
+ if(key === 'image') {
81
+ this.initInsertImage(toolbar);
82
+ }
83
+ }
84
+ }
85
+
86
+ if(options.toolbar) {
87
+ for(key in options.toolbar) {
88
+ toolbar.append(options.toolbar[key]);
89
+ }
90
+ }
91
+
92
+ toolbar.find('a[data-wysihtml5-command="formatBlock"]').click(function(e) {
93
+ var target = e.target || e.srcElement;
94
+ var el = $(target);
95
+ self.toolbar.find('.current-font').text(el.html());
96
+ });
97
+
98
+ toolbar.find('a[data-wysihtml5-command="foreColor"]').click(function(e) {
99
+ var target = e.target || e.srcElement;
100
+ var el = $(target);
101
+ self.toolbar.find('.current-color').text(el.html());
102
+ });
103
+
104
+ this.el.before(toolbar);
105
+
106
+ return toolbar;
107
+ },
108
+
109
+ initHtml: function(toolbar) {
110
+ var changeViewSelector = 'a[data-wysihtml5-action="change_view"]';
111
+ toolbar.find(changeViewSelector).click(function(e) {
112
+ toolbar.find('a.btn').not(changeViewSelector).toggleClass('disabled');
113
+ });
114
+ },
115
+
116
+ initInsertImage: function(toolbar) {
117
+ var self = this;
118
+ var insertImageModal = toolbar.find('.bootstrap-wysihtml5-insert-image-modal');
119
+ var urlInput = insertImageModal.find('.bootstrap-wysihtml5-insert-image-url');
120
+ var insertButton = insertImageModal.find('a.btn-primary');
121
+ var initialValue = urlInput.val();
122
+ var caretBookmark;
123
+
124
+ var insertImage = function() {
125
+ var url = urlInput.val();
126
+ urlInput.val(initialValue);
127
+ self.editor.currentView.element.focus();
128
+ if (caretBookmark) {
129
+ self.editor.composer.selection.setBookmark(caretBookmark);
130
+ caretBookmark = null;
131
+ }
132
+ self.editor.composer.commands.exec('insertImage', url);
133
+ };
134
+
135
+ urlInput.keypress(function(e) {
136
+ if(e.which == 13) {
137
+ insertImage();
138
+ insertImageModal.modal('hide');
139
+ }
140
+ });
141
+
142
+ insertButton.click(insertImage);
143
+
144
+ insertImageModal.on('shown', function() {
145
+ urlInput.focus();
146
+ });
147
+
148
+ insertImageModal.on('hide', function() {
149
+ self.editor.currentView.element.focus();
150
+ });
151
+
152
+ toolbar.find('a[data-wysihtml5-command=insertImage]').click(function() {
153
+ var activeButton = $(this).hasClass('wysihtml5-command-active');
154
+
155
+ if (!activeButton) {
156
+ self.editor.currentView.element.focus(false);
157
+ caretBookmark = self.editor.composer.selection.getBookmark();
158
+ insertImageModal.appendTo('body').modal('show');
159
+ insertImageModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
160
+ e.stopPropagation();
161
+ });
162
+ return false;
163
+ }
164
+ else {
165
+ return true;
166
+ }
167
+ });
168
+ },
169
+
170
+ initInsertLink: function(toolbar) {
171
+ var self = this;
172
+ var insertLinkModal = toolbar.find('.bootstrap-wysihtml5-insert-link-modal');
173
+ var urlInput = insertLinkModal.find('.bootstrap-wysihtml5-insert-link-url');
174
+ var targetInput = insertLinkModal.find('.bootstrap-wysihtml5-insert-link-target');
175
+ var insertButton = insertLinkModal.find('a.btn-primary');
176
+ var initialValue = urlInput.val();
177
+ var caretBookmark;
178
+
179
+ var insertLink = function() {
180
+ var url = urlInput.val();
181
+ urlInput.val(initialValue);
182
+ self.editor.currentView.element.focus();
183
+ if (caretBookmark) {
184
+ self.editor.composer.selection.setBookmark(caretBookmark);
185
+ caretBookmark = null;
186
+ }
187
+
188
+ var newWindow = targetInput.prop('checked');
189
+ self.editor.composer.commands.exec('createLink', {
190
+ 'href' : url,
191
+ 'target' : (newWindow ? '_blank' : '_self'),
192
+ 'rel' : (newWindow ? 'nofollow' : '')
193
+ });
194
+ };
195
+ var pressedEnter = false;
196
+
197
+ urlInput.keypress(function(e) {
198
+ if(e.which == 13) {
199
+ insertLink();
200
+ insertLinkModal.modal('hide');
201
+ }
202
+ });
203
+
204
+ insertButton.click(insertLink);
205
+
206
+ insertLinkModal.on('shown', function() {
207
+ urlInput.focus();
208
+ });
209
+
210
+ insertLinkModal.on('hide', function() {
211
+ self.editor.currentView.element.focus();
212
+ });
213
+
214
+ toolbar.find('a[data-wysihtml5-command=createLink]').click(function() {
215
+ var activeButton = $(this).hasClass('wysihtml5-command-active');
216
+
217
+ if (!activeButton) {
218
+ self.editor.currentView.element.focus(false);
219
+ caretBookmark = self.editor.composer.selection.getBookmark();
220
+ insertLinkModal.appendTo('body').modal('show');
221
+ insertLinkModal.on('click.dismiss.modal', '[data-dismiss="modal"]', function(e) {
222
+ e.stopPropagation();
223
+ });
224
+ return false;
225
+ }
226
+ else {
227
+ return true;
228
+ }
229
+ });
230
+ }
231
+ };
232
+
233
+ // these define our public api
234
+ var methods = {
235
+ resetDefaults: function() {
236
+ $.fn.wysihtml5.defaultOptions = $.extend(true, {}, $.fn.wysihtml5.defaultOptionsCache);
237
+ },
238
+ bypassDefaults: function(options) {
239
+ return this.each(function () {
240
+ var $this = $(this);
241
+ $this.data('wysihtml5', new Wysihtml5($this, options));
242
+ });
243
+ },
244
+ shallowExtend: function (options) {
245
+ var settings = $.extend({}, $.fn.wysihtml5.defaultOptions, options || {}, $(this).data());
246
+ var that = this;
247
+ return methods.bypassDefaults.apply(that, [settings]);
248
+ },
249
+ deepExtend: function(options) {
250
+ var settings = $.extend(true, {}, $.fn.wysihtml5.defaultOptions, options || {});
251
+ var that = this;
252
+ return methods.bypassDefaults.apply(that, [settings]);
253
+ },
254
+ init: function(options) {
255
+ var that = this;
256
+ return methods.shallowExtend.apply(that, [options]);
257
+ }
258
+ };
259
+
260
+ $.fn.wysihtml5 = function ( method ) {
261
+ if ( methods[method] ) {
262
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
263
+ } else if ( typeof method === 'object' || ! method ) {
264
+ return methods.init.apply( this, arguments );
265
+ } else {
266
+ $.error( 'Method ' + method + ' does not exist on jQuery.wysihtml5' );
267
+ }
268
+ };
269
+
270
+ $.fn.wysihtml5.Constructor = Wysihtml5;
271
+
272
+ var defaultOptions = $.fn.wysihtml5.defaultOptions = {
273
+ 'font-styles': true,
274
+ 'color': false,
275
+ 'emphasis': true,
276
+ 'lists': true,
277
+ 'html': false,
278
+ 'link': true,
279
+ 'image': true,
280
+ events: {},
281
+ parserRules: {
282
+ classes: {
283
+ 'wysiwyg-color-silver' : 1,
284
+ 'wysiwyg-color-gray' : 1,
285
+ 'wysiwyg-color-white' : 1,
286
+ 'wysiwyg-color-maroon' : 1,
287
+ 'wysiwyg-color-red' : 1,
288
+ 'wysiwyg-color-purple' : 1,
289
+ 'wysiwyg-color-fuchsia' : 1,
290
+ 'wysiwyg-color-green' : 1,
291
+ 'wysiwyg-color-lime' : 1,
292
+ 'wysiwyg-color-olive' : 1,
293
+ 'wysiwyg-color-yellow' : 1,
294
+ 'wysiwyg-color-navy' : 1,
295
+ 'wysiwyg-color-blue' : 1,
296
+ 'wysiwyg-color-teal' : 1,
297
+ 'wysiwyg-color-aqua' : 1,
298
+ 'wysiwyg-color-orange' : 1
299
+ },
300
+ tags: {
301
+ 'b': {},
302
+ 'i': {},
303
+ 'strong': {},
304
+ 'em': {},
305
+ 'p': {},
306
+ 'br': {},
307
+ 'ol': {},
308
+ 'ul': {},
309
+ 'li': {},
310
+ 'h1': {},
311
+ 'h2': {},
312
+ 'h3': {},
313
+ 'h4': {},
314
+ 'h5': {},
315
+ 'h6': {},
316
+ 'blockquote': {},
317
+ 'u': 1,
318
+ 'img': {
319
+ 'check_attributes': {
320
+ 'width': 'numbers',
321
+ 'alt': 'alt',
322
+ 'src': 'url',
323
+ 'height': 'numbers'
324
+ }
325
+ },
326
+ 'a': {
327
+ check_attributes: {
328
+ 'href': 'url' // important to avoid XSS
329
+ },
330
+ 'set_attributes': {
331
+ 'target': '_blank',
332
+ 'rel': 'nofollow'
333
+ }
334
+ },
335
+ 'span': 1,
336
+ 'div': 1,
337
+ // to allow save and edit files with code tag hacks
338
+ 'code': 1,
339
+ 'pre': 1
340
+ }
341
+ },
342
+ locale: 'en'
343
+ };
344
+
345
+ if (typeof $.fn.wysihtml5.defaultOptionsCache === 'undefined') {
346
+ $.fn.wysihtml5.defaultOptionsCache = $.extend(true, {}, $.fn.wysihtml5.defaultOptions);
347
+ }
348
+
349
+ var locale = $.fn.wysihtml5.locale = {};
350
+ })(window.jQuery, window.wysihtml5);