From 868bbcdd41fae6d736c5758a86d1a8ac96ea7dbd Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 4 Apr 2014 14:17:57 -0500 Subject: [PATCH] yank tips in favor of border and autofocus for item search --- app/assets/javascripts/outfits/edit.js | 5 ++-- app/assets/stylesheets/outfits/_edit.sass | 33 +++++------------------ app/views/outfits/edit.html.haml | 13 +-------- 3 files changed, 11 insertions(+), 40 deletions(-) diff --git a/app/assets/javascripts/outfits/edit.js b/app/assets/javascripts/outfits/edit.js index c58fedda..7eb39448 100644 --- a/app/assets/javascripts/outfits/edit.js +++ b/app/assets/javascripts/outfits/edit.js @@ -163,7 +163,8 @@ View.Fullscreen = function (wardrobe) { if(full) { preview_swf = $('#preview-swf'); // swf replaced var available = { - height: search_el.offset().top - preview_el.offset().top, + height: search_el.offset().top - + parseInt(search_el.css('marginTop'), 10) - preview_el.offset().top, width: preview_el.innerWidth() - sidebar_el.outerWidth() - 12 // 12px margin }, dim = {}, margin = {}, size = { old: {height: preview_swf.height(), width: preview_swf.width()}, @@ -189,7 +190,7 @@ View.Fullscreen = function (wardrobe) { preview_el.height(available.height); // If the footer goes onto two lines, nudge search up. - search_el.css('bottom', $('#footer').height()); + search_el.css('bottom', footer.outerHeight(true)); // Now that preview is fit, we fit the sidebar's content element, which // also has to deal with the constraint of its navbar's height. diff --git a/app/assets/stylesheets/outfits/_edit.sass b/app/assets/stylesheets/outfits/_edit.sass index 9e5a68e2..580fe006 100644 --- a/app/assets/stylesheets/outfits/_edit.sass +++ b/app/assets/stylesheets/outfits/_edit.sass @@ -238,8 +238,13 @@ body.outfits-edit top: -9999px width: 30em #preview-search + +border-radius(8px) + border: 1px solid $soft-border-color + box-sizing: border-box clear: both - padding-top: .5em + margin-bottom: .5em + margin-top: 1em + padding: .25em 1em .25em text-align: left h2 +inline-block @@ -253,35 +258,11 @@ body.outfits-edit display: none #preview-search-advanced display: block - &.has-results - #tips - display: none #preview-search-basic-main clear: both - #preview-search-basic-main, #preview-search-advanced-main + #preview-search.has-results #preview-search-basic-main, #preview-search-advanced-main /* don't bounce the header around kthx */ min-height: 180px - #tips - padding-top: .5em - - li - box-sizing: border-box - display: none - list-style: none - margin: 0 auto - padding: 1em - position: relative - width: 600px - - footer - color: $soft-text-color - font-size: 85% - position: absolute - right: 1em - top: 1.5em - - a, span - margin-left: .5em #preview-search-advanced display: none diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml index dcaeb490..4e4883f1 100644 --- a/app/views/outfits/edit.html.haml +++ b/app/views/outfits/edit.html.haml @@ -96,7 +96,7 @@ %form#preview-search-basic.item-search %header %h2= t '.search.header' - %input{:name => "query", :type => "search"}/ + %input{:name => "query", :type => "search", autofocus: true}/ %input{:type => "submit", :value => t('.search.form.submit')}/ %a#preview-search-advanced-link{href: 'javascript:void(0)'}= t '.search.advanced.header' %a#preview-search-form-clear{:href => "#"}= t '.search.form.clear' @@ -107,17 +107,6 @@ #preview-search-form-no-results = t '.search.no_results_html', :query => content_tag(:span) %ul#preview-search-results - #tips - %ul - - tips = WardrobeTip.by_index.all - - tips.each_with_index do |tip, index| - %li - %h3 Did you know? - %div= md tip.body - %footer - %a.prev{href: 'javascript:void(0)'} ← Prev - %span Tip #{index + 1} of #{tips.size} - %a.next{href: 'javascript:void(0)'} Next → %form#preview-search-advanced %header %h2= t '.search.advanced.header'