Edit button in KB Article

vijir
Mega Guru

Hello,

 

I am trying to enable Edit button when the article is in 'Scheduled for Publish' state.

Followed the UI Page and macros, but getting lost where 'isEditable' or showUpdateAction is set.

 

UI Macro:
kb_view_common_header_toolbar ->
<button role="link" id="editArticle" style="margin-left:0.4em;" title="${gs.getMessage('Edit content')}" aria-label="${gs.getMessage('Edit content')}" class="btn btn-default navbar-btn snc-article-header-toolbar-button pull-right">${gs.getMessage("Edit")}</button>

 

this leads to 'kb_view_common' -->
var showUpdateAction = !jelly.sysparm_no_update &amp;&amp; isEditable;

 

I tried other solutions in the community to modify 'KBCommon' to override 'canContribute', but did not work.

 

I think 'Edit' button is enabled currently for Draft state, thought I will extend it for other states.

Can someone please suggest on this?

 

Regards,

Viji

 

1 ACCEPTED SOLUTION

vijir
Mega Guru

overriding the function 'canWrite' in 'KBVersioning' script solved the issue. Providing the details here in case it is helpful to someone.

 

case 'scheduled_publish':

return false ; // OOTB - Modify the condition here to enable Edit button for this state.
return (this.isOwnerOrAdmin(current) || (this._isReviser(current)
&& this.safeExecute(this._knowledgeHelper.canContribute, current))
|| this.isMemberOfValidGroup(current,this.OWNERSHIP_GROUP));

 

View solution in original post

1 REPLY 1

vijir
Mega Guru

overriding the function 'canWrite' in 'KBVersioning' script solved the issue. Providing the details here in case it is helpful to someone.

 

case 'scheduled_publish':

return false ; // OOTB - Modify the condition here to enable Edit button for this state.
return (this.isOwnerOrAdmin(current) || (this._isReviser(current)
&& this.safeExecute(this._knowledgeHelper.canContribute, current))
|| this.isMemberOfValidGroup(current,this.OWNERSHIP_GROUP));