- Added `share_controller.js` to handle sharing logic. - Created `_share_social.html.erb` partial for social sharing buttons. - Integrated share buttons into city and weather art show pages. - Added sharer.js dependency. This feature allows users to share city and weather art pages on various social media platforms such as Facebook, Twitter, LinkedIn, Pinterest, Telegram, and WhatsApp, increasing content visibility.
12 lines
288 B
JavaScript
12 lines
288 B
JavaScript
// app/javascript/controllers/share_controller.js
|
|
import { Controller } from "@hotwired/stimulus"
|
|
import Sharer from "sharer.js"
|
|
|
|
export default class extends Controller {
|
|
static targets = ["button"]
|
|
|
|
connect() {
|
|
// 初始化 sharer.js
|
|
window.Sharer.init()
|
|
}
|
|
} |