Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 5 Months, 1 Week, 6 Days ago Cannot remove attachment when editing a post
#1
Solved: 5 Months, 1 Week, 6 Days ago
Upgraded to 1.8.20 (from 1.8.19).

For the life of me can't figure out why I can't do this now:
  1. Edit a post with attachments
  2. Find one of the attachments, and try to remove it
Every time I tried to perform this, it quits the end and return immediately to showing the thread.

I do have a custom theme, but comparing with the stock default template, it's mostly the same (difference is in the class attribute).
This is "post_attachments_attachment_remove" from the default template:

<input type="submit" class="button" name="rem" value="{$lang->remove_attachment}" onclick="return Post.removeAttachment({$attachment['aid']});" />



This is most likely a user error, but for the life of me I can't figure this out. The debug console did show an error, but that happened way too quick for me to debug. (Not sure how to set a break point in web dev). Any help?
Reply
#2
Solved: 5 Months, 1 Week, 6 Days ago
(03-05-2019, 09:45 AM)snakeoilos Wrote: The debug console did show an error, but that happened way too quick for me to debug. (Not sure how to set a break point in web dev). Any help?

Hi,

open the browser inspector, Console (tab), and click in Console settings (gear icon in the right), and check Preserve log.
I don't answer questions about localhost forums or forums without URL, I'm not a seer.  Cool
Reply
#3
Solved: 5 Months, 1 Week, 6 Days ago
(03-05-2019, 09:56 AM)NoRules Wrote:
(03-05-2019, 09:45 AM)snakeoilos Wrote: The debug console did show an error, but that happened way too quick for me to debug. (Not sure how to set a break point in web dev). Any help?

Hi,

open the browser inspector, Console (tab), and click in Console settings (gear icon in the right), and check Preserve log.

Hi NoRules,

Thanks for that. Now I'm a step closer to figure out what I missed,


ReferenceError: templates is not defined[Learn More] general.js:118:4
    prompt https://www.snakeoil-os.net/forums/jscripts/general.js?ver=1820:118 
 removeAttachment https://www.snakeoil-os.net/forums/jscripts/post.js?ver=1820:97
 onclick https://www.snakeoil-os.net/forums/editpost.php?pid=2272:1 

Tried adding/removing attachments over here at myBB, and there is a yes/no prompt happening here.. Don't recall ever seeing this prompt pop up at my site, and I did managed to remove attachments when editing posts in 1.8.19.


Looking at this error, is this a template issue, or javascript? Seem to recall something about templates in headinclude, not sure if I added that back or not.. Sad The hunt continues.

Hopefully somebody can work this out before me, would appreciate that a lot!!

Update:
Thanks NoRules for that tip, it did help me isolate the problem. I'm missing something in headerinclude. Thought <!-- --> is a block comment. Turns out that's probably for HTML, not javascript.

Added this back in and it's now all working.

 var templates = {
 modal: '{$jsTemplates['modal']}',
 modal_button: '{$jsTemplates['modal_button']}'
 };
Reply
#4
Solved: 5 Months, 1 Week, 6 Days ago
That solved it for me too! I just did a differ report on headerinclude template under ungrouped templates and showed me what was missing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)