platformx 0.0.8.6 → 0.0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/platformx/form.rb +138 -1
- data/lib/platformx/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a3d1094d28d76f7a0d5225d5c204ef7389b4ea9
|
4
|
+
data.tar.gz: a8bdc9c619863174a2ff0042437089ee59a020fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 284a986bbed0aa4f21f84003448cf951cbb9a17ae85109849fd8c888c43876ec04d3a2a302d2092e61cfe717237d1525ae9907e891cc62e060060ed6553504e3
|
7
|
+
data.tar.gz: e2e0a75b94c689058858fe03c7e2ffd5f6ee2545bf7e6a02adec8d453dde8471f8deeb0e3c96592806ad28d54a7bd6586d529d59ddf08a8ba36f5d8d2b07e962
|
data/lib/platformx/form.rb
CHANGED
@@ -402,7 +402,144 @@ EOS
|
|
402
402
|
# @param mask [String] phone input mask
|
403
403
|
# @param maxlength [String] nuber input max length
|
404
404
|
# @return [String] compiled html of phone input
|
405
|
-
def x_phone(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "(999) 999-9999", maxlength: "12")
|
405
|
+
def x_phone(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "(999) 999-9999? x99999", maxlength: "12")
|
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
|
+
|
419
|
+
if label != ""
|
420
|
+
label = "<label>#{label}#{required_output}</label>"
|
421
|
+
end
|
422
|
+
|
423
|
+
if mask != ""
|
424
|
+
mask = "data-masked-input='#{mask}'"
|
425
|
+
end
|
426
|
+
|
427
|
+
if maxlength != ""
|
428
|
+
maxlength = "maxlength='#{maxlength}'"
|
429
|
+
end
|
430
|
+
|
431
|
+
tb = <<EOS
|
432
|
+
<div class="form-group">
|
433
|
+
#{label}
|
434
|
+
<input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" #{mask} #{maxlength} />
|
435
|
+
</div>
|
436
|
+
EOS
|
437
|
+
return tb
|
438
|
+
end
|
439
|
+
|
440
|
+
|
441
|
+
# SSN input helper
|
442
|
+
# @param id [String] ssn input id
|
443
|
+
# @param name [String] ssn input name
|
444
|
+
# @param value [String] ssn input value
|
445
|
+
# @param label [String] ssn input label
|
446
|
+
# @param required [Boolean] if required or not
|
447
|
+
# @param placeholder [String] ssn input placeholder text
|
448
|
+
# @param mask [String] ssn input mask
|
449
|
+
# @param maxlength [String] nuber input max length
|
450
|
+
# @return [String] compiled html of ssn input
|
451
|
+
def x_ssn(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "999-99-9999", maxlength: "11")
|
452
|
+
|
453
|
+
if required
|
454
|
+
if label != ""
|
455
|
+
required_output = '<sup class="text-danger">*</sup>'
|
456
|
+
else
|
457
|
+
required_output = ''
|
458
|
+
end
|
459
|
+
required_tag = 'required="required"'
|
460
|
+
else
|
461
|
+
required_output = ""
|
462
|
+
required_tag = ""
|
463
|
+
end
|
464
|
+
|
465
|
+
if label != ""
|
466
|
+
label = "<label>#{label}#{required_output}</label>"
|
467
|
+
end
|
468
|
+
|
469
|
+
if mask != ""
|
470
|
+
mask = "data-masked-input='#{mask}'"
|
471
|
+
end
|
472
|
+
|
473
|
+
if maxlength != ""
|
474
|
+
maxlength = "maxlength='#{maxlength}'"
|
475
|
+
end
|
476
|
+
|
477
|
+
tb = <<EOS
|
478
|
+
<div class="form-group">
|
479
|
+
#{label}
|
480
|
+
<input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" #{mask} #{maxlength} />
|
481
|
+
</div>
|
482
|
+
EOS
|
483
|
+
return tb
|
484
|
+
end
|
485
|
+
|
486
|
+
|
487
|
+
# Zip input helper
|
488
|
+
# @param id [String] zip input id
|
489
|
+
# @param name [String] zip input name
|
490
|
+
# @param value [String] zip input value
|
491
|
+
# @param label [String] zip input label
|
492
|
+
# @param required [Boolean] if required or not
|
493
|
+
# @param placeholder [String] zip input placeholder text
|
494
|
+
# @param mask [String] zip input mask
|
495
|
+
# @param maxlength [String] nuber input max length
|
496
|
+
# @return [String] compiled html of zip input
|
497
|
+
def x_zip(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "99999", maxlength: "5")
|
498
|
+
|
499
|
+
if required
|
500
|
+
if label != ""
|
501
|
+
required_output = '<sup class="text-danger">*</sup>'
|
502
|
+
else
|
503
|
+
required_output = ''
|
504
|
+
end
|
505
|
+
required_tag = 'required="required"'
|
506
|
+
else
|
507
|
+
required_output = ""
|
508
|
+
required_tag = ""
|
509
|
+
end
|
510
|
+
|
511
|
+
if label != ""
|
512
|
+
label = "<label>#{label}#{required_output}</label>"
|
513
|
+
end
|
514
|
+
|
515
|
+
if mask != ""
|
516
|
+
mask = "data-masked-input='#{mask}'"
|
517
|
+
end
|
518
|
+
|
519
|
+
if maxlength != ""
|
520
|
+
maxlength = "maxlength='#{maxlength}'"
|
521
|
+
end
|
522
|
+
|
523
|
+
tb = <<EOS
|
524
|
+
<div class="form-group">
|
525
|
+
#{label}
|
526
|
+
<input type="text" class="form-control" id="#{id}" name="post[#{name}]" value="#{value}" #{required_tag} placeholder="#{placeholder}" #{mask} #{maxlength} />
|
527
|
+
</div>
|
528
|
+
EOS
|
529
|
+
return tb
|
530
|
+
end
|
531
|
+
|
532
|
+
# State input helper
|
533
|
+
# @param id [String] state input id
|
534
|
+
# @param name [String] state input name
|
535
|
+
# @param value [String] state input value
|
536
|
+
# @param label [String] state input label
|
537
|
+
# @param required [Boolean] if required or not
|
538
|
+
# @param placeholder [String] state input placeholder text
|
539
|
+
# @param mask [String] state input mask
|
540
|
+
# @param maxlength [String] nuber input max length
|
541
|
+
# @return [String] compiled html of state input
|
542
|
+
def x_state(id: "", name: "", value: "", label: "", required: false, placeholder: "", mask: "aa", maxlength: "2")
|
406
543
|
|
407
544
|
if required
|
408
545
|
if label != ""
|
data/lib/platformx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: platformx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.8.
|
4
|
+
version: 0.0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- timmushen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|