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
Léo-Paul Géneau
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
Hide 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 @@
break;
case 'projects:milestones:new':
case 'projects:milestones:edit':
case 'projects:milestones:update':
new ZenMode();
new gl.DueDateSelectors();
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 */
/* global dateFormat */
/* global Pikaday */
(function(global) {
class DueDateSelect {
...
...
@@ -31,6 +32,10 @@
initGlDropdown() {
this.$dropdown.glDropdown({
opened: () => {
const calendar = this.$datePicker.data('pikaday');
calendar.show();
},
hidden: () => {
this.$selectbox.hide();
this.$value.css('display', '');
...
...
@@ -39,25 +44,37 @@
}
initDatePicker() {
this.$datePicker.datepicker({
dateFormat: 'yy-mm-dd',
defaultDate: $("input[name='" + this.fieldName + "']").val(),
altField: "input[name='" + this.fieldName + "']",
onSelect: () => {
const $dueDateInput = $(`input[name='${this.fieldName}']`);
const calendar = new Pikaday({
field: $dueDateInput.get(0),
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')) {
gl.issueBoards.BoardsStore.detail.issue.dueDate = $
(`input[name='${this.fieldName}']`)
.val();
gl.issueBoards.BoardsStore.detail.issue.dueDate = $
dueDateInput
.val();
this.updateIssueBoardIssue();
} else {
return
this.saveDueDate(true);
this.saveDueDate(true);
}
}
});
this.$datePicker.append(calendar.el);
this.$datePicker.data('pikaday', calendar);
}
initRemoveDueDate() {
this.$block.on('click', '.js-remove-due-date', (e) => {
const calendar = this.$datePicker.data('pikaday');
e.preventDefault();
calendar.setDate(null);
if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
gl.issueBoards.BoardsStore.detail.issue.dueDate = '';
this.updateIssueBoardIssue();
...
...
@@ -154,14 +171,24 @@
}
initMilestoneDatePicker() {
$('.datepicker').datepicker({
dateFormat: 'yy-mm-dd'
$('.datepicker').each(function() {
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) => {
e.preventDefault();
const
datepicker = $(e.target).siblings('.datepicker
');
$.datepicker._clearDate(datepicker
);
const
calendar = $(e.target).siblings('.datepicker').data('pikaday
');
calendar.setDate(null
);
});
}
...
...
app/assets/javascripts/gl_dropdown.js
View file @
df6f6e31
...
...
@@ -437,7 +437,7 @@
}
};
GitLabDropdown
.
prototype
.
opened
=
function
()
{
GitLabDropdown
.
prototype
.
opened
=
function
(
e
)
{
var
contentHtml
;
this
.
resetRows
();
this
.
addArrowKeyEvent
();
...
...
@@ -457,6 +457,10 @@
this
.
positionMenuAbove
();
}
if
(
this
.
options
.
opened
)
{
this
.
options
.
opened
.
call
(
this
,
e
);
}
return
this
.
dropdown
.
trigger
(
'
shown.gl.dropdown
'
);
};
...
...
app/assets/javascripts/issuable_form.js
View file @
df6f6e31
...
...
@@ -40,10 +40,11 @@
new
Pikaday
({
field
:
$issuableDueDate
.
get
(
0
),
format
:
'
yyyy-mm-dd
'
,
defaultDate
:
new
Date
(
$issuableDueDate
.
val
()),
onSelect
:
function
(
dateText
)
{
$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
// children of an element with the `clearable-input` class, and have a sibling
...
...
@@ -11,21 +13,34 @@
}
const inputs = $(selector);
inputs.datepicker({
dateFormat: 'yy-mm-dd',
minDate: 1,
onSelect: function onSelect() {
$(this).trigger('change');
toggleClearInput.call(this);
},
inputs.each((i, el) => {
const $input = $(el);
const calendar = new Pikaday({
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);
},
});
$input.data('pikaday', calendar);
});
inputs.next('.js-clear-input').on('click', function clicked(event) {
event.preventDefault();
const input = $(this).closest('.clearable-input').find(selector);
input.datepicker('setDate', null)
.trigger('change');
const calendar = input.data('pikaday');
calendar.setDate(null);
input.trigger('change');
toggleClearInput.call(input);
});
...
...
app/views/shared/milestones/_form_dates.html.haml
View file @
df6f6e31
...
...
@@ -10,6 +10,3 @@
.col-sm-10
=
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
: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