title: Meteor.js mplement a singleton confirm box
body: <p>I try to create a reusable confirm box, but i'm unsure how to implement this the meteor way.</p>
  
  <p>I have a template for the confirm box. The text and button value should be dynamic.</p>
  
  <pre><code>&lt;template name="confirm"&gt;
    {{#if show}}
      {{text}}
      &lt;button class="cancel"&gt;cancel&lt;/button&gt;
      &lt;button class="confirm"&gt;{{action}}&lt;/button&gt;
    {{/if}}
   &lt;/template&gt;
  </code></pre>
  
  <p>And i have a user template with an delete button.</p>
  
  <pre><code>&lt;template name="user"&gt;
    &lt;h1&gt;{{name}}&lt;/h1&gt;
    &lt;button class="delete"&gt;delete user&lt;/button&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>In the app template i display a list of users and render the confirm template.</p>
  
  <pre><code>&lt;template app="app"&gt;
    {{#each user}}
      {{&gt; user}}
    {{/each}}
  
    {{&gt; confirm}}
  &lt;/tempalte&gt;
  </code></pre>
  
  <p>Now when i click the delete button of a user item i want to display the confirm box.</p>
  
  <pre><code>Template.confirm.helpers({
    text: function(){
      return Session.get('confirmText');
    },
    action: function(){
      return Session.get('confirmAction');
    },
    show: function(){
      return Session.get('showConfirm');
    },
  });
  
  Template.user.events({
    'click .delete': function(){
       Session.set('confirmAction', 'delete');
       Session.set('confirmText', 'Are you sure?');
       Session.set('showConfirm', true);
    }
  });
  </code></pre>
  
  <p>My confirm box displays as it should but how can i trigger the user deletion from the confirm box? </p>
  
  <p>Am i even on the right track? I tried to render a confirm template inside of every user template but there should only be one active confirm box at a time.</p>