Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
marketParser
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nazarf
marketParser
Commits
fbc685d1
Commit
fbc685d1
authored
Apr 06, 2020
by
kolosfed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating users views
parent
3d69c10b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
45 deletions
+62
-45
users.coffee
app/assets/javascripts/application/users.coffee
+4
-0
application_helper.rb
app/helpers/application_helper.rb
+4
-0
_form.html.haml
app/views/users/_form.html.haml
+22
-18
edit.html.haml
app/views/users/edit.html.haml
+6
-4
index.html.haml
app/views/users/index.html.haml
+5
-6
new.html.haml
app/views/users/new.html.haml
+5
-2
show.html.haml
app/views/users/show.html.haml
+16
-15
No files found.
app/assets/javascripts/application/users.coffee
0 → 100644
View file @
fbc685d1
$
(
document
).
on
"click"
,
".show_password_fields"
,
(
e
)
->
e
.
preventDefault
()
$
(
this
).
addClass
(
"d-none"
)
$
(
".password_fields"
).
removeClass
(
"d-none"
).
find
(
"input"
).
attr
(
"disabled"
,
null
)
\ No newline at end of file
app/helpers/application_helper.rb
View file @
fbc685d1
...
@@ -15,4 +15,8 @@ module ApplicationHelper
...
@@ -15,4 +15,8 @@ module ApplicationHelper
end
end
end
end
def
captures
@captures
||=
{}
end
end
end
app/views/users/_form.html.haml
View file @
fbc685d1
=
form_for
@user
do
|
f
|
:ruby
-
if
@user
.
errors
.
any?
show_password_fields
=
@user
.
new_record?
||
#error_explanation
@user
.
errors
.
details
.
has_key?
(
:password
)
||
%h2
=
"
#{
pluralize
(
@user
.
errors
.
count
,
"error"
)
}
prohibited this user from being saved:"
@user
.
errors
.
details
.
has_key?
(
:password_confirmation
)
%ul
.row
-
@user
.
errors
.
full_messages
.
each
do
|
message
|
.col-12.col-lg-6
%li
=
message
.card.shadow.mb-4
.card-header.py-3
%h2
.d-inline.m-0.font-weight-bold.text-primary
=
captures
[
:heading
]
.float-right
=
captures
[
:links
]
.card-body
=
simple_form_for
@user
do
|
f
|
=
f
.
input
:name
=
f
.
input
:email
%button
.show_password_fields.btn.btn-primary
{
class:
(
'd-none'
if
show_password_fields
)}
Change password
.password_fields
{
class:
(
'd-none'
unless
show_password_fields
)}
=
f
.
input
:password
,
as: :password
,
input_html:
{
disabled:
!
show_password_fields
}
=
f
.
input
:password_confirmation
,
as: :password
,
input_html:
{
disabled:
!
show_password_fields
}
=
f
.
submit
"Save"
,
class:
"btn btn-success"
.field
=
f
.
label
:name
=
f
.
text_field
:name
.field
=
f
.
label
:email
=
f
.
text_field
:email
.field
=
f
.
label
:password
=
f
.
text_field
:password
.actions
=
f
.
submit
'Save'
app/views/users/edit.html.haml
View file @
fbc685d1
%h1
Editing user
-
captures
[
:heading
]
=
capture
do
Editing user
-
captures
[
:links
]
=
capture
do
=
link_to
icon
(
'fas'
,
'eye'
,
class:
'fa-2x ml-2'
,
title:
'Show'
),
@user
=
link_to
icon
(
'fas'
,
'reply'
,
class:
'fa-2x ml-2'
,
title:
'Back'
),
users_path
=
render
'form'
=
render
'form'
=
link_to
'Show'
,
@user
\|
=
link_to
'Back'
,
users_path
app/views/users/index.html.haml
View file @
fbc685d1
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
.card.shadow.mb-4
.card.shadow.mb-4
.card-header.py-3
.card-header.py-3
%h2
.m-0.font-weight-bold.text-primary
=
model
.
model_name
.
human
(
count:
2
)
%h2
.d-inline.m-0.font-weight-bold.text-primary
=
model
.
model_name
.
human
(
count:
2
)
.float-right
=
link_to
icon
(
'fas'
,
'plus-square'
,
class:
"fa-2x"
,
title:
"New
#{
model
.
model_name
.
human
}
"
),
new_user_path
.card-body
.card-body
.table-responsive
.table-responsive
%table
.table.table-bordered.admin-table
%table
.table.table-bordered.admin-table
...
@@ -17,9 +18,7 @@
...
@@ -17,9 +18,7 @@
%td
=
link_to
user
.
name
,
user
%td
=
link_to
user
.
name
,
user
%td
=
user
.
email
%td
=
user
.
email
%td
%td
=
link_to
icon
(
'fas'
,
'eye'
),
user_path
(
user
)
=
link_to
icon
(
'fas'
,
'eye'
,
title:
"Show"
),
user_path
(
user
)
=
link_to
icon
(
'fas'
,
'edit'
),
edit_user_path
(
user
)
=
link_to
icon
(
'fas'
,
'edit'
,
title:
"Edit"
),
edit_user_path
(
user
)
=
link_to
icon
(
'fas'
,
'trash-alt'
),
user_path
(
user
),
method: :delete
,
data:
{
confirm:
"Are you sure?"
}
=
link_to
icon
(
'fas'
,
'trash-alt'
,
title:
"Delete"
),
user_path
(
user
),
method: :delete
,
data:
{
confirm:
"Are you sure?"
}
=
link_to
"New
#{
model
.
model_name
.
human
}
"
,
new_user_path
app/views/users/new.html.haml
View file @
fbc685d1
%h1
New user
-
captures
[
:heading
]
=
capture
do
New user
-
captures
[
:links
]
=
capture
do
=
link_to
icon
(
'fas'
,
'reply'
,
class:
'fa-2x ml-2'
,
title:
'Back'
),
users_path
=
render
'form'
=
render
'form'
,
heading:
"New user"
=
link_to
'Back'
,
users_path
=
link_to
'Back'
,
users_path
app/views/users/show.html.haml
View file @
fbc685d1
%p
#notice
=
notice
.row
.col-12.col-lg-6
%p
.card.shadow.mb-4
.card-header.py-3
%h2
.d-inline.m-0.font-weight-bold.text-primary
=
User
.float-right
=
link_to
icon
(
'fas'
,
'edit'
,
class:
'fa-2x ml-2'
,
title:
'Edit'
),
@user
=
link_to
icon
(
'fas'
,
'trash-alt'
,
class:
'fa-2x ml-2'
,
title:
'Delete'
),
@user
,
method: :delete
,
data:
{
confirm:
"Are you sure?"
}
=
link_to
icon
(
'fas'
,
'reply'
,
class:
'fa-2x ml-2'
,
title:
'Back'
),
users_path
.card-body
%p
%b
Name:
%b
Name:
=
@user
.
name
=
@user
.
name
%p
%p
%b
Email:
%b
Email:
=
@user
.
email
=
@user
.
email
%p
%b
Password:
=
@user
.
password
=
link_to
'Edit'
,
edit_user_path
(
@user
)
\|
=
link_to
'Back'
,
users_path
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment