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

Remove unused method

Henriette Dargea3e5b07d4140
diff --git a/app/helpers/work_packages_helper.rb b/app/helpers/work_packages_helper.rb
index eb320e18141..2d37bcad6da 100644
--- a/app/helpers/work_packages_helper.rb
+++ b/app/helpers/work_packages_helper.rb
@@ -171,20 +171,6 @@ module WorkPackagesHelper
end
end
- # Returns a string of css classes that apply to the issue
- def work_package_css_classes(work_package)
- s = "work_package op-hover-card--preview-trigger".html_safe
- s << " status-#{work_package.status.position}" if work_package.status
- s << " priority-#{work_package.priority.position}" if work_package.priority
- s << " closed" if work_package.closed?
- s << " overdue" if work_package.overdue?
- s << " child" if work_package.child?
- s << " parent" unless work_package.leaf?
- s << " created-by-me" if User.current.logged? && work_package.author_id == User.current.id
- s << " assigned-to-me" if User.current.logged? && work_package.assigned_to_id == User.current.id
- s
- end
-
def work_package_associations_to_address(associated)
ret = "".html_safe
diff --git a/spec/helpers/work_packages_helper_spec.rb b/spec/helpers/work_packages_helper_spec.rb
index a485dc669f8..5aa1b857019 100644
--- a/spec/helpers/work_packages_helper_spec.rb
+++ b/spec/helpers/work_packages_helper_spec.rb
@@ -158,122 +158,6 @@ RSpec.describe WorkPackagesHelper do
end
end
- describe "#work_package_css_classes" do
- let(:statuses) { (1..5).map { |_i| build_stubbed(:status) } }
- let(:priority) { build_stubbed(:priority, is_default: true) }
- let(:status) { statuses[0] }
- let(:stub_work_package) do
- build_stubbed(:work_package,
- status:,
- priority:)
- end
-
- it "always has the work_package class" do
- expect(helper.work_package_css_classes(stub_work_package)).to include("work_package")
- end
-
- it "returns the position of the work_package's status" do
- stub_work_package.status = open_status
- allow(open_status).to receive(:position).and_return(5)
-
- expect(helper.work_package_css_classes(stub_work_package)).to include("status-5")
- end
-
- it "returns the position of the work_package's priority" do
- allow(priority).to receive(:position).and_return(5)
-
- expect(helper.work_package_css_classes(stub_work_package)).to include("priority-5")
- end
-
- it "has a closed class if the work_package is closed" do
- allow(stub_work_package).to receive(:closed?).and_return(true)
-
- expect(helper.work_package_css_classes(stub_work_package)).to include("closed")
- end
-
- it "has no closed class if the work_package is not closed" do
- allow(stub_work_package).to receive(:closed?).and_return(false)
-
- expect(helper.work_package_css_classes(stub_work_package)).not_to include("closed")
- end
-
- it "has an overdue class if the work_package is overdue" do
- allow(stub_work_package).to receive(:overdue?).and_return(true)
-
- expect(helper.work_package_css_classes(stub_work_package)).to include("overdue")
- end
-
- it "has an overdue class if the work_package is not overdue" do
- allow(stub_work_package).to receive(:overdue?).and_return(false)
-
- expect(helper.work_package_css_classes(stub_work_package)).not_to include("overdue")
- end
-
- it "has a child class if the work_package is a child" do
- allow(stub_work_package).to receive(:child?).and_return(true)
-
- expect(helper.work_package_css_classes(stub_work_package)).to include("child")
- end
-
- it "has no child class if the work_package is not a child" do
- allow(stub_work_package).to receive(:child?).and_return(false)
-
- expect(helper.work_package_css_classes(stub_work_package)).not_to include("child")
- end
-
- it "has a parent class if the work_package is a parent" do
- allow(stub_work_package).to receive(:leaf?).and_return(false)
-
- expect(helper.work_package_css_classes(stub_work_package)).to include("parent")
- end
-
- it "has no parent class if the work_package is not a parent" do
- allow(stub_work_package).to receive(:leaf?).and_return(true)
-
- expect(helper.work_package_css_classes(stub_work_package)).not_to include("parent")
- end
-
- it "has a created-by-me class if the work_package is a created by the current user" do
- stub_user = double("user", logged?: true, id: 5)
- allow(User).to receive(:current).and_return(stub_user)
- allow(stub_work_package).to receive(:author_id).and_return(5)
-
- expect(helper.work_package_css_classes(stub_work_package)).to include("created-by-me")
- end
-
- it "has no created-by-me class if the work_package is not created by the current user" do
- stub_user = double("user", logged?: true, id: 5)
- allow(User).to receive(:current).and_return(stub_user)
- allow(stub_work_package).to receive(:author_id).and_return(4)
-
- expect(helper.work_package_css_classes(stub_work_package)).not_to include("created-by-me")
- end
-
- it "has a created-by-me class if the work_package is the current user is not logged in" do
- expect(helper.work_package_css_classes(stub_work_package)).not_to include("created-by-me")
- end
-
- it "has a assigned-to-me class if the work_package is a created by the current user" do
- stub_user = double("user", logged?: true, id: 5)
- allow(User).to receive(:current).and_return(stub_user)
- allow(stub_work_package).to receive(:assigned_to_id).and_return(5)
-
- expect(helper.work_package_css_classes(stub_work_package)).to include("assigned-to-me")
- end
-
- it "has no assigned-to-me class if the work_package is not created by the current user" do
- stub_user = double("user", logged?: true, id: 5)
- allow(User).to receive(:current).and_return(stub_user)
- allow(stub_work_package).to receive(:assigned_to_id).and_return(4)
-
- expect(helper.work_package_css_classes(stub_work_package)).not_to include("assigned-to-me")
- end
-
- it "has no assigned-to-me class if the work_package is the current user is not logged in" do
- expect(helper.work_package_css_classes(stub_work_package)).not_to include("assigned-to-me")
- end
- end
-
describe "#work_packages_columns_options" do
it "returns the columns options" do
expect(helper.work_packages_columns_options)