aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/blog_post.rb2
-rw-r--r--app/views/admin/blog/posts/_form.html.erb29
-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/shared/_tags.html.erb2
-rw-r--r--config/locales/de.yml2
-rw-r--r--features/authors.feature2
-rw-r--r--features/tags.feature2
-rw-r--r--lib/refinery/blog/tabs.rb28
-rw-r--r--lib/refinerycms-blog.rb7
-rw-r--r--public/stylesheets/refinerycms-blog.css3
11 files changed, 85 insertions, 14 deletions
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index 63c66ba..e298bcf 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -22,6 +22,8 @@ class BlogPost < ActiveRecord::Base
validates :body, :presence => true
has_friendly_id :title, :use_slug => true
+
+ 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 7bcca84..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'>
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/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| %>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 1209b5f..b7927f6 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -101,6 +101,8 @@ de:
singular: Kommentar
none: Keine Kommentare
archives: Archiv
+ tags:
+ title: Kategorien
categories:
show:
no_posts: Es sind noch keine Artikel vorhanden.
diff --git a/features/authors.feature b/features/authors.feature
index 0e17e32..f3fd3ec 100644
--- a/features/authors.feature
+++ b/features/authors.feature
@@ -8,7 +8,7 @@ Feature: Blog Post Authors
When I am on the new blog post form
And I fill in "Title" with "This is my blog post"
- And I fill in "Body" with "And I love it"
+ And I fill in "blog_post_body" with "And I love it"
And I press "Save"
Then there should be 1 blog post
diff --git a/features/tags.feature b/features/tags.feature
index 05d6028..24dff2a 100644
--- a/features/tags.feature
+++ b/features/tags.feature
@@ -12,7 +12,7 @@ Feature: Blog Post Tags
Scenario: The blog post new/edit form saves tag_list
When I am on the new blog post form
And I fill in "Title" with "This is my blog post"
- And I fill in "Body" with "And I love it"
+ And I fill in "blog_post_body" with "And I love it"
And I fill in "Tags" with "chicago, bikes, beers, babes"
And I press "Save"
diff --git a/lib/refinery/blog/tabs.rb b/lib/refinery/blog/tabs.rb
new file mode 100644
index 0000000..083d50b
--- /dev/null
+++ b/lib/refinery/blog/tabs.rb
@@ -0,0 +1,28 @@
+module Refinery
+ module Blog
+ attr_accessor :tabs
+
+ def self.tabs
+ @tabs ||= []
+ end
+
+ class Tab
+ attr_accessor :name, :partial
+
+ def self.register(&block)
+ tab = self.new
+
+ yield tab
+
+ raise "A tab MUST have a name!: #{tab.inspect}" if tab.name.blank?
+ raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank?
+ end
+
+ protected
+
+ def initialize
+ ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs
+ end
+ end
+ end
+end \ No newline at end of file
diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb
index 901535d..407b840 100644
--- a/lib/refinerycms-blog.rb
+++ b/lib/refinerycms-blog.rb
@@ -2,8 +2,9 @@ require 'filters_spam'
module Refinery
module Blog
-
autoload :Version, File.expand_path('../refinery/blog/version', __FILE__)
+ autoload :Tab, File.expand_path("../refinery/blog/tabs", __FILE__)
+
class << self
def version
::Refinery::Blog::Version.to_s
@@ -15,6 +16,10 @@ module Refinery
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
end
+ config.to_prepare do
+ require File.expand_path('../refinery/blog/tabs', __FILE__)
+ end
+
config.after_initialize do
Refinery::Plugin.register do |plugin|
plugin.name = "refinerycms_blog"
diff --git a/public/stylesheets/refinerycms-blog.css b/public/stylesheets/refinerycms-blog.css
index 3d98f45..ef6f224 100644
--- a/public/stylesheets/refinerycms-blog.css
+++ b/public/stylesheets/refinerycms-blog.css
@@ -1,3 +1,6 @@
+.blog_post header, .blog_post footer {
+ width: auto;
+}
.blog_post .posted_at{
}
.post_categories .filed_in {