Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhaseeb <haseebeqx@yahoo.com>2018-02-06 16:33:18 +0300
committerhaseeb <haseebeqx@yahoo.com>2018-02-28 16:18:26 +0300
commit27e8d38cea92d165a2e8400b25df23f408b4dca0 (patch)
tree0a16f63c8f380c92fb4185ca21ba8a264c572641 /app/views/shared/snippets
parent56af0631c6c6d838301ac068f2e79b8f4de9fda7 (diff)
embedded snippets support
Diffstat (limited to 'app/views/shared/snippets')
-rw-r--r--app/views/shared/snippets/_embed.html.haml23
-rw-r--r--app/views/shared/snippets/_header.html.haml21
-rw-r--r--app/views/shared/snippets/show.js.haml2
3 files changed, 46 insertions, 0 deletions
diff --git a/app/views/shared/snippets/_embed.html.haml b/app/views/shared/snippets/_embed.html.haml
new file mode 100644
index 00000000000..9a5bf4c9f04
--- /dev/null
+++ b/app/views/shared/snippets/_embed.html.haml
@@ -0,0 +1,23 @@
+- blob = @snippet.blob
+.gitlab-embed-snippets
+ .js-file-title.file-title-flex-parent
+ .file-header-content
+ = external_snippet_icon('doc_text')
+
+ %strong.file-title-name
+ = blob.name
+
+ %small
+ = number_to_human_size(blob.raw_size)
+ %a.gitlab-logo{ href: url_for(only_path: false, overwrite_params: nil) }
+ on &nbsp;
+ %span.logo-text
+ GitLab
+
+ .file-actions.hidden-xs
+ .btn-group{ role: "group" }<
+ = embedded_snippet_raw_button
+
+ = embedded_snippet_download_button
+ %article.file-holder.snippet-file-content
+ = render 'projects/blob/viewer', viewer: @snippet.blob.simple_viewer, load_async: false, external_embed: true
diff --git a/app/views/shared/snippets/_header.html.haml b/app/views/shared/snippets/_header.html.haml
index 12df79a28c7..de14356b82f 100644
--- a/app/views/shared/snippets/_header.html.haml
+++ b/app/views/shared/snippets/_header.html.haml
@@ -1,3 +1,6 @@
+- content_for :page_specific_javascripts do
+ = page_specific_javascript_bundle_tag('snippet_embed')
+
.detail-page-header
.detail-page-header-body
.snippet-box.has-tooltip.inline.append-right-5{ title: snippet_visibility_level_description(@snippet.visibility_level, @snippet), data: { container: "body" } }
@@ -27,3 +30,21 @@
= markdown_field(@snippet, :description)
%textarea.hidden.js-task-list-field
= @snippet.description
+ - if public_snippet?
+ .pull-right
+ .input-group
+ .input-group-btn
+ %button.btn.btn-default.dropdown-toggle{ 'data-toggle': 'dropdown' }
+ %span#embed-action Embed
+ = sprite_icon('angle-down', size: 16)
+ .dropdown-menu
+ %ul
+ %li
+ %a#embed-btn{ href: "#" }Embed
+ %li
+ %a#share-btn{ href: "#" }Share
+ %input#snippet-url-area.form-control{ type: "text", autocomplete: 'off', value: snippet_embed }
+ .input-group-btn
+ %a#clipboard-btn.btn.btn-default{ title: "Copy to clipboard", data: { toggle: "tooltip", placement: "bottom", title: "Copy source to clipboard", container: "body", clipboard_target: '#snippet-url-area' } }
+ = sprite_icon('duplicate', size: 16)
+ .clearfix
diff --git a/app/views/shared/snippets/show.js.haml b/app/views/shared/snippets/show.js.haml
new file mode 100644
index 00000000000..a9af732bbb5
--- /dev/null
+++ b/app/views/shared/snippets/show.js.haml
@@ -0,0 +1,2 @@
+document.write('#{escape_javascript(stylesheet_link_tag "#{stylesheet_url 'snippets'}")}');
+document.write('#{escape_javascript(render 'shared/snippets/embed')}');