Permalink
Browse files

add hook events for slide icon

  • Loading branch information...
1 parent e16aa7a commit 7f37e84483b73d0661a2c9b4f9d3b3e199799f6b @brentvatne committed Jul 1, 2012
@@ -1,19 +1,17 @@
<script type="text/template" id="slide-icon-template">
- <a href="/decks/<%= deckID %>/slides/<%= id %>/edit">
- <%= content %>
+ <%= content %>
- <a href="/decks/<%= deckID %>/slides/<%= id %>/delete" class="delete-button">x</a>
+ <a href="/decks/<%= deckID %>/slides/<%= id %>/delete" class="delete-button">x</a>
- <% if (! isFirstSlide) { %>
- <a href="/decks/<%= deckID %>/slides/<%= id %>/move-left" class="left-button">
- &larr;
- </a>
- <% } %>
+ <% if (! isFirstSlide) { %>
+ <a href="/decks/<%= deckID %>/slides/<%= id %>/move-left" class="left-button">
+ &larr;
+ </a>
+ <% } %>
- <% if (! isLastSlide) { %>
- <a href="/decks/<%= deckID %>/slides/<%= id %>/move-right" class="right-button">
- &rarr;
- </a>
- <% } %>
- </a>
+ <% if (! isLastSlide) { %>
+ <a href="/decks/<%= deckID %>/slides/<%= id %>/move-right" class="right-button">
+ &rarr;
+ </a>
+ <% } %>
</script>
@@ -17,10 +17,7 @@ class DeckEditView extends Backbone.View
@slides.fetch()
@$el.append(@slideListView.el)
-
invalidID: (model, response) ->
- console.log model
- console.log response
DeckApp.Util.displayNotification
type: 'error'
message: "A deck with an id of #{model.get('id')} does not exist, " +
@@ -3,6 +3,30 @@ class SlideIconView extends Backbone.View
className: 'micro-slide'
+ events:
+ 'click': 'editSlide'
+ 'click .right-button': 'moveSlideRight'
+ 'click .left-button': 'moveSlideLeft'
+ 'click .delete-button': 'deleteSlide'
+
+ editSlide: (e) ->
+ console.log "edit slide"
+
+ moveSlideRight: (e) ->
+ console.log 'move right'
+ e.preventDefault()
+ e.stopPropagation()
+
+ moveSlideLeft: (e) ->
+ console.log 'move left'
+ e.preventDefault()
+ e.stopPropagation()
+
+ deleteSlide: (e) ->
+ console.log 'delete slide'
+ e.preventDefault()
+ e.stopPropagation()
+
template: _.template($('#slide-icon-template').html())
initialize: (options) ->
@@ -20,6 +44,7 @@ class SlideIconView extends Backbone.View
isFirstSlide: @isFirstSlide
@$el.html(@template(_.extend(@model.toJSON(), params)))
+ @$el.data('slide-id', @model.get('id'))
DeckApp.Util.highlightCodeBlock(@$el)
@DeckApp = window.DeckApp || {}
@@ -42,6 +42,9 @@
vertical-align: top;
text-decoration: none;
z-index: 1000;
+ cursor: pointer;
+ cursor: hand;
+
p {
padding-top: 0px;
margin: 0px;

0 comments on commit 7f37e84

Please sign in to comment.