Compare commits
36 commits
master
...
1-x-stable
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0d9394dacd | ||
![]() |
2d4e9085eb | ||
![]() |
0f4d976f34 | ||
![]() |
dda07a7fab | ||
![]() |
e26d53bee4 | ||
![]() |
a0ec115272 | ||
![]() |
31bb972db9 | ||
![]() |
09d919d1b7 | ||
![]() |
6884642093 | ||
![]() |
58b87c9e1a | ||
![]() |
01a10f5266 | ||
![]() |
7ad876b8a5 | ||
![]() |
d3a914261a | ||
![]() |
6a5afeaa19 | ||
![]() |
2bff0b207f | ||
![]() |
5efcadcc80 | ||
![]() |
5c78c38e98 | ||
![]() |
57619d6993 | ||
![]() |
9840c56b40 | ||
![]() |
7d8588dfd2 | ||
![]() |
f3d32c1ac5 | ||
![]() |
8ca270774f | ||
![]() |
2ed293f74a | ||
![]() |
5ab4ef464b | ||
![]() |
92ed22cce2 | ||
![]() |
22f398c724 | ||
![]() |
b1d05554d6 | ||
![]() |
8b4be5638b | ||
![]() |
d9387e32c3 | ||
![]() |
81bf46cd7a | ||
![]() |
62c525e424 | ||
![]() |
eb160aa354 | ||
![]() |
d5fadb4523 | ||
![]() |
c761572593 | ||
![]() |
329d54bdf0 | ||
![]() |
49404806ab |
21 changed files with 135 additions and 65 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -42,3 +42,7 @@ nbproject
|
|||
|
||||
# Capybara Bug
|
||||
capybara-*html
|
||||
|
||||
# Future stuff
|
||||
Gemfile.lock
|
||||
spec/dummy
|
5
.travis.yml
Normal file
5
.travis.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
rvm:
|
||||
- 1.9.2
|
||||
branches:
|
||||
only:
|
||||
- rails-3-1
|
|
@ -1,10 +1,8 @@
|
|||
module BlogPostsHelper
|
||||
def blog_archive_list
|
||||
posts = BlogPost.select('published_at').all_previous
|
||||
posts = BlogPost.live.select('published_at').all_previous
|
||||
return nil if posts.blank?
|
||||
html = '<section id="blog_archive_list"><h2>'
|
||||
html << t('archives', :scope => 'blog.shared')
|
||||
html << '</h2><nav><ul>'
|
||||
html = ''
|
||||
links = []
|
||||
super_old_links = []
|
||||
|
||||
|
@ -20,7 +18,7 @@ module BlogPostsHelper
|
|||
links.each do |l|
|
||||
year = l.split('/')[1]
|
||||
month = l.split('/')[0]
|
||||
count = BlogPost.by_archive(Time.parse(l)).size
|
||||
count = BlogPost.live.by_archive(Time.parse(l)).size
|
||||
text = t("date.month_names")[month.to_i] + " #{year} (#{count})"
|
||||
html << "<li>"
|
||||
html << link_to(text, archive_blog_posts_path(:year => year, :month => month))
|
||||
|
@ -28,13 +26,12 @@ module BlogPostsHelper
|
|||
end
|
||||
super_old_links.each do |l|
|
||||
year = l.split('/')[1]
|
||||
count = BlogPost.by_year(Time.parse(l)).size
|
||||
count = BlogPost.live.by_year(Time.parse(l)).size
|
||||
text = "#{year} (#{count})"
|
||||
html << "<li>"
|
||||
html << link_to(text, archive_blog_posts_path(:year => year))
|
||||
html << "</li>"
|
||||
end
|
||||
html << '</ul></nav></section>'
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
|
|
|
@ -20,10 +20,16 @@ class BlogComment < ActiveRecord::Base
|
|||
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"
|
||||
params = {
|
||||
:s => options[:size] || 60,
|
||||
:d => options[:default_image]
|
||||
}
|
||||
query_string = params.map do |k,v|
|
||||
[k,v].map { |s| CGI::escape(s.to_s) }.join('=')
|
||||
end.join('&')
|
||||
email_md5 = Digest::MD5.hexdigest(self.email.to_s.strip.downcase)
|
||||
"http://gravatar.com/avatar/#{email_md5}?#{query_string}"
|
||||
end
|
||||
|
||||
def approve!
|
||||
|
|
|
@ -9,7 +9,12 @@
|
|||
<%= f.label :title -%>
|
||||
<%= f.text_field :title, :class => 'larger widest' -%>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<p>
|
||||
<%= f.check_box :draft %>
|
||||
<%= f.label :draft, t('.save_as_draft'), :class => "stripped" %>
|
||||
</p>
|
||||
</div>
|
||||
<div class='field'>
|
||||
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
||||
<ul id='page_parts'>
|
||||
|
@ -59,10 +64,7 @@
|
|||
:id => 'toggle_advanced_options',
|
||||
:title => t('.toggle_advanced_options') %>
|
||||
</p>
|
||||
<span id='draft_field'>
|
||||
<%= f.check_box :draft %>
|
||||
<%= f.label :draft, t('.save_as_draft'), :class => "stripped" %>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<div id='more_options' style="display:none;">
|
||||
<div class="hemisquare">
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<%= " by #{post.author.username}" if post.author.present? %>
|
||||
</span>
|
||||
</span>
|
||||
<% if post.draft? %>
|
||||
<span class="label notice">Draft</span>
|
||||
<% end %>
|
||||
<span class='actions'>
|
||||
<%= link_to refinery_icon_tag("application_go.png"), blog_post_url(post),
|
||||
:title => t('.view_live_html'),
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<% flash.each do |key, value| %>
|
||||
<div id='flash' class="flash flash_<%= key %>">
|
||||
<%= value %>
|
||||
</div>
|
||||
<% end %>
|
||||
<article id="blog_post">
|
||||
<header>
|
||||
<h1><%= @blog_post.title %></h1>
|
||||
<section class='details'>
|
||||
<time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'>
|
||||
<%= t('created_at', :scope => 'blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
|
||||
</time>
|
||||
<%= "#{t('by', :scope => 'blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
|
||||
<% if (categories = @blog_post.categories).any? %>
|
||||
<aside class='filed_in'>
|
||||
<%= t('filed_in', :scope => 'blog.posts.show') %>
|
||||
<% categories.each_with_index do |category, index| %>
|
||||
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
|
||||
<% end %>
|
||||
</aside>
|
||||
<% end %>
|
||||
</section>
|
||||
</header>
|
||||
<%= @blog_post.body.html_safe %>
|
||||
|
||||
<% if BlogPost::ShareThis.enabled? %>
|
||||
<span class="st_sharethis" displayText="ShareThis"></span>
|
||||
<% end %>
|
||||
</article>
|
||||
<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%>
|
||||
<%= render 'nav' if next_or_previous?(@blog_post) %>
|
|
@ -13,7 +13,7 @@
|
|||
<%= render :partial => "/blog/shared/categories" %>
|
||||
<%= render :partial => "/blog/shared/tags" %>
|
||||
<%= render :partial => "/blog/shared/rss_feed" %>
|
||||
<%= blog_archive_list %>
|
||||
<%= render :partial => "/blog/shared/archive_list" %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "/shared/content_page" %>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<%= render :partial => "/blog/shared/categories" %>
|
||||
<%= render :partial => "/blog/shared/tags" %>
|
||||
<%= render :partial => "/blog/shared/rss_feed" %>
|
||||
<%= blog_archive_list %>
|
||||
<%= render :partial => "/blog/shared/archive_list" %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "/shared/content_page" %>
|
||||
|
|
|
@ -1,6 +1,37 @@
|
|||
<% content_for :body_content_left do %>
|
||||
<div id="show_blog_post">
|
||||
<%= render 'post' %>
|
||||
<% flash.each do |key, value| %>
|
||||
<div id='flash' class="flash flash_<%= key %>">
|
||||
<%= value %>
|
||||
</div>
|
||||
<% end %>
|
||||
<article id="blog_post">
|
||||
<header>
|
||||
<h1><%= @blog_post.title %></h1>
|
||||
<section class='details'>
|
||||
<time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'>
|
||||
<%= t('created_at', :scope => 'blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
|
||||
</time>
|
||||
<%= "#{t('by', :scope => 'blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
|
||||
<% if (categories = @blog_post.categories).any? %>
|
||||
<aside class='filed_in'>
|
||||
<%= t('filed_in', :scope => 'blog.posts.show') %>
|
||||
<% categories.each_with_index do |category, index| %>
|
||||
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
|
||||
<% end %>
|
||||
</aside>
|
||||
<% end %>
|
||||
</section>
|
||||
</header>
|
||||
<%= @blog_post.body.html_safe %>
|
||||
|
||||
<% if BlogPost::ShareThis.enabled? %>
|
||||
<span class="st_sharethis" displayText="ShareThis"></span>
|
||||
<% end %>
|
||||
</article>
|
||||
<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%>
|
||||
<%= render 'nav' if next_or_previous?(@blog_post) %>
|
||||
|
||||
</div>
|
||||
|
||||
<% if BlogPost.comments_allowed? %>
|
||||
|
@ -50,9 +81,9 @@
|
|||
<% content_for :body_content_right do %>
|
||||
<%= render :partial => "/blog/shared/categories" %>
|
||||
<%= render :partial => "/blog/shared/tags" %>
|
||||
<%= render :partial => "/blog/shared/posts" %>
|
||||
<%= render :partial => "/blog/shared/related_posts" %>
|
||||
<%= render :partial => "/blog/shared/rss_feed" %>
|
||||
<%= blog_archive_list %>
|
||||
<%= render :partial => "/blog/shared/archive_list" %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "/shared/content_page", :locals => { :remove_automatic_sections => true } %>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<%= render :partial => "/blog/shared/categories" %>
|
||||
<%= render :partial => "/blog/shared/tags" %>
|
||||
<%= render :partial => "/blog/shared/rss_feed" %>
|
||||
<%= blog_archive_list %>
|
||||
<%= render :partial => "/blog/shared/archive_list" %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "/shared/content_page" %>
|
||||
|
|
9
app/views/blog/shared/_archive_list.html.erb
Normal file
9
app/views/blog/shared/_archive_list.html.erb
Normal file
|
@ -0,0 +1,9 @@
|
|||
<%
|
||||
archive_posts = blog_archive_list
|
||||
%>
|
||||
<% if archive_posts.present? %>
|
||||
<h2><%= t('archives', :scope => 'blog.shared') %></h2>
|
||||
<ul>
|
||||
<%= archive_posts %>
|
||||
</ul>
|
||||
<% end %>
|
20
changelog.md
20
changelog.md
|
@ -1,16 +1,29 @@
|
|||
## 1.6.3 [UNRELEASED]
|
||||
## 1.8.0 [UNRELEASED]
|
||||
* extraneous shared/_post partial was moved directly into posts/show [nicinabox](https://github.com/nicinabox)
|
||||
* blog archive list helper logic refactored (HTML exists in view template) [nicinabox](https://github.com/nicinabox)
|
||||
* pretty "Draft" label added to admin list of blog posts [nicinabox](https://github.com/nicinabox)
|
||||
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.7.0...1.8.0)
|
||||
|
||||
## 1.7.0 [05 December 2011]
|
||||
* Bulgarian translations [mirosr](https://github.com/mirosr)
|
||||
* posts/tagged... params[:tag_name] is optional [joemsak](https://github.com/joemsak)
|
||||
* Bug Fix on Categorization relationship: destroying a post produced error because no primary key existed on join table [joemsak](https://github.com/joemsak)
|
||||
* Bug fix on archive listing, don't include draft posts [jgrevich](https://github.com/jgrevich)
|
||||
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.6.2...1.7.0)
|
||||
|
||||
## 1.6.2 [29 June 2011]
|
||||
* Custom teaser field to overwrite the automatic truncation of the body [wikyd](https://github.com/wikyd)
|
||||
* Tagging URL strategy updated again [joemsak](https://github.com/joemsak)
|
||||
* Tagging bug fixed [ruprict](https://github.com/ruprict)
|
||||
* Refactored specs [parndt](https://github.com/parndt)
|
||||
* * [See full list](https://github.com/resolve/refinerycms-blog/compare/1.6.1...1.6.2)
|
||||
|
||||
|
||||
## 1.6.1 [21 June 2011]
|
||||
* Tagging URL strategy updated for reliability /blog/posts/tagged/ID-name-parameterized [joemsak](https://github.com/joemsak)
|
||||
* Heroku/PostgreSQL support for autocomplete tags [joemsak](https://github.com/joemsak)
|
||||
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.6...1.6.1)
|
||||
|
||||
|
||||
## 1.6 [20 June 2011]
|
||||
* Category bug fixes and cleanup [wikyd](https://github.com/wikyd)
|
||||
|
@ -20,11 +33,14 @@
|
|||
* More testing [wakeless](https://github.com/wakeless)
|
||||
* Tag list autocomplete baked in [joemsak](https://github.com/joemsak)
|
||||
* Customize the URL of your blog post [wikyd](https://github.com/wikyd)
|
||||
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.5...1.6)
|
||||
|
||||
|
||||
## 1.5 [28 May 2011]
|
||||
|
||||
* Added Gravatar support. [parndt](https://github.com/parndt)
|
||||
* Added support for Refinery CMS 1.0.0 and above. [parndt](https://github.com/parndt)
|
||||
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.4...1.5)
|
||||
|
||||
## 1.4 [26 May 2011]
|
||||
|
||||
|
@ -66,4 +82,4 @@
|
|||
* Rails 3 Support
|
||||
* Archives
|
||||
* Categories
|
||||
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.0...1.1)
|
||||
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.0...1.1)
|
||||
|
|
|
@ -46,6 +46,10 @@ pt-BR:
|
|||
toggle_advanced_options: Clique aqui para acessar as configurações de meta tag e menu
|
||||
save_as_draft: Salvar como rascunho
|
||||
published_at: Data de publicação
|
||||
custom_url: Url customizada
|
||||
custom_url_help: Gere a url para o post do blog a partir dessa ao invés de utilizar o título
|
||||
copy_body: Copiar o Corpo do post para o Teaser
|
||||
copy_body_helper: Copiar o corpo do post para o teaser. Deixe o teaser em branco para deixar o Refinery fazer o teaser automaticamente.
|
||||
index:
|
||||
no_items_yet: 'Ainda não há Posts no Blog. Clique em "%{create}" para adicionar o primeiro post.'
|
||||
uncategorized:
|
||||
|
@ -83,6 +87,7 @@ pt-BR:
|
|||
moderation: Moderação
|
||||
update_notified: Quem receberá a notificação?
|
||||
comments: Comentários
|
||||
teasers: Teasers
|
||||
blog:
|
||||
comment_mailer:
|
||||
notification:
|
||||
|
|
|
@ -101,6 +101,8 @@ ru:
|
|||
singular: комментарий
|
||||
none: нет комментариев
|
||||
archives: Архивы
|
||||
tags:
|
||||
title: "Теги"
|
||||
categories:
|
||||
show:
|
||||
no_posts: Записей пока нет.
|
||||
|
@ -122,7 +124,12 @@ ru:
|
|||
add: Написать комментарий
|
||||
other: Другие записи
|
||||
filed_in: Категория
|
||||
tagged: Теги
|
||||
submit: Отправить комментарий
|
||||
name: Имя
|
||||
email: Email
|
||||
message: Сообщение
|
||||
by: Автор
|
||||
archive:
|
||||
blog_archive_for: 'Архив %{date}'
|
||||
no_blog_articles_posted: 'Ни одной записи за %{date} не опубликовано. Следите за новостями.'
|
||||
|
|
|
@ -30,7 +30,7 @@ class CreateBlogStructure < ActiveRecord::Migration
|
|||
|
||||
add_index :blog_categories, :id
|
||||
|
||||
create_table :blog_categories_blog_posts, :id => true do |t|
|
||||
create_table :blog_categories_blog_posts, :id => false do |t|
|
||||
t.integer :blog_category_id
|
||||
t.integer :blog_post_id
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require File.expand_path('../refinery/blog/version', __FILE__)
|
||||
version = ::Refinery::Blog::Version.to_s
|
||||
raise "Could not get version so gemspec can not be built" if version.nil?
|
||||
files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{.gem$}}
|
||||
files = Dir.glob("**/*").flatten.reject{|f| f =~ %r{.(gem|lock)$}}
|
||||
|
||||
gemspec = <<EOF
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -2,8 +2,8 @@ module Refinery
|
|||
module Blog
|
||||
class Version
|
||||
@major = 1
|
||||
@minor = 6
|
||||
@tiny = 2
|
||||
@minor = 8
|
||||
@tiny = 0
|
||||
|
||||
class << self
|
||||
attr_reader :major, :minor, :tiny
|
||||
|
@ -14,4 +14,4 @@ module Refinery
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
15
readme.md
15
readme.md
|
@ -12,12 +12,23 @@ Options:
|
|||
## Requirements
|
||||
|
||||
Refinery CMS version 1.0.0 or above.
|
||||
Your Rails 3 application should not be called "blog"
|
||||
|
||||
## Install
|
||||
|
||||
Open up your ``Gemfile`` and add at the bottom this line:
|
||||
|
||||
gem 'refinerycms-blog', '~> 1.6.1'
|
||||
# You now have two options:
|
||||
|
||||
## Take the blue pill and stay on 1.7.x
|
||||
|
||||
gem 'refinerycms-blog', '~> 1.7.0'
|
||||
|
||||
## Take the red pill and head up to 1.8.x
|
||||
## Where the previous shared/_post.html.erb partial was moved directly into show.html.erb
|
||||
## *MEANING:* If you depend on that partial, you'll have to check the changes and merge your customizations back in!
|
||||
|
||||
gem 'refinerycms-blog', '~> 1.8.0'
|
||||
|
||||
Now, run ``bundle install``
|
||||
|
||||
|
@ -27,4 +38,4 @@ Next, to install the blog plugin run:
|
|||
|
||||
Finally migrate your database and you're done.
|
||||
|
||||
rake db:migrate
|
||||
rake db:migrate
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Gem::Specification.new do |s|
|
||||
s.name = %q{refinerycms-blog}
|
||||
s.version = %q{1.6.2}
|
||||
s.version = %q{1.8.0}
|
||||
s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.}
|
||||
s.date = %q{2011-06-29}
|
||||
s.date = %q{2012-01-19}
|
||||
s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.}
|
||||
s.email = %q{info@refinerycms.com}
|
||||
s.homepage = %q{http://refinerycms.com/blog}
|
||||
|
@ -81,16 +81,16 @@ Gem::Specification.new do |s|
|
|||
app/views/blog/posts
|
||||
app/views/blog/posts/_comment.html.erb
|
||||
app/views/blog/posts/_nav.html.erb
|
||||
app/views/blog/posts/_post.html.erb
|
||||
app/views/blog/posts/archive.html.erb
|
||||
app/views/blog/posts/index.html.erb
|
||||
app/views/blog/posts/index.rss.builder
|
||||
app/views/blog/posts/show.html.erb
|
||||
app/views/blog/posts/tagged.html.erb
|
||||
app/views/blog/shared
|
||||
app/views/blog/shared/_archive_list.html.erb
|
||||
app/views/blog/shared/_categories.html.erb
|
||||
app/views/blog/shared/_post.html.erb
|
||||
app/views/blog/shared/_posts.html.erb
|
||||
app/views/blog/shared/_related_posts.html.erb
|
||||
app/views/blog/shared/_rss_feed.html.erb
|
||||
app/views/blog/shared/_tags.html.erb
|
||||
app/views/shared
|
||||
|
@ -99,12 +99,14 @@ Gem::Specification.new do |s|
|
|||
changelog.md
|
||||
config
|
||||
config/locales
|
||||
config/locales/bg.yml
|
||||
config/locales/cs.yml
|
||||
config/locales/de.yml
|
||||
config/locales/en.yml
|
||||
config/locales/es.yml
|
||||
config/locales/fr.yml
|
||||
config/locales/it.yml
|
||||
config/locales/ja.yml
|
||||
config/locales/nb.yml
|
||||
config/locales/nl.yml
|
||||
config/locales/pl.yml
|
||||
|
@ -122,6 +124,7 @@ Gem::Specification.new do |s|
|
|||
db/migrate/5_add_cached_slugs.rb
|
||||
db/migrate/6_add_custom_url_field_to_blog_posts.rb
|
||||
db/migrate/7_add_custom_teaser_field_to_blog_posts.rb
|
||||
db/migrate/8_add_primary_key_to_categorizations.rb
|
||||
db/seeds
|
||||
db/seeds/refinerycms_blog.rb
|
||||
features
|
||||
|
@ -138,6 +141,7 @@ Gem::Specification.new do |s|
|
|||
features/support/step_definitions/category_steps.rb
|
||||
features/support/step_definitions/tags_steps.rb
|
||||
features/tags.feature
|
||||
Gemfile
|
||||
lib
|
||||
lib/gemspec.rb
|
||||
lib/generators
|
||||
|
@ -197,6 +201,7 @@ Gem::Specification.new do |s|
|
|||
spec/models/blog_category_spec.rb
|
||||
spec/models/blog_comment_spec.rb
|
||||
spec/models/blog_post_spec.rb
|
||||
todo.md
|
||||
)
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue