Added the attachment managers to Cosora.
The attachment manager now takes up less vertical space when there aren't any attachments on a post. Fixed a bug where opening the topic editor would open all of the attachment managers on the page. Removed the inline style for #upload_files_op.
This commit is contained in:
parent
4df0313961
commit
7d14b4afbb
|
@ -166,6 +166,7 @@ type CustomPagePage struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type TopicCEditPost struct {
|
type TopicCEditPost struct {
|
||||||
|
ID int
|
||||||
Source string
|
Source string
|
||||||
Ref string
|
Ref string
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,7 +477,7 @@ func compileJSTemplates(wg *sync.WaitGroup, c *tmpl.CTemplateSet, themeName stri
|
||||||
pageList := Paginate(20, itemsPerPage, 5)
|
pageList := Paginate(20, itemsPerPage, 5)
|
||||||
tmpls.AddStd("paginator", "common.Paginator", Paginator{pageList, page, lastPage})
|
tmpls.AddStd("paginator", "common.Paginator", Paginator{pageList, page, lastPage})
|
||||||
|
|
||||||
tmpls.AddStd("topic_c_edit_post", "common.TopicCEditPost", TopicCEditPost{Source: "", Ref: ""})
|
tmpls.AddStd("topic_c_edit_post", "common.TopicCEditPost", TopicCEditPost{ID: 0, Source: "", Ref: ""})
|
||||||
|
|
||||||
tmpls.AddStd("topic_c_attach_item", "common.TopicCAttachItem", TopicCAttachItem{ID: 1, ImgSrc: "", Path: "", FullPath: ""})
|
tmpls.AddStd("topic_c_attach_item", "common.TopicCAttachItem", TopicCAttachItem{ID: 1, ImgSrc: "", Path: "", FullPath: ""})
|
||||||
|
|
||||||
|
|
|
@ -653,16 +653,21 @@ function mainInit(){
|
||||||
|
|
||||||
$(".edit_item").click(function(event){
|
$(".edit_item").click(function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
let blockParent = this.closest('.editable_parent');
|
let blockParent = this.closest('.editable_parent');
|
||||||
$(blockParent).find('.hide_on_edit').addClass("edit_opened");
|
$(blockParent).find('.hide_on_edit').addClass("edit_opened");
|
||||||
$(blockParent).find('.show_on_edit').addClass("edit_opened");
|
$(blockParent).find('.show_on_edit').addClass("edit_opened");
|
||||||
|
$(blockParent).find('.hide_on_block_edit').addClass("edit_opened");
|
||||||
|
$(blockParent).find('.show_on_block_edit').addClass("edit_opened");
|
||||||
let srcNode = blockParent.querySelector(".edit_source");
|
let srcNode = blockParent.querySelector(".edit_source");
|
||||||
let block = blockParent.querySelector('.editable_block');
|
let block = blockParent.querySelector('.editable_block');
|
||||||
block.classList.add("in_edit");
|
block.classList.add("in_edit");
|
||||||
|
|
||||||
let source = "";
|
let source = "";
|
||||||
if(srcNode!=null) source = srcNode.innerText;
|
if(srcNode!=null) source = srcNode.innerText;
|
||||||
else source = block.innerHTML;
|
else source = block.innerHTML;
|
||||||
block.innerHTML = Template_topic_c_edit_post({
|
block.innerHTML = Template_topic_c_edit_post({
|
||||||
|
ID: blockParent.getAttribute("id").slice("post-".length),
|
||||||
Source: source,
|
Source: source,
|
||||||
Ref: this.closest('a').getAttribute("href")
|
Ref: this.closest('a').getAttribute("href")
|
||||||
})
|
})
|
||||||
|
@ -672,6 +677,8 @@ function mainInit(){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(blockParent).find('.hide_on_edit').removeClass("edit_opened");
|
$(blockParent).find('.hide_on_edit').removeClass("edit_opened");
|
||||||
$(blockParent).find('.show_on_edit').removeClass("edit_opened");
|
$(blockParent).find('.show_on_edit').removeClass("edit_opened");
|
||||||
|
$(blockParent).find('.hide_on_block_edit').removeClass("edit_opened");
|
||||||
|
$(blockParent).find('.show_on_block_edit').removeClass("edit_opened");
|
||||||
block.classList.remove("in_edit");
|
block.classList.remove("in_edit");
|
||||||
let newContent = block.querySelector('textarea').value;
|
let newContent = block.querySelector('textarea').value;
|
||||||
block.innerHTML = quickParse(newContent);
|
block.innerHTML = quickParse(newContent);
|
||||||
|
@ -716,8 +723,7 @@ function mainInit(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".edit_fields").click(function(event)
|
$(".edit_fields").click(function(event) {
|
||||||
{
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if($(this).find("input").length !== 0) return;
|
if($(this).find("input").length !== 0) return;
|
||||||
//console.log("clicked .edit_fields");
|
//console.log("clicked .edit_fields");
|
||||||
|
|
|
@ -79,9 +79,9 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
<div class="attach_item attach_item_buttons">
|
<div class="attach_item attach_item_buttons">
|
||||||
{{if .CurrentUser.Perms.UploadFiles}}
|
{{if .CurrentUser.Perms.UploadFiles}}
|
||||||
<input name="upload_files" id="upload_files_op" multiple type="file" style="display: none;" />
|
<input name="upload_files" id="upload_files_op" multiple type="file" class="auto_hide" />
|
||||||
<label for="upload_files_op" class="formbutton add_file_button">{{lang "topic.upload_button_text"}}</label>{{end}}
|
<label for="upload_files_op" class="formbutton add_file_button">{{lang "topic.upload_button_text"}}</label>{{end}}
|
||||||
<button class="attach_item_delete">{{lang "topic.delete_button_text"}}</button>
|
<button class="attach_item_delete formbutton">{{lang "topic.delete_button_text"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="edit_source auto_hide">{{.Content}}</div>
|
<div class="edit_source auto_hide">{{.Content}}</div>
|
||||||
|
|
||||||
{{if $.CurrentUser.Perms.EditReply}}
|
{{if $.CurrentUser.Perms.EditReply}}
|
||||||
<div class="show_on_edit show_on_block_edit attach_edit_bay" type="reply" id="{{.ID}}">
|
<div class="show_on_block_edit attach_edit_bay" type="reply" id="{{.ID}}">
|
||||||
{{range .Attachments}}
|
{{range .Attachments}}
|
||||||
<div class="attach_item attach_item_item{{if .Image}} attach_image_holder{{end}}">
|
<div class="attach_item attach_item_item{{if .Image}} attach_image_holder{{end}}">
|
||||||
{{if .Image}}<img src="//{{$.Header.Site.URL}}/attachs/{{.Path}}?sectionID={{.SectionID}}&sectionType=forums" height=24 width=24 />{{end}}
|
{{if .Image}}<img src="//{{$.Header.Site.URL}}/attachs/{{.Path}}?sectionID={{.SectionID}}&sectionType=forums" height=24 width=24 />{{end}}
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
{{if $.CurrentUser.Perms.UploadFiles}}
|
{{if $.CurrentUser.Perms.UploadFiles}}
|
||||||
<input name="upload_files" class="upload_files_post auto_hide" id="upload_files_post_{{.ID}}" multiple type="file" />
|
<input name="upload_files" class="upload_files_post auto_hide" id="upload_files_post_{{.ID}}" multiple type="file" />
|
||||||
<label for="upload_files_post_{{.ID}}" class="formbutton add_file_button">{{lang "topic.upload_button_text"}}</label>{{end}}
|
<label for="upload_files_post_{{.ID}}" class="formbutton add_file_button">{{lang "topic.upload_button_text"}}</label>{{end}}
|
||||||
<button class="attach_item_delete">{{lang "topic.delete_button_text"}}</button>
|
<button class="attach_item_delete formbutton">{{lang "topic.delete_button_text"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}{{end}}
|
{{end}}{{end}}
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
<textarea style='width: 99%;' name='edit_item'>{{.Source}}</textarea><br>
|
<textarea style='width: 99%;' name='edit_item'>{{.Source}}</textarea><br>
|
||||||
<a href='{{.Ref}}'><button class='submit_edit' type='submit'>{{lang "topic.update_button"}}</button></a>
|
<div class="update_buttons">
|
||||||
|
<a href='{{.Ref}}'><button class='submit_edit' type='submit'>{{lang "topic.update_button"}}</button></a>
|
||||||
|
<label for="upload_files_post_{{.ID}}" class="formbutton add_file_button">{{lang "topic.reply_add_file_button"}}</label>
|
||||||
|
</div>
|
|
@ -595,9 +595,9 @@ input[type=checkbox]:checked + label.poll_option_label .sel {
|
||||||
}
|
}
|
||||||
|
|
||||||
.formbutton {
|
.formbutton {
|
||||||
margin-top: 12px;
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
.quick_button_row .formitem {
|
.quick_button_row .formitem {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -1087,6 +1087,13 @@ blockquote:first-child {
|
||||||
red {
|
red {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
.update_buttons {
|
||||||
|
margin-top: -8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.update_buttons .add_file_button {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
.button_container {
|
.button_container {
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -1170,8 +1177,55 @@ red {
|
||||||
}
|
}
|
||||||
|
|
||||||
.attach_edit_bay {
|
.attach_edit_bay {
|
||||||
|
margin-top: -4px;
|
||||||
|
}
|
||||||
|
.top_post .attach_edit_bay {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.attach_item {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 4px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 8px;
|
||||||
|
padding-left: 0px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.attach_item img {
|
||||||
|
margin-right: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.attach_item_item {
|
||||||
|
background-color: #EEEEEE;
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
.attach_item_item span {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
margin-right: auto;
|
||||||
|
padding-top: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 350px;
|
||||||
|
}
|
||||||
|
.attach_image_holder span {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
.attach_item_buttons label, .attach_item_select, .attach_item_delete {
|
||||||
|
margin-left: 0px;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-top: 0px;
|
||||||
|
}
|
||||||
|
.post_item:not(.has_attachs) .attach_item_buttons,
|
||||||
|
.has_attachs .update_buttons .add_file_button {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.update_buttons a button {
|
||||||
|
margin-top: 0px;
|
||||||
|
}
|
||||||
|
.top_post .attach_item_buttons {
|
||||||
|
margin-top: -4px;
|
||||||
|
}
|
||||||
.zone_view_topic .pageset {
|
.zone_view_topic .pageset {
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -875,13 +875,16 @@ blockquote:first-child {
|
||||||
red {
|
red {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
.user_content.in_edit a {
|
.update_buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #444444;
|
background-color: #444444;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin-top: 4px; /*8 without <br>*/
|
margin-top: 4px; /*8 without <br>*/
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
}
|
}
|
||||||
|
.user_content.in_edit a {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
.post_item .button_container {
|
.post_item .button_container {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
@ -974,10 +977,6 @@ input[type=checkbox]:checked + label .sel {
|
||||||
content: "{{lang "topic.like_count_suffix" . }}";
|
content: "{{lang "topic.like_count_suffix" . }}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.attach_edit_bay {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
}*/
|
|
||||||
.attach_item {
|
.attach_item {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #444444;
|
background-color: #444444;
|
||||||
|
@ -994,9 +993,6 @@ input[type=checkbox]:checked + label .sel {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
.attach_item_item span {
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
.attach_edit_bay button {
|
.attach_edit_bay button {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
@ -1004,10 +1000,11 @@ input[type=checkbox]:checked + label .sel {
|
||||||
|
|
||||||
/* New */
|
/* New */
|
||||||
.attach_item {
|
.attach_item {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.attach_item_item span {
|
.attach_item_item span {
|
||||||
|
margin-bottom: 4px;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
@ -1019,7 +1016,8 @@ input[type=checkbox]:checked + label .sel {
|
||||||
.attach_item button {
|
.attach_item button {
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
}
|
}
|
||||||
.post_item:not(.has_attachs) .attach_item_delete {
|
.post_item:not(.has_attachs) .attach_item_buttons,
|
||||||
|
.has_attachs .update_buttons .add_file_button {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,6 +283,9 @@ h1, h2, h3, h4, h5 {
|
||||||
red {
|
red {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
.update_buttons .add_file_button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -705,6 +705,9 @@ red {
|
||||||
.staff_post {
|
.staff_post {
|
||||||
background-color: #ffeaff;
|
background-color: #ffeaff;
|
||||||
}
|
}
|
||||||
|
.update_buttons .add_file_button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.mod_button {
|
.mod_button {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
|
|
Loading…
Reference in New Issue