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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Remove current partial
Oliver Günther28434f7cc96e
diff --git a/app/views/enterprise_tokens/_current.html.erb b/app/views/enterprise_tokens/_current.html.erbdeleted file mode 100644index 92680f74f30..00000000000--- a/app/views/enterprise_tokens/_current.html.erb+++ /dev/null@@ -1,29 +0,0 @@-<opce-enterprise-active-saved-trial- data-subscriber="<%= @current_token.subscriber %>"- data-email="<%= @current_token.mail %>"- data-company="<%= @current_token.try(:company) %>"- data-domain="<%= @current_token.try(:domain) %>"- data-plan="<%= enterprise_token_plan_name(@current_token) %>"- data-user-count="<%= @current_token.restrictions.nil? ? t("js.admin.enterprise.upsell.unlimited") : @current_token.restrictions[:active_user_count] %>"- data-starts-at="<%= format_date @current_token.starts_at %>"- data-expires-at="<%= @current_token.will_expire? ? (format_date @current_token.expires_at) : t("js.admin.enterprise.upsell.unlimited") %>"- data-is-expired="<%= @current_token.expired?(reprieve: false) %>"- data-additional-features="<%= enterprise_plan_additional_features(@current_token) %>"- data-reprieve-days-left="<%= @current_token.reprieve_days_left %>">-</opce-enterprise-active-saved-trial>--<%= form_tag(- enterprise_token_path(@current_token),- method: :delete,- data: augmented_confirmation_dialog(- danger_zone: true,- text: t("admin.enterprise.delete_token_modal.text"),- title: t("admin.enterprise.delete_token_modal.title"),- button_continue: t(:button_delete),- icon_continue: "delete"- )- ) do %>- <%= styled_button_tag t(:button_delete),- method: :delete,- class: "-with-icon icon-delete" %>-<% end %>diff --git a/app/views/enterprise_tokens/index.html.erb b/app/views/enterprise_tokens/index.html.erbindex 3cd9d0358fa..322d5f3db1c 100644--- a/app/views/enterprise_tokens/index.html.erb+++ b/app/views/enterprise_tokens/index.html.erb@@ -35,7 +35,6 @@<% if EnterpriseToken.all_tokens.any? %><%= render Admin::EnterpriseTokens::TableComponent.new(rows: EnterpriseToken.all_tokens) %>- <%= render partial: "current" if @current_token.present? %><% else %><%= render partial: "info" %><% end %>diff --git a/spec/views/admin/enterprises/_current.html.erb_spec.rb b/spec/views/admin/enterprises/_current.html.erb_spec.rbdeleted file mode 100644index dc0565220e2..00000000000--- a/spec/views/admin/enterprises/_current.html.erb_spec.rb+++ /dev/null@@ -1,89 +0,0 @@-# frozen_string_literal: true--#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) the OpenProject GmbH-#-# 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-2013 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 COPYRIGHT and LICENSE files for more details.-#++--require "spec_helper"--# TODO: delete this file once the partial "current" is removed-RSpec.describe "enterprise_tokens/current" do- let(:current_user) { create(:admin) }- let(:ee_token) { "v1_expired_with_7_days_reprieve_at_2021_09_01.token" }- let(:current_time) { DateTime.now }-- before do- allow(User).to receive(:current).and_return current_user-- encoded = Rails.root.join("spec/fixtures/ee_tokens/#{ee_token}").read- token = EnterpriseToken.new(id: 42, encoded_token: encoded)-- assign :current_token, token-- Timecop.travel(current_date) do- render partial: "enterprise_tokens/current"- end- end-- context "with token still valid" do- let(:current_date) { "2021-08-28".to_datetime }-- it "renders the token as not expired and with no reprieve days" do- expect(rendered.to_s).to include 'data-is-expired="false"'- expect(rendered.to_s).to include 'data-reprieve-days-left=""'- end- end-- context "with token just expired (within grace period)" do- let(:current_date) { "2021-09-02".to_datetime }-- it "renders the token as expired and with 6 reprieve days" do- expect(rendered.to_s).to include 'data-is-expired="true"'- expect(rendered.to_s).to include 'data-reprieve-days-left="6"'- end- end-- context "with token expired past reprieve" do- let(:current_date) { "2021-09-08".to_datetime }-- it "renders the token as expired and with 0 reprieve days" do- expect(rendered.to_s).to include 'data-is-expired="true"'- expect(rendered.to_s).to include 'data-reprieve-days-left="0"'- end- end-- context "with token expired and no reprieve" do- let(:ee_token) { "v1_expired_without_reprieve_at_2021_09_01.token" }-- let(:current_date) { "2021-09-08".to_datetime }-- it "renders the token as expired and with no reprieve days" do- expect(rendered.to_s).to include 'data-is-expired="true"'- expect(rendered.to_s).to include 'data-reprieve-days-left=""'- end- end-end