diff --git a/app/assets/images/pictograms/account-remove-outline.svg b/app/assets/images/pictograms/account-remove-outline.svg new file mode 100644 index 0000000..495232c --- /dev/null +++ b/app/assets/images/pictograms/account-remove-outline.svg @@ -0,0 +1 @@ + diff --git a/app/assets/images/pictograms/checkbox-marked-outline.svg b/app/assets/images/pictograms/checkbox-marked-outline.svg new file mode 100644 index 0000000..e768916 --- /dev/null +++ b/app/assets/images/pictograms/checkbox-marked-outline.svg @@ -0,0 +1 @@ + diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 73dab9e..53ed2dd 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -214,3 +214,44 @@ form input[type=submit] { margin: 1.5rem auto 0 auto; padding: 0.75rem; } + +table.items { + border-spacing: 0; + border: 1px solid #dddddd; + border-radius: 0.2rem; + font-size: 0.85rem; + margin: 1rem auto 0 auto; +} +table.items th { + font-size: 0.8rem; +} +table.items th, +table.items tr:hover { + background-color: #f3f3f3; +} +table.items th, +table.items td:not(.svg):not(.actions) { + padding: 0.8rem; +} +table.items td { + border-top: 1px solid #dddddd; +} +table.items td a { + border-color: #dddddd; + color: #909090; + font-weight: normal; + margin-right: 0.25rem; + padding: 0.25rem; +} +table.items td:not(:first-child) { + color: #909090; + fill: #909090; + text-align: center; +} +table.items td.actions { + text-align: right; +} +table.items svg { + height: 1.2rem; + width: 1.2rem; +} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ba4c97c..2f0526a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -48,9 +48,11 @@ module ApplicationHelper current = html_options.delete(:current) return "" if (current == :hide) && (url_for(options) == request.path) - classes = class_names(html_options[:class], "image-button", active: current == :active) name = svg_tag("pictograms/#{image}.svg#icon") + name if image - link_to name, options, class: classes + classes = class_names(html_options[:class], "image-button", active: current == :active) + html_options.merge!(class: classes) { |k, v1, v2| "#{v1} #{v2}" } + + link_to name, options, html_options end def svg_tag(source, options = {}) diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb deleted file mode 100644 index e9b0220..0000000 --- a/app/views/users/_user.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
-

- Email: - <%= user.email %> -

- -

- Status: - <%= user.status %> -

- -
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index a3992d9..e37f739 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,10 +1,21 @@ -
+ + + + + + + + <% @users.each do |user| %> - <%= render user %> -

- <%= link_to "Show this user", user %> -

+ + + + + + + <% end %> - - -<%= link_to "New user", new_user_path %> +
<%= User.human_attribute_name(:email).capitalize %><%= User.human_attribute_name(:status).capitalize %><%= User.human_attribute_name(:created_at).capitalize %> UTC<%= User.human_attribute_name(:confirmed_at).capitalize %><%= t :actions %>
<%= user.email %><%= user.status %><%= user.created_at.to_fs(:db_without_sec) %> + <%= svg_tag "pictograms/checkbox-marked-outline.svg#icon" if user.confirmed_at.present? %> + <%= image_link_to "Delete", "account-remove-outline", user_path(user), + data: { turbo: true, turbo_method: :delete } %>
diff --git a/config/initializers/time_formats.rb b/config/initializers/time_formats.rb new file mode 100644 index 0000000..ad0c00c --- /dev/null +++ b/config/initializers/time_formats.rb @@ -0,0 +1 @@ +Time::DATE_FORMATS[:db_without_sec] = "%Y-%m-%d %H:%M" diff --git a/config/locales/en.yml b/config/locales/en.yml index 211a5f8..82841c9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,7 +3,10 @@ en: attributes: user: email: e-mail + status: status password: password + created_at: registration + confirmed_at: confirmed users: passwords: edit: @@ -19,6 +22,7 @@ en: layouts: application: users: Users + actions: Actions or: or register: Register sign_in: Sign in