title: Meteor: Disable button based on data context?
body: <p>I have a multi-tenant Meteor app and want to allow users with access to more than one organization's account to switch between organizations.</p>
  
  <p>The ability to switch organizations is working, but I now want to be able to disable the <code>button</code> for the user's current organization, so they can not switch to the same organization they are already in.</p>
  
  <p>Right now I'm trying to retrieve each button's value based on a <code>data-domain</code> attribute, but it comes back <code>undefined</code>. Also, <code>console.log(this);</code> comes back as <code>undefined</code> for the helper.</p>
  
  <p>How would I get the data context to match the current button's value to the user's current organization?</p>
  
  <p>Here's the template:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;template name="switchAccountsModal"&gt;
    &lt;div class="modal fade switchAccounts" id="switchAccounts" tabindex="-1" 
         role="dialog" aria-labelledby="switchAccounts"&gt;
      &lt;div class="modal-dialog modal-sm"&gt;
        &lt;div class="modal-content"&gt;
          &lt;div class="modal-header"&gt;
            &lt;button type="button" class="close" data-dismiss="modal"
                    aria-label="Close"&gt;
               &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
            &lt;/button&gt;
            &lt;h4 class="modal-title"&gt;Select an Organization&lt;/h4&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
            &lt;div class="list-group"&gt;
              {{#each organizations}}
              &lt;!-- {{activeOrg}} should render 'disabled' if this equals the 
                   user's current organization. --&gt;
              &lt;button type="button" class="list-group-item switchAccount" 
                      data-domain="{{this}}" {{activeOrg}}&gt;{{this}}&lt;/button&gt;
              {{/each}}
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>And here's the helper:</p>
  
  <pre class="lang-js prettyprint-override"><code>Template.switchAccountsModal.helpers({
    organizations: () =&gt; {
      var organizations = Meteor.user().organizations;
      console.log('organizations: ' + organizations);
      return organizations;
    },
    activeOrg: () =&gt; {
      console.log('activeOrg.this: ' + this);
      var currentOrg = Meteor.user().profile.currentOrg;
      var thisOrg    = $(this).data('domain');
      console.log('activeOrg.thisOrg: ' + thisOrg);
      return (this == currentOrg) ? {disabled: 'disabled'} : {};
    }
  });
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>