Skip to content
Browse files

Add autofocus in StockAdd Panel

Signed-off-by: Wenwei Cai <stanley.w.cai@gmail.com>
  • Loading branch information...
1 parent 3357ce6 commit 72a408dae9ebc1247c88c91264b3c81cb9e1ecc2 @swcai committed
Showing with 3 additions and 92 deletions.
  1. +1 −1 README.md
  2. +1 −0 app/controllers/stocks.coffee
  3. +1 −1 app/views/stocks/add.eco
  4. +0 −30 public/application.css
  5. +0 −1 public/application.js
  6. +0 −59 test/public/specs.js
View
2 README.md
@@ -4,7 +4,7 @@ TODO list
- StockAdd default to active the input
- Optimize the refresh rate
- Add StockDetail Panel
-- Deploy on PhoneGap, testing on Android and Apple
+- Deploy on PhoneGap, testing on Android and Apple - Done
- Update the app Theme
- beautify the StockList panel
- code clean
View
1 app/controllers/stocks.coffee
@@ -25,6 +25,7 @@ class StockAdd extends Panel
render: ->
@log 'StockAdd renderred!'
@html require('views/stocks/add')()
+ $('input').focus
back: ->
@navigate('/stocks', trans: 'left')
View
2 app/views/stocks/add.eco
@@ -1,6 +1,6 @@
<form>
<label>
<span>Code</span>
- <input type="text" name="code">
+ <input type="text" name="code" autofocus="autofocus">
</label>
</form>
View
30 public/application.css
@@ -1,30 +0,0 @@
-body,html{height:100%}
-.viewport{position:relative;}
-.viewport > *{position:absolute;left:0;right:0;top:0;bottom:0;}
-.viewport > *:not(.active){display:none}
-body.stage > header{position:absolute;left:0;top:0;right:0}
-body.stage > article{position:absolute;left:0;right:0;top:0;bottom:0}
-body.stage > footer{position:absolute;left:0;bottom:0;right:0}
-.panel{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;}
-.panel > article{-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;overflow:auto;-webkit-overflow-scrolling:touch}
-body{font-family:Helvetica Neue,Helvetica,Arial,sans-serif;overflow-x:hidden;-webkit-user-select:none;margin:0;padding:0;color:#292d39;background:#fff}
-*{-webkit-tap-highlight-color:rgba(0,0,0,0)}
-body.stage > header{height:40px;background:-webkit-gradient(linear,left top,left bottom,from(rgba(255,255,255,0.3)),color-stop(.5,rgba(255,255,255,0.1)),color-stop(.5,rgba(255,255,255,0))),-webkit-gradient(linear,left top,left bottom,from(#7189a6),to(#6a83a1))}
-body.stage > article{bottom:40px}
-body.stage > footer{height:40px;background:-webkit-gradient(linear,left top,left bottom,from(rgba(255,255,255,0.3)),color-stop(.5,rgba(255,255,255,0.2)),color-stop(.5,rgba(255,255,255,0))),#000}
-.panel > header{height:40px;line-height:40px;}
-.panel > header h2{margin:0;padding:0;text-align:center;color:#fffeff;text-shadow:0 -1px 0 rgba(0,0,0,0.5);font-weight:normal}
-.panel > header button{position:absolute;left:0;top:0;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.5);font-size:13px;background:-webkit-gradient(linear,left top,left bottom,from(rgba(255,255,255,0.3)),color-stop(.5,rgba(255,255,255,0.1)),color-stop(.5,rgba(255,255,255,0))),#476b9d;-webkit-box-shadow:inset 0 -1px 1px rgba(0,0,0,0.3),inset 0 1px 1px 0 rgba(0,0,0,0.6),0 1px 0 rgba(255,255,255,0.4);margin:7px;padding:5px 12px;border:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}
-.panel > header button:active{-webkit-box-shadow:inset 0 -1px 1px rgba(0,0,0,0.3),inset 0 1px 1px 0 rgba(0,0,0,0.6),0 1px 0 rgba(255,255,255,0.4),inset 0 0 20px rgba(255,255,255,0.2)}
-.panel > header button.right{left:auto;right:0}
-.list .item{padding:0 15px;height:50px;line-height:50px;border-bottom:1px solid rgba(0,0,0,0.1);color:#292d39;text-shadow:0 1px 0 #fff;background:#f6f6f7;background:-webkit-gradient(linear,left top,left bottom,from(#fff),color-stop(.5,rgba(255,255,255,0.4)),color-stop(.5,rgba(255,255,255,0))),#f6f6f7;}
-.list .item img{float:right;max-width:30px;max-height:30px;display:inline-block;margin:10px 0}
-.list .item:active{background:#f6f6f7;-moz-box-shadow:inset 0 1px 3px rgba(0,0,0,0.1);-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 3px rgba(0,0,0,0.1);-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,0.1);box-shadow:inset 0 1px 3px rgba(0,0,0,0.1)}
-form{margin:10px;background:#fff;border:1px solid #aeaeae;-moz-border-radius:10px;-webkit-border-radius:10px;border-radius:10px;-moz-box-shadow:0 1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.1);box-shadow:0 1px 1px rgba(0,0,0,0.1)}
-label{display:block;border-bottom:1px solid #aeaeae;font-size:13px;padding:15px;}
-label:last-child{border-bottom:none}
-label span::after{content:':'}
-select,input{display:block;width:100%;font-size:15px;margin:5px 0 0 0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
-.contacts.listView > article:empty::after{display:block;text-align:center;margin:10% 0;content:"No contacts"}
-.contacts.showView > article{padding:20px;}
-.contacts.showView > article img{max-width:150px;max-height:150px}
View
1 public/application.js
0 additions, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
View
59 test/public/specs.js
@@ -1,59 +0,0 @@
-
-
-(function(/*! Stitch !*/) {
- if (!this.specs) {
- var modules = {}, cache = {}, require = function(name, root) {
- var path = expand(root, name), indexPath = expand(path, './index'), module, fn;
- module = cache[path] || cache[indexPath]
- if (module) {
- return module.exports;
- } else if (fn = modules[path] || modules[path = indexPath]) {
- module = {id: path, exports: {}};
- try {
- cache[path] = module;
- fn(module.exports, function(name) {
- return require(name, dirname(path));
- }, module);
- return module.exports;
- } catch (err) {
- delete cache[path];
- throw err;
- }
- } else {
- throw 'module \'' + name + '\' not found';
- }
- }, expand = function(root, name) {
- var results = [], parts, part;
- if (/^\.\.?(\/|$)/.test(name)) {
- parts = [root, name].join('/').split('/');
- } else {
- parts = name.split('/');
- }
- for (var i = 0, length = parts.length; i < length; i++) {
- part = parts[i];
- if (part == '..') {
- results.pop();
- } else if (part != '.' && part != '') {
- results.push(part);
- }
- }
- return results.join('/');
- }, dirname = function(path) {
- return path.split('/').slice(0, -1).join('/');
- };
- this.specs = function(name) {
- return require(name, '');
- }
- this.specs.define = function(bundle) {
- for (var key in bundle)
- modules[key] = bundle[key];
- };
- this.specs.modules = modules;
- this.specs.cache = cache;
- }
- return this.specs.define;
-}).call(this)({
-
-});
-
-require('lib/setup'); for (var key in specs.modules) specs(key);

0 comments on commit 72a408d

Please sign in to comment.
Something went wrong with that request. Please try again.