muck-raker 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -42,6 +42,7 @@ begin
42
42
  gemspec.add_dependency "muck-users"
43
43
  gemspec.add_dependency "muck-solr"
44
44
  gemspec.files.include %w( tasks/*
45
+ db/bootstrap/*.yml
45
46
  db/migrate/*.rb
46
47
  app/**/**/**/*
47
48
  config/*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -5,16 +5,16 @@ class Recommender::EntriesController < ApplicationController
5
5
  end
6
6
 
7
7
  def index
8
- @tags = CloudCache.language_tags('en') unless fragment_exist?({:controller => 'entries', :action => 'index'})
8
+ @tag_cloud = TagCloud.language_tags(Language.locale_id) unless fragment_exist?({:controller => 'entries', :action => 'index', :language => Language.locale_id})
9
9
  respond_to do |format|
10
10
  format.html { render :template => 'entries/index' }
11
11
  end
12
12
  end
13
13
 
14
14
  def browse_by_tags
15
- @browse_tags = params[:tags]
16
- @top_tags = Entry.top_tags(@browse_tags)
17
- @search = @browse_tags.join(' ') if (!@browse_tags.nil? && !@browse_tags.empty?)
15
+ @tag_filter = params[:tags]
16
+ @search = @tag_filter.join(' ') if (!@tag_filter.nil? && !@tag_filter.empty?)
17
+ @tag_cloud = TagCloud.language_tags(Language.locale_id, @tag_filter) unless fragment_exist?({:controller => 'entries', :action => 'index', :language => Language.locale_id, :filter => @tag_filter})
18
18
  _search
19
19
  respond_to do |format|
20
20
  format.html { render :template => 'entries/browse_by_tags' }
@@ -34,7 +34,7 @@ class Recommender::EntriesController < ApplicationController
34
34
  @limit = (params[:limit] || 10).to_i
35
35
  @term_list = URI.escape(@search) if !@search.nil?
36
36
  if !@search.nil?
37
- results = Entry.search(@search, 'en', @limit, @offset)
37
+ results = Entry.search(@search, I18n.locale.to_s, @limit, @offset)
38
38
  @results = results.results
39
39
  @hit_count = results.total
40
40
  end
@@ -0,0 +1,8 @@
1
+ class TagCloud < ActiveRecord::Base
2
+
3
+ def self.language_tags language_id = 38, filter = ''
4
+ results = TagCloud.find(:all, :conditions => ["language_id = ? AND filter = ?", language_id, filter])
5
+ results.empty? ? '' : results[0].tag_list
6
+ end
7
+
8
+ end
@@ -0,0 +1,5 @@
1
+ <div>
2
+ <b><%= (link_to(t('muck.raker.previous'), {:action => :browse_by_tags, :tags => URI.unescape(@term_list), :locale => @language, :limit => @limit, :offset => @offset - @limit}, :rel => "nofollow") + "&nbsp;&nbsp;") if @offset > 0 %>
3
+ <%= (link_to(t('muck.raker.next'), {:action => :browse_by_tags, :tags => URI.unescape(@term_list), :locale => @language,:limit => @limit, :offset => @offset + @limit}, :rel => "nofollow") if @results.size >= @limit )%>
4
+ </b>
5
+ </div>
@@ -0,0 +1,14 @@
1
+ <div id="results-description" class="block">
2
+ <div class="column span-5">
3
+ <input type="radio" name="scope" value="all" checked/><%= t('folksemantic.all_resources') %> &nbsp&nbsp;&nbsp;
4
+ <input type="radio" name="scope" value="ocws"/><%= t('folksemantic.just_ocws') %><br/>
5
+ </div>
6
+ <div class="column span-19 align-right">
7
+ <%= t('muck.raker.results') %>
8
+ <b><%= (@offset+1) %> - <%= (@offset + @limit) < @hit_count ? (@offset + @limit) : @hit_count %></b>
9
+ <%= t('muck.raker.of') %>
10
+ <b><%= @hit_count %></b>
11
+ <%= t('muck.raker.for') %>
12
+ <b><%= URI.unescape(@term_list) %></b></p>
13
+ </div>
14
+ </div>
@@ -0,0 +1,3 @@
1
+ <div id="results">
2
+ <%= render(:partial => 'entries/result', :collection => @results) %>
3
+ </div>
@@ -1,4 +1,12 @@
1
1
  <div id="tag-cloud">
2
- <%= render(:partial => "cloud_type_selector") %>
3
- <%= render(:partial => "tags") %>
4
- </div>
2
+ <fieldset>
3
+ <legend><%= t('folksemantic.tag_cloud_legend') %></legend>
4
+ <% if @tag_cloud.blank? -%>
5
+ <%= t('folksemantic.no_tags') %>
6
+ <% else -%>
7
+ <% tag_cloud @tag_cloud, %w(cloud1 cloud2 cloud3 cloud4 cloud5 cloud6) do |tag, css_class| %>
8
+ <%= link_to tag, { :action => :browse_by_tags, :tags => tag }, :class => css_class %>
9
+ <% end %>
10
+ <% end -%>
11
+ </fieldset>
12
+ </div>
@@ -1,33 +1,14 @@
1
- <div id="finder">
2
- <div class="left">
3
-
4
- <fieldset style="margin-top:20px;">
5
- <legend style="font-size:12px; color:#555;">click more tags to narrow results</legend>
6
- <div style="margin-top:3px;margin-left:10px;font-size:12px;">
7
- <input type="radio" name="scope" value="all" checked style="vertical-align:center"/>All
8
- <input type="radio" name="scope" value="ocws" style="vertical-align:center"/>Courses<br/>
9
- </div>
10
- <img src="/images/tag_cloud2.jpg" align="center" width="200px;" />
11
- </fieldset>
12
-
13
- </div>
14
- <div class="left" style="width:480px; margin-left:20px; margin-top:10px;">
15
-
16
- <% if @results.length > 0 %>
17
-
18
- <p><%= t('muck.raker.results') %> <b><%= (@offset+1) %> - <%= (@offset + @limit) < @hit_count ? (@offset + @limit) : @hit_count %></b> <%= t('muck.raker.of') %> <b><%= @hit_count %></b> <%= t('muck.raker.for') %> <b><%= @terms %></b></p>
19
- <div id="results">
20
- <%= render(:partial => 'entries/result', :collection => @results) %>
21
- </div>
22
-
23
- <div>
24
- <b><%= (link_to(t('muck.raker.previous'), {:action => :browse_by_tags, :tags => URI.unescape(@term_list), :locale => @language, :limit => @limit, :offset => @offset - @limit}, :rel => "nofollow") + "&nbsp;&nbsp;") if @offset > 0 %>
25
- <%= (link_to(t('muck.raker.next'), {:action => :browse_by_tags, :tags => URI.unescape(@term_list), :locale => @language,:limit => @limit, :offset => @offset + @limit}, :rel => "nofollow") if @results.size >= @limit )%>
26
- </b>
27
- </div>
28
-
29
- <% else %>
30
- <p><%= t(:no_hits) %></p>
31
- <% end %>
32
-
1
+ <div class="block">
2
+ <% if @results.length > 0 %>
3
+ <%= render(:partial => 'entries/result_status') %>
4
+ <div class="column span-15">
5
+ <%= render(:partial => 'entries/results') %>
6
+ <%= render(:partial => 'entries/result_navigation') %>
7
+ </div>
8
+ <div class="column span-9 last">
9
+ <%= render(:partial => 'entries/tag_cloud') %>
10
+ </div>
11
+ <% else %>
12
+ <p><%= t(:no_hits) %></p>
13
+ <% end %>
33
14
  </div>
@@ -1,8 +1,3 @@
1
- <% cache do %>
2
1
  <div align="center">
3
- <fieldset id="tag-cloud" class="clear">
4
- <legend style="font-size:12px; color:#555;">browse resources using tags</legend>
5
- <%= render :partial => 'entries/tags', :object => @tags %>
6
- </fieldset>
2
+ <%= render :partial => 'entries/tag_cloud' %>
7
3
  </div>
8
- <% end %>
@@ -1,21 +1,11 @@
1
- <div id="finder">
2
-
3
- <% if !@results.nil? && !@results.empty? %>
4
-
5
- <p id="results-description"><%= t('muck.raker.results') %> <b><%= (@offset+1) %> - <%= (@offset + @limit) < @hit_count ? (@offset + @limit) : @hit_count %></b> <%= t('muck.raker.of') %> <b><%= @hit_count %></b> <%= t('muck.raker.for') %> <b><%= URI.unescape(@term_list) %></b></p>
6
-
7
- <div id="results">
8
- <%= render(:partial => 'entries/result', :collection => @results) %>
9
- </div>
10
-
11
- <div>
12
- <b><%= (link_to(t('muck.raker.previous'), {:action => :browse_by_tags, :tags => @term_list, :locale => @language, :limit => @limit, :offset => @offset - @limit}, :rel => "nofollow") + "&nbsp;&nbsp;") if @offset > 0 %>
13
- <%= (link_to(t('muck.raker.next'), {:action => :browse_by_tags, :tags => @term_list, :locale => @language,:limit => @limit, :offset => @offset + @limit}, :rel => "nofollow") if @results.size >= @limit )%>
14
- </b>
15
- </div>
16
-
17
- <% else %>
18
- <p><%= t('muck.raker.no_hits') %></p>
19
- <% end %>
20
-
1
+ <div id="search-results">
2
+ <% if @results.length > 0 %>
3
+ <div class="left">
4
+ <%= render(:partial => 'entries/result_status') %>
5
+ <%= render(:partial => 'entries/results') %>
6
+ <%= render(:partial => 'entries/result_navigation') %>
7
+ </div>
8
+ <% else %>
9
+ <p><%= t(:no_hits) %></p>
10
+ <% end %>
21
11
  </div>