diff --git a/.github/workflows/brakeman.yml b/.github/workflows/brakeman.yml index 0ae890ccad..bda70d0d32 100644 --- a/.github/workflows/brakeman.yml +++ b/.github/workflows/brakeman.yml @@ -19,7 +19,7 @@ permissions: contents: read jobs: - run: + brakeman: runs-on: ubuntu-24.04 timeout-minutes: 10 diff --git a/.github/workflows/herb.yml b/.github/workflows/herb.yml index 54ead1e729..f693c49879 100644 --- a/.github/workflows/herb.yml +++ b/.github/workflows/herb.yml @@ -17,7 +17,7 @@ permissions: contents: read jobs: - run: + herb: runs-on: ubuntu-24.04 timeout-minutes: 10 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e2c0af0732..2d9401a6b1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class UsersController < ApplicationController - layout "errbit", except: :index - def index @users = policy_scope(User) .order_by(name: :asc) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 5467463f7c..495d923dae 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,7 +13,7 @@ <%= favicon_link_tag %> <%= csrf_meta_tag %> <%= csp_meta_tag %> - <%= stylesheet_link_tag :application %> + <%= stylesheet_link_tag :application, integrity: true %> <%= javascript_include_tag :app %> <%= javascript_importmap_tags %> @@ -29,9 +29,15 @@ + <% if (breadcrumb = yield(:breadcrumb)).present? %> +
+ <%= breadcrumb %> +
+ <% end %> +
- <%= yield :title_avatar %> + <%#= yield :title_avatar %>

<%#= yield :title %>

<%= yield :meta %> diff --git a/app/views/shared/_link_github_account.html.erb b/app/views/shared/_link_github_account.html.erb index cd987656df..ba509d0616 100644 --- a/app/views/shared/_link_github_account.html.erb +++ b/app/views/shared/_link_github_account.html.erb @@ -1,4 +1,5 @@ <%# locals: (user:) %> + <% if Errbit::Config.github_authentication && user == current_user %> <% if user.github_account? %> diff --git a/app/views/shared/_link_google_account.html.erb b/app/views/shared/_link_google_account.html.erb index af1bfabb74..c0072fe1d2 100644 --- a/app/views/shared/_link_google_account.html.erb +++ b/app/views/shared/_link_google_account.html.erb @@ -1,4 +1,5 @@ <%# locals: (user:) %> + <% if Errbit::Config.google_authentication && user == current_user %> <% if user.google_account? %> diff --git a/app/views/shared/_notice_fingerprinter.html.erb b/app/views/shared/_notice_fingerprinter.html.erb index bcea935799..f5625744d3 100644 --- a/app/views/shared/_notice_fingerprinter.html.erb +++ b/app/views/shared/_notice_fingerprinter.html.erb @@ -1,4 +1,5 @@ <%# locals: (f:) %> + <%= f.fields_for :notice_fingerprinter do |g| %>
<%= g.check_box :error_class %> diff --git a/app/views/users/_fields.html.erb b/app/views/users/_fields.html.erb index b72d125a11..79965d552d 100644 --- a/app/views/users/_fields.html.erb +++ b/app/views/users/_fields.html.erb @@ -2,53 +2,73 @@ <%= errors_for user %> -
- <%= f.label :name, t(".name") %> - <%= f.text_field :name %> +
+
+ <%= f.label :name, t(".name"), class: "form-label" %> + <%= f.text_field :name, placeholder: t(".name_placeholder"), class: "form-control", required: true %> +
<% if Errbit::Config.user_has_username %> -
- <%= f.label :username, t(".username") %> - <%= f.text_field :username, autocomplete: "username" %> +
+
+ <%= f.label :username, t(".username"), class: "form-label" %> + <%= f.text_field :username, autocomplete: "username", class: "form-control", required: true %> +
<% end %> -
- <%= f.label :email, t(".email") %> - <%= f.text_field :email, autocomplete: "email" %> +
+
+ <%= f.label :email, t(".email"), class: "form-label" %> + <%= f.text_field :email, autocomplete: "email", placeholder: t(".email_placeholder"), class: "form-control", required: true %> +
<% if Errbit::Config.github_authentication %> -
- <%= f.label :github_login, "#{Errbit::Config.github_site_title} login" %> - <%= f.text_field :github_login %> +
+
+ <%= f.label :github_login, "#{Errbit::Config.github_site_title} login", class: "form-label" %> + <%= f.text_field :github_login, class: "form-control" %> +
<% end %> -
- <%= f.label :per_page, t(".entries") %> - <%= f.select :per_page, [10, 20, 30, 50, 75, 100] %> +
+
+ <%= f.label :per_page, t(".entries"), class: "form-label" %> + <%= f.select :per_page, [10, 20, 30, 50, 75, 100], {}, {class: "form-select"} %> +
-
- <%= f.label :time_zone, t(".time_zone") %> - <%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones %> +
+
+ <%= f.label :time_zone, t(".time_zone"), class: "form-label" %> + <%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.all, {}, class: "form-select" %> +
-
- <%= f.label :password, t(".password") %> - <%= f.password_field :password, autocomplete: "new-password" %> +
+
+ <%= f.label :password, t(".password"), class: "form-label" %> + <%= f.password_field :password, autocomplete: "new-password", class: "form-control" %> +
-
- <%= f.label :password_confirmation, t(".password_confirmation") %> - <%= f.password_field :password_confirmation, autocomplete: "new-password" %> +
+
+ <%= f.label :password_confirmation, t(".password_confirmation"), class: "form-label" %> + <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %> +
<% if current_user.admin? %> -
- <%= f.check_box :admin %> - <%= f.label :admin, t(".admin") %> +
+
+
+ <%= f.check_box :admin, class: "form-check-input" %> + <%= f.label :admin, t(".admin"), class: "form-check-label" %> +
+
<% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 2c92cdacf7..6a83d864d7 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -1,5 +1,20 @@ <% content_for :title, "#{t(".title")} #{@user.name}" %> +<% content_for :breadcrumb do %> +
+
+ +
+
+<% end %> + <% content_for :action_bar do %> <%= render "shared/link_github_account", user: @user %> <%= render "shared/link_google_account", user: @user %> @@ -9,7 +24,11 @@ <%= form_for @user, html: {autocomplete: "off"} do |f| %> <%= render "fields", f: f, user: @user %> -
- <%= f.submit t(".update_user") %> +
+
+ <%= button_tag type: :submit, class: "btn btn-primary" do %> + <%= inline_svg_tag "icons/floppy.svg" %> <%= t(".update_user") %> + <% end %> +
<% end %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index e0566527d8..62e0e48a5e 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,5 +1,18 @@ <% content_for :title, t(".title") %> +<% content_for :breadcrumb do %> +
+
+ +
+
+<% end %> + <% content_for :action_bar do %> <%= link_to new_user_path do %> @@ -12,7 +25,7 @@
- +
<% if Errbit::Config.use_gravatar %> @@ -47,7 +60,6 @@ -
<%= paginate @users %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 90c033c704..afe3cac8b6 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,11 +1,29 @@ <% content_for :title, t(".title") %> +<% content_for :breadcrumb do %> +
+
+ +
+
+<% end %> + <% content_for :action_bar, link_to(t(".cancel"), users_path, class: "button") %> <%= form_for @user do |f| %> <%= render "fields", f: f, user: @user %> -
- <%= f.submit t(".add_user") %> +
+
+ <%= button_tag type: :submit, class: "btn btn-primary" do %> + <%= inline_svg_tag "icons/floppy.svg" %> <%= t(".add_user") %> + <% end %> +
<% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 3ae98c305b..0a9c0add79 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,5 +1,19 @@ <% content_for :title, @user.name %> +<% content_for :breadcrumb do %> +
+
+ +
+
+<% end %> + <% if Errbit::Config.use_gravatar && (gravatar = gravatar_url(@user.email, s: 86)) %> <% content_for :title_avatar do %> <%= image_tag gravatar, class: "title-avatar", alt: "" %> @@ -18,23 +32,28 @@ class: "delete button" %> <% end %> -
+
+ + + + + - + <% if Errbit::Config.user_has_username %> - + <% end %> <% if Errbit::Config.github_authentication && @user.github_login.present? %> - + <% end %> diff --git a/config/initializers/kaminari.rb b/config/initializers/kaminari.rb new file mode 100644 index 0000000000..9bd4c7aa94 --- /dev/null +++ b/config/initializers/kaminari.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +Kaminari.configure do |config| + # config.default_per_page = 25 + # config.max_per_page = nil + config.window = 1 + # config.outer_window = 0 + # config.left = 0 + # config.right = 0 + # config.page_method_name = :page + # config.param_name = :page + # config.max_pages = nil + # config.params_on_first_page = false +end diff --git a/config/locales/en.yml b/config/locales/en.yml index fe4e18c565..8a91c45591 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -206,9 +206,11 @@ en: success: "That's sad. %{name} is no longer part of your team." error: "You can't delete yourself" fields: - name: Name + name: "Name" + name_placeholder: "Jon Snow" username: Username - email: Email + email: "Email" + email_placeholder: "jon.snow@example.com" entries: Entries per page time_zone: Time Zone password: Password diff --git a/config/locales/kaminari.en.yml b/config/locales/kaminari.en.yml new file mode 100644 index 0000000000..8c01f9b57d --- /dev/null +++ b/config/locales/kaminari.en.yml @@ -0,0 +1,8 @@ +en: + views: + pagination: + first: "«" + last: "»" + previous: "‹" + next: "›" + truncate: "…" diff --git a/config/locales/kaminari.pt-BR.yml b/config/locales/kaminari.pt-BR.yml new file mode 100644 index 0000000000..f0801936e8 --- /dev/null +++ b/config/locales/kaminari.pt-BR.yml @@ -0,0 +1,8 @@ +pt-BR: + views: + pagination: + first: "«" + last: "»" + previous: "‹" + next: "›" + truncate: "…" diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index e840bd8684..0bd052eb5c 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -174,9 +174,11 @@ pt-BR: success: "Isto é triste. %{name} não faz mais parte do seu time." error: "Você não pode excluir a si mesmo" fields: - name: Nome + name: "Nome" + name_placeholder: "Jon Snow" username: Usuário - email: E-mail + email: "E-mail" + email_placeholder: "jon.snow@example.com" entries: Registros por página time_zone: Fuso horário password: Senha diff --git a/spec/views/users/index.html.erb_spec.rb b/spec/views/users/index.html.erb_spec.rb index 523d47f7d8..bd1e33e187 100644 --- a/spec/views/users/index.html.erb_spec.rb +++ b/spec/views/users/index.html.erb_spec.rb @@ -10,6 +10,6 @@ it "should see users option" do render - expect(rendered).to match(/class="user_list"/) + expect(rendered).to match(/id="users"/) end end
<%= t(".name") %><%= @user.name %>
<%= t(".email") %><%= @user.email %><%= @user.email %>
<%= t(".username") %><%= @user.username %><%= @user.username %>
<%= "#{Errbit::Config.github_site_title} Login" %><%= link_to @user.github_login, "#{Errbit::Config.github_url}/#{@user.github_login}" %><%= link_to @user.github_login, "#{Errbit::Config.github_url}/#{@user.github_login}" %>