summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-10-14 20:00:59 -0400
committerJulie Lala <jules@okfoc.us>2014-10-14 20:33:29 -0400
commit1b152e66ad8d7aa1c5511152991e648308f8918b (patch)
treefafbf1de89a147adf8f79b1f866c023a63a09482 /public/assets/javascripts/ui
parent527a65ca570891ff473dbdac36d41b1be60196f1 (diff)
fixed-position close box
fixed-position close box &c
Diffstat (limited to 'public/assets/javascripts/ui')
-rw-r--r--public/assets/javascripts/ui/editor/MediaViewer.js11
-rw-r--r--public/assets/javascripts/ui/lib/ModalView.js8
2 files changed, 17 insertions, 2 deletions
diff --git a/public/assets/javascripts/ui/editor/MediaViewer.js b/public/assets/javascripts/ui/editor/MediaViewer.js
index 2e76bec..10819af 100644
--- a/public/assets/javascripts/ui/editor/MediaViewer.js
+++ b/public/assets/javascripts/ui/editor/MediaViewer.js
@@ -6,6 +6,7 @@ var MediaViewer = ModalView.extend({
loaded: false,
perPage: 12,
offset: 0,
+ fixedClose: true,
events: {
'mousedown': "stopPropagation",
@@ -106,6 +107,7 @@ var MediaViewer = ModalView.extend({
},
populate: function(data){
+ var scrollTop = this.loaded ? $('.myMedia .container').height() : 0
if (data && data.length) {
if (data.length < this.perPage) {
this.$viewMore.hide()
@@ -122,8 +124,13 @@ var MediaViewer = ModalView.extend({
this.$noMedia.show()
this.$deleteMedia.hide()
}
- this.loaded = true
- this.__super__.show.call(this)
+ if (this.loaded) {
+ this.$el.delay(300).animate({ scrollTop: scrollTop }, 200)
+ }
+ else {
+ this.loaded = true
+ this.__super__.show.call(this)
+ }
},
addUploadedMedia: function(media){
diff --git a/public/assets/javascripts/ui/lib/ModalView.js b/public/assets/javascripts/ui/lib/ModalView.js
index d9b518a..1c41861 100644
--- a/public/assets/javascripts/ui/lib/ModalView.js
+++ b/public/assets/javascripts/ui/lib/ModalView.js
@@ -18,6 +18,10 @@ var ModalView = View.extend({
if (! this.usesFileUpload) {
$(".fileUpload").removeClass("active")
}
+ if (this.fixedClose) {
+ $("#fixed_close").addClass("active")
+ $("#fixed_close").bind("click", this.hide.bind(this))
+ }
this.$el.addClass("active")
$("body").addClass("noOverflow")
@@ -25,6 +29,10 @@ var ModalView = View.extend({
hide: function(){
// $(".mediaDrawer, .room1").removeClass("active editing");
+ if (this.fixedClose) {
+ $("#fixed_close").removeClass("active")
+ $("#fixed_close").unbind("click", this.hide.bind(this))
+ }
this.$el.removeClass("active");
$("body").removeClass("noOverflow");
},