summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/site/StaffView.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-10-28 18:06:46 -0400
committerJules Laplace <jules@okfoc.us>2016-10-28 18:06:46 -0400
commit9e7bacd46c1e5d0e1c24433690d421ab3f3a11f2 (patch)
tree4d0cefa2780dfa4382f1ed2ea481b6aafbdbb15e /public/assets/javascripts/ui/site/StaffView.js
parent50da9e3e677f121f15e501bf062da6c45db255ad (diff)
parentcce1dea756717f1308c6b72f762b5ea5f5b43958 (diff)
merge
Diffstat (limited to 'public/assets/javascripts/ui/site/StaffView.js')
-rw-r--r--public/assets/javascripts/ui/site/StaffView.js70
1 files changed, 69 insertions, 1 deletions
diff --git a/public/assets/javascripts/ui/site/StaffView.js b/public/assets/javascripts/ui/site/StaffView.js
index fdf39d2..97f86c2 100644
--- a/public/assets/javascripts/ui/site/StaffView.js
+++ b/public/assets/javascripts/ui/site/StaffView.js
@@ -3,14 +3,29 @@ var StaffView = View.extend({
events: {
"click #toggle-staff": "toggleStaff",
+ "click #toggle-featured": "toggleFeatured",
+ "click #toggle-stock": "toggleStock",
+ "click #toggle-artist": "toggleArtist",
},
initialize: function() {
this.$toggleStaff = $("#toggle-staff")
+ this.$toggleFeatured = $("#toggle-featured")
+ this.$toggleStock = $("#toggle-stock")
+ this.$toggleArtist = $("#toggle-artist")
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.$toggleStock.length && this.$toggleStock.data().stock) {
+ this.$toggleStock.html("Layout is Stock")
+ }
+ if (this.$toggleArtist.length && this.$toggleArtist.data().isartist) {
+ this.$toggleArtist.html("Is Artist")
+ }
if (this.$mediaEmbed.length) {
var media = this.$mediaEmbed.data()
this.$mediaEmbed.html( Parser.tag( media ) )
@@ -44,6 +59,59 @@ 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)
+ })
+ },
+
+ toggleStock: function(){
+ var state = ! this.$toggleStock.data().stock
+ $.ajax({
+ type: "put",
+ dataType: "json",
+ url: window.location.href + "/stock",
+ data: {
+ state: state,
+ _csrf: $("#_csrf").val(),
+ },
+ success: function(data){
+ this.$toggleStock.data("stock", data.state)
+ this.$toggleStock.html(data.state ? "Stock Layout" : "Make this layout Stock")
+ $("#isStockLayout").html(data.state ? "yes" : "no")
+ }.bind(this)
+ })
+ },
+
+ toggleArtist: function(){
+ var state = ! this.$toggleArtist.data().isartist
+ $.ajax({
+ type: "put",
+ dataType: "json",
+ url: window.location.href + "/artist",
+ data: {
+ state: state,
+ _csrf: $("#_csrf").val(),
+ },
+ success: function(data){
+ this.$toggleArtist.data("stock", data.state)
+ this.$toggleArtist.html(data.state ? "Is Artist" : "Make Artist")
+ $("#isArtist").html(data.state ? "yes" : "no")
+ }.bind(this)
+ })
+ },
})