Sitelet https://github.com/errbit/errbit/pull/3169/files
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/brakeman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ permissions:
contents: read

jobs:
run:
brakeman:
runs-on: ubuntu-24.04
timeout-minutes: 10

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/herb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:
contents: read

jobs:
run:
herb:
runs-on: ubuntu-24.04
timeout-minutes: 10

Expand Down
2 changes: 0 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

class UsersController < ApplicationController
Comment thread
biow0lf marked this conversation as resolved.
layout "errbit", except: :index

def index
@users = policy_scope(User)
.order_by(name: :asc)
Expand Down
10 changes: 8 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>

Expand All @@ -29,9 +29,15 @@
</div>
</div>

<% if (breadcrumb = yield(:breadcrumb)).present? %>
<div class="container">
<%= breadcrumb %>
</div>
<% end %>

<div>
<div>
<%= yield :title_avatar %>
<%#= yield :title_avatar %>
Comment thread
biow0lf marked this conversation as resolved.
<h1><%#= yield :title %></h1>

<span><%= yield :meta %></span>
Expand Down
1 change: 1 addition & 0 deletions app/views/shared/_link_github_account.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%# locals: (user:) %>

<% if Errbit::Config.github_authentication && user == current_user %>
<span class="github">
<% if user.github_account? %>
Expand Down
1 change: 1 addition & 0 deletions app/views/shared/_link_google_account.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%# locals: (user:) %>

<% if Errbit::Config.google_authentication && user == current_user %>
<span class="google">
<% if user.google_account? %>
Expand Down
1 change: 1 addition & 0 deletions app/views/shared/_notice_fingerprinter.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%# locals: (f:) %>

<%= f.fields_for :notice_fingerprinter do |g| %>
<div class="checkbox">
<%= g.check_box :error_class %>
Expand Down
74 changes: 47 additions & 27 deletions app/views/users/_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,73 @@

<%= errors_for user %>

<div class="required">
<%= f.label :name, t(".name") %>
<%= f.text_field :name %>
<div class="row">
<div class="col">
<%= f.label :name, t(".name"), class: "form-label" %>
<%= f.text_field :name, placeholder: t(".name_placeholder"), class: "form-control", required: true %>
</div>
</div>

<% if Errbit::Config.user_has_username %>
<div class="required">
<%= f.label :username, t(".username") %>
<%= f.text_field :username, autocomplete: "username" %>
<div class="row">
<div class="col">
<%= f.label :username, t(".username"), class: "form-label" %>
<%= f.text_field :username, autocomplete: "username", class: "form-control", required: true %>
</div>
</div>
<% end %>

<div class="required">
<%= f.label :email, t(".email") %>
<%= f.text_field :email, autocomplete: "email" %>
<div class="row">
<div class="col">
<%= f.label :email, t(".email"), class: "form-label" %>
<%= f.text_field :email, autocomplete: "email", placeholder: t(".email_placeholder"), class: "form-control", required: true %>
</div>
</div>

<% if Errbit::Config.github_authentication %>
<div>
<%= f.label :github_login, "#{Errbit::Config.github_site_title} login" %>
<%= f.text_field :github_login %>
<div class="row">
<div class="col">
<%= f.label :github_login, "#{Errbit::Config.github_site_title} login", class: "form-label" %>
<%= f.text_field :github_login, class: "form-control" %>
</div>
</div>
<% end %>

<div class="required">
<%= f.label :per_page, t(".entries") %>
<%= f.select :per_page, [10, 20, 30, 50, 75, 100] %>
<div class="row">
<div class="col">
<%= f.label :per_page, t(".entries"), class: "form-label" %>
<%= f.select :per_page, [10, 20, 30, 50, 75, 100], {}, {class: "form-select"} %>
</div>
</div>

<div class="required">
<%= f.label :time_zone, t(".time_zone") %>
<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones %>
<div class="row">
<div class="col">
<%= f.label :time_zone, t(".time_zone"), class: "form-label" %>
<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.all, {}, class: "form-select" %>
</div>
</div>

<div class="required">
<%= f.label :password, t(".password") %>
<%= f.password_field :password, autocomplete: "new-password" %>
<div class="row">
<div class="col">
<%= f.label :password, t(".password"), class: "form-label" %>
<%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
</div>
</div>

<div class="required">
<%= f.label :password_confirmation, t(".password_confirmation") %>
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
<div class="row">
<div class="col">
<%= f.label :password_confirmation, t(".password_confirmation"), class: "form-label" %>
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
</div>
</div>

<% if current_user.admin? %>
<div class="checkbox">
<%= f.check_box :admin %>
<%= f.label :admin, t(".admin") %>
<div class="row">
<div class="col">
<div class="form-check">
<%= f.check_box :admin, class: "form-check-input" %>
<%= f.label :admin, t(".admin"), class: "form-check-label" %>
</div>
</div>
</div>
<% end %>
23 changes: 21 additions & 2 deletions app/views/users/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
<% content_for :title, "#{t(".title")} #{@user.name}" %>

<% content_for :breadcrumb do %>
<div class="row">
<div class="col">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><%= link_to("Home", root_path) %></li>
<li class="breadcrumb-item"><%= link_to("Users", users_path) %></li>
Comment on lines +8 to +9
<li class="breadcrumb-item"><%= link_to(@user.name, user_path(@user)) %></li>
<li class="breadcrumb-item active" aria-current="page"><%= t(".title") %></li>
</ol>
</nav>
</div>
</div>
<% end %>

<% content_for :action_bar do %>
<%= render "shared/link_github_account", user: @user %>
<%= render "shared/link_google_account", user: @user %>
Expand All @@ -9,7 +24,11 @@
<%= form_for @user, html: {autocomplete: "off"} do |f| %>
<%= render "fields", f: f, user: @user %>

<div class="buttons">
<%= f.submit t(".update_user") %>
<div class="row">
<div class="col text-center">
<%= button_tag type: :submit, class: "btn btn-primary" do %>
<%= inline_svg_tag "icons/floppy.svg" %> <%= t(".update_user") %>
<% end %>
</div>
</div>
<% end %>
16 changes: 14 additions & 2 deletions app/views/users/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<% content_for :title, t(".title") %>

<% content_for :breadcrumb do %>
<div class="row">
<div class="col">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><%= link_to("Home", root_path) %></li>
<li class="breadcrumb-item active" aria-current="page"><%= t(".title") %></li>
</ol>
</nav>
</div>
</div>
<% end %>

<% content_for :action_bar do %>
<span>
<%= link_to new_user_path do %>
Expand All @@ -12,7 +25,7 @@
<div class="row">
<div class="col">

<table class="table table-striped table-hover table-bordered">
<table id="users" class="table table-striped table-hover table-bordered">
<thead>
<tr>
<% if Errbit::Config.use_gravatar %>
Expand Down Expand Up @@ -47,7 +60,6 @@
</div>
</div>


<div class="row">
<div class="col">
<%= paginate @users %>
Expand Down
22 changes: 20 additions & 2 deletions app/views/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
<% content_for :title, t(".title") %>

<% content_for :breadcrumb do %>
<div class="row">
<div class="col">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><%= link_to("Home", root_path) %></li>
<li class="breadcrumb-item"><%= link_to("Users", users_path) %></li>
Comment on lines +8 to +9
<li class="breadcrumb-item active" aria-current="page"><%= t(".title") %></li>
</ol>
</nav>
</div>
</div>
<% end %>

<% content_for :action_bar, link_to(t(".cancel"), users_path, class: "button") %>

<%= form_for @user do |f| %>
<%= render "fields", f: f, user: @user %>

<div class="buttons">
<%= f.submit t(".add_user") %>
<div class="row">
<div class="col text-center">
<%= button_tag type: :submit, class: "btn btn-primary" do %>
<%= inline_svg_tag "icons/floppy.svg" %> <%= t(".add_user") %>
<% end %>
</div>
</div>
<% end %>
27 changes: 23 additions & 4 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
<% content_for :title, @user.name %>

<% content_for :breadcrumb do %>
<div class="row">
<div class="col">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><%= link_to("Home", root_path) %></li>
<li class="breadcrumb-item"><%= link_to("Users", users_path) %></li>
Comment on lines +8 to +9
<li class="breadcrumb-item active" aria-current="page"><%= @user.name %></li>
</ol>
</nav>
</div>
</div>
<% end %>

<% if Errbit::Config.use_gravatar && (gravatar = gravatar_url(/sitelet?url=https%3A%2F%2Fgithub.com%2Ferrbit%2Ferrbit%2Fpull%2F3169%2F%40user.email%2C%2520s%3A%252086)) %>
<% content_for :title_avatar do %>
<%= image_tag gravatar, class: "title-avatar", alt: "" %>
Expand All @@ -18,23 +32,28 @@
class: "delete button" %>
<% end %>

<table class="single_user">
<table id="user" class="table table-striped table-hover table-bordered">
<tr>
<th><%= t(".name") %></th>
<td><%= @user.name %></td>
</tr>

<tr>
<th><%= t(".email") %></th>
<td class="main"><%= @user.email %></td>
<td><%= @user.email %></td>
</tr>

<% if Errbit::Config.user_has_username %>
<tr>
<th><%= t(".username") %></th>
<td class="main"><%= @user.username %></td>
<td><%= @user.username %></td>
</tr>
<% end %>

<% if Errbit::Config.github_authentication && @user.github_login.present? %>
<tr>
<th><%= "#{Errbit::Config.github_site_title} Login" %></th>
<td class="main"><%= link_to @user.github_login, "#{Errbit::Config.github_url}/#{@user.github_login}" %></td>
<td><%= link_to @user.github_login, "#{Errbit::Config.github_url}/#{@user.github_login}" %></td>
</tr>
<% end %>

Expand Down
14 changes: 14 additions & 0 deletions config/initializers/kaminari.rb
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions config/locales/kaminari.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
en:
views:
pagination:
first: "&laquo;"
last: "&raquo;"
previous: "&lsaquo;"
next: "&rsaquo;"
truncate: "&hellip;"
8 changes: 8 additions & 0 deletions config/locales/kaminari.pt-BR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pt-BR:
views:
pagination:
first: "&laquo;"
last: "&raquo;"
previous: "&lsaquo;"
next: "&rsaquo;"
truncate: "&hellip;"
6 changes: 4 additions & 2 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/views/users/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading