Jump to content

Question

Posted (edited)

I used to be able to hold click the titles and edit them(rename them), specifically in the Adjutant Office posts. It's not working for me now actually, this issue just started. I've restarted browser and even tried (gasp) Firefox. There is no option anywhere that allows renaming, is there?.

Edited by Brault 1st MRB

13 answers to this question

Recommended Posts

  • 0
Posted (edited)
On 4/4/2016 at 10:52 AM, Woz 1st MRB said:

So when you go to the list of topics on this page you can't long click a title to edit it, but you can do so from this thread?

 

I can edit title names there as well now and on additional sub forums such as the MOS subforum. It would appear the issue to be resolved.

 

And in regards to your question Woz, yes I could edit the thread title from in this page for the entire time but it was selecting the edit button on the OP.

Edited by Woz 1st MRB
Adding context for best answer
  • 0
Posted

I've noticed that it doesn't work all the time now... but that capability is still there, just hit and miss.  I'll have to do some more testing to figure out why it doesn't work all the time, hopefully it wasn't the plugin that split the pinned and unpinned topics.

 

The only other workaround I know of it to edit the first post of the topic you wanted to change the title for, it should give you the editing view as if you were starting a new topic.

  • 0
Posted

Lt. Col.,

If you track down an example of one that cannot be edited, I have a hunch that the <a> element will be missing:

data-role="editableTitle"

 

 

Example of a title that brings up the edit input as expected:

<a href="http://www.1stmarineraiders.com/forums/topic/33781-new-forum-questions/" data-ipshover="" data-ipshover-target="http://www.1stmarineraiders.com/forums/topic/33781-new-forum-questions/?preview=1" data-ipshover-timeout="1.5" itemprop="url" data-role="editableTitle" id="ips_uid_252_5">
  <span itemprop="name">
    New Forum Questions
  </span>
</a>

Example of a title that does not bring up the edit input as expected:

<a href="http://www.1stmarineraiders.com/forums/topic/33781-new-forum-questions/" data-ipshover="" data-ipshover-target="http://www.1stmarineraiders.com/forums/topic/33781-new-forum-questions/?preview=1" data-ipshover-timeout="1.5" itemprop="url" id="ips_uid_252_5">
  <span itemprop="name">
    New Forum Questions
  </span>
</a>

 

 

In the relevant templates, the html should look something similar this:

<a href='{$row->url()}' {{if $row->tableHoverUrl and $row->canView()}}data-ipsHover data-ipsHover-target='{$row->url()->setQueryString('preview', 1)}' data-ipsHover-timeout='1.5'{{endif}} itemprop="url" {{if $row->canEdit()}}data-role="editableTitle"{{endif}}>
  <span itemprop="name">
	{{if $row->mapped('title')}}{wordbreak="$row->mapped('title')"}{{else}}<em class="ipsType_light">{lang="content_deleted"}</em>{{endif}}
  </span>
</a>

In any case, the segment we are focusing on is the if statement surrounding data-role="editableTitle"

If the template is lacking this segment, there is no way for the title to ever be editable from the long click, even if they have the appropriate permissions.

 

If the element has this attribute in HTML and it is still not working, then it is a JS issue. (If this is the case, I can help if given an example)

If the relevant templates have that if statement, but the HTML element is not showing it in the right cases, then it is probably a permissions issue.

  • 0
Posted (edited)

I found a direct reference in the source code to the "editingTitle: False" being set when I dug through. I'm going to be honest and admit though that I am not super familiar with HTML coding.

 

 

ips.controller.register('core.front.core.moderation', {
	_editTimeout : ,
	_editingTitle : false,
	initialize : function () {
		this.on('submit', '[data-role="moderationTools"]', this.moderationSubmit);
		this.on('mousedown', 'a[data-role="editableTitle"]', this.editTitleMousedown);
		this.on('mouseup mouseleave', 'a[data-role="editableTitle"]', this.editTitleMouseup);
		this.on('click', 'a[data-role="editableTitle"]', this.editTitleMouseclick);
	},
	editTitleMousedown : function (e) {
		var self = this;
		this._editTimeout = setTimeout(function () {
				self._editingTitle = true;
				clearTimeout(this._editTimeout);
				var anchor = $(e.currentTarget);
				anchor.hide();
				var inputNode = $('<input/>').attr({
						type : 'text'
					}).attr('data-role', 'editTitleField').val(anchor.text().trim());
				anchor.after(inputNode);
				inputNode.focus();
				inputNode.on('blur', function () {
					inputNode.addClass('ipsField_loading');
					ips.getAjax()(anchor.attr('href'), {
						data : {
							do  : 'ajaxEditTitle', newTitle : inputNode.val()
						}
					}).done(function (response) {
						anchor.text(inputNode.val());
					}).fail(function (response) {
						ips.ui.alert.show({
							type : 'alert',
							icon : 'warn',
							message : response.responseJSON,
						});
					}).always(function () {
						inputNode.remove();
						anchor.show();
						self._editingTitle = false;
					});
				});
				inputNode.on('keypress', function (e) {
					if (e.keyCode == ips.ui.key.ENTER) {
						e.stopPropagation();
						e.preventDefault();
						inputNode.blur();
						return false;
					}
				});
			}, 1000);
	},
	editTitleMouseup : function (e) {
		clearTimeout(this._editTimeout);
	},
	editTitleMouseclick : function (e) {
		if (this._editingTitle) {
			e.preventDefault();
		}
	}
}

 

Edited by Woz 1st MRB
Made the JS more readable and removed unrelated code.
  • 0
Posted
33 minutes ago, Yamagata 1st MRB said:

Is that for an instance that will not allow you to edit the title?

That is the javascript that makes the title edit work. It pretty much confirms my suspicion that data-role="editableTitle" is required on the <a> element in order for it to editable.

 

Just to offer an explanation of what's going on in that JS, when it sees data-role="editableTitle", it registers a few event listeners on that element. Namely these:

  • mousedown: starts a 1 second timer which eventually uses jQuery to add the text input element and hide the <a> element. It then registers another event listener on the input element that will send the update to the server on blur (losing focus) or on a press of the enter key. After the update completes, it removes the input and un-hides the title.
  • mouseup: cancels the 1 second timer or does nothing if the timer has already fired
  • click: It registers an event on this one to make sure that the click event does not go through (preventDefault) after a long click to edit has occured.

 

  • 0
Posted

Well, here's the whole template for topic view...

{{$rowIds = array();}}
{{foreach $rows as $row}}
	{{$idField = $row::$databaseColumnId;}}
	{{$rowIds[] = $row->$idField;}}
{{endforeach}}
{{$iposted = ( method_exists( $table, 'container' ) AND $table->container() !== NULL ) ? $table->container()->contentPostedIn( null, $rowIds ) : array();}}
{{if count( $rows )}}
	{{$rowCount=0;}}
	{{foreach $rows as $row}}
		{{if $rowCount == 1 AND $advertisement = \IPS\core\Advertisement::loadByLocation( 'ad_forum_listing' )}}
			<li class="ipsDataItem">
				{$advertisement|raw}
			</li>
		{{endif}}
		{{$rowCount++;}}
		{{$idField = $row::$databaseColumnId;}}
		{{if $row->mapped('moved_to')}}
			{{if $movedTo = $row->movedTo()}}
				<li class="ipsDataItem">
					<div class='ipsDataItem_icon ipsType_center ipsType_noBreak'>
						<i class="fa fa-arrow-left ipsType_large"></i>
					</div>
					<div class='ipsDataItem_main'>
						<h4 class='ipsDataItem_title ipsType_break'>
							<em><a href='{$movedTo->url()}' title='{lang="go_to_new_location"}'>{wordbreak="$row->mapped('title')"}</a></em>
						</h4>
						<div class='ipsDataItem_meta'>
							<p class='ipsType_reset ipsType_light ipsType_blendLinks'>{lang="topic_moved_to" sprintf="$movedTo->container()->url(), $movedTo->container()->_title"}</p>
						</div>
					</div>
					{{if $table->canModerate()}}
						<div class='ipsDataItem_modCheck'>
							<span class='ipsCustomInput'>
								<input type='checkbox' data-role='moderation' name="moderate[{$row->$idField}]" data-actions="{{if $row->mapped('featured')}}unfeature{{endif}} {{if $row->mapped('pinned')}}unpin{{endif}} delete" data-state='{{if $row->mapped('pinned')}}pinned{{endif}} {{if $row->mapped('featured')}}featured{{endif}}'>
								<span></span>
							</span>
						</div>
					{{endif}}
				</li>
			{{endif}}
		{{else}}
			<li class="ipsDataItem ipsDataItem_responsivePhoto {{if $row->unread()}}ipsDataItem_unread{{endif}} {{if method_exists( $row, 'tableClass' ) && $row->tableClass()}}ipsDataItem_{$row->tableClass()}{{endif}} {{if $row->hidden()}}ipsModerated{{endif}}" data-rowID='{$row->$idField}' itemprop="itemListElement" itemscope itemtype="http://schema.org/Article">
				{{if member.member_id}}
					<div class='ipsDataItem_icon ipsPos_top'>
						{{if $row->unread()}}
							<a href='{$row->url( 'getNewComment' )}' title='{lang="first_unread_post"}' data-ipsTooltip>
								<span class='ipsItemStatus'><i class="fa {{if in_array( $row->$idField, $iposted )}}fa-star{{else}}fa-circle{{endif}}"></i></span>
							</a>
						{{else}}
							{{if in_array( $row->$idField, $iposted )}}
								<span class='ipsItemStatus ipsItemStatus_read ipsItemStatus_posted'><i class="fa fa-star"></i></span>
							{{else}}
								&nbsp;
							{{endif}}
						{{endif}}
					</div>
				{{endif}}
				<div class='ipsDataItem_main'>
					<h4 class='ipsDataItem_title ipsType_break'>
						{{if $row->locked()}}
							<i class='ipsType_medium fa fa-lock' data-ipsTooltip title='{lang="topic_locked"}'></i>
							
							{{if $row->topic_open_time && $row->topic_open_time > time()}}
								<strong class='ipsType_small' data-ipsTooltip title='{lang="topic_unlocks_at" sprintf="\IPS\DateTime::ts( $row->topic_open_time )->relative(), \IPS\DateTime::ts( $row->topic_open_time )->localeTime( FALSE )"}'>{lang="topic_unlocks_at_short" sprintf="\IPS\DateTime::ts($row->topic_open_time)->relative(1)"}</strong>&nbsp;&nbsp;
							{{endif}}
						{{elseif !$row->locked() && $row->topic_close_time && $row->topic_close_time > time()}}
							<strong class='ipsType_small' data-ipsTooltip title='{lang="topic_locks_at" sprintf="\IPS\DateTime::ts( $row->topic_close_time )->relative(), \IPS\DateTime::ts( $row->topic_close_time )->localeTime( FALSE )"}'><i class='fa fa-clock-o'></i> {lang="topic_locks_at_short" sprintf="\IPS\DateTime::ts($row->topic_close_time)->relative(1)"}</strong>&nbsp;&nbsp;
						{{endif}}
						
						{{if $row->mapped('pinned') || $row->mapped('featured') || $row->hidden() === -1 || $row->hidden() === 1}}
							<span>
								{{if $row->hidden() === -1}}
									<span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_warning" data-ipsTooltip title='{$row->hiddenBlurb()}'><i class='fa fa-eye-slash'></i></span>
								{{elseif $row->hidden() === 1}}
									<span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_warning" data-ipsTooltip title='{lang="pending_approval"}'><i class='fa fa-warning'></i></span>
								{{endif}}							
								{{if $row->mapped('pinned')}}
									<span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_positive" data-ipsTooltip title='{lang="pinned"}'><i class='fa fa-thumb-tack'></i></span>
								{{endif}}
								{{if $row->mapped('featured')}}
									<span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_positive" data-ipsTooltip title='{lang="featured"}'><i class='fa fa-star'></i></span>
								{{endif}}
							</span>
						{{endif}}
										
						{{if $row->prefix()}}
							{template="prefix" group="global" app="core" params="$row->prefix( TRUE ), $row->prefix()"}
						{{endif}}
						
						<a href='{$row->url()}' itemprop="url"{{if $row->tableHoverUrl and $row->canView()}} data-ipsHover data-ipsHover-target='{$row->url()->setQueryString('preview', 1)}' data-ipsHover-timeout='1.5'{{endif}}{{if $row->canEdit()}} data-role="editableTitle"{{endif}}>
							<span itemprop="name headline">
								{{if $row->mapped('title')}}{wordbreak="$row->mapped('title')"}{{else}}<em class="ipsType_light">{lang="content_deleted"}</em>{{endif}}
							</span>
						</a>
						<meta itemprop="position" content="{$row->tid}">
					</h4>
					{{if $row->commentPageCount() > 1}}
						{$row->commentPagination( array(), 'miniPagination' )|raw}
					{{endif}}
					<div class='ipsDataItem_meta ipsType_reset ipsType_light ipsType_blendLinks'>
						<span itemprop="author" itemscope itemtype="http://schema.org/Person">
							{lang="byline_itemprop" htmlsprintf="$row->author()->link()"}
						</span>{datetime="$row->mapped('date')" lowercase="true"}
						<meta itemprop="dateCreated datePublished" content="{expression="\IPS\DateTime::create( $row->__get( $row::$databaseColumnMap['date'] ) )->rfc3339()"}">
						{{if !in_array( \IPS\Dispatcher::i()->controller, array( 'forums', 'index' ) )}}
							{lang="in"} <a href="{$row->container()->url()}">{$row->container()->_title}</a>
						{{endif}}
						{{if count( $row->tags() )}}
							&nbsp;&nbsp;
							{template="tags" group="global" app="core" params="$row->tags(), true, true"}
						{{endif}}
					</div>
				</div>
				<ul class='ipsDataItem_stats'>
					{{foreach $row->stats(FALSE) as $k => $v}}
						<li {{if $k == 'num_views'}}class='ipsType_light'{{elseif in_array( $k, $row->hotStats )}}class="ipsDataItem_stats_hot" data-text='{lang="hot_item"}' data-ipsTooltip title='{lang="hot_item_desc"}'{{endif}}>
							<span class='ipsDataItem_stats_number' {{if $k == 'forums_comments' OR $k == 'answers_no_number'}}itemprop='commentCount'{{endif}}>{number="$v"}</span>
							<span class='ipsDataItem_stats_type'>{lang="{$k}" pluralize="$v"}</span>
							{{if ( $k == 'forums_comments' OR $k == 'answers_no_number' ) && \IPS\forums\Topic::modPermission( 'unhide', NULL, $row->container() ) AND $unapprovedComments = $row->mapped('unapproved_comments')}}
								&nbsp;<a href='{$row->url()->setQueryString( 'queued_posts', 1 )}' class='ipsType_warning ipsType_small ipsPos_right ipsResponsive_noFloat' data-ipsTooltip title='{lang="queued_posts_badge" pluralize="$row->topic_queuedposts"}'><i class='fa fa-warning'></i> <strong>{$unapprovedComments}</strong></a>
							{{endif}}
						</li>
					{{endforeach}}
				</ul>
				<ul class='ipsDataItem_lastPoster ipsDataItem_withPhoto ipsType_blendLinks'>
					<li>
						{{if $row->mapped('num_comments')}}
							{template="userPhoto" app="core" group="global" params="$row->lastCommenter(), 'tiny'"}
						{{else}}
							{template="userPhoto" app="core" group="global" params="$row->author(), 'tiny'"}
						{{endif}}
					</li>
					<li>
						{{if $row->mapped('num_comments')}}
							{$row->lastCommenter()->link()|raw}
						{{else}}
							{$row->author()->link()|raw}
						{{endif}}
					</li>
					<li class="ipsType_light">
						<a href='{$row->url( 'getLastComment' )}' title='{lang="get_last_post"}' class='ipsType_blendLinks'>
							{{if $row->mapped('last_comment')}}{datetime="$row->mapped('last_comment')"}{{else}}{datetime="$row->mapped('date')"}{{endif}}
						</a>
					</li>
				</ul>
				{{if $table->canModerate()}}
					<div class='ipsDataItem_modCheck'>
						<span class='ipsCustomInput'>
							<input type='checkbox' data-role='moderation' name="moderate[{$row->$idField}]" data-actions="{expression="implode( ' ', $table->multimodActions( $row ) )"}" data-state='{{if $row->tableStates()}}{$row->tableStates()}{{endif}}'>
							<span></span>
						</span>
					</div>
				{{endif}}
			</li>
		{{endif}}
	{{endforeach}}
{{endif}}

 

  • 0
Posted

Also in regards to your question sir; that snippet of Java Script was from this Thread which I do have the ability to edit the title but only from within edit of the original posting and not as we had done in the past by clicking the title.

  • 0
Posted
On 4/1/2016 at 1:04 PM, Marsden 1st MRB said:

Also in regards to your question sir; that snippet of Java Script was from this Thread which I do have the ability to edit the title but only from within edit of the original posting and not as we had done in the past by clicking the title.

So when you go to the list of topics on this page you can't long click a title to edit it, but you can do so from this thread?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Recent Posts

    • Its Friday Night Fight Night in HLL and me and Muthas are in different squads. We meet up while attacking a point: Me: Muthas! Let's go get the poiple toineps! Muthas: Hah poi....   We are immediately cut down by a MG.   Steam messages:  Muthas: LMFAOO Me:OMFG! ROFLMAO!
    • Name: elon musk   Steam I.D: STEAM_0:0:918906720   Duration of Ban: Permanent   Reasons for the Ban: Racist comments and Mass Team Killing   Demo Provided?: N   Comments: Keebler reported in public chat, sent screen shot of typed comments  
    • Hey Reis! Great to see you again, man. The unit means a lot to all of us and I know you were here for quite some time. There’s always room for you to come back   *Salute*
    • I dont know how many of the people that know me or what i did in the unit are still here. But i just wanted to leave a huge thank you on the forums to this unit, that i was a part of for so many years, and all the good times and hardships i shared with a lot of different people from all over the world.    Maybe i'll still see you in DoD:s   *Salute*
    • 2nd Platoon Weekly Attendance   Week of 10NOV2024   P = Present | E = Excused | A = Absent   Platoon Staff WO. A. Pitteway - Excused MSgt. J. Candy - Present TSgt. A Yoder - Present   1st Squad Squad leader:  SSgt. R. Fielding - Present Cpl. B. Grande - Present Pfc. R. Smith - Excused Pfc. M. Noel - Present Pfc. C. Keebler - Present Pvt. D. Moffat - Present Pvt. R. Zera - Absent Pvt. N. Clement - Excused       2nd Squad Squad leader:  Cpl. S. Holquist - Present Pfc. A. Cannon - Excused Pfc. T. Scary - Present Pfc. C. Marsh - Present Pfc. M. Oake - Excused Pvt. L. Whistle - Present Pvt. M. Clarkson - Excused Pvt. W. Swift - Present           Helpers: WO. S. Belcher
×
×
  • Create New...