Commit 51118147
Changed files (11)
app
controllers
helpers
views
layouts
search
config
spec
controllers
helpers
views
search
app/controllers/creations_controller.rb
@@ -3,7 +3,6 @@ class CreationsController < ApplicationController
# GET /creations
# GET /creations.xml
def index
- # @creations = Creation.search params[:search], :include => :user, :match_mode => :boolean
@creations = Creation.all
respond_to do |format|
app/controllers/search_controller.rb
@@ -0,0 +1,6 @@
+class SearchController < ApplicationController
+ def index
+ @creations = Creation.search params[:search], :include => :user, :match_mode => :boolean
+ end
+
+end
app/helpers/search_helper.rb
@@ -0,0 +1,2 @@
+module SearchHelper
+end
app/views/layouts/application.html.erb
@@ -19,8 +19,14 @@
<div id="header"><!-- Header starts here -->
<div class="searchBar">
<div class="search">
- <div class="txt"><input type="text" /></div>
- <div class="searchBt"><input type="button" value="search" /></div>
+ <% form_tag(search_index_path, :method => "get") do %>
+ <div class="txt">
+ <%= text_field_tag(:search) %>
+ </div>
+ <div class="searchBt">
+ <%= submit_tag("search") %>
+ </div>
+ <% end %>
</div>
<% if user_signed_in? %>
<div class="signOut">
app/views/search/index.html.erb
@@ -0,0 +1,44 @@
+<div class="welcomeHolder">
+ <div class="welcome">
+ <h1>Search Results</h1>
+ <p><em>What time is it? Nana, nana, naaaaana caake time!</em></p>
+ <p>Check out our communities most recent cake work.</p>
+ <p align="right">
+ <a href="<%= url_for my_creations_path %>"><input type="button" value="MY CREATIONS" class="view" /></a>
+ </p>
+ <div class="clear"></div>
+ </div>
+ <div class="welcomeBottom"></div>
+</div>
+
+<div class="heading">The most recent creations</div>
+
+<div class="organic">
+<% @creations.reverse.each_with_index do |creation, index| %>
+ <div class="organicHolder">
+ <div class="organicContent">
+ <a href="<%= url_for creation %>">
+ <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo", :alt => creation.name %>
+ </a>
+ <h2><%= creation.name %></h2>
+ <p><%= creation.story %> <%= link_to 'more...', creation %></p>
+ </div>
+ </div>
+ <% if (index +1) % 3 == 0 %>
+</div>
+
+<div class="space"></div>
+<div class="organic">
+
+ <% end %>
+
+<% end %>
+</div>
+
+
+<div class="space"></div>
+
+<div class="clear"></div>
+
+<div class="hr"></div>
+<div class="space"></div>
config/routes.rb
@@ -1,4 +1,6 @@
Cake::Application.routes.draw do
+ get "search/index"
+
resources :creations
resources :authentications
get "home/index"
log/searchd.development.pid
@@ -0,0 +1,1 @@
+3794
spec/controllers/search_controller_spec.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe SearchController do
+
+ describe "GET 'index'" do
+ it "should be successful" do
+ get 'index'
+ response.should be_success
+ end
+ end
+
+end
spec/helpers/search_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the SearchHelper. For example:
+#
+# describe SearchHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# helper.concat_strings("this","that").should == "this that"
+# end
+# end
+# end
+describe SearchHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
spec/views/search/index.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "search/index.html.erb" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
.gitignore
@@ -4,3 +4,4 @@ log/*.log
tmp/**/*
*.swp
public/uploads/
+db/sphinx/development/*