dimagi/Vellum — pull request #135 by mwhite (2013-11-01 17:49:00+00:00)
Title: fix copying select items on firefox

copying select items would fail only on firefox due to inserting nodes
in the UI tree before the data trees (which we do because it allows us
to let JSTree handle all the structural validation), but this fires
question icon overriding, which for select items depends on the parent
select's type.

This would throw an error in FF at

```
- var parentMug = formdesigner.controller.form.controlTree.getParentMug(this);
- if (parentMug.__className === "Select") {
```

which for some reason didn't happen in Chrome. Seems like this was due
to inconsistencies in the event scheduler (if the UI insertion
succeeded, then the model insertion could potentially finish before the
icon overriding triggered by the UI insertion happened).

This fixes this by switching to use an explicitly set mug.parentMug, and
then manually setting that on the mug in the main initQuestion() method
before the UI insertion happens to handle this special case.

(This is ok wrt question moving because all question moving is actually
a deletion + an insertion.)