From 4e7acd88dc02e545ba696a2b4fd8c16bd6df31d5 Mon Sep 17 00:00:00 2001 From: Timothy Andrew Date: Wed, 20 Apr 2016 12:21:14 +0530 Subject: [PATCH] Remove unnecessary javascript from the datepicker initialization. - In the personal access tokens page. - Also fix the z-index so it doesn't appear below the token text fields. --- .../personal_access_tokens/index.html.haml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/views/profiles/personal_access_tokens/index.html.haml b/app/views/profiles/personal_access_tokens/index.html.haml index e61fa69af5..af34eb389d 100644 --- a/app/views/profiles/personal_access_tokens/index.html.haml +++ b/app/views/profiles/personal_access_tokens/index.html.haml @@ -90,5 +90,16 @@ :javascript $(".datepicker").datepicker({ dateFormat: "yy-mm-dd", - onSelect: function(dateText, inst) { $("#personal_access_token_expires_at").val(dateText) } - }).datepicker("setDate", $.datepicker.parseDate('yy-mm-dd', $('#personal_access_token_expires_at').val())); \ No newline at end of file + beforeShow: function() { + //////////////////////////////////////////////////////////////// + // 1. Need the setTimeout because the datepicker doesn't have // + // an `afterShow` callback. // + // 2. Need to set the z-index like this because we don't want // + // to target datepickers outside the current page, which // + // will happen if we set this in CSS directly. // + //////////////////////////////////////////////////////////////// + setTimeout(function(){ + $('.ui-datepicker').css('z-index', 3); + }, 0); + } + });