File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,15 @@ import screenshots from "./snap-details/screenshots";
22import videos from "./snap-details/videos" ;
33import initExpandableArea from "./expandable-area" ;
44import triggerEventWhenVisible from "./ga-scroll-event" ;
5+ import initCopyCommand from "./snap-details/copyCommand" ;
56import declareGlobal from "../libs/declare" ;
7+ import { trackPageView } from "@canonical/analytics-events" ;
8+
9+ if ( window . ANALYTICS_ENDPOINT ) {
10+ trackPageView ( "snap_distro_install_page" ) ;
11+ }
12+
13+ initCopyCommand ( ) ;
614
715declareGlobal ( "snapcraft.public.distroInstall" , {
816 screenshots,
Original file line number Diff line number Diff line change 1- < div class ="p-code-snippet ">
1+ < div class ="p-code-snippet " style =" position: relative; " >
22 < pre class ="p-code-snippet__block--icon is-wrapped "> < code {% if snippet_id %}id ="snippet-{{ snippet_id }} "{% endif %} > {{ snippet_value }}</ code > </ pre >
3+ {% if snippet_id %}
4+ < button
5+ class ="p-button--base is-dense has-icon u-no-margin--bottom "
6+ title ="Copy to clipboard "
7+ data-js ="copy-install-command "
8+ data-copy-target ="snippet-{{ snippet_id }} "
9+ {% if snippet_analytics_target %}
10+ data-analytics-click
11+ data-analytics-target ="{{ snippet_analytics_target }} "
12+ {% endif %}
13+ style ="position: absolute; top: 0.5rem; right: 0.5rem; "
14+ >
15+ < i class ="p-icon--copy "> Copy to clipboard</ i >
16+ </ button >
17+ {% endif %}
318</ div >
Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ <h3>Install {{ snap_title }}</h3>
188188 lowest_risk_available,
189189 confinement) %}
190190 {% set snippet_id = "snap-install-stable" %}
191+ {% set snippet_analytics_target = "snap_distro_install_copy_install_command" %}
191192 {% include "/partials/_code-snippet.html" %}
192193 </ div >
193194 </ div >
You can’t perform that action at this time.
0 commit comments