rostra 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,8 +12,11 @@ module Rostra
12
12
  end
13
13
 
14
14
  def index
15
- @questions = Question.order('created_at desc')
16
- @user = rostra_user
15
+ if params[:tag_search]
16
+ @questions = Question.tagged_with(params[:tag_search]).order('created_at desc')
17
+ else
18
+ @questions = Question.order('created_at desc')
19
+ end
17
20
  end
18
21
 
19
22
  def show
@@ -1,10 +1,10 @@
1
1
  module Rostra
2
2
  module ApplicationHelper
3
3
 
4
- # Creates a list of tags linking to...TODO: Where should these link?
4
+ # Creates a list of tags linking to the index showing only questions with that tag
5
5
  #
6
6
  def tag_list(question)
7
- content_tag :div, "Tags: #{question.tags.map { |tag| link_to tag, ''}.join}".html_safe, class: 'tags'
7
+ content_tag :div, "Tags: #{question.tags.map { |tag| link_to tag, questions_path(:tag_search => "#{tag}")}.join}".html_safe, class: 'tags'
8
8
  end
9
9
 
10
10
  # Finds the url to the user's avatar following this logic:
@@ -15,6 +15,7 @@ module Rostra
15
15
  # Finds questions asked within the last 15 days ordered by non-unique page views.
16
16
  #
17
17
  def self.trending(limit = 5)
18
+ return [] if Question.count.zero?
18
19
  Question
19
20
  .where(created_at: (15.days.ago)..(Time.now))
20
21
  .limit(limit)
@@ -1,4 +1,9 @@
1
- <h1>Recent Questions</h1>
1
+ <h1>
2
+ Recent Questions
3
+ <% if params[:tag_search] %>
4
+ for tag "<%= params[:tag_search] %>"
5
+ <% end %>
6
+ </h1>
2
7
 
3
8
  <%= render 'rostra/shared/sidebar' %>
4
9
 
@@ -1,3 +1,3 @@
1
1
  module Rostra
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rostra
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Cory Schires