code.gitea.io/gitea@v1.22.3/templates/devtest/fetch-action.tmpl (about)

     1  {{template "base/head" .}}
     2  <div class="page-content devtest ui container">
     3  	{{template "base/alert" .}}
     4  	<div>
     5  		<h1>link-action</h1>
     6  		<div>
     7  			Use "window.fetch" to send a request to backend, the request is defined in an "A" or "BUTTON" element.
     8  			It might be renamed to "link-fetch-action" to match the "form-fetch-action".
     9  		</div>
    10  		<div>
    11  			<button class="link-action" data-url="fetch-action-test?k=1">test action</button>
    12  			<button class="link-action" data-url="fetch-action-test?k=1" data-modal-confirm="confirm?">test with confirm</button>
    13  			<button class="ui red button link-action" data-url="fetch-action-test?k=1" data-modal-confirm="confirm?">test with risky confirm</button>
    14  		</div>
    15  	</div>
    16  	<div>
    17  		<h1>form-fetch-action</h1>
    18  		<div>Use "window.fetch" to send a form request to backend</div>
    19  		<div>
    20  			<form method="get" action="fetch-action-test?k=1" class="form-fetch-action">
    21  				<button name="btn">submit get</button>
    22  			</form>
    23  			<form method="post" action="fetch-action-test?k=1" class="form-fetch-action">
    24  				<div><textarea name="text" rows="3"></textarea></div>
    25  				<div><label><input name="check" type="checkbox"> check</label></div>
    26  				<div><button name="btn">submit post</button></div>
    27  			</form>
    28  			<form method="post" action="no-such-uri" class="form-fetch-action">
    29  				<div class="tw-py-8">bad action url</div>
    30  				<div><button name="btn">submit test</button></div>
    31  			</form>
    32  		</div>
    33  	</div>
    34  </div>
    35  <style>
    36  	.ui.message.flash-message {
    37  		text-align: left;
    38  	}
    39  	.form-fetch-action {
    40  		margin-bottom: 1em;
    41  		border: 1px red dashed; /* show the border for demo purpose */
    42  	}
    43  </style>
    44  {{template "base/footer" .}}