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
Jérome Perrin
gitlab-ce
Commits
7371f6cd
Commit
7371f6cd
authored
Mar 01, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor common bundle to ES module syntax and move global exports to application.js
parent
cb6c036d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
32 deletions
+49
-32
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+22
-10
app/assets/javascripts/commons/bootstrap.js
app/assets/javascripts/commons/bootstrap.js
+9
-9
app/assets/javascripts/commons/index.js
app/assets/javascripts/commons/index.js
+2
-2
app/assets/javascripts/commons/jquery.js
app/assets/javascripts/commons/jquery.js
+10
-11
config/webpack.config.js
config/webpack.config.js
+6
-0
No files found.
app/assets/javascripts/application.js
View file @
7371f6cd
...
...
@@ -6,14 +6,29 @@
/* global AwardsHandler */
/* global Aside */
// common libraries
window
.
Cookies
=
require
(
'
js-cookie
'
);
window
.
Pikaday
=
require
(
'
pikaday
'
);
window
.
_
=
require
(
'
underscore
'
);
window
.
Dropzone
=
require
(
'
dropzone
'
);
window
.
Sortable
=
require
(
'
vendor/Sortable
'
);
import
jQuery
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
Cookies
from
'
js-cookie
'
;
import
Pikaday
from
'
pikaday
'
;
import
Dropzone
from
'
dropzone
'
;
import
Sortable
from
'
vendor/Sortable
'
;
// libraries with import side-effects
require
(
'
mousetrap
'
);
require
(
'
mousetrap/plugins/pause/mousetrap-pause
'
);
require
(
'
vendor/fuzzaldrin-plus
'
);
require
(
'
es6-promise
'
).
polyfill
();
// expose common libraries as globals (TODO: remove these)
window
.
jQuery
=
jQuery
;
window
.
$
=
jQuery
;
window
.
_
=
_
;
window
.
Cookies
=
Cookies
;
window
.
Pikaday
=
Pikaday
;
window
.
Dropzone
=
Dropzone
;
window
.
Sortable
=
Sortable
;
// shortcuts
require
(
'
./shortcuts
'
);
require
(
'
./shortcuts_navigation
'
);
require
(
'
./shortcuts_dashboard_navigation
'
);
...
...
@@ -189,9 +204,6 @@ require('./visibility_select');
require
(
'
./wikis
'
);
require
(
'
./zen_mode
'
);
require
(
'
vendor/fuzzaldrin-plus
'
);
require
(
'
es6-promise
'
).
polyfill
();
(
function
()
{
document
.
addEventListener
(
'
beforeunload
'
,
function
()
{
// Unbind scroll events
...
...
@@ -269,7 +281,7 @@ require('es6-promise').polyfill();
$
.
fn
.
tooltip
.
Constructor
.
DEFAULTS
.
trigger
=
'
hover
'
;
$body
.
tooltip
({
selector
:
'
.has-tooltip, [data-toggle="tooltip"]
'
,
placement
:
function
(
_
,
el
)
{
placement
:
function
(
tip
,
el
)
{
return
$
(
el
).
data
(
'
placement
'
)
||
'
bottom
'
;
}
});
...
...
app/assets/javascripts/commons/bootstrap.js
View file @
7371f6cd
require
(
'
./jquery
'
)
;
import
'
jquery
'
;
//
twitter bootstrap
plugins
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/affix
'
)
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/alert
'
)
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/dropdown
'
)
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/modal
'
)
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/tab
'
)
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/transition
'
)
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/tooltip
'
)
;
//
bootstrap jQuery
plugins
import
'
bootstrap-sass/assets/javascripts/bootstrap/affix
'
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/alert
'
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/dropdown
'
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/modal
'
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/tab
'
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/transition
'
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/tooltip
'
;
app/assets/javascripts/commons/index.js
View file @
7371f6cd
require
(
'
./jquery
'
)
;
require
(
'
./bootstrap
'
)
;
import
'
./jquery
'
;
import
'
./bootstrap
'
;
app/assets/javascripts/commons/jquery.js
View file @
7371f6cd
// jQuery library
window
.
$
=
window
.
jQuery
=
require
(
'
jquery
'
);
import
'
jquery
'
;
// jQuery plugins
require
(
'
jquery-ujs
'
)
;
require
(
'
vendor/jquery.endless-scroll
'
)
;
require
(
'
vendor/jquery.caret
'
)
;
require
(
'
vendor/jquery.atwho
'
)
;
require
(
'
vendor/jquery.scrollTo
'
)
;
require
(
'
vendor/jquery.nicescroll
'
)
;
require
(
'
vendor/jquery.waitforimages
'
)
;
require
(
'
select2/select2.js
'
)
;
//
common
jQuery plugins
import
'
jquery-ujs
'
;
import
'
vendor/jquery.endless-scroll
'
;
import
'
vendor/jquery.caret
'
;
import
'
vendor/jquery.atwho
'
;
import
'
vendor/jquery.scrollTo
'
;
import
'
vendor/jquery.nicescroll
'
;
import
'
vendor/jquery.waitforimages
'
;
import
'
select2/select2
'
;
config/webpack.config.js
View file @
7371f6cd
...
...
@@ -87,6 +87,12 @@ var config = {
// prevent pikaday from including moment.js
new
webpack
.
IgnorePlugin
(
/moment/
,
/pikaday/
),
// fix legacy jQuery plugins which depend on globals
new
webpack
.
ProvidePlugin
({
$
:
'
jquery
'
,
jQuery
:
'
jquery
'
,
}),
// use deterministic module ids in all environments
IS_PRODUCTION
?
new
webpack
.
HashedModuleIdsPlugin
()
:
...
...
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