From d54506989129fd5e1380ae64d77fc19191221dff Mon Sep 17 00:00:00 2001 From: Rolux Date: Fri, 26 Feb 2010 14:22:27 +0100 Subject: [PATCH] very basic textarea support --- build/css/ox.ui.classic.css | 3 ++- build/css/ox.ui.css | 15 +++++++++++++-- build/js/ox.ui.js | 12 ++++++++++-- demos/test/index.html | 5 +++++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/build/css/ox.ui.classic.css b/build/css/ox.ui.classic.css index 5ee3942..84171cb 100644 --- a/build/css/ox.ui.classic.css +++ b/build/css/ox.ui.classic.css @@ -103,7 +103,8 @@ Forms background: -moz-linear-gradient(top, rgb(224, 224, 224), rgb(255, 255, 255)); background: -webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), to(rgb(255, 255, 255))); } -.OxThemeClassic input.OxInput:focus { +.OxThemeClassic input.OxInput:focus, +.OxThemeClassic textarea.OxInput:focus { border: 1px solid rgb(160, 160, 160); -moz-box-shadow: 0 0 2px rgb(128, 128, 128); -webkit-box-shadow: 0 0 2px rgb(128, 128, 128); diff --git a/build/css/ox.ui.css b/build/css/ox.ui.css index 8dd8ec7..0742417 100644 --- a/build/css/ox.ui.css +++ b/build/css/ox.ui.css @@ -138,7 +138,8 @@ Forms ================================================================================ */ -input { +input, +textarea { padding: 0; border: 1px; margin: 0; @@ -152,7 +153,8 @@ input[type=submit] { input[type=image] { cursor: default; } -input:focus { +input:focus, +textarea:focus { outline: none; } /* @@ -214,12 +216,18 @@ input[type=image].OxSmall { input::-moz-focus-inner { border: none; } +textarea { + margin: -1px 0 0 -1px; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; +} .OxButton.OxSymbol, .OxButton.OxSymbol:active, .OxButton.OxSymbol:focus { border: 1px solid rgba(0, 0, 0, 0); background: rgba(0, 0, 0, 0); -moz-box-shadow: 0 0 0 rgba(0, 0, 0, 0); + //-webkit-box-shadow: 0 0 0 rgba(0, 0, 0, 0); } /* -------------------------------------------------------------------------------- @@ -325,6 +333,9 @@ div.OxInput > .OxButton:last-child { input.OxInput { float: left; margin: -1px -1px 0 -1px; +} +textarea.OxInput { + } /* -------------------------------------------------------------------------------- diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 04ab846..c368cf2 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -1799,7 +1799,7 @@ requires self.options.type == "textarea" ? "textarea" : "input", self ) .attr({ - type: self.options.type == "textarea" ? null : self.options.type + type: self.options.type == "textarea" ? undefined : self.options.type // fixme: make conditional? }) .addClass( "OxInput Ox" + Ox.toTitleCase(self.options.size) + @@ -1989,9 +1989,17 @@ requires that.triggerEvent("submit", that.$input.val()); } + that.height = function(value) { + if (self.options.type == "textarea") { + that.$element.height(value); + that.$input.height(value); + } + return that; + } + that.width = function(value) { that.$element.width(value); - that.$input.width(value - 2 - + that.$input.width(value - (self.options.type == "textarea" ? 0 : 2) - (self.options.labelWidth ? self.options.labelWidth + 34 : 0) - (self.options.placeholder.length > 1 ? 26 : 0) - (self.options.clear ? 15 : 0)); diff --git a/demos/test/index.html b/demos/test/index.html index 51d7225..b77d861 100644 --- a/demos/test/index.html +++ b/demos/test/index.html @@ -509,6 +509,11 @@ type: "text", value: "Bar" }).addClass("margin").appendTo(mainPanel); + $("
").appendTo(mainPanel.$element); + $("
").appendTo(mainPanel.$element); + Ox.Input({ + type: "textarea" + }).width(400).height(200).addClass("margin").appendTo(mainPanel); //*/ function openDialog() {