platformx 0.0.8 → 0.0.8.1

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.
@@ -1,145 +1,145 @@
1
1
  module Platformx
2
- module FormHelpers
3
-
4
- # View helper to generate check box
5
- # @param id [String] the checkbox id attribute
6
- # @param name [String] the checkbox name attribute
7
- # @param value [String] the checkbox value
8
- # @param label [String] the checkbox label
9
- # @param checked [Boolean] if the checkbox is checked
10
- # @param switch [Boolean] if the checkbox is a switch
11
- # @param align [String] if the alignment should be left or right
12
- # @param inline [Boolean] if the element is inline
13
- # @param form_group [Boolean] if a form group
14
- # @param required [Boolean] if required or not
15
- # @return [String] Compiled html checkbox
16
- def x_checkbox(id: "", name: "", value: "", label: "", checked: false, switch: false, align: false, inline: false, form_group: true, required: false)
17
-
18
- checked_output = ""
19
- switchery_div = ""
20
- switchery_input = ""
21
- align_class = ""
22
- inline_class = ""
23
- form_group_start = ""
24
- form_group_end = ""
25
- required_output = ""
26
-
27
- if checked == true then checked_output='checked="checked"' end
28
- if switch == true then switchery_div='checkbox-switchery' end
29
- if switch == true then switchery_input='switch' end
30
- if align == "left" then align_class='pull-left' end
31
- if align == "right" then align_class='pull-right' end
32
- if inline == true then inline_class ='inline' end
33
- if form_group == true then form_group_start = '<div class="form-group">' end
34
- if form_group == true then form_group_end = '</div>' end
35
- if required == true then required_output = "data-parsley-mincheck='1'" end
36
-
37
- cb = <<EOS
38
- #{form_group_start}
39
- <div class="checkbox #{switchery_div}">
40
- <label class="#{align_class} #{inline_class}">
41
- <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
42
- <input type="checkbox" class="#{switchery_input}" id="#{id}" name="post[#{name}]" value="1" #{checked_output} data-toggle="checkbox" #{required_output}/>
43
- #{label} </label>
44
- </div>
45
- #{form_group_end}
46
- EOS
47
- return cb
48
- end
2
+ module FormHelpers
3
+
4
+ # View helper to generate check box
5
+ # @param id [String] the checkbox id attribute
6
+ # @param name [String] the checkbox name attribute
7
+ # @param value [String] the checkbox value
8
+ # @param label [String] the checkbox label
9
+ # @param checked [Boolean] if the checkbox is checked
10
+ # @param switch [Boolean] if the checkbox is a switch
11
+ # @param align [String] if the alignment should be left or right
12
+ # @param inline [Boolean] if the element is inline
13
+ # @param form_group [Boolean] if a form group
14
+ # @param required [Boolean] if required or not
15
+ # @return [String] Compiled html checkbox
16
+ def x_checkbox(id: "", name: "", value: "", label: "", checked: false, switch: false, align: false, inline: false, form_group: true, required: false)
17
+
18
+ checked_output = ""
19
+ switchery_div = ""
20
+ switchery_input = ""
21
+ align_class = ""
22
+ inline_class = ""
23
+ form_group_start = ""
24
+ form_group_end = ""
25
+ required_output = ""
49
26
 
50
- # Check box helper
51
- # @param id [String] the checkbox id
52
- # @param name [String] the name attribute of the checkbox
53
- # @param value [String] the checkbox value
54
- # @param label [String] the label text of the checkbox
55
- # @param checked [Boolean] if the checkbox is checked
56
- # @param switch [Boolean] if the checkbox is a switchery input
57
- # @param align [String] if the check box aligned 'left' or 'right'
58
- # @param inline [Boolean] if the checkbox is inline or not
59
- # @param form_group [Boolean] if the checkbox is of form group
60
- # @param required [Boolean] if checkbox is required
61
- # @return [String] the compiled checkbox
62
- def x_checkbox_string(id: "", name: "", value: "", label: "", checked: false, switch: false, align: false, inline: false, form_group: true, required: false)
63
-
64
- checked_output = ""
65
- switchery_div = ""
66
- switchery_input = ""
67
- align_class = ""
68
- inline_class = ""
69
- form_group_start = ""
70
- form_group_end = ""
71
- required_output = ""
72
-
73
- if checked == true then checked_output='checked="checked"' end
74
- if switch == true then switchery_div='checkbox-switchery' end
75
- if switch == true then switchery_input='switch' end
76
- if align == "left" then align_class='pull-left' end
77
- if align == "right" then align_class='pull-right' end
78
- if inline == true then inline_class ='inline' end
79
- if form_group == true then form_group_start = '<div class="form-group">' end
80
- if form_group == true then form_group_end = '</div>' end
81
- if required == true then required_output = "data-parsley-mincheck='1'" end
82
-
83
- cb = <<EOS
84
- #{form_group_start}
85
- <div class="checkbox #{switchery_div}">
86
- <label class="#{align_class} #{inline_class}">
87
- <input type="checkbox" class="#{switchery_input}" id="#{id}" name="#{name}" value="#{value}" #{checked_output} data-toggle="checkbox" #{required_output}/>
88
- #{label} </label>
89
- </div>
90
- #{form_group_end}
91
- EOS
92
- return cb
93
- end
27
+ if checked == true then checked_output='checked="checked"' end
28
+ if switch == true then switchery_div='checkbox-switchery' end
29
+ if switch == true then switchery_input='switch' end
30
+ if align == "left" then align_class='pull-left' end
31
+ if align == "right" then align_class='pull-right' end
32
+ if inline == true then inline_class ='inline' end
33
+ if form_group == true then form_group_start = '<div class="form-group">' end
34
+ if form_group == true then form_group_end = '</div>' end
35
+ if required == true then required_output = "data-parsley-mincheck='1'" end
36
+
37
+ cb = <<EOS
38
+ #{form_group_start}
39
+ <div class="checkbox #{switchery_div}">
40
+ <label class="#{align_class} #{inline_class}">
41
+ <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
42
+ <input type="checkbox" class="#{switchery_input}" id="#{id}" name="post[#{name}]" value="1" #{checked_output} data-toggle="checkbox" #{required_output}/>
43
+ #{label} </label>
44
+ </div>
45
+ #{form_group_end}
46
+ EOS
47
+ return cb
48
+ end
94
49
 
50
+ # Check box helper
51
+ # @param id [String] the checkbox id
52
+ # @param name [String] the name attribute of the checkbox
53
+ # @param value [String] the checkbox value
54
+ # @param label [String] the label text of the checkbox
55
+ # @param checked [Boolean] if the checkbox is checked
56
+ # @param switch [Boolean] if the checkbox is a switchery input
57
+ # @param align [String] if the check box aligned 'left' or 'right'
58
+ # @param inline [Boolean] if the checkbox is inline or not
59
+ # @param form_group [Boolean] if the checkbox is of form group
60
+ # @param required [Boolean] if checkbox is required
61
+ # @return [String] the compiled checkbox
62
+ def x_checkbox_string(id: "", name: "", value: "", label: "", checked: false, switch: false, align: false, inline: false, form_group: true, required: false)
63
+
64
+ checked_output = ""
65
+ switchery_div = ""
66
+ switchery_input = ""
67
+ align_class = ""
68
+ inline_class = ""
69
+ form_group_start = ""
70
+ form_group_end = ""
71
+ required_output = ""
95
72
 
96
- # Radio button view helper
97
- # @param id [String] the radio id
98
- # @param name [String] the name attribute of the radio
99
- # @param value [String] the radio value
100
- # @param label [String] the label text of the radio
101
- # @param checked [Boolean] if the radio is checked
102
- # @param align [String] if the check box aligned 'left' or 'right'
103
- # @param inline [Boolean] if the radio is inline or not
104
- # @param form_group [Boolean] if the radio is of form group
105
- # @return [String] the compiled radio
106
- def x_radio(id: "", name: "", value: "", label: "", checked: false, align: false, inline: false, form_group: true)
107
-
108
- checked_output = ""
109
- align_class = ""
110
- inline_class = ""
111
- form_group_start = ""
112
- form_group_end = ""
113
-
114
- if checked == true then checked_output='checked="checked"' end
115
- if align == "left" then align_class='pull-left' end
116
- if align == "right" then align_class='pull-right' end
117
- if inline == true then inline_class ='inline' end
118
- if form_group == true then form_group_start = '<div class="form-group">' end
119
- if form_group == true then form_group_end = '</div>' end
120
-
121
- cb = <<EOS
122
- #{form_group_start}
123
- <div class="radio">
124
- <label class="#{align_class} #{inline_class}">
125
- <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
126
- <input type="radio" id="#{id}" name="post[#{name}]" value="1" #{checked_output} data-toggle="radio"/>
127
- #{label} </label>
128
- </div>
129
- #{form_group_end}
130
- EOS
131
- return cb
132
- end
73
+ if checked == true then checked_output='checked="checked"' end
74
+ if switch == true then switchery_div='checkbox-switchery' end
75
+ if switch == true then switchery_input='switch' end
76
+ if align == "left" then align_class='pull-left' end
77
+ if align == "right" then align_class='pull-right' end
78
+ if inline == true then inline_class ='inline' end
79
+ if form_group == true then form_group_start = '<div class="form-group">' end
80
+ if form_group == true then form_group_end = '</div>' end
81
+ if required == true then required_output = "data-parsley-mincheck='1'" end
82
+
83
+ cb = <<EOS
84
+ #{form_group_start}
85
+ <div class="checkbox #{switchery_div}">
86
+ <label class="#{align_class} #{inline_class}">
87
+ <input type="checkbox" class="#{switchery_input}" id="#{id}" name="#{name}" value="#{value}" #{checked_output} data-toggle="checkbox" #{required_output}/>
88
+ #{label} </label>
89
+ </div>
90
+ #{form_group_end}
91
+ EOS
92
+ return cb
93
+ end
133
94
 
134
- # Hidden input helper
135
- # @param id [String] hidden input id
136
- # @param name [String] hidden input name
137
- # @param value [String] hidden input value
138
- # @return [String] compiled hidden input html
139
- def x_hidden(id: "", name: "", value: "")
140
95
 
141
- hi = <<EOS
142
- <input type="hidden" id="#{id}" name="post[#{name}]" value="#{value}"/>
96
+ # Radio button view helper
97
+ # @param id [String] the radio id
98
+ # @param name [String] the name attribute of the radio
99
+ # @param value [String] the radio value
100
+ # @param label [String] the label text of the radio
101
+ # @param checked [Boolean] if the radio is checked
102
+ # @param align [String] if the check box aligned 'left' or 'right'
103
+ # @param inline [Boolean] if the radio is inline or not
104
+ # @param form_group [Boolean] if the radio is of form group
105
+ # @return [String] the compiled radio
106
+ def x_radio(id: "", name: "", value: "", label: "", checked: false, align: false, inline: false, form_group: true)
107
+
108
+ checked_output = ""
109
+ align_class = ""
110
+ inline_class = ""
111
+ form_group_start = ""
112
+ form_group_end = ""
113
+
114
+ if checked == true then checked_output='checked="checked"' end
115
+ if align == "left" then align_class='pull-left' end
116
+ if align == "right" then align_class='pull-right' end
117
+ if inline == true then inline_class ='inline' end
118
+ if form_group == true then form_group_start = '<div class="form-group">' end
119
+ if form_group == true then form_group_end = '</div>' end
120
+
121
+ cb = <<EOS
122
+ #{form_group_start}
123
+ <div class="radio">
124
+ <label class="#{align_class} #{inline_class}">
125
+ <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
126
+ <input type="radio" id="#{id}" name="post[#{name}]" value="1" #{checked_output} data-toggle="radio"/>
127
+ #{label} </label>
128
+ </div>
129
+ #{form_group_end}
130
+ EOS
131
+ return cb
132
+ end
133
+
134
+ # Hidden input helper
135
+ # @param id [String] hidden input id
136
+ # @param name [String] hidden input name
137
+ # @param value [String] hidden input value
138
+ # @return [String] compiled hidden input html
139
+ def x_hidden(id: "", name: "", value: "")
140
+
141
+ hi = <<EOS
142
+ <input type="hidden" id="#{id}" name="post[#{name}]" value="#{value}"/>
143
143
  EOS
144
144
  return hi
145
145
  end
@@ -182,29 +182,29 @@ def x_input(id: "", name: "", value: "", label: "", required: false, placeholder
182
182
  mask = "data-masked-input='#{mask}'"
183
183
  end
184
184
 
185
- tb = <<EOS
186
- <div class="form-group">
187
- #{label}#{required_output}
188
- <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag} #{mask} #{maxlength} />
189
- </div>
190
- EOS
185
+ tb = <<EOS
186
+ <div class="form-group">
187
+ #{label}#{required_output}
188
+ <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag} #{mask} #{maxlength} />
189
+ </div>
190
+ EOS
191
191
  return tb
192
- end
192
+ end
193
193
 
194
194
 
195
- # Money input helper
196
- # @param id [String] the money input id
197
- # @param name [String] the money input name
198
- # @param label [String] the money input label
199
- # @param required [Boolean] if money input is required or not
200
- # @param placeholder [String] the moeny input placeholder
201
- # @param mask [String] the money input mask
202
- # @param maxlength [String] max length of the input
203
- # @return [String] compiled money input html
204
- def x_money(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
195
+ # Money input helper
196
+ # @param id [String] the money input id
197
+ # @param name [String] the money input name
198
+ # @param label [String] the money input label
199
+ # @param required [Boolean] if money input is required or not
200
+ # @param placeholder [String] the moeny input placeholder
201
+ # @param mask [String] the money input mask
202
+ # @param maxlength [String] max length of the input
203
+ # @return [String] compiled money input html
204
+ def x_money(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
205
205
 
206
206
  id = name unless id != ""
207
- if required
207
+ if required
208
208
  if label != ""
209
209
  required_output = '<sup class="text-danger">*</sup>'
210
210
  else
@@ -228,31 +228,31 @@ def x_money(id: "", name: "", value: "", label: "", required: false, placeholder
228
228
  mask = "data-masked-input='#{mask}'"
229
229
  end
230
230
 
231
- tb = <<EOS
232
- <div class="form-group">
233
- <div class="input-group">
234
- <span class="input-group-addon">$</span>
235
- #{label}#{required_output}
236
- <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" data-parsley-type="number" #{required_tag} #{mask} #{maxlength} />
237
- </div>
238
- </div>
239
- EOS
231
+ tb = <<EOS
232
+ <div class="form-group">
233
+ <div class="input-group">
234
+ <span class="input-group-addon">$</span>
235
+ #{label}#{required_output}
236
+ <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" data-parsley-type="number" #{required_tag} #{mask} #{maxlength} />
237
+ </div>
238
+ </div>
239
+ EOS
240
240
  return tb
241
- end
241
+ end
242
242
 
243
- # Percentage input helper
244
- # @param id [String] percentage input id
245
- # @param name [String] percentage input name
246
- # @param value [String] percentage input value
247
- # @param label [String] percentage input label
248
- # @param required [Boolean] if percentage input is required
249
- # @param placeholder [String] percentage input placeholder
250
- # @param mask [String] percentage input mask
251
- # @param maxlength [String] percentage input maxlength
252
- def x_percentage(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
243
+ # Percentage input helper
244
+ # @param id [String] percentage input id
245
+ # @param name [String] percentage input name
246
+ # @param value [String] percentage input value
247
+ # @param label [String] percentage input label
248
+ # @param required [Boolean] if percentage input is required
249
+ # @param placeholder [String] percentage input placeholder
250
+ # @param mask [String] percentage input mask
251
+ # @param maxlength [String] percentage input maxlength
252
+ def x_percentage(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
253
253
 
254
254
  id = name unless id != ""
255
- if required
255
+ if required
256
256
  if label != ""
257
257
  required_output = '<sup class="text-danger">*</sup>'
258
258
  else
@@ -276,17 +276,17 @@ def x_percentage(id: "", name: "", value: "", label: "", required: false, placeh
276
276
  mask = "data-masked-input='#{mask}'"
277
277
  end
278
278
 
279
- tb = <<EOS
280
- <div class="form-group">
281
- <div class="input-group">
282
- <span class="input-group-addon">%</span>
283
- #{label}#{required_output}
284
- <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" data-parsley-type="number" #{required_tag} #{mask} #{maxlength} />
285
- </div>
286
- </div>
287
- EOS
279
+ tb = <<EOS
280
+ <div class="form-group">
281
+ <div class="input-group">
282
+ <span class="input-group-addon">%</span>
283
+ #{label}#{required_output}
284
+ <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" data-parsley-type="number" #{required_tag} #{mask} #{maxlength} />
285
+ </div>
286
+ </div>
287
+ EOS
288
288
  return tb
289
- end
289
+ end
290
290
 
291
291
  # Number input helper
292
292
  # @param id [String] number input id
@@ -300,7 +300,7 @@ end
300
300
  # @return [String] compiled html of number input
301
301
  def x_number(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
302
302
 
303
- if required
303
+ if required
304
304
  if label != ""
305
305
  required_output = '<sup class="text-danger">*</sup>'
306
306
  else
@@ -311,7 +311,7 @@ end
311
311
  required_output = ""
312
312
  required_tag = ""
313
313
  end
314
-
314
+
315
315
  if label != ""
316
316
  label = "<label>#{label}#{required_output}</label>"
317
317
  end
@@ -324,12 +324,12 @@ end
324
324
  mask = "data-masked-input='#{mask}'"
325
325
  end
326
326
 
327
- tb = <<EOS
328
- <div class="form-group">
329
- #{label}
330
- <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" data-parsley-type="number" #{mask} #{maxlength}/>
331
- </div>
332
- EOS
327
+ tb = <<EOS
328
+ <div class="form-group">
329
+ #{label}
330
+ <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" data-parsley-type="number" #{mask} #{maxlength}/>
331
+ </div>
332
+ EOS
333
333
  return tb
334
334
  end
335
335
 
@@ -347,7 +347,7 @@ EOS
347
347
  # @return [String] compiled html of phone input
348
348
  def x_phone(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "(999) 999-9999", maxlength: "12")
349
349
 
350
- if required
350
+ if required
351
351
  if label != ""
352
352
  required_output = '<sup class="text-danger">*</sup>'
353
353
  else
@@ -358,7 +358,7 @@ EOS
358
358
  required_output = ""
359
359
  required_tag = ""
360
360
  end
361
-
361
+
362
362
  if label != ""
363
363
  label = "<label>#{label}#{required_output}</label>"
364
364
  end
@@ -371,12 +371,12 @@ EOS
371
371
  maxlength = "maxlength='#{maxlength}'"
372
372
  end
373
373
 
374
- tb = <<EOS
375
- <div class="form-group">
376
- #{label}
377
- <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" #{mask} #{maxlength} />
378
- </div>
379
- EOS
374
+ tb = <<EOS
375
+ <div class="form-group">
376
+ #{label}
377
+ <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" #{mask} #{maxlength} />
378
+ </div>
379
+ EOS
380
380
  return tb
381
381
  end
382
382
 
@@ -393,7 +393,7 @@ EOS
393
393
  # @return [String] compiled html of credit card input
394
394
  def x_credit_card(id: "", name: "", value: "", label: "", required: false, placeholder: "", maxlength: "16", mask:"")
395
395
 
396
- if required
396
+ if required
397
397
  if label != ""
398
398
  required_output = '<sup class="text-danger">*</sup>'
399
399
  else
@@ -417,12 +417,12 @@ EOS
417
417
  maxlength = "maxlength='#{maxlength}'"
418
418
  end
419
419
 
420
- tb = <<EOS
421
- <div class="form-group">
422
- #{label}
423
- <input type="number" pattern="[0-9]{13,16}" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="integer" data-parsley-length="[13, 16]" placeholder="#{placeholder}" #{mask} #{maxlength} />
424
- </div>
425
- EOS
420
+ tb = <<EOS
421
+ <div class="form-group">
422
+ #{label}
423
+ <input type="number" pattern="[0-9]{13,16}" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="integer" data-parsley-length="[13, 16]" placeholder="#{placeholder}" #{mask} #{maxlength} />
424
+ </div>
425
+ EOS
426
426
  return tb
427
427
  end
428
428
 
@@ -438,7 +438,7 @@ EOS
438
438
  # @return [String] compiled html of cvc input
439
439
  def x_cvc(id: "", name: "", value: "", label: "", required: false, placeholder: "", maxlength: "4", mask:"999999999999999999")
440
440
 
441
- if required
441
+ if required
442
442
  if label != ""
443
443
  required_output = '<sup class="text-danger">*</sup>'
444
444
  else
@@ -461,12 +461,12 @@ EOS
461
461
  maxlength = "maxlength='#{maxlength}'"
462
462
  end
463
463
 
464
- tb = <<EOS
465
- <div class="form-group">
466
- #{label}#{required_output}
467
- <input type="number" pattern="[0-9]{3,4}" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="integer" data-parsley-length="[3, 4]" placeholder="#{placeholder}" #{mask} #{maxlength} />
468
- </div>
469
- EOS
464
+ tb = <<EOS
465
+ <div class="form-group">
466
+ #{label}#{required_output}
467
+ <input type="number" pattern="[0-9]{3,4}" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="integer" data-parsley-length="[3, 4]" placeholder="#{placeholder}" #{mask} #{maxlength} />
468
+ </div>
469
+ EOS
470
470
  return tb
471
471
  end
472
472
 
@@ -480,7 +480,7 @@ EOS
480
480
  # @return [String] compiled html of email input
481
481
  def x_email(id: "", name: "", value: "", label: "", required: false, placeholder: "")
482
482
 
483
- if required
483
+ if required
484
484
  if label != ""
485
485
  required_output = '<sup class="text-danger">*</sup>'
486
486
  else
@@ -495,12 +495,12 @@ EOS
495
495
  label = "<label>#{label}</label>"
496
496
  end
497
497
 
498
- tb = <<EOS
499
- <div class="form-group">
500
- #{label}#{required_output}
501
- <input type="email" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="email" placeholder="#{placeholder}" />
502
- </div>
503
- EOS
498
+ tb = <<EOS
499
+ <div class="form-group">
500
+ #{label}#{required_output}
501
+ <input type="email" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="email" placeholder="#{placeholder}" />
502
+ </div>
503
+ EOS
504
504
  return tb
505
505
  end
506
506
 
@@ -515,7 +515,7 @@ EOS
515
515
  # @return [String] compiled html of url input
516
516
  def x_url(id:"", name:"", value:"", label:"", required: false, placeholder: "")
517
517
 
518
- if required
518
+ if required
519
519
  if label != ""
520
520
  required_output = '<sup class="text-danger">*</sup>'
521
521
  else
@@ -529,13 +529,13 @@ EOS
529
529
  if label != ""
530
530
  label = "<label>#{label}</label>"
531
531
  end
532
-
533
- tb = <<EOS
534
- <div class="form-group">
535
- #{label}#{required_output}
536
- <input type="url" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="url" placeholder="#{placeholder}" />
537
- </div>
538
- EOS
532
+
533
+ tb = <<EOS
534
+ <div class="form-group">
535
+ #{label}#{required_output}
536
+ <input type="url" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="url" placeholder="#{placeholder}" />
537
+ </div>
538
+ EOS
539
539
  return tb
540
540
  end
541
541
 
@@ -550,7 +550,7 @@ EOS
550
550
  # @return [String] compiled html of file input
551
551
  def x_file(id:"", name:"", value:"", label:"", required: false, placeholder: "", css: "")
552
552
 
553
- if required
553
+ if required
554
554
  if label != ""
555
555
  required_output = '<sup class="text-danger">*</sup>'
556
556
  else
@@ -564,49 +564,49 @@ EOS
564
564
  if label != ""
565
565
  label = "<label>#{label}</label>"
566
566
  end
567
- tb = <<EOS
568
- <div class="form-group">
569
- #{label}#{required_output}
570
- <input type="file" class="form-control file #{css}" id="#{id}" name="filename" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
571
- </div>
572
- EOS
567
+ tb = <<EOS
568
+ <div class="form-group">
569
+ #{label}#{required_output}
570
+ <input type="file" class="form-control file #{css}" id="#{id}" name="filename" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
571
+ </div>
572
+ EOS
573
573
  return tb
574
574
  end
575
575
 
576
- # Image Upload
577
- # @param id [String] file input id
578
- # @param name [String] file input name
579
- # @param value [String] file input value
580
- # @param label [String] file input label
581
- # @param required [Boolean] if required or not
582
- # @param placeholder [String] file input placeholder text
583
- # @param css [String] file input css
584
- # @return [String] compiled html of file input
585
- def x_image_upload(id: "input1",name: "input1",value: "",label: "Input1",required: false, size: "1M",height: "",default: "")
586
-
587
- if required && label != ""
588
- required_output = '<sup class="text-danger">*</sup>'
589
- required_tag = 'required="required"'
590
- else
591
- required_output = ""
592
- required_tag = ""
593
- end
576
+ # Image Upload
577
+ # @param id [String] file input id
578
+ # @param name [String] file input name
579
+ # @param value [String] file input value
580
+ # @param label [String] file input label
581
+ # @param required [Boolean] if required or not
582
+ # @param placeholder [String] file input placeholder text
583
+ # @param css [String] file input css
584
+ # @return [String] compiled html of file input
585
+ def x_image_upload(id: "input1",name: "input1",value: "",label: "Input1",required: false, size: "1M",height: "",default: "")
594
586
 
595
- if height == ""
596
- height = ""
597
- else
598
- height="data-height='#{height}'"
599
- end
587
+ if required && label != ""
588
+ required_output = '<sup class="text-danger">*</sup>'
589
+ required_tag = 'required="required"'
590
+ else
591
+ required_output = ""
592
+ required_tag = ""
593
+ end
600
594
 
595
+ if height == ""
596
+ height = ""
597
+ else
598
+ height="data-height='#{height}'"
599
+ end
601
600
 
602
- tb = <<EOS
603
- <div class="form-group">
604
- <label>#{label}</label>
605
- <input type="file" class="form-control file dropify" data-default-file="#{value}" data-max-file-size="#{size}" id="#{id}" name="filename" value="#{value}" #{required_tag} #{height}/>
606
- </div>
607
- EOS
608
- return tb
609
- end
601
+
602
+ tb = <<EOS
603
+ <div class="form-group">
604
+ <label>#{label}</label>
605
+ <input type="file" class="form-control file dropify" data-default-file="#{value}" data-max-file-size="#{size}" id="#{id}" name="filename" value="#{value}" #{required_tag} #{height}/>
606
+ </div>
607
+ EOS
608
+ return tb
609
+ end
610
610
 
611
611
  # Date input helper
612
612
  # @param id [String] date input id
@@ -618,7 +618,7 @@ end
618
618
  # @return [String] compiled html of date input
619
619
  def x_date(id: "", name: "", value: "", label: "", required: false, placeholder: "")
620
620
 
621
- if required
621
+ if required
622
622
  if label != ""
623
623
  required_output = '<sup class="text-danger">*</sup>'
624
624
  else
@@ -633,15 +633,15 @@ end
633
633
  label = "<label for='#{id}' class='control-label'>#{label}</label>"
634
634
  end
635
635
 
636
- tb = <<EOS
637
- <div class="form-group">
638
- #{label}#{required_output}
636
+ tb = <<EOS
637
+ <div class="form-group">
638
+ #{label}#{required_output}
639
639
  <div class="input-group">
640
- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
641
- <input type="text" class="form-control datepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
642
- </div>
643
- </div>
644
- EOS
640
+ <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
641
+ <input type="text" class="form-control datepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
642
+ </div>
643
+ </div>
644
+ EOS
645
645
  return tb
646
646
  end
647
647
 
@@ -655,7 +655,7 @@ EOS
655
655
  # @return [String] compiled html of date-time input
656
656
  def x_datetime(id: "", name: "", value: "", label: "", required: false, placeholder: "")
657
657
 
658
- if required
658
+ if required
659
659
  if label != ""
660
660
  required_output = '<sup class="text-danger">*</sup>'
661
661
  else
@@ -670,15 +670,15 @@ EOS
670
670
  label = "<label for='#{id}' class='control-label'>#{label}</label>"
671
671
  end
672
672
 
673
- tb = <<EOS
674
- <div class="form-group">
675
- #{label}#{required_output}
673
+ tb = <<EOS
674
+ <div class="form-group">
675
+ #{label}#{required_output}
676
676
  <div class="input-group">
677
- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
678
- <input type="text" class="form-control datetimepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
679
- </div>
680
- </div>
681
- EOS
677
+ <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
678
+ <input type="text" class="form-control datetimepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
679
+ </div>
680
+ </div>
681
+ EOS
682
682
  return tb
683
683
  end
684
684
 
@@ -692,7 +692,7 @@ EOS
692
692
  # @return [String] compiled html of time input
693
693
  def x_time(id: "", name: "", value: "", label: "", required: false, placeholder: "")
694
694
 
695
- if required
695
+ if required
696
696
  if label != ""
697
697
  required_output = '<sup class="text-danger">*</sup>'
698
698
  else
@@ -707,15 +707,15 @@ EOS
707
707
  label = "<label for='#{id}' class='control-label'>#{label}</label>"
708
708
  end
709
709
 
710
- tb = <<EOS
711
- <div class="form-group">
712
- #{label}#{required_output}
710
+ tb = <<EOS
711
+ <div class="form-group">
712
+ #{label}#{required_output}
713
713
  <div class="input-group">
714
- <span class="input-group-addon"><i class="fa fa fa-clock-o"></i></span>
715
- <input type="text" class="form-control timepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
716
- </div>
717
- </div>
718
- EOS
714
+ <span class="input-group-addon"><i class="fa fa fa-clock-o"></i></span>
715
+ <input type="text" class="form-control timepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
716
+ </div>
717
+ </div>
718
+ EOS
719
719
  return tb
720
720
  end
721
721
 
@@ -730,7 +730,7 @@ EOS
730
730
  # @return [String] compiled html of password input
731
731
  def x_password(id: "",name: "", value: "", label: "", required: false, placeholder: "")
732
732
 
733
- if required
733
+ if required
734
734
  if label != ""
735
735
  required_output = '<sup class="text-danger">*</sup>'
736
736
  else
@@ -745,37 +745,37 @@ EOS
745
745
  label = "<label>#{label}</label>"
746
746
  end
747
747
 
748
- tb = <<EOS
749
- <div class="form-group">
750
- #{label}#{required_output}
751
- <input type="password" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-length="[6, 34]" placeholder="#{placeholder}" />
752
- </div>
753
- EOS
748
+ tb = <<EOS
749
+ <div class="form-group">
750
+ #{label}#{required_output}
751
+ <input type="password" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-length="[6, 34]" placeholder="#{placeholder}" />
752
+ </div>
753
+ EOS
754
754
  return tb
755
755
  end
756
756
 
757
- # Submit Helper
758
- # @param label [String] submit button label
759
- # @param css [String] submit button css
760
- # @param icon [String] submit button icon
761
- # @param size [String] submit button size
762
- # @param wrapper_css [String] submit button wrapper css
763
- # @return [String] compiled html of submit button
764
- def x_submit(label: "Submit", css: "btn-primary", icon: "", size: "", wrapper_css: "pull-right")
757
+ # Submit Helper
758
+ # @param label [String] submit button label
759
+ # @param css [String] submit button css
760
+ # @param icon [String] submit button icon
761
+ # @param size [String] submit button size
762
+ # @param wrapper_css [String] submit button wrapper css
763
+ # @return [String] compiled html of submit button
764
+ def x_submit(label: "Submit", css: "btn-primary", icon: "", size: "", wrapper_css: "pull-right")
765
765
 
766
- if icon != ""
766
+ if icon != ""
767
767
  icon = "<i class='fa #{icon}'></i> "
768
- end
768
+ end
769
769
 
770
- submit = <<EOS
771
- <div class="form-group form-actions #{wrapper_css}">
772
- <button type="submit" class="btn #{css} #{size}">#{icon}#{label}</button>
773
- </div>
774
- <div class="clearfix"></div>
775
- EOS
770
+ submit = <<EOS
771
+ <div class="form-group form-actions #{wrapper_css}">
772
+ <button type="submit" class="btn #{css} #{size}">#{icon}#{label}</button>
773
+ </div>
774
+ <div class="clearfix"></div>
775
+ EOS
776
776
 
777
- return submit
778
- end
777
+ return submit
778
+ end
779
779
 
780
780
 
781
781
 
@@ -790,7 +790,7 @@ end
790
790
  # @return [String] compiled html of textarea
791
791
  def x_textarea(id: "", name: "", value: "",label: "",placeholder: "",required: false, maxlength:"")
792
792
 
793
- if required
793
+ if required
794
794
  if label != ""
795
795
  required_output = '<sup class="text-danger">*</sup>'
796
796
  else
@@ -801,7 +801,7 @@ end
801
801
  required_output = ""
802
802
  required_tag = ""
803
803
  end
804
-
804
+
805
805
  if label != ""
806
806
  label = "<label for='#{id}'>#{label}</label>"
807
807
  end
@@ -814,12 +814,12 @@ end
814
814
  maxlength = "maxlength='#{maxlength}'"
815
815
  end
816
816
 
817
- ta = <<EOS
818
- <div class="form-group">
817
+ ta = <<EOS
818
+ <div class="form-group">
819
819
  #{label}#{required_output}
820
820
  <textarea name="post[#{name}]" id="#{id}" rows="4" class="form-control" placeholder="#{placeholder}" #{maxlength}>#{value}</textarea>
821
- </div>
822
- EOS
821
+ </div>
822
+ EOS
823
823
  return ta
824
824
  end
825
825
 
@@ -832,7 +832,7 @@ EOS
832
832
  # @return [String] compiled html of summernote
833
833
  def x_html(id: "", name: "", value: "", label: "", help: "", required: false)
834
834
 
835
- if required
835
+ if required
836
836
  if label != ""
837
837
  required_output = '<sup class="text-danger">*</sup>'
838
838
  else
@@ -846,127 +846,127 @@ EOS
846
846
  if label != ""
847
847
  label = "<label for='#{id}'>#{label}</label>"
848
848
  end
849
- ta = <<EOS
850
- <div class="form-group">
849
+ ta = <<EOS
850
+ <div class="form-group">
851
851
  #{label}
852
852
  <textarea name="post[#{name}]" id="#{id}" rows="4" class="form-control summernote">#{value}</textarea>
853
- </div>
854
- EOS
853
+ </div>
854
+ EOS
855
855
  return ta
856
856
  end
857
857
 
858
858
 
859
859
 
860
- # Year Drop down
861
- def x_year
862
- current_year = Time.now.year
863
-
864
- year_dd = <<EOS
865
- <select id="selected_year" name="selected_year" class="selectpicker" data-style="btn-primary btn" data-width="auto">
866
- <option selected="selected" value="#{current_year}">#{current_year}</option>
867
- <option value="#{current_year - 1}">#{current_year - 1}</option>
868
- <option value="#{current_year - 2}">#{current_year - 2}</option>
869
- <option value="#{current_year - 3}">#{current_year - 3}</option>
870
- <option value="#{current_year - 4}">#{current_year - 4}</option>
871
- <option value="#{current_year - 5}">#{current_year - 5}</option>
872
- <option value="#{current_year - 6}">#{current_year - 6}</option>
873
- <option value="#{current_year - 7}">#{current_year - 7}</option>
874
- </select>
875
- EOS
876
- end
860
+ # Year Drop down
861
+ def x_year
862
+ current_year = Time.now.year
877
863
 
864
+ year_dd = <<EOS
865
+ <select id="selected_year" name="selected_year" class="selectpicker" data-style="btn-primary btn" data-width="auto">
866
+ <option selected="selected" value="#{current_year}">#{current_year}</option>
867
+ <option value="#{current_year - 1}">#{current_year - 1}</option>
868
+ <option value="#{current_year - 2}">#{current_year - 2}</option>
869
+ <option value="#{current_year - 3}">#{current_year - 3}</option>
870
+ <option value="#{current_year - 4}">#{current_year - 4}</option>
871
+ <option value="#{current_year - 5}">#{current_year - 5}</option>
872
+ <option value="#{current_year - 6}">#{current_year - 6}</option>
873
+ <option value="#{current_year - 7}">#{current_year - 7}</option>
874
+ </select>
875
+ EOS
876
+ end
878
877
 
879
- # Year Drop down (expiry)
880
- def x_exp_year
881
- current_year = Time.now.year
882
- begining_year = Time.now.year + 6
883
-
884
- year_dd = <<EOS
885
- <div class="col-md-6">
886
- <div class="form-group">
887
- <label>Expiration Year</label>
888
- <select id="exp_year" name="post[exp_year]" class="form-control" data-stripe="exp-year">
889
- <option value="#{(current_year)}">#{current_year}</option>
890
- <option value="#{(current_year + 1)}">#{current_year + 1}</option>
891
- <option value="#{(current_year + 2)}">#{current_year + 2}</option>
892
- <option value="#{(current_year + 3)}">#{current_year + 3}</option>
893
- <option value="#{(current_year + 4)}">#{current_year + 4}</option>
894
- <option value="#{(current_year + 5)}">#{current_year + 5}</option>
895
- <option value="#{(current_year + 6)}">#{current_year + 6}</option>
896
- <option value="#{(current_year + 7)}">#{current_year + 7}</option>
897
- </select>
898
- </div>
899
- </div>
900
- EOS
901
- end
902
878
 
903
- # Month Drop down
904
- def x_exp_month
905
- current_year = Time.now.year
906
- begining_year = Time.now.year - 6
907
-
908
- year_dd = <<EOS
909
- <div class="col-md-6">
910
- <div class="form-group">
911
- <label>Expiration Month</label>
912
- <select id="exp_mo" name="post[exp_mo]" class="form-control" data-stripe="exp-month">
913
- <option value="01">01</option>
914
- <option value="02">02</option>
915
- <option value="03">03</option>
916
- <option value="04">04</option>
917
- <option value="05">05</option>
918
- <option value="06">06</option>
919
- <option value="07">07</option>
920
- <option value="08">08</option>
921
- <option value="09">09</option>
922
- <option value="10">10</option>
923
- <option value="11">11</option>
924
- <option value="12">12</option>
925
- </select>
926
- </div>
927
- </div>
928
- EOS
929
- end
879
+ # Year Drop down (expiry)
880
+ def x_exp_year
881
+ current_year = Time.now.year
882
+ begining_year = Time.now.year + 6
883
+
884
+ year_dd = <<EOS
885
+ <div class="col-md-6">
886
+ <div class="form-group">
887
+ <label>Expiration Year</label>
888
+ <select id="exp_year" name="post[exp_year]" class="form-control" data-stripe="exp-year">
889
+ <option value="#{(current_year)}">#{current_year}</option>
890
+ <option value="#{(current_year + 1)}">#{current_year + 1}</option>
891
+ <option value="#{(current_year + 2)}">#{current_year + 2}</option>
892
+ <option value="#{(current_year + 3)}">#{current_year + 3}</option>
893
+ <option value="#{(current_year + 4)}">#{current_year + 4}</option>
894
+ <option value="#{(current_year + 5)}">#{current_year + 5}</option>
895
+ <option value="#{(current_year + 6)}">#{current_year + 6}</option>
896
+ <option value="#{(current_year + 7)}">#{current_year + 7}</option>
897
+ </select>
898
+ </div>
899
+ </div>
900
+ EOS
901
+ end
930
902
 
931
- # Switch
932
- # @param id [String] summernote id
933
- # @param name [String] summernote name
934
- # @param value [String] summernote value
935
- # @param label [String] summernote label
936
- # @param checked [Boolen] if checked or not
937
- # @return [String] compiled html of summernote
938
- def x_switch(id: "", name: "", value: "", label: "", checked: false)
939
-
940
- checked_output = ""
941
-
942
- if checked == true then checked_output='checked="checked"' end
943
-
944
- cb = <<EOS
945
- <div class="form-group">
946
- <label>#{label}</label><br>
947
- <div class="switch"
948
- data-on-label="<i class='fa fa-check'></i>"
949
- data-off-label="<i class='fa fa-times'></i>">
950
- <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
951
- <input type="checkbox" id="#{id}" name="post[#{name}]" value="1" #{checked_output}/>
952
- </div>
953
- </div>
954
- EOS
955
- return cb
956
- end
903
+ # Month Drop down
904
+ def x_exp_month
905
+ current_year = Time.now.year
906
+ begining_year = Time.now.year - 6
907
+
908
+ year_dd = <<EOS
909
+ <div class="col-md-6">
910
+ <div class="form-group">
911
+ <label>Expiration Month</label>
912
+ <select id="exp_mo" name="post[exp_mo]" class="form-control" data-stripe="exp-month">
913
+ <option value="01">01</option>
914
+ <option value="02">02</option>
915
+ <option value="03">03</option>
916
+ <option value="04">04</option>
917
+ <option value="05">05</option>
918
+ <option value="06">06</option>
919
+ <option value="07">07</option>
920
+ <option value="08">08</option>
921
+ <option value="09">09</option>
922
+ <option value="10">10</option>
923
+ <option value="11">11</option>
924
+ <option value="12">12</option>
925
+ </select>
926
+ </div>
927
+ </div>
928
+ EOS
929
+ end
930
+
931
+ # Switch
932
+ # @param id [String] summernote id
933
+ # @param name [String] summernote name
934
+ # @param value [String] summernote value
935
+ # @param label [String] summernote label
936
+ # @param checked [Boolen] if checked or not
937
+ # @return [String] compiled html of summernote
938
+ def x_switch(id: "", name: "", value: "", label: "", checked: false)
939
+
940
+ checked_output = ""
941
+
942
+ if checked == true then checked_output='checked="checked"' end
943
+
944
+ cb = <<EOS
945
+ <div class="form-group">
946
+ <label>#{label}</label><br>
947
+ <div class="switch"
948
+ data-on-label="<i class='fa fa-check'></i>"
949
+ data-off-label="<i class='fa fa-times'></i>">
950
+ <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
951
+ <input type="checkbox" id="#{id}" name="post[#{name}]" value="1" #{checked_output}/>
952
+ </div>
953
+ </div>
954
+ EOS
955
+ return cb
956
+ end
957
957
 
958
- # Tags
959
- # @param id [String] tags id
960
- # @param name [String] tags name
961
- # @param value [String] tags value
962
- # @param label [String] tags label
963
- # @param required [Boolean] if required or not
964
- # @param placeholder [String] tags placeholder text
965
- # @return [String] compiled html of tags
966
- def x_tags(id: "", name: "", value: "", label: "", required: false, placeholder: "")
958
+ # Tags
959
+ # @param id [String] tags id
960
+ # @param name [String] tags name
961
+ # @param value [String] tags value
962
+ # @param label [String] tags label
963
+ # @param required [Boolean] if required or not
964
+ # @param placeholder [String] tags placeholder text
965
+ # @return [String] compiled html of tags
966
+ def x_tags(id: "", name: "", value: "", label: "", required: false, placeholder: "")
967
967
 
968
968
  id = name unless id != ""
969
- if required
969
+ if required
970
970
  if label != ""
971
971
  required_output = '<sup class="text-danger">*</sup>'
972
972
  else
@@ -981,29 +981,29 @@ def x_tags(id: "", name: "", value: "", label: "", required: false, placeholder:
981
981
  if label != ""
982
982
  label = "<label>#{label}</label>"
983
983
  end
984
- tb = <<EOS
985
- <div class="form-group">
986
- #{label}#{required_output}
987
- <input type="text" class="form-control tagsinput typeahead tag-azure tag-fill" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag}/>
988
- </div>
989
- EOS
984
+ tb = <<EOS
985
+ <div class="form-group">
986
+ #{label}#{required_output}
987
+ <input type="text" class="form-control tagsinput typeahead tag-azure tag-fill" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag}/>
988
+ </div>
989
+ EOS
990
990
  return tb
991
- end
991
+ end
992
992
 
993
993
 
994
- # Typeahead
995
- # @param id [String] typeahead id
996
- # @param name [String] typeahead name
997
- # @param value [String] typeahead value
998
- # @param label [String] typeahead label
999
- # @param required [Boolean] if required or not
1000
- # @param placeholder [String] typeahead placeholder text
1001
- # @param css [String] typeahead css
1002
- # @return [String] compiled html of typeahead
1003
- def x_typeahead(id: "", name: "", value: "", label: "", required: false, placeholder: "", css: "")
994
+ # Typeahead
995
+ # @param id [String] typeahead id
996
+ # @param name [String] typeahead name
997
+ # @param value [String] typeahead value
998
+ # @param label [String] typeahead label
999
+ # @param required [Boolean] if required or not
1000
+ # @param placeholder [String] typeahead placeholder text
1001
+ # @param css [String] typeahead css
1002
+ # @return [String] compiled html of typeahead
1003
+ def x_typeahead(id: "", name: "", value: "", label: "", required: false, placeholder: "", css: "")
1004
1004
 
1005
1005
  id = name unless id != ""
1006
- if required
1006
+ if required
1007
1007
  if label != ""
1008
1008
  required_output = '<sup class="text-danger">*</sup>'
1009
1009
  else
@@ -1018,115 +1018,115 @@ def x_typeahead(id: "", name: "", value: "", label: "", required: false, placeho
1018
1018
  if label != ""
1019
1019
  label = "<label>#{label}</label>"
1020
1020
  end
1021
- tb = <<EOS
1022
- <div class="form-group">
1023
- #{label}#{required_output}
1024
- <input type="text" class="form-control typeahead #{css}" autocomplete="off" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag}/>
1025
- </div>
1026
- EOS
1021
+ tb = <<EOS
1022
+ <div class="form-group">
1023
+ #{label}#{required_output}
1024
+ <input type="text" class="form-control typeahead #{css}" autocomplete="off" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag}/>
1025
+ </div>
1026
+ EOS
1027
1027
  return tb
1028
- end
1028
+ end
1029
1029
 
1030
1030
 
1031
- # Rating Radios
1032
- # @param id [String] id of the survey radio
1033
- # @param name [String] name of the survey radio
1034
- # @return [String] compiled html of the survey radio
1035
- def x_survey_radio(id: "", name: "")
1036
- tb = <<EOS
1037
- <label class="radio radio-inline">
1038
- <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="1">
1039
- </label>
1040
- <label class="radio radio-inline">
1041
- <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="2">
1042
- </label>
1043
- <label class="radio radio-inline">
1044
- <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="3">
1045
- </label>
1046
- <label class="radio radio-inline">
1047
- <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="4">
1048
- </label>
1049
- <label class="radio radio-inline">
1050
- <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="5">
1051
- </label>
1052
- <label class="radio radio-inline">
1053
- <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="6">
1054
- </label>
1055
- <label class="radio radio-inline">
1056
- <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="7">
1057
- </label>
1058
- EOS
1059
- return tb
1060
- end
1031
+ # Rating Radios
1032
+ # @param id [String] id of the survey radio
1033
+ # @param name [String] name of the survey radio
1034
+ # @return [String] compiled html of the survey radio
1035
+ def x_survey_radio(id: "", name: "")
1036
+ tb = <<EOS
1037
+ <label class="radio radio-inline">
1038
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="1">
1039
+ </label>
1040
+ <label class="radio radio-inline">
1041
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="2">
1042
+ </label>
1043
+ <label class="radio radio-inline">
1044
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="3">
1045
+ </label>
1046
+ <label class="radio radio-inline">
1047
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="4">
1048
+ </label>
1049
+ <label class="radio radio-inline">
1050
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="5">
1051
+ </label>
1052
+ <label class="radio radio-inline">
1053
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="6">
1054
+ </label>
1055
+ <label class="radio radio-inline">
1056
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="7">
1057
+ </label>
1058
+ EOS
1059
+ return tb
1060
+ end
1061
1061
 
1062
1062
 
1063
- # Select Dropdown
1064
- # @param id [String] id of the select
1065
- # @param name [String] name of the select
1066
- # @param value [String] value of the select
1067
- # @param name_col [String] name col of the select
1068
- # @param value_col [String] vale col of the select
1069
- # @param label [String] label of the select
1070
- # @param css [String] css of the select
1071
- # @param menu_style [String] menu syle of the select
1072
- # @param style [String] style classes of the select
1073
- # @param option_data [String] option data
1074
- # @param option_name [String] option name
1075
- # @param option_value [String] option value
1076
- # @param selected_value [String] selected value of the select
1077
- # @param title [String] title of the select
1078
- # @param multple [Boolean] if multiple selection is enabled
1079
- # @return [String] compiled select drop down
1080
- def x_select(id: "", name: "", value: "",name_col: "name", value_col: "id", label: "", css: "", menu_style: "dropdown-blue", style: "btn-default btn-block", option_data: "", option_name: "name", option_value: "id", selected_value: "", title: "", multiple: false)
1081
-
1082
- options_html = ""
1083
- show_multiple = ""
1084
-
1085
- if multiple == true
1086
- show_multiple = "Multiple"
1087
- end
1063
+ # Select Dropdown
1064
+ # @param id [String] id of the select
1065
+ # @param name [String] name of the select
1066
+ # @param value [String] value of the select
1067
+ # @param name_col [String] name col of the select
1068
+ # @param value_col [String] vale col of the select
1069
+ # @param label [String] label of the select
1070
+ # @param css [String] css of the select
1071
+ # @param menu_style [String] menu syle of the select
1072
+ # @param style [String] style classes of the select
1073
+ # @param option_data [String] option data
1074
+ # @param option_name [String] option name
1075
+ # @param option_value [String] option value
1076
+ # @param selected_value [String] selected value of the select
1077
+ # @param title [String] title of the select
1078
+ # @param multple [Boolean] if multiple selection is enabled
1079
+ # @return [String] compiled select drop down
1080
+ def x_select(id: "", name: "", value: "",name_col: "name", value_col: "id", label: "", css: "", menu_style: "dropdown-blue", style: "btn-default btn-block", option_data: "", option_name: "name", option_value: "id", selected_value: "", title: "", multiple: false)
1081
+
1082
+ options_html = ""
1083
+ show_multiple = ""
1084
+
1085
+ if multiple == true
1086
+ show_multiple = "Multiple"
1087
+ end
1088
1088
 
1089
- multiple_name = ""
1090
- if multiple == true
1091
- multiple_name = "[]"
1092
- end
1089
+ multiple_name = ""
1090
+ if multiple == true
1091
+ multiple_name = "[]"
1092
+ end
1093
1093
 
1094
- option_data.each do |i|
1095
- selected = ""
1094
+ option_data.each do |i|
1095
+ selected = ""
1096
1096
 
1097
- if selected_value == i[:id]
1098
- selected = "selected='selected'"
1099
- end
1097
+ if selected_value == i[:id]
1098
+ selected = "selected='selected'"
1099
+ end
1100
+
1101
+ unless name_col.kind_of?(Array)
1102
+ options_html << "<option value='#{i[value_col.to_sym]}' #{selected}>#{i[name_col.to_sym]}</option>"
1103
+ else
1104
+
1105
+ options_html << "<option value='#{i[value_col.to_sym]}' #{selected}>"
1106
+ name_col.each do |n|
1107
+ options_html << "#{i[n.to_sym]} "
1108
+ end
1109
+ options_html << "</option>"
1100
1110
 
1101
- unless name_col.kind_of?(Array)
1102
- options_html << "<option value='#{i[value_col.to_sym]}' #{selected}>#{i[name_col.to_sym]}</option>"
1103
- else
1104
-
1105
- options_html << "<option value='#{i[value_col.to_sym]}' #{selected}>"
1106
- name_col.each do |n|
1107
- options_html << "#{i[n.to_sym]} "
1111
+ end
1108
1112
  end
1109
- options_html << "</option>"
1110
-
1111
- end
1112
- end
1113
1113
 
1114
- if option_data.count == 0 || option_data.nil?
1115
- options_html << "<option value=''>No available selections</option>"
1116
- end
1114
+ if option_data.count == 0 || option_data.nil?
1115
+ options_html << "<option value=''>No available selections</option>"
1116
+ end
1117
1117
 
1118
1118
 
1119
- select = <<EOS
1120
- <div class="form-group">
1121
- <label>#{label}</label>
1122
- <select name="post[#{name}]#{multiple_name}" class="selectpicker #{css}" data-title="#{title}" title="#{title}" data-style="#{style}" data-menu-style="#{menu_style}" #{show_multiple}">
1123
- #{options_html}
1124
- </select>
1125
- </div>
1126
- EOS
1127
-
1128
- return select
1119
+ select = <<EOS
1120
+ <div class="form-group">
1121
+ <label>#{label}</label>
1122
+ <select name="post[#{name}]#{multiple_name}" class="#{css}" data-title="#{title}" title="#{title}" data-style="#{style}" data-menu-style="#{menu_style}" #{show_multiple}">
1123
+ #{options_html}
1124
+ </select>
1125
+ </div>
1126
+ EOS
1127
+
1128
+ return select
1129
1129
 
1130
- end
1131
1130
  end
1132
1131
  end
1132
+ end