diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 45fea92..66e6d90 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -1,27 +1,26 @@ -<%= form_with(model: user, local: true) do |form| %> - <% if user.errors.any? %> -
-

<%= pluralize(user.errors.count, "error") %> prohibited this user from being saved:

- -
- <% end %> - -
- <%= form.label :email %>
- <%= form.email_field :email, id: :user_email %> -
- -
- <%= form.label :admin %>
- <%= form.check_box :admin %> -
- -
- <%= form.submit 'Save', class: 'btn btn-primary' %> +<%= form_with(model: user, local: true, html: { class: 'needs-validation', novalidate: true }) do |form| %> + <% if user.errors.any? %> + <% end %> - \ No newline at end of file + +
+ <%= form.label :email, class: 'form-label' %> + <%= form.email_field :email, id: :user_email, class: 'form-control' %> +
+ +
+ <%= form.check_box :admin, class: 'form-check-input', id: :user_admin %> + <%= form.label :admin, class: 'form-check-label' %> +
+ +
+ <%= form.submit 'Save', class: 'btn btn-dark' %> +
+<% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 810147d..48bc5ba 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -1,5 +1,14 @@ -

Edit User

+
+
+
+

Edit User

-<%= render 'form', user: @user %> + <%= render 'form', user: @user %> -<%= link_to 'Back to Users', users_path, class: 'btn btn-secondary' %> +
+ <%= link_to 'Back to Users', users_path, class: 'btn btn-secondary' %> + <%= link_to 'Delete User', user_path(@user), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %> +
+
+
+
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 2330ada..1f214fa 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,23 +1,40 @@ -

Users

- - - - - - - - - - - <% @users.each do |user| %> - - - - - - <% end %> - -
EmailAdminActions
<%= user.email %><%= user.admin? ? 'Yes' : 'No' %> - <%= link_to 'Edit', edit_user_path(user), class: 'btn btn-info' %> - <%= link_to 'Delete', user_path(user), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %> -
+
+
+
+

Users

+
+
+ + + + + + + + + + <% @users.each do |user| %> + + + + + + <% end %> + +
EmailAdminActions
<%= user.email %><%= user.admin? ? 'Yes' : 'No' %> + <%= link_to edit_user_path(user), class: 'btn btn-info btn-sm' do %> + + <% end %> + <%= link_to user_path(user), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger btn-sm' do %> + + <% end %> +
+
+
+ +
+
+ <%= link_to 'Back to Home', root_path, class: "btn btn-secondary" %> +
+
+