nyros_form2 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/nyros_form2/users_controller.rb +23 -9
- data/app/models/nyros_form2/user.rb +11 -0
- data/app/views/nyros_form2/users/edit.html.erb +211 -2
- data/app/views/nyros_form2/users/index.html.erb +29 -3
- data/app/views/nyros_form2/users/new.html.erb +8 -9
- data/lib/nyros_form2/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75bd11885a424f9c63e3e08cd1ff61fde5ee0b30f73806fce9bdc76569f69925
|
4
|
+
data.tar.gz: 8bd0ebd148fceff5ebe7a4c0325cc0d7348ba12a11d43742380cb81a8756832b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1c6921a2cfb1cb7f5d8975b58a3c7457ee8d8c18f420b93ecad8db1c453fccbe82802c8dd19991b09af14c8ac377041e37939381f23bd0edfb4c05cb4afaea7
|
7
|
+
data.tar.gz: da72839e22f17c4a24f0730419f1e8a58a0ea8afd44d5fa8288565d9dad5eaa3ffe46a3ad689f74d22e9bd87cfef80ff3f03ed40bc54d2fb4c4817eabd1fdd89
|
@@ -17,7 +17,7 @@ module NyrosForm2
|
|
17
17
|
redirect_to users_path
|
18
18
|
|
19
19
|
else
|
20
|
-
render
|
20
|
+
render new_user_path
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -26,14 +26,28 @@ module NyrosForm2
|
|
26
26
|
@user = User.find(params[:id])
|
27
27
|
end
|
28
28
|
|
29
|
-
def edit
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
def edit
|
30
|
+
@user = User.find(params[:id])
|
31
|
+
end
|
32
|
+
|
33
|
+
def update
|
34
|
+
@user = User.find(params[:id])
|
35
|
+
if @user.update_attributes(user_params)
|
36
|
+
redirect_to users_path
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def destroy
|
43
|
+
@user = User.find(params[:id])
|
44
|
+
@user.destroy
|
45
|
+
respond_to do |format|
|
46
|
+
format.html { redirect_to users_url, notice: 'user succesfully deleted' }
|
47
|
+
format.json { head :no_content}
|
48
|
+
format.js { render :layout => false }
|
49
|
+
end
|
50
|
+
end
|
37
51
|
|
38
52
|
def user_params
|
39
53
|
params.require(:user).permit(:name, :email, :mobile);
|
@@ -1,4 +1,15 @@
|
|
1
1
|
module NyrosForm2
|
2
2
|
class User < ApplicationRecord
|
3
|
+
validates :email,uniqueness: true, format: {
|
4
|
+
with: URI::MailTo::EMAIL_REGEXP,
|
5
|
+
message: '*Please Enter Your Email'
|
6
|
+
}
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
validates_presence_of :name, message: "*Please Enter Your Name"
|
11
|
+
validates_presence_of :mobile, message: "Please Enter Your Mobile"
|
12
|
+
|
13
|
+
|
3
14
|
end
|
4
15
|
end
|
@@ -1,2 +1,211 @@
|
|
1
|
-
<
|
2
|
-
<
|
1
|
+
<body >
|
2
|
+
<div class="container" >
|
3
|
+
<div class="form-horizontal no-border form u-dimension-2"
|
4
|
+
style ="margin-top: 20px; width: 450px;"align="center" >
|
5
|
+
|
6
|
+
<%= form_for @user, url: {action: :update} do |f| %>
|
7
|
+
<h2 align="center">User Form </h2>
|
8
|
+
|
9
|
+
<div class="form-group">
|
10
|
+
<div class="col-sm-12">
|
11
|
+
<%= f.label :name %>
|
12
|
+
<span class="err"><%= @user.errors[:name].join('. ') %></span><br/>
|
13
|
+
<%= f.text_field :name, autocomplete: "current-name",class: 'form-control'%>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="form-group">
|
18
|
+
<div class="col-sm-12">
|
19
|
+
<%= f.label :email %>
|
20
|
+
<span class="err"><%= @user.errors[:email].join('. ') %></span><br/>
|
21
|
+
<%= f.email_field :email, autocomplete: "email",class: 'form-control'%>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="form-group">
|
26
|
+
<div class="col-sm-12">
|
27
|
+
<%= f.label :mobile %>
|
28
|
+
<span class="err"><%= @user.errors[:mobile].join('. ') %></span><br/>
|
29
|
+
<%= f.text_field :mobile, autocomplete: "current-name",class: 'form-control'%>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="form-group">
|
34
|
+
<div class="col-sm-12">
|
35
|
+
<%= f.submit "Submit", class: 'submitBtn btn btn-block btn-success btn', id: 'modal-submit' %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<div>
|
41
|
+
<%= link_to "Back", users_path, class: 'btn btn-sm btn-info' %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
|
48
|
+
</body>
|
49
|
+
<style type="text/css">
|
50
|
+
.form-group{
|
51
|
+
width:356px;
|
52
|
+
}
|
53
|
+
|
54
|
+
.form{
|
55
|
+
|
56
|
+
|
57
|
+
padding-top: 30px;
|
58
|
+
padding-bottom: 50px;
|
59
|
+
}
|
60
|
+
.col-sm-12{
|
61
|
+
padding-left: 0px;
|
62
|
+
padding-right: 0px;
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
#user_remember_me{
|
68
|
+
margin-right:0px;
|
69
|
+
}
|
70
|
+
.forgot_pwd{
|
71
|
+
padding-left: 90px;
|
72
|
+
}
|
73
|
+
|
74
|
+
a:hover{
|
75
|
+
text-decoration-line: none;
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
#flash_alert{
|
80
|
+
color: red;
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
#form_email{
|
85
|
+
margin-left: 23px;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
#sign_in_from{
|
91
|
+
margin-left: 400px;
|
92
|
+
}
|
93
|
+
|
94
|
+
/*.new_user{
|
95
|
+
margin-top: 100px;
|
96
|
+
}*/
|
97
|
+
|
98
|
+
.form1 {
|
99
|
+
margin: 0 auto;
|
100
|
+
width: 470px;
|
101
|
+
background-color: white;
|
102
|
+
padding-left: 0px;
|
103
|
+
}
|
104
|
+
|
105
|
+
.form label {
|
106
|
+
display: inline-block;
|
107
|
+
text-align: right;
|
108
|
+
float: left;
|
109
|
+
|
110
|
+
}
|
111
|
+
|
112
|
+
.modal_form{
|
113
|
+
margin-top: 0px;
|
114
|
+
}
|
115
|
+
|
116
|
+
.homepage_dish{
|
117
|
+
height: 100%;
|
118
|
+
width: 50%;
|
119
|
+
position:fixed;
|
120
|
+
}
|
121
|
+
|
122
|
+
.login{
|
123
|
+
padding-right: 20px;
|
124
|
+
color:#0066ff;
|
125
|
+
font-size: 20.3px;
|
126
|
+
line-height: 1.44359;
|
127
|
+
border: 0px;
|
128
|
+
font-weight:700;
|
129
|
+
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
.login a:hover{
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
.signup{
|
138
|
+
padding-right: 100px;
|
139
|
+
color:#0066ff;
|
140
|
+
|
141
|
+
font-size: 20.3px;
|
142
|
+
line-height: 1.44359;
|
143
|
+
border: 0px;
|
144
|
+
font-weight:700;
|
145
|
+
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
.top-left {
|
150
|
+
position: absolute;
|
151
|
+
top:450px;
|
152
|
+
left:10px;
|
153
|
+
color: #f79b9b;
|
154
|
+
font-size: 50px;
|
155
|
+
font-weight: 900;
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
.top-left:hover{
|
160
|
+
color: #f79b9b;
|
161
|
+
}
|
162
|
+
|
163
|
+
.bottom-right {
|
164
|
+
|
165
|
+
}
|
166
|
+
.bottom_img{
|
167
|
+
width: 300px;
|
168
|
+
height: 300px;
|
169
|
+
}
|
170
|
+
.main_header{
|
171
|
+
font-weight: 800;
|
172
|
+
font-size:40px;
|
173
|
+
color: black;
|
174
|
+
}
|
175
|
+
|
176
|
+
a:hover{
|
177
|
+
text-decoration-line: none;
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
.u-dimension-2 {
|
182
|
+
box-shadow: 0 0 0 1px rgba(67,41,163,.1), 0 1px 8px 0 rgba(67,41,163,.1);
|
183
|
+
}
|
184
|
+
|
185
|
+
.form {
|
186
|
+
margin: 0 auto;
|
187
|
+
width: 470px;
|
188
|
+
background-color: white;
|
189
|
+
padding-left: 0px;
|
190
|
+
}
|
191
|
+
|
192
|
+
|
193
|
+
.form input{
|
194
|
+
margin-right: 180px;
|
195
|
+
}
|
196
|
+
|
197
|
+
.err {
|
198
|
+
color: red;
|
199
|
+
font-size: 14px;
|
200
|
+
}
|
201
|
+
|
202
|
+
#flash_alert{
|
203
|
+
color: red;
|
204
|
+
font-size: 14px;
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
</style>
|
209
|
+
|
210
|
+
|
211
|
+
|
@@ -1,9 +1,13 @@
|
|
1
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
2
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
|
3
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
|
4
|
+
|
1
5
|
<br><br>
|
2
6
|
<div class="container">
|
3
7
|
<div>
|
4
8
|
<h2>Users</h2>
|
5
|
-
<%= link_to "New_user", new_user_path %>
|
6
|
-
</div>
|
9
|
+
<%= link_to "New_user", new_user_path, :class => 'btn btn-sm btn-success' %>
|
10
|
+
</div><br>
|
7
11
|
<table class="table">
|
8
12
|
<thead>
|
9
13
|
<tr>
|
@@ -11,6 +15,7 @@
|
|
11
15
|
<th>name</th>
|
12
16
|
<th>email</th>
|
13
17
|
<th>mobile</th>
|
18
|
+
<th>Actions</th>
|
14
19
|
</tr>
|
15
20
|
</thead>
|
16
21
|
<tbody>
|
@@ -18,8 +23,29 @@
|
|
18
23
|
<tr>
|
19
24
|
<td><%= u.id %> </td>
|
20
25
|
<td><%= u.name %></td>
|
21
|
-
<td><%= u.mobile %></td>
|
22
26
|
<td><%= u.email %></td>
|
27
|
+
<td><%= u.mobile %></td>
|
28
|
+
<td>
|
29
|
+
<%= link_to "Edit", edit_user_path(u.id), class: 'btn btn-sm btn-info' %>
|
30
|
+
|
31
|
+
<%= link_to 'Delete', '#',{:class=>"btn btn-danger btn-sm", "data-toggle"=>"modal", "data-target" => "#delete-#{u.id}"} %>
|
32
|
+
<div class="modal fade " id="delete-<%= u.id %>">
|
33
|
+
<div class="modal-dialog ">
|
34
|
+
<div class="modal-content">
|
35
|
+
<div class="modal-header">
|
36
|
+
<h5><%= u.name %> User Delete</h5>
|
37
|
+
</div>
|
38
|
+
<div class="modal-body">
|
39
|
+
<p>Are you sure to delete this User?</p>
|
40
|
+
</div>
|
41
|
+
<div class="modal-footer">
|
42
|
+
<%= link_to 'Delete', user_path(u), method: :delete, :class => 'btn btn-danger btn-sm' %>
|
43
|
+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</td>
|
23
49
|
</tr>
|
24
50
|
<% end %>
|
25
51
|
</tbody>
|
@@ -5,36 +5,35 @@
|
|
5
5
|
|
6
6
|
<%= form_for @user, url: {action: :create} do |f| %>
|
7
7
|
<h2 align="center">User Form </h2>
|
8
|
-
|
9
|
-
<%= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String) %>
|
10
|
-
<% end %>
|
8
|
+
|
11
9
|
|
12
10
|
<div class="form-group">
|
13
11
|
<div class="col-sm-12">
|
14
12
|
<%= f.label :name %>
|
15
|
-
|
16
|
-
'
|
13
|
+
<span class="err"><%= @user.errors[:name].join('. ') %></span><br/>
|
14
|
+
<%= f.text_field :name, autocomplete: "current-name",class: 'form-control'%>
|
17
15
|
</div>
|
18
16
|
</div>
|
19
17
|
|
20
18
|
<div class="form-group">
|
21
19
|
<div class="col-sm-12">
|
22
20
|
<%= f.label :email %>
|
23
|
-
|
21
|
+
<span class="err"><%= @user.errors[:email].join('. ') %></span><br/>
|
22
|
+
<%= f.email_field :email, autocomplete: "email",class: 'form-control'%>
|
24
23
|
</div>
|
25
24
|
</div>
|
26
25
|
|
27
26
|
<div class="form-group">
|
28
27
|
<div class="col-sm-12">
|
29
28
|
<%= f.label :mobile %>
|
30
|
-
|
31
|
-
'
|
29
|
+
<span class="err"><%= @user.errors[:mobile].join('. ') %></span><br/>
|
30
|
+
<%= f.text_field :mobile, autocomplete: "current-name",class: 'form-control'%>
|
32
31
|
</div>
|
33
32
|
</div>
|
34
33
|
|
35
34
|
<div class="form-group">
|
36
35
|
<div class="col-sm-12">
|
37
|
-
<%= f.submit "
|
36
|
+
<%= f.submit "Submit", class: 'submitBtn btn btn-block btn-success btn', id: 'modal-submit' %>
|
38
37
|
</div>
|
39
38
|
</div>
|
40
39
|
<% end %>
|
data/lib/nyros_form2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nyros_form2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- raju rekadi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|