-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdatepicker_example.cljs
More file actions
139 lines (129 loc) · 5.87 KB
/
datepicker_example.cljs
File metadata and controls
139 lines (129 loc) · 5.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
(ns examples.basic.datepicker-example
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[sablono.core :as html :refer-macros [html]]
[om-widgets.core :as w]))
(defn datepicker-example
[app owner]
(reify
om/IRenderState
(render-state [this state]
(html
[:div.panel.panel-default
[:div.panel-heading "Datepicker"]
[:div.panel-body
[:div.row
[:div.col-lg-6
[:label "Datepicker placement"]
[:div.well
[:label "Input Group - left side"]
(w/popover
(fn [show]
[:div.input-group
[:span.input-group-btn
[:button.btn.btn-primary {:id "btn-cal-left" :onClick show}
[:span.glyphicon.glyphicon-calendar]]]
(w/textinput app :input-group-left {:input-class "form-control"
:input-format "date"
:placeholder "MM/DD/YYYY"})])
(fn [close]
(w/datepicker app :input-group-left))
{:for "btn-cal-left"})]
[:div.well
[:label "Input Group - right side"]
(w/popover
(fn [show]
[:div.input-group
(w/textinput app :input-group-right {:input-class "form-control"
:input-format "date"
:placeholder "MM/DD/YYYY"})
[:span.input-group-btn
[:button.btn.btn-primary {:id "btn-cal-right" :onClick show}
[:span.glyphicon.glyphicon-calendar]]]])
(fn [close]
(w/datepicker app :input-group-right))
{:for "btn-cal-right"})]
[:label "Actions when a date's been selected"]
[:div.well
[:label "Input Group - Close when selecting day"]
(w/popover
(fn [show]
[:div.input-group
(w/textinput app :input-group-close-on-change {:input-class "form-control"
:input-format "date"
:placeholder "MM/DD/YYYY"})
[:span.input-group-btn
[:button.btn.btn-primary {:id "btn-cal-close-on-select" :onClick show}
[:span.glyphicon.glyphicon-calendar]]]])
(fn [close]
(w/datepicker app :input-group-close-on-change {:onChange close}))
{:for "btn-cal-close-on-select"})]]
[:div.col-lg-6
[:div.well
[:label "Monday-first:"]
(w/datepicker app :inline)]]]
[:div.row
[:div.col-lg-6
[:label "Formatting and separators"]
[:div.well
[:label "YYYY/MM/DD"]
(w/popover
(fn [show]
[:div.input-group
(w/textinput app :slash-separator {:input-class "form-control"
:input-format "date"
:date-format "yyyy/MM/dd"})
[:span.input-group-btn
[:button.btn.btn-primary {:id "btn-cal-right" :onClick show}
[:span.glyphicon.glyphicon-calendar]]]])
(fn [close]
(w/datepicker app :slash-separator))
{:for "btn-cal-right"})]
[:div.well
[:label "YYYY-MM-DD"]
(w/popover
(fn [show]
[:div.input-group
(w/textinput app :hyphen-separator {:input-class "form-control"
:input-format "date"
:date-format "yyyy-MM-dd"})
[:span.input-group-btn
[:button.btn.btn-primary {:id "btn-cal-right" :onClick show}
[:span.glyphicon.glyphicon-calendar]]]])
(fn [close]
(w/datepicker app :hyphen-separator))
{:for "btn-cal-right"})]
[:div.well
[:label "MM.DD.YYYY"]
(w/popover
(fn [show]
[:div.input-group
(w/textinput app :dot-separator {:input-class "form-control"
:input-format "date"
:date-format "MM.dd.yyyy"})
[:span.input-group-btn
[:button.btn.btn-primary {:id "btn-cal-right" :onClick show}
[:span.glyphicon.glyphicon-calendar]]]])
(fn [close]
(w/datepicker app :dot-separator))
{:for "btn-cal-right"})]
[:div.well
[:label "YYYYMMDD"]
(w/popover
(fn [show]
[:div.input-group
(w/textinput app :no-separator {:input-class "form-control"
:input-format "date"
:date-format "yyyyMMdd"})
[:span.input-group-btn
[:button.btn.btn-primary {:id "btn-cal-close-on-select" :onClick show}
[:span.glyphicon.glyphicon-calendar]]]])
(fn [close]
(w/datepicker app :no-separator))
{:for "btn-cal-close-on-select"})]]
[:div.col-lg-6
[:div.well
[:label "Sunday-first:"]
(w/datepicker app :inline {:sunday-first? true})
]
[:label (str (:inline app))]]]]]))))