platformx 0.0.4

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.
@@ -0,0 +1,100 @@
1
+ module Platformx
2
+ module FakerHelpers
3
+ ########################################################
4
+ #
5
+ # Start Helpers
6
+ #
7
+ ########################################################
8
+
9
+ ################# Faker Email #################
10
+ def x_faker_email()
11
+ return Faker::Internet.safe_email
12
+ end
13
+
14
+ ################# Faker First Name #################
15
+ def x_faker_first_name()
16
+ return Faker::Name.first_name
17
+ end
18
+
19
+ ################# Faker Last Name #################
20
+ def x_faker_last_name()
21
+ return Faker::Name.last_name
22
+ end
23
+
24
+ ################# Faker Street Address #################
25
+ def x_faker_street_address()
26
+ return Faker::Address.street_address
27
+ end
28
+
29
+ ################# Faker City #################
30
+ def x_faker_city()
31
+ return Faker::Address.city
32
+ end
33
+
34
+ ################# Faker State #################
35
+ def x_faker_state()
36
+ return Faker::Address.state_abbr
37
+ end
38
+
39
+ ################# Faker Zip #################
40
+ def x_faker_zip()
41
+ return Faker::Address.zip
42
+ end
43
+
44
+ ################# Faker Phone #################
45
+ def x_faker_phone()
46
+ return Faker::PhoneNumber.phone_number
47
+ end
48
+
49
+ ################# Faker Password #################
50
+ def x_faker_password()
51
+ return Faker::Internet.password
52
+ end
53
+
54
+ ################# UUID #################
55
+ def x_faker_uuid()
56
+ return UUIDTools::UUID.random_create
57
+ end
58
+
59
+ ################# Faker Birthday #################
60
+ def x_faker_birthday()
61
+ return Faker::Time.between(15.years.ago, 5.years.ago)
62
+ end
63
+
64
+ ################# Faker Number #################
65
+ def x_faker_number(length: 2)
66
+ return Faker::Number.number(length)
67
+ end
68
+
69
+ ################# Faker Boolean #################
70
+ def x_faker_boolean()
71
+ return Faker::Boolean.boolean(0.2)
72
+ end
73
+
74
+ ################# Faker Range #################
75
+ def x_faker_range(low:1, high:10)
76
+ return Faker::Number.between(low, high)
77
+ end
78
+
79
+ ################# Faker Price #################
80
+ def x_faker_price()
81
+ return Faker::Commerce.price
82
+ end
83
+
84
+ ################# Faker Chars #################
85
+ def x_faker_characters(length: 10)
86
+ return Faker::Lorem.characters(length)
87
+ end
88
+
89
+ ################# Faker Full Name #################
90
+ def x_faker_full_name()
91
+ return Faker::Name.name
92
+ end
93
+
94
+ ########################################################
95
+ #
96
+ # End
97
+ #
98
+ ########################################################
99
+ end
100
+ end
@@ -0,0 +1,953 @@
1
+ module Platformx
2
+ module FormHelpers
3
+ ########################################################
4
+ #
5
+ # Start Helpers
6
+ #
7
+ ########################################################
8
+ ########################################################
9
+ #
10
+ # Checkbox helper
11
+ #
12
+ ########################################################
13
+ def x_checkbox(id: "", name: "", value: "", label: "", checked: false, switch: false, align: false, inline: false, form_group: true, required: false)
14
+
15
+ checked_output = ""
16
+ switchery_div = ""
17
+ switchery_input = ""
18
+ align_class = ""
19
+ inline_class = ""
20
+ form_group_start = ""
21
+ form_group_end = ""
22
+ required_output = ""
23
+
24
+ if checked == true then checked_output='checked="checked"' end
25
+ if switch == true then switchery_div='checkbox-switchery' end
26
+ if switch == true then switchery_input='switch' end
27
+ if align == "left" then align_class='pull-left' end
28
+ if align == "right" then align_class='pull-right' end
29
+ if inline == true then inline_class ='inline' end
30
+ if form_group == true then form_group_start = '<div class="form-group">' end
31
+ if form_group == true then form_group_end = '</div>' end
32
+ if required == true then required_output = "data-parsley-mincheck='1'" end
33
+
34
+ cb = <<EOS
35
+ #{form_group_start}
36
+ <div class="checkbox #{switchery_div}">
37
+ <label class="#{align_class} #{inline_class}">
38
+ <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
39
+ <input type="checkbox" class="#{switchery_input}" id="#{id}" name="post[#{name}]" value="1" #{checked_output} data-toggle="checkbox" #{required_output}/>
40
+ #{label} </label>
41
+ </div>
42
+ #{form_group_end}
43
+ EOS
44
+ return cb
45
+ end
46
+
47
+ ########################################################
48
+ #
49
+ # Checkbox helper
50
+ #
51
+ ########################################################
52
+ def x_checkbox_string(id: "", name: "", value: "", label: "", checked: false, switch: false, align: false, inline: false, form_group: true, required: false)
53
+
54
+ checked_output = ""
55
+ switchery_div = ""
56
+ switchery_input = ""
57
+ align_class = ""
58
+ inline_class = ""
59
+ form_group_start = ""
60
+ form_group_end = ""
61
+ required_output = ""
62
+
63
+ if checked == true then checked_output='checked="checked"' end
64
+ if switch == true then switchery_div='checkbox-switchery' end
65
+ if switch == true then switchery_input='switch' end
66
+ if align == "left" then align_class='pull-left' end
67
+ if align == "right" then align_class='pull-right' end
68
+ if inline == true then inline_class ='inline' end
69
+ if form_group == true then form_group_start = '<div class="form-group">' end
70
+ if form_group == true then form_group_end = '</div>' end
71
+ if required == true then required_output = "data-parsley-mincheck='1'" end
72
+
73
+ cb = <<EOS
74
+ #{form_group_start}
75
+ <div class="checkbox #{switchery_div}">
76
+ <label class="#{align_class} #{inline_class}">
77
+ <input type="checkbox" class="#{switchery_input}" id="#{id}" name="#{name}" value="#{value}" #{checked_output} data-toggle="checkbox" #{required_output}/>
78
+ #{label} </label>
79
+ </div>
80
+ #{form_group_end}
81
+ EOS
82
+ return cb
83
+ end
84
+
85
+
86
+ ########################################################
87
+ #
88
+ # Radio helper
89
+ #
90
+ ########################################################
91
+ def x_radio(id: "", name: "", value: "", label: "", checked: false, align: false, inline: false, form_group: true)
92
+
93
+ checked_output = ""
94
+ align_class = ""
95
+ inline_class = ""
96
+ form_group_start = ""
97
+ form_group_end = ""
98
+
99
+ if checked == true then checked_output='checked="checked"' end
100
+ if align == "left" then align_class='pull-left' end
101
+ if align == "right" then align_class='pull-right' end
102
+ if inline == true then inline_class ='inline' end
103
+ if form_group == true then form_group_start = '<div class="form-group">' end
104
+ if form_group == true then form_group_end = '</div>' end
105
+
106
+ cb = <<EOS
107
+ #{form_group_start}
108
+ <div class="radio">
109
+ <label class="#{align_class} #{inline_class}">
110
+ <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
111
+ <input type="radio" id="#{id}" name="post[#{name}]" value="1" #{checked_output} data-toggle="radio"/>
112
+ #{label} </label>
113
+ </div>
114
+ #{form_group_end}
115
+ EOS
116
+ return cb
117
+ end
118
+
119
+ ########################################################
120
+ #
121
+ # Hidden input helper
122
+ #
123
+ ########################################################
124
+ def x_hidden(id: "", name: "", value: "")
125
+
126
+ hi = <<EOS
127
+ <input type="hidden" id="#{id}" name="post[#{name}]" value="#{value}"/>
128
+ EOS
129
+ return hi
130
+ end
131
+
132
+
133
+ ########################################################
134
+ #
135
+ # Text input helper
136
+ #
137
+ ########################################################
138
+ def x_input(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
139
+
140
+ id = name unless id != ""
141
+ if required
142
+ if label != ""
143
+ required_output = '<sup class="text-danger">*</sup>'
144
+ else
145
+ required_output = ''
146
+ end
147
+ required_tag = 'required="required"'
148
+ else
149
+ required_output = ""
150
+ required_tag = ""
151
+ end
152
+
153
+ if label != ""
154
+ label = "<label>#{label}</label>"
155
+ end
156
+
157
+ if maxlength != ""
158
+ maxlength = "maxlength='#{maxlength}'"
159
+ end
160
+
161
+ if mask != ""
162
+ mask = "data-masked-input='#{mask}'"
163
+ end
164
+
165
+ tb = <<EOS
166
+ <div class="form-group">
167
+ #{label}#{required_output}
168
+ <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag} #{mask} #{maxlength} />
169
+ </div>
170
+ EOS
171
+ return tb
172
+ end
173
+
174
+
175
+ ########################################################
176
+ #
177
+ # Number input helper
178
+ #
179
+ ########################################################
180
+ def x_number(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
181
+
182
+ if required
183
+ if label != ""
184
+ required_output = '<sup class="text-danger">*</sup>'
185
+ else
186
+ required_output = ''
187
+ end
188
+ required_tag = 'required="required"'
189
+ else
190
+ required_output = ""
191
+ required_tag = ""
192
+ end
193
+
194
+ if label != ""
195
+ label = "<label>#{label}#{required_output}</label>"
196
+ end
197
+
198
+ if maxlength != ""
199
+ maxlength = "maxlength='#{maxlength}'"
200
+ end
201
+
202
+ if mask != ""
203
+ mask = "data-masked-input='#{mask}'"
204
+ end
205
+
206
+ tb = <<EOS
207
+ <div class="form-group">
208
+ #{label}
209
+ <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" data-parsley-type="number" #{mask} #{maxlength}/>
210
+ </div>
211
+ EOS
212
+ return tb
213
+ end
214
+
215
+
216
+
217
+ ########################################################
218
+ #
219
+ # Phone input helper
220
+ #
221
+ ########################################################
222
+ def x_phone(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "(999) 999-9999", maxlength: "12")
223
+
224
+ if required
225
+ if label != ""
226
+ required_output = '<sup class="text-danger">*</sup>'
227
+ else
228
+ required_output = ''
229
+ end
230
+ required_tag = 'required="required"'
231
+ else
232
+ required_output = ""
233
+ required_tag = ""
234
+ end
235
+
236
+ if label != ""
237
+ label = "<label>#{label}#{required_output}</label>"
238
+ end
239
+
240
+ if mask != ""
241
+ mask = "data-masked-input='#{mask}'"
242
+ end
243
+
244
+ if maxlength != ""
245
+ maxlength = "maxlength='#{maxlength}'"
246
+ end
247
+
248
+ tb = <<EOS
249
+ <div class="form-group">
250
+ #{label}
251
+ <input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" #{mask} #{maxlength} />
252
+ </div>
253
+ EOS
254
+ return tb
255
+ end
256
+
257
+
258
+ ########################################################
259
+ #
260
+ # Number input helper
261
+ #
262
+ ########################################################
263
+ def x_credit_card(id: "", name: "", value: "", label: "", required: false, placeholder: "", maxlength: "16", mask:"")
264
+
265
+ if required
266
+ if label != ""
267
+ required_output = '<sup class="text-danger">*</sup>'
268
+ else
269
+ required_output = ''
270
+ end
271
+ required_tag = 'required="required"'
272
+ else
273
+ required_output = ""
274
+ required_tag = ""
275
+ end
276
+
277
+ if label != ""
278
+ label = "<label>#{label}#{required_output} <small>(Numbers Only)</small></label>"
279
+ end
280
+
281
+ if mask != ""
282
+ mask = "data-masked-input='#{mask}'"
283
+ end
284
+
285
+ if maxlength != ""
286
+ maxlength = "maxlength='#{maxlength}'"
287
+ end
288
+
289
+ tb = <<EOS
290
+ <div class="form-group">
291
+ #{label}
292
+ <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} />
293
+ </div>
294
+ EOS
295
+ return tb
296
+ end
297
+
298
+ ########################################################
299
+ #
300
+ # Number input helper
301
+ #
302
+ ########################################################
303
+ def x_cvc(id: "", name: "", value: "", label: "", required: false, placeholder: "", maxlength: "4", mask:"999999999999999999")
304
+
305
+ if required
306
+ if label != ""
307
+ required_output = '<sup class="text-danger">*</sup>'
308
+ else
309
+ required_output = ''
310
+ end
311
+ required_tag = 'required="required"'
312
+ else
313
+ required_output = ""
314
+ required_tag = ""
315
+ end
316
+ if label != ""
317
+ label = "<label>#{label}</label>"
318
+ end
319
+
320
+ if mask != ""
321
+ mask = "data-masked-input='#{mask}'"
322
+ end
323
+
324
+ if maxlength != ""
325
+ maxlength = "maxlength='#{maxlength}'"
326
+ end
327
+
328
+ tb = <<EOS
329
+ <div class="form-group">
330
+ #{label}#{required_output}
331
+ <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} />
332
+ </div>
333
+ EOS
334
+ return tb
335
+ end
336
+ ########################################################
337
+ #
338
+ # Email input helper
339
+ #
340
+ ########################################################
341
+ def x_email(id: "", name: "", value: "", label: "", required: false, placeholder: "")
342
+
343
+ if required
344
+ if label != ""
345
+ required_output = '<sup class="text-danger">*</sup>'
346
+ else
347
+ required_output = ''
348
+ end
349
+ required_tag = 'required="required"'
350
+ else
351
+ required_output = ""
352
+ required_tag = ""
353
+ end
354
+ if label != ""
355
+ label = "<label>#{label}</label>"
356
+ end
357
+
358
+ tb = <<EOS
359
+ <div class="form-group">
360
+ #{label}#{required_output}
361
+ <input type="email" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="email" placeholder="#{placeholder}" />
362
+ </div>
363
+ EOS
364
+ return tb
365
+ end
366
+
367
+
368
+
369
+ ########################################################
370
+ #
371
+ # URL input helper
372
+ #
373
+ ########################################################
374
+ def x_url(id:"", name:"", value:"", label:"", required: false, placeholder: "")
375
+
376
+ if required
377
+ if label != ""
378
+ required_output = '<sup class="text-danger">*</sup>'
379
+ else
380
+ required_output = ''
381
+ end
382
+ required_tag = 'required="required"'
383
+ else
384
+ required_output = ""
385
+ required_tag = ""
386
+ end
387
+ if label != ""
388
+ label = "<label>#{label}</label>"
389
+ end
390
+
391
+ tb = <<EOS
392
+ <div class="form-group">
393
+ #{label}#{required_output}
394
+ <input type="url" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-type="url" placeholder="#{placeholder}" />
395
+ </div>
396
+ EOS
397
+ return tb
398
+ end
399
+
400
+ ########################################################
401
+ #
402
+ # File input helper
403
+ #
404
+ ########################################################
405
+ def x_file(id:"", name:"", value:"", label:"", required: false, placeholder: "", css: "")
406
+
407
+ if required
408
+ if label != ""
409
+ required_output = '<sup class="text-danger">*</sup>'
410
+ else
411
+ required_output = ''
412
+ end
413
+ required_tag = 'required="required"'
414
+ else
415
+ required_output = ""
416
+ required_tag = ""
417
+ end
418
+ if label != ""
419
+ label = "<label>#{label}</label>"
420
+ end
421
+ tb = <<EOS
422
+ <div class="form-group">
423
+ #{label}#{required_output}
424
+ <input type="file" class="form-control file #{css}" id="#{id}" name="filename" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
425
+ </div>
426
+ EOS
427
+ return tb
428
+ end
429
+
430
+ ########################################################
431
+ #
432
+ # Image Upload
433
+ #
434
+ ########################################################
435
+ def x_image_upload(id: "input1",name: "input1",value: "",label: "Input1",required: false, size: "1M",height: "",default: "")
436
+
437
+ if required && label != ""
438
+ required_output = '<sup class="text-danger">*</sup>'
439
+ required_tag = 'required="required"'
440
+ else
441
+ required_output = ""
442
+ required_tag = ""
443
+ end
444
+
445
+ if height == ""
446
+ height = ""
447
+ else
448
+ height="data-height='#{height}'"
449
+ end
450
+
451
+
452
+ tb = <<EOS
453
+ <div class="form-group">
454
+ <label>#{label}</label>
455
+ <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}/>
456
+ </div>
457
+ EOS
458
+ return tb
459
+ end
460
+
461
+ ########################################################
462
+ #
463
+ # Date input helper
464
+ #
465
+ ########################################################
466
+ def x_date(id: "", name: "", value: "", label: "", required: false, placeholder: "")
467
+
468
+ if required
469
+ if label != ""
470
+ required_output = '<sup class="text-danger">*</sup>'
471
+ else
472
+ required_output = ''
473
+ end
474
+ required_tag = 'required="required"'
475
+ else
476
+ required_output = ""
477
+ required_tag = ""
478
+ end
479
+ if label != ""
480
+ label = "<label for='#{id}' class='control-label'>#{label}</label>"
481
+ end
482
+
483
+ tb = <<EOS
484
+ <div class="form-group">
485
+ #{label}#{required_output}
486
+ <div class="input-group">
487
+ <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
488
+ <input type="text" class="form-control datepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
489
+ </div>
490
+ </div>
491
+ EOS
492
+ return tb
493
+ end
494
+
495
+ ########################################################
496
+ #
497
+ # Datetime input helper
498
+ #
499
+ ########################################################
500
+ def x_datetime(id: "", name: "", value: "", label: "", required: false, placeholder: "")
501
+
502
+ if required
503
+ if label != ""
504
+ required_output = '<sup class="text-danger">*</sup>'
505
+ else
506
+ required_output = ''
507
+ end
508
+ required_tag = 'required="required"'
509
+ else
510
+ required_output = ""
511
+ required_tag = ""
512
+ end
513
+ if label != ""
514
+ label = "<label for='#{id}' class='control-label'>#{label}</label>"
515
+ end
516
+
517
+ tb = <<EOS
518
+ <div class="form-group">
519
+ #{label}#{required_output}
520
+ <div class="input-group">
521
+ <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
522
+ <input type="text" class="form-control datetimepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
523
+ </div>
524
+ </div>
525
+ EOS
526
+ return tb
527
+ end
528
+
529
+ ########################################################
530
+ #
531
+ # Time input helper
532
+ #
533
+ ########################################################
534
+ def x_time(id: "", name: "", value: "", label: "", required: false, placeholder: "")
535
+
536
+ if required
537
+ if label != ""
538
+ required_output = '<sup class="text-danger">*</sup>'
539
+ else
540
+ required_output = ''
541
+ end
542
+ required_tag = 'required="required"'
543
+ else
544
+ required_output = ""
545
+ required_tag = ""
546
+ end
547
+ if label != ""
548
+ label = "<label for='#{id}' class='control-label'>#{label}</label>"
549
+ end
550
+
551
+ tb = <<EOS
552
+ <div class="form-group">
553
+ #{label}#{required_output}
554
+ <div class="input-group">
555
+ <span class="input-group-addon"><i class="fa fa fa-clock-o"></i></span>
556
+ <input type="text" class="form-control timepicker" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" />
557
+ </div>
558
+ </div>
559
+ EOS
560
+ return tb
561
+ end
562
+
563
+
564
+ ########################################################
565
+ #
566
+ # Password input helper
567
+ #
568
+ ########################################################
569
+ def x_password(id: "",name: "", value: "", label: "", required: false, placeholder: "")
570
+
571
+ if required
572
+ if label != ""
573
+ required_output = '<sup class="text-danger">*</sup>'
574
+ else
575
+ required_output = ''
576
+ end
577
+ required_tag = 'required="required"'
578
+ else
579
+ required_output = ""
580
+ required_tag = ""
581
+ end
582
+ if label != ""
583
+ label = "<label>#{label}</label>"
584
+ end
585
+
586
+ tb = <<EOS
587
+ <div class="form-group">
588
+ #{label}#{required_output}
589
+ <input type="password" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} data-parsley-length="[6, 34]" placeholder="#{placeholder}" />
590
+ </div>
591
+ EOS
592
+ return tb
593
+ end
594
+
595
+ ########################################################
596
+ #
597
+ # Submit Helper
598
+ #
599
+ ########################################################
600
+ def x_submit(label: "Submit", css: "btn-primary", icon: "", size: "", wrapper_css: "pull-right")
601
+
602
+ if icon != ""
603
+ icon = "<i class='fa #{icon}'></i> "
604
+ end
605
+
606
+ submit = <<EOS
607
+ <div class="form-group form-actions #{wrapper_css}">
608
+ <button type="submit" class="btn #{css} #{size}">#{icon}#{label}</button>
609
+ </div>
610
+ <div class="clearfix"></div>
611
+ EOS
612
+
613
+ return submit
614
+ end
615
+
616
+
617
+
618
+ ########################################################
619
+ #
620
+ # Text Area Helper
621
+ #
622
+ ########################################################
623
+ def x_textarea(id: "", name: "", value: "",label: "",placeholder: "",required: false, maxlength:"")
624
+
625
+ if required
626
+ if label != ""
627
+ required_output = '<sup class="text-danger">*</sup>'
628
+ else
629
+ required_output = ''
630
+ end
631
+ required_tag = 'required="required"'
632
+ else
633
+ required_output = ""
634
+ required_tag = ""
635
+ end
636
+
637
+ if label != ""
638
+ label = "<label for='#{id}'>#{label}</label>"
639
+ end
640
+
641
+ if label != ""
642
+ label = "<label for='#{id}'>#{label}</label>"
643
+ end
644
+
645
+ if maxlength != ""
646
+ maxlength = "maxlength='#{maxlength}'"
647
+ end
648
+
649
+ ta = <<EOS
650
+ <div class="form-group">
651
+ #{label}#{required_output}
652
+ <textarea name="post[#{name}]" id="#{id}" rows="4" class="form-control" placeholder="#{placeholder}" #{maxlength}>#{value}</textarea>
653
+ </div>
654
+ EOS
655
+ return ta
656
+ end
657
+
658
+ ########################################################
659
+ #
660
+ # Summernote
661
+ #
662
+ ########################################################
663
+ def x_html(id: "", name: "", value: "", label: "", help: "", required: false)
664
+
665
+ if required
666
+ if label != ""
667
+ required_output = '<sup class="text-danger">*</sup>'
668
+ else
669
+ required_output = ''
670
+ end
671
+ required_tag = 'required="required"'
672
+ else
673
+ required_output = ""
674
+ required_tag = ""
675
+ end
676
+ if label != ""
677
+ label = "<label for='#{id}'>#{label}</label>"
678
+ end
679
+ ta = <<EOS
680
+ <div class="form-group">
681
+ #{label}
682
+ <textarea name="post[#{name}]" id="#{id}" rows="4" class="form-control summernote">#{value}</textarea>
683
+ </div>
684
+ EOS
685
+ return ta
686
+ end
687
+
688
+
689
+
690
+ ########################################################
691
+ #
692
+ # Year Drop down
693
+ #
694
+ ########################################################
695
+
696
+ def x_year
697
+ current_year = Time.now.year
698
+
699
+ year_dd = <<EOS
700
+ <select id="selected_year" name="selected_year" class="selectpicker" data-style="btn-primary btn" data-width="auto">
701
+ <option selected="selected" value="#{current_year}">#{current_year}</option>
702
+ <option value="#{current_year - 1}">#{current_year - 1}</option>
703
+ <option value="#{current_year - 2}">#{current_year - 2}</option>
704
+ <option value="#{current_year - 3}">#{current_year - 3}</option>
705
+ <option value="#{current_year - 4}">#{current_year - 4}</option>
706
+ <option value="#{current_year - 5}">#{current_year - 5}</option>
707
+ <option value="#{current_year - 6}">#{current_year - 6}</option>
708
+ <option value="#{current_year - 7}">#{current_year - 7}</option>
709
+ </select>
710
+ EOS
711
+ end
712
+
713
+
714
+ ########################################################
715
+ #
716
+ # Year Drop down
717
+ #
718
+ ########################################################
719
+
720
+ def x_exp_year
721
+ current_year = Time.now.year
722
+ begining_year = Time.now.year + 6
723
+
724
+ year_dd = <<EOS
725
+ <div class="col-md-6">
726
+ <div class="form-group">
727
+ <label>Expiration Year</label>
728
+ <select id="exp_year" name="post[exp_year]" class="form-control" data-stripe="exp-year">
729
+ <option value="#{(current_year)}">#{current_year}</option>
730
+ <option value="#{(current_year + 1)}">#{current_year + 1}</option>
731
+ <option value="#{(current_year + 2)}">#{current_year + 2}</option>
732
+ <option value="#{(current_year + 3)}">#{current_year + 3}</option>
733
+ <option value="#{(current_year + 4)}">#{current_year + 4}</option>
734
+ <option value="#{(current_year + 5)}">#{current_year + 5}</option>
735
+ <option value="#{(current_year + 6)}">#{current_year + 6}</option>
736
+ <option value="#{(current_year + 7)}">#{current_year + 7}</option>
737
+ </select>
738
+ </div>
739
+ </div>
740
+ EOS
741
+ end
742
+
743
+ ########################################################
744
+ #
745
+ # Month Drop down
746
+ #
747
+ ########################################################
748
+
749
+ def x_exp_month
750
+ current_year = Time.now.year
751
+ begining_year = Time.now.year - 6
752
+
753
+ year_dd = <<EOS
754
+ <div class="col-md-6">
755
+ <div class="form-group">
756
+ <label>Expiration Month</label>
757
+ <select id="exp_mo" name="post[exp_mo]" class="form-control" data-stripe="exp-month">
758
+ <option value="01">01</option>
759
+ <option value="02">02</option>
760
+ <option value="03">03</option>
761
+ <option value="04">04</option>
762
+ <option value="05">05</option>
763
+ <option value="06">06</option>
764
+ <option value="07">07</option>
765
+ <option value="08">08</option>
766
+ <option value="09">09</option>
767
+ <option value="10">10</option>
768
+ <option value="11">11</option>
769
+ <option value="12">12</option>
770
+ </select>
771
+ </div>
772
+ </div>
773
+ EOS
774
+ end
775
+
776
+ ########################################################
777
+ #
778
+ # Switch
779
+ #
780
+ ########################################################
781
+ def x_switch(id: "", name: "", value: "", label: "", checked: false)
782
+
783
+ checked_output = ""
784
+
785
+ if checked == true then checked_output='checked="checked"' end
786
+
787
+ cb = <<EOS
788
+ <div class="form-group">
789
+ <label>#{label}</label><br>
790
+ <div class="switch"
791
+ data-on-label="<i class='fa fa-check'></i>"
792
+ data-off-label="<i class='fa fa-times'></i>">
793
+ <input type="hidden" id="#{id}" name="post[#{name}]" value="0">
794
+ <input type="checkbox" id="#{id}" name="post[#{name}]" value="1" #{checked_output}/>
795
+ </div>
796
+ </div>
797
+ EOS
798
+ return cb
799
+ end
800
+
801
+ ########################################################
802
+ #
803
+ # Tags
804
+ #
805
+ ########################################################
806
+ def x_tags(id: "", name: "", value: "", label: "", required: false, placeholder: "")
807
+
808
+ id = name unless id != ""
809
+ if required
810
+ if label != ""
811
+ required_output = '<sup class="text-danger">*</sup>'
812
+ else
813
+ required_output = ''
814
+ end
815
+ required_tag = 'required="required"'
816
+ else
817
+ required_output = ""
818
+ required_tag = ""
819
+ end
820
+
821
+ if label != ""
822
+ label = "<label>#{label}</label>"
823
+ end
824
+ tb = <<EOS
825
+ <div class="form-group">
826
+ #{label}#{required_output}
827
+ <input type="text" class="form-control tagsinput typeahead tag-azure tag-fill" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag}/>
828
+ </div>
829
+ EOS
830
+ return tb
831
+ end
832
+
833
+
834
+ ########################################################
835
+ #
836
+ # Typeahead
837
+ #
838
+ ########################################################
839
+ def x_typeahead(id: "", name: "", value: "", label: "", required: false, placeholder: "", css: "")
840
+
841
+ id = name unless id != ""
842
+ if required
843
+ if label != ""
844
+ required_output = '<sup class="text-danger">*</sup>'
845
+ else
846
+ required_output = ''
847
+ end
848
+ required_tag = 'required="required"'
849
+ else
850
+ required_output = ""
851
+ required_tag = ""
852
+ end
853
+
854
+ if label != ""
855
+ label = "<label>#{label}</label>"
856
+ end
857
+ tb = <<EOS
858
+ <div class="form-group">
859
+ #{label}#{required_output}
860
+ <input type="text" class="form-control typeahead #{css}" autocomplete="off" id="#{id}" name="post[#{name}]" value="#{value}" placeholder="#{placeholder}" #{required_tag}/>
861
+ </div>
862
+ EOS
863
+ return tb
864
+ end
865
+
866
+
867
+ ########################################################
868
+ #
869
+ # Rating Radios
870
+ #
871
+ ########################################################
872
+ def x_survey_radio(id: "", name: "")
873
+ tb = <<EOS
874
+ <label class="radio radio-inline">
875
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="1">
876
+ </label>
877
+ <label class="radio radio-inline">
878
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="2">
879
+ </label>
880
+ <label class="radio radio-inline">
881
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="3">
882
+ </label>
883
+ <label class="radio radio-inline">
884
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="4">
885
+ </label>
886
+ <label class="radio radio-inline">
887
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="5">
888
+ </label>
889
+ <label class="radio radio-inline">
890
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="6">
891
+ </label>
892
+ <label class="radio radio-inline">
893
+ <input type="radio" id="#{id}" name="#{name}" data-toggle="radio" value="7">
894
+ </label>
895
+ EOS
896
+ return tb
897
+ end
898
+
899
+
900
+ ########################################################
901
+ #
902
+ # Select Dropdown
903
+ #
904
+ ########################################################
905
+ 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: "")
906
+
907
+ options_html = ""
908
+
909
+ option_data.each do |i|
910
+ selected = ""
911
+
912
+ if selected_value == i[:id]
913
+ selected = "selected='selected'"
914
+ end
915
+
916
+ unless name_col.kind_of?(Array)
917
+ options_html << "<option value='#{i[value_col.to_sym]}' #{selected}>#{i[name_col.to_sym]}</option>"
918
+ else
919
+ label = ""
920
+
921
+ options_html << "<option value='#{i[value_col.to_sym]}' #{selected}>"
922
+ name_col.each do |n|
923
+ options_html << "#{i[n.to_sym]} "
924
+ end
925
+ options_html << "</option>"
926
+
927
+ end
928
+ end
929
+
930
+ if option_data.count == 0 || option_data.nil?
931
+ options_html << "<option value=''>No available selections</option>"
932
+ end
933
+
934
+
935
+ select = <<EOS
936
+ <div class="form-group">
937
+ <label>#{label}</label>
938
+ <select name="post[#{name}]" class="selectpicker #{css}" data-title="Single Select" data-style="#{style}" data-menu-style="#{menu_style}">
939
+ #{options_html}
940
+ </select>
941
+ </div>
942
+ EOS
943
+
944
+ return select
945
+
946
+ end
947
+ ########################################################
948
+ #
949
+ # End
950
+ #
951
+ ########################################################
952
+ end
953
+ end