Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Progressbar to Milestone Page #25050

Merged
merged 7 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ milestones.no_due_date = No due date
milestones.open = Open
milestones.close = Close
milestones.new_subheader = Milestones organize issues and track progress.
milestones.completeness = %d%% Completed
milestones.completeness = <strong>%d%%</strong> Completed
Copy link
Member

@silverwind silverwind Jun 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have really liked to use {percentage} Completed here where the template code takes care of percentage rendering, but it's currently not possible with this translation system to have named tokens.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could put %s completed and avoid the HTML in the translation, but that might confuse translators because they don't know that %s is supposed to be a percentage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not preferred, do don't change existing translations?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well… Yesn't.
The problem is simply that new strings (which is the case for modified strings) can be untranslated for quite some time.

milestones.create = Create Milestone
milestones.title = Title
milestones.desc = Description
Expand Down
38 changes: 20 additions & 18 deletions templates/repo/issue/milestone_issues.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{template "repo/header" .}}
<div class="ui container">
<div class="gt-df">
<h1>{{.Milestone.Name}}</h1>
<h1 class="gt-mb-3">{{.Milestone.Name}}</h1>
{{if not .Repository.IsArchived}}
<div class="text right gt-f1">
{{if or .CanWriteIssues .CanWritePulls}}
Expand All @@ -20,26 +20,28 @@
</div>
{{end}}
</div>
<div class="ui one column stackable grid">
<div class="column markup content">
{{.Milestone.RenderedContent|Str2html}}
</div>
{{if .Milestone.RenderedContent}}
<div class="markup content gt-mb-4">
{{.Milestone.RenderedContent|Str2html}}
</div>
<div class="ui one column stackable grid">
<div class="column">
{{$closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix $.locale}}
{{if .IsClosed}}
{{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate | Safe}}
{{else}}
{{svg "octicon-calendar"}}
{{if .Milestone.DeadlineString}}
<span {{if .IsOverdue}}class="overdue"{{end}}>{{DateTime "short" .Milestone.DeadlineString}}</span>
{{end}}
<div class="gt-df gt-fc gt-gap-3">
<progress class="milestone-progress-big" value="{{.Milestone.Completeness}}" max="100"></progress>
<div class="gt-df gt-gap-4">
<div classs="gt-df gt-ac">
{{$closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix $.locale}}
{{if .IsClosed}}
{{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate | Safe}}
{{else}}
{{$.locale.Tr "repo.milestones.no_due_date"}}
{{svg "octicon-calendar"}}
{{if .Milestone.DeadlineString}}
<span {{if .IsOverdue}}class="overdue"{{end}}>{{DateTime "short" .Milestone.DeadlineString}}</span>
{{else}}
{{$.locale.Tr "repo.milestones.no_due_date"}}
{{end}}
{{end}}
{{end}}
&nbsp;
<b>{{.locale.Tr "repo.milestones.completeness" .Milestone.Completeness}}</b>
</div>
<div class="gt-mr-3">{{.locale.Tr "repo.milestones.completeness" .Milestone.Completeness | Safe}}</div>
</div>
</div>
<div class="ui divider"></div>
Expand Down
5 changes: 5 additions & 0 deletions web_src/css/repo.css
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,11 @@
height: 200px;
}

.milestone-progress-big {
width: min(420px, 96vw);
Copy link
Contributor

@wxiaoguang wxiaoguang Jun 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but ... why "width: min" here?

  • Does "420px/96vw" overflow some small width screens? eg: when 100vw=400, the remaining 4vw=16px?
  • Could the "96vw" be replaced by "flex: 1" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how small screens can get, but min confines the bar neatly to the screen with equal margins. Could also use q media query to achieve the same effect without vw which is a bit cleaner.

height: 10px;
}

.repository.compare.pull .show-form-container {
text-align: left;
}
Expand Down