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.
|