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
67d2b2ac
Commit
67d2b2ac
authored
Oct 24, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace jquery.cookie vendor script with js.cookie
parent
5a4e6721
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
185 additions
and
70 deletions
+185
-70
app/assets/javascripts/activities.js
app/assets/javascripts/activities.js
+1
-1
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+1
-1
app/assets/javascripts/awards_handler.js
app/assets/javascripts/awards_handler.js
+3
-3
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+2
-2
app/assets/javascripts/cycle_analytics.js.es6
app/assets/javascripts/cycle_analytics.js.es6
+2
-2
app/assets/javascripts/merge_conflicts/merge_conflict_store.js.es6
...s/javascripts/merge_conflicts/merge_conflict_store.js.es6
+2
-2
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+2
-2
app/assets/javascripts/project.js
app/assets/javascripts/project.js
+2
-2
app/assets/javascripts/right_sidebar.js
app/assets/javascripts/right_sidebar.js
+1
-1
app/assets/javascripts/sidebar.js.es6
app/assets/javascripts/sidebar.js.es6
+2
-2
app/assets/javascripts/user.js.es6
app/assets/javascripts/user.js.es6
+1
-1
spec/javascripts/activities_spec.js.es6
spec/javascripts/activities_spec.js.es6
+1
-1
spec/javascripts/awards_handler_spec.js
spec/javascripts/awards_handler_spec.js
+4
-4
spec/javascripts/boards/boards_store_spec.js.es6
spec/javascripts/boards/boards_store_spec.js.es6
+2
-2
spec/javascripts/boards/issue_spec.js.es6
spec/javascripts/boards/issue_spec.js.es6
+1
-1
spec/javascripts/boards/list_spec.js.es6
spec/javascripts/boards/list_spec.js.es6
+1
-1
spec/javascripts/right_sidebar_spec.js
spec/javascripts/right_sidebar_spec.js
+1
-1
vendor/assets/javascripts/jquery.cookie.js
vendor/assets/javascripts/jquery.cookie.js
+0
-41
vendor/assets/javascripts/js.cookie.js
vendor/assets/javascripts/js.cookie.js
+156
-0
No files found.
app/assets/javascripts/activities.js
View file @
67d2b2ac
...
...
@@ -24,7 +24,7 @@
var
filter
=
sender
.
attr
(
"
id
"
).
split
(
"
_
"
)[
0
];
$
(
'
.event-filter .active
'
).
removeClass
(
"
active
"
);
$
.
cookie
(
"
event_filter
"
,
filter
,
{
Cookies
.
set
(
"
event_filter
"
,
filter
,
{
path
:
gon
.
relative_url_root
||
'
/
'
});
...
...
app/assets/javascripts/application.js
View file @
67d2b2ac
...
...
@@ -11,13 +11,13 @@
/*= require jquery-ui/effect-highlight */
/*= require jquery-ui/sortable */
/*= require jquery_ujs */
/*= require jquery.cookie */
/*= require jquery.endless-scroll */
/*= require jquery.highlight */
/*= require jquery.waitforimages */
/*= require jquery.atwho */
/*= require jquery.scrollTo */
/*= require jquery.turbolinks */
/*= require js.cookie */
/*= require turbolinks */
/*= require autosave */
/*= require bootstrap/affix */
...
...
app/assets/javascripts/awards_handler.js
View file @
67d2b2ac
...
...
@@ -322,7 +322,7 @@
var
frequentlyUsedEmojis
;
frequentlyUsedEmojis
=
this
.
getFrequentlyUsedEmojis
();
frequentlyUsedEmojis
.
push
(
emoji
);
return
$
.
cookie
(
'
frequently_used_emojis
'
,
frequentlyUsedEmojis
.
join
(
'
,
'
),
{
Cookies
.
set
(
'
frequently_used_emojis
'
,
frequentlyUsedEmojis
.
join
(
'
,
'
),
{
path
:
gon
.
relative_url_root
||
'
/
'
,
expires
:
365
});
...
...
@@ -330,13 +330,13 @@
AwardsHandler
.
prototype
.
getFrequentlyUsedEmojis
=
function
()
{
var
frequentlyUsedEmojis
;
frequentlyUsedEmojis
=
(
$
.
cookie
(
'
frequently_used_emojis
'
)
||
''
).
split
(
'
,
'
);
frequentlyUsedEmojis
=
(
Cookies
.
get
(
'
frequently_used_emojis
'
)
||
''
).
split
(
'
,
'
);
return
_
.
compact
(
_
.
uniq
(
frequentlyUsedEmojis
));
};
AwardsHandler
.
prototype
.
renderFrequentlyUsedBlock
=
function
()
{
var
emoji
,
frequentlyUsedEmojis
,
i
,
len
,
ul
;
if
(
$
.
cookie
(
'
frequently_used_emojis
'
))
{
if
(
Cookies
.
get
(
'
frequently_used_emojis
'
))
{
frequentlyUsedEmojis
=
this
.
getFrequentlyUsedEmojis
();
ul
=
$
(
"
<ul class='clearfix emoji-menu-list frequent-emojis'>
"
);
for
(
i
=
0
,
len
=
frequentlyUsedEmojis
.
length
;
i
<
len
;
i
++
)
{
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
View file @
67d2b2ac
...
...
@@ -58,12 +58,12 @@
removeBlankState () {
this.removeList('blank');
$.cookie
('issue_board_welcome_hidden', 'true', {
Cookies.set
('issue_board_welcome_hidden', 'true', {
expires: 365 * 10
});
},
welcomeIsHidden () {
return
$.cookie
('issue_board_welcome_hidden') === 'true';
return
Cookies.get
('issue_board_welcome_hidden') === 'true';
},
removeList (id, type = 'blank') {
const list = this.findList('id', id, type);
...
...
app/assets/javascripts/cycle_analytics.js.es6
View file @
67d2b2ac
...
...
@@ -6,7 +6,7 @@
const store = gl.cycleAnalyticsStore = {
isLoading: true,
hasError: false,
isHelpDismissed:
$.cookie
(COOKIE_NAME),
isHelpDismissed:
Cookies.get
(COOKIE_NAME),
analytics: {}
};
...
...
@@ -75,7 +75,7 @@
dismissLanding() {
store.isHelpDismissed = true;
$.cookie
(COOKIE_NAME, true, {
Cookies.set
(COOKIE_NAME, true, {
path: gon.relative_url_root || '/'
});
}
...
...
app/assets/javascripts/merge_conflicts/merge_conflict_store.js.es6
View file @
67d2b2ac
((global) => {
global.mergeConflicts = global.mergeConflicts || {};
const diffViewType =
$.cookie
('diff_view');
const diffViewType =
Cookies.get
('diff_view');
const HEAD_HEADER_TEXT = 'HEAD//our changes';
const ORIGIN_HEADER_TEXT = 'origin//their changes';
const HEAD_BUTTON_TITLE = 'Use ours';
...
...
@@ -180,7 +180,7 @@
this.state.diffView = viewType;
this.state.isParallel = viewType === VIEW_TYPES.PARALLEL;
$.cookie
('diff_view', viewType, {
Cookies.set
('diff_view', viewType, {
path: gon.relative_url_root || '/'
});
},
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
67d2b2ac
...
...
@@ -3,7 +3,7 @@
// Handles persisting and restoring the current tab selection and lazily-loading
// content on the MergeRequests#show page.
//
/*= require j
query
.cookie */
/*= require j
s
.cookie */
//
// ### Example Markup
...
...
@@ -368,7 +368,7 @@
MergeRequestTabs
.
prototype
.
expandView
=
function
()
{
var
$gutterIcon
;
if
(
$
.
cookie
(
'
collapsed_gutter
'
)
===
'
true
'
)
{
if
(
Cookies
.
get
(
'
collapsed_gutter
'
)
===
'
true
'
)
{
return
;
}
$gutterIcon
=
$
(
'
.js-sidebar-toggle i:visible
'
);
...
...
app/assets/javascripts/project.js
View file @
67d2b2ac
...
...
@@ -23,14 +23,14 @@
return
$
(
this
).
parents
(
'
form
'
).
submit
();
});
$
(
'
.hide-no-ssh-message
'
).
on
(
'
click
'
,
function
(
e
)
{
$
.
cookie
(
'
hide_no_ssh_message
'
,
'
false
'
,
{
Cookies
.
set
(
'
hide_no_ssh_message
'
,
'
false
'
,
{
path
:
gon
.
relative_url_root
||
'
/
'
});
$
(
this
).
parents
(
'
.no-ssh-key-message
'
).
remove
();
return
e
.
preventDefault
();
});
$
(
'
.hide-no-password-message
'
).
on
(
'
click
'
,
function
(
e
)
{
$
.
cookie
(
'
hide_no_password_message
'
,
'
false
'
,
{
Cookies
.
set
(
'
hide_no_password_message
'
,
'
false
'
,
{
path
:
gon
.
relative_url_root
||
'
/
'
});
$
(
this
).
parents
(
'
.no-password-message
'
).
remove
();
...
...
app/assets/javascripts/right_sidebar.js
View file @
67d2b2ac
...
...
@@ -29,7 +29,7 @@
$
(
'
.page-with-sidebar
'
).
removeClass
(
'
right-sidebar-collapsed
'
).
addClass
(
'
right-sidebar-expanded
'
);
}
if
(
!
triggered
)
{
return
$
.
cookie
(
"
collapsed_gutter
"
,
$
(
'
.right-sidebar
'
).
hasClass
(
'
right-sidebar-collapsed
'
),
{
return
Cookies
.
set
(
"
collapsed_gutter
"
,
$
(
'
.right-sidebar
'
).
hasClass
(
'
right-sidebar-collapsed
'
),
{
path
:
gon
.
relative_url_root
||
'
/
'
});
}
...
...
app/assets/javascripts/sidebar.js.es6
View file @
67d2b2ac
...
...
@@ -28,7 +28,7 @@
}
init() {
this.isPinned =
$.cookie
(pinnedStateCookie) === 'true';
this.isPinned =
Cookies.get
(pinnedStateCookie) === 'true';
this.isExpanded = (
window.innerWidth >= sidebarBreakpoint &&
$(pageSelector).hasClass(expandedPageClass)
...
...
@@ -62,7 +62,7 @@
if (!this.isPinned) {
this.isExpanded = false;
}
$.cookie
(pinnedStateCookie, this.isPinned ? 'true' : 'false', {
Cookies.set
(pinnedStateCookie, this.isPinned ? 'true' : 'false', {
path: gon.relative_url_root || '/',
expires: 3650
});
...
...
app/assets/javascripts/user.js.es6
View file @
67d2b2ac
...
...
@@ -24,7 +24,7 @@
$('.hide-project-limit-message').on('click', e => {
e.preventDefault();
const path = gon.relative_url_root || '/';
$.cookie
('hide_project_limit_message', 'false', {
Cookies.set
('hide_project_limit_message', 'false', {
path: path
});
$(this).parents('.project-limit-message').remove();
...
...
spec/javascripts/activities_spec.js.es6
View file @
67d2b2ac
/*= require j
query
.cookie.js */
/*= require j
s
.cookie.js */
/*= require jquery.endless-scroll.js */
/*= require pager */
/*= require activities */
...
...
spec/javascripts/awards_handler_spec.js
View file @
67d2b2ac
/*= require awards_handler */
/*= require jquery */
/*= require j
query
.cookie */
/*= require j
s
.cookie */
/*= require ./fixtures/emoji_menu */
(
function
()
{
...
...
@@ -44,7 +44,7 @@
spyOn
(
jQuery
,
'
get
'
).
and
.
callFake
(
function
(
req
,
cb
)
{
return
cb
(
window
.
emojiMenu
);
});
spyOn
(
jQuery
,
'
cookie
'
);
spyOn
(
Cookies
,
'
set
'
);
});
afterEach
(
function
()
{
// restore original url root value
...
...
@@ -194,7 +194,7 @@
it
(
'
should set a cookie with the correct default path
'
,
function
()
{
gon
.
relative_url_root
=
''
;
awardsHandler
.
addEmojiToFrequentlyUsedList
(
'
sunglasses
'
);
expect
(
jQuery
.
cookie
)
expect
(
Cookies
.
set
)
.
toHaveBeenCalledWith
(
'
frequently_used_emojis
'
,
'
sunglasses
'
,
{
path
:
'
/
'
,
expires
:
365
...
...
@@ -204,7 +204,7 @@
it
(
'
should set a cookie with the correct custom root path
'
,
function
()
{
gon
.
relative_url_root
=
'
/gitlab/subdir
'
;
awardsHandler
.
addEmojiToFrequentlyUsedList
(
'
alien
'
);
expect
(
jQuery
.
cookie
)
expect
(
Cookies
.
set
)
.
toHaveBeenCalledWith
(
'
frequently_used_emojis
'
,
'
alien
'
,
{
path
:
'
/gitlab/subdir
'
,
expires
:
365
...
...
spec/javascripts/boards/boards_store_spec.js.es6
View file @
67d2b2ac
//= require jquery
//= require jquery_ujs
//= require j
query
.cookie
//= require j
s
.cookie
//= require vue
//= require vue-resource
//= require lib/utils/url_utility
...
...
@@ -17,7 +17,7 @@
gl.boardService = new BoardService('/test/issue-boards/board', '1');
gl.issueBoards.BoardsStore.create();
$.cookie
('issue_board_welcome_hidden', 'false');
Cookies.set
('issue_board_welcome_hidden', 'false');
});
describe('Store', () => {
...
...
spec/javascripts/boards/issue_spec.js.es6
View file @
67d2b2ac
//= require jquery
//= require jquery_ujs
//= require j
query
.cookie
//= require j
s
.cookie
//= require vue
//= require vue-resource
//= require lib/utils/url_utility
...
...
spec/javascripts/boards/list_spec.js.es6
View file @
67d2b2ac
//= require jquery
//= require jquery_ujs
//= require j
query
.cookie
//= require j
s
.cookie
//= require vue
//= require vue-resource
//= require lib/utils/url_utility
...
...
spec/javascripts/right_sidebar_spec.js
View file @
67d2b2ac
/*= require right_sidebar */
/*= require jquery */
/*= require j
query
.cookie */
/*= require j
s
.cookie */
(
function
()
{
var
$aside
,
$icon
,
$labelsIcon
,
$page
,
$toggle
,
assertSidebarState
;
...
...
vendor/assets/javascripts/jquery.cookie.js
deleted
100644 → 0
View file @
5a4e6721
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery
.
cookie
=
function
(
key
,
value
,
options
)
{
// key and at least value given, set cookie...
if
(
arguments
.
length
>
1
&&
String
(
value
)
!==
"
[object Object]
"
)
{
options
=
jQuery
.
extend
({},
options
);
if
(
value
===
null
||
value
===
undefined
)
{
options
.
expires
=
-
1
;
}
if
(
typeof
options
.
expires
===
'
number
'
)
{
var
days
=
options
.
expires
,
t
=
options
.
expires
=
new
Date
();
t
.
setDate
(
t
.
getDate
()
+
days
);
}
value
=
String
(
value
);
return
(
document
.
cookie
=
[
encodeURIComponent
(
key
),
'
=
'
,
options
.
raw
?
value
:
encodeURIComponent
(
value
),
options
.
expires
?
'
; expires=
'
+
options
.
expires
.
toUTCString
()
:
''
,
// use expires attribute, max-age is not supported by IE
options
.
path
?
'
; path=
'
+
options
.
path
:
''
,
options
.
domain
?
'
; domain=
'
+
options
.
domain
:
''
,
options
.
secure
?
'
; secure
'
:
''
].
join
(
''
));
}
// key and possibly options given, get cookie...
options
=
value
||
{};
var
result
,
decode
=
options
.
raw
?
function
(
s
)
{
return
s
;
}
:
decodeURIComponent
;
return
(
result
=
new
RegExp
(
'
(?:^|; )
'
+
encodeURIComponent
(
key
)
+
'
=([^;]*)
'
).
exec
(
document
.
cookie
))
?
decode
(
result
[
1
])
:
null
;
};
vendor/assets/javascripts/js.cookie.js
0 → 100644
View file @
67d2b2ac
/*!
* JavaScript Cookie v2.1.3
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
;(
function
(
factory
)
{
var
registeredInModuleLoader
=
false
;
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
define
(
factory
);
registeredInModuleLoader
=
true
;
}
if
(
typeof
exports
===
'
object
'
)
{
module
.
exports
=
factory
();
registeredInModuleLoader
=
true
;
}
if
(
!
registeredInModuleLoader
)
{
var
OldCookies
=
window
.
Cookies
;
var
api
=
window
.
Cookies
=
factory
();
api
.
noConflict
=
function
()
{
window
.
Cookies
=
OldCookies
;
return
api
;
};
}
}(
function
()
{
function
extend
()
{
var
i
=
0
;
var
result
=
{};
for
(;
i
<
arguments
.
length
;
i
++
)
{
var
attributes
=
arguments
[
i
];
for
(
var
key
in
attributes
)
{
result
[
key
]
=
attributes
[
key
];
}
}
return
result
;
}
function
init
(
converter
)
{
function
api
(
key
,
value
,
attributes
)
{
var
result
;
if
(
typeof
document
===
'
undefined
'
)
{
return
;
}
// Write
if
(
arguments
.
length
>
1
)
{
attributes
=
extend
({
path
:
'
/
'
},
api
.
defaults
,
attributes
);
if
(
typeof
attributes
.
expires
===
'
number
'
)
{
var
expires
=
new
Date
();
expires
.
setMilliseconds
(
expires
.
getMilliseconds
()
+
attributes
.
expires
*
864
e
+
5
);
attributes
.
expires
=
expires
;
}
try
{
result
=
JSON
.
stringify
(
value
);
if
(
/^
[\{\[]
/
.
test
(
result
))
{
value
=
result
;
}
}
catch
(
e
)
{}
if
(
!
converter
.
write
)
{
value
=
encodeURIComponent
(
String
(
value
))
.
replace
(
/%
(
23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C
)
/g
,
decodeURIComponent
);
}
else
{
value
=
converter
.
write
(
value
,
key
);
}
key
=
encodeURIComponent
(
String
(
key
));
key
=
key
.
replace
(
/%
(
23|24|26|2B|5E|60|7C
)
/g
,
decodeURIComponent
);
key
=
key
.
replace
(
/
[\(\)]
/g
,
escape
);
return
(
document
.
cookie
=
[
key
,
'
=
'
,
value
,
attributes
.
expires
?
'
; expires=
'
+
attributes
.
expires
.
toUTCString
()
:
''
,
// use expires attribute, max-age is not supported by IE
attributes
.
path
?
'
; path=
'
+
attributes
.
path
:
''
,
attributes
.
domain
?
'
; domain=
'
+
attributes
.
domain
:
''
,
attributes
.
secure
?
'
; secure
'
:
''
].
join
(
''
));
}
// Read
if
(
!
key
)
{
result
=
{};
}
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling "get()"
var
cookies
=
document
.
cookie
?
document
.
cookie
.
split
(
'
;
'
)
:
[];
var
rdecode
=
/
(
%
[
0-9A-Z
]{2})
+/g
;
var
i
=
0
;
for
(;
i
<
cookies
.
length
;
i
++
)
{
var
parts
=
cookies
[
i
].
split
(
'
=
'
);
var
cookie
=
parts
.
slice
(
1
).
join
(
'
=
'
);
if
(
cookie
.
charAt
(
0
)
===
'
"
'
)
{
cookie
=
cookie
.
slice
(
1
,
-
1
);
}
try
{
var
name
=
parts
[
0
].
replace
(
rdecode
,
decodeURIComponent
);
cookie
=
converter
.
read
?
converter
.
read
(
cookie
,
name
)
:
converter
(
cookie
,
name
)
||
cookie
.
replace
(
rdecode
,
decodeURIComponent
);
if
(
this
.
json
)
{
try
{
cookie
=
JSON
.
parse
(
cookie
);
}
catch
(
e
)
{}
}
if
(
key
===
name
)
{
result
=
cookie
;
break
;
}
if
(
!
key
)
{
result
[
name
]
=
cookie
;
}
}
catch
(
e
)
{}
}
return
result
;
}
api
.
set
=
api
;
api
.
get
=
function
(
key
)
{
return
api
.
call
(
api
,
key
);
};
api
.
getJSON
=
function
()
{
return
api
.
apply
({
json
:
true
},
[].
slice
.
call
(
arguments
));
};
api
.
defaults
=
{};
api
.
remove
=
function
(
key
,
attributes
)
{
api
(
key
,
''
,
extend
(
attributes
,
{
expires
:
-
1
}));
};
api
.
withConverter
=
init
;
return
api
;
}
return
init
(
function
()
{});
}));
\ No newline at end of file
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