Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%=
component_wrapper(data: wrapper_data_attributes, class: "work-packages-activities-tab-journals-item-component") do
component_wrapper(class: "work-packages-activities-tab-journals-item-component") do
flex_layout(
data: {
test_selector: "op-wp-journal-entry-#{journal.id}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ def wrapper_uniq_by
journal.id
end

def wrapper_data_attributes
{
controller: "work-packages--activities-tab--item",
"work-packages--activities-tab--item-activity-url-value": activity_url(journal)
}
end

def container_classes
[].tap do |classes|
if journal.internal?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
) do |menu|
menu.with_item(
label: t("button_copy_link_to_clipboard"),
tag: :button,
content_arguments: {
data: {
action: "click->work-packages--activities-tab--item#copyActivityUrlToClipboard"
}
}
tag: :"clipboard-copy",
content_arguments: { value: activity_url(journal) }
) do |item|
item.with_leading_visual_icon(icon: :copy)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module WorkPackages
module ActivitiesTab
module Journals
class ItemComponent::Actions < ApplicationComponent
include WorkPackages::ActivitiesTab::SharedHelpers
include WorkPackages::ActivitiesTab::StimulusControllers

def initialize(journal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,20 @@ def revision_url
show_revision_project_repository_path(project_id: repository.project_id, rev: changeset.revision)
end

def absolute_revision_url
repository = changeset.repository

show_revision_project_repository_url(project_id: repository.project_id, rev: changeset.revision)
end

def short_revision
changeset.revision[0..7]
end

def copy_url_action_item(menu)
menu.with_item(label: t("button_copy_link_to_clipboard"),
tag: :button,
content_arguments: {
data: {
action: "click->work-packages--activities-tab--item#copyActivityUrlToClipboard"
}
}) do |item|
tag: :"clipboard-copy",
content_arguments: { value: absolute_revision_url }) do |item|
item.with_leading_visual_icon(icon: :copy)
end
end
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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"

RSpec.describe WorkPackages::ActivitiesTab::Journals::ItemComponent::Actions, type: :component do
shared_let(:work_package) { create(:work_package) }
shared_let(:journal) { work_package.journals.last }

current_user { create(:admin) }

before do
render_inline(described_class.new(journal))
end

it "copies the sharable activity URL through the clipboard-copy element" do
expect(page.find("clipboard-copy")["value"])
.to end_with("/projects/#{work_package.project.identifier}" \
"/work_packages/#{work_package.id}/activity#comment-#{journal.id}")
end
end
Loading