now with toggling also, full functionality pretty much present

This commit is contained in:
Peter Cottle 2012-10-23 22:18:31 -07:00
parent 41d72793ea
commit 1a24fa370a
3 changed files with 28 additions and 11 deletions

View file

@ -109,14 +109,15 @@
</script> </script>
<script type="text/html" id="interactive-rebase-entry-template"> <script type="text/html" id="interactive-rebase-entry-template">
<li id="<%= id %>"> <li id="<%= id %>" class="rebaseEntry">
<div class="wrapper"> <div class="wrapper">
<%= id %>
<div>
Options: Pick, Choose, Etc
</div>
<i class="icon-align-justify"></i> <i class="icon-align-justify"></i>
<span class="idwrapper">
<%= id %>
</span>
<a id="toggleButton" class="uiButton uiButtonPink">
Toggle Pick
</a>
</div> </div>
</li> </li>
</script> </script>

View file

@ -101,21 +101,28 @@ var RebaseEntryView = Backbone.View.extend({
tagName: 'li', tagName: 'li',
template: _.template($('#interactive-rebase-entry-template').html()), template: _.template($('#interactive-rebase-entry-template').html()),
events: {
'click #toggleButton': 'toggle'
},
toggle: function() { toggle: function() {
this.model.toggle(); this.model.toggle();
// toggle a class also
this.listEntry.toggleClass('notPicked', !this.model.get('pick'));
}, },
initialize: function(options) { initialize: function(options) {
this.model.on('change', this.render, this);
this.render(); this.render();
}, },
render: function() { render: function() {
this.$el.append(this.template(this.model.toJSON())); this.$el.append(this.template(this.model.toJSON()));
// have to build some of this stuff up manually, lame.
// backbone needs a collectionview, this is ugly
var id = '#' + this.model.get('id');
this.listEntry = this.$(id);
this.$(id + ' #toggleButton').on('click', _.bind(function() {
this.toggle();
}, this));
} }
}); });

View file

@ -325,6 +325,15 @@ p.commandLine span.prompt {
cursor: pointer; cursor: pointer;
} }
li.rebaseEntry {
margin: 10px;
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}
li.rebaseEntry.notPicked {
opacity: 0.2;
}
/* button stuff from liquidGraph */ /* button stuff from liquidGraph */
.uiButton { .uiButton {
border-top: 1px solid #96d1f8; border-top: 1px solid #96d1f8;