From 4532ecccd5469a8558d105d0a28863ac6fbce0f1 Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 31 Mar 2014 23:07:55 -0500 Subject: [PATCH] lolwhoops, make nebula previews clickable - and all pet type previews for that matter --- app/assets/javascripts/outfits/new.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/outfits/new.js b/app/assets/javascripts/outfits/new.js index 66de56b1..968b25be 100644 --- a/app/assets/javascripts/outfits/new.js +++ b/app/assets/javascripts/outfits/new.js @@ -8,7 +8,7 @@ var preview_el = $('#pet-preview'), name_el = $('#main-pet-name'); preview_el.click(function () { - name_el.val(Preview.Job.current.name).closest('form').submit(); + Preview.Job.current.visit(); }); var Preview = { @@ -87,10 +87,19 @@ Preview.Job = function (key, base) { Preview.Job.Name = function (name) { this.name = name; Preview.Job.apply(this, [name, 'cpn']); + + this.visit = function() { + name_el.val(this.name).closest('form').submit(); + } } Preview.Job.Hash = function (hash) { Preview.Job.apply(this, [hash, 'cp']); + + this.visit = function() { + window.location = "/wardrobe?color=" + $('#color').val() + "&species=" + + $('#species').val(); + } }