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
Léo-Paul Géneau
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
Hide 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 @@
...
@@ -6,14 +6,29 @@
/* global AwardsHandler */
/* global AwardsHandler */
/* global Aside */
/* global Aside */
// common libraries
import
jQuery
from
'
jquery
'
;
window
.
Cookies
=
require
(
'
js-cookie
'
);
import
_
from
'
underscore
'
;
window
.
Pikaday
=
require
(
'
pikaday
'
);
import
Cookies
from
'
js-cookie
'
;
window
.
_
=
require
(
'
underscore
'
);
import
Pikaday
from
'
pikaday
'
;
window
.
Dropzone
=
require
(
'
dropzone
'
);
import
Dropzone
from
'
dropzone
'
;
window
.
Sortable
=
require
(
'
vendor/Sortable
'
);
import
Sortable
from
'
vendor/Sortable
'
;
// libraries with import side-effects
require
(
'
mousetrap
'
);
require
(
'
mousetrap
'
);
require
(
'
mousetrap/plugins/pause/mousetrap-pause
'
);
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
'
);
require
(
'
./shortcuts_navigation
'
);
require
(
'
./shortcuts_navigation
'
);
require
(
'
./shortcuts_dashboard_navigation
'
);
require
(
'
./shortcuts_dashboard_navigation
'
);
...
@@ -189,9 +204,6 @@ require('./visibility_select');
...
@@ -189,9 +204,6 @@ require('./visibility_select');
require
(
'
./wikis
'
);
require
(
'
./wikis
'
);
require
(
'
./zen_mode
'
);
require
(
'
./zen_mode
'
);
require
(
'
vendor/fuzzaldrin-plus
'
);
require
(
'
es6-promise
'
).
polyfill
();
(
function
()
{
(
function
()
{
document
.
addEventListener
(
'
beforeunload
'
,
function
()
{
document
.
addEventListener
(
'
beforeunload
'
,
function
()
{
// Unbind scroll events
// Unbind scroll events
...
@@ -269,7 +281,7 @@ require('es6-promise').polyfill();
...
@@ -269,7 +281,7 @@ require('es6-promise').polyfill();
$
.
fn
.
tooltip
.
Constructor
.
DEFAULTS
.
trigger
=
'
hover
'
;
$
.
fn
.
tooltip
.
Constructor
.
DEFAULTS
.
trigger
=
'
hover
'
;
$body
.
tooltip
({
$body
.
tooltip
({
selector
:
'
.has-tooltip, [data-toggle="tooltip"]
'
,
selector
:
'
.has-tooltip, [data-toggle="tooltip"]
'
,
placement
:
function
(
_
,
el
)
{
placement
:
function
(
tip
,
el
)
{
return
$
(
el
).
data
(
'
placement
'
)
||
'
bottom
'
;
return
$
(
el
).
data
(
'
placement
'
)
||
'
bottom
'
;
}
}
});
});
...
...
app/assets/javascripts/commons/bootstrap.js
View file @
7371f6cd
require
(
'
./jquery
'
)
;
import
'
jquery
'
;
//
twitter bootstrap
plugins
//
bootstrap jQuery
plugins
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/affix
'
)
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/affix
'
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/alert
'
)
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/alert
'
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/dropdown
'
)
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/dropdown
'
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/modal
'
)
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/modal
'
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/tab
'
)
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/tab
'
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/transition
'
)
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/transition
'
;
require
(
'
bootstrap-sass/assets/javascripts/bootstrap/tooltip
'
)
;
import
'
bootstrap-sass/assets/javascripts/bootstrap/tooltip
'
;
app/assets/javascripts/commons/index.js
View file @
7371f6cd
require
(
'
./jquery
'
)
;
import
'
./jquery
'
;
require
(
'
./bootstrap
'
)
;
import
'
./bootstrap
'
;
app/assets/javascripts/commons/jquery.js
View file @
7371f6cd
// jQuery library
import
'
jquery
'
;
window
.
$
=
window
.
jQuery
=
require
(
'
jquery
'
);
// jQuery plugins
//
common
jQuery plugins
require
(
'
jquery-ujs
'
)
;
import
'
jquery-ujs
'
;
require
(
'
vendor/jquery.endless-scroll
'
)
;
import
'
vendor/jquery.endless-scroll
'
;
require
(
'
vendor/jquery.caret
'
)
;
import
'
vendor/jquery.caret
'
;
require
(
'
vendor/jquery.atwho
'
)
;
import
'
vendor/jquery.atwho
'
;
require
(
'
vendor/jquery.scrollTo
'
)
;
import
'
vendor/jquery.scrollTo
'
;
require
(
'
vendor/jquery.nicescroll
'
)
;
import
'
vendor/jquery.nicescroll
'
;
require
(
'
vendor/jquery.waitforimages
'
)
;
import
'
vendor/jquery.waitforimages
'
;
require
(
'
select2/select2.js
'
)
;
import
'
select2/select2
'
;
config/webpack.config.js
View file @
7371f6cd
...
@@ -87,6 +87,12 @@ var config = {
...
@@ -87,6 +87,12 @@ var config = {
// prevent pikaday from including moment.js
// prevent pikaday from including moment.js
new
webpack
.
IgnorePlugin
(
/moment/
,
/pikaday/
),
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
// use deterministic module ids in all environments
IS_PRODUCTION
?
IS_PRODUCTION
?
new
webpack
.
HashedModuleIdsPlugin
()
:
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