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

Fix .locale.Tr function not found in delete modal #23468

Merged
merged 8 commits into from
Mar 21, 2023
22 changes: 20 additions & 2 deletions templates/admin/repo/unadopted.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@
<input type="hidden" name="action" value="adopt">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
{{template "base/delete_modal_actions" .}}
<div class="actions">
<button class="ui red basic inverted cancel button">
{{svg "octicon-trash" 16 "gt-mr-2"}}
{{$.locale.Tr "modal.no"}}
</button>
<button class="ui green basic inverted ok button">
{{svg "octicon-check" 16 "gt-mr-2"}}
{{$.locale.Tr "modal.yes"}}
</button>
</div>
</form>
</div>
<button class="ui button submit tiny red delete show-modal" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{$.locale.Tr "repo.delete_preexisting_label"}}</span></button>
Expand All @@ -61,7 +70,16 @@
<input type="hidden" name="action" value="delete">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
{{template "base/delete_modal_actions" .}}
<div class="actions">
<button class="ui red basic inverted cancel button">
{{svg "octicon-trash" 16 "gt-mr-2"}}
{{$.locale.Tr "modal.no"}}
</button>
<button class="ui green basic inverted ok button">
{{svg "octicon-check" 16 "gt-mr-2"}}
{{$.locale.Tr "modal.yes"}}
</button>
</div>
Copy link
Member

@silverwind silverwind Mar 14, 2023

Choose a reason for hiding this comment

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

Why not make another subtemplate with the trash icon? 3 repetitions is already worthy of a subtemplate.

Copy link
Contributor

Choose a reason for hiding this comment

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

It just need a rename.

Rename the delete_modal_actions to modal_actions_yes_no

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to postpone this for a future PR, but yeah, we can of course do it in this one too…

Copy link
Contributor

Choose a reason for hiding this comment

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

Either is fine, fix bugs first 😁

</form>
</div>
</div>
Expand Down
13 changes: 11 additions & 2 deletions templates/user/settings/repos.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="adopt">
{{template "base/delete_modal_actions" .}}
<div class="actions">
<button class="ui red basic inverted cancel button">
{{svg "octicon-x"}}
{{$.locale.Tr "modal.no"}}
</button>
<button class="ui green basic inverted ok button">
{{svg "octicon-check"}}
{{$.locale.Tr "modal.yes"}}
</button>
</div>
</form>
</div>
{{end}}
Expand All @@ -68,7 +77,7 @@
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="delete">
{{template "base/delete_modal_actions" .}}
{{template "base/delete_modal_actions" $}}
</form>
</div>
{{end}}
Expand Down