In checkbox click, change which buttons can be clicked


#1

I’m starting in ember now, and i already made all my static app, so i “just” need create the ember layer on top.

In my events page, i have a list where i’m showing the events (the events are from my database).

events.js:

export default = Ember.Route.extend({
 model () {
   return this.store.findAll('event');
 }
});

And in my template i’m doing a looping, which will print something like this:http://codepen.io/anon/pen/YydjwV As you can see, is static.

In this page i have a controller, which will control the actions based on checkbox checked:

<ul class="controller__list">
  <li class="controller__item">
    <span class="controller__legend"> New </span>
  </li>
  <li class="controller__item">
    <span class="controller__legend"> Edit </span>
  </li>
  <li class="controller__item">
    <span class="controller__legend"> Delete </span>
  </li>
</ul>

So… depending on the number of checkboxes checked, i want allow clicks on this actions:

New action = 0 - Infinity checkbox checked (always allowed)
Edit action = 1 - 1 checkboxes checked
Delete action = 1 - Infinity checkbox checked

My question… how can i bind this with the actions??? I really new to Ember, and this is very hardcore level i think… i’m studying a lot, but the learning curve is so crazy… So… i was think, how could i do that? First i need bind actions in my inputs, right??? So:

{{input type="checkbox" action='checkBoxClicked'}}

and in my EventController:

export default = Ember.ArrayController.extend({
 actions: {
   checkBoxClicked () {
      // WHAT NOW? HOW DISABLE THE BUTTONS?
   }
 }
});

I don’t want know how to save, delete, edit, etc… this thinks are easy, my problem is understand how to use components and manipulate html depending on actions.

Guys, i’m not asking for a full answer, i know the SOF is not this kind of forum, but a light would be very nice… some tutorial, ANYTHING…