Re: [DEV TargetProcess] Digest for devtargetprocess@googlegroups.com - 1 update in 1 topic

8 views
Skip to first unread message

Jesse Rosenberg

unread,
Jul 19, 2016, 3:49:56 PM7/19/16
to devtarge...@googlegroups.com
Did you try putting the code inside a document.ready?

If that doesn't work and since we are OK with hacks 😉 you could put the code in an interval that checks for the elements existence and then cancel the interval once the elements have appeared. I had to do a similar workaround for one of my mashups.

On Tue, Jul 19, 2016, 2:38 PM <devtarge...@googlegroups.com> wrote:
Anthony S <anthonys...@gmail.com>: Jul 19 04:01AM -0700

We are trying to write a mashup which prevents users from editing the hours
on any closed entities (user stories, tasks, etc); the only way they would
be able to change hours is if the bug is not closed (or more specifically,
if the bug is not marked as "Done").
 
To do this, we have two plans:
 
1) Disable the 'plus' sign on a specific entity's "Time" tab page if the
entity is marked as "Done"
 
 
 
2) Disable the popup that appears on the "Time Sheets" page when clicking
on a cell if the entity is marked as "Done".
 
 
 
I've tried my hand at the first one, but it seems the page is rendering too
quickly (i.e. before the frame containing time information is available).
Essentially, if I let the page load normally and then test my code in
something like Chrome's developer console, it works, the button becomes
disabled. However, if I try to integrate it into a mashup, it fails,
predictably because the elements I'm looking for do not exist (yet).
 
The mashup I've written thus far is as follows (it's a bit hacky in terms
of jQuery, but I couldn't find a better way to get the elements I wanted):
 
tau.mashups
.addDependency('libs/jquery/jquery')
.addMashup(function($, config) {
 
var plusButton = $('[id^=entitygeneralinfo] > div >
div.tau-container.tau-tabs > div.entity-tabs.entity-tabs_more_enable > div
> div > div > span');
var itemStatus = $('[id^=entityadditionalinfo] > div > div >
div.state-selector > div >
div.ui-collapsible-header.i-role-panel-entity-select-header.collapsed > div
> span.state-selector__current-state');
if (!plusButton.length || !itemStatus.length) {
return;
}

if(itemStatus.text() === "Done") {
plusButton.css('pointer-events', 'none');
}

});
 
Any help is appreciated.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to devtargetproce...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages