bootstrap_builders 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb7c7644e9b3fb61308f5c91ce4721f6c919af49
|
4
|
+
data.tar.gz: 4a5fe3886d8bebd03dde534cd3c84f3df7716702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a6f4c9f052c961c38d0cbb34c1704aa6b5e9350f047995c4ea7eb9898f58bd1a1a7b52c91e63402e94cac7d8e0cafd50cb77bc54b570ae1701995cc37fef796
|
7
|
+
data.tar.gz: 21927109d19fdd8320065a4168344f503328a693843e42201ef7e94bcf4ed5c3bac02f7f91e1d3d96d2c6721570a4cff6e8edee90a53e91e0f3e6c54efd6fb88
|
@@ -1,85 +1,59 @@
|
|
1
1
|
(($, window, document) ->
|
2
|
-
$this = undefined
|
3
|
-
$text_ele = undefined
|
4
|
-
$form = undefined
|
5
|
-
$year_ele = undefined
|
6
|
-
$month_ele = undefined
|
7
|
-
$day_ele = undefined
|
8
|
-
$hour_ele = undefined
|
9
|
-
$min_ele = undefined
|
10
|
-
|
11
2
|
methods = {
|
12
3
|
# Constructor.
|
13
4
|
init: (options) ->
|
14
|
-
$this = $(@)
|
15
|
-
throw "Invalid element given." if $this.length <= 0
|
16
|
-
|
17
5
|
# The hidden Rails-inputs that will get the actual values like year, month, date, hour and minute.
|
18
|
-
|
19
|
-
|
20
|
-
$year_ele = $(".bb-date-picker-input-year", $this).first()
|
21
|
-
$month_ele = $(".bb-date-picker-input-moth", $this).first()
|
22
|
-
$day_ele = $(".bb-date-picker-input-day", $this).first()
|
23
|
-
$hour_ele = $(".bb-date-picker-input-hour", $this).first()
|
24
|
-
$min_ele = $(".bb-date-picker-input-min", $this).first()
|
25
|
-
|
26
|
-
throw "Could not find the year element." if $year_ele.length <= 0
|
6
|
+
text_ele = $("input.bb_date_picker, input.bb_date_time_picker", $(@))
|
7
|
+
form = text_ele.parents("form").first()
|
27
8
|
|
28
9
|
# Update values on form-submit.
|
29
|
-
if
|
30
|
-
|
10
|
+
if form.length > 0 && form.data("bb-date-picker-input") != "true"
|
11
|
+
form.data("bb-date-picker-input", "true")
|
31
12
|
|
32
|
-
|
13
|
+
form.submit ->
|
33
14
|
$(".bb-date-picker-input", this).each ->
|
34
15
|
$(this).bbDatePickerInput("updateValues")
|
35
16
|
return true
|
36
17
|
|
37
18
|
# Update the values when the date is changed or upon blur
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
return $this
|
19
|
+
text_ele.on "changeDate blur", ->
|
20
|
+
parents = $(this).parents(".bb-date-picker")
|
21
|
+
throw "No parents were found" if parents.length <= 0
|
22
|
+
parents.first().bbDatePickerInput("updateValues")
|
43
23
|
|
44
24
|
# Parses the date in the input-field and updates all the hidden Rails-inputs from the parsed values.
|
45
25
|
updateValues: ->
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
$month_ele = $(".bb-date-picker-input-month", $this).first()
|
53
|
-
$day_ele = $(".bb-date-picker-input-day", $this).first()
|
54
|
-
$hour_ele = $(".bb-date-picker-input-hour", $this).first()
|
55
|
-
$min_ele = $(".bb-date-picker-input-min", $this).first()
|
26
|
+
text_ele = $("input.bb_date_picker, input.bb_date_time_picker", $(@))
|
27
|
+
year_ele = $(".bb-date-picker-input-year", $(@)).first()
|
28
|
+
month_ele = $(".bb-date-picker-input-moth", $(@)).first()
|
29
|
+
day_ele = $(".bb-date-picker-input-day", $(@)).first()
|
30
|
+
hour_ele = $(".bb-date-picker-input-hour", $(@)).first()
|
31
|
+
min_ele = $(".bb-date-picker-input-min", $(@)).first()
|
56
32
|
|
57
|
-
if $.trim(
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
else if match =
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
else if match =
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
33
|
+
if $.trim(text_ele.val()) == ""
|
34
|
+
year_ele.val("")
|
35
|
+
month_ele.val("")
|
36
|
+
day_ele.val("")
|
37
|
+
hour_ele.val("")
|
38
|
+
min_ele.val("")
|
39
|
+
else if match = text_ele.val().match(/^\s*(\d+)-(\d+)-(\d+)\s+(\d+):(\d+)\s*$/)
|
40
|
+
year_ele.val(match[1])
|
41
|
+
month_ele.val(match[2])
|
42
|
+
day_ele.val(match[3])
|
43
|
+
hour_ele.val(match[4])
|
44
|
+
min_ele.val(match[5])
|
45
|
+
else if match = text_ele.val().match(/^\s*(\d+)-(\d+)-(\d+)\s*$/)
|
46
|
+
year_ele.val(match[1])
|
47
|
+
month_ele.val(match[2])
|
48
|
+
day_ele.val(match[3])
|
49
|
+
hour_ele.val(0)
|
50
|
+
min_ele.val(0)
|
75
51
|
else
|
76
|
-
throw "Invalid date-format: '" +
|
52
|
+
throw "Invalid date-format: '" + text_ele.val() + "'."
|
77
53
|
|
78
54
|
# Set the content to be a date, if this is a date-input-picker.
|
79
|
-
if match &&
|
80
|
-
|
81
|
-
|
82
|
-
return $this
|
55
|
+
if match && text_ele.hasClass("bb_date_picker")
|
56
|
+
text_ele.val(match[1] + "-" + match[2] + "-" + match[3])
|
83
57
|
}
|
84
58
|
|
85
59
|
# Initialize the plugin.
|
@@ -93,5 +67,4 @@
|
|
93
67
|
) jQuery, window, document
|
94
68
|
|
95
69
|
$ ->
|
96
|
-
$(".bb-date-picker").each ->
|
97
|
-
$(this).bbDatePickerInput()
|
70
|
+
$(".bb-date-picker").each -> $(this).bbDatePickerInput()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap_builders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|