Skip to content

Instantly share code, notes, and snippets.

@jdorrance
Created November 15, 2013 14:23
Show Gist options
  • Save jdorrance/7485084 to your computer and use it in GitHub Desktop.
Save jdorrance/7485084 to your computer and use it in GitHub Desktop.
CQ.Ext.override CQ.wcm.Sidekick,
addButtons: ->
bbar = @getBottomToolbar()
bbar.removeAll true
bbar.add [@editButton, @previewButton]
bbar.add @designButton if ACS.wcm.Page.canViewDesignMode()
bbar.add @scaffoldingButton if ACS.wcm.Page.canViewScaffoldingMode()
bbar.add @liveCopyStatusButton
bbar.add @clientContextButton if ACS.wcm.Page.canViewClientContext()
bbar.add "-"
bbar.add @adminButton
bbar.add @analyticsButton if ACS.wcm.Page.canViewSiteCatalyst()
bbar.add @reloadButton
loadActions: (config) ->
# texts for default actions
CQ.Timing.stamp "Start rendering sidekick"
# add actions
@buttons = {}
actions = config.actions
i = 0
while i < actions.length
actn = actions[i]
actnConf = undefined
actnName = undefined
if typeof actn is "string"
actnName = actn
actnConf = @getCreateConfig() if actn is CQ.wcm.Sidekick.CREATE
actnConf = @getCreateChildPageConfig() if actn is CQ.wcm.Sidekick.CREATECHILDPAGE
actnConf = @getCopyPageConfig() if actn is CQ.wcm.Sidekick.COPYPAGE
actnConf = @getMovePageConfig() if actn is CQ.wcm.Sidekick.MOVEPAGE
actnConf = @getDeleteConfig() if actn is CQ.wcm.Sidekick.DELETE
actnConf = @getPublishConfig() if actn is CQ.wcm.Sidekick.PUBLISH and ACS.wcm.Page.canActivateContent()
actnConf = @getRolloutConfig() if actn is CQ.wcm.Sidekick.ROLLOUT
actnConf = @getReferencesConfig() if actn is CQ.wcm.Sidekick.REFERENCES
actnConf = @getLockConfig() if actn is CQ.wcm.Sidekick.LOCK
actnConf = @getVersionConfig() if actn is CQ.wcm.Sidekick.VERSION
actnConf = @getRestoreConfig() if actn is CQ.wcm.Sidekick.RESTORE
actnConf = @getAuditConfig() if actn is CQ.wcm.Sidekick.AUDIT
actnConf = @getPermsConfig(config) if actn is CQ.wcm.Sidekick.PERMS
actnConf = @getPropsConfig(config) if actn is CQ.wcm.Sidekick.PROPS
actnConf = @getStartWorkflowConfig() if actn is CQ.wcm.Sidekick.START_WORKFLOW
else
actnConf = actn
actnName = (if actn then actn.text else "")
if actnConf
actnConf.name = actnName
actnConf.disabled |= config.readOnly
@addAction actnConf, true
i++
for p of @panels
@panels[p].doLayout()
CQ.Timing.stamp "Completed rendering sidekick"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment