nyros_form2 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75bd11885a424f9c63e3e08cd1ff61fde5ee0b30f73806fce9bdc76569f69925
4
- data.tar.gz: 8bd0ebd148fceff5ebe7a4c0325cc0d7348ba12a11d43742380cb81a8756832b
3
+ metadata.gz: f27409c9258c80f1515b0d286960fac7bb0e17a2f96daf78bf0c144fdb731623
4
+ data.tar.gz: aafb9bb7d22dfe6ba9cdfb6ff3d48b31af9a2fbb74eb1477bd9caf1e675c7752
5
5
  SHA512:
6
- metadata.gz: c1c6921a2cfb1cb7f5d8975b58a3c7457ee8d8c18f420b93ecad8db1c453fccbe82802c8dd19991b09af14c8ac377041e37939381f23bd0edfb4c05cb4afaea7
7
- data.tar.gz: da72839e22f17c4a24f0730419f1e8a58a0ea8afd44d5fa8288565d9dad5eaa3ffe46a3ad689f74d22e9bd87cfef80ff3f03ed40bc54d2fb4c4817eabd1fdd89
6
+ metadata.gz: 89bdcb1e7432f84bf8fde9dad3961f0d2d7d4930c32bab8ab53d44abd45d5ccd19e4acde6c0209b8ae0df1febfd429cd9afe50244d416074257d92c2c8e0157f
7
+ data.tar.gz: 8b869b98e3eaf6b257fd9b7e8e29af159dd38c8037585ee6fe7898220668326af33d9a362250d17ff938e16ed9373f73304d9c4cff534a601d65e3bc9b5f63fb
@@ -13,7 +13,6 @@ module NyrosForm2
13
13
  def create
14
14
  @user = User.new(user_params)
15
15
  if @user.save
16
-
17
16
  redirect_to users_path
18
17
 
19
18
  else
@@ -1,14 +1,13 @@
1
1
  module NyrosForm2
2
2
  class User < ApplicationRecord
3
3
  validates :email,uniqueness: true, format: {
4
- with: URI::MailTo::EMAIL_REGEXP,
5
- message: '*Please Enter Your Email'
6
- }
7
-
8
-
9
-
4
+ with: URI::MailTo::EMAIL_REGEXP,
5
+ message: '*Please Enter Your Email'
6
+ }
10
7
  validates_presence_of :name, message: "*Please Enter Your Name"
11
- validates_presence_of :mobile, message: "Please Enter Your Mobile"
8
+ # svalidates_presence_of :mobile, message: "*Please Enter Your Mobile"
9
+ validates_format_of :mobile, :with => /\d[0-9]\)*\z/ , :message => "*Please Enter a Valid Mobile Number"
10
+
12
11
 
13
12
 
14
13
  end
@@ -33,7 +33,7 @@
33
33
  <div class="modal-dialog ">
34
34
  <div class="modal-content">
35
35
  <div class="modal-header">
36
- <h5><%= u.name %> User Delete</h5>
36
+ <h5>User Delete</h5>
37
37
  </div>
38
38
  <div class="modal-body">
39
39
  <p>Are you sure to delete this User?</p>
@@ -1,9 +1,15 @@
1
+ <script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.17.0/dist/jquery.validate.js"></script>
2
+
3
+
4
+
1
5
  <body >
2
6
  <div class="container" >
3
7
  <div class="form-horizontal no-border form u-dimension-2"
4
- style ="margin-top: 20px; width: 450px;"align="center" >
8
+ style ="margin-top: 100px; width: 450px;"align="center" >
5
9
 
6
- <%= form_for @user, url: {action: :create} do |f| %>
10
+
11
+ <%= form_for @user , :url => {:action => "create", :controller => "users"} do |f| %>
12
+
7
13
  <h2 align="center">User Form </h2>
8
14
 
9
15
 
@@ -33,16 +39,40 @@
33
39
 
34
40
  <div class="form-group">
35
41
  <div class="col-sm-12">
36
- <%= f.submit "Submit", class: 'submitBtn btn btn-block btn-success btn', id: 'modal-submit' %>
42
+ <%= f.submit "Submit", class: 'submitBtn btn btn-block btn-success btn modal_btn', id: 'modal-submit' %>
37
43
  </div>
38
44
  </div>
39
45
  <% end %>
40
46
  </div>
41
47
 
42
48
  </div>
49
+ </body>
50
+
51
+ <script type="text/javascript">
52
+ $(".modal_btn").click(function(){
53
+
54
+ jQuery.validator.addMethod("lettersonly", function(value, element) {
55
+ return this.optional(element) || /^[a-zA-Z\\ \\.\\]+$/.test(value);
56
+ }, "Letters only please");
57
+
58
+ $(".new_rating").validate();
59
+
60
+ $("#rating_comments").rules("add", {
61
+ required:true,
62
+ lettersonly: true,
63
+ minlength:10,
64
+ maxlength:300,
65
+ messages: {
66
+ required: "*Please Enter comment."
67
+ }
68
+ });
69
+ })
70
+
71
+
72
+
73
+ </script>
43
74
 
44
75
 
45
- </body>
46
76
  <style type="text/css">
47
77
  .form-group{
48
78
  width:356px;
@@ -1,3 +1,3 @@
1
1
  module NyrosForm2
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nyros_form2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - raju rekadi