platformx 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,18 @@
1
1
  module Platformx
2
2
  module FormHelpers
3
- ########################################################
4
- #
5
- # Start Helpers
6
- #
7
- ########################################################
8
- ########################################################
9
- #
10
- # Checkbox helper
11
- #
12
- ########################################################
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
13
16
  def x_checkbox(id: "", name: "", value: "", label: "", checked: false, switch: false, align: false, inline: false, form_group: true, required: false)
14
17
 
15
18
  checked_output = ""
@@ -44,11 +47,18 @@ EOS
44
47
  return cb
45
48
  end
46
49
 
47
- ########################################################
48
- #
49
- # Checkbox helper
50
- #
51
- ########################################################
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
52
62
  def x_checkbox_string(id: "", name: "", value: "", label: "", checked: false, switch: false, align: false, inline: false, form_group: true, required: false)
53
63
 
54
64
  checked_output = ""
@@ -83,11 +93,16 @@ EOS
83
93
  end
84
94
 
85
95
 
86
- ########################################################
87
- #
88
- # Radio helper
89
- #
90
- ########################################################
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
91
106
  def x_radio(id: "", name: "", value: "", label: "", checked: false, align: false, inline: false, form_group: true)
92
107
 
93
108
  checked_output = ""
@@ -116,11 +131,11 @@ EOS
116
131
  return cb
117
132
  end
118
133
 
119
- ########################################################
120
- #
121
134
  # Hidden input helper
122
- #
123
- ########################################################
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
124
139
  def x_hidden(id: "", name: "", value: "")
125
140
 
126
141
  hi = <<EOS
@@ -130,11 +145,16 @@ EOS
130
145
  end
131
146
 
132
147
 
133
- ########################################################
134
- #
135
148
  # Text input helper
136
- #
137
- ########################################################
149
+ # @param id [String] input element id
150
+ # @param name [String] input element name
151
+ # @param value [String] input element value
152
+ # @param label [String] input element label
153
+ # @param required [Boolean] if input element is required
154
+ # @param placeholder [String] input element placeholder
155
+ # @param mask [String] input element mask
156
+ # @param maxlength [String] input element max length
157
+ # @return [String] compiled input element
138
158
  def x_input(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
139
159
 
140
160
  id = name unless id != ""
@@ -172,11 +192,15 @@ EOS
172
192
  end
173
193
 
174
194
 
175
- ########################################################
176
- #
177
195
  # Money input helper
178
- #
179
- ########################################################
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
180
204
  def x_money(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
181
205
 
182
206
  id = name unless id != ""
@@ -216,11 +240,15 @@ EOS
216
240
  return tb
217
241
  end
218
242
 
219
- ########################################################
220
- #
221
243
  # Percentage input helper
222
- #
223
- ########################################################
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
224
252
  def x_percentage(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
225
253
 
226
254
  id = name unless id != ""
@@ -260,11 +288,16 @@ EOS
260
288
  return tb
261
289
  end
262
290
 
263
- ########################################################
264
- #
265
- # Number input helper
266
- #
267
- ########################################################
291
+ # Number input helper
292
+ # @param id [String] number input id
293
+ # @param name [String] number input name
294
+ # @param value [String] number input value
295
+ # @param label [String] number input label
296
+ # @param required [Boolean] if required or not
297
+ # @param placeholder [String] number input placeholder text
298
+ # @param mask [String] number input mask
299
+ # @param maxlength [String] nuber input max length
300
+ # @return [String] compiled html of number input
268
301
  def x_number(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "", maxlength: "")
269
302
 
270
303
  if required
@@ -302,11 +335,16 @@ EOS
302
335
 
303
336
 
304
337
 
305
- ########################################################
306
- #
307
- # Phone input helper
308
- #
309
- ########################################################
338
+ # Phone input helper
339
+ # @param id [String] phone input id
340
+ # @param name [String] phone input name
341
+ # @param value [String] phone input value
342
+ # @param label [String] phone input label
343
+ # @param required [Boolean] if required or not
344
+ # @param placeholder [String] phone input placeholder text
345
+ # @param mask [String] phone input mask
346
+ # @param maxlength [String] nuber input max length
347
+ # @return [String] compiled html of phone input
310
348
  def x_phone(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "(999) 999-9999", maxlength: "12")
311
349
 
312
350
  if required
@@ -343,11 +381,16 @@ EOS
343
381
  end
344
382
 
345
383
 
346
- ########################################################
347
- #
348
- # Number input helper
349
- #
350
- ########################################################
384
+ # Credit card input helper
385
+ # @param id [String] credit card input id
386
+ # @param name [String] credit card input name
387
+ # @param value [String] credit card input value
388
+ # @param label [String] credit card label
389
+ # @param required [Boolean] if required or not
390
+ # @param placeholder [String] credit card input placeholder text
391
+ # @param mask [String] credit card input mask
392
+ # @param maxlength [String] nuber input max length
393
+ # @return [String] compiled html of credit card input
351
394
  def x_credit_card(id: "", name: "", value: "", label: "", required: false, placeholder: "", maxlength: "16", mask:"")
352
395
 
353
396
  if required
@@ -383,11 +426,16 @@ EOS
383
426
  return tb
384
427
  end
385
428
 
386
- ########################################################
387
- #
388
- # Number input helper
389
- #
390
- ########################################################
429
+ # CVC input helper
430
+ # @param id [String] cvc input id
431
+ # @param name [String] cvc input name
432
+ # @param value [String] cvc input value
433
+ # @param lable [String] cvc label
434
+ # @param required [Boolean] if required or not
435
+ # @param placeholder [String] cvc input placeholder text
436
+ # @param mask [String] cvc input mask
437
+ # @param maxlength [String] nuber input max length
438
+ # @return [String] compiled html of cvc input
391
439
  def x_cvc(id: "", name: "", value: "", label: "", required: false, placeholder: "", maxlength: "4", mask:"999999999999999999")
392
440
 
393
441
  if required
@@ -421,11 +469,15 @@ tb = <<EOS
421
469
  EOS
422
470
  return tb
423
471
  end
424
- ########################################################
425
- #
426
- # Email input helper
427
- #
428
- ########################################################
472
+
473
+ # Email input helper
474
+ # @param id [String] email input id
475
+ # @param name [String] email input name
476
+ # @param value [String] email input value
477
+ # @param label [String] email input label
478
+ # @param required [Boolean] if required or not
479
+ # @param placeholder [String] email input placeholder text
480
+ # @return [String] compiled html of email input
429
481
  def x_email(id: "", name: "", value: "", label: "", required: false, placeholder: "")
430
482
 
431
483
  if required
@@ -453,12 +505,14 @@ EOS
453
505
  end
454
506
 
455
507
 
456
-
457
- ########################################################
458
- #
459
- # URL input helper
460
- #
461
- ########################################################
508
+ # URL input helper
509
+ # @param id [String] url input id
510
+ # @param name [String] url input name
511
+ # @param value [String] url input value
512
+ # @param label [String] url input label
513
+ # @param required [Boolean] if required or not
514
+ # @param placeholder [String] url input placeholder text
515
+ # @return [String] compiled html of url input
462
516
  def x_url(id:"", name:"", value:"", label:"", required: false, placeholder: "")
463
517
 
464
518
  if required
@@ -485,11 +539,15 @@ EOS
485
539
  return tb
486
540
  end
487
541
 
488
- ########################################################
489
- #
490
- # File input helper
491
- #
492
- ########################################################
542
+ # File input helper
543
+ # @param id [String] file input id
544
+ # @param name [String] file input name
545
+ # @param value [String] file input value
546
+ # @param label [String] file input label
547
+ # @param required [Boolean] if required or not
548
+ # @param placeholder [String] file input placeholder text
549
+ # @param css [String] file input css
550
+ # @return [String] compiled html of file input
493
551
  def x_file(id:"", name:"", value:"", label:"", required: false, placeholder: "", css: "")
494
552
 
495
553
  if required
@@ -515,11 +573,15 @@ EOS
515
573
  return tb
516
574
  end
517
575
 
518
- ########################################################
519
- #
520
576
  # Image Upload
521
- #
522
- ########################################################
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
523
585
  def x_image_upload(id: "input1",name: "input1",value: "",label: "Input1",required: false, size: "1M",height: "",default: "")
524
586
 
525
587
  if required && label != ""
@@ -546,11 +608,14 @@ EOS
546
608
  return tb
547
609
  end
548
610
 
549
- ########################################################
550
- #
551
- # Date input helper
552
- #
553
- ########################################################
611
+ # Date input helper
612
+ # @param id [String] date input id
613
+ # @param name [String] date input name
614
+ # @param value [String] date input value
615
+ # @param label [String] date input label
616
+ # @param required [Boolean] if required or not
617
+ # @param placeholder [String] date input placeholder text
618
+ # @return [String] compiled html of date input
554
619
  def x_date(id: "", name: "", value: "", label: "", required: false, placeholder: "")
555
620
 
556
621
  if required
@@ -580,11 +645,14 @@ EOS
580
645
  return tb
581
646
  end
582
647
 
583
- ########################################################
584
- #
585
- # Datetime input helper
586
- #
587
- ########################################################
648
+ # Date-time input helper
649
+ # @param id [String] date-time input id
650
+ # @param name [String] date-time input name
651
+ # @param value [String] date-time input value
652
+ # @param label [String] date-time input label
653
+ # @param required [Boolean] if required or not
654
+ # @param placeholder [String] date-time input placeholder text
655
+ # @return [String] compiled html of date-time input
588
656
  def x_datetime(id: "", name: "", value: "", label: "", required: false, placeholder: "")
589
657
 
590
658
  if required
@@ -614,11 +682,14 @@ EOS
614
682
  return tb
615
683
  end
616
684
 
617
- ########################################################
618
- #
619
- # Time input helper
620
- #
621
- ########################################################
685
+ # Time input helper
686
+ # @param id [String] time input id
687
+ # @param name [String] time input name
688
+ # @param value [String] time input value
689
+ # @param label [String] time input label
690
+ # @param required [Boolean] if required or not
691
+ # @param placeholder [String] time input placeholder text
692
+ # @return [String] compiled html of time input
622
693
  def x_time(id: "", name: "", value: "", label: "", required: false, placeholder: "")
623
694
 
624
695
  if required
@@ -649,11 +720,14 @@ EOS
649
720
  end
650
721
 
651
722
 
652
- ########################################################
653
- #
654
- # Password input helper
655
- #
656
- ########################################################
723
+ # Password input helper
724
+ # @param id [String] password input id
725
+ # @param name [String] password input name
726
+ # @param value [String] password input value
727
+ # @param label [String] password input label
728
+ # @param required [Boolean] if required or not
729
+ # @param placeholder [String] password input placeholder text
730
+ # @return [String] compiled html of password input
657
731
  def x_password(id: "",name: "", value: "", label: "", required: false, placeholder: "")
658
732
 
659
733
  if required
@@ -680,11 +754,13 @@ EOS
680
754
  return tb
681
755
  end
682
756
 
683
- ########################################################
684
- #
685
757
  # Submit Helper
686
- #
687
- ########################################################
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
688
764
  def x_submit(label: "Submit", css: "btn-primary", icon: "", size: "", wrapper_css: "pull-right")
689
765
 
690
766
  if icon != ""
@@ -703,11 +779,15 @@ end
703
779
 
704
780
 
705
781
 
706
- ########################################################
707
- #
708
- # Text Area Helper
709
- #
710
- ########################################################
782
+ # Text Area Helper
783
+ # @param id [String] textarea id
784
+ # @param name [String] textarea name
785
+ # @param value [String] textarea value
786
+ # @param placeholder [String] textarea placeholder text
787
+ # @param label [String] textarea label
788
+ # @param required [Boolean] if required or not
789
+ # @param maxlength [String] textarea max length
790
+ # @return [String] compiled html of textarea
711
791
  def x_textarea(id: "", name: "", value: "",label: "",placeholder: "",required: false, maxlength:"")
712
792
 
713
793
  if required
@@ -743,11 +823,13 @@ EOS
743
823
  return ta
744
824
  end
745
825
 
746
- ########################################################
747
- #
748
- # Summernote
749
- #
750
- ########################################################
826
+ # Summernote
827
+ # @param id [String] summernote id
828
+ # @param name [String] summernote name
829
+ # @param value [String] summernote value
830
+ # @param label [String] summernote label
831
+ # @param required [Boolean] if required or not
832
+ # @return [String] compiled html of summernote
751
833
  def x_html(id: "", name: "", value: "", label: "", help: "", required: false)
752
834
 
753
835
  if required
@@ -775,12 +857,7 @@ EOS
775
857
 
776
858
 
777
859
 
778
- ########################################################
779
- #
780
860
  # Year Drop down
781
- #
782
- ########################################################
783
-
784
861
  def x_year
785
862
  current_year = Time.now.year
786
863
 
@@ -799,12 +876,7 @@ EOS
799
876
  end
800
877
 
801
878
 
802
- ########################################################
803
- #
804
- # Year Drop down
805
- #
806
- ########################################################
807
-
879
+ # Year Drop down (expiry)
808
880
  def x_exp_year
809
881
  current_year = Time.now.year
810
882
  begining_year = Time.now.year + 6
@@ -828,12 +900,7 @@ year_dd = <<EOS
828
900
  EOS
829
901
  end
830
902
 
831
- ########################################################
832
- #
833
903
  # Month Drop down
834
- #
835
- ########################################################
836
-
837
904
  def x_exp_month
838
905
  current_year = Time.now.year
839
906
  begining_year = Time.now.year - 6
@@ -861,11 +928,13 @@ year_dd = <<EOS
861
928
  EOS
862
929
  end
863
930
 
864
- ########################################################
865
- #
866
931
  # Switch
867
- #
868
- ########################################################
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
869
938
  def x_switch(id: "", name: "", value: "", label: "", checked: false)
870
939
 
871
940
  checked_output = ""
@@ -886,11 +955,14 @@ EOS
886
955
  return cb
887
956
  end
888
957
 
889
- ########################################################
890
- #
891
958
  # Tags
892
- #
893
- ########################################################
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
894
966
  def x_tags(id: "", name: "", value: "", label: "", required: false, placeholder: "")
895
967
 
896
968
  id = name unless id != ""
@@ -919,11 +991,15 @@ EOS
919
991
  end
920
992
 
921
993
 
922
- ########################################################
923
- #
924
994
  # Typeahead
925
- #
926
- ########################################################
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
927
1003
  def x_typeahead(id: "", name: "", value: "", label: "", required: false, placeholder: "", css: "")
928
1004
 
929
1005
  id = name unless id != ""
@@ -952,11 +1028,10 @@ EOS
952
1028
  end
953
1029
 
954
1030
 
955
- ########################################################
956
- #
957
1031
  # Rating Radios
958
- #
959
- ########################################################
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
960
1035
  def x_survey_radio(id: "", name: "")
961
1036
  tb = <<EOS
962
1037
  <label class="radio radio-inline">
@@ -985,11 +1060,23 @@ EOS
985
1060
  end
986
1061
 
987
1062
 
988
- ########################################################
989
- #
990
1063
  # Select Dropdown
991
- #
992
- ########################################################
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
993
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)
994
1081
 
995
1082
  options_html = ""
@@ -1041,10 +1128,5 @@ EOS
1041
1128
  return select
1042
1129
 
1043
1130
  end
1044
- ########################################################
1045
- #
1046
- # End
1047
- #
1048
- ########################################################
1049
1131
  end
1050
- end
1132
+ end