summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/editor/MediaViewer.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-12-01 16:27:39 -0500
committerJules Laplace <jules@okfoc.us>2014-12-01 16:27:39 -0500
commit64f99d71c9ff0d419fad080751ba02afe9f6f3df (patch)
tree1b1e66065ada66a38e07763c127e8e3e7f308b0c /public/assets/javascripts/ui/editor/MediaViewer.js
parent42144451294184225ceccbfe0ac9459c1c6cb1a9 (diff)
move tumblr load stuff into own modal; example tumblrs
Diffstat (limited to 'public/assets/javascripts/ui/editor/MediaViewer.js')
-rw-r--r--public/assets/javascripts/ui/editor/MediaViewer.js40
1 files changed, 22 insertions, 18 deletions
diff --git a/public/assets/javascripts/ui/editor/MediaViewer.js b/public/assets/javascripts/ui/editor/MediaViewer.js
index 94a9d90..2ae5104 100644
--- a/public/assets/javascripts/ui/editor/MediaViewer.js
+++ b/public/assets/javascripts/ui/editor/MediaViewer.js
@@ -38,11 +38,11 @@ var MediaViewer = ModalView.extend({
this.$deleteMedia = this.$("#deleteMedia")
this.$viewMore = this.$(".viewMore")
this.$noMedia = this.$(".noMedia")
-
- this.$tumblrUrl = this.$("#tumblr-url")
},
+ mode: "user",
wallpaperToggle: function(){
+ this.mode = "wallpaper"
this.$wallpaperMedia.addClass("active")
this.$foundMedia.addClass("inactive")
this.$myMedia.addClass("inactive").removeClass('active')
@@ -51,19 +51,25 @@ var MediaViewer = ModalView.extend({
},
foundToggle: function(){
+ this.mode = "found"
this.$wallpaperMedia.removeClass("active")
this.$foundMedia.addClass("active")
this.$myMedia.addClass("inactive").removeClass('active')
this.$("a").removeClass("active")
this.$foundToggle.addClass("active")
+ this.parent.mediaUpload.hide()
+ this.parent.mediaTumblr.show()
},
userToggle: function(){
+ this.mode = "user"
this.$wallpaperMedia.removeClass("active")
this.$foundMedia.removeClass("active")
this.$myMedia.removeClass("inactive").addClass('active')
this.$("a").removeClass("active")
this.$userToggle.addClass("active")
+ this.parent.mediaUpload.show()
+ this.parent.mediaTumblr.hide()
},
show: function(){
@@ -72,8 +78,7 @@ var MediaViewer = ModalView.extend({
// this.loadTrending()
}
else {
- this.parent.cursor.message("media")
- this.__super__.show.call(this)
+ this.reallyShow()
}
},
@@ -81,8 +86,20 @@ var MediaViewer = ModalView.extend({
this.__super__.hide.call(this)
this.deleteArmed(false)
this.parent.mediaUpload.hide()
+ this.parent.mediaTumblr.hide()
this.parent.cursor.message('start')
},
+
+ reallyShow: function(){
+ this.__super__.show.call(this)
+ if (this.mode == "user") {
+ this.userToggle()
+ }
+ else {
+ this.foundToggle()
+ }
+ this.parent.cursor.message("media")
+ },
load: function(){
$.get("/api/media/user", { offset: this.offset, limit: this.perPage }, this.populate.bind(this))
@@ -159,8 +176,7 @@ var MediaViewer = ModalView.extend({
}
else {
this.loaded = true
- this.parent.cursor.message("media")
- this.__super__.show.call(this)
+ this.reallyShow()
}
},
@@ -296,16 +312,4 @@ var MediaViewer = ModalView.extend({
_followCursor(e)
},
- enterTumblrUrl: function(e){
- e.stopPropagation()
- if (e.keyCode !== 13) { return }
- var url = this.$tumblrUrl.val()
- Parser.tumblr(url, function(media_list){
- console.log(media_list)
- this.$foundMediaContainer.empty()
- media_list.reverse().forEach(function(media){
- this.add(media, this.$foundMediaContainer)
- }.bind(this))
- }.bind(this))
- },
})