Skip to content
Browse files

New file input, fixed creation

  • Loading branch information...
1 parent d30d8ca commit c2e067d82a7749b60859d15c870a1f438e3f4653 myfreeweb committed Feb 20, 2011
Showing with 20 additions and 8 deletions.
  1. +16 −8 views/js.haml
  2. +2 −0 views/pages.haml
  3. +2 −0 views/screen.sass
View
24 views/js.haml
@@ -4,22 +4,30 @@
$dom.addClass($dom.get('article form')[0], 'hidden');
var editlink = $dom.create('a'), bd = $dom.get('#body')[0], af = $dom.get('article form')[0];
editlink.innerHTML = 'edit';
- editlink.href = 'javascript:void(0)';
- editlink.onclick = function() {
+ editlink.href = 'javascript:toggle_edit()';
+ function toggle_edit() {
$dom.toggleClass(bd, 'hidden', !$dom.hasClass(bd, 'hidden'));
$dom.toggleClass(af, 'hidden', !$dom.hasClass(af, 'hidden'));
if (editlink.innerHTML == 'edit') editlink.innerHTML = 'cancel'
- else editlink.innerHTML = 'edit';
+ else {editlink.innerHTML = 'edit';location.hash = ''}
}
$dom.get('article header')[0].appendChild(editlink);
-- if flash
+ if (location.hash == '#edit') toggle_edit();
+ window.onhashchange = function(e) {
+ if (location.hash == '#edit') toggle_edit();
+ }
+ $dom.get('nav input')[0].onkeyup = function(e) {
+ if(e.which) var keycode = e.which; else var keycode = e.keyCode;
+ if(keycode == 13) location.href = '/pages/' + this.value + '#edit';
+ }
+- if flash[:info] or flash[:error]
:javascript
- if (!Array.prototype.forEach) {Array.prototype.forEach = function(fun){var len=this.length;
- if (typeof fun!="function") throw new TypeError();
- var thisp = arguments[1];for (var i = 0; i < len; i++){if (i in this)fun.call(thisp, this[i], i, this);}}}
+ if(!Array.prototype.forEach){Array.prototype.forEach = function(fun){var len=this.length;
+ if(typeof fun!="function") throw new TypeError();
+ var thisp = arguments[1];for (var i=0;i<len;i++){if(i in this)fun.call(thisp,this[i],i,this);}}}
var el = $dom.get('.flash');
setTimeout(function() {
- if (Modernizr.csstransitions) el.forEach(function(e){$dom.addClass(e,'fade')})
+ if(Modernizr.csstransitions) el.forEach(function(e){$dom.addClass(e,'fade')});
else el.forEach(function(e){$dom.transform(e,{opacity:0},600)});
}, 1500);
setTimeout(function() {
View
2 views/pages.haml
@@ -11,6 +11,8 @@
- for page in @pages
%li
%a{:href => "/pages/#{page}", :class => ("active" if page == @cur_page[:name])}= page
+ %li
+ %input{:type => "text", :placeholder => "Create a new file"}
%article
%header
%h1= @cur_page[:name]
View
2 views/screen.sass
@@ -50,6 +50,8 @@ body > header
padding: 2em $sidepad 0
nav
+box-flex(1)
+ input
+ width: 50%
ul
+no-bullets
.active

0 comments on commit c2e067d

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