diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-10-10 13:03:34 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-10-10 13:03:34 -0400 |
| commit | 478361d2fe51e24e45ddb683118c6a0fe4eec895 (patch) | |
| tree | e2e569457f83bce4160ee1c18bb0ba9d5e283fe1 /public/assets/javascripts/ui/site/StaffView.js | |
| parent | d6d78ddf16e9cb6555e92089dfa77ba5648f686b (diff) | |
| parent | 81f10a23c2ab2bca5ee7a8d4bcc12c881cb04734 (diff) | |
merge
Diffstat (limited to 'public/assets/javascripts/ui/site/StaffView.js')
| -rw-r--r-- | public/assets/javascripts/ui/site/StaffView.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/public/assets/javascripts/ui/site/StaffView.js b/public/assets/javascripts/ui/site/StaffView.js index fdf39d2..0398f71 100644 --- a/public/assets/javascripts/ui/site/StaffView.js +++ b/public/assets/javascripts/ui/site/StaffView.js @@ -3,14 +3,19 @@ var StaffView = View.extend({ events: { "click #toggle-staff": "toggleStaff", + "click #toggle-featured": "toggleFeatured", }, initialize: function() { this.$toggleStaff = $("#toggle-staff") + this.$toggleFeatured = $("#toggle-featured") this.$mediaEmbed = $("#media-embed") if (this.$toggleStaff.length && this.$toggleStaff.data().isstaff) { this.$toggleStaff.html("Is Staff") } + if (this.$toggleFeatured.length && this.$toggleFeatured.data().featured) { + this.$toggleFeatured.html("Featured Project") + } if (this.$mediaEmbed.length) { var media = this.$mediaEmbed.data() this.$mediaEmbed.html( Parser.tag( media ) ) @@ -44,6 +49,24 @@ var StaffView = View.extend({ }.bind(this) }) }.bind(this)) + }, + + toggleFeatured: function(){ + var state = ! this.$toggleFeatured.data().featured + $.ajax({ + type: "put", + dataType: "json", + url: window.location.href + "/feature", + data: { + state: state, + _csrf: $("#_csrf").val(), + }, + success: function(data){ + this.$toggleFeatured.data("featured", data.state) + this.$toggleFeatured.html(data.state ? "Featured Project" : "Feature this project") + $("#isFeaturedProject").html(data.state ? "yes" : "no") + }.bind(this) + }) }, }) |
