@@ -9,12 +9,4 @@ module BoardsHelper
|
||||
icon_tag("settings") + tag.span("Settings for #{board.name}", class: "for-screen-reader")
|
||||
end
|
||||
end
|
||||
|
||||
def bridged_button_to_board(board)
|
||||
link_to "Go to #{board.name}", board, hidden: true, data: {
|
||||
bridge__buttons_target: "button",
|
||||
bridge_icon_url: bridge_icon("board"),
|
||||
bridge_title: "Go to #{board.name}"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,4 +2,36 @@ module BridgeHelper
|
||||
def bridge_icon(name)
|
||||
asset_url("#{name}.svg")
|
||||
end
|
||||
|
||||
def bridged_button_to_board(board)
|
||||
link_to "Go to #{board.name}", board, hidden: true, data: {
|
||||
bridge__buttons_target: "button",
|
||||
bridge_icon_url: bridge_icon("board"),
|
||||
bridge_title: "Go to #{board.name}"
|
||||
}
|
||||
end
|
||||
|
||||
def bridged_share_url_button(description = nil)
|
||||
tag.button "Share", hidden: true, data: {
|
||||
controller: "bridge--share",
|
||||
action: "bridge--share#shareUrl",
|
||||
bridge__overflow_menu_target: "item",
|
||||
bridge_title: "Share",
|
||||
bridge_share_description: description
|
||||
}
|
||||
end
|
||||
|
||||
def bridge_share_card_description(card)
|
||||
date_added = card.created_at.strftime("%b %e")
|
||||
date_updated = card.last_active_at.strftime("%b %e")
|
||||
author = card.creator.familiar_name
|
||||
assignees = card.assignees.any? ? "assigned to #{card.assignees.map { |assignee| h assignee.familiar_name }.to_sentence}" : "not assigned"
|
||||
"Added #{date_added} by #{author} and #{assignees}. Updated #{date_updated}"
|
||||
end
|
||||
|
||||
def bridge_share_board_description(board)
|
||||
count_open = board.cards.active.count
|
||||
count_in_stream = board.cards.awaiting_triage.count
|
||||
"#{count_open} open cards, #{count_in_stream} in MAYBE?"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { BridgeComponent } from "@hotwired/hotwire-native-bridge"
|
||||
|
||||
export default class extends BridgeComponent {
|
||||
static component = "share"
|
||||
|
||||
shareUrl() {
|
||||
const description = this.bridgeElement.bridgeAttribute("share-description")
|
||||
this.send("shareUrl", {
|
||||
title: document.title,
|
||||
url: window.location.href,
|
||||
description: description
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -30,3 +30,5 @@
|
||||
<%= render "boards/show/columns", page: @page, board: @board %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= bridged_share_url_button(bridge_share_board_description(@board)) %>
|
||||
|
||||
@@ -23,3 +23,5 @@
|
||||
<%= button_to_remove_card_image(@card) if @card.image.attached? %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= bridged_share_url_button(bridge_share_card_description(@card)) %>
|
||||
|
||||
Reference in New Issue
Block a user