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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
df6f6e31
Commit
df6f6e31
authored
Jan 04, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced more jQuery UI datepickers
parent
b138ec3d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
25 deletions
+70
-25
app/assets/javascripts/dispatcher.js.es6
app/assets/javascripts/dispatcher.js.es6
+1
-0
app/assets/javascripts/due_date_select.js.es6
app/assets/javascripts/due_date_select.js.es6
+38
-11
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+5
-1
app/assets/javascripts/issuable_form.js
app/assets/javascripts/issuable_form.js
+2
-1
app/assets/javascripts/member_expiration_date.js.es6
app/assets/javascripts/member_expiration_date.js.es6
+24
-9
app/views/shared/milestones/_form_dates.html.haml
app/views/shared/milestones/_form_dates.html.haml
+0
-3
No files found.
app/assets/javascripts/dispatcher.js.es6
View file @
df6f6e31
...
@@ -96,6 +96,7 @@
...
@@ -96,6 +96,7 @@
break;
break;
case 'projects:milestones:new':
case 'projects:milestones:new':
case 'projects:milestones:edit':
case 'projects:milestones:edit':
case 'projects:milestones:update':
new ZenMode();
new ZenMode();
new gl.DueDateSelectors();
new gl.DueDateSelectors();
new gl.GLForm($('.milestone-form'));
new gl.GLForm($('.milestone-form'));
...
...
app/assets/javascripts/due_date_select.js.es6
View file @
df6f6e31
/* eslint-disable wrap-iife, func-names, space-before-function-paren, comma-dangle, prefer-template, consistent-return, class-methods-use-this, arrow-body-style, no-unused-vars, no-underscore-dangle, no-new, max-len, no-sequences, no-unused-expressions, no-param-reassign */
/* eslint-disable wrap-iife, func-names, space-before-function-paren, comma-dangle, prefer-template, consistent-return, class-methods-use-this, arrow-body-style, no-unused-vars, no-underscore-dangle, no-new, max-len, no-sequences, no-unused-expressions, no-param-reassign */
/* global dateFormat */
/* global dateFormat */
/* global Pikaday */
(function(global) {
(function(global) {
class DueDateSelect {
class DueDateSelect {
...
@@ -31,6 +32,10 @@
...
@@ -31,6 +32,10 @@
initGlDropdown() {
initGlDropdown() {
this.$dropdown.glDropdown({
this.$dropdown.glDropdown({
opened: () => {
const calendar = this.$datePicker.data('pikaday');
calendar.show();
},
hidden: () => {
hidden: () => {
this.$selectbox.hide();
this.$selectbox.hide();
this.$value.css('display', '');
this.$value.css('display', '');
...
@@ -39,25 +44,37 @@
...
@@ -39,25 +44,37 @@
}
}
initDatePicker() {
initDatePicker() {
this.$datePicker.datepicker({
const $dueDateInput = $(`input[name='${this.fieldName}']`);
dateFormat: 'yy-mm-dd',
defaultDate: $("input[name='" + this.fieldName + "']").val(),
const calendar = new Pikaday({
altField: "input[name='" + this.fieldName + "']",
field: $dueDateInput.get(0),
onSelect: () => {
format: 'yyyy-mm-dd',
defaultDate: new Date($dueDateInput.val()),
onSelect: (dateText) => {
const formattedDate = dateFormat(new Date(dateText), 'yyyy-mm-dd');
$dueDateInput.val(formattedDate);
if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
gl.issueBoards.BoardsStore.detail.issue.dueDate = $
(`input[name='${this.fieldName}']`)
.val();
gl.issueBoards.BoardsStore.detail.issue.dueDate = $
dueDateInput
.val();
this.updateIssueBoardIssue();
this.updateIssueBoardIssue();
} else {
} else {
return
this.saveDueDate(true);
this.saveDueDate(true);
}
}
}
}
});
});
this.$datePicker.append(calendar.el);
this.$datePicker.data('pikaday', calendar);
}
}
initRemoveDueDate() {
initRemoveDueDate() {
this.$block.on('click', '.js-remove-due-date', (e) => {
this.$block.on('click', '.js-remove-due-date', (e) => {
const calendar = this.$datePicker.data('pikaday');
e.preventDefault();
e.preventDefault();
calendar.setDate(null);
if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
gl.issueBoards.BoardsStore.detail.issue.dueDate = '';
gl.issueBoards.BoardsStore.detail.issue.dueDate = '';
this.updateIssueBoardIssue();
this.updateIssueBoardIssue();
...
@@ -154,14 +171,24 @@
...
@@ -154,14 +171,24 @@
}
}
initMilestoneDatePicker() {
initMilestoneDatePicker() {
$('.datepicker').datepicker({
$('.datepicker').each(function() {
dateFormat: 'yy-mm-dd'
const $datePicker = $(this);
const calendar = new Pikaday({
field: $datePicker.get(0),
format: 'yyyy-mm-dd',
defaultDate: new Date($datePicker.val()),
onSelect(dateText) {
$datePicker.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
}
});
$datePicker.data('pikaday', calendar);
});
});
$('.js-clear-due-date,.js-clear-start-date').on('click', (e) => {
$('.js-clear-due-date,.js-clear-start-date').on('click', (e) => {
e.preventDefault();
e.preventDefault();
const
datepicker = $(e.target).siblings('.datepicker
');
const
calendar = $(e.target).siblings('.datepicker').data('pikaday
');
$.datepicker._clearDate(datepicker
);
calendar.setDate(null
);
});
});
}
}
...
...
app/assets/javascripts/gl_dropdown.js
View file @
df6f6e31
...
@@ -437,7 +437,7 @@
...
@@ -437,7 +437,7 @@
}
}
};
};
GitLabDropdown
.
prototype
.
opened
=
function
()
{
GitLabDropdown
.
prototype
.
opened
=
function
(
e
)
{
var
contentHtml
;
var
contentHtml
;
this
.
resetRows
();
this
.
resetRows
();
this
.
addArrowKeyEvent
();
this
.
addArrowKeyEvent
();
...
@@ -457,6 +457,10 @@
...
@@ -457,6 +457,10 @@
this
.
positionMenuAbove
();
this
.
positionMenuAbove
();
}
}
if
(
this
.
options
.
opened
)
{
this
.
options
.
opened
.
call
(
this
,
e
);
}
return
this
.
dropdown
.
trigger
(
'
shown.gl.dropdown
'
);
return
this
.
dropdown
.
trigger
(
'
shown.gl.dropdown
'
);
};
};
...
...
app/assets/javascripts/issuable_form.js
View file @
df6f6e31
...
@@ -40,10 +40,11 @@
...
@@ -40,10 +40,11 @@
new
Pikaday
({
new
Pikaday
({
field
:
$issuableDueDate
.
get
(
0
),
field
:
$issuableDueDate
.
get
(
0
),
format
:
'
yyyy-mm-dd
'
,
format
:
'
yyyy-mm-dd
'
,
defaultDate
:
new
Date
(
$issuableDueDate
.
val
()),
onSelect
:
function
(
dateText
)
{
onSelect
:
function
(
dateText
)
{
$issuableDueDate
.
val
(
dateFormat
(
new
Date
(
dateText
),
'
yyyy-mm-dd
'
));
$issuableDueDate
.
val
(
dateFormat
(
new
Date
(
dateText
),
'
yyyy-mm-dd
'
));
}
}
})
.
setDate
(
new
Date
(
$issuableDueDate
.
val
()))
;
});
}
}
}
}
...
...
app/assets/javascripts/member_expiration_date.js.es6
View file @
df6f6e31
/* global Pikaday */
/* global dateFormat */
(() => {
(() => {
// Add datepickers to all `js-access-expiration-date` elements. If those elements are
// Add datepickers to all `js-access-expiration-date` elements. If those elements are
// children of an element with the `clearable-input` class, and have a sibling
// children of an element with the `clearable-input` class, and have a sibling
...
@@ -11,21 +13,34 @@
...
@@ -11,21 +13,34 @@
}
}
const inputs = $(selector);
const inputs = $(selector);
inputs.datepicker({
inputs.each((i, el) => {
dateFormat: 'yy-mm-dd',
const $input = $(el);
minDate: 1,
onSelect: function onSelect() {
const calendar = new Pikaday({
$(this).trigger('change');
field: $input.get(0),
format: 'yyyy-mm-dd',
minDate: new Date(),
defaultDate: new Date($input.val()),
onSelect: (dateText) => {
$input.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
$input.trigger('change');
toggleClearInput.call(this);
toggleClearInput.call(this);
},
},
});
});
$input.data('pikaday', calendar);
});
inputs.next('.js-clear-input').on('click', function clicked(event) {
inputs.next('.js-clear-input').on('click', function clicked(event) {
event.preventDefault();
event.preventDefault();
const input = $(this).closest('.clearable-input').find(selector);
const input = $(this).closest('.clearable-input').find(selector);
input.datepicker('setDate', null)
const calendar = input.data('pikaday');
.trigger('change');
calendar.setDate(null);
input.trigger('change');
toggleClearInput.call(input);
toggleClearInput.call(input);
});
});
...
...
app/views/shared/milestones/_form_dates.html.haml
View file @
df6f6e31
...
@@ -10,6 +10,3 @@
...
@@ -10,6 +10,3 @@
.col-sm-10
.col-sm-10
=
f
.
text_field
:due_date
,
class:
"datepicker form-control"
,
placeholder:
"Select due date"
=
f
.
text_field
:due_date
,
class:
"datepicker form-control"
,
placeholder:
"Select due date"
%a
.inline.prepend-top-5.js-clear-due-date
{
href:
"#"
}
Clear due date
%a
.inline.prepend-top-5.js-clear-due-date
{
href:
"#"
}
Clear due date
:javascript
new
gl
.
DueDateSelectors
();
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