I'm working specifically with the PowerTools extensions for Tridion 2011, but this applies to any Anguilla extension with buttons in the dashboard.
We can set <ext:title>
to get a hover-over tooltip. User hovers over the GUI extension button to see this text. See example for the "count items" extension in the config.
<ext:extension assignid="CountItems" name="Count Items"
pageid="Power Tools" groupid="Tools">
<ext:command>PT_CountItems</ext:command>
<ext:title>Count Items</ext:title>
<ext:issmallbutton>false</ext:issmallbutton>
<ext:dependencies>
<cfg:dependency>PowerTools.Commands</cfg:dependency>
</ext:dependencies>
<ext:apply>
<ext:view name="DashboardView" />
</ext:apply>
</ext:extension>
We have a request to change this tooltip to some helpful text when the extension is not enabled.
I can see the "Count Items" text within the button with Chrome's console.
<div id="CountItems" class="tridion button PT_CountItems ribbonitem disabled"
title="Count Items" c:command="PT_CountItems"
c:controltype="Tridion.Controls.RibbonButton"
style="-webkit-user-select: none; ">
<div class="image"> </div>
<div class="text">Count Items</div>
</div>
Also in the console, I can select div surrounding the text with: $("div#CountItems > div.text")
. I'm not sure how to get the text.
Question: How do/should I change the tooltip text when a GUI button is inactive?
I probably need clarification on these as well.
- In Anguilla (or PowerTools), is the
$()
the same asjQuery()
? I tried$("div#CountItems > div.text").text()
and getObject #<HTMLDivElement> has no method 'text'
- Is there a preferred or configurable way to set that tooltip when the button is disabled? I'm sure we can find an element in the DOM, but I'm probably missing something.
And finally,
- Would
{NameSpace}.Commands.{ExtensionName}.prototype.isValidSelection = function(selection) { }
be the right place to change this tooltip in general? - For context-menus, I believe we have _isAvailable instead.