Do not disable commit changes button on repost (#12644)
If the user has pressed commit changes and the post has failed - do not disable the commit changes button. Fix #12072 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		
							parent
							
								
									9abc16a280
								
							
						
					
					
						commit
						17fbbe97d7
					
				
					 3 changed files with 5 additions and 1 deletions
				
			
		|  | @ -184,6 +184,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	ctx.Data["PageIsEdit"] = true | 	ctx.Data["PageIsEdit"] = true | ||||||
|  | 	ctx.Data["PageHasPosted"] = true | ||||||
| 	ctx.Data["IsNewFile"] = isNewFile | 	ctx.Data["IsNewFile"] = isNewFile | ||||||
| 	ctx.Data["RequireHighlightJS"] = true | 	ctx.Data["RequireHighlightJS"] = true | ||||||
| 	ctx.Data["RequireSimpleMDE"] = true | 	ctx.Data["RequireSimpleMDE"] = true | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ | ||||||
| 		<form class="ui edit form" method="post"> | 		<form class="ui edit form" method="post"> | ||||||
| 			{{.CsrfTokenHtml}} | 			{{.CsrfTokenHtml}} | ||||||
| 			<input type="hidden" name="last_commit" value="{{.last_commit}}"> | 			<input type="hidden" name="last_commit" value="{{.last_commit}}"> | ||||||
|  | 			<input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}"> | ||||||
| 			<div class="ui secondary menu"> | 			<div class="ui secondary menu"> | ||||||
| 				<div class="fitted item treepath"> | 				<div class="fitted item treepath"> | ||||||
| 					<div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> | 					<div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> | ||||||
|  |  | ||||||
|  | @ -1592,7 +1592,9 @@ async function initEditor() { | ||||||
|   const dirtyFileClass = 'dirty-file'; |   const dirtyFileClass = 'dirty-file'; | ||||||
| 
 | 
 | ||||||
|   // Disabling the button at the start
 |   // Disabling the button at the start
 | ||||||
|   $commitButton.prop('disabled', true); |   if ($('input[name="page_has_posted"]').val() !== 'true') { | ||||||
|  |     $commitButton.prop('disabled', true); | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   // Registering a custom listener for the file path and the file content
 |   // Registering a custom listener for the file path and the file content
 | ||||||
|   $editForm.areYouSure({ |   $editForm.areYouSure({ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue