KITAITI Makoto
null+****@clear*****
Tue Dec 23 06:23:12 JST 2014
KITAITI Makoto 2014-12-23 06:23:12 +0900 (Tue, 23 Dec 2014) New Revision: d94a3fefbef25ce72d5b376e4de04f3c7729aa1f https://github.com/ranguba/epub-searcher/commit/d94a3fefbef25ce72d5b376e4de04f3c7729aa1f Message: Keep query words in input after search Modified files: app/controllers/main-controller.rb app/views/index.haml Modified: app/controllers/main-controller.rb (+3 -3) =================================================================== --- app/controllers/main-controller.rb 2014-12-23 06:16:20 +0900 (7090a81) +++ app/controllers/main-controller.rb 2014-12-23 06:23:12 +0900 (8d7bec5) @@ -4,11 +4,11 @@ Epub::App.controllers do layout :layout get :index do - query_words = params[:q] + @query_words = params[:q] - right_query = query_words && !query_words.empty? + right_query = @query_words && !@query_words.empty? if right_query - hit_records = search_from_groonga(query_words) + hit_records = search_from_groonga(@query_words) @results = Array.new hit_records.each do |record| Modified: app/views/index.haml (+1 -1) =================================================================== --- app/views/index.haml 2014-12-23 06:16:20 +0900 (81c703c) +++ app/views/index.haml 2014-12-23 06:23:12 +0900 (96b7d2c) @@ -6,7 +6,7 @@ %form{:class => 'row', :action => '/', :method => 'GET'} %div{:class => 'form-group'} %div{:class => 'col-md-6 col-md-offset-2'} - %input{:type => 'search', :class => 'form-control', :name => 'q'} + %input{:type => 'search', :class => 'form-control', :name => 'q', :value => @query_words} %div{:class => 'col-md-2'} %button{:class => 'form-control btn btn-default'} Search -------------- next part -------------- HTML����������������������������... 다운로드