mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 16:02:52 +00:00 
			
		
		
		
	Remove JS globals related to timetracking and due date (#13921)
Refactor to avoid these globals. Should work exactly as before.
This commit is contained in:
		| @@ -1,5 +1,4 @@ | ||||
| /* exported timeAddManual, toggleStopwatch, cancelStopwatch */ | ||||
| /* exported toggleDeadlineForm, setDeadline, updateDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */ | ||||
| /* exported deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */ | ||||
|  | ||||
| import './publicpath.js'; | ||||
|  | ||||
| @@ -2525,6 +2524,8 @@ $(document).ready(async () => { | ||||
|   initU2FAuth(); | ||||
|   initU2FRegister(); | ||||
|   initIssueList(); | ||||
|   initIssueTimetracking(); | ||||
|   initIssueDue(); | ||||
|   initWipTitle(); | ||||
|   initPullRequestReview(); | ||||
|   initRepoStatusChecker(); | ||||
| @@ -3105,22 +3106,22 @@ function initVueApp() { | ||||
|   }); | ||||
| } | ||||
|  | ||||
| window.timeAddManual = function () { | ||||
|   $('.mini.modal') | ||||
|     .modal({ | ||||
| function initIssueTimetracking() { | ||||
|   $(document).on('click', '.issue-add-time', () => { | ||||
|     $('.mini.modal').modal({ | ||||
|       duration: 200, | ||||
|       onApprove() { | ||||
|         $('#add_time_manual_form').trigger('submit'); | ||||
|       } | ||||
|     }).modal('show'); | ||||
| }; | ||||
|  | ||||
| window.toggleStopwatch = function () { | ||||
|   $('#toggle_stopwatch_form').trigger('submit'); | ||||
| }; | ||||
| window.cancelStopwatch = function () { | ||||
|   $('#cancel_stopwatch_form').trigger('submit'); | ||||
| }; | ||||
|   }); | ||||
|   $(document).on('click', '.issue-start-time, .issue-stop-time', () => { | ||||
|     $('#toggle_stopwatch_form').trigger('submit'); | ||||
|   }); | ||||
|   $(document).on('click', '.issue-cancel-time', () => { | ||||
|     $('#cancel_stopwatch_form').trigger('submit'); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| function initFilterBranchTagDropdown(selector) { | ||||
|   $(selector).each(function () { | ||||
| @@ -3476,16 +3477,7 @@ function initTopicbar() { | ||||
|   }); | ||||
| } | ||||
|  | ||||
| window.toggleDeadlineForm = function () { | ||||
|   $('#deadlineForm').fadeToggle(150); | ||||
| }; | ||||
|  | ||||
| window.setDeadline = function () { | ||||
|   const deadline = $('#deadlineDate').val(); | ||||
|   window.updateDeadline(deadline); | ||||
| }; | ||||
|  | ||||
| window.updateDeadline = function (deadlineString) { | ||||
| function updateDeadline(deadlineString) { | ||||
|   $('#deadline-err-invalid-date').hide(); | ||||
|   $('#deadline-loader').addClass('loading'); | ||||
|  | ||||
| @@ -3519,7 +3511,20 @@ window.updateDeadline = function (deadlineString) { | ||||
|       $('#deadline-err-invalid-date').show(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
| } | ||||
|  | ||||
| function initIssueDue() { | ||||
|   $(document).on('click', '.issue-due-edit', () => { | ||||
|     $('#deadlineForm').fadeToggle(150); | ||||
|   }); | ||||
|   $(document).on('click', '.issue-due-remove', () => { | ||||
|     updateDeadline(''); | ||||
|   }); | ||||
|   $(document).on('submit', '.issue-due-form', () => { | ||||
|     updateDeadline($('#deadlineDate').val()); | ||||
|     return false; | ||||
|   }); | ||||
| } | ||||
|  | ||||
| window.deleteDependencyModal = function (id, type) { | ||||
|   $('.remove-dependency') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user