-
-
Save kamilbiela/7e72bb2f532c171b1bf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{outlet}} | |
<div class="container"> | |
<div class="row"> | |
<div class="span12"> | |
<ul class="thumbnails thumbnails-list"> | |
{{#each gallery in controller}} | |
{{#view App.GalleriesIndexItemView}} | |
<li class="span4"> | |
<div class="thumbnail"> | |
<a href="#"> | |
<img src="images/300x200.gif" alt=""> | |
</a> | |
<div class="caption"> | |
<h4>{{gallery.name}}</h4> | |
{{#if view.hover}} | |
<button {{action editGallery gallery }} class="btn btn-mini" type="button">Edit</button> | |
<button {{action deleteGallery gallery}} class="btn btn-mini" type="button">Delete</button> | |
{{/if}} | |
</div> | |
</div> | |
</li> | |
{{/view}} | |
{{/each}} | |
</ul> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.GalleriesIndexController = Ember.ArrayController.extend({ | |
deleteGallery: function(gallery) { | |
if (confirm('Are You sure? You will delete all photos in ' + gallery.get('name') + ".")) { | |
gallery.deleteRecord(); | |
App.store.commit(); | |
} | |
}, | |
editGallery: function(gallery) { | |
// todo | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.GalleriesIndexItemView = Ember.View.extend({ | |
hover: false, | |
mouseEnter: function() { | |
this.set('hover', true); | |
}, | |
mouseLeave: function() { | |
this.set('hover', false); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.GalleriesIndexRoute = Ember.Route.extend({ | |
enter: function() { | |
this.controllerFor('application').set('currentMenuItem', 'dashboard'); | |
}, | |
model: function() { | |
return App.Gallery.find(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment