• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed "list-item-edit" without javascript not working

Luxus

Well-known member
#1
If you have permission, you can edit threads quickly with the small edit link floated right in a thread list item. With javascript enabled, this would open a grey area:

edit.png

With javascript disabled or if you right-click the edit link and open it in a new tab, you would get to the "thread_list_item_edit" page, but there you can't save or cancel. Pressing buttons does nothing. So this needs to be fixed for javascript haters.
 

Jake Bunce

XenForo moderator
Staff member
#2
Confirmed. That form obviously wasn't made to be accessed as a regular page. As a quick fix, edit this template:

Admin CP -> Appearance -> Templates -> thread_list_item_edit

Add the red code:

Code:
<xen:require css="thread_list_item_edit.css" />

<li>

<form action="{xen:link 'threads/save', $thread}" method="post">

	<div class="discussionListItemEdit inlineCtrlGroup">
	
		<div class="titleEdit editBlock">
			<label>{xen:phrase title}:
				<xen:if is="{$prefixes}">
				
					<xen:require js="js/xenforo/title_prefix.js" />
					<xen:require css="title_prefix_edit.css" />
					
					<select name="prefix_id" id="ctrl_prefix_{$thread.thread_id}" class="textCtrl TitlePrefix"
						data-container="#ctrl_prefix_{$thread.thread_id}"
						data-textbox="#ctrl_title_{$thread.thread_id}">
						<xen:include template="title_prefix_edit_options">
							<xen:set var="$selectedPrefix">{$thread.prefix_id}</xen:set>
						</xen:include>
					</select>
					
				</xen:if>
			</label>
			<input type="text" name="title" value="{$thread.title}" class="textCtrl titleField" id="ctrl_title_{$thread.thread_id}" maxlength="100" />
		</div>
		
		<xen:if hascontent="true">
			<div class="stateEdit editBlock">
				<label for="ctrl_state_{$thread.thread_id}">{xen:phrase state}:
					<select name="discussion_state" class="textCtrl" id="ctrl_state_{$thread.thread_id}">
						<xen:contentcheck>
							<xen:if is="{$canAlterState.visible}"><option value="visible" {xen:selected "{$thread.discussion_state} == 'visible'"}>{xen:phrase visible}</option></xen:if>
							<xen:if is="{$canAlterState.moderated}"><option value="moderated" {xen:selected "{$thread.discussion_state} == 'moderated'"}>{xen:phrase moderated}</option></xen:if>
							<xen:if is="{$canAlterState.deleted}"><option value="deleted" {xen:selected "{$thread.discussion_state} == 'deleted'"}>{xen:phrase deleted}</option></xen:if>
						</xen:contentcheck>
					</select>
				</label>
			</div>
		</xen:if>
		
		<xen:if hascontent="true">
			<ul class="optionsEdit editBlock">
				<xen:contentcheck>
					<xen:if is="{$canLockUnlockThread}">
						<li><label for="ctrl_open_{$thread.thread_id}" title="{xen:phrase people_may_reply_to_this_thread}"><input type="checkbox" name="discussion_open" value="1" id="ctrl_open_{$thread.thread_id}" {xen:checked "{$thread.discussion_open}"} /> {xen:phrase open_thread}</label></li>
					</xen:if>
					<xen:if is="{$canStickUnstickThread}">
						<li><label for="ctrl_sticky_{$thread.thread_id}"><input type="checkbox" name="sticky" value="1" id="ctrl_sticky_{$thread.thread_id}" {xen:checked "{$thread.sticky}"} /> {xen:phrase sticky}</label></li>
					</xen:if>
				</xen:contentcheck>
			</ul>
		</xen:if>
	
		<div class="buttons editBlock">
			<img src="@imagePath/xenforo/widgets/ajaxload.info_000000_facebook.gif" class="AjaxSaveProgress" alt="" />
			<input type="submit" value="{xen:phrase save}" class="textCtrl primary" id="ctrl_submit_{$thread.thread_id}" data-submitUrl="{xen:link 'threads/save', $thread}" />
			<input type="reset"  value="{xen:phrase cancel}" class="textCtrl" id="ctrl_reset_{$thread.thread_id}" />
		</div>
		
	</div>	

<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>

</li>