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 +1 -1
- data/app/helpers/articles_helper.rb +19 -19
- data/app/views/admin/articles/index.html.erb +2 -2
- data/app/views/articles/_article.html.erb +2 -2
- data/app/views/articles/index.rss.builder +2 -2
- data/app/views/comments/_comment.html.erb +1 -1
- data/articles.gemspec +2 -2
- data/config/routes.rb +1 -1
- data/lib/articles.rb +5 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
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,
|
12
|
+
"| #{link_to('Comment'.pluralize, [article, {:anchor => 'comments'}])} (#{article.comments.count.to_s})"
|
13
13
|
else
|
14
|
-
"#{(article.commentable?)? '|' : ''} #{link_to 'Comment',
|
14
|
+
"#{(article.commentable?)? '|' : ''} #{link_to 'Comment', [article, {:anchor => 'comments'}] if article.commentable?}"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def digg_link(
|
19
|
-
link_to 'Digg', "http://digg.com/submit?phase=2&url=#{
|
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(
|
23
|
-
link_to 'delicious', "http://del.icio.us/post?url=#{
|
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(
|
27
|
-
link_to 'Facebook', "http://www.facebook.com/sharer.php?u=#{
|
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(
|
31
|
-
link_to 'Stumble Upon', "http://www.stumbleupon.com/submit?url=#{
|
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(
|
35
|
-
mail_to nil, "Email", html_options.reverse_merge( :
|
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(
|
39
|
-
link_to 'Twitter', "http://twitter.com/home?status=#{
|
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(
|
43
|
-
link_to 'Reddit', "http://www.reddit.com/submit?url=#{
|
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(
|
47
|
-
link_to 'Technorati', "http://technorati.com/faves/?add=#{
|
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,
|
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',
|
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),
|
4
|
-
<%= link_to(image_tag(article.assets.images.first.public_filename(:medium)),
|
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(
|
14
|
-
xml.guid(
|
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
|
-
|
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.
|
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-
|
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 =>
|
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
|
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.
|
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-
|
12
|
+
date: 2009-07-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|