Add in helpful shortcuts menu to issue due dates

This commit is contained in:
Simon Holywell 2012-04-10 21:46:58 +01:00
parent 1690fa8416
commit 10e5f350f7
4 changed files with 84 additions and 4 deletions

View File

@ -476,6 +476,14 @@ class IDF_Views_Issue
'preview' => $preview,
'issue' => new IDF_Issue(),
'date_today' => date('Y-m-d'),
'date_tomorrow' => date('Y-m-d', strtotime('tomorrow')),
'date_eow' => date('Y-m-d', strtotime('next friday')),
'date_eom' => date('Y-m-d', strtotime('last day of this month')),
'date_2_hours' => date('Y-m-d H:i', strtotime('+2 hours')),
'date_2_days' => date('Y-m-d', strtotime('+2 days')),
'date_1_week' => date('Y-m-d', strtotime('+1 week')),
'date_two_weeks' => date('Y-m-d', strtotime('+2 week')),
'date_one_month' => date('Y-m-d', strtotime('+1 month')),
'default_time' => Pluf::f('issue_default_due_date_time'),
),
self::autoCompleteArrays($prj)
@ -715,6 +723,14 @@ class IDF_Views_Issue
'next_issue_id' => $next_issue_id,
'related_issues' => $related_issues,
'date_today' => date('Y-m-d'),
'date_tomorrow' => date('Y-m-d', strtotime('tomorrow')),
'date_eow' => date('Y-m-d', strtotime('next friday')),
'date_eom' => date('Y-m-d', strtotime('last day of this month')),
'date_2_hours' => date('Y-m-d H:i', strtotime('+2 hours')),
'date_2_days' => date('Y-m-d', strtotime('+2 days')),
'date_1_week' => date('Y-m-d', strtotime('+1 week')),
'date_two_weeks' => date('Y-m-d', strtotime('+2 week')),
'date_one_month' => date('Y-m-d', strtotime('+1 month')),
'default_time' => Pluf::f('issue_default_due_date_time'),
),
$arrays),

View File

@ -66,7 +66,20 @@
<th>{$form.f.due_dtime.labelTag}:</th>
<td>{if $form.f.due_dtime.errors}{$form.f.due_dtime.fieldErrors}{/if}
{$form.f.due_dtime|unsafe}
<a href="#" rel="{$date_today} {$default_time}" id="due_dtime_today">Today</a>
<div id="due_dtime_wrapper">
<a href="#" rel="{$date_today} {$default_time}" class="due_dtime_shortcut" id="due_dtime_today">Today</a>
<div id="due_dtime_more_shortcuts" style="display: none">
<a href="#" rel="{$date_today} {$default_time}" class="due_dtime_shortcut" id="due_dtime_today_more">Today</a> -
<a href="#" rel="{$date_tomorrow} {$default_time}" class="due_dtime_shortcut" id="due_dtime_tomorrow">Tomorrow</a> -
<a href="#" rel="{$date_eow} {$default_time}" class="due_dtime_shortcut" id="due_dtime_eow">End of the Week</a> -
<a href="#" rel="{$date_eom} {$default_time}" class="due_dtime_shortcut" id="due_dtime_eom">End of the Month</a><br />
<a href="#" rel="{$date_2_hours}" class="due_dtime_shortcut" id="due_dtime_2_hours">2 Hours</a> -
<a href="#" rel="{$date_2_days} {$default_time}" class="due_dtime_shortcut" id="due_dtime_2_days">2 Days</a> -
<a href="#" rel="{$date_1_week} {$default_time}" class="due_dtime_shortcut" id="due_dtime_1_week">1 Week</a> -
<a href="#" rel="{$date_two_weeks} {$default_time}" class="due_dtime_shortcut" id="due_dtime_two_weeks">A Fortnight</a> -
<a href="#" rel="{$date_one_month} {$default_time}" class="due_dtime_shortcut" id="due_dtime_one_month">1 Month</a>
</div>
</div>
</td>
<tr>
<th>{$form.f.relation_type0.labelTag}:</th>
@ -125,7 +138,12 @@ $(document).ready(function(){
this.value = dateText + ' ' + default_time;
}
});
$("#due_dtime_today").click(function(){
$('#due_dtime_wrapper').mouseover(function(){
$('#due_dtime_more_shortcuts').show();
}).mouseout(function(){
$('#due_dtime_more_shortcuts').hide();
});
$(".due_dtime_shortcut").click(function(){
$('#id_due_dtime').val($(this).attr('rel'));
return false;
});

View File

@ -131,7 +131,20 @@
<th>{$form.f.due_dtime.labelTag}:</th>
<td>{if $form.f.due_dtime.errors}{$form.f.due_dtime.fieldErrors}{/if}
{$form.f.due_dtime|unsafe}
<a href="#" rel="{$date_today} {$default_time}" id="due_dtime_today">Today</a>
<div id="due_dtime_wrapper">
<a href="#" rel="{$date_today} {$default_time}" class="due_dtime_shortcut" id="due_dtime_today">Today</a>
<div id="due_dtime_more_shortcuts" style="display: none">
<a href="#" rel="{$date_today} {$default_time}" class="due_dtime_shortcut" id="due_dtime_today_more">Today</a> -
<a href="#" rel="{$date_tomorrow} {$default_time}" class="due_dtime_shortcut" id="due_dtime_tomorrow">Tomorrow</a> -
<a href="#" rel="{$date_eow} {$default_time}" class="due_dtime_shortcut" id="due_dtime_eow">End of the Week</a> -
<a href="#" rel="{$date_eom} {$default_time}" class="due_dtime_shortcut" id="due_dtime_eom">End of the Month</a><br />
<a href="#" rel="{$date_2_hours}" class="due_dtime_shortcut" id="due_dtime_2_hours">2 Hours</a> -
<a href="#" rel="{$date_2_days} {$default_time}" class="due_dtime_shortcut" id="due_dtime_2_days">2 Days</a> -
<a href="#" rel="{$date_1_week} {$default_time}" class="due_dtime_shortcut" id="due_dtime_1_week">1 Week</a> -
<a href="#" rel="{$date_two_weeks} {$default_time}" class="due_dtime_shortcut" id="due_dtime_two_weeks">A Fortnight</a> -
<a href="#" rel="{$date_one_month} {$default_time}" class="due_dtime_shortcut" id="due_dtime_one_month">1 Month</a>
</div>
</div>
</td>
<tr>
<tr>
@ -226,7 +239,12 @@ $(document).ready(function(){
this.value = dateText + ' ' + default_time;
}
});
$("#due_dtime_today").click(function(){
$('#due_dtime_wrapper').mouseover(function(){
$('#due_dtime_more_shortcuts').show();
}).mouseout(function(){
$('#due_dtime_more_shortcuts').hide();
});
$(".due_dtime_shortcut").click(function(){
$('#id_due_dtime').val($(this).attr('rel'));
return false;
});

View File

@ -325,6 +325,34 @@ div.issue-submit-info h2 {
margin-top: 0;
}
#due_dtime_wrapper {
position: relative;
float: right;
width: 350px;
}
#due_dtime_more_shortcuts {
display: none;
width: 345px;
position: absolute;
top: -3px;
left: -6px;
background: white;
padding: 2px 5px;
border: 1px solid black;
}
#due_dtime_wrapper a {
text-decoration: none;
color: black;
padding: 0 2px;
}
#due_dtime_wrapper a:hover {
background-color: #4E9A06;
color: white;
}
span.label {
color: #204a87;
padding-left: 0.5em;