aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2012-01-28 20:02:13 -0800
committerPhilip Arndt <parndt@gmail.com>2012-01-28 20:02:13 -0800
commitd8bdcb482ce51205bfdde0b39a02f7eba49e23e9 (patch)
tree2c896df9bd0a66aa288bfdf8f30fe767516ec0bc /app
parentd1ad82d42eceb53b203716e1c37f4fbb326a2ee8 (diff)
parente274bb1757aa3c27645c181bae6164131a7a35dd (diff)
downloadrefinerycms-blog-d8bdcb482ce51205bfdde0b39a02f7eba49e23e9.tar.gz
refinerycms-blog-d8bdcb482ce51205bfdde0b39a02f7eba49e23e9.tar.bz2
refinerycms-blog-d8bdcb482ce51205bfdde0b39a02f7eba49e23e9.zip
Merge pull request #186 from dmoose/add-src-url-3-1
Add src url 3 1
Diffstat (limited to 'app')
-rw-r--r--app/models/refinery/blog/post.rb7
-rw-r--r--app/views/refinery/blog/admin/posts/_form.html.erb16
-rw-r--r--app/views/refinery/blog/posts/_post.html.erb8
3 files changed, 30 insertions, 1 deletions
diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb
index 883f4fc..1eae99a 100644
--- a/app/models/refinery/blog/post.rb
+++ b/app/models/refinery/blog/post.rb
@@ -22,6 +22,12 @@ module Refinery
validates :title, :presence => true, :uniqueness => true
validates :body, :presence => true
+
+ validates :source_url, :url => { :if => 'Refinery::Blog.config.validate_source_url',
+ :update => true,
+ :allow_nil => true,
+ :allow_blank => true,
+ :verify => [:resolve_redirects]}
has_friendly_id :friendly_id_source, :use_slug => true,
:default_locale => (::Refinery::I18n.default_frontend_locale rescue :en),
@@ -48,6 +54,7 @@ module Refinery
attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url
attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids
+ attr_accessible :source_url, :source_url_title
self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10)
diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb
index a33baeb..68b1d31 100644
--- a/app/views/refinery/blog/admin/posts/_form.html.erb
+++ b/app/views/refinery/blog/admin/posts/_form.html.erb
@@ -83,6 +83,22 @@
<div class='field'>
<span class='label_with_help'>
+ <%= f.label :source_url_title, t('.source_url_title') %>
+ <%= refinery_help_tag t('.source_url_title_help') %>
+ </span>
+ <%= f.text_field :source_url_title, :class => "widest" %>
+ </div>
+
+ <div class='field'>
+ <span class='label_with_help'>
+ <%= f.label :source_url, t('.source_url') %>
+ <%= refinery_help_tag t('.source_url_help') %>
+ </span>
+ <%= f.text_field :source_url, :class => "widest" %>
+ </div>
+
+ <div class='field'>
+ <span class='label_with_help'>
<%= f.label :user_id, t('.author') %>
<%= refinery_help_tag t('.author_help') %>
<br/>
diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb
index 020ba41..77e43ff 100644
--- a/app/views/refinery/blog/posts/_post.html.erb
+++ b/app/views/refinery/blog/posts/_post.html.erb
@@ -10,7 +10,13 @@
<time datetime="<%=l @post.published_at.to_date, :format => :default %>" class='posted_at'>
<%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(@post.published_at.to_date, :format => :short)) %>
</time>
- <%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{@post.author.username}" if @post.author.present? %>.
+ <%= content_tag(:div, "#{t('by', :scope => 'refinery.blog.posts.show')} #{@post.author.username}", :class => "blog_author") if @post.author.present? %>
+ <% if @post.source_url.present? %>
+ <div class='blog_source'>
+ <%= "#{t('source', :scope => 'refinery.blog.posts.show')}: " %>
+ <%= link_to (@post.source_url_title.blank? ? @post.source_url : @post.source_url_title), @post.source_url %>
+ </div>
+ <% end %>
<% if (categories = @post.categories).any? %>
<aside class='filed_in'>
<%= t('filed_in', :scope => 'refinery.blog.posts.show') %>