Commit 5cae36d1 authored by Fatih Acet's avatar Fatih Acet

Show milestone remaining tooltip in right sidebar.

parent 91937d5b
...@@ -24,11 +24,21 @@ class @MilestoneSelect ...@@ -24,11 +24,21 @@ class @MilestoneSelect
if issueUpdateURL if issueUpdateURL
milestoneLinkTemplate = _.template( milestoneLinkTemplate = _.template(
'<a href="/<%= namespace %>/<%= path %>/milestones/<%= iid %>"><%= _.escape(title) %></a>' '<a href="/<%= namespace %>/<%= path %>/milestones/<%= iid %>">
<span class="has-tooltip" data-container="body" data-original-title="<%= remaining %>">
<%= _.escape(title) %>
</span>
</a>'
) )
milestoneLinkNoneTemplate = '<div class="light">None</div>' milestoneLinkNoneTemplate = '<div class="light">None</div>'
collapsedSidebarLabelTemplate = _.template(
'<span class="has-tooltip" data-container="body" data-original-title="<%= remaining %>" data-placement="left">
<%= _.escape(title) %>
</span>'
)
$dropdown.glDropdown( $dropdown.glDropdown(
data: (term, callback) -> data: (term, callback) ->
$.ajax( $.ajax(
...@@ -122,8 +132,9 @@ class @MilestoneSelect ...@@ -122,8 +132,9 @@ class @MilestoneSelect
if data.milestone? if data.milestone?
data.milestone.namespace = _this.currentProject.namespace data.milestone.namespace = _this.currentProject.namespace
data.milestone.path = _this.currentProject.path data.milestone.path = _this.currentProject.path
data.milestone.remaining = $.timefor data.milestone.due_date
$value.html(milestoneLinkTemplate(data.milestone)) $value.html(milestoneLinkTemplate(data.milestone))
$sidebarCollapsedValue.find('span').text(data.milestone.title) $sidebarCollapsedValue.find('span').html(collapsedSidebarLabelTemplate(data.milestone))
else else
$value.html(milestoneLinkNoneTemplate) $value.html(milestoneLinkNoneTemplate)
$sidebarCollapsedValue.find('span').text('No') $sidebarCollapsedValue.find('span').text('No')
......
...@@ -54,13 +54,18 @@ module MilestonesHelper ...@@ -54,13 +54,18 @@ module MilestonesHelper
end end
end end
def milestone_remaining_days(milestone) def milestone_remaining_days(milestone, withContentTag = true)
if milestone.expired? if milestone.expired?
content_tag(:strong, 'expired') if withContentTag then content_tag(:strong, 'expired') else 'expired' end
elsif milestone.due_date elsif milestone.due_date
days = milestone.remaining_days days = milestone.remaining_days
content = content_tag(:strong, days)
content << " #{'day'.pluralize(days)} remaining" if withContentTag
content = content_tag(:strong, days)
content << " #{'day'.pluralize(days)} remaining"
else
"#{days} #{'day'.pluralize(days)} remaining"
end
end end
end end
end end
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
= icon('clock-o') = icon('clock-o')
%span %span
- if issuable.milestone - if issuable.milestone
= issuable.milestone.title %span.has-tooltip{"data-container" => "body", "data-placement" => "left", "data-original-title" => milestone_remaining_days(issuable.milestone, false)}
= issuable.milestone.title
- else - else
None None
.title.hide-collapsed .title.hide-collapsed
...@@ -67,7 +68,8 @@ ...@@ -67,7 +68,8 @@
.value.bold.hide-collapsed .value.bold.hide-collapsed
- if issuable.milestone - if issuable.milestone
= link_to namespace_project_milestone_path(@project.namespace, @project, issuable.milestone) do = link_to namespace_project_milestone_path(@project.namespace, @project, issuable.milestone) do
= issuable.milestone.title %span.has-tooltip{"data-container" => "body", "data-original-title" => milestone_remaining_days(issuable.milestone, false)}
= issuable.milestone.title
- else - else
.light None .light None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment