Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
9bac5c4a
Commit
9bac5c4a
authored
Mar 03, 2018
by
haseeb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery and webpack changed
parent
a6635fb6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
24 deletions
+26
-24
app/assets/javascripts/pages/projects/snippets/show/index.js
app/assets/javascripts/pages/projects/snippets/show/index.js
+2
-0
app/assets/javascripts/pages/snippets/show/index.js
app/assets/javascripts/pages/snippets/show/index.js
+2
-0
app/assets/javascripts/snippet/snippet_embed.js
app/assets/javascripts/snippet/snippet_embed.js
+21
-19
app/views/shared/snippets/_header.html.haml
app/views/shared/snippets/_header.html.haml
+1
-4
config/webpack.config.js
config/webpack.config.js
+0
-1
No files found.
app/assets/javascripts/pages/projects/snippets/show/index.js
View file @
9bac5c4a
...
@@ -2,10 +2,12 @@ import initNotes from '~/init_notes';
...
@@ -2,10 +2,12 @@ import initNotes from '~/init_notes';
import
ZenMode
from
'
~/zen_mode
'
;
import
ZenMode
from
'
~/zen_mode
'
;
import
LineHighlighter
from
'
../../../../line_highlighter
'
;
import
LineHighlighter
from
'
../../../../line_highlighter
'
;
import
BlobViewer
from
'
../../../../blob/viewer
'
;
import
BlobViewer
from
'
../../../../blob/viewer
'
;
import
snippetEmbed
from
'
../../../../snippet/snippet_embed
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
new
LineHighlighter
();
// eslint-disable-line no-new
new
LineHighlighter
();
// eslint-disable-line no-new
new
BlobViewer
();
// eslint-disable-line no-new
new
BlobViewer
();
// eslint-disable-line no-new
initNotes
();
initNotes
();
new
ZenMode
();
// eslint-disable-line no-new
new
ZenMode
();
// eslint-disable-line no-new
snippetEmbed
();
});
});
app/assets/javascripts/pages/snippets/show/index.js
View file @
9bac5c4a
...
@@ -2,10 +2,12 @@ import LineHighlighter from '../../../line_highlighter';
...
@@ -2,10 +2,12 @@ import LineHighlighter from '../../../line_highlighter';
import
BlobViewer
from
'
../../../blob/viewer
'
;
import
BlobViewer
from
'
../../../blob/viewer
'
;
import
ZenMode
from
'
../../../zen_mode
'
;
import
ZenMode
from
'
../../../zen_mode
'
;
import
initNotes
from
'
../../../init_notes
'
;
import
initNotes
from
'
../../../init_notes
'
;
import
snippetEmbed
from
'
../../../snippet/snippet_embed
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
new
LineHighlighter
();
// eslint-disable-line no-new
new
LineHighlighter
();
// eslint-disable-line no-new
new
BlobViewer
();
// eslint-disable-line no-new
new
BlobViewer
();
// eslint-disable-line no-new
initNotes
();
initNotes
();
new
ZenMode
();
// eslint-disable-line no-new
new
ZenMode
();
// eslint-disable-line no-new
snippetEmbed
();
});
});
app/assets/javascripts/snippet/snippet_embed.js
View file @
9bac5c4a
(()
=>
{
export
default
()
=>
{
$
(()
=>
{
const
{
protocol
,
host
,
pathname
}
=
location
;
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
'
);
$
(
'
#share-btn
'
).
click
(
(
event
)
=>
{
shareBtn
.
addEventListener
(
'
click
'
,
(
event
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
$
(
'
#share-btn
'
).
addClass
(
'
is-active
'
);
shareBtn
.
classList
.
add
(
'
is-active
'
);
$
(
'
#embed-btn
'
).
removeClass
(
'
is-active
'
);
embedBtn
.
classList
.
remove
(
'
is-active
'
);
$
(
'
#snippet-url-area
'
).
val
(
`
${
protocol
}
//
${
host
+
pathname
}
`
)
;
snippetUrlArea
.
value
=
`
${
protocol
}
//
${
host
+
pathname
}
`
;
$
(
'
#embed-action
'
).
html
(
'
Share
'
)
;
embedAction
.
innerHTML
=
'
Share
'
;
});
});
$
(
'
#embed-btn
'
).
click
((
event
)
=>
{
embedBtn
.
addEventListener
(
'
click
'
,
(
event
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
$
(
'
#embed-btn
'
).
addClass
(
'
is-active
'
);
embedBtn
.
classList
.
add
(
'
is-active
'
);
$
(
'
#share-btn
'
).
removeClass
(
'
is-active
'
);
shareBtn
.
classList
.
remove
(
'
is-active
'
);
const
scriptTag
=
`<script src="
${
protocol
}
//
${
host
+
pathname
}
.js"></script>`
;
const
scriptTag
=
`<script src="
${
protocol
}
//
${
host
+
pathname
}
.js"></script>`
;
$
(
'
#snippet-url-area
'
).
val
(
scriptTag
);
snippetUrlArea
.
value
=
scriptTag
;
$
(
'
#embed-action
'
).
html
(
'
Embed
'
);
embedAction
.
innerHTML
=
'
Embed
'
;
});
});
});
}
).
call
(
window
)
;
};
app/views/shared/snippets/_header.html.haml
View file @
9bac5c4a
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_bundle_tag
(
'snippet_embed'
)
.detail-page-header
.detail-page-header
.detail-page-header-body
.detail-page-header-body
.snippet-box.has-tooltip.inline.append-right-5
{
title:
snippet_visibility_level_description
(
@snippet
.
visibility_level
,
@snippet
),
data:
{
container:
"body"
}
}
.snippet-box.has-tooltip.inline.append-right-5
{
title:
snippet_visibility_level_description
(
@snippet
.
visibility_level
,
@snippet
),
data:
{
container:
"body"
}
}
...
@@ -36,7 +33,7 @@
...
@@ -36,7 +33,7 @@
.embed-snippet
.embed-snippet
.input-group
.input-group
.input-group-btn
.input-group-btn
%
a
.btn.embed-toggle
{
'data-toggle'
:
'dropdown'
}
%
button
.btn.embed-toggle
{
'data-toggle'
:
'dropdown'
}
%span
#embed-action
Embed
%span
#embed-action
Embed
=
sprite_icon
(
'angle-down'
,
size:
12
)
=
sprite_icon
(
'angle-down'
,
size:
12
)
%ul
.dropdown-menu.dropdown-menu-selectable.embed-toggle-list
%ul
.dropdown-menu.dropdown-menu-selectable.embed-toggle-list
...
...
config/webpack.config.js
View file @
9bac5c4a
...
@@ -57,7 +57,6 @@ function generateEntries() {
...
@@ -57,7 +57,6 @@ function generateEntries() {
protected_branches
:
'
./protected_branches
'
,
protected_branches
:
'
./protected_branches
'
,
protected_tags
:
'
./protected_tags
'
,
protected_tags
:
'
./protected_tags
'
,
registry_list
:
'
./registry/index.js
'
,
registry_list
:
'
./registry/index.js
'
,
snippet_embed
:
'
./snippet/snippet_embed.js
'
,
sketch_viewer
:
'
./blob/sketch_viewer.js
'
,
sketch_viewer
:
'
./blob/sketch_viewer.js
'
,
stl_viewer
:
'
./blob/stl_viewer.js
'
,
stl_viewer
:
'
./blob/stl_viewer.js
'
,
terminal
:
'
./terminal/terminal_bundle.js
'
,
terminal
:
'
./terminal/terminal_bundle.js
'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment