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
94743e0e
Commit
94743e0e
authored
Oct 26, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove issuable form from global namespace
parent
a665a354
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
102 deletions
+98
-102
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
+1
-1
app/assets/javascripts/issuable_form.js
app/assets/javascripts/issuable_form.js
+96
-99
spec/javascripts/labels_issue_sidebar_spec.js
spec/javascripts/labels_issue_sidebar_spec.js
+0
-1
No files found.
app/assets/javascripts/boards/components/board_sidebar.js
View file @
94743e0e
/* eslint-disable comma-dangle, space-before-function-paren, no-new */
/* eslint-disable comma-dangle, space-before-function-paren, no-new */
import
IssuableContext
from
'
../../issuable_context
'
;
/* global MilestoneSelect */
/* global MilestoneSelect */
/* global LabelsSelect */
/* global LabelsSelect */
/* global Sidebar */
/* global Sidebar */
...
@@ -11,6 +10,7 @@ import AssigneeTitle from '../../sidebar/components/assignees/assignee_title';
...
@@ -11,6 +10,7 @@ import AssigneeTitle from '../../sidebar/components/assignees/assignee_title';
import
Assignees
from
'
../../sidebar/components/assignees/assignees
'
;
import
Assignees
from
'
../../sidebar/components/assignees/assignees
'
;
import
DueDateSelectors
from
'
../../due_date_select
'
;
import
DueDateSelectors
from
'
../../due_date_select
'
;
import
'
./sidebar/remove_issue
'
;
import
'
./sidebar/remove_issue
'
;
import
IssuableContext
from
'
../../issuable_context
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
...
...
app/assets/javascripts/dispatcher.js
View file @
94743e0e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/* global ProjectSelect */
/* global ProjectSelect */
import
IssuableIndex
from
'
./issuable_index
'
;
import
IssuableIndex
from
'
./issuable_index
'
;
/* global Milestone */
/* global Milestone */
/* global IssuableForm */
import
IssuableForm
from
'
./issuable_form
'
;
/* global LabelsSelect */
/* global LabelsSelect */
/* global MilestoneSelect */
/* global MilestoneSelect */
/* global NewBranchForm */
/* global NewBranchForm */
...
...
app/assets/javascripts/issuable_form.js
View file @
94743e0e
/* eslint-disable func-names,
space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-use-before-define, no-useless-escape, no-new, quotes
, object-shorthand, no-unused-vars, comma-dangle, no-alert, consistent-return, no-else-return, prefer-template, one-var, one-var-declaration-per-line, curly, max-len */
/* eslint-disable func-names,
prefer-rest-params, wrap-iife, no-use-before-define, no-useless-escape, no-new
, object-shorthand, no-unused-vars, comma-dangle, no-alert, consistent-return, no-else-return, prefer-template, one-var, one-var-declaration-per-line, curly, max-len */
/* global GitLab */
/* global GitLab */
/* global Autosave */
/* global Autosave */
...
@@ -8,103 +8,100 @@ import GfmAutoComplete from './gfm_auto_complete';
...
@@ -8,103 +8,100 @@ import GfmAutoComplete from './gfm_auto_complete';
import
ZenMode
from
'
./zen_mode
'
;
import
ZenMode
from
'
./zen_mode
'
;
import
{
parsePikadayDate
,
pikadayToString
}
from
'
./lib/utils/datefix
'
;
import
{
parsePikadayDate
,
pikadayToString
}
from
'
./lib/utils/datefix
'
;
(
function
()
{
export
default
class
IssuableForm
{
this
.
IssuableForm
=
(
function
()
{
constructor
(
form
)
{
IssuableForm
.
prototype
.
wipRegex
=
/^
\s
*
(\[
WIP
\]\s
*|WIP:
\s
*|WIP
\s
+
)
+
\s
*/i
;
this
.
form
=
form
;
this
.
toggleWip
=
this
.
toggleWip
.
bind
(
this
);
function
IssuableForm
(
form
)
{
this
.
renderWipExplanation
=
this
.
renderWipExplanation
.
bind
(
this
);
var
$issuableDueDate
,
calendar
;
this
.
resetAutosave
=
this
.
resetAutosave
.
bind
(
this
);
this
.
form
=
form
;
this
.
handleSubmit
=
this
.
handleSubmit
.
bind
(
this
);
this
.
toggleWip
=
this
.
toggleWip
.
bind
(
this
);
this
.
wipRegex
=
/^
\s
*
(\[
WIP
\]\s
*|WIP:
\s
*|WIP
\s
+
)
+
\s
*/i
;
this
.
renderWipExplanation
=
this
.
renderWipExplanation
.
bind
(
this
);
this
.
resetAutosave
=
this
.
resetAutosave
.
bind
(
this
);
new
GfmAutoComplete
(
gl
.
GfmAutoComplete
&&
gl
.
GfmAutoComplete
.
dataSources
).
setup
();
this
.
handleSubmit
=
this
.
handleSubmit
.
bind
(
this
);
new
UsersSelect
();
new
GfmAutoComplete
(
gl
.
GfmAutoComplete
&&
gl
.
GfmAutoComplete
.
dataSources
).
setup
();
new
ZenMode
();
new
UsersSelect
();
new
ZenMode
();
this
.
titleField
=
this
.
form
.
find
(
'
input[name*="[title]"]
'
);
this
.
titleField
=
this
.
form
.
find
(
"
input[name*='[title]']
"
);
this
.
descriptionField
=
this
.
form
.
find
(
'
textarea[name*="[description]"]
'
);
this
.
descriptionField
=
this
.
form
.
find
(
"
textarea[name*='[description]']
"
);
if
(
!
(
this
.
titleField
.
length
&&
this
.
descriptionField
.
length
))
{
if
(
!
(
this
.
titleField
.
length
&&
this
.
descriptionField
.
length
))
{
return
;
return
;
}
this
.
initAutosave
();
this
.
form
.
on
(
"
submit
"
,
this
.
handleSubmit
);
this
.
form
.
on
(
"
click
"
,
"
.btn-cancel
"
,
this
.
resetAutosave
);
this
.
initWip
();
$issuableDueDate
=
$
(
'
#issuable-due-date
'
);
if
(
$issuableDueDate
.
length
)
{
calendar
=
new
Pikaday
({
field
:
$issuableDueDate
.
get
(
0
),
theme
:
'
gitlab-theme animate-picker
'
,
format
:
'
yyyy-mm-dd
'
,
container
:
$issuableDueDate
.
parent
().
get
(
0
),
parse
:
dateString
=>
parsePikadayDate
(
dateString
),
toString
:
date
=>
pikadayToString
(
date
),
onSelect
:
function
(
dateText
)
{
$issuableDueDate
.
val
(
calendar
.
toString
(
dateText
));
}
});
calendar
.
setDate
(
parsePikadayDate
(
$issuableDueDate
.
val
()));
}
}
}
IssuableForm
.
prototype
.
initAutosave
=
function
()
{
this
.
initAutosave
();
new
Autosave
(
this
.
titleField
,
[
document
.
location
.
pathname
,
document
.
location
.
search
,
"
title
"
]);
this
.
form
.
on
(
'
submit
'
,
this
.
handleSubmit
);
return
new
Autosave
(
this
.
descriptionField
,
[
document
.
location
.
pathname
,
document
.
location
.
search
,
"
description
"
]);
this
.
form
.
on
(
'
click
'
,
'
.btn-cancel
'
,
this
.
resetAutosave
);
};
this
.
initWip
();
IssuableForm
.
prototype
.
handleSubmit
=
function
()
{
const
$issuableDueDate
=
$
(
'
#issuable-due-date
'
);
return
this
.
resetAutosave
();
};
if
(
$issuableDueDate
.
length
)
{
const
calendar
=
new
Pikaday
({
IssuableForm
.
prototype
.
resetAutosave
=
function
()
{
field
:
$issuableDueDate
.
get
(
0
),
this
.
titleField
.
data
(
"
autosave
"
).
reset
();
theme
:
'
gitlab-theme animate-picker
'
,
return
this
.
descriptionField
.
data
(
"
autosave
"
).
reset
();
format
:
'
yyyy-mm-dd
'
,
};
container
:
$issuableDueDate
.
parent
().
get
(
0
),
parse
:
dateString
=>
parsePikadayDate
(
dateString
),
IssuableForm
.
prototype
.
initWip
=
function
()
{
toString
:
date
=>
pikadayToString
(
date
),
this
.
$wipExplanation
=
this
.
form
.
find
(
"
.js-wip-explanation
"
);
onSelect
:
dateText
=>
$issuableDueDate
.
val
(
calendar
.
toString
(
dateText
)),
this
.
$noWipExplanation
=
this
.
form
.
find
(
"
.js-no-wip-explanation
"
);
});
if
(
!
(
this
.
$wipExplanation
.
length
&&
this
.
$noWipExplanation
.
length
))
{
calendar
.
setDate
(
parsePikadayDate
(
$issuableDueDate
.
val
()));
return
;
}
}
}
this
.
form
.
on
(
"
click
"
,
"
.js-toggle-wip
"
,
this
.
toggleWip
);
this
.
titleField
.
on
(
"
keyup blur
"
,
this
.
renderWipExplanation
);
initAutosave
()
{
return
this
.
renderWipExplanation
();
new
Autosave
(
this
.
titleField
,
[
document
.
location
.
pathname
,
document
.
location
.
search
,
'
title
'
]);
};
return
new
Autosave
(
this
.
descriptionField
,
[
document
.
location
.
pathname
,
document
.
location
.
search
,
'
description
'
]);
}
IssuableForm
.
prototype
.
workInProgress
=
function
()
{
return
this
.
wipRegex
.
test
(
this
.
titleField
.
val
());
handleSubmit
()
{
};
return
this
.
resetAutosave
();
}
IssuableForm
.
prototype
.
renderWipExplanation
=
function
()
{
if
(
this
.
workInProgress
())
{
resetAutosave
()
{
this
.
$wipExplanation
.
show
();
this
.
titleField
.
data
(
'
autosave
'
).
reset
();
return
this
.
$noWipExplanation
.
hide
();
return
this
.
descriptionField
.
data
(
'
autosave
'
).
reset
();
}
else
{
}
this
.
$wipExplanation
.
hide
();
return
this
.
$noWipExplanation
.
show
();
initWip
()
{
}
this
.
$wipExplanation
=
this
.
form
.
find
(
'
.js-wip-explanation
'
);
};
this
.
$noWipExplanation
=
this
.
form
.
find
(
'
.js-no-wip-explanation
'
);
if
(
!
(
this
.
$wipExplanation
.
length
&&
this
.
$noWipExplanation
.
length
))
{
IssuableForm
.
prototype
.
toggleWip
=
function
(
event
)
{
return
;
event
.
preventDefault
();
}
if
(
this
.
workInProgress
())
{
this
.
form
.
on
(
'
click
'
,
'
.js-toggle-wip
'
,
this
.
toggleWip
);
this
.
removeWip
();
this
.
titleField
.
on
(
'
keyup blur
'
,
this
.
renderWipExplanation
);
}
else
{
return
this
.
renderWipExplanation
();
this
.
addWip
();
}
}
return
this
.
renderWipExplanation
();
workInProgress
()
{
};
return
this
.
wipRegex
.
test
(
this
.
titleField
.
val
());
}
IssuableForm
.
prototype
.
removeWip
=
function
()
{
return
this
.
titleField
.
val
(
this
.
titleField
.
val
().
replace
(
this
.
wipRegex
,
""
));
renderWipExplanation
()
{
};
if
(
this
.
workInProgress
())
{
this
.
$wipExplanation
.
show
();
IssuableForm
.
prototype
.
addWip
=
function
()
{
return
this
.
$noWipExplanation
.
hide
();
return
this
.
titleField
.
val
(
"
WIP:
"
+
(
this
.
titleField
.
val
()));
}
else
{
};
this
.
$wipExplanation
.
hide
();
return
this
.
$noWipExplanation
.
show
();
return
IssuableForm
;
}
})();
}
}).
call
(
window
);
toggleWip
(
event
)
{
event
.
preventDefault
();
if
(
this
.
workInProgress
())
{
this
.
removeWip
();
}
else
{
this
.
addWip
();
}
return
this
.
renderWipExplanation
();
}
removeWip
()
{
return
this
.
titleField
.
val
(
this
.
titleField
.
val
().
replace
(
this
.
wipRegex
,
''
));
}
addWip
()
{
this
.
titleField
.
val
(
`WIP:
${(
this
.
titleField
.
val
())}
`
);
}
}
spec/javascripts/labels_issue_sidebar_spec.js
View file @
94743e0e
...
@@ -6,7 +6,6 @@ import '~/gl_dropdown';
...
@@ -6,7 +6,6 @@ import '~/gl_dropdown';
import
'
select2
'
;
import
'
select2
'
;
import
'
~/api
'
;
import
'
~/api
'
;
import
'
~/create_label
'
;
import
'
~/create_label
'
;
import
'
~/issuable_context
'
;
import
'
~/users_select
'
;
import
'
~/users_select
'
;
import
'
~/labels_select
'
;
import
'
~/labels_select
'
;
...
...
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