Skip to content

Commit

Permalink
further refinement of tag query for #97
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren committed Mar 3, 2015
1 parent 712cd4c commit 5b9c480
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions app/controllers/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ def create
def show
@tag = Tag.find_by_name(params[:id], :order => "id DESC")
if @tag
@spectrums = @tag.spectra
@count = @spectrums.length
@spectrums = @spectrums.paginate :page => params[:page], :per_page => 24
@spectrums = @tag.spectra.paginate(:page => params[:page], :per_page => 24)
end
@spectrums = [] if @spectrums.nil?
@comments = Comment.all :limit => 12, :order => "id DESC"
Expand Down
2 changes: 1 addition & 1 deletion app/views/tag/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<a rel="tooltip" class="btn btn-small" href="http://publiclab.org/wiki/spectral-workbench-exporting" title="About export formats"><i class="icon icon-question-sign"></i></a>
</div>

<h2 style="margin-left:10px;">Spectra tagged with "<%=h params[:id] %>"<% if @tag %> (<%= @count %>)<% end %></h2>
<h2 style="margin-left:10px;">Spectra tagged with "<%=h params[:id] %>"</h2>

<% if @tag %>
<%= render :partial => 'spectrums/list' %>
Expand Down
8 changes: 5 additions & 3 deletions test/functional/tag_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'test_helper'

class TagControllerTest < ActionController::TestCase
# Replace this with your real tests.
test "the truth" do
assert true

test "should show tag" do
get :show, :id => 'cfl'
assert_response :success
end

end

0 comments on commit 5b9c480

Please sign in to comment.