Skip to content

Commit 795352d

Browse files
committed
fixed admin users view
1 parent 9f4cb4b commit 795352d

File tree

3 files changed

+26
-40
lines changed

3 files changed

+26
-40
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
<div class="col-sm-3">
1+
<div class="col-sm-9">
22
<% url = @user.persisted? ? lcms_engine.admin_user_path(@user) : lcms_engine.admin_users_path %>
33
<%= simple_form_for @user, url: url, data: { turbo: false } do |f| %>
44
<% if @user.persisted? %>
55
<%= f.input :id, disabled: true %>
66
<% end %>
7-
87
<%= f.input :name %>
98
<%= f.input :email %>
109
<%= f.input :role, collection: Lcms::Engine::User.roles.keys, include_blank: false %>
1110
<%= f.input :access_code, disabled: @user.persisted? %>
12-
1311
<% if @user.persisted? %>
1412
<%= f.input :confirmed_at, disabled: true, as: :string %>
1513
<% end %>
16-
1714
<%= f.button :submit, t('ui.save'), name: nil, class: 'btn btn-primary' %>
1815
<% end %>
1916
</div>
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<%= simple_form_for :query, url: lcms_engine.admin_users_path, html: { method: :get } do |f| %>
2-
<div class='row align-bottom align-justify'>
3-
<%= f.input :email, label: false, required: false, placeholder: 'Search by E-mail', wrapper_html: { class: 'o-admin-search-term' } %>
4-
<%= f.input :access_code, label: false, required: false, placeholder: 'Enter Access Code', wrapper_html: { class: 'o-admin-search-term' } %>
5-
6-
<div class="row justify-content-center">
7-
<div class="col-sm-1">
8-
<%= f.button :submit, t('ui.search'), class: 'btn btn-warning', name: nil %>
9-
</div>
2+
<div class='row align-items-end'>
3+
<%= f.input :email, label: false, required: false, placeholder: 'Search by E-mail', wrapper_html: { class: 'o-admin-search-term flex-grow-1 col-auto' } %>
4+
<%= f.input :access_code, label: false, required: false, placeholder: 'Enter Access Code', wrapper_html: { class: 'o-admin-search-termflex-grow-1 col-auto' } %>
5+
<div class="col-auto mb-3">
6+
<%= f.button :submit, t('ui.search'), class: 'btn btn-warning', name: nil %>
107
</div>
118
</div>
129
<% end %>

app/views/lcms/engine/admin/users/index.html.erb

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,42 @@
11
<% set_page_title 'Users' %>
2-
32
<div class="container-fluid">
43
<h1 class="text-center"><%= t('.page_title') %></h1>
5-
64
<hr>
7-
85
<div class="row">
9-
<div class="col-sm-9"><%= link_to t('.new_user'), lcms_engine.new_admin_user_path, class: 'btn btn-success' %></div>
10-
<div class="col-sm-3"><%= render 'search_form' %></div>
11-
6+
<div class="col-12"><%= render 'search_form' %></div>
7+
<div class="col-12"><%= link_to t('.new_user'), lcms_engine.new_admin_user_path, class: 'btn btn-success' %></div>
128
</div>
13-
149
<hr>
15-
1610
<div class="row">
1711
<table class="table">
1812
<tr>
19-
<th><%= t('.id') %>
20-
<th><%= t('.name') %>
21-
<th><%= t('.email') %>
22-
<th><%= t('.role') %>
23-
<th><%= t('.access_code') %>
24-
<th><%= t('.confirmed') %>
25-
<th><%= t('.registration') %>
26-
<th>
27-
<th>
13+
<th><%= t('.id') %></th>
14+
<th><%= t('.name') %></th>
15+
<th><%= t('.email') %></th>
16+
<th><%= t('.role') %></th>
17+
<th><%= t('.access_code') %></th>
18+
<th><%= t('.confirmed') %></th>
19+
<th><%= t('.registration') %></th>
20+
<th></th>
21+
<th></th>
2822
</tr>
29-
3023
<% @users.each do |user| %>
3124
<% cache user do %>
3225
<tr id="user_<%= user.id %>">
33-
<td><%= link_to user.id, lcms_engine.edit_admin_user_path(user) %>
34-
<td><%= link_to user.name, lcms_engine.edit_admin_user_path(user) %>
35-
<td><%= user.email %>
36-
<td><%= user.role %>
37-
<td><%= user.access_code.presence || '-' %>
38-
<td><%= user.confirmed? ? 'YES' : 'NO' %>
39-
<td class="u-txt--small"><%= user.created_at.to_s %>
40-
<td><%= button_to t('.reset_password_btn'), lcms_engine.reset_password_admin_user_path(user), class: 'btn btn-warning', data: { confirm: t('ui.are_you_sure') }, form_class: 'inline', method: :post %>
41-
<td><%= button_to t('ui.delete'), lcms_engine.admin_user_path(user), class: 'btn btn-danger', data: { confirm: t('ui.are_you_sure'), 'turbo-method': :delete }, form_class: 'inline', method: :delete %></td>
26+
<td><%= link_to user.id, lcms_engine.edit_admin_user_path(user) %></td>
27+
<td><%= link_to user.name, lcms_engine.edit_admin_user_path(user) %></td>
28+
<td><%= user.email %></td>
29+
<td><%= user.role %></td>
30+
<td><%= user.access_code.presence || '-' %></td>
31+
<td><%= user.confirmed? ? 'YES' : 'NO' %></td>
32+
<td class="u-txt--small"><%= user.created_at.to_s %></td>
33+
<td><%= button_to t('.reset_password_btn'), lcms_engine.reset_password_admin_user_path(user), class: 'btn btn-warning btn-sm', data: { confirm: t('ui.are_you_sure') }, form_class: 'inline', method: :post %></td>
34+
<td><%= button_to t('ui.delete'), lcms_engine.admin_user_path(user), class: 'btn btn-danger btn-sm', data: { confirm: t('ui.are_you_sure'), 'turbo-method': :delete }, form_class: 'inline', method: :delete %></td>
4235
</tr>
4336
<% end %>
4437
<% end %>
4538
</table>
4639
</div>
47-
4840
<div class="row">
4941
<%= will_paginate @users, list_classes: %w(pagination d-flex justify-content-center) %>
5042
</div>

0 commit comments

Comments
 (0)