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
6a335871
Commit
6a335871
authored
Dec 15, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exported JS classes as modules
parent
627a9687
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
362 additions
and
371 deletions
+362
-371
app/assets/javascripts/boards/components/board_sidebar.js
app/assets/javascripts/boards/components/board_sidebar.js
+1
-1
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+3
-3
app/assets/javascripts/init_issuable_sidebar.js
app/assets/javascripts/init_issuable_sidebar.js
+2
-2
app/assets/javascripts/line_highlighter.js
app/assets/javascripts/line_highlighter.js
+1
-1
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-2
app/assets/javascripts/merge_request.js
app/assets/javascripts/merge_request.js
+128
-133
app/assets/javascripts/repo/components/repo_preview.vue
app/assets/javascripts/repo/components/repo_preview.vue
+1
-1
app/assets/javascripts/right_sidebar.js
app/assets/javascripts/right_sidebar.js
+220
-218
app/assets/javascripts/shortcuts_issuable.js
app/assets/javascripts/shortcuts_issuable.js
+2
-2
spec/javascripts/collapsed_sidebar_todo_spec.js
spec/javascripts/collapsed_sidebar_todo_spec.js
+1
-2
spec/javascripts/line_highlighter_spec.js
spec/javascripts/line_highlighter_spec.js
+1
-2
spec/javascripts/merge_request_spec.js
spec/javascripts/merge_request_spec.js
+1
-2
spec/javascripts/right_sidebar_spec.js
spec/javascripts/right_sidebar_spec.js
+1
-2
No files found.
app/assets/javascripts/boards/components/board_sidebar.js
View file @
6a335871
/* eslint-disable comma-dangle, space-before-function-paren, no-new */
/* eslint-disable comma-dangle, space-before-function-paren, no-new */
/* global MilestoneSelect */
/* global MilestoneSelect */
/* global Sidebar */
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Flash
from
'
../../flash
'
;
import
Flash
from
'
../../flash
'
;
import
Sidebar
from
'
../../right_sidebar
'
;
import
eventHub
from
'
../../sidebar/event_hub
'
;
import
eventHub
from
'
../../sidebar/event_hub
'
;
import
assigneeTitle
from
'
../../sidebar/components/assignees/assignee_title
'
;
import
assigneeTitle
from
'
../../sidebar/components/assignees/assignee_title
'
;
import
assignees
from
'
../../sidebar/components/assignees/assignees
'
;
import
assignees
from
'
../../sidebar/components/assignees/assignees
'
;
...
...
app/assets/javascripts/dispatcher.js
View file @
6a335871
...
@@ -11,7 +11,7 @@ import NotificationsForm from './notifications_form';
...
@@ -11,7 +11,7 @@ import NotificationsForm from './notifications_form';
import
notificationsDropdown
from
'
./notifications_dropdown
'
;
import
notificationsDropdown
from
'
./notifications_dropdown
'
;
import
groupAvatar
from
'
./group_avatar
'
;
import
groupAvatar
from
'
./group_avatar
'
;
import
GroupLabelSubscription
from
'
./group_label_subscription
'
;
import
GroupLabelSubscription
from
'
./group_label_subscription
'
;
/* global LineHighlighter */
import
LineHighlighter
from
'
./line_highlighter
'
;
import
BuildArtifacts
from
'
./build_artifacts
'
;
import
BuildArtifacts
from
'
./build_artifacts
'
;
import
CILintEditor
from
'
./ci_lint_editor
'
;
import
CILintEditor
from
'
./ci_lint_editor
'
;
import
groupsSelect
from
'
./groups_select
'
;
import
groupsSelect
from
'
./groups_select
'
;
...
@@ -21,7 +21,7 @@ import NamespaceSelect from './namespace_select';
...
@@ -21,7 +21,7 @@ import NamespaceSelect from './namespace_select';
import
NewCommitForm
from
'
./new_commit_form
'
;
import
NewCommitForm
from
'
./new_commit_form
'
;
import
Project
from
'
./project
'
;
import
Project
from
'
./project
'
;
import
projectAvatar
from
'
./project_avatar
'
;
import
projectAvatar
from
'
./project_avatar
'
;
/* global MergeRequest */
import
MergeRequest
from
'
./merge_request
'
;
import
Compare
from
'
./compare
'
;
import
Compare
from
'
./compare
'
;
import
initCompareAutocomplete
from
'
./compare_autocomplete
'
;
import
initCompareAutocomplete
from
'
./compare_autocomplete
'
;
import
ProjectFindFile
from
'
./project_find_file
'
;
import
ProjectFindFile
from
'
./project_find_file
'
;
...
@@ -29,7 +29,7 @@ import ProjectNew from './project_new';
...
@@ -29,7 +29,7 @@ import ProjectNew from './project_new';
import
projectImport
from
'
./project_import
'
;
import
projectImport
from
'
./project_import
'
;
import
Labels
from
'
./labels
'
;
import
Labels
from
'
./labels
'
;
import
LabelManager
from
'
./label_manager
'
;
import
LabelManager
from
'
./label_manager
'
;
/* global Sidebar */
import
Sidebar
from
'
./right_sidebar
'
;
import
IssuableTemplateSelectors
from
'
./templates/issuable_template_selectors
'
;
import
IssuableTemplateSelectors
from
'
./templates/issuable_template_selectors
'
;
import
Flash
from
'
./flash
'
;
import
Flash
from
'
./flash
'
;
import
CommitsList
from
'
./commits
'
;
import
CommitsList
from
'
./commits
'
;
...
...
app/assets/javascripts/init_issuable_sidebar.js
View file @
6a335871
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/* global MilestoneSelect */
/* global MilestoneSelect */
import
LabelsSelect
from
'
./labels_select
'
;
import
LabelsSelect
from
'
./labels_select
'
;
import
IssuableContext
from
'
./issuable_context
'
;
import
IssuableContext
from
'
./issuable_context
'
;
/* global Sidebar */
import
Sidebar
from
'
./right_sidebar
'
;
import
DueDateSelectors
from
'
./due_date_select
'
;
import
DueDateSelectors
from
'
./due_date_select
'
;
...
@@ -15,5 +15,5 @@ export default () => {
...
@@ -15,5 +15,5 @@ export default () => {
new
LabelsSelect
();
new
LabelsSelect
();
new
IssuableContext
(
sidebarOptions
.
currentUser
);
new
IssuableContext
(
sidebarOptions
.
currentUser
);
new
DueDateSelectors
();
new
DueDateSelectors
();
window
.
sidebar
=
new
Sidebar
();
Sidebar
.
initialize
();
};
};
app/assets/javascripts/line_highlighter.js
View file @
6a335871
...
@@ -175,4 +175,4 @@ LineHighlighter.prototype.__setLocationHash__ = function(value) {
...
@@ -175,4 +175,4 @@ LineHighlighter.prototype.__setLocationHash__ = function(value) {
},
document
.
title
,
value
);
},
document
.
title
,
value
);
};
};
window
.
LineHighlighter
=
LineHighlighter
;
export
default
LineHighlighter
;
app/assets/javascripts/main.js
View file @
6a335871
...
@@ -45,14 +45,12 @@ import './layout_nav';
...
@@ -45,14 +45,12 @@ import './layout_nav';
import
LazyLoader
from
'
./lazy_loader
'
;
import
LazyLoader
from
'
./lazy_loader
'
;
import
'
./line_highlighter
'
;
import
'
./line_highlighter
'
;
import
initLogoAnimation
from
'
./logo
'
;
import
initLogoAnimation
from
'
./logo
'
;
import
'
./merge_request
'
;
import
'
./merge_request_tabs
'
;
import
'
./merge_request_tabs
'
;
import
'
./milestone_select
'
;
import
'
./milestone_select
'
;
import
'
./notes
'
;
import
'
./notes
'
;
import
'
./preview_markdown
'
;
import
'
./preview_markdown
'
;
import
'
./projects_dropdown
'
;
import
'
./projects_dropdown
'
;
import
'
./render_gfm
'
;
import
'
./render_gfm
'
;
import
'
./right_sidebar
'
;
import
initBreadcrumbs
from
'
./breadcrumb
'
;
import
initBreadcrumbs
from
'
./breadcrumb
'
;
import
'
./dispatcher
'
;
import
'
./dispatcher
'
;
...
...
app/assets/javascripts/merge_request.js
View file @
6a335871
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, no-underscore-dangle, one-var, one-var-declaration-per-line, consistent-return, dot-notation, quote-props, comma-dangle, object-shorthand, max-len, prefer-arrow-callback */
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, no-underscore-dangle, one-var, one-var-declaration-per-line, consistent-return, dot-notation, quote-props, comma-dangle, object-shorthand, max-len, prefer-arrow-callback */
/* global MergeRequestTabs */
import
'
vendor/jquery.waitforimages
'
;
import
'
vendor/jquery.waitforimages
'
;
import
TaskList
from
'
./task_list
'
;
import
TaskList
from
'
./task_list
'
;
...
@@ -7,9 +6,7 @@ import MergeRequestTabs from './merge_request_tabs';
...
@@ -7,9 +6,7 @@ import MergeRequestTabs from './merge_request_tabs';
import
IssuablesHelper
from
'
./helpers/issuables_helper
'
;
import
IssuablesHelper
from
'
./helpers/issuables_helper
'
;
import
{
addDelimiter
}
from
'
./lib/utils/text_utility
'
;
import
{
addDelimiter
}
from
'
./lib/utils/text_utility
'
;
(
function
()
{
function
MergeRequest
(
opts
)
{
this
.
MergeRequest
=
(
function
()
{
function
MergeRequest
(
opts
)
{
// Initialize MergeRequest behavior
// Initialize MergeRequest behavior
//
//
// Options:
// Options:
...
@@ -40,26 +37,26 @@ import { addDelimiter } from './lib/utils/text_utility';
...
@@ -40,26 +37,26 @@ import { addDelimiter } from './lib/utils/text_utility';
}
}
});
});
}
}
}
}
// Local jQuery finder
// Local jQuery finder
MergeRequest
.
prototype
.
$
=
function
(
selector
)
{
MergeRequest
.
prototype
.
$
=
function
(
selector
)
{
return
this
.
$el
.
find
(
selector
);
return
this
.
$el
.
find
(
selector
);
};
};
MergeRequest
.
prototype
.
initTabs
=
function
()
{
MergeRequest
.
prototype
.
initTabs
=
function
()
{
if
(
window
.
mrTabs
)
{
if
(
window
.
mrTabs
)
{
window
.
mrTabs
.
unbindEvents
();
window
.
mrTabs
.
unbindEvents
();
}
}
window
.
mrTabs
=
new
MergeRequestTabs
(
this
.
opts
);
window
.
mrTabs
=
new
MergeRequestTabs
(
this
.
opts
);
};
};
MergeRequest
.
prototype
.
showAllCommits
=
function
()
{
MergeRequest
.
prototype
.
showAllCommits
=
function
()
{
this
.
$
(
'
.first-commits
'
).
remove
();
this
.
$
(
'
.first-commits
'
).
remove
();
return
this
.
$
(
'
.all-commits
'
).
removeClass
(
'
hide
'
);
return
this
.
$
(
'
.all-commits
'
).
removeClass
(
'
hide
'
);
};
};
MergeRequest
.
prototype
.
initMRBtnListeners
=
function
()
{
MergeRequest
.
prototype
.
initMRBtnListeners
=
function
()
{
var
_this
;
var
_this
;
_this
=
this
;
_this
=
this
;
return
$
(
'
a.btn-close, a.btn-reopen
'
).
on
(
'
click
'
,
function
(
e
)
{
return
$
(
'
a.btn-close, a.btn-reopen
'
).
on
(
'
click
'
,
function
(
e
)
{
...
@@ -81,9 +78,9 @@ import { addDelimiter } from './lib/utils/text_utility';
...
@@ -81,9 +78,9 @@ import { addDelimiter } from './lib/utils/text_utility';
}
}
}
}
});
});
};
};
MergeRequest
.
prototype
.
submitNoteForm
=
function
(
form
,
$button
)
{
MergeRequest
.
prototype
.
submitNoteForm
=
function
(
form
,
$button
)
{
var
noteText
;
var
noteText
;
noteText
=
form
.
find
(
"
textarea.js-note-text
"
).
val
();
noteText
=
form
.
find
(
"
textarea.js-note-text
"
).
val
();
if
(
noteText
.
trim
().
length
>
0
)
{
if
(
noteText
.
trim
().
length
>
0
)
{
...
@@ -91,9 +88,9 @@ import { addDelimiter } from './lib/utils/text_utility';
...
@@ -91,9 +88,9 @@ import { addDelimiter } from './lib/utils/text_utility';
$button
.
data
(
'
submitted
'
,
true
);
$button
.
data
(
'
submitted
'
,
true
);
return
$button
.
trigger
(
'
click
'
);
return
$button
.
trigger
(
'
click
'
);
}
}
};
};
MergeRequest
.
prototype
.
initCommitMessageListeners
=
function
()
{
MergeRequest
.
prototype
.
initCommitMessageListeners
=
function
()
{
$
(
document
).
on
(
'
click
'
,
'
a.js-with-description-link
'
,
function
(
e
)
{
$
(
document
).
on
(
'
click
'
,
'
a.js-with-description-link
'
,
function
(
e
)
{
var
textarea
=
$
(
'
textarea.js-commit-message
'
);
var
textarea
=
$
(
'
textarea.js-commit-message
'
);
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -111,24 +108,24 @@ import { addDelimiter } from './lib/utils/text_utility';
...
@@ -111,24 +108,24 @@ import { addDelimiter } from './lib/utils/text_utility';
$
(
'
.js-with-description-hint
'
).
show
();
$
(
'
.js-with-description-hint
'
).
show
();
$
(
'
.js-without-description-hint
'
).
hide
();
$
(
'
.js-without-description-hint
'
).
hide
();
});
});
};
};
MergeRequest
.
prototype
.
updateStatusText
=
function
(
classToRemove
,
classToAdd
,
newStatusText
)
{
MergeRequest
.
prototype
.
updateStatusText
=
function
(
classToRemove
,
classToAdd
,
newStatusText
)
{
$
(
'
.detail-page-header .status-box
'
)
$
(
'
.detail-page-header .status-box
'
)
.
removeClass
(
classToRemove
)
.
removeClass
(
classToRemove
)
.
addClass
(
classToAdd
)
.
addClass
(
classToAdd
)
.
find
(
'
span
'
)
.
find
(
'
span
'
)
.
text
(
newStatusText
);
.
text
(
newStatusText
);
};
};
MergeRequest
.
prototype
.
decreaseCounter
=
function
(
by
=
1
)
{
MergeRequest
.
prototype
.
decreaseCounter
=
function
(
by
=
1
)
{
const
$el
=
$
(
'
.nav-links .js-merge-counter
'
);
const
$el
=
$
(
'
.nav-links .js-merge-counter
'
);
const
count
=
Math
.
max
((
parseInt
(
$el
.
text
().
replace
(
/
[^\d]
/
,
''
),
10
)
-
by
),
0
);
const
count
=
Math
.
max
((
parseInt
(
$el
.
text
().
replace
(
/
[^\d]
/
,
''
),
10
)
-
by
),
0
);
$el
.
text
(
addDelimiter
(
count
));
$el
.
text
(
addDelimiter
(
count
));
};
};
MergeRequest
.
prototype
.
hideCloseButton
=
function
()
{
MergeRequest
.
prototype
.
hideCloseButton
=
function
()
{
const
el
=
document
.
querySelector
(
'
.merge-request .js-issuable-actions
'
);
const
el
=
document
.
querySelector
(
'
.merge-request .js-issuable-actions
'
);
const
closeDropdownItem
=
el
.
querySelector
(
'
li.close-item
'
);
const
closeDropdownItem
=
el
.
querySelector
(
'
li.close-item
'
);
if
(
closeDropdownItem
)
{
if
(
closeDropdownItem
)
{
...
@@ -141,8 +138,6 @@ import { addDelimiter } from './lib/utils/text_utility';
...
@@ -141,8 +138,6 @@ import { addDelimiter } from './lib/utils/text_utility';
}
}
// Dropdown for mobile screen
// Dropdown for mobile screen
el
.
querySelector
(
'
li.js-close-item
'
).
classList
.
add
(
'
hidden
'
);
el
.
querySelector
(
'
li.js-close-item
'
).
classList
.
add
(
'
hidden
'
);
};
};
return
MergeRequest
;
export
default
MergeRequest
;
})();
}).
call
(
window
);
app/assets/javascripts/repo/components/repo_preview.vue
View file @
6a335871
<
script
>
<
script
>
/* global LineHighlighter */
import
{
mapGetters
}
from
'
vuex
'
;
import
{
mapGetters
}
from
'
vuex
'
;
import
LineHighlighter
from
'
../../line_highlighter
'
;
import
syntaxHighlight
from
'
../../syntax_highlight
'
;
import
syntaxHighlight
from
'
../../syntax_highlight
'
;
export
default
{
export
default
{
...
...
app/assets/javascripts/right_sidebar.js
View file @
6a335871
...
@@ -3,25 +3,29 @@
...
@@ -3,25 +3,29 @@
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
(
function
()
{
function
Sidebar
(
currentUser
)
{
this
.
Sidebar
=
(
function
()
{
function
Sidebar
(
currentUser
)
{
this
.
toggleTodo
=
this
.
toggleTodo
.
bind
(
this
);
this
.
toggleTodo
=
this
.
toggleTodo
.
bind
(
this
);
this
.
sidebar
=
$
(
'
aside
'
);
this
.
sidebar
=
$
(
'
aside
'
);
this
.
removeListeners
();
this
.
removeListeners
();
this
.
addEventListeners
();
this
.
addEventListeners
();
}
Sidebar
.
initialize
=
function
(
currentUser
)
{
if
(
!
this
.
instance
)
{
this
.
instance
=
new
Sidebar
(
currentUser
);
}
}
};
Sidebar
.
prototype
.
removeListeners
=
function
()
{
Sidebar
.
prototype
.
removeListeners
=
function
()
{
this
.
sidebar
.
off
(
'
click
'
,
'
.sidebar-collapsed-icon
'
);
this
.
sidebar
.
off
(
'
click
'
,
'
.sidebar-collapsed-icon
'
);
this
.
sidebar
.
off
(
'
hidden.gl.dropdown
'
);
this
.
sidebar
.
off
(
'
hidden.gl.dropdown
'
);
$
(
'
.dropdown
'
).
off
(
'
loading.gl.dropdown
'
);
$
(
'
.dropdown
'
).
off
(
'
loading.gl.dropdown
'
);
$
(
'
.dropdown
'
).
off
(
'
loaded.gl.dropdown
'
);
$
(
'
.dropdown
'
).
off
(
'
loaded.gl.dropdown
'
);
$
(
document
).
off
(
'
click
'
,
'
.js-sidebar-toggle
'
);
$
(
document
).
off
(
'
click
'
,
'
.js-sidebar-toggle
'
);
};
};
Sidebar
.
prototype
.
addEventListeners
=
function
()
{
Sidebar
.
prototype
.
addEventListeners
=
function
()
{
const
$document
=
$
(
document
);
const
$document
=
$
(
document
);
this
.
sidebar
.
on
(
'
click
'
,
'
.sidebar-collapsed-icon
'
,
this
,
this
.
sidebarCollapseClicked
);
this
.
sidebar
.
on
(
'
click
'
,
'
.sidebar-collapsed-icon
'
,
this
,
this
.
sidebarCollapseClicked
);
...
@@ -31,9 +35,9 @@ import Cookies from 'js-cookie';
...
@@ -31,9 +35,9 @@ import Cookies from 'js-cookie';
$document
.
on
(
'
click
'
,
'
.js-sidebar-toggle
'
,
this
.
sidebarToggleClicked
);
$document
.
on
(
'
click
'
,
'
.js-sidebar-toggle
'
,
this
.
sidebarToggleClicked
);
return
$
(
document
).
off
(
'
click
'
,
'
.js-issuable-todo
'
).
on
(
'
click
'
,
'
.js-issuable-todo
'
,
this
.
toggleTodo
);
return
$
(
document
).
off
(
'
click
'
,
'
.js-issuable-todo
'
).
on
(
'
click
'
,
'
.js-issuable-todo
'
,
this
.
toggleTodo
);
};
};
Sidebar
.
prototype
.
sidebarToggleClicked
=
function
(
e
,
triggered
)
{
Sidebar
.
prototype
.
sidebarToggleClicked
=
function
(
e
,
triggered
)
{
var
$allGutterToggleIcons
,
$this
,
$thisIcon
;
var
$allGutterToggleIcons
,
$this
,
$thisIcon
;
e
.
preventDefault
();
e
.
preventDefault
();
$this
=
$
(
this
);
$this
=
$
(
this
);
...
@@ -53,9 +57,9 @@ import Cookies from 'js-cookie';
...
@@ -53,9 +57,9 @@ import Cookies from 'js-cookie';
if
(
!
triggered
)
{
if
(
!
triggered
)
{
Cookies
.
set
(
"
collapsed_gutter
"
,
$
(
'
.right-sidebar
'
).
hasClass
(
'
right-sidebar-collapsed
'
));
Cookies
.
set
(
"
collapsed_gutter
"
,
$
(
'
.right-sidebar
'
).
hasClass
(
'
right-sidebar-collapsed
'
));
}
}
};
};
Sidebar
.
prototype
.
toggleTodo
=
function
(
e
)
{
Sidebar
.
prototype
.
toggleTodo
=
function
(
e
)
{
var
$btnText
,
$this
,
$todoLoading
,
ajaxType
,
url
;
var
$btnText
,
$this
,
$todoLoading
,
ajaxType
,
url
;
$this
=
$
(
e
.
currentTarget
);
$this
=
$
(
e
.
currentTarget
);
ajaxType
=
$this
.
attr
(
'
data-delete-path
'
)
?
'
DELETE
'
:
'
POST
'
;
ajaxType
=
$this
.
attr
(
'
data-delete-path
'
)
?
'
DELETE
'
:
'
POST
'
;
...
@@ -86,9 +90,9 @@ import Cookies from 'js-cookie';
...
@@ -86,9 +90,9 @@ import Cookies from 'js-cookie';
return
_this
.
todoUpdateDone
(
data
);
return
_this
.
todoUpdateDone
(
data
);
};
};
})(
this
));
})(
this
));
};
};
Sidebar
.
prototype
.
todoUpdateDone
=
function
(
data
)
{
Sidebar
.
prototype
.
todoUpdateDone
=
function
(
data
)
{
const
deletePath
=
data
.
delete_path
?
data
.
delete_path
:
null
;
const
deletePath
=
data
.
delete_path
?
data
.
delete_path
:
null
;
const
attrPrefix
=
deletePath
?
'
mark
'
:
'
todo
'
;
const
attrPrefix
=
deletePath
?
'
mark
'
:
'
todo
'
;
const
$todoBtns
=
$
(
'
.js-issuable-todo
'
);
const
$todoBtns
=
$
(
'
.js-issuable-todo
'
);
...
@@ -115,9 +119,9 @@ import Cookies from 'js-cookie';
...
@@ -115,9 +119,9 @@ import Cookies from 'js-cookie';
$elText
.
text
(
$el
.
data
(
`
${
attrPrefix
}
-text`
));
$elText
.
text
(
$el
.
data
(
`
${
attrPrefix
}
-text`
));
}
}
});
});
};
};
Sidebar
.
prototype
.
sidebarDropdownLoading
=
function
(
e
)
{
Sidebar
.
prototype
.
sidebarDropdownLoading
=
function
(
e
)
{
var
$loading
,
$sidebarCollapsedIcon
,
i
,
img
;
var
$loading
,
$sidebarCollapsedIcon
,
i
,
img
;
$sidebarCollapsedIcon
=
$
(
this
).
closest
(
'
.block
'
).
find
(
'
.sidebar-collapsed-icon
'
);
$sidebarCollapsedIcon
=
$
(
this
).
closest
(
'
.block
'
).
find
(
'
.sidebar-collapsed-icon
'
);
img
=
$sidebarCollapsedIcon
.
find
(
'
img
'
);
img
=
$sidebarCollapsedIcon
.
find
(
'
img
'
);
...
@@ -130,9 +134,9 @@ import Cookies from 'js-cookie';
...
@@ -130,9 +134,9 @@ import Cookies from 'js-cookie';
i
.
before
(
$loading
);
i
.
before
(
$loading
);
return
i
.
hide
();
return
i
.
hide
();
}
}
};
};
Sidebar
.
prototype
.
sidebarDropdownLoaded
=
function
(
e
)
{
Sidebar
.
prototype
.
sidebarDropdownLoaded
=
function
(
e
)
{
var
$sidebarCollapsedIcon
,
i
,
img
;
var
$sidebarCollapsedIcon
,
i
,
img
;
$sidebarCollapsedIcon
=
$
(
this
).
closest
(
'
.block
'
).
find
(
'
.sidebar-collapsed-icon
'
);
$sidebarCollapsedIcon
=
$
(
this
).
closest
(
'
.block
'
).
find
(
'
.sidebar-collapsed-icon
'
);
img
=
$sidebarCollapsedIcon
.
find
(
'
img
'
);
img
=
$sidebarCollapsedIcon
.
find
(
'
img
'
);
...
@@ -143,9 +147,9 @@ import Cookies from 'js-cookie';
...
@@ -143,9 +147,9 @@ import Cookies from 'js-cookie';
}
else
{
}
else
{
return
i
.
show
();
return
i
.
show
();
}
}
};
};
Sidebar
.
prototype
.
sidebarCollapseClicked
=
function
(
e
)
{
Sidebar
.
prototype
.
sidebarCollapseClicked
=
function
(
e
)
{
var
$block
,
sidebar
;
var
$block
,
sidebar
;
if
(
$
(
e
.
currentTarget
).
hasClass
(
'
dont-change-state
'
))
{
if
(
$
(
e
.
currentTarget
).
hasClass
(
'
dont-change-state
'
))
{
return
;
return
;
...
@@ -154,9 +158,9 @@ import Cookies from 'js-cookie';
...
@@ -154,9 +158,9 @@ import Cookies from 'js-cookie';
e
.
preventDefault
();
e
.
preventDefault
();
$block
=
$
(
this
).
closest
(
'
.block
'
);
$block
=
$
(
this
).
closest
(
'
.block
'
);
return
sidebar
.
openDropdown
(
$block
);
return
sidebar
.
openDropdown
(
$block
);
};
};
Sidebar
.
prototype
.
openDropdown
=
function
(
blockOrName
)
{
Sidebar
.
prototype
.
openDropdown
=
function
(
blockOrName
)
{
var
$block
;
var
$block
;
$block
=
_
.
isString
(
blockOrName
)
?
this
.
getBlock
(
blockOrName
)
:
blockOrName
;
$block
=
_
.
isString
(
blockOrName
)
?
this
.
getBlock
(
blockOrName
)
:
blockOrName
;
if
(
!
this
.
isOpen
())
{
if
(
!
this
.
isOpen
())
{
...
@@ -169,34 +173,34 @@ import Cookies from 'js-cookie';
...
@@ -169,34 +173,34 @@ import Cookies from 'js-cookie';
setTimeout
(()
=>
{
setTimeout
(()
=>
{
$block
.
find
(
'
.js-sidebar-dropdown-toggle
'
).
trigger
(
'
click
'
);
$block
.
find
(
'
.js-sidebar-dropdown-toggle
'
).
trigger
(
'
click
'
);
});
});
};
};
Sidebar
.
prototype
.
setCollapseAfterUpdate
=
function
(
$block
)
{
Sidebar
.
prototype
.
setCollapseAfterUpdate
=
function
(
$block
)
{
$block
.
addClass
(
'
collapse-after-update
'
);
$block
.
addClass
(
'
collapse-after-update
'
);
return
$
(
'
.layout-page
'
).
addClass
(
'
with-overlay
'
);
return
$
(
'
.layout-page
'
).
addClass
(
'
with-overlay
'
);
};
};
Sidebar
.
prototype
.
onSidebarDropdownHidden
=
function
(
e
)
{
Sidebar
.
prototype
.
onSidebarDropdownHidden
=
function
(
e
)
{
var
$block
,
sidebar
;
var
$block
,
sidebar
;
sidebar
=
e
.
data
;
sidebar
=
e
.
data
;
e
.
preventDefault
();
e
.
preventDefault
();
$block
=
$
(
e
.
target
).
closest
(
'
.block
'
);
$block
=
$
(
e
.
target
).
closest
(
'
.block
'
);
return
sidebar
.
sidebarDropdownHidden
(
$block
);
return
sidebar
.
sidebarDropdownHidden
(
$block
);
};
};
Sidebar
.
prototype
.
sidebarDropdownHidden
=
function
(
$block
)
{
Sidebar
.
prototype
.
sidebarDropdownHidden
=
function
(
$block
)
{
if
(
$block
.
hasClass
(
'
collapse-after-update
'
))
{
if
(
$block
.
hasClass
(
'
collapse-after-update
'
))
{
$block
.
removeClass
(
'
collapse-after-update
'
);
$block
.
removeClass
(
'
collapse-after-update
'
);
$
(
'
.layout-page
'
).
removeClass
(
'
with-overlay
'
);
$
(
'
.layout-page
'
).
removeClass
(
'
with-overlay
'
);
return
this
.
toggleSidebar
(
'
hide
'
);
return
this
.
toggleSidebar
(
'
hide
'
);
}
}
};
};
Sidebar
.
prototype
.
triggerOpenSidebar
=
function
()
{
Sidebar
.
prototype
.
triggerOpenSidebar
=
function
()
{
return
this
.
sidebar
.
find
(
'
.js-sidebar-toggle
'
).
trigger
(
'
click
'
);
return
this
.
sidebar
.
find
(
'
.js-sidebar-toggle
'
).
trigger
(
'
click
'
);
};
};
Sidebar
.
prototype
.
toggleSidebar
=
function
(
action
)
{
Sidebar
.
prototype
.
toggleSidebar
=
function
(
action
)
{
if
(
action
==
null
)
{
if
(
action
==
null
)
{
action
=
'
toggle
'
;
action
=
'
toggle
'
;
}
}
...
@@ -213,16 +217,14 @@ import Cookies from 'js-cookie';
...
@@ -213,16 +217,14 @@ import Cookies from 'js-cookie';
return
this
.
triggerOpenSidebar
();
return
this
.
triggerOpenSidebar
();
}
}
}
}
};
};
Sidebar
.
prototype
.
isOpen
=
function
()
{
Sidebar
.
prototype
.
isOpen
=
function
()
{
return
this
.
sidebar
.
is
(
'
.right-sidebar-expanded
'
);
return
this
.
sidebar
.
is
(
'
.right-sidebar-expanded
'
);
};
};
Sidebar
.
prototype
.
getBlock
=
function
(
name
)
{
Sidebar
.
prototype
.
getBlock
=
function
(
name
)
{
return
this
.
sidebar
.
find
(
"
.block.
"
+
name
);
return
this
.
sidebar
.
find
(
"
.block.
"
+
name
);
};
};
return
Sidebar
;
export
default
Sidebar
;
})();
}).
call
(
window
);
app/assets/javascripts/shortcuts_issuable.js
View file @
6a335871
/* global Mousetrap */
/* global Mousetrap */
/* global sidebar */
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
'
mousetrap
'
;
import
'
mousetrap
'
;
import
Sidebar
from
'
./right_sidebar
'
;
import
ShortcutsNavigation
from
'
./shortcuts_navigation
'
;
import
ShortcutsNavigation
from
'
./shortcuts_navigation
'
;
import
{
CopyAsGFM
}
from
'
./behaviors/copy_as_gfm
'
;
import
{
CopyAsGFM
}
from
'
./behaviors/copy_as_gfm
'
;
...
@@ -69,7 +69,7 @@ export default class ShortcutsIssuable extends ShortcutsNavigation {
...
@@ -69,7 +69,7 @@ export default class ShortcutsIssuable extends ShortcutsNavigation {
}
}
static
openSidebarDropdown
(
name
)
{
static
openSidebarDropdown
(
name
)
{
sidebar
.
openDropdown
(
name
);
Sidebar
.
instance
.
openDropdown
(
name
);
return
false
;
return
false
;
}
}
}
}
spec/javascripts/collapsed_sidebar_todo_spec.js
View file @
6a335871
/* global Sidebar */
/* eslint-disable no-new */
/* eslint-disable no-new */
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
'
~/right_sidebar
'
;
import
Sidebar
from
'
~/right_sidebar
'
;
describe
(
'
Issuable right sidebar collapsed todo toggle
'
,
()
=>
{
describe
(
'
Issuable right sidebar collapsed todo toggle
'
,
()
=>
{
const
fixtureName
=
'
issues/open-issue.html.raw
'
;
const
fixtureName
=
'
issues/open-issue.html.raw
'
;
...
...
spec/javascripts/line_highlighter_spec.js
View file @
6a335871
/* eslint-disable space-before-function-paren, no-var, no-param-reassign, quotes, prefer-template, no-else-return, new-cap, dot-notation, no-return-assign, comma-dangle, no-new, one-var, one-var-declaration-per-line, jasmine/no-spec-dupes, no-underscore-dangle, max-len */
/* eslint-disable space-before-function-paren, no-var, no-param-reassign, quotes, prefer-template, no-else-return, new-cap, dot-notation, no-return-assign, comma-dangle, no-new, one-var, one-var-declaration-per-line, jasmine/no-spec-dupes, no-underscore-dangle, max-len */
/* global LineHighlighter */
import
'
~/line_highlighter
'
;
import
LineHighlighter
from
'
~/line_highlighter
'
;
(
function
()
{
(
function
()
{
describe
(
'
LineHighlighter
'
,
function
()
{
describe
(
'
LineHighlighter
'
,
function
()
{
...
...
spec/javascripts/merge_request_spec.js
View file @
6a335871
/* eslint-disable space-before-function-paren, no-return-assign */
/* eslint-disable space-before-function-paren, no-return-assign */
/* global MergeRequest */
import
'
~/merge_request
'
;
import
MergeRequest
from
'
~/merge_request
'
;
import
CloseReopenReportToggle
from
'
~/close_reopen_report_toggle
'
;
import
CloseReopenReportToggle
from
'
~/close_reopen_report_toggle
'
;
import
IssuablesHelper
from
'
~/helpers/issuables_helper
'
;
import
IssuablesHelper
from
'
~/helpers/issuables_helper
'
;
...
...
spec/javascripts/right_sidebar_spec.js
View file @
6a335871
/* eslint-disable space-before-function-paren, no-var, one-var, one-var-declaration-per-line, new-parens, no-return-assign, new-cap, vars-on-top, max-len */
/* eslint-disable space-before-function-paren, no-var, one-var, one-var-declaration-per-line, new-parens, no-return-assign, new-cap, vars-on-top, max-len */
/* global Sidebar */
import
'
~/commons/bootstrap
'
;
import
'
~/commons/bootstrap
'
;
import
'
~/right_sidebar
'
;
import
Sidebar
from
'
~/right_sidebar
'
;
(
function
()
{
(
function
()
{
var
$aside
,
$icon
,
$labelsIcon
,
$page
,
$toggle
,
assertSidebarState
;
var
$aside
,
$icon
,
$labelsIcon
,
$page
,
$toggle
,
assertSidebarState
;
...
...
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