Showing
7 changed files
with
56 additions
and
1 deletions
... | @@ -118,7 +118,7 @@ table { | ... | @@ -118,7 +118,7 @@ table { |
118 | grid-template-columns: 2.5vw auto 2.5vw; | 118 | grid-template-columns: 2.5vw auto 2.5vw; |
119 | } | 119 | } |
120 | 120 | ||
121 | -.admin-index { | 121 | +.admin-index, .user-index, .user-form { |
122 | grid-row: 2; | 122 | grid-row: 2; |
123 | grid-column: 2; | 123 | grid-column: 2; |
124 | 124 | ... | ... |
app/controllers/admin/users_controller.rb
0 → 100644
1 | +class Admin::UsersController < CrudController::Base | ||
2 | + enable_gatekeeper | ||
3 | + guard_bifrost | ||
4 | + | ||
5 | + def update | ||
6 | + if update! | ||
7 | + redirect_to admin_users_path | ||
8 | + else | ||
9 | + render :edit | ||
10 | + end | ||
11 | + end | ||
12 | + | ||
13 | + private | ||
14 | + | ||
15 | + def object_params | ||
16 | + params.require(:user).permit( | ||
17 | + :name, :mail, :password, :password_confirmation | ||
18 | + ) | ||
19 | + end | ||
20 | +end |
app/views/admin/users/_form.html.slim
0 → 100644
app/views/admin/users/edit.html.slim
0 → 100644
1 | += render 'form', title: 'Edit' | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
app/views/admin/users/index.html.slim
0 → 100644
1 | +.user-index | ||
2 | + h2 | ||
3 | + | Users | ||
4 | + = link_to 'New User', new_admin_user_path, style: 'float: right' | ||
5 | + | ||
6 | + - attrs = %i[name mail] | ||
7 | + table | ||
8 | + thead | ||
9 | + - attrs.each do |a| | ||
10 | + th = User.human_attribute_name(a) | ||
11 | + th | ||
12 | + tbody | ||
13 | + - @object_collection.each do |model| | ||
14 | + tr | ||
15 | + - attrs.each do |a| | ||
16 | + td = model.send(a) | ||
17 | + td | ||
18 | + = link_to 'Edit', edit_admin_user_path(model) | ||
19 | + | ||
20 | + |
app/views/admin/users/new.html.slim
0 → 100644
1 | += render 'form', title: 'New' | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment