Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add project status column to project list

Wieland Lindenthal9cd7994a305a
diff --git a/app/assets/stylesheets/content/_project_status.sass b/app/assets/stylesheets/content/_project_status.sass
index 0663834c4b7..0b965f443f6 100644
--- a/app/assets/stylesheets/content/_project_status.sass
+++ b/app/assets/stylesheets/content/_project_status.sass
@@ -39,6 +39,11 @@
border-color: $project-status-green
background-color: adjust-color($project-status-green, $alpha: -0.7)
+ &.-inline
+ height: 24px
+ width: 24px
+ border-width: 6px
+
.project-status--container
display: inline-block
diff --git a/app/helpers/project_status_helper.rb b/app/helpers/project_status_helper.rb
new file mode 100644
index 00000000000..ff19d348536
--- /dev/null
+++ b/app/helpers/project_status_helper.rb
@@ -0,0 +1,45 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is a project management system.
+# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2017 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See docs/COPYRIGHT.rdoc for more details.
+#++
+
+module ProjectStatusHelper
+ def project_status_css_class(status)
+ code = project_status_ensure_default_code(status)
+ '-' + code.gsub('_', '-')
+ end
+
+ def project_status_name(status)
+ code = project_status_ensure_default_code(status)
+ I18n.t('js.grid.widgets.project_status.' + code)
+ end
+
+ def project_status_ensure_default_code(status)
+ status.try(:code) || 'not_set'
+ end
+end
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index a5e9e6693d0..2bf248748e8 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -65,6 +65,7 @@ See docs/COPYRIGHT.rdoc for more details.
<tr>
<%= render partial: 'hierarchy_header' %>
<%= projects_sort_header_tag('name', caption: Project.human_attribute_name(:name), param: :json) %>
+ <%= projects_sort_header_tag('status', caption: Project.human_attribute_name(:status), param: :json) %>
<%= projects_sort_header_tag('public', caption: Project.human_attribute_name(:public), param: :json) %>
<% if EnterpriseToken.allows_to?(:custom_fields_in_projects_list) %>
<% @custom_fields.each do |custom_field| %>
@@ -100,6 +101,10 @@ See docs/COPYRIGHT.rdoc for more details.
<% end %>
<%= link_to_project(project, {}, {}, false) %>
</td>
+ <td>
+ <span class="project-status--bulb -inline <%= project_status_css_class(project.status) %>"></span>
+ <span class="project-status--name <%= project_status_css_class(project.status) %>"><%= project_status_name(project.status) %></span>
+ </td>
<td><%= checked_image project.public? %></td>
<% if EnterpriseToken.allows_to?(:custom_fields_in_projects_list) %>
<% @custom_fields.each do |custom_field| %>
diff --git a/frontend/src/app/modules/grids/widgets/project-status/project-status.component.sass b/frontend/src/app/modules/grids/widgets/project-status/project-status.component.sass
deleted file mode 100644
index 9cc7ca20ca7..00000000000
--- a/frontend/src/app/modules/grids/widgets/project-status/project-status.component.sass
+++ /dev/null
@@ -1,42 +0,0 @@
-$gray: #CCCCCC
-$red: #E73E3D
-$orange: #FFB030
-$green: #00D12D
-
-.bulb
- display: inline-block
- width: 40px
- height: 40px
- border-radius: 50%
- border-width: 10px
- border-style: solid
- margin-right: 7px
- vertical-align: middle
- &.-gray
- border-color: $gray
- background-color: adjust-color($gray, $alpha: -0.7)
- &.-red
- border-color: $red
- background-color: adjust-color($red, $alpha: -0.7)
- &.-orange
- border-color: $orange
- background-color: adjust-color($orange, $alpha: -0.7)
- &.-green
- border-color: $green
- background-color: adjust-color($green, $alpha: -0.7)
-
-.status-name
- text-transform: uppercase
- font-weight: bold
- &.-gray
- color: $gray
- &.-red
- color: $red
- &.-orange
- color: $orange
- &.-green
- color: $green
-
-.explanation
- margin-top: 9px
-
diff --git a/frontend/src/app/modules/grids/widgets/project-status/project-status.component.ts b/frontend/src/app/modules/grids/widgets/project-status/project-status.component.ts
index 1d42d9c231d..c37b1c50685 100644
--- a/frontend/src/app/modules/grids/widgets/project-status/project-status.component.ts
+++ b/frontend/src/app/modules/grids/widgets/project-status/project-status.component.ts
@@ -42,7 +42,6 @@ import {HalResourceEditingService} from "core-app/modules/fields/edit/services/h
@Component({
templateUrl: './project-status.component.html',
- styleUrls: ['./project-status.component.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
// required by the displayField service to render the fields