Skip to content

Commit 1b9fa6e

Browse files
authored
Merge pull request #4 from akpaevj/feature-add-date-and-badge
date and project badge are added in the issue card
2 parents 184d612 + ee6ab7f commit 1b9fa6e

File tree

7 files changed

+46
-8
lines changed

7 files changed

+46
-8
lines changed

app/controllers/dashboard_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def getProjects(selected_project_id = -1)
3030
projects.push({
3131
"id" => project.id,
3232
"name" => project.name,
33+
"color" => Setting.plugin_dashboard["project_color_" + project.id.to_s],
3334
"selected" => selected
3435
})
3536
end
@@ -52,6 +53,9 @@ def getData(project_id = -1)
5253
"id" => issue.id,
5354
"subject" => issue.subject,
5455
"status_id" => issue.status.id,
56+
"project" => issue.project.name,
57+
"project_id" => issue.project.id,
58+
"created_at" => issue.start_date,
5559
"author" => issue.author.name(User::USER_FORMATS[:firstname_lastname]),
5660
"executor" => executor
5761
})

app/views/dashboard/index.html.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
<div class="status_column_issues">
2222
<% status["issues"].each do |issue| %>
2323
<div draggable="true" class="issue_card" data-status="<%= status['id'] %>" data-id="<%= issue['id'] %>" onclick="goToIssue(<%= issue['id'] %>)">
24+
<div class="issue_card_header">
25+
<span class="issue_card_header_date"><%= issue["created_at"] %></span>
26+
<div class="issue_card_header_project" style="background-color: <%= @projects[issue['project_id']]['color'] %>"><%= issue["project"] %></div>
27+
</div>
2428
<span class="issue_card_title"> <%= issue["subject"] %> </span>
2529
<span class="issue_card_author"><i class="bi bi-person"></i> <%= issue["author"] %> </span>
2630
<% if issue["executor"] == '' || issue["executor"].nil? %>
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<table>
2-
<thead>
3-
<tr>
4-
<th colspan="2"> <%=l :settings_header %> </td>
5-
</tr>
6-
</thead>
72
<tbody>
3+
<tr>
4+
<th colspan="2"> <%=l :settings_header_statuses %> </td>
5+
</tr>
86
<% IssueStatus.sorted().each do |status| %>
97
<% if !status.is_closed %>
108
<% property_name = "status_color_" + status.id.to_s %>
@@ -15,6 +13,18 @@
1513
</td>
1614
</tr>
1715
<% end %>
16+
<% end %>
17+
<tr>
18+
<th colspan="2"> <%=l :settings_header_projects %> </td>
19+
</tr>
20+
<% Project.all.each do |project| %>
21+
<% property_name = "project_color_" + project.id.to_s %>
22+
<tr>
23+
<td> <%= project.name %> </th>
24+
<td>
25+
<input type="color" id="settings_<%= property_name %>" value="<%= settings[property_name] %>" name="settings[<%= property_name %>]">
26+
</td>
27+
</tr>
1828
<% end %>
1929
</tbody>
2030
</table>

assets/stylesheets/style.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,22 @@
9797

9898
.select_project {
9999
margin-left: 10px;
100+
}
101+
102+
.issue_card_header {
103+
display: flex;
104+
padding-top: 5px;
105+
align-items: center;
106+
width: 100%;
107+
}
108+
109+
.issue_card_header_project {
110+
margin-left: auto;
111+
padding-top: 5px;
112+
padding-bottom: 5px;
113+
padding-left: 8px;
114+
padding-right: 8px;
115+
margin-right: 10px;
116+
border-radius: 15px;
117+
color: white;
100118
}

config/locales/en.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
en:
22
top_menu_item_title: "Dashboard"
3-
settings_header: "Colors of the status column header"
3+
settings_header_statuses: "Colors of the status column header"
4+
settings_header_projects: "Project colors"
45
executor_not_set: "Not set"
56
label_all: "All"

config/locales/ru.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ru:
22
top_menu_item_title: "Панель задач"
3-
settings_header: "Цвета заголовков колонок статусов"
3+
settings_header_statuses: "Цвета заголовков колонок статусов"
4+
settings_header_projects: "Цвета проектов"
45
executor_not_set: "Не установлен"
56
label_all: "Все"

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name 'Dashboard'
33
author "Akpaev E.A."
44
description "Plugin adds an issues dashboard to the application"
5-
version '1.0.3'
5+
version '1.0.4'
66
url 'https://github.com/akpaevj/Dashboard'
77
author_url 'https://github.com/akpaevj'
88
menu :top_menu, :dashboard, { controller: 'dashboard', action: 'index' }, caption: :top_menu_item_title, first: true

0 commit comments

Comments
 (0)