Skip to content

Commit

Permalink
Some styling
Browse files Browse the repository at this point in the history
  • Loading branch information
tmuerell committed Sep 19, 2023
1 parent f09aaf6 commit 7caf398
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize(user)
can %i[read select], Project, user_project_roles: { user_id: user.id, role: ['guest', :guest, 'admin', :admin, 'user', :user, 'reporter', :reporter]}
can [:read, :inbox, :watch, :unwatch, :transitions], Ticket, project: { user_project_roles: { user_id: user.id, role: ['guest', :guest, 'admin', :admin, 'user', :user, 'reporter', :reporter]}}
can [:create, :backlog], Ticket
can [:update, :tag, :mine, :link, :unassign], Ticket, project: { user_project_roles: { user_id: user.id, role: ['admin', :admin, 'user', :user, 'reporter', :reporter]}}
can [:update, :tag, :mine, :link, :unassign], Ticket, project: { user_project_roles: { user_id: user.id, role: ['admin', :admin, 'user', :user]}}
can :manage, Tag, project: { user_project_roles: { user_id: user.id, role: ['admin', :admin]}}
can :manage, TagGroup, project: { user_project_roles: { user_id: user.id, role: ['admin', :admin]}}
can :create, Tag
Expand All @@ -33,10 +33,10 @@ def initialize(user)
can %i[create read], Comment, ticket: { project: { user_project_roles: { user_id: user.id, role: ['admin', :admin, 'user', :user]}} }
can %i[read], Comment, ticket: { project: { user_project_roles: { user_id: user.id, role: ['admin', :admin, 'user', :user, 'reporter', :reporter]}} }

can %i[read edit], Ticket, creator_id: user.id
can %i[read update], Ticket, creator_id: user.id
can %i[create read], Comment, ticket: { creator_id: user.id }

can %i[read edit], Ticket, assignee_id: user.id
can %i[read update], Ticket, assignee_id: user.id
can %i[create read], Comment, ticket: { assignee_id: user.id }
end
end
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ class User < ApplicationRecord

before_create :set_default_user_groups

has_many :ticket_user_relationships

if ENV['PLATO_OPENID_CONNECT_ENABLE'] == 'true'
devise :omniauthable, omniauth_providers: [ENV['PLATO_OPENID_CONNECT_NAME'].to_sym]

Expand Down Expand Up @@ -37,6 +35,8 @@ def self.from_omniauth(auth)

belongs_to :current_project, class_name: 'Project', optional: true
has_many :user_project_roles
has_many :ticket_user_relationships

serialize :roles, JSON
serialize :groups, JSON
gravtastic
Expand Down
40 changes: 38 additions & 2 deletions app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>Ticket</th>
<th>Status</th>
<th style="width: 8em;">Ticket</th>
<th>Title</th>
<th style="width: 8em;">Status</th>
<th style="width: 1em;"></th>
</tr>
</thead>
<tbody>
Expand All @@ -20,7 +22,9 @@
data-uri="<%= ticket_url(ticket) %>"
>
<td><%= link_to ticket.identifier, ticket %></td>
<td><%= truncate(ticket.title) %></td>
<td><%= status_label(ticket) %></td>
<td><%= gravatar_icon(ticket.assignee, [], 20) if ticket.assignee.present? %></td>
</tr>
<% end %>
</tbody>
Expand All @@ -30,6 +34,38 @@
<% end %>
</div>
</div>
<div class="m-2 card">
<div class="card-body">
<h5><%= t('.open_tickets') %></h5>

<% if current_project.tickets.where.not(status: current_project.end_states).count > 0 %>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th style="width: 8em;">Ticket</th>
<th>Title</th>
<th style="width: 8em;">Status</th>
<th style="width: 1em;"></th>
</tr>
</thead>
<tbody>
<% for ticket in current_project.tickets.where.not(status: current_project.end_states).order("created_at DESC").limit(10) %>
<tr class="selectable"
data-uri="<%= ticket_url(ticket) %>"
>
<td><%= link_to ticket.identifier, ticket %></td>
<td><%= truncate(ticket.title) %></td>
<td><%= status_label(ticket) %></td>
<td><%= gravatar_icon(ticket.assignee, [], 20) if ticket.assignee.present? %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<%= t '.no_tickets_to_show' %>
<% end %>
</div>
</div>
</div>
<div class="col-lg-4 col-6">
<div class="m-2 card">
Expand Down
24 changes: 18 additions & 6 deletions app/views/dashboard/profile.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
<h3 class="card-title"><%= current_user.name %></h3>
<h5 class="card-subtitle text-muted"><%= current_user.email %></h5>

<p class="mt-3">User roles:</p>
<% if current_user.roles.present? %>
<p class="mt-3">User roles:</p>

<ul>
<% for g in current_user.roles %>
<li><%= g %></li>
<% end %>
</ul>
<ul>
<% for g in current_user.roles %>
<li><%= g %></li>
<% end %>
</ul>
<% end %>
<% if current_user.groups.present? %>
<p class="mt-3">User groups:</p>
Expand All @@ -22,6 +24,16 @@
<% end %>
</ul>
<% end %>
<% if current_user.user_project_roles.count > 0 %>
<p class="mt-3">User project roles:</p>

<ul>
<% for upr in current_user.user_project_roles %>
<li><%= upr.project.name %>: <%= upr.role_text %></li>
<% end %>
</ul>
<% end %>
</div>
</div>

Expand Down
2 changes: 2 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ de:
no_tickets_yet: "Sie haben noch keine Tickets angelegt."
create_new_request: "Neue Anfrage erstellen"
create_new_request_text: "Hier können Sie eine neue Anfrage erstellen."
open_tickets: "Offene Tickets"
no_tickets_to_show: "Es gibt keine Tickets anzuzeigen."
projects:
index:
no_projects: "Sie haben keine Berechtigungen auf Projekte. Bitte lassen Sie sich entsprechende Rechte zuweisen."
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ en:
no_tickets_yet: "You didn't create any tickets yet."
create_new_request: "Create a new ticket"
create_new_request_text: "Here you can create a new support request by specifying the necessary details."
open_tickets: "Open tickets"
no_tickets_to_show: "There are no tickets to show."
projects:
index:
no_projects: "You don't have access to a project. Please have some access granted first."

0 comments on commit 7caf398

Please sign in to comment.