beautiful_scaffold 0.3.5 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +2 -0
- data/.gitignore +1 -0
- data/CHANGELOG +66 -1
- data/Gemfile +24 -17
- data/Gemfile.lock +209 -0
- data/README.rdoc +56 -44
- data/Rakefile +32 -0
- data/beautiful_scaffold.gemspec +8 -5
- data/lib/beautiful_scaffold/version.rb +3 -0
- data/lib/generators/beautiful_devisecancan_generator.rb +1 -1
- data/lib/generators/beautiful_jointable_generator.rb +40 -7
- data/lib/generators/beautiful_locale_generator.rb +102 -80
- data/lib/generators/beautiful_migration_generator.rb +12 -20
- data/lib/generators/beautiful_scaffold_common_methods.rb +88 -29
- data/lib/generators/beautiful_scaffold_generator.rb +166 -111
- data/lib/generators/templates/app/assets/javascripts/application-bs.js +11 -19
- data/lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js +68 -78
- data/lib/generators/templates/app/assets/javascripts/bootstrap-datetimepicker-for-beautiful-scaffold.js +23 -42
- data/lib/generators/templates/app/assets/javascripts/fixed_menu.js +3 -1
- data/lib/generators/templates/app/assets/javascripts/jstree.min.js +6 -0
- data/lib/generators/templates/app/assets/stylesheets/application-bs.css +14 -12
- data/lib/generators/templates/app/assets/stylesheets/beautiful-scaffold.css.scss +36 -3
- data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/32px.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/40px.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/style.scss +1146 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/throbber.gif +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/32px.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/40px.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/style.scss +1102 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/throbber.gif +0 -0
- data/lib/generators/templates/app/controllers/base.rb +32 -15
- data/lib/generators/templates/app/controllers/master_base.rb +55 -47
- data/lib/generators/templates/app/helpers/beautiful_helper.rb +104 -67
- data/lib/generators/templates/app/helpers/model_helper.rb +14 -3
- data/lib/generators/templates/app/initializers/link_renderer.rb +24 -17
- data/lib/generators/templates/app/initializers/ransack.rb +16 -0
- data/lib/generators/templates/app/locales/beautiful_scaffold.ja.yml +50 -0
- data/lib/generators/templates/app/models/concerns/fulltext_concern.rb +10 -10
- data/lib/generators/templates/app/views/_form.html.erb +5 -2
- data/lib/generators/templates/app/views/_form_habtm_tag.html.erb +6 -2
- data/lib/generators/templates/app/views/_mass_inserting.html.erb +40 -31
- data/lib/generators/templates/app/views/_modal_columns.html.erb +4 -4
- data/lib/generators/templates/app/views/edit.html.erb +1 -3
- data/lib/generators/templates/app/views/index.html.erb +84 -58
- data/lib/generators/templates/app/views/layout.html.erb +29 -47
- data/lib/generators/templates/app/views/new.html.erb +0 -2
- data/lib/generators/templates/app/views/partials/_forget_password.html.erb +2 -2
- data/lib/generators/templates/app/views/partials/_form_field.html.erb +7 -33
- data/lib/generators/templates/app/views/partials/_index_batch.html.erb +1 -1
- data/lib/generators/templates/app/views/partials/_index_column.html.erb +4 -6
- data/lib/generators/templates/app/views/partials/_index_header.html.erb +1 -1
- data/lib/generators/templates/app/views/partials/_index_search.html.erb +2 -4
- data/lib/generators/templates/app/views/partials/_index_search_default_fields.html.erb +1 -1
- data/lib/generators/templates/app/views/partials/_register_form.html.erb +2 -2
- data/lib/generators/templates/app/views/partials/_show_field.html.erb +3 -3
- data/lib/generators/templates/app/views/partials/_sign_in_form.html.erb +1 -1
- data/lib/generators/templates/app/views/partials/_sign_in_sign_out.html.erb +2 -2
- data/lib/generators/templates/app/views/show.html.erb +2 -2
- data/lib/generators/templates/app/views/treeview.html.erb +8 -5
- metadata +43 -188
- data/lib/generators/templates/app/assets/javascripts/bootstrap-datepicker.js +0 -834
- data/lib/generators/templates/app/assets/javascripts/bootstrap-timepicker.js +0 -797
- data/lib/generators/templates/app/assets/javascripts/jquery.jstree.js +0 -4551
- data/lib/generators/templates/app/assets/javascripts/jquery.livequery.js +0 -226
- data/lib/generators/templates/app/assets/stylesheets/bootstrap_and_overrides.css.less +0 -40
- data/lib/generators/templates/app/assets/stylesheets/datepicker.css +0 -224
- data/lib/generators/templates/app/assets/stylesheets/reset.css +0 -48
- data/lib/generators/templates/app/assets/stylesheets/themes/default/d.gif +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/d.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/style.css +0 -74
- data/lib/generators/templates/app/assets/stylesheets/timepicker.css +0 -89
- data/lib/generators/templates/markitup/jquery.markitup.js +0 -593
- data/lib/generators/templates/markitup/sets/bbcode/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/clean.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/code.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/fonts.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/list-item.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/quotes.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/underline.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/bbcode/set.js +0 -39
- data/lib/generators/templates/markitup/sets/bbcode/style.css +0 -47
- data/lib/generators/templates/markitup/sets/default/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/clean.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/image.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/default/set.js +0 -30
- data/lib/generators/templates/markitup/sets/default/style.css +0 -34
- data/lib/generators/templates/markitup/sets/html/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/clean.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h1.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h2.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h3.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h4.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h5.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h6.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/image.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/list-item.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/paragraph.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/html/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/html/set.js +0 -39
- data/lib/generators/templates/markitup/sets/html/style.css +0 -59
- data/lib/generators/templates/markitup/sets/markdown/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/code.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h1.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h2.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h3.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h4.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h5.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h6.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/quotes.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/markdown/set.js +0 -52
- data/lib/generators/templates/markitup/sets/markdown/style.css +0 -54
- data/lib/generators/templates/markitup/sets/textile/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/code.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h1.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h2.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h3.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h4.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h5.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h6.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/paragraph.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/quotes.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/textile/set.js +0 -40
- data/lib/generators/templates/markitup/sets/textile/style.css +0 -60
- data/lib/generators/templates/markitup/sets/wiki/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/code.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h1.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h2.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h3.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h4.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h5.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h6.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/quotes.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/url.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/wiki/set.js +0 -37
- data/lib/generators/templates/markitup/sets/wiki/style.css +0 -57
- data/lib/generators/templates/markitup/skins/markitup/images/bg-container.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-html.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-json.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/handle.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/menu.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/submenu.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/style.css +0 -147
- data/lib/generators/templates/markitup/skins/simple/images/handle.png +0 -0
- data/lib/generators/templates/markitup/skins/simple/images/menu.png +0 -0
- data/lib/generators/templates/markitup/skins/simple/images/submenu.png +0 -0
- data/lib/generators/templates/markitup/skins/simple/style.css +0 -118
- data/lib/generators/templates/markitup/templates/preview.css +0 -5
- data/lib/generators/templates/markitup/templates/preview.html +0 -11
@@ -1,797 +0,0 @@
|
|
1
|
-
/* =========================================================
|
2
|
-
* bootstrap-timepicker.js
|
3
|
-
* http://www.github.com/jdewit/bootstrap-timepicker
|
4
|
-
* =========================================================
|
5
|
-
* Copyright 2012
|
6
|
-
*
|
7
|
-
* Created By:
|
8
|
-
* Joris de Wit @joris_dewit
|
9
|
-
*
|
10
|
-
* Contributions By:
|
11
|
-
* Gilbert @mindeavor
|
12
|
-
* Koen Punt info@koenpunt.nl
|
13
|
-
* Nek
|
14
|
-
* Chris Martin
|
15
|
-
* Dominic Barnes contact@dominicbarnes.us
|
16
|
-
* Rivsc (http://blog.escarworld.com for Beautiful-Scaffold) same behavior as datepicker
|
17
|
-
*
|
18
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
19
|
-
* you may not use this file except in compliance with the License.
|
20
|
-
* You may obtain a copy of the License at
|
21
|
-
*
|
22
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
23
|
-
*
|
24
|
-
* Unless required by applicable law or agreed to in writing, software
|
25
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
26
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
27
|
-
* See the License for the specific language governing permissions and
|
28
|
-
* limitations under the License.
|
29
|
-
* ========================================================= */
|
30
|
-
|
31
|
-
!function($) {
|
32
|
-
|
33
|
-
"use strict"; // jshint ;_;
|
34
|
-
|
35
|
-
/* TIMEPICKER PUBLIC CLASS DEFINITION
|
36
|
-
* ================================== */
|
37
|
-
var Timepicker = function(element, options) {
|
38
|
-
this.$element = $(element);
|
39
|
-
this.options = $.extend({}, $.fn.timepicker.defaults, options, this.$element.data());
|
40
|
-
this.minuteStep = this.options.minuteStep || this.minuteStep;
|
41
|
-
this.secondStep = this.options.secondStep || this.secondStep;
|
42
|
-
this.showMeridian = this.options.showMeridian || this.showMeridian;
|
43
|
-
this.showSeconds = this.options.showSeconds || this.showSeconds;
|
44
|
-
this.showInputs = this.options.showInputs || this.showInputs;
|
45
|
-
this.disableFocus = this.options.disableFocus || this.disableFocus;
|
46
|
-
this.template = this.options.template || this.template;
|
47
|
-
this.modalBackdrop = this.options.modalBackdrop || this.modalBackdrop;
|
48
|
-
this.defaultTime = this.options.defaultTime || this.defaultTime;
|
49
|
-
this.open = false;
|
50
|
-
this.init();
|
51
|
-
};
|
52
|
-
|
53
|
-
Timepicker.prototype = {
|
54
|
-
|
55
|
-
constructor: Timepicker
|
56
|
-
|
57
|
-
, init: function () {
|
58
|
-
if (this.$element.parent().hasClass('input-group')) {
|
59
|
-
this.$element.parent('.input-group').find('.input-group-addon').on('click', $.proxy(this.showWidget, this));
|
60
|
-
this.$element.on('click', $.proxy(this.showWidget, this));
|
61
|
-
this.$element.on({
|
62
|
-
focus: $.proxy(this.highlightUnit, this),
|
63
|
-
click: $.proxy(this.highlightUnit, this),
|
64
|
-
keypress: $.proxy(this.elementKeypress, this),
|
65
|
-
blur: $.proxy(this.updateFromElementVal, this)
|
66
|
-
});
|
67
|
-
|
68
|
-
} else {
|
69
|
-
if (this.template) {
|
70
|
-
this.$element.on({
|
71
|
-
focus: $.proxy(this.showWidget, this),
|
72
|
-
click: $.proxy(this.showWidget, this),
|
73
|
-
blur: $.proxy(this.updateFromElementVal, this)
|
74
|
-
});
|
75
|
-
} else {
|
76
|
-
this.$element.on({
|
77
|
-
focus: $.proxy(this.highlightUnit, this),
|
78
|
-
click: $.proxy(this.highlightUnit, this),
|
79
|
-
keypress: $.proxy(this.elementKeypress, this),
|
80
|
-
blur: $.proxy(this.updateFromElementVal, this)
|
81
|
-
});
|
82
|
-
}
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
this.$widget = $(this.getTemplate()).appendTo('body');
|
87
|
-
|
88
|
-
this.$widget.on('click', $.proxy(this.widgetClick, this));
|
89
|
-
|
90
|
-
if (this.showInputs) {
|
91
|
-
this.$widget.find('input').on({
|
92
|
-
click: function() { this.select(); },
|
93
|
-
keypress: $.proxy(this.widgetKeypress, this),
|
94
|
-
change: $.proxy(this.updateFromWidgetInputs, this)
|
95
|
-
});
|
96
|
-
}
|
97
|
-
|
98
|
-
this.setDefaultTime(this.defaultTime);
|
99
|
-
}
|
100
|
-
|
101
|
-
, showWidget: function(e) {
|
102
|
-
e.stopPropagation();
|
103
|
-
e.preventDefault();
|
104
|
-
|
105
|
-
if (this.open) {
|
106
|
-
return;
|
107
|
-
}
|
108
|
-
|
109
|
-
this.$element.trigger('show');
|
110
|
-
|
111
|
-
if (this.disableFocus) {
|
112
|
-
this.$element.blur();
|
113
|
-
}
|
114
|
-
|
115
|
-
var pos = $.extend({}, this.$element.offset(), {
|
116
|
-
height: this.$element[0].offsetHeight
|
117
|
-
});
|
118
|
-
|
119
|
-
this.updateFromElementVal();
|
120
|
-
|
121
|
-
$('html')
|
122
|
-
.trigger('click.timepicker.data-api')
|
123
|
-
.one('click.timepicker.data-api', $.proxy(this.hideWidget, this));
|
124
|
-
|
125
|
-
if (this.template === 'modal') {
|
126
|
-
this.$widget.modal('show').on('hidden', $.proxy(this.hideWidget, this));
|
127
|
-
} else {
|
128
|
-
this.$widget.css({
|
129
|
-
top: pos.top + pos.height
|
130
|
-
, left: pos.left
|
131
|
-
})
|
132
|
-
|
133
|
-
if (!this.open) {
|
134
|
-
this.$widget.addClass('open');
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
this.open = true;
|
139
|
-
this.$element.trigger('shown');
|
140
|
-
}
|
141
|
-
|
142
|
-
, hideWidget: function(){
|
143
|
-
this.$element.trigger('hide');
|
144
|
-
|
145
|
-
if (this.template === 'modal') {
|
146
|
-
this.$widget.modal('hide');
|
147
|
-
} else {
|
148
|
-
this.$widget.removeClass('open');
|
149
|
-
}
|
150
|
-
this.open = false;
|
151
|
-
this.$element.trigger('hidden');
|
152
|
-
}
|
153
|
-
|
154
|
-
, widgetClick: function(e) {
|
155
|
-
e.stopPropagation();
|
156
|
-
e.preventDefault();
|
157
|
-
|
158
|
-
var action = $(e.target).closest('a').data('action');
|
159
|
-
if (action) {
|
160
|
-
this[action]();
|
161
|
-
this.update();
|
162
|
-
}
|
163
|
-
}
|
164
|
-
|
165
|
-
, widgetKeypress: function(e) {
|
166
|
-
var input = $(e.target).closest('input').attr('name');
|
167
|
-
|
168
|
-
switch (e.keyCode) {
|
169
|
-
case 9: //tab
|
170
|
-
if (this.showMeridian) {
|
171
|
-
if (input == 'meridian') {
|
172
|
-
this.hideWidget();
|
173
|
-
}
|
174
|
-
} else {
|
175
|
-
if (this.showSeconds) {
|
176
|
-
if (input == 'second') {
|
177
|
-
this.hideWidget();
|
178
|
-
}
|
179
|
-
} else {
|
180
|
-
if (input == 'minute') {
|
181
|
-
this.hideWidget();
|
182
|
-
}
|
183
|
-
}
|
184
|
-
}
|
185
|
-
break;
|
186
|
-
case 27: // escape
|
187
|
-
this.hideWidget();
|
188
|
-
break;
|
189
|
-
case 38: // up arrow
|
190
|
-
switch (input) {
|
191
|
-
case 'hour':
|
192
|
-
this.incrementHour();
|
193
|
-
break;
|
194
|
-
case 'minute':
|
195
|
-
this.incrementMinute();
|
196
|
-
break;
|
197
|
-
case 'second':
|
198
|
-
this.incrementSecond();
|
199
|
-
break;
|
200
|
-
case 'meridian':
|
201
|
-
this.toggleMeridian();
|
202
|
-
break;
|
203
|
-
}
|
204
|
-
this.update();
|
205
|
-
break;
|
206
|
-
case 40: // down arrow
|
207
|
-
switch (input) {
|
208
|
-
case 'hour':
|
209
|
-
this.decrementHour();
|
210
|
-
break;
|
211
|
-
case 'minute':
|
212
|
-
this.decrementMinute();
|
213
|
-
break;
|
214
|
-
case 'second':
|
215
|
-
this.decrementSecond();
|
216
|
-
break;
|
217
|
-
case 'meridian':
|
218
|
-
this.toggleMeridian();
|
219
|
-
break;
|
220
|
-
}
|
221
|
-
this.update();
|
222
|
-
break;
|
223
|
-
}
|
224
|
-
}
|
225
|
-
|
226
|
-
, elementKeypress: function(e) {
|
227
|
-
var input = this.$element.get(0);
|
228
|
-
switch (e.keyCode) {
|
229
|
-
case 0: //input
|
230
|
-
break;
|
231
|
-
case 9: //tab
|
232
|
-
this.updateFromElementVal();
|
233
|
-
if (this.showMeridian) {
|
234
|
-
if (this.highlightedUnit != 'meridian') {
|
235
|
-
e.preventDefault();
|
236
|
-
this.highlightNextUnit();
|
237
|
-
}
|
238
|
-
} else {
|
239
|
-
if (this.showSeconds) {
|
240
|
-
if (this.highlightedUnit != 'second') {
|
241
|
-
e.preventDefault();
|
242
|
-
this.highlightNextUnit();
|
243
|
-
}
|
244
|
-
} else {
|
245
|
-
if (this.highlightedUnit != 'minute') {
|
246
|
-
e.preventDefault();
|
247
|
-
this.highlightNextUnit();
|
248
|
-
}
|
249
|
-
}
|
250
|
-
}
|
251
|
-
break;
|
252
|
-
case 27: // escape
|
253
|
-
this.updateFromElementVal();
|
254
|
-
break;
|
255
|
-
case 37: // left arrow
|
256
|
-
this.updateFromElementVal();
|
257
|
-
this.highlightPrevUnit();
|
258
|
-
break;
|
259
|
-
case 38: // up arrow
|
260
|
-
switch (this.highlightedUnit) {
|
261
|
-
case 'hour':
|
262
|
-
this.incrementHour();
|
263
|
-
break;
|
264
|
-
case 'minute':
|
265
|
-
this.incrementMinute();
|
266
|
-
break;
|
267
|
-
case 'second':
|
268
|
-
this.incrementSecond();
|
269
|
-
break;
|
270
|
-
case 'meridian':
|
271
|
-
this.toggleMeridian();
|
272
|
-
break;
|
273
|
-
}
|
274
|
-
this.updateElement();
|
275
|
-
break;
|
276
|
-
case 39: // right arrow
|
277
|
-
this.updateFromElementVal();
|
278
|
-
this.highlightNextUnit();
|
279
|
-
break;
|
280
|
-
case 40: // down arrow
|
281
|
-
switch (this.highlightedUnit) {
|
282
|
-
case 'hour':
|
283
|
-
this.decrementHour();
|
284
|
-
break;
|
285
|
-
case 'minute':
|
286
|
-
this.decrementMinute();
|
287
|
-
break;
|
288
|
-
case 'second':
|
289
|
-
this.decrementSecond();
|
290
|
-
break;
|
291
|
-
case 'meridian':
|
292
|
-
this.toggleMeridian();
|
293
|
-
break;
|
294
|
-
}
|
295
|
-
this.updateElement();
|
296
|
-
break;
|
297
|
-
}
|
298
|
-
|
299
|
-
if (e.keyCode !== 0 && e.keyCode !== 8 && e.keyCode !== 9 && e.keyCode !== 46) {
|
300
|
-
e.preventDefault();
|
301
|
-
}
|
302
|
-
|
303
|
-
}
|
304
|
-
|
305
|
-
, setValues: function(time) {
|
306
|
-
if (this.showMeridian) {
|
307
|
-
var arr = time.split(' ');
|
308
|
-
var timeArray = arr[0].split(':');
|
309
|
-
this.meridian = arr[1];
|
310
|
-
} else {
|
311
|
-
var timeArray = time.split(':');
|
312
|
-
}
|
313
|
-
|
314
|
-
this.hour = parseInt(timeArray[0], 10);
|
315
|
-
this.minute = parseInt(timeArray[1], 10);
|
316
|
-
this.second = parseInt(timeArray[2], 10);
|
317
|
-
|
318
|
-
if (isNaN(this.hour)) {
|
319
|
-
this.hour = 1;
|
320
|
-
}
|
321
|
-
if (isNaN(this.minute)) {
|
322
|
-
this.minute = 0;
|
323
|
-
}
|
324
|
-
|
325
|
-
if (this.showMeridian) {
|
326
|
-
if (this.hour > 12) {
|
327
|
-
this.hour = 12;
|
328
|
-
} else if (this.hour < 1) {
|
329
|
-
this.hour = 1;
|
330
|
-
}
|
331
|
-
|
332
|
-
if (this.meridian == 'am' || this.meridian == 'a') {
|
333
|
-
this.meridian = 'AM';
|
334
|
-
} else if (this.meridian == 'pm' || this.meridian == 'p') {
|
335
|
-
this.meridian = 'PM';
|
336
|
-
}
|
337
|
-
|
338
|
-
if (this.meridian != 'AM' && this.meridian != 'PM') {
|
339
|
-
this.meridian = 'AM';
|
340
|
-
}
|
341
|
-
}
|
342
|
-
|
343
|
-
if (this.minute < 0) {
|
344
|
-
this.minute = 0;
|
345
|
-
} else if (this.minute > 60) {
|
346
|
-
this.minute = 60;
|
347
|
-
}
|
348
|
-
|
349
|
-
if (this.showSeconds) {
|
350
|
-
if (isNaN(this.second)) {
|
351
|
-
this.second = 0;
|
352
|
-
} else if (this.second < 0) {
|
353
|
-
this.second = 0;
|
354
|
-
} else if (this.second > 60) {
|
355
|
-
this.second = 60;
|
356
|
-
}
|
357
|
-
}
|
358
|
-
|
359
|
-
this.updateElement();
|
360
|
-
this.updateWidget();
|
361
|
-
}
|
362
|
-
|
363
|
-
, setMeridian: function(meridian) {
|
364
|
-
if (meridian == 'a' || meridian == 'am' || meridian == 'AM' ) {
|
365
|
-
this.meridian = 'AM';
|
366
|
-
} else if (meridian == 'p' || meridian == 'pm' || meridian == 'PM' ) {
|
367
|
-
this.meridian = 'PM';
|
368
|
-
} else {
|
369
|
-
this.updateWidget();
|
370
|
-
}
|
371
|
-
|
372
|
-
this.updateElement();
|
373
|
-
}
|
374
|
-
|
375
|
-
, setDefaultTime: function(defaultTime){
|
376
|
-
if (defaultTime) {
|
377
|
-
if (defaultTime === 'current') {
|
378
|
-
var dTime = new Date();
|
379
|
-
var hours = dTime.getHours();
|
380
|
-
var minutes = Math.floor(dTime.getMinutes() / this.minuteStep) * this.minuteStep;
|
381
|
-
var seconds = Math.floor(dTime.getSeconds() / this.secondStep) * this.secondStep;
|
382
|
-
var meridian = "AM";
|
383
|
-
if (this.showMeridian) {
|
384
|
-
if (hours === 0) {
|
385
|
-
hours = 12;
|
386
|
-
} else if (hours >= 12) {
|
387
|
-
if (hours > 12) {
|
388
|
-
hours = hours - 12;
|
389
|
-
}
|
390
|
-
meridian = "PM";
|
391
|
-
} else {
|
392
|
-
meridian = "AM";
|
393
|
-
}
|
394
|
-
}
|
395
|
-
this.hour = hours;
|
396
|
-
this.minute = minutes;
|
397
|
-
this.second = seconds;
|
398
|
-
this.meridian = meridian;
|
399
|
-
} else if (defaultTime === 'value') {
|
400
|
-
this.setValues(this.$element.val());
|
401
|
-
} else {
|
402
|
-
this.setValues(defaultTime);
|
403
|
-
}
|
404
|
-
this.update();
|
405
|
-
} else {
|
406
|
-
this.hour = 0;
|
407
|
-
this.minute = 0;
|
408
|
-
this.second = 0;
|
409
|
-
}
|
410
|
-
}
|
411
|
-
|
412
|
-
, formatTime: function(hour, minute, second, meridian) {
|
413
|
-
hour = hour < 10 ? '0' + hour : hour;
|
414
|
-
minute = minute < 10 ? '0' + minute : minute;
|
415
|
-
second = second < 10 ? '0' + second : second;
|
416
|
-
|
417
|
-
return hour + ':' + minute + (this.showSeconds ? ':' + second : '') + (this.showMeridian ? ' ' + meridian : '');
|
418
|
-
}
|
419
|
-
|
420
|
-
, getTime: function() {
|
421
|
-
return this.formatTime(this.hour, this.minute, this.second, this.meridian);
|
422
|
-
}
|
423
|
-
|
424
|
-
, setTime: function(time) {
|
425
|
-
this.setValues(time);
|
426
|
-
this.update();
|
427
|
-
}
|
428
|
-
|
429
|
-
, update: function() {
|
430
|
-
this.updateElement();
|
431
|
-
this.updateWidget();
|
432
|
-
}
|
433
|
-
|
434
|
-
, updateElement: function() {
|
435
|
-
var time = this.getTime();
|
436
|
-
|
437
|
-
this.$element.val(time).change();
|
438
|
-
|
439
|
-
switch (this.highlightedUnit) {
|
440
|
-
case 'hour':
|
441
|
-
this.highlightHour();
|
442
|
-
break;
|
443
|
-
case 'minute':
|
444
|
-
this.highlightMinute();
|
445
|
-
break;
|
446
|
-
case 'second':
|
447
|
-
this.highlightSecond();
|
448
|
-
break;
|
449
|
-
case 'meridian':
|
450
|
-
this.highlightMeridian();
|
451
|
-
break;
|
452
|
-
}
|
453
|
-
|
454
|
-
}
|
455
|
-
|
456
|
-
, updateWidget: function() {
|
457
|
-
if (this.showInputs) {
|
458
|
-
this.$widget.find('input.bootstrap-timepicker-hour').val(this.hour < 10 ? '0' + this.hour : this.hour);
|
459
|
-
this.$widget.find('input.bootstrap-timepicker-minute').val(this.minute < 10 ? '0' + this.minute : this.minute);
|
460
|
-
if (this.showSeconds) {
|
461
|
-
this.$widget.find('input.bootstrap-timepicker-second').val(this.second < 10 ? '0' + this.second : this.second);
|
462
|
-
}
|
463
|
-
if (this.showMeridian) {
|
464
|
-
this.$widget.find('input.bootstrap-timepicker-meridian').val(this.meridian);
|
465
|
-
}
|
466
|
-
} else {
|
467
|
-
this.$widget.find('span.bootstrap-timepicker-hour').text(this.hour);
|
468
|
-
this.$widget.find('span.bootstrap-timepicker-minute').text(this.minute < 10 ? '0' + this.minute : this.minute);
|
469
|
-
if (this.showSeconds) {
|
470
|
-
this.$widget.find('span.bootstrap-timepicker-second').text(this.second < 10 ? '0' + this.second : this.second);
|
471
|
-
}
|
472
|
-
if (this.showMeridian) {
|
473
|
-
this.$widget.find('span.bootstrap-timepicker-meridian').text(this.meridian);
|
474
|
-
}
|
475
|
-
}
|
476
|
-
}
|
477
|
-
|
478
|
-
, updateFromElementVal: function (e) {
|
479
|
-
var time = this.$element.val();
|
480
|
-
if (time) {
|
481
|
-
this.setValues(time);
|
482
|
-
this.updateWidget();
|
483
|
-
}
|
484
|
-
}
|
485
|
-
|
486
|
-
, updateFromWidgetInputs: function () {
|
487
|
-
var time = $('input.bootstrap-timepicker-hour').val() + ':' +
|
488
|
-
$('input.bootstrap-timepicker-minute').val() +
|
489
|
-
(this.showSeconds ?
|
490
|
-
':' + $('input.bootstrap-timepicker-second').val()
|
491
|
-
: '') +
|
492
|
-
(this.showMeridian ?
|
493
|
-
' ' + $('input.bootstrap-timepicker-meridian').val()
|
494
|
-
: '');
|
495
|
-
|
496
|
-
this.setValues(time);
|
497
|
-
}
|
498
|
-
|
499
|
-
, getCursorPosition: function() {
|
500
|
-
var input = this.$element.get(0);
|
501
|
-
|
502
|
-
if ('selectionStart' in input) {
|
503
|
-
// Standard-compliant browsers
|
504
|
-
return input.selectionStart;
|
505
|
-
} else if (document.selection) {
|
506
|
-
// IE fix
|
507
|
-
input.focus();
|
508
|
-
var sel = document.selection.createRange();
|
509
|
-
var selLen = document.selection.createRange().text.length;
|
510
|
-
sel.moveStart('character', - input.value.length);
|
511
|
-
|
512
|
-
return sel.text.length - selLen;
|
513
|
-
}
|
514
|
-
}
|
515
|
-
|
516
|
-
, highlightUnit: function () {
|
517
|
-
var input = this.$element.get(0);
|
518
|
-
|
519
|
-
this.position = this.getCursorPosition();
|
520
|
-
if (this.position >= 0 && this.position <= 2) {
|
521
|
-
this.highlightHour();
|
522
|
-
} else if (this.position >= 3 && this.position <= 5) {
|
523
|
-
this.highlightMinute();
|
524
|
-
} else if (this.position >= 6 && this.position <= 8) {
|
525
|
-
if (this.showSeconds) {
|
526
|
-
this.highlightSecond();
|
527
|
-
} else {
|
528
|
-
this.highlightMeridian();
|
529
|
-
}
|
530
|
-
} else if (this.position >= 9 && this.position <= 11) {
|
531
|
-
this.highlightMeridian();
|
532
|
-
}
|
533
|
-
}
|
534
|
-
|
535
|
-
, highlightNextUnit: function() {
|
536
|
-
switch (this.highlightedUnit) {
|
537
|
-
case 'hour':
|
538
|
-
this.highlightMinute();
|
539
|
-
break;
|
540
|
-
case 'minute':
|
541
|
-
if (this.showSeconds) {
|
542
|
-
this.highlightSecond();
|
543
|
-
} else {
|
544
|
-
this.highlightMeridian();
|
545
|
-
}
|
546
|
-
break;
|
547
|
-
case 'second':
|
548
|
-
this.highlightMeridian();
|
549
|
-
break;
|
550
|
-
case 'meridian':
|
551
|
-
this.highlightHour();
|
552
|
-
break;
|
553
|
-
}
|
554
|
-
}
|
555
|
-
|
556
|
-
, highlightPrevUnit: function() {
|
557
|
-
switch (this.highlightedUnit) {
|
558
|
-
case 'hour':
|
559
|
-
this.highlightMeridian();
|
560
|
-
break;
|
561
|
-
case 'minute':
|
562
|
-
this.highlightHour();
|
563
|
-
break;
|
564
|
-
case 'second':
|
565
|
-
this.highlightMinute();
|
566
|
-
break;
|
567
|
-
case 'meridian':
|
568
|
-
if (this.showSeconds) {
|
569
|
-
this.highlightSecond();
|
570
|
-
} else {
|
571
|
-
this.highlightMinute();
|
572
|
-
}
|
573
|
-
break;
|
574
|
-
}
|
575
|
-
}
|
576
|
-
|
577
|
-
, highlightHour: function() {
|
578
|
-
this.highlightedUnit = 'hour';
|
579
|
-
//this.$element.get(0).setSelectionRange(0,2);
|
580
|
-
}
|
581
|
-
|
582
|
-
, highlightMinute: function() {
|
583
|
-
this.highlightedUnit = 'minute';
|
584
|
-
//this.$element.get(0).setSelectionRange(3,5);
|
585
|
-
}
|
586
|
-
|
587
|
-
, highlightSecond: function() {
|
588
|
-
this.highlightedUnit = 'second';
|
589
|
-
//this.$element.get(0).setSelectionRange(6,8);
|
590
|
-
}
|
591
|
-
|
592
|
-
, highlightMeridian: function() {
|
593
|
-
this.highlightedUnit = 'meridian';
|
594
|
-
if (this.showSeconds) {
|
595
|
-
//this.$element.get(0).setSelectionRange(9,11);
|
596
|
-
} else {
|
597
|
-
//this.$element.get(0).setSelectionRange(6,8);
|
598
|
-
}
|
599
|
-
}
|
600
|
-
|
601
|
-
, incrementHour: function() {
|
602
|
-
if (this.showMeridian) {
|
603
|
-
if (this.hour === 11) {
|
604
|
-
this.toggleMeridian();
|
605
|
-
} else if (this.hour === 12) {
|
606
|
-
return this.hour = 1;
|
607
|
-
}
|
608
|
-
}
|
609
|
-
if (this.hour === 23) {
|
610
|
-
return this.hour = 0;
|
611
|
-
}
|
612
|
-
this.hour = this.hour + 1;
|
613
|
-
}
|
614
|
-
|
615
|
-
, decrementHour: function() {
|
616
|
-
if (this.showMeridian) {
|
617
|
-
if (this.hour === 1) {
|
618
|
-
return this.hour = 12;
|
619
|
-
}
|
620
|
-
else if (this.hour === 12) {
|
621
|
-
this.toggleMeridian();
|
622
|
-
}
|
623
|
-
}
|
624
|
-
if (this.hour === 0) {
|
625
|
-
return this.hour = 23;
|
626
|
-
}
|
627
|
-
this.hour = this.hour - 1;
|
628
|
-
}
|
629
|
-
|
630
|
-
, incrementMinute: function() {
|
631
|
-
var newVal = this.minute + this.minuteStep - (this.minute % this.minuteStep);
|
632
|
-
if (newVal > 59) {
|
633
|
-
this.incrementHour();
|
634
|
-
this.minute = newVal - 60;
|
635
|
-
} else {
|
636
|
-
this.minute = newVal;
|
637
|
-
}
|
638
|
-
}
|
639
|
-
|
640
|
-
, decrementMinute: function() {
|
641
|
-
var newVal = this.minute - this.minuteStep;
|
642
|
-
if (newVal < 0) {
|
643
|
-
this.decrementHour();
|
644
|
-
this.minute = newVal + 60;
|
645
|
-
} else {
|
646
|
-
this.minute = newVal;
|
647
|
-
}
|
648
|
-
}
|
649
|
-
|
650
|
-
, incrementSecond: function() {
|
651
|
-
var newVal = this.second + this.secondStep - (this.second % this.secondStep);
|
652
|
-
if (newVal > 59) {
|
653
|
-
this.incrementMinute();
|
654
|
-
this.second = newVal - 60;
|
655
|
-
} else {
|
656
|
-
this.second = newVal;
|
657
|
-
}
|
658
|
-
}
|
659
|
-
|
660
|
-
, decrementSecond: function() {
|
661
|
-
var newVal = this.second - this.secondStep;
|
662
|
-
if (newVal < 0) {
|
663
|
-
this.decrementMinute();
|
664
|
-
this.second = newVal + 60;
|
665
|
-
} else {
|
666
|
-
this.second = newVal;
|
667
|
-
}
|
668
|
-
}
|
669
|
-
|
670
|
-
, toggleMeridian: function() {
|
671
|
-
this.meridian = this.meridian === 'AM' ? 'PM' : 'AM';
|
672
|
-
|
673
|
-
this.update();
|
674
|
-
}
|
675
|
-
|
676
|
-
, getTemplate: function() {
|
677
|
-
if (this.options.templates[this.options.template]) {
|
678
|
-
return this.options.templates[this.options.template];
|
679
|
-
}
|
680
|
-
if (this.showInputs) {
|
681
|
-
var hourTemplate = '<input type="text" name="hour" class="bootstrap-timepicker-hour" maxlength="2"/>';
|
682
|
-
var minuteTemplate = '<input type="text" name="minute" class="bootstrap-timepicker-minute" maxlength="2"/>';
|
683
|
-
var secondTemplate = '<input type="text" name="second" class="bootstrap-timepicker-second" maxlength="2"/>';
|
684
|
-
var meridianTemplate = '<input type="text" name="meridian" class="bootstrap-timepicker-meridian" maxlength="2"/>';
|
685
|
-
} else {
|
686
|
-
var hourTemplate = '<span class="bootstrap-timepicker-hour"></span>';
|
687
|
-
var minuteTemplate = '<span class="bootstrap-timepicker-minute"></span>';
|
688
|
-
var secondTemplate = '<span class="bootstrap-timepicker-second"></span>';
|
689
|
-
var meridianTemplate = '<span class="bootstrap-timepicker-meridian"></span>';
|
690
|
-
}
|
691
|
-
var templateContent = '<table class="'+ (this.showSeconds ? 'show-seconds' : '') +' '+ (this.showMeridian ? 'show-meridian' : '') +'">'+
|
692
|
-
'<tr>'+
|
693
|
-
'<td><a href="#" data-action="incrementHour"><i class="fa fa-chevron-up"></i></a></td>'+
|
694
|
-
'<td class="separator"> </td>'+
|
695
|
-
'<td><a href="#" data-action="incrementMinute"><i class="fa fa-chevron-up"></i></a></td>'+
|
696
|
-
(this.showSeconds ?
|
697
|
-
'<td class="separator"> </td>'+
|
698
|
-
'<td><a href="#" data-action="incrementSecond"><i class="fa fa-chevron-up"></i></a></td>'
|
699
|
-
: '') +
|
700
|
-
(this.showMeridian ?
|
701
|
-
'<td class="separator"> </td>'+
|
702
|
-
'<td class="meridian-column"><a href="#" data-action="toggleMeridian"><i class="fa fa-chevron-up"></i></a></td>'
|
703
|
-
: '') +
|
704
|
-
'</tr>'+
|
705
|
-
'<tr>'+
|
706
|
-
'<td>'+ hourTemplate +'</td> '+
|
707
|
-
'<td class="separator">:</td>'+
|
708
|
-
'<td>'+ minuteTemplate +'</td> '+
|
709
|
-
(this.showSeconds ?
|
710
|
-
'<td class="separator">:</td>'+
|
711
|
-
'<td>'+ secondTemplate +'</td>'
|
712
|
-
: '') +
|
713
|
-
(this.showMeridian ?
|
714
|
-
'<td class="separator"> </td>'+
|
715
|
-
'<td>'+ meridianTemplate +'</td>'
|
716
|
-
: '') +
|
717
|
-
'</tr>'+
|
718
|
-
'<tr>'+
|
719
|
-
'<td><a href="#" data-action="decrementHour"><i class="fa fa-chevron-down"></i></a></td>'+
|
720
|
-
'<td class="separator"></td>'+
|
721
|
-
'<td><a href="#" data-action="decrementMinute"><i class="fa fa-chevron-down"></i></a></td>'+
|
722
|
-
(this.showSeconds ?
|
723
|
-
'<td class="separator"> </td>'+
|
724
|
-
'<td><a href="#" data-action="decrementSecond"><i class="fa fa-chevron-down"></i></a></td>'
|
725
|
-
: '') +
|
726
|
-
(this.showMeridian ?
|
727
|
-
'<td class="separator"> </td>'+
|
728
|
-
'<td><a href="#" data-action="toggleMeridian"><i class="fa fa-chevron-down"></i></a></td>'
|
729
|
-
: '') +
|
730
|
-
'</tr>'+
|
731
|
-
'</table>';
|
732
|
-
|
733
|
-
var template;
|
734
|
-
switch(this.options.template) {
|
735
|
-
case 'modal':
|
736
|
-
template = '<div class="bootstrap-timepicker modal fade in" style="top: 30%; margin-top: 0;" data-backdrop="'+ (this.modalBackdrop ? 'true' : 'false') +'">'+
|
737
|
-
'<div class="modal-dialog">'+
|
738
|
-
'<div class="modal-content">'+
|
739
|
-
'<div class="modal-header">'+
|
740
|
-
'<a href="#" class="close" data-dismiss="modal">×</a>'+
|
741
|
-
'<h3>Pick a Time</h3>'+
|
742
|
-
'</div>'+
|
743
|
-
'<div class="modal-content">'+
|
744
|
-
templateContent +
|
745
|
-
'</div>'+
|
746
|
-
'<div class="modal-footer">'+
|
747
|
-
'<a href="#" class="btn btn-primary" data-dismiss="modal">Ok</a>'+
|
748
|
-
'</div>'+
|
749
|
-
'</div>'+
|
750
|
-
'</div>'+
|
751
|
-
'</div>';
|
752
|
-
|
753
|
-
break;
|
754
|
-
case 'dropdown':
|
755
|
-
template = '<div class="bootstrap-timepicker dropdown-menu">'+
|
756
|
-
templateContent +
|
757
|
-
'</div>';
|
758
|
-
break;
|
759
|
-
|
760
|
-
}
|
761
|
-
return template;
|
762
|
-
}
|
763
|
-
};
|
764
|
-
|
765
|
-
|
766
|
-
/* TIMEPICKER PLUGIN DEFINITION
|
767
|
-
* =========================== */
|
768
|
-
|
769
|
-
$.fn.timepicker = function (option) {
|
770
|
-
return this.each(function () {
|
771
|
-
var $this = $(this)
|
772
|
-
, data = $this.data('timepicker')
|
773
|
-
, options = typeof option == 'object' && option;
|
774
|
-
if (!data) {
|
775
|
-
$this.data('timepicker', (data = new Timepicker(this, options)));
|
776
|
-
}
|
777
|
-
if (typeof option == 'string') {
|
778
|
-
data[option]();
|
779
|
-
}
|
780
|
-
})
|
781
|
-
}
|
782
|
-
|
783
|
-
$.fn.timepicker.defaults = {
|
784
|
-
minuteStep: 15
|
785
|
-
, secondStep: 15
|
786
|
-
, disableFocus: false
|
787
|
-
, defaultTime: 'current'
|
788
|
-
, showSeconds: false
|
789
|
-
, showInputs: true
|
790
|
-
, showMeridian: true
|
791
|
-
, template: 'dropdown'
|
792
|
-
, modalBackdrop: false
|
793
|
-
, templates: {} // set custom templates
|
794
|
-
}
|
795
|
-
|
796
|
-
$.fn.timepicker.Constructor = Timepicker
|
797
|
-
}(window.jQuery);
|