beef-articles 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
@@ -9,42 +9,42 @@ module ArticlesHelper
9
9
 
10
10
  def comments_link(article)
11
11
  if(article.comments.count!=0)
12
- "|  #{link_to('Comment'.pluralize, article_permalink(article, :anchor => 'comments'))} (#{article.comments.count.to_s})"
12
+ "|  #{link_to('Comment'.pluralize, [article, {:anchor => 'comments'}])} (#{article.comments.count.to_s})"
13
13
  else
14
- "#{(article.commentable?)? '|' : ''}  #{link_to 'Comment', article_permalink(article, :anchor => 'comments') if article.commentable?}"
14
+ "#{(article.commentable?)? '|' : ''}  #{link_to 'Comment', [article, {:anchor => 'comments'}] if article.commentable?}"
15
15
  end
16
16
  end
17
17
 
18
- def digg_link(article, html_options = {})
19
- link_to 'Digg', "http://digg.com/submit?phase=2&url=#{article_permalink(article, :only_path => false)}", html_options.reverse_merge(:class => 'share-link', :id => 'digg-submit', :title => 'Digg this!')
18
+ def digg_link(options, html_options = {})
19
+ link_to 'Digg', "http://digg.com/submit?phase=2&url=#{url_for(options)}", html_options.reverse_merge(:class => 'share-link', :id => 'digg-submit', :title => 'Digg this!')
20
20
  end
21
21
 
22
- def delicious_link(article, html_options = {})
23
- link_to 'delicious', "http://del.icio.us/post?url=#{article_permalink(article, :only_path => false)}", html_options.reverse_merge(:class => 'share-link', :id => 'delicious-submit', :title => 'Save to delicious')
22
+ def delicious_link(options, html_options = {})
23
+ link_to 'delicious', "http://del.icio.us/post?url=#{url_for(options)}", html_options.reverse_merge(:class => 'share-link', :id => 'delicious-submit', :title => 'Save to delicious')
24
24
  end
25
25
 
26
- def facebook_link(article, html_options = {})
27
- link_to 'Facebook', "http://www.facebook.com/sharer.php?u=#{article_permalink(article, :only_path => false)}", html_options.reverse_merge(:class => 'share-link', :id => 'facebook-submit', :title => 'Share on Facebook')
26
+ def facebook_link(options, html_options = {})
27
+ link_to 'Facebook', "http://www.facebook.com/sharer.php?u=#{url_for(options)}", html_options.reverse_merge(:class => 'share-link', :id => 'facebook-submit', :title => 'Share on Facebook')
28
28
  end
29
29
 
30
- def stumble_link(article, html_options = {})
31
- link_to 'Stumble Upon', "http://www.stumbleupon.com/submit?url=#{article_permalink(article, :only_path => false)}", html_options.reverse_merge(:class => 'share-link', :id => 'stumble-submit', :title => 'Stumble on this')
30
+ def stumble_link(options, html_options = {})
31
+ link_to 'Stumble Upon', "http://www.stumbleupon.com/submit?url=#{url_for(options)}", html_options.reverse_merge(:class => 'share-link', :id => 'stumble-submit', :title => 'Stumble on this')
32
32
  end
33
33
 
34
- def mail_link(article, html_options = {})
35
- mail_to nil, "Email", html_options.reverse_merge( :subject => article.title, :body => article_permalink(article, :only_path => false), :class => 'share-link', :id => 'mail-link', :title => 'Email this to a friend')
34
+ def mail_link(options, html_options = {})
35
+ mail_to nil, "Email", html_options.reverse_merge( :body => url_for(options), :class => 'share-link', :id => 'mail-link', :title => 'Email this to a friend')
36
36
  end
37
37
 
38
- def twitter_link(article, html_options = {})
39
- link_to 'Twitter', "http://twitter.com/home?status=#{article_permalink(article, :only_path => false)}", html_options.reverse_merge(:class => 'share-link', :id => 'twitter-submit', :title => 'Tweet this')
38
+ def twitter_link(options, html_options = {})
39
+ link_to 'Twitter', "http://twitter.com/home?status=#{url_for(options)}}", html_options.reverse_merge(:class => 'share-link', :id => 'twitter-submit', :title => 'Tweet this')
40
40
  end
41
41
 
42
- def reddit_link(article, html_options = {})
43
- link_to 'Reddit', "http://www.reddit.com/submit?url=#{article_permalink(article, :only_path => false)}", html_options.reverse_merge(:class => 'share-link', :id => 'reddit-submit', :title => 'Reddit this!')
42
+ def reddit_link(options, html_options = {})
43
+ link_to 'Reddit', "http://www.reddit.com/submit?url=#{url_for(options)}", html_options.reverse_merge(:class => 'share-link', :id => 'reddit-submit', :title => 'Reddit this!')
44
44
  end
45
45
 
46
- def technorati_link(article, html_options = {})
47
- link_to 'Technorati', "http://technorati.com/faves/?add=#{article_permalink(article, :only_path => false)}", html_options.reverse_merge(:class => 'share-link', :id => 'technorati-submit', :title => 'Technorati this!')
46
+ def technorati_link(options, html_options = {})
47
+ link_to 'Technorati', "http://technorati.com/faves/?add=#{url_for(options)}", html_options.reverse_merge(:class => 'share-link', :id => 'technorati-submit', :title => 'Technorati this!')
48
48
  end
49
49
 
50
50
  def archive(options = {} )
@@ -93,7 +93,7 @@ module ArticlesHelper
93
93
 
94
94
  def articles_list(articles)
95
95
  return if articles.empty?
96
- articles.collect! { |article| content_tag( 'li', "#{link_to(article.title, article_permalink(article))}") }
96
+ articles.collect! { |article| content_tag( 'li', "#{link_to(article.title, article)}") }
97
97
  content_tag( 'ul', articles.join, :class => 'article-list' )
98
98
  end
99
99
 
@@ -21,13 +21,13 @@
21
21
  <tbody>
22
22
  <% @articles.each do |article| %>
23
23
  <tr id="article-<%= article.id %>">
24
- <td><%=h article.title %></td>
24
+ <td><%= link_to h( article.title ), admin_article_path(article) %></td>
25
25
  <td><%= content_status(article) %></td>
26
26
  <td><%= article.author %></td>
27
27
  <td><%= article.updated_at.strftime('%d %b') %></td>
28
28
  <td><%= article.published_at.strftime('%d %b') unless article.published_at.nil? %></td>
29
29
  <td><%= article.published_to.strftime('%d %b') unless article.published_to.nil? %></td>
30
- <td><%= link_to 'Show', article_permalink(article), :class => 'show' if article.published? %></td>
30
+ <td><%= link_to 'Show', article_url(article), :class => 'show' if article.published? %></td>
31
31
  <td><%= link_to 'Edit', admin_article_path(article), :class => 'edit' %></td>
32
32
  <td><%= link_to 'Destroy', admin_article_path(article), :confirm => 'Are you sure?', :method => :delete, :class => 'delete' %></td>
33
33
  </tr>
@@ -1,7 +1,7 @@
1
1
  <!-- so:post -->
2
2
  <dt>
3
- <%= link_to h(article.title), article_permalink(article) %>
4
- <%= link_to(image_tag(article.assets.images.first.public_filename(:medium)), article_permalink(article)) unless article.assets.images.first.nil? %>
3
+ <%= link_to h(article.title), article %>
4
+ <%= link_to(image_tag(article.assets.images.first.public_filename(:medium)), article) unless article.assets.images.first.nil? %>
5
5
  </dt>
6
6
  <dd>
7
7
  <p class="post-meta">
@@ -10,8 +10,8 @@ xml.rss(:version=>"2.0") do
10
10
  xml.category(article.tag_list)
11
11
  xml.description(article.description)
12
12
  xml.pubDate(article.published_at.rfc822)
13
- xml.link(article_permalink(article, :only_path => false))
14
- xml.guid(article_permalink(article, :only_path => false))
13
+ xml.link(article_url(article))
14
+ xml.guid(article_url(article))
15
15
  end
16
16
  end
17
17
  end
@@ -1,4 +1,4 @@
1
1
  <li id="comment-<%= comment.id %>">
2
2
  <%= sanitize comment.comment, :tags => Settings.allowed_html_tags_for_UGC.to_s.split(' '), :attributes => Settings.allowed_html_attributes_for_UGC.to_s.split(' ') %>
3
- <a href="<%= article_permalink(commentable, :anchor => "comment-#{comment.id}") %>" title="Permalink to this comment"><%= comment.created_at.to_formatted_s(:short_dot)%></a> | posted by <%= link_to_unless comment.website.blank?, comment.name, "http://#{comment.website}" %>
3
+ <%= link_to comment.created_at.to_formatted_s(:short_dot), article_url(commentable, :anchor => "comment-#{comment.id}"), :title => "Permalink to this comment" %> | posted by <%= link_to_unless comment.website.blank?, comment.name, "http://#{comment.website}" %>
4
4
  </li>
data/articles.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{articles}
5
- s.version = "0.2.2"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Steve England"]
9
- s.date = %q{2009-07-14}
9
+ s.date = %q{2009-07-22}
10
10
  s.email = %q{steve@wearebeef.co.uk}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
data/config/routes.rb CHANGED
@@ -17,7 +17,7 @@ ActionController::Routing::Routes.draw do |map|
17
17
  :controller => 'articles', :action => 'show',
18
18
  :year => /\d{4}/, :day => /\d{1,2}/, :month => /\d{1,2}/,
19
19
  :path_prefix => nil
20
- map.resources :articles, :only => [:index], :collection => { :preview => :get }, :has_many => [:comments, { :only => :create } ]
20
+ map.resources :articles, :only => [:index], :collection => { :preview => :get }, :has_many => :comments
21
21
 
22
22
  map.namespace(:admin) do |admin|
23
23
  admin.resources :categories
data/lib/articles.rb CHANGED
@@ -1,7 +1,11 @@
1
1
  module Beef
2
2
  module Articles
3
- def article_permalink(article, options = {})
3
+ def article_path(article, options = {})
4
4
  article_permalink_path(article.published_at.year,article.published_at.month,article.published_at.day,article.permalink,options)
5
5
  end
6
+
7
+ def article_url(article, options = {})
8
+ article_path(article, options.merge(:only_path => false))
9
+ end
6
10
  end
7
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beef-articles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve England
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-14 00:00:00 -07:00
12
+ date: 2009-07-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency