Skip to content

Commit

Permalink
Few bug fixes in layout and disable search when search term blank
Browse files Browse the repository at this point in the history
  • Loading branch information
amitamb committed May 28, 2012
1 parent 5f57d98 commit 1c11707
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 4 deletions.
Binary file added app/assets/images/dailymotion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/soundcloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/vimeo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/youtube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ jQTubeUtil.init({

$(function(){

$(".search-form").submit(function(){
if (!$(this).find("#searchInput").val()){
return false;
}
});

$("#searchInput").autocomplete({
source: function( request, response ) {
var q = request.term;
Expand Down
17 changes: 15 additions & 2 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
.search-btn {
border-top-left-radius: 0px !important;
border-bottom-left-radius: 0px !important;
width:34px;
height:32px;
/*
<img src="/assets/search.png" style="max-height:12px;max-width:12px;padding-top:6px;"></img>
*/
}

.search-btn img {
Expand Down Expand Up @@ -115,9 +120,17 @@ ul.search-nav li a {
}

.search-icon {
position:relative;
top:3px;
padding-right:2px;
display:inline-block;
max-height:16px;
max-width:16px;
float:left;
clear:right;
position:absolute;
}

.source-link > span.source-name {
padding-left:20px !important;
}

.clearfix:after {
Expand Down
4 changes: 3 additions & 1 deletion app/views/home/_search_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<% if @source %>
<input type="hidden" id="source" name="source" value="<%= @source %>"></input>
<% end %>
<input value="<%= @q %>" name="q" class="span6 search-input" id="searchInput" size="16" type="text" ><button class="btn search-btn" type="submit" ><img src="/assets/search.png" style="max-height:12px;max-width:12px;padding-top:5px;"></img></button>
<input value="<%= @q %>" name="q" class="span6 search-input" id="searchInput" size="16" type="text" ><button class="btn search-btn" type="submit" >
<img src="/assets/search.png" style="max-height:12px;max-width:12px;padding-top:6px;"></img>
</button>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/home/search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ul id="search-nav" class="nav nav-tabs">
<% ["youtube", "vimeo", "soundcloud", "dailymotion"].each do |source| %>
<li class="<%= if source.to_sym == @source then "active" end %>">
<%= link_to image_tag("#{ source }.ico", :class => "search-icon") + " " + source.humanize, remove_filters(params).merge({ :q => @q, :source => source, :page => nil }), :data => { :source => source }, :class => "source-link pjax-enabled" %>
<%= link_to image_tag("#{ source }.png", :class => "search-icon") + " " + content_tag( :span, source.humanize, :class => "source-name" ), remove_filters(params).merge({ :q => @q, :source => source, :page => nil }), :data => { :source => source }, :class => "source-link pjax-enabled" %>
</li>
<% end %>
</ul>
Expand Down
16 changes: 16 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 0) do

end

0 comments on commit 1c11707

Please sign in to comment.