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

1.8 KB
Raw Blame
<%=
  render Primer::OpenProject::PageHeader.new do |header|
    header.with_title { @topic.subject }
    header.with_breadcrumbs(breadcrumb_items)

    watcher_action_button(header, @topic)

    if !@topic.locked? && authorize_for("messages", "reply")
      header.with_action_button(
        tag: :a,
        scheme: :default,
        mobile_icon: :quote,
        mobile_label: t(:button_quote),
        size: :medium,
        href: url_for({ action: "quote", id: @topic }),
        aria: { label: I18n.t(:button_delete) },
        data: { action: "forum-messages#quote", test_selector: "message-quote-button" },
        title: t(:button_quote)
      ) do |button|
        button.with_leading_visual_icon(icon: :quote)
        t(:button_quote)
      end
    end

    if @message.editable_by?(User.current)
      header.with_action_button(
        tag: :a,
        scheme: :default,
        mobile_icon: :pencil,
        mobile_label: t(:button_edit),
        size: :medium,
        href: edit_topic_path(@topic),
        aria: { label: t(:button_edit) },
        data: { test_selector: "message-edit-button" },
        title: t(:button_edit)
      ) do |button|
        button.with_leading_visual_icon(icon: :pencil)
        t(:button_edit)
      end
    end

    if @message.destroyable_by?(User.current)
      header.with_action_button(
        tag: :a,
        scheme: :danger,
        mobile_icon: :trash,
        mobile_label: t(:button_delete),
        size: :medium,
        href: topic_path(@topic),
        aria: { label: I18n.t(:button_delete) },
        data: {
          turbo_confirm: I18n.t(:text_are_you_sure),
          turbo_method: :delete
        },
        title: I18n.t(:button_delete)
      ) do |button|
        button.with_leading_visual_icon(icon: :trash)
        t(:button_delete)
      end
    end
  end
%>