wheels 0.0.39 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.39
1
+ 0.0.40
@@ -12,12 +12,16 @@ class BlogsController < InheritedResources::Base
12
12
  end
13
13
  end
14
14
 
15
+ def parent
16
+ @user ||= User.find(params[:user_id])
17
+ end
18
+
15
19
  def tags
16
- @tags ||= Blog.where(:user_id=>@user.id).tag_counts.sort{|t, u| t.count <=> u.count}
20
+ @tags ||= Blog.where(:user_id=>parent.id).tag_counts.sort{|t, u| t.count <=> u.count}
17
21
  end
18
22
 
19
23
  def collection
20
- @blogs ||= Blog.where(:user_id=>@user.id).
24
+ @blogs ||= Blog.where(:user_id=>parent.id).
21
25
  paginate(:page => params[:page], :order => 'created_at DESC' )
22
26
  end
23
27
 
data/app/models/blog.rb CHANGED
@@ -2,6 +2,8 @@ class Blog < ActiveRecord::Base
2
2
  acts_as_taggable
3
3
  belongs_to :user
4
4
  validates_presence_of :user_id, :title
5
+ acts_as_linkable :parent=>:user, :name=>:title
6
+
5
7
  has_many :images
6
8
  cattr_reader :per_page
7
9
  @@per_page = 5
@@ -1,9 +1,25 @@
1
- %h1= @blog.title
2
- .tag_list!= tag_list @blog
3
- %p
4
- %b Body:
5
- != raw @blog.body
6
- = link_to 'Edit', edit_resource_url
7
- \|
1
+
2
+ .entry
3
+ .entry-title= link_to resource.title, resource_url(resource)
4
+
5
+ .date Posted on #{resource.created_at}
6
+ .blog_body!= resource.body
7
+ .tags!= tag_list resource
8
+
9
+ .comments
10
+ %a{:href => "#"} 3 comments
11
+
12
+
13
+
14
+ = will_paginate collection
15
+
16
+ - content_for(:tags) do
17
+ - for tag in tags
18
+ %li= link_to tag.name, user_blogs_path(parent, :tag=>tag.name)
19
+
20
+
8
21
  = link_to 'Back', collection_url
22
+ = link_to '| Edit', edit_resource_url if can? :edit, resource
23
+ - if current_user.try(:id) == parent.id
24
+ = link_to '| New Blog Post', new_user_blog_path(parent)
9
25
 
data/wheels.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wheels}
8
- s.version = "0.0.39"
8
+ s.version = "0.0.40"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyler Gannon"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wheels
3
3
  version: !ruby/object:Gem::Version
4
- hash: 81
4
+ hash: 79
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 39
10
- version: 0.0.39
9
+ - 40
10
+ version: 0.0.40
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon