Skip to content

Commit

Permalink
Merge pull request #4 from akpaevj/feature-add-date-and-badge
Browse files Browse the repository at this point in the history
date and project badge are added in the issue card
  • Loading branch information
akpaevj authored May 17, 2021
2 parents 184d612 + ee6ab7f commit 1b9fa6e
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 8 deletions.
4 changes: 4 additions & 0 deletions app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def getProjects(selected_project_id = -1)
projects.push({
"id" => project.id,
"name" => project.name,
"color" => Setting.plugin_dashboard["project_color_" + project.id.to_s],
"selected" => selected
})
end
Expand All @@ -52,6 +53,9 @@ def getData(project_id = -1)
"id" => issue.id,
"subject" => issue.subject,
"status_id" => issue.status.id,
"project" => issue.project.name,
"project_id" => issue.project.id,
"created_at" => issue.start_date,
"author" => issue.author.name(User::USER_FORMATS[:firstname_lastname]),
"executor" => executor
})
Expand Down
4 changes: 4 additions & 0 deletions app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
<div class="status_column_issues">
<% status["issues"].each do |issue| %>
<div draggable="true" class="issue_card" data-status="<%= status['id'] %>" data-id="<%= issue['id'] %>" onclick="goToIssue(<%= issue['id'] %>)">
<div class="issue_card_header">
<span class="issue_card_header_date"><%= issue["created_at"] %></span>
<div class="issue_card_header_project" style="background-color: <%= @projects[issue['project_id']]['color'] %>"><%= issue["project"] %></div>
</div>
<span class="issue_card_title"> <%= issue["subject"] %> </span>
<span class="issue_card_author"><i class="bi bi-person"></i> <%= issue["author"] %> </span>
<% if issue["executor"] == '' || issue["executor"].nil? %>
Expand Down
20 changes: 15 additions & 5 deletions app/views/settings/_dashboard_settings.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<table>
<thead>
<tr>
<th colspan="2"> <%=l :settings_header %> </td>
</tr>
</thead>
<tbody>
<tr>
<th colspan="2"> <%=l :settings_header_statuses %> </td>
</tr>
<% IssueStatus.sorted().each do |status| %>
<% if !status.is_closed %>
<% property_name = "status_color_" + status.id.to_s %>
Expand All @@ -15,6 +13,18 @@
</td>
</tr>
<% end %>
<% end %>
<tr>
<th colspan="2"> <%=l :settings_header_projects %> </td>
</tr>
<% Project.all.each do |project| %>
<% property_name = "project_color_" + project.id.to_s %>
<tr>
<td> <%= project.name %> </th>
<td>
<input type="color" id="settings_<%= property_name %>" value="<%= settings[property_name] %>" name="settings[<%= property_name %>]">
</td>
</tr>
<% end %>
</tbody>
</table>
18 changes: 18 additions & 0 deletions assets/stylesheets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,22 @@

.select_project {
margin-left: 10px;
}

.issue_card_header {
display: flex;
padding-top: 5px;
align-items: center;
width: 100%;
}

.issue_card_header_project {
margin-left: auto;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 8px;
padding-right: 8px;
margin-right: 10px;
border-radius: 15px;
color: white;
}
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
en:
top_menu_item_title: "Dashboard"
settings_header: "Colors of the status column header"
settings_header_statuses: "Colors of the status column header"
settings_header_projects: "Project colors"
executor_not_set: "Not set"
label_all: "All"
3 changes: 2 additions & 1 deletion config/locales/ru.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ru:
top_menu_item_title: "Панель задач"
settings_header: "Цвета заголовков колонок статусов"
settings_header_statuses: "Цвета заголовков колонок статусов"
settings_header_projects: "Цвета проектов"
executor_not_set: "Не установлен"
label_all: "Все"
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name 'Dashboard'
author "Akpaev E.A."
description "Plugin adds an issues dashboard to the application"
version '1.0.3'
version '1.0.4'
url 'https://github.com/akpaevj/Dashboard'
author_url 'https://github.com/akpaevj'
menu :top_menu, :dashboard, { controller: 'dashboard', action: 'index' }, caption: :top_menu_item_title, first: true
Expand Down

0 comments on commit 1b9fa6e

Please sign in to comment.