From 101c37085f5342189b64a04f19c742cbd91e01f4 Mon Sep 17 00:00:00 2001 From: haseeb Date: Wed, 7 Mar 2018 18:36:16 +0530 Subject: [PATCH] changes based on review --- app/assets/javascripts/snippet/snippet_embed.js | 8 ++++---- app/assets/stylesheets/snippets.scss | 6 +++--- app/helpers/snippets_helper.rb | 2 +- app/views/shared/snippets/_header.html.haml | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/snippet/snippet_embed.js b/app/assets/javascripts/snippet/snippet_embed.js index 700247cfdb3..81ec483f2d9 100644 --- a/app/assets/javascripts/snippet/snippet_embed.js +++ b/app/assets/javascripts/snippet/snippet_embed.js @@ -1,9 +1,9 @@ export default () => { const { protocol, host, pathname } = location; - const shareBtn = document.querySelector('#share-btn'); - const embedBtn = document.querySelector('#embed-btn'); - const snippetUrlArea = document.querySelector('#snippet-url-area'); - const embedAction = document.querySelector('#embed-action'); + const shareBtn = document.querySelector('.js-share-btn'); + const embedBtn = document.querySelector('.js-embed-btn'); + const snippetUrlArea = document.querySelector('.js-snippet-url-area'); + const embedAction = document.querySelector('.js-embed-action'); const url = `${protocol}//${host + pathname}`; shareBtn.addEventListener('click', () => { diff --git a/app/assets/stylesheets/snippets.scss b/app/assets/stylesheets/snippets.scss index 14e6b5a1e1e..0d6b0735f70 100644 --- a/app/assets/stylesheets/snippets.scss +++ b/app/assets/stylesheets/snippets.scss @@ -22,9 +22,9 @@ height: 16px; background-size: cover; - &.gl-snippet-icon-doc_code { background-position: -0 -0; } - &.gl-snippet-icon-doc_text { background-position: -0 -16px; } - &.gl-snippet-icon-download { background-position: -0 -32px; } + &.gl-snippet-icon-doc_code { background-position: 0 0; } + &.gl-snippet-icon-doc_text { background-position: 0 -16px; } + &.gl-snippet-icon-download { background-position: 0 -32px; } } .blob-viewer { diff --git a/app/helpers/snippets_helper.rb b/app/helpers/snippets_helper.rb index 830db46d67f..59e0d192ffa 100644 --- a/app/helpers/snippets_helper.rb +++ b/app/helpers/snippets_helper.rb @@ -116,7 +116,7 @@ module SnippetsHelper raw_project_snippet_url(@snippet.project, @snippet) end - link_to external_snippet_icon('doc_code'), snippet_raw_url, class: 'btn', target: '_blank', rel: 'noopener noreferrer', title: 'Open raw', data: { container: 'body' } + link_to external_snippet_icon('doc_code'), snippet_raw_url, class: 'btn', target: '_blank', rel: 'noopener noreferrer', title: 'Open raw' end def embedded_snippet_download_button diff --git a/app/views/shared/snippets/_header.html.haml b/app/views/shared/snippets/_header.html.haml index 43567bae619..836230ae8ee 100644 --- a/app/views/shared/snippets/_header.html.haml +++ b/app/views/shared/snippets/_header.html.haml @@ -34,17 +34,17 @@ .input-group .input-group-btn %button.btn.embed-toggle{ 'data-toggle': 'dropdown', type: 'button' } - %span#embed-action= _("Embed") + %span.js-embed-action= _("Embed") = sprite_icon('angle-down', size: 12) %ul.dropdown-menu.dropdown-menu-selectable.embed-toggle-list %li - %button#embed-btn.btn.btn-transparent.is-active{ type: 'button' } + %button.js-embed-btn.btn.btn-transparent.is-active{ type: 'button' } %strong.embed-toggle-list-item= _("Embed") %li - %button#share-btn.btn.btn-transparent{ type: 'button' } + %button.js-share-btn.btn.btn-transparent{ type: 'button' } %strong.embed-toggle-list-item= _("Share") - %input#snippet-url-area.snippet-embed-input.form-control{ type: "text", autocomplete: 'off', value: snippet_embed } + %input.js-snippet-url-area.snippet-embed-input.form-control{ type: "text", autocomplete: 'off', value: snippet_embed } .input-group-btn - %button#clipboard-btn.btn.btn-default{ title: "Copy to clipboard", type: "button", data: { toggle: "tooltip", placement: "bottom", title: "Copy source to clipboard", container: "body", clipboard_target: '#snippet-url-area' } } + %button.js-clipboard-btn.btn.btn-default.has-tooltip{ title: "Copy to clipboard", 'data-clipboard-target': '#snippet-url-area' } = sprite_icon('duplicate', size: 16) .clearfix