Created
August 19, 2011 19:09
-
-
Save dmitrig01/1157720 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
diff --git a/templates/Projects._ b/templates/Projects._ | |
index f49198b..c5da571 100644 | |
--- a/templates/Projects._ | |
+++ b/templates/Projects._ | |
@@ -8,6 +8,7 @@ | |
<span class='icon reverse labeled add'></span> | |
Add project | |
</a> | |
+ <a class='popup button' href='#exports'>View exports</a> | |
<a class='button' href='/#!/manual'> | |
<span class='icon reverse labeled reference'></span> | |
Manual | |
diff --git a/views/Projects.bones b/views/Projects.bones | |
index 1a08819..5742b29 100644 | |
--- a/views/Projects.bones | |
+++ b/views/Projects.bones | |
@@ -1,10 +1,11 @@ | |
view = Backbone.View.extend({ | |
events: { | |
'click .actions a[href=#add]': 'add', | |
+ 'click .actions a[href=#exports]': 'exportList', | |
'click .delete': 'del' | |
}, | |
initialize: function() { | |
- _(this).bindAll('render', 'add', 'del'); | |
+ _(this).bindAll('render', 'add', 'del', 'exportList'); | |
this.collection.bind('add', this.render); | |
this.collection.bind('remove', this.render); | |
this.render(); | |
@@ -34,5 +35,23 @@ view = Backbone.View.extend({ | |
}).bind(this) | |
}); | |
return false; | |
+ }, | |
+ exportList: function(ev) { | |
+ $('#popup').addClass('loading'); | |
+ Bones.models = Bones.models || {}; | |
+ Bones.models.exports = Bones.models.exports || new models.Exports(); | |
+ Bones.models.exports.fetch({ | |
+ success: function(collection) { | |
+ $('#popup').removeClass('loading'); | |
+ new views.Exports({ | |
+ collection: collection, | |
+ el: $('#popup') | |
+ }); | |
+ }, | |
+ error: function(m, e) { | |
+ $('#popup').removeClass('loading'); | |
+ new views.Modal(e); | |
+ } | |
+ }); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment