mirror of
				https://github.com/osmarks/mycorrhiza.git
				synced 2025-10-31 07:33:00 +00:00 
			
		
		
		
	Isolate hypha deletion view
This commit is contained in:
		| @@ -23,14 +23,35 @@ var ( | |||||||
| {{define "upload a media"}}Загрузить медиа{{end}} | {{define "upload a media"}}Загрузить медиа{{end}} | ||||||
| {{define "upload a media tip"}}Загрузите изображение, видео или аудио. Распространённые форматы можно просматривать из браузера, остальные – просто скачать. Позже вы можете дописать пояснение к этому медиа.{{end}} | {{define "upload a media tip"}}Загрузите изображение, видео или аудио. Распространённые форматы можно просматривать из браузера, остальные – просто скачать. Позже вы можете дописать пояснение к этому медиа.{{end}} | ||||||
| {{define "upload a media btn"}}Загрузить{{end}} | {{define "upload a media btn"}}Загрузить{{end}} | ||||||
|  |  | ||||||
|  | {{define "delete hypha?"}}Удалить {{beautifulName .}}?{{end}} | ||||||
|  | {{define "delete [[hypha]]?"}}Удалить <a href="/hypha/{{.}}">{{beautifulName .}}</a>?{{end}} | ||||||
|  | {{define "want to delete?"}}Вы действительно хотите удалить эту гифу?{{end}} | ||||||
|  | {{define "delete tip"}}Нельзя отменить удаление гифы, но её история останется доступной.{{end}} | ||||||
| ` | ` | ||||||
| 	chainNaviTitle  viewutil.Chain | 	chainNaviTitle   viewutil.Chain | ||||||
| 	chainEmptyHypha viewutil.Chain | 	chainEmptyHypha  viewutil.Chain | ||||||
|  | 	chainDeleteHypha viewutil.Chain | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func Init() { | func Init() { | ||||||
| 	chainNaviTitle = viewutil.CopyEnRuWith(fs, "view_navititle.html", "") | 	chainNaviTitle = viewutil.CopyEnRuWith(fs, "view_navititle.html", "") | ||||||
| 	chainEmptyHypha = viewutil.CopyEnRuWith(fs, "view_empty_hypha.html", ruTranslation) | 	chainEmptyHypha = viewutil.CopyEnRuWith(fs, "view_empty_hypha.html", ruTranslation) | ||||||
|  | 	chainDeleteHypha = viewutil.CopyEnRuWith(fs, "view_delete.html", ruTranslation) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type deleteData struct { | ||||||
|  | 	*viewutil.BaseData | ||||||
|  | 	HyphaName string | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func DeleteHypha(meta viewutil.Meta, hyphaName string) { | ||||||
|  | 	viewutil.ExecutePage(meta, chainDeleteHypha, deleteData{ | ||||||
|  | 		BaseData: &viewutil.BaseData{ | ||||||
|  | 			Addr: "/delete/" + hyphaName, | ||||||
|  | 		}, | ||||||
|  | 		HyphaName: hyphaName, | ||||||
|  | 	}) | ||||||
| } | } | ||||||
|  |  | ||||||
| type emptyHyphaData struct { | type emptyHyphaData struct { | ||||||
|   | |||||||
							
								
								
									
										23
									
								
								hypview/view_delete.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								hypview/view_delete.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | {{define "title"}}{{template "delete hypha?" .HyphaName}}{{end}} | ||||||
|  | {{define "delete hypha?"}}Delete {{beautifulName .}}?{{end}} | ||||||
|  | {{define "body"}} | ||||||
|  | <main class="main-width"> | ||||||
|  | 	<form class="modal" action="/delete/{{.HyphaName}}" method="post"> | ||||||
|  | 		<fieldset class="modal__fieldset"> | ||||||
|  | 			<legend class="modal__title"> | ||||||
|  | 				{{block "delete [[hypha]]?" .HyphaName}}Delete <a href="/hypha/{{.}}">{{beautifulName .}}</a>?{{end}} | ||||||
|  | 			</legend> | ||||||
|  | 			<p class="modal__confirmation-msg"> | ||||||
|  | 				{{block "want to delete?" .}}Do you really want to delete this hypha?{{end}} | ||||||
|  | 			</p> | ||||||
|  | 			<p>{{block "delete tip" .}}You cannot undelete a deleted hypha but the history can still be accessed.{{end}}</p> | ||||||
|  | 			<button type="submit" value="Confirm" class="btn" autofocus> | ||||||
|  | 				{{template "confirm"}} | ||||||
|  | 			</button> | ||||||
|  | 			<a href="/hypha/{%s hyphaName %}" class="btn btn_weak"> | ||||||
|  | 				{{template "cancel"}} | ||||||
|  | 			</a> | ||||||
|  | 		</fieldset> | ||||||
|  | 	</form> | ||||||
|  | </main> | ||||||
|  | {{end}} | ||||||
| @@ -50,8 +50,6 @@ | |||||||
| 	"act_norights_edit": "You must be an editor to edit a hypha", | 	"act_norights_edit": "You must be an editor to edit a hypha", | ||||||
| 	"act_norights_upload_media": "You must be an editor to upload media", | 	"act_norights_upload_media": "You must be an editor to upload media", | ||||||
|  |  | ||||||
| 	"ask_delete": "Delete %s?", |  | ||||||
| 	"ask_delete_tip": "In this version of Mycorrhiza Wiki you cannot undelete a deleted hypha but the history can still be accessed.", |  | ||||||
| 	"ask_remove_media": "Remove media from %s?", | 	"ask_remove_media": "Remove media from %s?", | ||||||
| 	"ask_really": "Do you really want to {{.verb}} hypha {{.name}}?", | 	"ask_really": "Do you really want to {{.verb}} hypha {{.name}}?", | ||||||
| 	"ask_delete_verb": "delete", | 	"ask_delete_verb": "delete", | ||||||
|   | |||||||
| @@ -55,11 +55,8 @@ | |||||||
| 	"act_notexist_rename": "Нельзя переименовать эту гифу, потому что она не существует", | 	"act_notexist_rename": "Нельзя переименовать эту гифу, потому что она не существует", | ||||||
| 	"act_notexist_remove_media": "Нельзя убрать медиа, потому что нет такой гифы", | 	"act_notexist_remove_media": "Нельзя убрать медиа, потому что нет такой гифы", | ||||||
|  |  | ||||||
| 	"ask_delete": "Удалить «%s»?", |  | ||||||
| 	"ask_delete_tip": "В этой версии Микоризы нельзя отменить удаление гифы, но её история останется доступной.", |  | ||||||
| 	"ask_remove_media": "Убрать медиа у «%s»?", | 	"ask_remove_media": "Убрать медиа у «%s»?", | ||||||
| 	"ask_really": "Вы действительно хотите {{.verb}} гифу «{{.name}}»?", | 	"ask_really": "Вы действительно хотите {{.verb}} гифу «{{.name}}»?", | ||||||
| 	"ask_delete_verb": "удалить", |  | ||||||
| 	"ask_remove_media_verb": "убрать медиа", | 	"ask_remove_media_verb": "убрать медиа", | ||||||
|  |  | ||||||
| 	"revision_title": "{{.name}} из {{.rev}}", | 	"revision_title": "{{.name}} из {{.rev}}", | ||||||
|   | |||||||
| @@ -2,31 +2,6 @@ | |||||||
| {% import "net/http" %} | {% import "net/http" %} | ||||||
| {% import "github.com/bouncepaw/mycorrhiza/l18n" %} | {% import "github.com/bouncepaw/mycorrhiza/l18n" %} | ||||||
|  |  | ||||||
| {% func DeleteAsk(rq *http.Request, hyphaName string) %} |  | ||||||
| {% code  |  | ||||||
|   lc := l18n.FromRequest(rq) |  | ||||||
| %} |  | ||||||
| <main class="main-width"> |  | ||||||
| 	<form class="modal" action="/delete/{%s hyphaName %}" method="post"> |  | ||||||
| 		<fieldset class="modal__fieldset"> |  | ||||||
| 			<legend class="modal__title"> |  | ||||||
| 				{%s= fmt.Sprintf(lc.Get("ui.ask_delete"), beautifulLink(hyphaName)) %} |  | ||||||
| 			</legend> |  | ||||||
| 			<p class="modal__confirmation-msg"> |  | ||||||
| 				{%s= lc.Get("ui.ask_really", &l18n.Replacements{"verb": lc.Get("ui.ask_delete_verb"), "name": fmt.Sprintf("<em>%s</em>", hyphaName)}) %} |  | ||||||
| 			</p> |  | ||||||
| 			<p>{%s lc.Get("ui.ask_delete_tip") %}</p> |  | ||||||
| 			<button type="submit" value="Confirm" class="btn" autofocus> |  | ||||||
| 				{%s lc.Get("ui.confirm") %} |  | ||||||
| 			</button> |  | ||||||
| 			<a href="/hypha/{%s hyphaName %}" class="btn btn_weak"> |  | ||||||
| 				{%s lc.Get("ui.cancel") %} |  | ||||||
| 			</a> |  | ||||||
| 		</fieldset> |  | ||||||
| 	</form> |  | ||||||
| </main> |  | ||||||
| {% endfunc %} |  | ||||||
|  |  | ||||||
| {% func RemoveMediaAsk(rq *http.Request, hyphaName string) %} | {% func RemoveMediaAsk(rq *http.Request, hyphaName string) %} | ||||||
| {% code  | {% code  | ||||||
|   lc := l18n.FromRequest(rq) |   lc := l18n.FromRequest(rq) | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ var ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| //line views/modal.qtpl:5 | //line views/modal.qtpl:5 | ||||||
| func StreamDeleteAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string) { | func StreamRemoveMediaAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string) { | ||||||
| //line views/modal.qtpl:5 | //line views/modal.qtpl:5 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| `) | `) | ||||||
| @@ -37,7 +37,7 @@ func StreamDeleteAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName stri | |||||||
| //line views/modal.qtpl:8 | //line views/modal.qtpl:8 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| <main class="main-width"> | <main class="main-width"> | ||||||
| 	<form class="modal" action="/delete/`) | 	<form class="modal" action="/remove-media/`) | ||||||
| //line views/modal.qtpl:10 | //line views/modal.qtpl:10 | ||||||
| 	qw422016.E().S(hyphaName) | 	qw422016.E().S(hyphaName) | ||||||
| //line views/modal.qtpl:10 | //line views/modal.qtpl:10 | ||||||
| @@ -46,245 +46,162 @@ func StreamDeleteAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName stri | |||||||
| 			<legend class="modal__title"> | 			<legend class="modal__title"> | ||||||
| 				`) | 				`) | ||||||
| //line views/modal.qtpl:13 | //line views/modal.qtpl:13 | ||||||
| 	qw422016.N().S(fmt.Sprintf(lc.Get("ui.ask_delete"), beautifulLink(hyphaName))) | 	qw422016.N().S(fmt.Sprintf(lc.Get("ui.ask_remove_media"), beautifulLink(hyphaName))) | ||||||
| //line views/modal.qtpl:13 | //line views/modal.qtpl:13 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| 			</legend> | 			</legend> | ||||||
| 			<p class="modal__confirmation-msg"> | 			<p class="modal__confirmation-msg"> | ||||||
| 				`) | 				`) | ||||||
| //line views/modal.qtpl:16 | //line views/modal.qtpl:16 | ||||||
| 	qw422016.N().S(lc.Get("ui.ask_really", &l18n.Replacements{"verb": lc.Get("ui.ask_delete_verb"), "name": fmt.Sprintf("<em>%s</em>", hyphaName)})) | 	qw422016.N().S(lc.Get("ui.ask_really", &l18n.Replacements{"verb": lc.Get("ui.ask_remove_media_verb"), "name": fmt.Sprintf("<em>%s</em>", hyphaName)})) | ||||||
| //line views/modal.qtpl:16 | //line views/modal.qtpl:16 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| 			</p> | 			</p> | ||||||
| 			<p>`) |  | ||||||
| //line views/modal.qtpl:18 |  | ||||||
| 	qw422016.E().S(lc.Get("ui.ask_delete_tip")) |  | ||||||
| //line views/modal.qtpl:18 |  | ||||||
| 	qw422016.N().S(`</p> |  | ||||||
| 			<button type="submit" value="Confirm" class="btn" autofocus> | 			<button type="submit" value="Confirm" class="btn" autofocus> | ||||||
| 				`) | 				`) | ||||||
| //line views/modal.qtpl:20 | //line views/modal.qtpl:19 | ||||||
| 	qw422016.E().S(lc.Get("ui.confirm")) | 	qw422016.E().S(lc.Get("ui.confirm")) | ||||||
| //line views/modal.qtpl:20 | //line views/modal.qtpl:19 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| 			</button> | 			</button> | ||||||
| 			<a href="/hypha/`) | 			<a href="/hypha/`) | ||||||
| //line views/modal.qtpl:22 | //line views/modal.qtpl:21 | ||||||
| 	qw422016.E().S(hyphaName) | 	qw422016.E().S(hyphaName) | ||||||
| //line views/modal.qtpl:22 | //line views/modal.qtpl:21 | ||||||
| 	qw422016.N().S(`" class="btn btn_weak"> | 	qw422016.N().S(`" class="btn btn_weak"> | ||||||
| 				`) | 				`) | ||||||
| //line views/modal.qtpl:23 | //line views/modal.qtpl:22 | ||||||
| 	qw422016.E().S(lc.Get("ui.cancel")) | 	qw422016.E().S(lc.Get("ui.cancel")) | ||||||
| //line views/modal.qtpl:23 | //line views/modal.qtpl:22 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| 			</a> | 			</a> | ||||||
| 		</fieldset> | 		</fieldset> | ||||||
| 	</form> | 	</form> | ||||||
| </main> | </main> | ||||||
| `) | `) | ||||||
| //line views/modal.qtpl:28 | //line views/modal.qtpl:27 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/modal.qtpl:28 | //line views/modal.qtpl:27 | ||||||
| func WriteDeleteAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) { |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| 	StreamDeleteAsk(qw422016, rq, hyphaName) |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| 	qt422016.ReleaseWriter(qw422016) |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| func DeleteAsk(rq *http.Request, hyphaName string) string { |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| 	qb422016 := qt422016.AcquireByteBuffer() |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| 	WriteDeleteAsk(qb422016, rq, hyphaName) |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| 	qs422016 := string(qb422016.B) |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| 	qt422016.ReleaseByteBuffer(qb422016) |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| 	return qs422016 |  | ||||||
| //line views/modal.qtpl:28 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| //line views/modal.qtpl:30 |  | ||||||
| func StreamRemoveMediaAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string) { |  | ||||||
| //line views/modal.qtpl:30 |  | ||||||
| 	qw422016.N().S(` |  | ||||||
| `) |  | ||||||
| //line views/modal.qtpl:32 |  | ||||||
| 	lc := l18n.FromRequest(rq) |  | ||||||
|  |  | ||||||
| //line views/modal.qtpl:33 |  | ||||||
| 	qw422016.N().S(` |  | ||||||
| <main class="main-width"> |  | ||||||
| 	<form class="modal" action="/remove-media/`) |  | ||||||
| //line views/modal.qtpl:35 |  | ||||||
| 	qw422016.E().S(hyphaName) |  | ||||||
| //line views/modal.qtpl:35 |  | ||||||
| 	qw422016.N().S(`" method="post"> |  | ||||||
| 		<fieldset class="modal__fieldset"> |  | ||||||
| 			<legend class="modal__title">`) |  | ||||||
| //line views/modal.qtpl:37 |  | ||||||
| 	qw422016.N().S(fmt.Sprintf(lc.Get("ui.ask_remove_media"), beautifulLink(hyphaName))) |  | ||||||
| //line views/modal.qtpl:37 |  | ||||||
| 	qw422016.N().S(`</legend> |  | ||||||
| 			<p class="modal__confirmation-msg"> |  | ||||||
| 				`) |  | ||||||
| //line views/modal.qtpl:39 |  | ||||||
| 	qw422016.N().S(lc.Get("ui.ask_really", &l18n.Replacements{"verb": lc.Get("ui.ask_remove_media_verb"), "name": fmt.Sprintf("<em>%s</em>", hyphaName)})) |  | ||||||
| //line views/modal.qtpl:39 |  | ||||||
| 	qw422016.N().S(` |  | ||||||
| 			</p> |  | ||||||
| 			<button type="submit" value="Confirm" class="btn" autofocus> |  | ||||||
| 				`) |  | ||||||
| //line views/modal.qtpl:42 |  | ||||||
| 	qw422016.E().S(lc.Get("ui.confirm")) |  | ||||||
| //line views/modal.qtpl:42 |  | ||||||
| 	qw422016.N().S(` |  | ||||||
| 			</button> |  | ||||||
| 			<a href="/hypha/`) |  | ||||||
| //line views/modal.qtpl:44 |  | ||||||
| 	qw422016.E().S(hyphaName) |  | ||||||
| //line views/modal.qtpl:44 |  | ||||||
| 	qw422016.N().S(`" class="btn btn_weak"> |  | ||||||
| 				`) |  | ||||||
| //line views/modal.qtpl:45 |  | ||||||
| 	qw422016.E().S(lc.Get("ui.cancel")) |  | ||||||
| //line views/modal.qtpl:45 |  | ||||||
| 	qw422016.N().S(` |  | ||||||
| 			</a> |  | ||||||
| 		</fieldset> |  | ||||||
| 	</form> |  | ||||||
| </main> |  | ||||||
| `) |  | ||||||
| //line views/modal.qtpl:50 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| //line views/modal.qtpl:50 |  | ||||||
| func WriteRemoveMediaAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) { | func WriteRemoveMediaAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) { | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| 	StreamRemoveMediaAsk(qw422016, rq, hyphaName) | 	StreamRemoveMediaAsk(qw422016, rq, hyphaName) | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| 	qt422016.ReleaseWriter(qw422016) | 	qt422016.ReleaseWriter(qw422016) | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| func RemoveMediaAsk(rq *http.Request, hyphaName string) string { | func RemoveMediaAsk(rq *http.Request, hyphaName string) string { | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| 	qb422016 := qt422016.AcquireByteBuffer() | 	qb422016 := qt422016.AcquireByteBuffer() | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| 	WriteRemoveMediaAsk(qb422016, rq, hyphaName) | 	WriteRemoveMediaAsk(qb422016, rq, hyphaName) | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| 	qs422016 := string(qb422016.B) | 	qs422016 := string(qb422016.B) | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| 	qt422016.ReleaseByteBuffer(qb422016) | 	qt422016.ReleaseByteBuffer(qb422016) | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| 	return qs422016 | 	return qs422016 | ||||||
| //line views/modal.qtpl:50 | //line views/modal.qtpl:27 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/modal.qtpl:52 | //line views/modal.qtpl:29 | ||||||
| func StreamRenameAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string) { | func StreamRenameAsk(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string) { | ||||||
| //line views/modal.qtpl:52 | //line views/modal.qtpl:29 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| `) | `) | ||||||
| //line views/modal.qtpl:54 | //line views/modal.qtpl:31 | ||||||
| 	lc := l18n.FromRequest(rq) | 	lc := l18n.FromRequest(rq) | ||||||
|  |  | ||||||
| //line views/modal.qtpl:55 | //line views/modal.qtpl:32 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| <main class="main-width"> | <main class="main-width"> | ||||||
| 	<form class="modal" action="/rename/`) | 	<form class="modal" action="/rename/`) | ||||||
| //line views/modal.qtpl:57 | //line views/modal.qtpl:34 | ||||||
| 	qw422016.E().S(hyphaName) | 	qw422016.E().S(hyphaName) | ||||||
| //line views/modal.qtpl:57 | //line views/modal.qtpl:34 | ||||||
| 	qw422016.N().S(`" method="post" enctype="multipart/form-data"> | 	qw422016.N().S(`" method="post" enctype="multipart/form-data"> | ||||||
| 		<fieldset class="modal__fieldset"> | 		<fieldset class="modal__fieldset"> | ||||||
| 			<legend class="modal__title">`) | 			<legend class="modal__title"> | ||||||
| //line views/modal.qtpl:59 | 				`) | ||||||
|  | //line views/modal.qtpl:37 | ||||||
| 	qw422016.N().S(fmt.Sprintf(lc.Get("ui.ask_rename"), beautifulLink(hyphaName))) | 	qw422016.N().S(fmt.Sprintf(lc.Get("ui.ask_rename"), beautifulLink(hyphaName))) | ||||||
| //line views/modal.qtpl:59 | //line views/modal.qtpl:37 | ||||||
| 	qw422016.N().S(`</legend> | 	qw422016.N().S(` | ||||||
|  | 			</legend> | ||||||
| 			<label for="new-name">`) | 			<label for="new-name">`) | ||||||
| //line views/modal.qtpl:60 | //line views/modal.qtpl:39 | ||||||
| 	qw422016.E().S(lc.Get("ui.rename_to")) | 	qw422016.E().S(lc.Get("ui.rename_to")) | ||||||
| //line views/modal.qtpl:60 | //line views/modal.qtpl:39 | ||||||
| 	qw422016.N().S(`</label> | 	qw422016.N().S(`</label> | ||||||
| 			<input type="text" value="`) | 			<input type="text" value="`) | ||||||
| //line views/modal.qtpl:61 | //line views/modal.qtpl:40 | ||||||
| 	qw422016.E().S(hyphaName) | 	qw422016.E().S(hyphaName) | ||||||
| //line views/modal.qtpl:61 | //line views/modal.qtpl:40 | ||||||
| 	qw422016.N().S(`" required autofocus id="new-name" name="new-name"/> | 	qw422016.N().S(`" required autofocus id="new-name" name="new-name"/> | ||||||
|  |  | ||||||
| 			<input type="checkbox" id="recursive" name="recursive" value="true" checked/> | 			<input type="checkbox" id="recursive" name="recursive" value="true" checked/> | ||||||
| 			<label for="recursive">`) | 			<label for="recursive">`) | ||||||
| //line views/modal.qtpl:64 | //line views/modal.qtpl:43 | ||||||
| 	qw422016.E().S(lc.Get("ui.rename_recurse")) | 	qw422016.E().S(lc.Get("ui.rename_recurse")) | ||||||
| //line views/modal.qtpl:64 | //line views/modal.qtpl:43 | ||||||
| 	qw422016.N().S(`</label> | 	qw422016.N().S(`</label> | ||||||
|  |  | ||||||
| 			<p>`) | 			<p>`) | ||||||
| //line views/modal.qtpl:66 | //line views/modal.qtpl:45 | ||||||
| 	qw422016.E().S(lc.Get("ui.rename_tip")) | 	qw422016.E().S(lc.Get("ui.rename_tip")) | ||||||
| //line views/modal.qtpl:66 | //line views/modal.qtpl:45 | ||||||
| 	qw422016.N().S(`</p> | 	qw422016.N().S(`</p> | ||||||
| 			<button type="submit" value="Confirm" class="btn"> | 			<button type="submit" value="Confirm" class="btn"> | ||||||
| 				`) | 				`) | ||||||
| //line views/modal.qtpl:68 | //line views/modal.qtpl:47 | ||||||
| 	qw422016.E().S(lc.Get("ui.confirm")) | 	qw422016.E().S(lc.Get("ui.confirm")) | ||||||
| //line views/modal.qtpl:68 | //line views/modal.qtpl:47 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| 			</button> | 			</button> | ||||||
| 			<a href="/hypha/`) | 			<a href="/hypha/`) | ||||||
| //line views/modal.qtpl:70 | //line views/modal.qtpl:49 | ||||||
| 	qw422016.E().S(hyphaName) | 	qw422016.E().S(hyphaName) | ||||||
| //line views/modal.qtpl:70 | //line views/modal.qtpl:49 | ||||||
| 	qw422016.N().S(`" class="btn btn_weak"> | 	qw422016.N().S(`" class="btn btn_weak"> | ||||||
| 				`) | 				`) | ||||||
| //line views/modal.qtpl:71 | //line views/modal.qtpl:50 | ||||||
| 	qw422016.E().S(lc.Get("ui.cancel")) | 	qw422016.E().S(lc.Get("ui.cancel")) | ||||||
| //line views/modal.qtpl:71 | //line views/modal.qtpl:50 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| 			</a> | 			</a> | ||||||
| 		</fieldset> | 		</fieldset> | ||||||
| 	</form> | 	</form> | ||||||
| </main> | </main> | ||||||
| `) | `) | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| func WriteRenameAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) { | func WriteRenameAsk(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string) { | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| 	StreamRenameAsk(qw422016, rq, hyphaName) | 	StreamRenameAsk(qw422016, rq, hyphaName) | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| 	qt422016.ReleaseWriter(qw422016) | 	qt422016.ReleaseWriter(qw422016) | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| func RenameAsk(rq *http.Request, hyphaName string) string { | func RenameAsk(rq *http.Request, hyphaName string) string { | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| 	qb422016 := qt422016.AcquireByteBuffer() | 	qb422016 := qt422016.AcquireByteBuffer() | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| 	WriteRenameAsk(qb422016, rq, hyphaName) | 	WriteRenameAsk(qb422016, rq, hyphaName) | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| 	qs422016 := string(qb422016.B) | 	qs422016 := string(qb422016.B) | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| 	qt422016.ReleaseByteBuffer(qb422016) | 	qt422016.ReleaseByteBuffer(qb422016) | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| 	return qs422016 | 	return qs422016 | ||||||
| //line views/modal.qtpl:76 | //line views/modal.qtpl:55 | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | {{define "confirm"}}Confirm{{end}} | ||||||
|  | {{define "cancel"}}Cancel{{end}} | ||||||
| {{define "page"}} | {{define "page"}} | ||||||
| <!doctype html> | <!doctype html> | ||||||
| <html lang="{{.Meta.Locale}}"> | <html lang="{{.Meta.Locale}}"> | ||||||
|   | |||||||
| @@ -25,6 +25,8 @@ const ruText = ` | |||||||
| {{define "close this dialog"}}Закрыть этот диалог{{end}} | {{define "close this dialog"}}Закрыть этот диалог{{end}} | ||||||
| {{define "login"}}Войти{{end}} | {{define "login"}}Войти{{end}} | ||||||
| {{define "register"}}Регистрация{{end}} | {{define "register"}}Регистрация{{end}} | ||||||
|  | {{define "confirm"}}Подтвердить{{end}} | ||||||
|  | {{define "cancel"}}Отмена{{end}} | ||||||
| ` | ` | ||||||
|  |  | ||||||
| func Init() { | func Init() { | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ package web | |||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/bouncepaw/mycomarkup/v5" | 	"github.com/bouncepaw/mycomarkup/v5" | ||||||
|  | 	"github.com/bouncepaw/mycorrhiza/hypview" | ||||||
| 	"github.com/bouncepaw/mycorrhiza/mycoopts" | 	"github.com/bouncepaw/mycorrhiza/mycoopts" | ||||||
| 	"github.com/bouncepaw/mycorrhiza/viewutil" | 	"github.com/bouncepaw/mycorrhiza/viewutil" | ||||||
| 	"log" | 	"log" | ||||||
| @@ -69,7 +70,6 @@ func handlerDelete(w http.ResponseWriter, rq *http.Request) { | |||||||
| 	util.PrepareRq(rq) | 	util.PrepareRq(rq) | ||||||
| 	var ( | 	var ( | ||||||
| 		u    = user.FromRequest(rq) | 		u    = user.FromRequest(rq) | ||||||
| 		lc   = l18n.FromRequest(rq) |  | ||||||
| 		h    = hyphae.ByName(util.HyphaNameFromRq(rq, "delete")) | 		h    = hyphae.ByName(util.HyphaNameFromRq(rq, "delete")) | ||||||
| 		meta = viewutil.MetaFrom(w, rq) | 		meta = viewutil.MetaFrom(w, rq) | ||||||
| 	) | 	) | ||||||
| @@ -89,12 +89,7 @@ func handlerDelete(w http.ResponseWriter, rq *http.Request) { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if rq.Method == "GET" { | 	if rq.Method == "GET" { | ||||||
| 		util.HTTP200Page( | 		hypview.DeleteHypha(meta, h.CanonicalName()) | ||||||
| 			w, |  | ||||||
| 			views.Base( |  | ||||||
| 				meta, |  | ||||||
| 				fmt.Sprintf(lc.Get("ui.ask_delete"), util.BeautifulName(h.CanonicalName())), |  | ||||||
| 				views.DeleteAsk(rq, h.CanonicalName()))) |  | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Timur Ismagilov
					Timur Ismagilov