aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/blog_comment.rb7
-rw-r--r--app/models/blog_post.rb2
-rw-r--r--app/views/admin/blog/posts/_form.html.erb52
-rw-r--r--app/views/admin/blog/posts/_form.js.erb19
-rw-r--r--app/views/admin/blog/posts/_form_part.html.erb3
-rw-r--r--app/views/blog/posts/_comment.html.erb5
-rw-r--r--app/views/blog/posts/_post.html.erb4
-rw-r--r--app/views/blog/posts/tagged.html.erb2
-rw-r--r--app/views/blog/shared/_post.html.erb4
-rw-r--r--app/views/blog/shared/_tags.html.erb2
10 files changed, 59 insertions, 41 deletions
diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb
index 13aceb1..6216cc2 100644
--- a/app/models/blog_comment.rb
+++ b/app/models/blog_comment.rb
@@ -19,6 +19,13 @@ class BlogComment < ActiveRecord::Base
scope :approved, :conditions => {:state => 'approved'}
scope :rejected, :conditions => {:state => 'rejected'}
+ def avatar_url(options = {})
+ options = {:size => 60}
+ require 'digest/md5'
+ size = ("?s=#{options[:size]}" if options[:size])
+ "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg"
+ end
+
def approve!
self.update_attribute(:state, 'approved')
end
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index d287c6f..c1b8973 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -26,6 +26,8 @@ class BlogPost < ActiveRecord::Base
:approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'),
:strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog')
+ attr_accessible :title, :body, :tag_list, :draft, :published_at, :browser_title, :meta_keywords, :meta_description, :user_id
+
scope :by_archive, lambda { |archive_date|
where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month])
}
diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb
index 9d0e0bd..7d95052 100644
--- a/app/views/admin/blog/posts/_form.html.erb
+++ b/app/views/admin/blog/posts/_form.html.erb
@@ -11,8 +11,33 @@
</div>
<div class='field'>
- <%= f.label :body -%>
- <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%>
+ <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
+ <ul id='page_parts'>
+ <li class='ui-state-default'>
+ <%= link_to "Body", "#page_part_body" %>
+ </li>
+ <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
+ <li class='ui-state-default' id="custom_<%= tab.name %>_tab">
+ <%= link_to tab.name.titleize, "#custom_tab_#{tab_index}" %>
+ </li>
+ <% end %>
+ </ul>
+
+ <div id='page_part_editors'>
+
+ <% part_index = -1 %>
+ <%= render :partial => 'form_part',
+ :locals => {
+ :f => f,
+ :part_index => (part_index += 1),
+ } -%>
+ <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
+ <div class='page_part' id='<%= "custom_tab_#{tab_index}" %>'>
+ <%= render :partial => tab.partial, :locals => {:f => f} %>
+ </div>
+ <% end %>
+ </div>
+ </div>
</div>
<div class='field'>
@@ -50,28 +75,7 @@
<%= f.datetime_select :published_at %>
</div>
<div class='hemisquare right_side'>
- <h2><%= t('.seo') %></h2>
- <div class='field'>
- <span class='label_with_help'>
- <%= f.label :browser_title, t('.seo_override_title') %>
- <%= refinery_help_tag t('.seo_override_title_help')%>
- </span>
- <%= f.text_field :browser_title, :class => 'widest' %>
- </div>
- <div class='field'>
- <span class='label_with_help'>
- <%= f.label :meta_keywords, t('.meta_keywords_title') %>
- <%= refinery_help_tag t('.meta_keywords_help') %>
- </span>
- <%= f.text_field :meta_keywords, :class => 'widest' %>
- </div>
- <div class='field'>
- <span class='label_with_help'>
- <%= f.label :meta_description, t('.meta_description_title') %>
- <%= refinery_help_tag t('.meta_description_help') %>
- </span>
- <%= f.text_area :meta_description, :class => 'widest', :rows => 7 %>
- </div>
+ <%= render :partial => '/seo_meta/form', :locals => {:form => f} %>
</div>
</div>
<%= render :partial => "/shared/admin/form_actions",
diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb
index 1d65448..1c030b4 100644
--- a/app/views/admin/blog/posts/_form.js.erb
+++ b/app/views/admin/blog/posts/_form.js.erb
@@ -1,13 +1,16 @@
<script>
- $(document).ready(function(){
- $('#toggle_advanced_options').click(function(e){
- e.preventDefault();
+ (function($) {
+ $(document).ready(function(){
+ $('#toggle_advanced_options').click(function(e){
+ e.preventDefault();
- $('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250);
+ $('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250);
- $('html,body').animate({
- scrollTop: $('#toggle_advanced_options').parent().offset().top
- }, 250);
+ $('html,body').animate({
+ scrollTop: $('#toggle_advanced_options').parent().offset().top
+ }, 250);
+ });
});
- });
+ $('#page-tabs').tabs();
+ })(jQuery);
</script>
diff --git a/app/views/admin/blog/posts/_form_part.html.erb b/app/views/admin/blog/posts/_form_part.html.erb
new file mode 100644
index 0000000..114e493
--- /dev/null
+++ b/app/views/admin/blog/posts/_form_part.html.erb
@@ -0,0 +1,3 @@
+<div class='page_part' id='page_part_body'>
+ <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%>
+</div>
diff --git a/app/views/blog/posts/_comment.html.erb b/app/views/blog/posts/_comment.html.erb
index 71eab30..17b2002 100644
--- a/app/views/blog/posts/_comment.html.erb
+++ b/app/views/blog/posts/_comment.html.erb
@@ -1,7 +1,6 @@
<article class='blog_comment_message' id='<%= "comment-#{comment.to_param}" %>'>
- <p>
- <%= simple_format auto_link(comment.message.to_s) %>
- </p>
+ <%= image_tag comment.avatar_url, :alt => comment.name, :class => 'avatar' %>
+ <%= simple_format auto_link(comment.message.to_s) %>
<footer class='blog_comment_author'>
<p>
<%= t('blog.posts.comments.by', :who => comment.name) %>,
diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb
index f589a33..e5aabdb 100644
--- a/app/views/blog/posts/_post.html.erb
+++ b/app/views/blog/posts/_post.html.erb
@@ -8,8 +8,8 @@
<h1><%= @blog_post.title %></h1>
<details>
<time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'>
- <%= t('blog.shared.posts.created_at', :when => l(@blog_post.published_at.to_date, :format => :short)) %>.
- </time><%= " by #{@blog_post.author.username}" if @blog_post.author.present? %>
+ <%= t('blog.shared.posts.created_at', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
+ </time><%= "#{t('blog.posts.show.by')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
<% if (categories = @blog_post.categories).any? %>
<aside class='filed_in'>
<%= t('blog.posts.show.filed_in') %>
diff --git a/app/views/blog/posts/tagged.html.erb b/app/views/blog/posts/tagged.html.erb
index 29de791..904150f 100644
--- a/app/views/blog/posts/tagged.html.erb
+++ b/app/views/blog/posts/tagged.html.erb
@@ -1,4 +1,4 @@
-<% content_for :body_content_title, "Posts tagged &#8220;#{@tag_name.titleize}&#8221;".html_safe -%>
+<% content_for :body_content_title, "#{t('.posts_tagged')} &#8220;#{@tag_name.titleize}&#8221;".html_safe -%>
<% content_for :body_content_left do %>
<% if @blog_posts.any? %>
diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb
index 716c1ad..05c6af2 100644
--- a/app/views/blog/shared/_post.html.erb
+++ b/app/views/blog/shared/_post.html.erb
@@ -4,8 +4,8 @@
<h1><%= link_to post.title, blog_post_url(post) %></h1>
<details>
<time datetime="<%=l post.published_at.to_date, :format => :default %>" class='posted_at'>
- <%= t('blog.shared.posts.created_at', :when => l(post.published_at.to_date, :format => :short)) %>.
- </time><%= " by #{post.author.username}" if post.author.present? %>
+ <%= t('blog.shared.posts.created_at', :when => l(post.published_at.to_date, :format => :short)) %>
+ </time><%= "#{t('blog.shared.posts.by')} #{post.author.username}" if post.author.present? %>.
<% if (categories = post.categories).any? %>
<aside class='filed_in'>
<%= t('filed_in', :scope => 'blog.posts.show') %>
diff --git a/app/views/blog/shared/_tags.html.erb b/app/views/blog/shared/_tags.html.erb
index f8833f1..140e60e 100644
--- a/app/views/blog/shared/_tags.html.erb
+++ b/app/views/blog/shared/_tags.html.erb
@@ -1,4 +1,4 @@
-<% unless @tags.nil? %>
+<% if @tags.any? %>
<h2><%= t('.title') %></h2>
<nav id='tags'>
<% tag_cloud(@tags, %w(tag1 tag2 tag3 tag4)) do |tag, css_class| %>