Skip to content

Commit

Permalink
Cleanup, start on the advanced search stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
djcp committed Jul 28, 2009
1 parent 28ce042 commit ae94396
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 87 deletions.
67 changes: 0 additions & 67 deletions app/controllers/admin/model_abstract_controller.rb

This file was deleted.

10 changes: 10 additions & 0 deletions app/controllers/advanced_search_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class AdvancedSearchController < ApplicationController
before_filter :is_admin

def contacts
end

def notes
end

end
8 changes: 4 additions & 4 deletions app/controllers/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def manage_tags
(new_tags and new_tags.collect{|t|t.to_i}),
(current_tags and current_tags.collect{|t|t.to_i})
].flatten.uniq.compact
logger.warn('Deduped Tags: ' + deduped_tags.inspect)
#logger.warn('Deduped Tags: ' + deduped_tags.inspect)
@object.tag_ids = deduped_tags || []
@object.save
end
Expand Down Expand Up @@ -62,7 +62,7 @@ def index
end
end

logger.warn("Ferret search string: " + ferret_fields)
#logger.warn("Ferret search string: " + ferret_fields)

if params[:export].blank?
if ferret_fields == '* '
Expand Down Expand Up @@ -137,7 +137,7 @@ def update
flash[:notice] = 'Saved!'
redirect_to :controller => '/admin/dashboard', :action => :dashboard and return
else
logger.warn('update failed.')
#logger.warn('update failed.')
render :template => 'contacts/edit' and return
end
end
Expand All @@ -149,7 +149,7 @@ def destroy
flash[:notice] = 'Gone!'
redirect_to :controller => '/admin/dashboard', :action => :dashboard and return
rescue Exception => exc
logger.error "Destroy failed #{exc.message}"
#logger.error "Destroy failed #{exc.message}"
flash[:error] = 'There was an error deleting that item. Sorry!'
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/saved_searches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def create
def show
@saved_search = SavedSearch.find(params[:id])
rescue Exception => exc
flash[:error] = "There was an error when we looked for that tag: #{exc.message}"
flash[:error] = "There was an error when we looked for that saved search: #{exc.message}"
redirect_to :action => :index and return
end

Expand Down
2 changes: 0 additions & 2 deletions app/helpers/admin/model_abstract_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/admin/saved_search_helper.rb

This file was deleted.

2 changes: 2 additions & 0 deletions app/helpers/advanced_search_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module AdvancedSearchHelper
end
2 changes: 0 additions & 2 deletions app/helpers/saved_search_helper.rb

This file was deleted.

23 changes: 23 additions & 0 deletions app/views/advanced_search/contacts.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<% form_tag contacts_url do %>
<%= text_field_tag :q, params[:q] %>
<%= submit_tag 'Go' %>
<% end %>

<table border="0" cellpadding="5" cellspacing="0">
<tr>
<th>all these words:</th>
<td><%= text_field_tag :all_words, params[:all_words], :size => 50 %></td>
</tr>
<tr>
<th>this exact phrase:</th>
<td><%= text_field_tag :exact_phrase, params[:exact_phrase], :size => 50 %></td>
</tr>
<tr>
<th>one or more of these words:</th>
<td>
<%= text_field_tag 'ors[]', (params[:ors] ? params[:ors][0] : ''), :size => 15 %>
<%= text_field_tag 'ors[]', (params[:ors] ? params[:ors][1] : ''), :size => 15 %>
<%= text_field_tag 'ors[]', (params[:ors] ? params[:ors][2] : ''), :size => 15 %>
</td>
</tr>
</table>
2 changes: 2 additions & 0 deletions app/views/advanced_search/notes.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>AdvancedSearch#notes</h1>
<p>Find me in app/views/advanced_search/notes.html.erb</p>
8 changes: 0 additions & 8 deletions test/functional/admin/model_abstract_controller_test.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'test_helper'

class Admin::SavedSearchControllerTest < ActionController::TestCase
class AdvancedSearchControllerTest < ActionController::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
Expand Down
4 changes: 4 additions & 0 deletions test/unit/helpers/advanced_search_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'test_helper'

class AdvancedSearchHelperTest < ActionView::TestCase
end

0 comments on commit ae94396

Please sign in to comment.