summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-10-16 17:42:31 -0400
committerJules Laplace <jules@okfoc.us>2014-10-16 17:42:31 -0400
commit9880712797beedb5df936f3c740de79d549fca74 (patch)
treeda316af18c72601acc9f9781a38b64f77c25c249
parent4b2360ff6d7279df58d4fe5723fdf015d6577149 (diff)
move mega-tile behavior into wallpapepr picker
-rw-r--r--public/assets/javascripts/ui/editor/Presets.js20
-rw-r--r--public/assets/javascripts/ui/editor/WallpaperPicker.js23
-rwxr-xr-xpublic/assets/stylesheets/app.css2
-rw-r--r--views/controls/editor/presets.ejs1
-rw-r--r--views/controls/editor/wallpaper.ejs1
5 files changed, 24 insertions, 23 deletions
diff --git a/public/assets/javascripts/ui/editor/Presets.js b/public/assets/javascripts/ui/editor/Presets.js
index 4cd4eea..be86af3 100644
--- a/public/assets/javascripts/ui/editor/Presets.js
+++ b/public/assets/javascripts/ui/editor/Presets.js
@@ -5,8 +5,6 @@ var Presets = View.extend({
"mousedown": "stopPropagation",
"click .presets span": "selectPreset",
"click .swatches span": "selectColor",
- "change .url": "tileWalls",
- "keydown .url": "enterSetUrl",
},
presets: {
@@ -46,8 +44,6 @@ var Presets = View.extend({
initialize: function(opt){
this.parent = opt.parent
- this.$url = this.$(".url")
-
this.$presets = this.$(".presets")
_.keys(this.presets).forEach(function(name){
var $swatch = $("<span>")
@@ -102,21 +98,5 @@ var Presets = View.extend({
Walls.setBodyColor()
this.lastPreset = preset
},
-
- tileWalls: function(){
- var url = this.$url.sanitize()
- if (url.length && url.indexOf("http://") == 0) {
- Walls.setWallpaper.wall({ src: url })
- Walls.setWallpaper.floor({ src: url })
- Walls.setWallpaper.ceiling({ src: url })
- }
- app.controller.wallpaperPicker.addUrl(url)
- },
- enterSetUrl: function (e) {
- e.stopPropagation()
- if (e.keyCode == 13) {
- setTimeout(this.tileWalls.bind(this), 100)
- }
- },
}) \ No newline at end of file
diff --git a/public/assets/javascripts/ui/editor/WallpaperPicker.js b/public/assets/javascripts/ui/editor/WallpaperPicker.js
index 116b725..b26a5dc 100644
--- a/public/assets/javascripts/ui/editor/WallpaperPicker.js
+++ b/public/assets/javascripts/ui/editor/WallpaperPicker.js
@@ -11,6 +11,8 @@ var WallpaperPicker = UploadView.extend({
"click .swatch": 'pick',
"click .wallpaperRemove": 'remove',
"input [data-role='wallpaper-scale']": 'updateScale',
+ "change .url": "tileWalls",
+ "keydown .url": "enterSetUrl",
},
initialize: function(opt){
@@ -20,6 +22,8 @@ var WallpaperPicker = UploadView.extend({
this.$remove = this.$(".wallpaperRemove")
this.$remove.hide()
+ this.$url = this.$(".url")
+
this.$position = this.$("[data-role='wallpaper-position']")
this.$scale = this.$("[data-role='wallpaper-scale']")
@@ -161,7 +165,24 @@ var WallpaperPicker = UploadView.extend({
s = parseFloat(this.$scale.val())
this.wall.wallpaperPosition({ scale: s })
},
-
+
+ tileWalls: function(){
+ var url = this.$url.sanitize()
+ if (url.length && url.indexOf("http") == 0) {
+ Walls.setWallpaper.wall({ src: url })
+ Walls.setWallpaper.floor({ src: url })
+ Walls.setWallpaper.ceiling({ src: url })
+ }
+ this.addUrl(url)
+ this.$url.val("")
+ },
+ enterSetUrl: function (e) {
+ e.stopPropagation()
+ if (e.keyCode == 13) {
+ setTimeout(this.tileWalls.bind(this), 100)
+ }
+ },
+
initializePositionCursor: function(){
var base = this
var dx = 0, dy = 0, dragging = false, delta
diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css
index 89a6495..28eabd9 100755
--- a/public/assets/stylesheets/app.css
+++ b/public/assets/stylesheets/app.css
@@ -1700,7 +1700,7 @@ input[type="range"]::-webkit-slider-thumb {
width: 100%;
color: #555;
}
-#presets .url {
+.wallpaper .url {
margin: 4px 0;
padding: 2px;
font-size: 12px;
diff --git a/views/controls/editor/presets.ejs b/views/controls/editor/presets.ejs
index 02e9d42..04b1cf1 100644
--- a/views/controls/editor/presets.ejs
+++ b/views/controls/editor/presets.ejs
@@ -2,5 +2,4 @@
<h4>Preset Styles</h4>
<div class="presets">
</div>
- <input type="text" class="url" placeholder="enter a url">
</div>
diff --git a/views/controls/editor/wallpaper.ejs b/views/controls/editor/wallpaper.ejs
index 39a109b..ed175ae 100644
--- a/views/controls/editor/wallpaper.ejs
+++ b/views/controls/editor/wallpaper.ejs
@@ -32,6 +32,7 @@
<label>Resize Wallpaper</label>
</div>
-->
+ <input type="text" class="url" placeholder="enter a url">
<div class="wallpaperResizeControls">
<span data-role="wallpaper-position" class="ion-arrow-expand"></span>