Permalink
Browse files

solr fix

  • Loading branch information...
1 parent 4dfad74 commit ef151850da0c26664ca2bf575040bbb2451d75e3 Brian Armstrong committed Nov 23, 2011
View
@@ -4,16 +4,16 @@ gem 'rails', '3.1.1'
gem 'mongoid', '2.3.3'
gem 'bson', '1.4.0'
gem 'bson_ext', '1.4.0'
-gem 'jquery-rails', '1.0.16'
+gem 'jquery-rails', '1.0.17'
gem 'twitter-bootstrap-rails', '1.4.0'
gem 'database_cleaner', '0.6.7'
gem 'bcrypt-ruby', '3.0.1'
gem 'kaminari', '0.12.4'
gem 'gravtastic', '3.2.6'
gem 'mongoid_nested_set', '0.1.3'
gem 'cancan', '1.6.7'
-gem 'sunspot_mongoid', '0.4.1', :git => "git://github.com/TV4/sunspot_mongoid.git"
-gem 'sunspot_rails', :git => "git://github.com/sunspot/sunspot.git"
+gem 'sunspot_mongoid', '0.4.1'
+gem 'sunspot_rails', '1.2.1'
gem 'sunspot_with_kaminari', '0.1.0'
gem 'voteable_mongo', '0.9.3'
gem 'acts_as_list_mongoid', '0.2.4'
@@ -41,4 +41,4 @@ group :test do
gem "launchy", '2.0.5'
gem 'sunspot_test', '0.4.0'
gem 'capybara-webkit', '0.7.2' # requires "brew install qt"
-end
+end
View
@@ -1,24 +1,3 @@
-GIT
- remote: git://github.com/TV4/sunspot_mongoid.git
- revision: c67c8265141988f4443a431c6f4ca65bdc2364f5
- specs:
- sunspot_mongoid (0.4.1)
- mongoid
- sunspot (>= 1.1.0)
- sunspot_rails (>= 1.1.0)
-
-GIT
- remote: git://github.com/sunspot/sunspot.git
- revision: 448371155f4d79acca526acbd697b319a921c5dc
- specs:
- sunspot (1.3.0.rc6)
- escape (~> 0.0.4)
- pr_geohash (~> 1.0)
- rsolr (~> 1.0.3)
- sunspot_rails (1.3.0.rc6)
- nokogiri
- sunspot (= 1.3.0.rc6)
-
GEM
remote: http://rubygems.org/
specs:
@@ -102,7 +81,7 @@ GEM
spork (>= 0.8.4)
hike (1.2.1)
i18n (0.6.0)
- jquery-rails (1.0.16)
+ jquery-rails (1.0.17)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.1)
@@ -174,8 +153,7 @@ GEM
rake (0.9.2.2)
rdoc (3.11)
json (~> 1.4)
- rsolr (1.0.3)
- builder (= 3.0.0)
+ rsolr (0.12.1)
builder (>= 2.1.2)
rspec (2.7.0)
rspec-core (~> 2.7.0)
@@ -207,6 +185,17 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
+ sunspot (1.2.1)
+ escape (= 0.0.4)
+ pr_geohash (~> 1.0)
+ rsolr (= 0.12.1)
+ sunspot_mongoid (0.4.1)
+ mongoid
+ sunspot (>= 1.1.0)
+ sunspot_rails (>= 1.1.0)
+ sunspot_rails (1.2.1)
+ nokogiri
+ sunspot (= 1.2.1)
sunspot_test (0.4.0)
sunspot_rails (>= 1.2.1)
sunspot_with_kaminari (0.1.0)
@@ -252,7 +241,7 @@ DEPENDENCIES
growl (= 1.0.3)
guard-rspec (= 0.5.0)
guard-spork (= 0.3.1)
- jquery-rails (= 1.0.16)
+ jquery-rails (= 1.0.17)
kaminari (= 0.12.4)
launchy (= 2.0.5)
mocha (= 0.10.0)
@@ -262,8 +251,8 @@ DEPENDENCIES
rspec-rails
sass-rails (~> 3.1.4)
spork (> 0.9.0.rc)
- sunspot_mongoid (= 0.4.1)!
- sunspot_rails!
+ sunspot_mongoid (= 0.4.1)
+ sunspot_rails (= 1.2.1)
sunspot_test (= 0.4.0)
sunspot_with_kaminari (= 0.1.0)
twitter-bootstrap-rails (= 1.4.0)
@@ -7,7 +7,8 @@ def new
end
def index
- @forums = current_user.forums.order(:name)
+ @participations = current_user.participations.includes(:forum)
+ @participations.sort {|a,b| a.forum.name <=> b.forum.name }
end
def create
@@ -4,13 +4,18 @@ class ParticipationsController < ApplicationController
load_and_authorize_resource
def ban
- #@participation = Participation.find(params[:id])
@participation.update_attribute :banned, true
end
def unban
- #@participation = Participation.find(params[:id])
@participation.update_attribute :banned, false
render :ban
end
+
+ def hide
+ if @participation.level == Participation::MEMBER
+ @participation.update_attribute :hidden, true
+ end
+ redirect_to forums_path
+ end
end
View
@@ -24,7 +24,7 @@ class Comment
attr_protected :parent_id
def create_participation
- forum.add_member(user) unless user.member_of?(forum)
+ forum.add_member(user)
end
def inc_comment_count
View
@@ -55,7 +55,11 @@ def add_admin user
end
def add_member user
- participations.create!(:user => user, :level => Participation::MEMBER)
+ if p = participations.where(:user_id => user.id).first
+ p.update_attribute :hidden, false if p.hidden?
+ else
+ participations.create!(:user => user, :level => Participation::MEMBER)
+ end
end
def downcase_subdomain
View
@@ -41,7 +41,7 @@ class Post
end
def create_participation
- forum.add_member(user) unless user.member_of?(forum)
+ forum.add_member(user)
end
def user_is_not_banned
@@ -3,6 +3,20 @@
</div>
<h1>My Forums</h1>
-<% @forums.each do |f| %>
- <h2><%= link_to f.name, root_url(:subdomain => f.subdomain) %></h2>
-<% end %>
+
+<table>
+ <tbody>
+ <% @participations.each do |p| %>
+ <% f = p.forum %>
+ <tr>
+ <td><h2><%= link_to f.name, account_comments_url(:subdomain => f.subdomain) %></h2></td>
+ <td><%= p.level_in_words %></td>
+ <td>
+ <% if p.level == Participation::MEMBER %>
+ <%= link_to "X", hide_participation_path(p), :method => :put %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
@@ -3,7 +3,7 @@
<table>
<thead>
<tr>
- <th>Num Users</th>
+ <th>Number of Users</th>
<th>Ad-Free</th>
<th>Ad-Supported*</th>
</tr>
View
@@ -29,6 +29,7 @@
member do
put :ban
put :unban
+ put :hide
end
end
View
@@ -1,3 +1,9 @@
+production:
+ solr:
+ hostname: localhost
+ port: 8983
+ log_level: WARNING
+
development:
solr:
hostname: localhost
@@ -8,10 +14,4 @@ test:
solr:
hostname: localhost
port: 8981
- log_level: WARNING
-
-production:
- solr:
- hostname: localhost
- port: 8983
log_level: WARNING
View
@@ -0,0 +1,11 @@
+# #lib/tasks/sunspot.rake
+# namespace :sunspot do
+# namespace :solr do
+# desc "indexes searchable models"
+# task :index => :environment do
+# #[list your models here].each {|model| Sunspot.index!(model.all)}
+# [Post].each {|model| Sunspot.index(model.all)}
+# Sunspot.commit
+# end
+# end
+# end
No changes.
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "themes/index.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end
View
@@ -1 +0,0 @@
-92131

0 comments on commit ef15185

Please sign in to comment.