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
if issueUpdateURL
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>'
collapsedSidebarLabelTemplate = _.template(
'<span class="has-tooltip" data-container="body" data-original-title="<%= remaining %>" data-placement="left">
<%= _.escape(title) %>
</span>'
)
$dropdown.glDropdown(
data: (term, callback) ->
$.ajax(
......@@ -122,8 +132,9 @@ class @MilestoneSelect
if data.milestone?
data.milestone.namespace = _this.currentProject.namespace
data.milestone.path = _this.currentProject.path
data.milestone.remaining = $.timefor data.milestone.due_date
$value.html(milestoneLinkTemplate(data.milestone))
$sidebarCollapsedValue.find('span').text(data.milestone.title)
$sidebarCollapsedValue.find('span').html(collapsedSidebarLabelTemplate(data.milestone))
else
$value.html(milestoneLinkNoneTemplate)
$sidebarCollapsedValue.find('span').text('No')
......
......@@ -54,13 +54,18 @@ module MilestonesHelper
end
end
def milestone_remaining_days(milestone)
def milestone_remaining_days(milestone, withContentTag = true)
if milestone.expired?
content_tag(:strong, 'expired')
if withContentTag then content_tag(:strong, 'expired') else 'expired' end
elsif milestone.due_date
days = milestone.remaining_days
if withContentTag
content = content_tag(:strong, days)
content << " #{'day'.pluralize(days)} remaining"
else
"#{days} #{'day'.pluralize(days)} remaining"
end
end
end
end
......@@ -56,6 +56,7 @@
= icon('clock-o')
%span
- if issuable.milestone
%span.has-tooltip{"data-container" => "body", "data-placement" => "left", "data-original-title" => milestone_remaining_days(issuable.milestone, false)}
= issuable.milestone.title
- else
None
......@@ -67,6 +68,7 @@
.value.bold.hide-collapsed
- if issuable.milestone
= link_to namespace_project_milestone_path(@project.namespace, @project, issuable.milestone) do
%span.has-tooltip{"data-container" => "body", "data-original-title" => milestone_remaining_days(issuable.milestone, false)}
= issuable.milestone.title
- else
.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