mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 06:03:51 +03:00
Merge pull request 'Fix milestone assignment in new issue' (#5180) from esainane/forgejo:five-hundred-more into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5180 Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
commit
a0c11f58dd
4 changed files with 31 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
|||
{{$useHTMX := not .NewIssuePage}}
|
||||
{{if or .OpenMilestones .ClosedMilestones}}
|
||||
<div class="ui icon search input">
|
||||
<i class="icon">{{svg "octicon-search" 16}}</i>
|
||||
|
@ -5,7 +6,7 @@
|
|||
</div>
|
||||
<div class="divider"></div>
|
||||
{{end}}
|
||||
<div class="no-select item" hx-post="{{$.RepoLink}}/issues/milestone?issue_ids={{$.Issue.ID}}&htmx=true">{{ctx.Locale.Tr "repo.issues.new.clear_milestone"}}</div>
|
||||
<div class="no-select item"{{if $useHTMX}} hx-post="{{$.RepoLink}}/issues/milestone?issue_ids={{$.Issue.ID}}&htmx=true"{{end}}>{{ctx.Locale.Tr "repo.issues.new.clear_milestone"}}</div>
|
||||
{{if and (not .OpenMilestones) (not .ClosedMilestones)}}
|
||||
<div class="disabled item">
|
||||
{{ctx.Locale.Tr "repo.issues.new.no_items"}}
|
||||
|
@ -17,7 +18,7 @@
|
|||
{{ctx.Locale.Tr "repo.issues.new.open_milestone"}}
|
||||
</div>
|
||||
{{range .OpenMilestones}}
|
||||
<a class="item" hx-post="{{$.RepoLink}}/issues/milestone?id={{.ID}}&issue_ids={{$.Issue.ID}}&htmx=true">
|
||||
<a class="item"{{if $useHTMX}} hx-post="{{$.RepoLink}}/issues/milestone?id={{.ID}}&issue_ids={{$.Issue.ID}}&htmx=true"{{else}} data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"{{end}}>
|
||||
{{svg "octicon-milestone" 16 "tw-mr-1"}}
|
||||
{{.Name}}
|
||||
</a>
|
||||
|
@ -29,7 +30,7 @@
|
|||
{{ctx.Locale.Tr "repo.issues.new.closed_milestone"}}
|
||||
</div>
|
||||
{{range .ClosedMilestones}}
|
||||
<a class="item" hx-post="{{$.RepoLink}}/issues/milestone?id={{.ID}}&issue_ids={{$.Issue.ID}}&htmx=true">
|
||||
<a class="item"{{if $useHTMX}} hx-post="{{$.RepoLink}}/issues/milestone?id={{.ID}}&issue_ids={{$.Issue.ID}}&htmx=true"{{else}} data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"{{end}}>
|
||||
{{svg "octicon-milestone" 16 "tw-mr-1"}}
|
||||
{{.Name}}
|
||||
</a>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
{{end}}
|
||||
</span>
|
||||
<div class="menu">
|
||||
{{template "repo/issue/milestone/select_menu" .}}
|
||||
{{template "repo/issue/milestone/select_menu" dict "." . "NewIssuePage" 1}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui select-milestone list">
|
||||
|
|
|
@ -119,3 +119,25 @@ test('Issue: Milestone', async ({browser}, workerInfo) => {
|
|||
await expect(selectedMilestone).toContainText('No milestone');
|
||||
await expect(page.locator('.timeline-item.event').last()).toContainText('user2 removed this from the milestone1 milestone');
|
||||
});
|
||||
|
||||
test('New Issue: Milestone', async ({browser}, workerInfo) => {
|
||||
test.skip(workerInfo.project.name === 'Mobile Safari', 'Unable to get tests working on Safari Mobile, see https://codeberg.org/forgejo/forgejo/pulls/3445#issuecomment-1789636');
|
||||
const page = await login({browser}, workerInfo);
|
||||
|
||||
const response = await page.goto('/user2/repo1/issues/new');
|
||||
await expect(response?.status()).toBe(200);
|
||||
|
||||
const selectedMilestone = page.locator('.issue-content-right .select-milestone.list');
|
||||
const milestoneDropdown = page.locator('.issue-content-right .select-milestone.dropdown');
|
||||
await expect(selectedMilestone).toContainText('No milestone');
|
||||
|
||||
// Add milestone.
|
||||
await milestoneDropdown.click();
|
||||
await page.getByRole('option', {name: 'milestone1'}).click();
|
||||
await expect(selectedMilestone).toContainText('milestone1');
|
||||
|
||||
// Clear milestone.
|
||||
await milestoneDropdown.click();
|
||||
await page.getByText('Clear milestone', {exact: true}).click();
|
||||
await expect(selectedMilestone).toContainText('No milestone');
|
||||
});
|
||||
|
|
|
@ -270,7 +270,9 @@ export function initRepoCommentForm() {
|
|||
}
|
||||
|
||||
let icon = '';
|
||||
if (input_id === '#project_id') {
|
||||
if (input_id === '#milestone_id') {
|
||||
icon = svg('octicon-milestone', 18, 'tw-mr-2');
|
||||
} else if (input_id === '#project_id') {
|
||||
icon = svg('octicon-project', 18, 'tw-mr-2');
|
||||
} else if (input_id === '#assignee_id') {
|
||||
icon = `<img class="ui avatar image tw-mr-2" alt="avatar" src=${$(this).data('avatar')}>`;
|
||||
|
@ -311,6 +313,7 @@ export function initRepoCommentForm() {
|
|||
|
||||
// Milestone, Assignee, Project
|
||||
selectItem('.select-project', '#project_id');
|
||||
selectItem('.select-milestone', '#milestone_id');
|
||||
selectItem('.select-assignee', '#assignee_id');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue