You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

view.tmpl 7.1KB

Refactor delete_modal_actions template and use it for project column related actions (#24097) Co-Author: @wxiaoguang This PR is to fix https://github.com/go-gitea/gitea/issues/23318#issuecomment-1506275446 . The way to fix this in this PR is to use `delete_modal_actions.tmpl` here both to fix this issue and keep ui consistency (as suggested by [TODO here](https://github.com/go-gitea/gitea/blob/4299c3b7db61f8741eca0ba3d663bb65745a4acc/templates/projects/view.tmpl#L161)) And this PR also refactors `delete_modal_actions.tmpl` and its related styles, and use the template for more modal actions: 1. Added template attributes: * locale * ModalButtonStyle: "yes" (default) or "confirm" * ModalButtonCancelText * ModalButtonOkText 2. Rename `delete_modal_actions.tmpl` template to `modal_actions_confirm.tmpl` because it is not only used for action modals deletion now. 3. Refactored css related to modals into `web_src/css/modules/modal.css` and improved the styles. 4. Also use the template for PR deletion modal and remove issue dependency modal. 5. Some modals should also use the template, but not sure how to open them, so mark these modal actions by `{{/* TODO: Convert to base/modal_actions_confirm */}}` After (Also tested on arc green): Hovering on the left buttons <img width="711" alt="Screen Shot 2023-04-23 at 15 17 12" src="https://user-images.githubusercontent.com/17645053/233825650-76307e65-9255-44bb-80e8-7062f58ead1b.png"> <img width="786" alt="Screen Shot 2023-04-23 at 15 17 21" src="https://user-images.githubusercontent.com/17645053/233825652-4dc6f7d1-a180-49fb-a468-d60950eaee0d.png"> Test for functionalities: https://user-images.githubusercontent.com/17645053/233826857-76376fda-022c-42d0-b0f3-339c17ca4e59.mov --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 year ago
Refactor delete_modal_actions template and use it for project column related actions (#24097) Co-Author: @wxiaoguang This PR is to fix https://github.com/go-gitea/gitea/issues/23318#issuecomment-1506275446 . The way to fix this in this PR is to use `delete_modal_actions.tmpl` here both to fix this issue and keep ui consistency (as suggested by [TODO here](https://github.com/go-gitea/gitea/blob/4299c3b7db61f8741eca0ba3d663bb65745a4acc/templates/projects/view.tmpl#L161)) And this PR also refactors `delete_modal_actions.tmpl` and its related styles, and use the template for more modal actions: 1. Added template attributes: * locale * ModalButtonStyle: "yes" (default) or "confirm" * ModalButtonCancelText * ModalButtonOkText 2. Rename `delete_modal_actions.tmpl` template to `modal_actions_confirm.tmpl` because it is not only used for action modals deletion now. 3. Refactored css related to modals into `web_src/css/modules/modal.css` and improved the styles. 4. Also use the template for PR deletion modal and remove issue dependency modal. 5. Some modals should also use the template, but not sure how to open them, so mark these modal actions by `{{/* TODO: Convert to base/modal_actions_confirm */}}` After (Also tested on arc green): Hovering on the left buttons <img width="711" alt="Screen Shot 2023-04-23 at 15 17 12" src="https://user-images.githubusercontent.com/17645053/233825650-76307e65-9255-44bb-80e8-7062f58ead1b.png"> <img width="786" alt="Screen Shot 2023-04-23 at 15 17 21" src="https://user-images.githubusercontent.com/17645053/233825652-4dc6f7d1-a180-49fb-a468-d60950eaee0d.png"> Test for functionalities: https://user-images.githubusercontent.com/17645053/233826857-76376fda-022c-42d0-b0f3-339c17ca4e59.mov --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. {{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}}
  2. <div class="ui container">
  3. <div class="tw-flex tw-justify-between tw-items-center tw-mb-4">
  4. <h2 class="tw-mb-0">{{.Project.Title}}</h2>
  5. {{if $canWriteProject}}
  6. <div class="ui compact mini menu">
  7. <a class="item" href="{{.Link}}/edit?redirect=project">
  8. {{svg "octicon-pencil"}}
  9. {{ctx.Locale.Tr "repo.issues.label_edit"}}
  10. </a>
  11. {{if .Project.IsClosed}}
  12. <button class="item btn link-action" data-url="{{.Link}}/open">
  13. {{svg "octicon-check"}}
  14. {{ctx.Locale.Tr "repo.projects.open"}}
  15. </button>
  16. {{else}}
  17. <button class="item btn link-action" data-url="{{.Link}}/close">
  18. {{svg "octicon-skip"}}
  19. {{ctx.Locale.Tr "repo.projects.close"}}
  20. </button>
  21. {{end}}
  22. <button class="item btn delete-button" data-url="{{.Link}}/delete" data-id="{{.Project.ID}}">
  23. {{svg "octicon-trash"}}
  24. {{ctx.Locale.Tr "repo.issues.label_delete"}}
  25. </button>
  26. <button class="item btn show-modal" data-modal="#new-project-column-item">
  27. {{svg "octicon-plus"}}
  28. {{ctx.Locale.Tr "new_project_column"}}
  29. </button>
  30. </div>
  31. <div class="ui small modal new-project-column-modal" id="new-project-column-item">
  32. <div class="header">
  33. {{ctx.Locale.Tr "repo.projects.column.new"}}
  34. </div>
  35. <div class="content">
  36. <form class="ui form">
  37. <div class="required field">
  38. <label for="new_project_column">{{ctx.Locale.Tr "repo.projects.column.new_title"}}</label>
  39. <input class="new-project-column" id="new_project_column" name="title" required>
  40. </div>
  41. <div class="field color-field">
  42. <label for="new_project_column_color_picker">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
  43. <div class="color picker column">
  44. <input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_project_column_color_picker" name="color">
  45. {{template "repo/issue/label_precolors"}}
  46. </div>
  47. </div>
  48. <div class="text right actions">
  49. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  50. <button data-url="{{$.Link}}" class="ui primary button" id="new_project_column_submit">{{ctx.Locale.Tr "repo.projects.column.new_submit"}}</button>
  51. </div>
  52. </form>
  53. </div>
  54. </div>
  55. {{end}}
  56. </div>
  57. <div class="content">{{$.Project.RenderedContent}}</div>
  58. <div class="divider"></div>
  59. </div>
  60. <div id="project-board">
  61. <div class="board {{if .CanWriteProjects}}sortable{{end}}">
  62. {{range .Columns}}
  63. <div class="ui segment project-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
  64. <div class="project-column-header">
  65. <div class="ui large label project-column-title tw-py-1">
  66. <div class="ui small circular grey label project-column-issue-count">
  67. {{.NumIssues ctx}}
  68. </div>
  69. {{.Title}}
  70. </div>
  71. {{if $canWriteProject}}
  72. <div class="ui dropdown jump item">
  73. <div class="tw-px-2">
  74. {{svg "octicon-kebab-horizontal"}}
  75. </div>
  76. <div class="menu user-menu">
  77. <a class="item show-modal button" data-modal="#edit-project-column-modal-{{.ID}}">
  78. {{svg "octicon-pencil"}}
  79. {{ctx.Locale.Tr "repo.projects.column.edit"}}
  80. </a>
  81. {{if not .Default}}
  82. <a class="item show-modal button default-project-column-show"
  83. data-modal="#default-project-column-modal-{{.ID}}"
  84. data-modal-default-project-column-header="{{ctx.Locale.Tr "repo.projects.column.set_default"}}"
  85. data-modal-default-project-column-content="{{ctx.Locale.Tr "repo.projects.column.set_default_desc"}}"
  86. data-url="{{$.Link}}/{{.ID}}/default">
  87. {{svg "octicon-pin"}}
  88. {{ctx.Locale.Tr "repo.projects.column.set_default"}}
  89. </a>
  90. <a class="item show-modal button show-delete-project-column-modal"
  91. data-modal="#delete-project-column-modal-{{.ID}}"
  92. data-url="{{$.Link}}/{{.ID}}">
  93. {{svg "octicon-trash"}}
  94. {{ctx.Locale.Tr "repo.projects.column.delete"}}
  95. </a>
  96. {{end}}
  97. <div class="ui small modal edit-project-column-modal" id="edit-project-column-modal-{{.ID}}">
  98. <div class="header">
  99. {{ctx.Locale.Tr "repo.projects.column.edit"}}
  100. </div>
  101. <div class="content">
  102. <form class="ui form">
  103. <div class="required field">
  104. <label for="new_project_column_title">{{ctx.Locale.Tr "repo.projects.column.edit_title"}}</label>
  105. <input class="project-column-title-input" id="new_project_column_title" name="title" value="{{.Title}}" required>
  106. </div>
  107. <div class="field color-field">
  108. <label for="new_project_column_color">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
  109. <div class="color picker column">
  110. <input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_project_column_color" name="color" value="{{.Color}}">
  111. {{template "repo/issue/label_precolors"}}
  112. </div>
  113. </div>
  114. <div class="text right actions">
  115. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  116. <button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-project-column-button">{{ctx.Locale.Tr "repo.projects.column.edit"}}</button>
  117. </div>
  118. </form>
  119. </div>
  120. </div>
  121. <div class="ui g-modal-confirm modal default-project-column-modal" id="default-project-column-modal-{{.ID}}">
  122. <div class="header">
  123. <span id="default-project-column-header"></span>
  124. </div>
  125. <div class="content">
  126. <label id="default-project-column-content"></label>
  127. </div>
  128. {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
  129. </div>
  130. <div class="ui g-modal-confirm modal" id="delete-project-column-modal-{{.ID}}">
  131. <div class="header">
  132. {{ctx.Locale.Tr "repo.projects.column.delete"}}
  133. </div>
  134. <div class="content">
  135. <label>
  136. {{ctx.Locale.Tr "repo.projects.column.deletion_desc"}}
  137. </label>
  138. </div>
  139. {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
  140. </div>
  141. </div>
  142. </div>
  143. {{end}}
  144. </div>
  145. <div class="divider"></div>
  146. <div class="ui cards{{if $canWriteProject}} tw-cursor-grab{{end}}" data-url="{{$.Link}}/{{.ID}}" data-project="{{$.Project.ID}}" data-board="{{.ID}}" id="board_{{.ID}}">
  147. {{range (index $.IssuesMap .ID)}}
  148. <div class="issue-card gt-word-break {{if $canWriteProject}}tw-cursor-grab{{end}}" data-issue="{{.ID}}">
  149. {{template "repo/issue/card" (dict "Issue" . "Page" $)}}
  150. </div>
  151. {{end}}
  152. </div>
  153. </div>
  154. {{end}}
  155. </div>
  156. </div>
  157. {{if .CanWriteProjects}}
  158. <div class="ui g-modal-confirm delete modal">
  159. <div class="header">
  160. {{svg "octicon-trash"}}
  161. {{ctx.Locale.Tr "repo.projects.deletion"}}
  162. </div>
  163. <div class="content">
  164. <p>{{ctx.Locale.Tr "repo.projects.deletion_desc"}}</p>
  165. </div>
  166. {{template "base/modal_actions_confirm" .}}
  167. </div>
  168. {{end}}