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
a665a354
Commit
a665a354
authored
Oct 26, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove issuableContext from global namespace
parent
cf542f9e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
64 deletions
+60
-64
app/assets/javascripts/boards/components/board_sidebar.js
app/assets/javascripts/boards/components/board_sidebar.js
+1
-1
app/assets/javascripts/init_issuable_sidebar.js
app/assets/javascripts/init_issuable_sidebar.js
+1
-1
app/assets/javascripts/issuable_context.js
app/assets/javascripts/issuable_context.js
+56
-57
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-2
spec/javascripts/issuable_context_spec.js
spec/javascripts/issuable_context_spec.js
+1
-2
spec/javascripts/labels_issue_sidebar_spec.js
spec/javascripts/labels_issue_sidebar_spec.js
+1
-1
No files found.
app/assets/javascripts/boards/components/board_sidebar.js
View file @
a665a354
/* eslint-disable comma-dangle, space-before-function-paren, no-new */
/* eslint-disable comma-dangle, space-before-function-paren, no-new */
/* global IssuableContext */
import
IssuableContext
from
'
../../issuable_context
'
;
/* global MilestoneSelect */
/* global MilestoneSelect */
/* global LabelsSelect */
/* global LabelsSelect */
/* global Sidebar */
/* global Sidebar */
...
...
app/assets/javascripts/init_issuable_sidebar.js
View file @
a665a354
/* eslint-disable no-new */
/* eslint-disable no-new */
/* global MilestoneSelect */
/* global MilestoneSelect */
/* global LabelsSelect */
/* global LabelsSelect */
/* global IssuableContext */
import
IssuableContext
from
'
./issuable_context
'
;
/* global Sidebar */
/* global Sidebar */
import
DueDateSelectors
from
'
./due_date_select
'
;
import
DueDateSelectors
from
'
./due_date_select
'
;
...
...
app/assets/javascripts/issuable_context.js
View file @
a665a354
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-new, comma-dangle, quotes, prefer-arrow-callback, consistent-return, one-var, no-var, one-var-declaration-per-line, no-underscore-dangle, max-len */
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
bp
from
'
./breakpoints
'
;
import
bp
from
'
./breakpoints
'
;
import
UsersSelect
from
'
./users_select
'
;
import
UsersSelect
from
'
./users_select
'
;
const
PARTICIPANTS_ROW_COUNT
=
7
;
const
PARTICIPANTS_ROW_COUNT
=
7
;
(
function
()
{
export
default
class
IssuableContext
{
this
.
IssuableContext
=
(
function
()
{
constructor
(
currentUser
)
{
function
IssuableContext
(
currentUser
)
{
this
.
initParticipants
();
this
.
initParticipants
();
new
UsersSelect
(
currentUser
);
this
.
userSelect
=
new
UsersSelect
(
currentUser
);
$
(
'
select.select2
'
).
select2
({
$
(
'
select.select2
'
).
select2
({
width
:
'
resolve
'
,
width
:
'
resolve
'
,
dropdownAutoWidth
:
true
dropdownAutoWidth
:
true
,
});
});
$
(
"
.issuable-sidebar .inline-update
"
).
on
(
"
change
"
,
"
select
"
,
function
()
{
$
(
'
.issuable-sidebar .inline-update
'
).
on
(
'
change
'
,
'
select
'
,
function
onClickSelect
()
{
return
$
(
this
).
submit
();
return
$
(
this
).
submit
();
});
});
$
(
"
.issuable-sidebar .inline-update
"
).
on
(
"
change
"
,
"
.js-assignee
"
,
function
()
{
$
(
'
.issuable-sidebar .inline-update
'
).
on
(
'
change
'
,
'
.js-assignee
'
,
function
onClickAssignee
()
{
return
$
(
this
).
submit
();
return
$
(
this
).
submit
();
});
});
$
(
document
).
off
(
'
click
'
,
'
.issuable-sidebar .dropdown-content a
'
).
on
(
'
click
'
,
'
.issuable-sidebar .dropdown-content a
'
,
function
(
e
)
{
$
(
document
)
return
e
.
preventDefault
();
.
off
(
'
click
'
,
'
.issuable-sidebar .dropdown-content a
'
)
});
.
on
(
'
click
'
,
'
.issuable-sidebar .dropdown-content a
'
,
e
=>
e
.
preventDefault
());
$
(
document
).
off
(
'
click
'
,
'
.edit-link
'
).
on
(
'
click
'
,
'
.edit-link
'
,
function
(
e
)
{
var
$block
,
$selectbox
;
$
(
document
)
.
off
(
'
click
'
,
'
.edit-link
'
)
.
on
(
'
click
'
,
'
.edit-link
'
,
function
onClickEdit
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
$block
=
$
(
this
).
parents
(
'
.block
'
);
const
$block
=
$
(
this
).
parents
(
'
.block
'
);
$selectbox
=
$block
.
find
(
'
.selectbox
'
);
const
$selectbox
=
$block
.
find
(
'
.selectbox
'
);
if
(
$selectbox
.
is
(
'
:visible
'
))
{
if
(
$selectbox
.
is
(
'
:visible
'
))
{
$selectbox
.
hide
();
$selectbox
.
hide
();
$block
.
find
(
'
.value
'
).
show
();
$block
.
find
(
'
.value
'
).
show
();
...
@@ -35,31 +37,31 @@ const PARTICIPANTS_ROW_COUNT = 7;
...
@@ -35,31 +37,31 @@ const PARTICIPANTS_ROW_COUNT = 7;
$selectbox
.
show
();
$selectbox
.
show
();
$block
.
find
(
'
.value
'
).
hide
();
$block
.
find
(
'
.value
'
).
hide
();
}
}
if
(
$selectbox
.
is
(
'
:visible
'
))
{
if
(
$selectbox
.
is
(
'
:visible
'
))
{
return
setTimeout
(
function
()
{
setTimeout
(()
=>
$block
.
find
(
'
.dropdown-menu-toggle
'
).
trigger
(
'
click
'
),
0
);
return
$block
.
find
(
'
.dropdown-menu-toggle
'
).
trigger
(
'
click
'
);
},
0
);
}
}
});
});
window
.
addEventListener
(
'
beforeunload
'
,
function
()
{
window
.
addEventListener
(
'
beforeunload
'
,
()
=>
{
// collapsed_gutter cookie hides the sidebar
// collapsed_gutter cookie hides the sidebar
var
bpBreakpoint
=
bp
.
getBreakpointSize
();
const
bpBreakpoint
=
bp
.
getBreakpointSize
();
if
(
bpBreakpoint
===
'
xs
'
||
bpBreakpoint
===
'
sm
'
)
{
if
(
bpBreakpoint
===
'
xs
'
||
bpBreakpoint
===
'
sm
'
)
{
Cookies
.
set
(
'
collapsed_gutter
'
,
true
);
Cookies
.
set
(
'
collapsed_gutter
'
,
true
);
}
}
});
});
}
}
IssuableContext
.
prototype
.
initParticipants
=
function
()
{
initParticipants
()
{
$
(
document
).
on
(
'
click
'
,
'
.js-participants-more
'
,
this
.
toggleHiddenParticipants
);
$
(
document
).
on
(
'
click
'
,
'
.js-participants-more
'
,
this
.
toggleHiddenParticipants
);
return
$
(
'
.js-participants-author
'
).
each
(
function
(
i
)
{
return
$
(
'
.js-participants-author
'
).
each
(
function
forEachAuthor
(
i
)
{
if
(
i
>=
PARTICIPANTS_ROW_COUNT
)
{
if
(
i
>=
PARTICIPANTS_ROW_COUNT
)
{
return
$
(
this
).
addClass
(
'
js-participants-hidden
'
).
hide
();
$
(
this
).
addClass
(
'
js-participants-hidden
'
).
hide
();
}
}
});
});
};
}
IssuableContext
.
prototype
.
toggleHiddenParticipants
=
function
()
{
toggleHiddenParticipants
()
{
const
currentText
=
$
(
this
).
text
().
trim
();
const
currentText
=
$
(
this
).
text
().
trim
();
const
lessText
=
$
(
this
).
data
(
'
less-text
'
);
const
lessText
=
$
(
this
).
data
(
'
less-text
'
);
const
originalText
=
$
(
this
).
data
(
'
original-text
'
);
const
originalText
=
$
(
this
).
data
(
'
original-text
'
);
...
@@ -73,8 +75,5 @@ const PARTICIPANTS_ROW_COUNT = 7;
...
@@ -73,8 +75,5 @@ const PARTICIPANTS_ROW_COUNT = 7;
}
}
$
(
'
.js-participants-hidden
'
).
toggle
();
$
(
'
.js-participants-hidden
'
).
toggle
();
};
}
}
return
IssuableContext
;
})();
}).
call
(
window
);
app/assets/javascripts/main.js
View file @
a665a354
...
@@ -58,8 +58,6 @@ import './gl_form';
...
@@ -58,8 +58,6 @@ import './gl_form';
import
'
./groups_select
'
;
import
'
./groups_select
'
;
import
'
./header
'
;
import
'
./header
'
;
import
initImporterStatus
from
'
./importer_status
'
;
import
initImporterStatus
from
'
./importer_status
'
;
import
'
./issuable_index
'
;
import
'
./issuable_context
'
;
import
'
./issuable_form
'
;
import
'
./issuable_form
'
;
import
'
./issue
'
;
import
'
./issue
'
;
import
'
./issue_status_select
'
;
import
'
./issue_status_select
'
;
...
...
spec/javascripts/issuable_context_spec.js
View file @
a665a354
/* global IssuableContext */
import
'
~/issuable_context
'
;
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
IssuableContext
from
'
~/issuable_context
'
;
describe
(
'
IssuableContext
'
,
()
=>
{
describe
(
'
IssuableContext
'
,
()
=>
{
describe
(
'
toggleHiddenParticipants
'
,
()
=>
{
describe
(
'
toggleHiddenParticipants
'
,
()
=>
{
...
...
spec/javascripts/labels_issue_sidebar_spec.js
View file @
a665a354
/* eslint-disable no-new */
/* eslint-disable no-new */
/* global IssuableContext */
import
IssuableContext
from
'
~/issuable_context
'
;
/* global LabelsSelect */
/* global LabelsSelect */
import
'
~/gl_dropdown
'
;
import
'
~/gl_dropdown
'
;
...
...
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