diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-12-03 15:19:43 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-12-03 15:19:43 -0500 |
| commit | 9b656e51232f1b1f2cf210908b569b1a224e7a90 (patch) | |
| tree | b73727987c57b201c5ed6d7d4311195a20a18b73 /StoneIsland/www/js | |
| parent | 0e783ecb14849eb8ab36f3c4d591ffdbb2e8e942 (diff) | |
date css
Diffstat (limited to 'StoneIsland/www/js')
| -rw-r--r-- | StoneIsland/www/js/index.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/view/Serializable.js | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index 468c0d7e..0b3531dd 100644 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -3,7 +3,7 @@ var app = (function(){ app.init = function(){ - sdk.init({ env: "test" }) + sdk.init({ env: "production" }) app.bind() app.build() diff --git a/StoneIsland/www/js/lib/view/Serializable.js b/StoneIsland/www/js/lib/view/Serializable.js index f9abd011..98aa8ce3 100644 --- a/StoneIsland/www/js/lib/view/Serializable.js +++ b/StoneIsland/www/js/lib/view/Serializable.js @@ -2,7 +2,9 @@ var SerializableView = View.extend({ events: { "change select": "update_select", + "change [type=date]": "update_date", "focus input": "focus_input", + "click .date-wrapper": "focus_date", "submit form": "save", }, @@ -21,6 +23,10 @@ var SerializableView = View.extend({ if ($el.attr("type") == "checkbox") { $el.prop("checked", value) } + if ($el.attr("type") == "date") { + $el.val( value ) + this.update_date({ currentTarget: $el }) + } else if ($el.prop("tagName") == "SELECT") { $el.val( value ) this.update_select({ currentTarget: $el }) @@ -57,12 +63,23 @@ var SerializableView = View.extend({ $(e.currentTarget).removeClass("error_hilite") }, + focus_date: function(e){ + $(e.currentTarget).find("input").focus() + }, + update_select: function(e){ var $target = $(e.currentTarget), value = $target.val() var label = $target.find("option").filter(function(){ return this.value === value }).html() $target.parent().addClass("picked") $target.parent().find("span").html(label) }, + + update_date: function(e){ + var $target = $(e.currentTarget), value = $target.val() + var label = moment(value).format("MM/DD/YYYY") + $target.parent().addClass("picked") + $target.parent().find("span").html(label) + }, validate: function(data, errors){ var data = data || this.serialize() |
