diff --git a/.gitignore b/.gitignore index 9c1a2c5..02200c0 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ doc/* *.autobackupbyrefinery.* /refinerycms-blog*.gem .autotest +spec/dummy # Mac .DS_Store @@ -42,3 +43,12 @@ nbproject # Capybara Bug capybara-*html + +# rvm +.rvmrc + +#rbenv +.rbenv-version + +Gemfile.lock +.rbx \ No newline at end of file diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..53607ea --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--colour diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f240b90 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +before_script: + - "bundle exec rake refinery:testing:dummy_app > /dev/null" +script: "bundle exec rake spec" +notifications: + email: + - parndt@gmail.com + - ugis.ozolss@gmail.com + - joe@joesak.com + - jamie@enmasse.com +env: + - DB=postgresql + - DB=mysql +matrix: + allow_failures: + - rvm: rbx-19mode +rvm: + - 1.8.7 + - 1.9.3 + - rbx-19mode + - jruby diff --git a/Gemfile b/Gemfile index 84f127c..f9da5c3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,70 @@ -gem 'filters_spam', '~> 0.3' -gem "will_paginate", ">= 2.3.14" \ No newline at end of file +source "http://rubygems.org" + +gemspec + +gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +gem 'refinerycms-i18n', :git => 'git://github.com/parndt/refinerycms-i18n.git' +gem 'refinerycms-settings', :git => 'git://github.com/parndt/refinerycms-settings.git' + +group :development, :test do + require 'rbconfig' + + gem 'refinerycms-testing', :git => 'git://github.com/resolve/refinerycms.git' + + platforms :jruby do + gem 'activerecord-jdbcsqlite3-adapter' + gem 'activerecord-jdbcmysql-adapter' + gem 'activerecord-jdbcpostgresql-adapter' + gem 'jruby-openssl' + end + + unless defined?(JRUBY_VERSION) + gem 'sqlite3' + gem 'mysql2' + gem 'pg' + end + + platforms :mswin, :mingw do + gem 'win32console' + gem 'rb-fchange', '~> 0.0.5' + gem 'rb-notifu', '~> 0.0.4' + end + + platforms :ruby do + gem 'spork', '0.9.0.rc9' + gem 'guard-spork' + + unless ENV['TRAVIS'] + if RbConfig::CONFIG['target_os'] =~ /darwin/i + gem 'rb-fsevent', '>= 0.3.9' + gem 'growl', '~> 1.0.3' + end + if RbConfig::CONFIG['target_os'] =~ /linux/i + gem 'rb-inotify', '>= 0.5.1' + gem 'libnotify', '~> 0.1.3' + gem 'therubyracer', '~> 0.9.9' + end + end + end + + platforms :jruby do + unless ENV['TRAVIS'] + if RbConfig::CONFIG['target_os'] =~ /darwin/i + gem 'growl', '~> 1.0.3' + end + if RbConfig::CONFIG['target_os'] =~ /linux/i + gem 'rb-inotify', '>= 0.5.1' + gem 'libnotify', '~> 0.1.3' + end + end + end +end + +# Refinery/rails should pull in the proper versions of these +group :assets do + gem 'sass-rails' + gem 'coffee-rails' + gem 'uglifier' +end + +gem 'jquery-rails' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index ae2c41e..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,11 +0,0 @@ -GEM - specs: - filters_spam (0.3) - will_paginate (2.3.14) - -PLATFORMS - ruby - -DEPENDENCIES - filters_spam (~> 0.3) - will_paginate (>= 2.3.14) diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..0de2882 --- /dev/null +++ b/Guardfile @@ -0,0 +1,20 @@ +guard 'rspec', :version => 2, :cli => "--format Fuubar --color --drb" do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/controllers/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch('spec/spec_helper.rb') { "spec" } + watch('config/routes.rb') { "spec/routing" } + watch('app/controllers/application_controller.rb') { "spec/controllers" } + # Capybara request specs + watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } +end + +guard 'spork', :wait => 60, :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do + watch('config/application.rb') + watch('config/environment.rb') + watch(%r{^config/environments/.+\.rb$}) + watch(%r{^config/initializers/.+\.rb$}) + watch('spec/spec_helper.rb') +end diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..743f388 --- /dev/null +++ b/Rakefile @@ -0,0 +1,19 @@ +#!/usr/bin/env rake +begin + require 'bundler/setup' +rescue LoadError + puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +end + +ENGINE_PATH = File.dirname(__FILE__) +APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) + +if File.exists?(APP_RAKEFILE) + load 'rails/tasks/engine.rake' +end + +require "refinerycms-testing" +Refinery::Testing::Railtie.load_tasks +Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH) + +load File.expand_path('../tasks/rspec.rake', __FILE__) diff --git a/public/images/refinerycms-blog/icons/cog.png b/app/assets/images/refinery/blog/icons/cog.png similarity index 100% rename from public/images/refinerycms-blog/icons/cog.png rename to app/assets/images/refinery/blog/icons/cog.png diff --git a/public/images/refinerycms-blog/icons/comment.png b/app/assets/images/refinery/blog/icons/comment.png similarity index 100% rename from public/images/refinerycms-blog/icons/comment.png rename to app/assets/images/refinery/blog/icons/comment.png diff --git a/public/images/refinerycms-blog/icons/comment_cross.png b/app/assets/images/refinery/blog/icons/comment_cross.png similarity index 100% rename from public/images/refinerycms-blog/icons/comment_cross.png rename to app/assets/images/refinery/blog/icons/comment_cross.png diff --git a/public/images/refinerycms-blog/icons/comment_tick.png b/app/assets/images/refinery/blog/icons/comment_tick.png similarity index 100% rename from public/images/refinerycms-blog/icons/comment_tick.png rename to app/assets/images/refinery/blog/icons/comment_tick.png diff --git a/public/images/refinerycms-blog/icons/comments.png b/app/assets/images/refinery/blog/icons/comments.png similarity index 100% rename from public/images/refinerycms-blog/icons/comments.png rename to app/assets/images/refinery/blog/icons/comments.png diff --git a/public/images/refinerycms-blog/icons/down.gif b/app/assets/images/refinery/blog/icons/down.gif similarity index 100% rename from public/images/refinerycms-blog/icons/down.gif rename to app/assets/images/refinery/blog/icons/down.gif diff --git a/public/images/refinerycms-blog/icons/folder.png b/app/assets/images/refinery/blog/icons/folder.png similarity index 100% rename from public/images/refinerycms-blog/icons/folder.png rename to app/assets/images/refinery/blog/icons/folder.png diff --git a/public/images/refinerycms-blog/icons/folder_add.png b/app/assets/images/refinery/blog/icons/folder_add.png similarity index 100% rename from public/images/refinerycms-blog/icons/folder_add.png rename to app/assets/images/refinery/blog/icons/folder_add.png diff --git a/public/images/refinerycms-blog/icons/folder_edit.png b/app/assets/images/refinery/blog/icons/folder_edit.png similarity index 100% rename from public/images/refinerycms-blog/icons/folder_edit.png rename to app/assets/images/refinery/blog/icons/folder_edit.png diff --git a/public/images/refinerycms-blog/icons/page.png b/app/assets/images/refinery/blog/icons/page.png similarity index 100% rename from public/images/refinerycms-blog/icons/page.png rename to app/assets/images/refinery/blog/icons/page.png diff --git a/public/images/refinerycms-blog/icons/page_add.png b/app/assets/images/refinery/blog/icons/page_add.png similarity index 100% rename from public/images/refinerycms-blog/icons/page_add.png rename to app/assets/images/refinery/blog/icons/page_add.png diff --git a/public/images/refinerycms-blog/icons/page_copy.png b/app/assets/images/refinery/blog/icons/page_copy.png similarity index 100% rename from public/images/refinerycms-blog/icons/page_copy.png rename to app/assets/images/refinery/blog/icons/page_copy.png diff --git a/public/images/refinerycms-blog/icons/up.gif b/app/assets/images/refinery/blog/icons/up.gif similarity index 100% rename from public/images/refinerycms-blog/icons/up.gif rename to app/assets/images/refinery/blog/icons/up.gif diff --git a/public/images/refinerycms-blog/rss-feed.png b/app/assets/images/refinery/blog/rss-feed.png similarity index 100% rename from public/images/refinerycms-blog/rss-feed.png rename to app/assets/images/refinery/blog/rss-feed.png diff --git a/app/assets/images/refinerycms-blog/.gitkeep b/app/assets/images/refinerycms-blog/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/refinery/blog/backend.js b/app/assets/javascripts/refinery/blog/backend.js new file mode 100644 index 0000000..695cdb7 --- /dev/null +++ b/app/assets/javascripts/refinery/blog/backend.js @@ -0,0 +1,115 @@ +$(document).ready(function(){ + $('nav#actions.multilist > ul:not(.search_list) li a[href$="' + window.location.pathname + '"]') + .parent().addClass('selected'); + if($('nav#actions.multilist > ul:not(.search_list) li.selected').length == 0) { + $('nav#actions.multilist > ul:not(.search_list) li a:nth(1)').parent().addClass('selected'); + } + + $('nav#actions.multilist > ul:not(.search_list) li > a').each(function(i,a){ + if ($(this).data('dialog-title') == null) { + $(this).bind('click', function(){ + $(this).css('background-image', "url('/images/refinery/icons/ajax-loader.gif') !important"); + }); + } + }); + + $('ul.collapsible_menu').each(function(i, ul) { + (first_li = $(this).children('li:first')).after(div=$("
")); + + $(" ").appendTo(first_li) + + if (($(this).children('li.selected')).length == 0) { + div.hide(); + first_li.addClass("closed"); + } + $(this).children('li:not(:first)').appendTo(div); + + first_li.find('> a, > span.arrow').click(function(e){ + $(this).parent().toggleClass("closed"); + $(this).parent().toggleClass("open"); + + $(this).parent().next('div').animate({ + opacity: 'toggle' + , height: 'toggle' + }, 250, $.proxy(function(){ + $(this).css('background-image', null); + }, $(this)) + ); + e.preventDefault(); + }); + }); + + $('.success_icon, .failure_icon').bind('click', function(e) { + $.get($(this).attr('href'), $.proxy(function(data){ + $(this).css('background-image', null) + .removeClass('failure_icon').removeClass('success_icon') + .addClass(data.enabled ? 'success_icon' : 'failure_icon'); + }, $(this))); + e.preventDefault(); + }); + + + $(function() { + $('#page-tabs').tabs(); + $('#copy_body_link').click(function(event) { + // Find the WYMEditor that maps to the custom_teaser field + var teaserTextArea = $('#blog_post_custom_teaser')[0]; + var teaserEditor = null; + $.each(WYMeditor.INSTANCES, function(index, editor) { + if (editor._element[0] == teaserTextArea) { + teaserEditor = editor; + } + }); + + if (teaserEditor) { + teaserEditor.html($('#blog_post_body').attr('value')); + } + + event.preventDefault(); + }); + }); + + + function split( val ) { + return val.split( /,\s*/ ); + } + function extractLast( term ) { + return split( term ).pop(); + } + + page_options.init(false, '', '') + + $('<%= dom_id %>').bind( "keydown", function( event ) { + if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { + event.preventDefault() + } + }).autocomplete({ + source: function( request, response ) { + $.getJSON( "<%= url %>", { + term: extractLast( request.term ) + }, response ); + }, + search: function() { + // custom minLength + var term = extractLast( this.value ); + if ( term.length < 2 ) { + return false; + } + }, + focus: function() { + // prevent value inserted on focus + return false; + }, + select: function( event, ui ) { + var terms = split( this.value ); + // remove the current input + terms.pop(); + // add the selected item + terms.push( ui.item.value ); + // add placeholder to get the comma-and-space at the end + terms.push( "" ); + this.value = terms.join( ", " ); + return false; + } + }) +}); diff --git a/public/javascripts/refinerycms-blog.js b/app/assets/javascripts/refinery/blog/frontend.js similarity index 100% rename from public/javascripts/refinerycms-blog.js rename to app/assets/javascripts/refinery/blog/frontend.js diff --git a/app/assets/javascripts/refinerycms-blog/.gitkeep b/app/assets/javascripts/refinerycms-blog/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/refinery/blog/backend.css.scss b/app/assets/stylesheets/refinery/blog/backend.css.scss new file mode 100644 index 0000000..7e2a841 --- /dev/null +++ b/app/assets/stylesheets/refinery/blog/backend.css.scss @@ -0,0 +1,73 @@ +.comments_icon { + background-image: image_url('refinery/blog/icons/comments.png'); +} +.comment_icon { + background-image: image_url('refinery/blog/icons/comment.png'); +} +.comment_cross_icon { + background-image: image_url('refinery/blog/icons/comment_cross.png'); +} +.comment_tick_icon { + background-image: image_url('refinery/blog/icons/comment_tick.png'); +} +.folder_icon { + background-image: image_url('refinery/blog/icons/folder.png'); +} +.folder_add_icon { + background-image: image_url('refinery/blog/icons/folder_add.png'); +} +.folder_edit_icon { + background-image: image_url('refinery/blog/icons/folder_edit.png'); +} +.settings_icon { + background-image: image_url('refinery/blog/icons/cog.png'); +} +.page_icon { + background-image: image_url('refinery/blog/icons/page.png'); +} +.page_copy_icon { + background-image: image_url('refinery/blog/icons/page_copy.png'); +} +.page_add_icon { + background-image: image_url('refinery/blog/icons/page_add.png'); +} +ul.collapsible_menu li { + position: relative; +} +ul.collapsible_menu li span.arrow { + background-repeat: no-repeat; + position: absolute; + right: 10px; + top: 13px; + width: 11px; + height: 7px; + cursor: pointer; +} +ul.collapsible_menu li span.arrow { + background-image: image_url('refinery/blog/icons/up.gif'); +} +ul.collapsible_menu li.closed span.arrow { + background-image: image_url('refinery/blog/icons/down.gif'); +} +ul.collapsible_menu > div { + width: 93%; + margin: 0px auto; +} +ul.blog_categories{ + height:200px; + overflow:auto; + border:1px solid #ccc; + padding:5px; +} +ul.blog_categories, ul.blog_categories li { + list-style: none; + margin:5px 0; +} +a#copy_body_link { + background: image_url('refinery/blog/icons/add.png') no-repeat scroll 0 6px transparent; + border-bottom: 0 none; + display: inline; + line-height: 29px; + margin-top: 0; + padding-left: 20px; +} diff --git a/public/stylesheets/refinerycms-blog.css b/app/assets/stylesheets/refinery/blog/frontend.css.scss similarity index 83% rename from public/stylesheets/refinerycms-blog.css rename to app/assets/stylesheets/refinery/blog/frontend.css.scss index 73a4e42..65cecd0 100644 --- a/public/stylesheets/refinerycms-blog.css +++ b/app/assets/stylesheets/refinery/blog/frontend.css.scss @@ -1,6 +1,7 @@ +.blog_post header, .blog_post footer { + width: auto; +} .blog_post .posted_at{ - display:block; - margin:0 0 10px; } .post_categories .filed_in { display: inline; @@ -21,7 +22,7 @@ #rss_feed_subscribe { display: block; padding-left: 25px; - background: url('/images/refinerycms-blog/rss-feed.png') no-repeat; + background: image_url('refinery/blog/rss-feed.png') no-repeat; } #next_prev_article{ overflow:hidden; @@ -57,7 +58,7 @@ .flash_notice, .flash_message { border: 1px solid #00A017; color: #00A017; - background: 7px 7px no-repeat url('/images/refinery/icons/accept.png') #E0F5E0; + background: 7px 7px no-repeat image_url('refinery/blog/icons/accept.png') #E0F5E0; } .flash_notice, .flash_notice * { color: #00A017; @@ -65,7 +66,7 @@ .flash_error { border: 1px solid #A00027; color: #A00027; - background: 7px 7px no-repeat url('/images/refinery/icons/cancel.png') #FFB1B1; + background: 7px 7px no-repeat image_url('refinery/blog/icons/cancel.png') #FFB1B1; } .flash.flash_notice #flash_close, .flash.flash_error #flash_close { text-transform: lowercase; diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png new file mode 100755 index 0000000..954e22d Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png new file mode 100755 index 0000000..64ece57 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_flat_10_000000_40x100.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_flat_10_000000_40x100.png new file mode 100755 index 0000000..abdc010 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_flat_10_000000_40x100.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png new file mode 100755 index 0000000..9b383f4 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png new file mode 100755 index 0000000..a23baad Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100755 index 0000000..42ccba2 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png new file mode 100755 index 0000000..39d5824 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png new file mode 100755 index 0000000..f127367 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png new file mode 100755 index 0000000..359397a Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_222222_256x240.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_222222_256x240.png new file mode 100755 index 0000000..b273ff1 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_222222_256x240.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_228ef1_256x240.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_228ef1_256x240.png new file mode 100755 index 0000000..a641a37 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_228ef1_256x240.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ef8c08_256x240.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ef8c08_256x240.png new file mode 100755 index 0000000..85e63e9 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ef8c08_256x240.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffd27a_256x240.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffd27a_256x240.png new file mode 100755 index 0000000..e117eff Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffd27a_256x240.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffffff_256x240.png b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffffff_256x240.png new file mode 100755 index 0000000..42f8f99 Binary files /dev/null and b/app/assets/stylesheets/refinery/blog/ui-lightness/images/ui-icons_ffffff_256x240.png differ diff --git a/app/assets/stylesheets/refinery/blog/ui-lightness/jquery-ui-1.8.13.custom.css.scss b/app/assets/stylesheets/refinery/blog/ui-lightness/jquery-ui-1.8.13.custom.css.scss new file mode 100755 index 0000000..f9a1401 --- /dev/null +++ b/app/assets/stylesheets/refinery/blog/ui-lightness/jquery-ui-1.8.13.custom.css.scss @@ -0,0 +1,330 @@ +/* + * jQuery UI CSS Framework 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } +.ui-autocomplete{ background:#fff; border:solid #ccc; border-width:0 1px 1px; } + +/* + * jQuery UI CSS Framework 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px + */ + + +/* Interaction states +----------------------------------*/ + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); } +.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/* + * jQuery UI Autocomplete 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } + +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + +/* + * jQuery UI Menu 1.8.13 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; + float: left; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + zoom: 1; + float: left; + clear: left; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; + zoom:1; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; + margin: -1px; +} + diff --git a/app/assets/stylesheets/refinerycms-blog/.gitkeep b/app/assets/stylesheets/refinerycms-blog/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/.gitkeep b/app/controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/admin/blog/categories_controller.rb b/app/controllers/admin/blog/categories_controller.rb deleted file mode 100644 index fe15a0b..0000000 --- a/app/controllers/admin/blog/categories_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Admin::Blog::CategoriesController < Admin::BaseController - - crudify :blog_category, - :title_attribute => :title, - :order => 'title ASC' - -end diff --git a/app/controllers/admin/blog/comments_controller.rb b/app/controllers/admin/blog/comments_controller.rb deleted file mode 100644 index 0dc1db5..0000000 --- a/app/controllers/admin/blog/comments_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -class Admin::Blog::CommentsController < Admin::BaseController - - crudify :blog_comment, - :title_attribute => :name, - :order => 'published_at DESC' - - def index - @blog_comments = BlogComment.unmoderated - render :action => 'index' - end - - def approved - unless params[:id].present? - @blog_comments = BlogComment.approved - render :action => 'index' - else - @blog_comment = BlogComment.find(params[:id]) - @blog_comment.approve! - flash[:notice] = t('admin.blog.comments.approved', :author => @blog_comment.name) - redirect_to :action => params[:return_to] || 'index' - end - end - - def rejected - unless params[:id].present? - @blog_comments = BlogComment.rejected - render :action => 'index' - else - @blog_comment = BlogComment.find(params[:id]) - @blog_comment.reject! - flash[:notice] = t('admin.blog.comments.rejected', :author => @blog_comment.name) - redirect_to :action => params[:return_to] || 'index' - end - end - -end diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb deleted file mode 100644 index bd5dd49..0000000 --- a/app/controllers/admin/blog/posts_controller.rb +++ /dev/null @@ -1,14 +0,0 @@ -class Admin::Blog::PostsController < Admin::BaseController - - crudify :blog_post, - :title_attribute => :title, - :order => 'published_at DESC' - - before_filter :find_all_categories, - :only => [:new, :edit, :create, :update] - -protected - def find_all_categories - @blog_categories = BlogCategory.find(:all) - end -end diff --git a/app/controllers/admin/blog/settings_controller.rb b/app/controllers/admin/blog/settings_controller.rb deleted file mode 100644 index cc9261b..0000000 --- a/app/controllers/admin/blog/settings_controller.rb +++ /dev/null @@ -1,27 +0,0 @@ -class Admin::Blog::SettingsController < Admin::BaseController - - def notification_recipients - @recipients = BlogComment::Notification.recipients - - if request.post? - BlogComment::Notification.recipients = params[:recipients] - flash[:notice] = t('admin.blog.settings.notification_recipients.updated', - :recipients => BlogComment::Notification.recipients) - unless request.xhr? or from_dialog? - redirect_back_or_default(admin_blog_posts_path) - else - render :text => "" - end - end - end - - def moderation - enabled = BlogComment::Moderation.toggle! - unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) - else - render :json => {:enabled => enabled} - end - end - -end diff --git a/app/controllers/blog/categories_controller.rb b/app/controllers/blog/categories_controller.rb deleted file mode 100644 index 4795e99..0000000 --- a/app/controllers/blog/categories_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Blog::CategoriesController < BlogController - - def show - @category = BlogCategory.find(params[:id]) - end - -end diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb deleted file mode 100644 index 5de6984..0000000 --- a/app/controllers/blog/posts_controller.rb +++ /dev/null @@ -1,92 +0,0 @@ -class Blog::PostsController < BlogController - - before_filter :find_all_blog_posts, :except => [:archive] - before_filter :find_blog_post, :only => [:show, :comment, :update_nav] - - respond_to :html, :js, :rss if Rails.version >= '3.0.0' - - def index - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_posts) do |format| - format.html - format.rss - end - end - end - - def show - @blog_comment = BlogComment.new - - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_post) do |format| - format.html { present(@page) } - format.js { render :partial => 'post', :layout => false } - end - end - end - - def comment - if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? - if BlogComment::Moderation.enabled? or @blog_comment.ham? - begin - if Rails.version < '3.0.0' - Blog::CommentMailer.deliver_notification(@blog_comment, request) - else - Blog::CommentMailer.notification(@blog_comment, request).deliver - end - rescue - logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n" - end - end - - if BlogComment::Moderation.enabled? - flash[:notice] = t('blog.posts.comments.thank_you_moderated') - redirect_to blog_post_url(params[:id]) - else - flash[:notice] = t('blog.posts.comments.thank_you') - redirect_to blog_post_url(params[:id], - :anchor => "comment-#{@blog_comment.to_param}") - end - else - render :action => 'show' - end - end - - def archive - date = "#{params[:month]}/#{params[:year]}" - @archive_date = Time.parse(date) - @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_posts) - end - end - -protected - - def find_blog_post - unless (@blog_post = BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = BlogPost.find(params[:id]) - else - error_404 - end - end - end - - def find_all_blog_posts - @blog_posts = BlogPost.live.paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) - end - -end diff --git a/app/controllers/blog_controller.rb b/app/controllers/blog_controller.rb deleted file mode 100644 index f51d5bb..0000000 --- a/app/controllers/blog_controller.rb +++ /dev/null @@ -1,16 +0,0 @@ -class BlogController < ApplicationController - - helper :blog_posts - before_filter :find_page, :find_all_blog_categories - -protected - - def find_page - @page = Page.find_by_link_url("/blog") - end - - def find_all_blog_categories - @blog_categories = BlogCategory.all - end - -end diff --git a/app/controllers/refinery/blog/admin/categories_controller.rb b/app/controllers/refinery/blog/admin/categories_controller.rb new file mode 100644 index 0000000..0a3b7b9 --- /dev/null +++ b/app/controllers/refinery/blog/admin/categories_controller.rb @@ -0,0 +1,12 @@ +module Refinery + module Blog + module Admin + class CategoriesController < ::Refinery::AdminController + + crudify :'refinery/blog/category', + :order => 'title ASC' + + end + end + end +end diff --git a/app/controllers/refinery/blog/admin/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb new file mode 100644 index 0000000..8565b28 --- /dev/null +++ b/app/controllers/refinery/blog/admin/comments_controller.rb @@ -0,0 +1,49 @@ +module Refinery + module Blog + module Admin + class CommentsController < ::Refinery::AdminController + + cache_sweeper Refinery::BlogSweeper + + crudify :'refinery/blog/comment', + :title_attribute => :name, + :order => 'published_at DESC' + + def index + @comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) + + render :action => 'index' + end + + def approved + unless params[:id].present? + @comments = Refinery::Blog::Comment.approved.page(params[:page]) + + render :action => 'index' + else + @comment = Refinery::Blog::Comment.find(params[:id]) + @comment.approve! + flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name) + + redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil) + end + end + + def rejected + unless params[:id].present? + @comments = Refinery::Blog::Comment.rejected.page(params[:page]) + + render :action => 'index' + else + @comment = Refinery::Blog::Comment.find(params[:id]) + @comment.reject! + flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name) + + redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil) + end + end + + end + end + end +end diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb new file mode 100644 index 0000000..b379a24 --- /dev/null +++ b/app/controllers/refinery/blog/admin/posts_controller.rb @@ -0,0 +1,90 @@ +module Refinery + module Blog + module Admin + class PostsController < ::Refinery::AdminController + + cache_sweeper Refinery::BlogSweeper + + crudify :'refinery/blog/post', + :order => 'published_at DESC' + + before_filter :find_all_categories, + :only => [:new, :edit, :create, :update] + + before_filter :check_category_ids, :only => :update + + def uncategorized + @posts = Refinery::Blog::Post.uncategorized.page(params[:page]) + end + + def tags + if ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql' + op = '~*' + wildcard = '.*' + else + op = 'LIKE' + wildcard = '%' + end + + @tags = Refinery::Blog::Post.tag_counts_on(:tags).where( + ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"] + ).map { |tag| {:id => tag.id, :value => tag.name}} + render :json => @tags.flatten + end + + def new + @post = ::Refinery::Blog::Post.new(:author => current_refinery_user) + end + + def create + # if the position field exists, set this object as last object, given the conditions of this class. + if Refinery::Blog::Post.column_names.include?("position") + params[:post].merge!({ + :position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1) + }) + end + + if (@post = Refinery::Blog::Post.create(params[:post])).valid? + (request.xhr? ? flash.now : flash).notice = t( + 'refinery.crudify.created', + :what => "'#{@post.title}'" + ) + + unless from_dialog? + unless params[:continue_editing] =~ /true|on|1/ + redirect_back_or_default(refinery.blog_admin_posts_path) + else + unless request.xhr? + redirect_to :back + else + render "/shared/message" + end + end + else + render :text => "" + end + else + unless request.xhr? + render :action => 'new' + else + render :partial => "/refinery/admin/error_messages", + :locals => { + :object => @post, + :include_object_name => true + } + end + end + end + + protected + def find_all_categories + @categories = Refinery::Blog::Category.find(:all) + end + + def check_category_ids + params[:post][:category_ids] ||= [] + end + end + end + end +end diff --git a/app/controllers/refinery/blog/admin/settings_controller.rb b/app/controllers/refinery/blog/admin/settings_controller.rb new file mode 100644 index 0000000..68daa19 --- /dev/null +++ b/app/controllers/refinery/blog/admin/settings_controller.rb @@ -0,0 +1,55 @@ +module Refinery + module Blog + module Admin + class SettingsController < ::Refinery::AdminController + + def notification_recipients + @recipients = Refinery::Blog::Comment::Notification.recipients + + if request.post? + Refinery::Blog::Comment::Notification.recipients = params[:recipients] + flash[:notice] = t('updated', :scope => 'refinery.blog.admin.settings.notification_recipients', + :recipients => Refinery::Blog::Comment::Notification.recipients) + unless request.xhr? or from_dialog? + redirect_back_or_default(refinery.blog_admin_posts_path) + else + render :text => "", + :layout => false + end + end + end + + def moderation + enabled = Refinery::Blog::Comment::Moderation.toggle! + unless request.xhr? + redirect_back_or_default(refinery.blog_admin_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + def comments + enabled = Refinery::Blog::Comment.toggle! + unless request.xhr? + redirect_back_or_default(refinery.blog_admin_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + def teasers + enabled = Refinery::Blog::Post.teaser_enabled_toggle! + unless request.xhr? + redirect_back_or_default(refinery.blog_admin_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + end + end + end +end \ No newline at end of file diff --git a/app/controllers/refinery/blog/blog_controller.rb b/app/controllers/refinery/blog/blog_controller.rb new file mode 100644 index 0000000..54a8b03 --- /dev/null +++ b/app/controllers/refinery/blog/blog_controller.rb @@ -0,0 +1,17 @@ +module Refinery + module Blog + class BlogController < ::ApplicationController + + include ControllerHelper + + helper :'refinery/blog/posts' + before_filter :find_page, :find_all_blog_categories + + protected + + def find_page + @page = Refinery::Page.find_by_link_url("/blog") + end + end + end +end diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb new file mode 100644 index 0000000..467726e --- /dev/null +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -0,0 +1,12 @@ +module Refinery + module Blog + class CategoriesController < BlogController + + def show + @category = Refinery::Blog::Category.find(params[:id]) + @posts = @category.posts.live.includes(:comments, :categories).page(params[:page]) + end + + end + end +end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb new file mode 100644 index 0000000..caa46ec --- /dev/null +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -0,0 +1,85 @@ +module Refinery + module Blog + class PostsController < BlogController + + caches_page :index, :unless => proc {|c| c.refinery_user_signed_in? || c.flash.any? || params[:page].present? } + + before_filter :find_all_blog_posts, :except => [:archive] + before_filter :find_blog_post, :only => [:show, :comment, :update_nav] + before_filter :find_tags + + respond_to :html, :js, :rss + + def index + # Rss feeders are greedy. Let's give them every blog post instead of paginating. + (@posts = Post.live.includes(:comments, :categories).all) if request.format.rss? + respond_with (@posts) do |format| + format.html + format.rss + end + end + + def show + @comment = Comment.new + + @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical? + + @post.increment!(:access_count, 1) + + respond_with (@post) do |format| + format.html { present(@post) } + format.js { render :partial => 'post', :layout => false } + end + end + + def comment + if (@comment = @post.comments.create(params[:comment])).valid? + if Comment::Moderation.enabled? or @comment.ham? + begin + CommentMailer.notification(@comment, request).deliver + rescue + logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n" + end + end + + if Comment::Moderation.enabled? + flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments') + redirect_to refinery.blog_post_url(params[:id]) + else + flash[:notice] = t('thank_you', :scope => 'refinery.blog.posts.comments') + redirect_to refinery.blog_post_url(params[:id], + :anchor => "comment-#{@comment.to_param}") + end + else + render :action => 'show' + end + end + + def archive + if params[:month].present? + date = "#{params[:month]}/#{params[:year]}" + @archive_date = Time.parse(date) + @date_title = @archive_date.strftime('%B %Y') + @posts = Post.live.by_month(@archive_date).page(params[:page]) + else + date = "01/#{params[:year]}" + @archive_date = Time.parse(date) + @date_title = @archive_date.strftime('%Y') + @posts = Post.live.by_year(@archive_date).page(params[:page]) + end + respond_with (@posts) + end + + def tagged + @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) + @tag_name = @tag.name + @posts = Post.tagged_with(@tag_name).page(params[:page]) + end + + protected + def canonical? + ::Refinery.i18n_enabled? && ::Refinery::I18n.default_frontend_locale != ::Refinery::I18n.current_frontend_locale + end + end + end +end diff --git a/app/helpers/.gitkeep b/app/helpers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/helpers/blog_posts_helper.rb b/app/helpers/blog_posts_helper.rb deleted file mode 100644 index 53bdb75..0000000 --- a/app/helpers/blog_posts_helper.rb +++ /dev/null @@ -1,28 +0,0 @@ -module BlogPostsHelper - def blog_archive_list - posts = BlogPost.select('published_at').all_previous - return nil if posts.blank? - html = '

Archives

' - html.html_safe - end - - def next_or_previous?(post) - post.next.present? or post.prev.present? - end -end diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb new file mode 100644 index 0000000..bf4926b --- /dev/null +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -0,0 +1,29 @@ +module Refinery + module Blog + module ControllerHelper + + protected + + def find_blog_post + unless (@post = Refinery::Blog::Post.find(params[:id])).try(:live?) + if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog") + @post = Refinery::Blog::Post.find(params[:id]) + else + error_404 + end + end + end + + def find_all_blog_posts + @posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page]) + end + + def find_tags + @tags = Refinery::Blog::Post.tag_counts_on(:tags) + end + def find_all_blog_categories + @categories = Refinery::Blog::Category.all + end + end + end +end diff --git a/app/helpers/refinery/blog/posts_helper.rb b/app/helpers/refinery/blog/posts_helper.rb new file mode 100644 index 0000000..dfb742a --- /dev/null +++ b/app/helpers/refinery/blog/posts_helper.rb @@ -0,0 +1,72 @@ +module Refinery + module Blog + module PostsHelper + def next_or_previous?(post) + post.next.present? or post.prev.present? + end + + def blog_post_teaser_enabled? + Refinery::Blog::Post.teasers_enabled? + end + + def blog_post_teaser(post) + if post.respond_to?(:custom_teaser) && post.custom_teaser.present? + post.custom_teaser.html_safe + else + truncate(post.body, { + :length => Refinery::Blog.post_teaser_length, + :preserve_html_tags => true + }).html_safe + end + end + + def blog_archive_widget(dates=blog_archive_dates) + ArchiveWidget.new(dates, self).display + end + + def blog_archive_dates(cutoff=Time.now.beginning_of_month) + Refinery::Blog::Post.published_dates_older_than(cutoff) + end + + class ArchiveWidget + delegate :t, :link_to, :refinery, :render, :to => :view_context + attr_reader :view_context + + def initialize(dates, view_context, cutoff=3.years.ago.end_of_year) + @recent_dates, @old_dates = dates.sort_by {|date| -date.to_i }. + partition {|date| date > cutoff } + + @view_context = view_context + end + + def recent_links + @recent_dates.group_by {|date| [date.year, date.month] }. + map {|(year, month), dates| recent_link(year, month, dates.count) } + end + + def recent_link(year, month, count) + link_to "#{t("date.month_names")[month]} #{year} (#{count})", + refinery.blog_archive_posts_path(:year => year, :month => month) + end + + def old_links + @old_dates.group_by {|date| date.year }. + map {|year, dates| old_link(year, dates.size) } + end + + def old_link(year, count) + link_to "#{year} (#{count})", refinery.blog_archive_posts_path(:year => year) + end + + def links + recent_links + old_links + end + + def display + return "" if links.empty? + render "refinery/blog/widgets/blog_archive", :links => links + end + end + end + end +end diff --git a/app/mailers/blog/comment_mailer.rb b/app/mailers/blog/comment_mailer.rb deleted file mode 100644 index 3e4c76d..0000000 --- a/app/mailers/blog/comment_mailer.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Blog::CommentMailer < ActionMailer::Base - - def notification(comment, request) - subject BlogComment::Notification.subject - recipients BlogComment::Notification.recipients - from "\"#{RefinerySetting[:site_name]}\" " - sent_on Time.now - @comment = comment - end - -end diff --git a/app/mailers/refinery/blog/comment_mailer.rb b/app/mailers/refinery/blog/comment_mailer.rb new file mode 100644 index 0000000..69a7da4 --- /dev/null +++ b/app/mailers/refinery/blog/comment_mailer.rb @@ -0,0 +1,14 @@ +module Refinery + module Blog + class CommentMailer < ActionMailer::Base + + def notification(comment, request) + @comment = comment + mail :subject => Blog::Comment::Notification.subject, + :to => Blog::Comment::Notification.recipients, + :from => "\"#{Refinery::Core.site_name}\" " + end + + end + end +end diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/blog/comment_mailer.rb b/app/models/blog/comment_mailer.rb deleted file mode 100644 index acef313..0000000 --- a/app/models/blog/comment_mailer.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../mailers/blog/comment_mailer', __FILE__) diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb deleted file mode 100644 index 89bff27..0000000 --- a/app/models/blog_category.rb +++ /dev/null @@ -1,23 +0,0 @@ -class BlogCategory < ActiveRecord::Base - - has_and_belongs_to_many :posts, :class_name => 'BlogPost' - - acts_as_indexed :fields => [:title] - - validates_presence_of :title - validates_uniqueness_of :title - - has_friendly_id :title, :use_slug => true - - # this might be able to be optimised a little more - def post_count - count = 0 - - self.posts.each do |p| - count += 1 if p.live? - end - - count - end - -end diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb deleted file mode 100644 index 63f9731..0000000 --- a/app/models/blog_comment.rb +++ /dev/null @@ -1,122 +0,0 @@ -class BlogComment < ActiveRecord::Base - - filters_spam :author_field => :name, - :email_field => :email, - :message_field => :body - - belongs_to :post, :class_name => 'BlogPost', :foreign_key => 'blog_post_id' - - acts_as_indexed :fields => [:name, :email, :message] - - alias_attribute :message, :body - - validates_presence_of :name, :message - validates_format_of :email, - :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i - - if Rails.version < '3.0.0' - named_scope :unmoderated, :conditions => {:state => nil} - named_scope :approved, :conditions => {:state => 'approved'} - named_scope :rejected, :conditions => {:state => 'rejected'} - else - scope :unmoderated, :conditions => {:state => nil} - scope :approved, :conditions => {:state => 'approved'} - scope :rejected, :conditions => {:state => 'rejected'} - end - - def approve! - self.update_attribute(:state, 'approved') - end - - def reject! - self.update_attribute(:state, 'rejected') - end - - def rejected? - self.state == 'rejected' - end - - def approved? - self.state == 'approved' - end - - def unmoderated? - self.state.nil? - end - - before_create do |comment| - unless BlogComment::Moderation.enabled? - comment.state = comment.ham? ? 'approved' : 'rejected' - end - end - - module Moderation - class << self - def enabled? - RefinerySetting.find_or_set(:comment_moderation, true, { - :scoping => 'blog', - :restricted => false - }) - end - - def toggle! - new_value = { - :value => !BlogComment::Moderation.enabled?, - :scoping => 'blog', - :restricted => false - } - if RefinerySetting.respond_to?(:set) - RefinerySetting.set(:comment_moderation, new_value) - else - RefinerySetting[:comment_moderation] = new_value - end - end - end - end - - module Notification - class << self - def recipients - RefinerySetting.find_or_set(:comment_notification_recipients, (Role[:refinery].users.first.email rescue ''), - { - :scoping => 'blog', - :restricted => false - }) - end - - def recipients=(emails) - new_value = { - :value => emails, - :scoping => 'blog', - :restricted => false - } - if RefinerySetting.respond_to?(:set) - RefinerySetting.set(:comment_notification_recipients, new_value) - else - RefinerySetting[:comment_notification_recipients] = new_value - end - end - - def subject - RefinerySetting.find_or_set(:comment_notification_subject, "New inquiry from your website", { - :scoping => 'blog', - :restricted => false - }) - end - - def subject=(subject_line) - new_value = { - :value => subject_line, - :scoping => 'blog', - :restricted => false - } - if RefinerySetting.respond_to?(:set) - RefinerySetting.set(:comment_notification_subject, new_value) - else - RefinerySetting[:comment_notification_subject] = new_value - end - end - end - end - -end diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb deleted file mode 100644 index b965e5d..0000000 --- a/app/models/blog_post.rb +++ /dev/null @@ -1,84 +0,0 @@ -class BlogPost < ActiveRecord::Base - - has_many :comments, :class_name => 'BlogComment' - has_and_belongs_to_many :categories, :class_name => 'BlogCategory' - - acts_as_indexed :fields => [:title, :body] - - validates_presence_of :title - validates_uniqueness_of :title - - has_friendly_id :title, :use_slug => true - - if Rails.version < '3.0.0' - named_scope :by_archive, lambda { |archive_date| {:conditions => ['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month], :order => "published_at DESC"} } - else - scope :by_archive, lambda { |archive_date| - where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC") - } - end - - if Rails.version < '3.0.0' - named_scope :all_previous, :conditions => ['published_at <= ?', Time.now.beginning_of_month], :order => "published_at DESC" - else - scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC") - end - - if Rails.version < '3.0.0' - named_scope :live, lambda { {:conditions => ["published_at < ? and draft = ?", Time.now, false], :order => "published_at DESC"} } - else - scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") } - end - - if Rails.version < '3.0.0' - named_scope :previous, lambda { |i| { :conditions => ["published_at < ?", i.published_at], :order => "published_at DESC", :limit => 1 } } - named_scope :next, lambda { |i| { :condtions => ["published_at > ?", i.published_at], :order => "published_at ASC", :limit => 1 } } - else - scope :previous, lambda { |i| where(["published_at < ?", i.published_at]).order("published_at DESC").limit(1) } - scope :next, lambda { |i| where(["published_at > ?", i.published_at]).order("published_at ASC").limit(1) } - end - - def next - self.class.next(self).first - end - - def prev - self.class.previous(self).first - end - - def live? - !draft and published_at <= Time.now - end - - def category_ids=(ids) - self.categories = ids.reject{|id| id.blank?}.collect {|c_id| - BlogCategory.find(c_id.to_i) rescue nil - }.compact - end - - class << self - def comments_allowed? - RefinerySetting.find_or_set(:comments_allowed, true, { - :scoping => 'blog' - }) - end - end - - module ShareThis - DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - - class << self - def key - RefinerySetting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, { - :scoping => 'blog' - }) - end - - def enabled? - key = BlogPost::ShareThis.key - key.present? and key != BlogPost::ShareThis::DEFAULT_KEY - end - end - end - -end diff --git a/app/models/refinery/blog/category.rb b/app/models/refinery/blog/category.rb new file mode 100644 index 0000000..2935c89 --- /dev/null +++ b/app/models/refinery/blog/category.rb @@ -0,0 +1,25 @@ +module Refinery + module Blog + class Category < ActiveRecord::Base + extend FriendlyId + friendly_id :title, :use => [:slugged] + + has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_category_id + has_many :posts, :through => :categorizations, :source => :blog_post + + acts_as_indexed :fields => [:title] + + validates :title, :presence => true, :uniqueness => true + + attr_accessible :title + + def post_count + posts.live.count + end + + # how many items to show per page + self.per_page = Refinery::Blog.posts_per_page + + end + end +end diff --git a/app/models/refinery/blog/comment.rb b/app/models/refinery/blog/comment.rb new file mode 100644 index 0000000..3675e46 --- /dev/null +++ b/app/models/refinery/blog/comment.rb @@ -0,0 +1,135 @@ +module Refinery + module Blog + class Comment < ActiveRecord::Base + + attr_accessible :name, :email, :message + + filters_spam :author_field => :name, + :email_field => :email, + :message_field => :body + + belongs_to :post, :foreign_key => 'blog_post_id' + + acts_as_indexed :fields => [:name, :email, :message] + + alias_attribute :message, :body + + validates :name, :message, :presence => true + validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } + + class << self + def unmoderated + where(:state => nil) + end + + def approved + where(:state => 'approved') + end + + def rejected + where(:state => 'rejected') + end + end + + self.per_page = Refinery::Blog.comments_per_page + + 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 + + def reject! + self.update_attribute(:state, 'rejected') + end + + def rejected? + self.state == 'rejected' + end + + def approved? + self.state == 'approved' + end + + def unmoderated? + self.state.nil? + end + + def self.toggle! + currently = Refinery::Setting.find_or_set(:comments_allowed, true, { + :scoping => 'blog' + }) + Refinery::Setting.set(:comments_allowed, {:value => !currently, :scoping => 'blog'}) + end + + before_create do |comment| + unless Moderation.enabled? + comment.state = comment.ham? ? 'approved' : 'rejected' + end + end + + module Moderation + class << self + def enabled? + Refinery::Setting.find_or_set(:comment_moderation, true, { + :scoping => 'blog', + :restricted => false + }) + end + + def toggle! + new_value = { + :value => !Blog::Comment::Moderation.enabled?, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_moderation, new_value) + end + end + end + + module Notification + class << self + def recipients + Refinery::Setting.find_or_set(:comment_notification_recipients, (Refinery::Role[:refinery].users.first.email rescue ''), + { + :scoping => 'blog', + :restricted => false + }) + end + + def recipients=(emails) + new_value = { + :value => emails, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_notification_recipients, new_value) + end + + def subject + Refinery::Setting.find_or_set(:comment_notification_subject, "New inquiry from your website", { + :scoping => 'blog', + :restricted => false + }) + end + + def subject=(subject_line) + new_value = { + :value => subject_line, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_notification_subject, new_value) + end + end + end + + end + end +end diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb new file mode 100644 index 0000000..c32b775 --- /dev/null +++ b/app/models/refinery/blog/post.rb @@ -0,0 +1,120 @@ +require 'acts-as-taggable-on' +require 'seo_meta' + +module Refinery + module Blog + class Post < ActiveRecord::Base + extend FriendlyId + friendly_id :friendly_id_source, :use => [:slugged] + + is_seo_meta if self.table_exists? + + default_scope :order => 'published_at DESC' + + belongs_to :author, :class_name => 'Refinery::User', :foreign_key => :user_id, :readonly => true + + has_many :comments, :dependent => :destroy, :foreign_key => :blog_post_id + acts_as_taggable + + has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_post_id + has_many :categories, :through => :categorizations, :source => :blog_category + + acts_as_indexed :fields => [:title, :body] + + validates :title, :presence => true, :uniqueness => true + validates :body, :presence => true + + validates :source_url, :url => { :if => 'Refinery::Blog.validate_source_url', + :update => true, + :allow_nil => true, + :allow_blank => true, + :verify => [:resolve_redirects]} + + attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url, :author + attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids + attr_accessible :source_url, :source_url_title + + self.per_page = Refinery::Blog.posts_per_page + + def next + self.class.next(self) + end + + def prev + self.class.previous(self) + end + + def live? + !draft and published_at <= Time.now + end + + def friendly_id_source + custom_url.presence || title + end + + class << self + def by_month(date) + where(:published_at => date.beginning_of_month..date.end_of_month) + end + + def by_archive(date) + Refinery.deprecate("Refinery::Blog::Post.by_archive(date)", {:replacement => "Refinery::Blog::Post.by_month(date)", :when => 2.2 }) + by_month(date) + end + + def by_year(date) + where(:published_at => date.beginning_of_year..date.end_of_year) + end + + def published_dates_older_than(date) + published_before(date).pluck(:published_at) + end + + def recent(count) + live.limit(count) + end + + def popular(count) + unscoped.order("access_count DESC").limit(count) + end + + def previous(item) + published_before(item.published_at).first + end + + def uncategorized + live.includes(:categories).where(:categories => { Refinery::Categorization.table_name => { :blog_category_id => nil } }) + end + + def next(current_record) + where(["published_at > ? and draft = ?", current_record.published_at, false]).first + end + + def published_before(date=Time.now) + where("published_at < ? and draft = ?", date, false) + end + alias_method :live, :published_before + + def comments_allowed? + Refinery::Setting.find_or_set(:comments_allowed, true, :scoping => 'blog') + end + + def teasers_enabled? + Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') + end + + def teaser_enabled_toggle! + currently = Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') + Refinery::Setting.set(:teasers_enabled, :value => !currently, :scoping => 'blog') + end + end + + module ShareThis + def self.enabled? + Refinery::Blog.share_this_key != "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + end + end + + end + end +end diff --git a/app/models/refinery/categorization.rb b/app/models/refinery/categorization.rb new file mode 100644 index 0000000..ec51ea7 --- /dev/null +++ b/app/models/refinery/categorization.rb @@ -0,0 +1,10 @@ +module Refinery + class Categorization < ActiveRecord::Base + + self.table_name = 'refinery_blog_categories_blog_posts' + belongs_to :blog_post, :class_name => 'Refinery::Blog::Post', :foreign_key => :blog_post_id + belongs_to :blog_category, :class_name => 'Refinery::Blog::Category', :foreign_key => :blog_category_id + + attr_accessible :blog_category_id, :blog_post_id + end +end \ No newline at end of file diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb new file mode 100644 index 0000000..a58ac7e --- /dev/null +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -0,0 +1,26 @@ +module Refinery + class BlogSweeper < ActionController::Caching::Sweeper + observe Blog::Post, Blog::Comment + + def after_create(record) + expire_cache_for(record) + end + + def after_update(record) + expire_cache_for(record) + end + + def after_destroy(record) + expire_cache_for(record) + end + + private + + def expire_cache_for(record) + # TODO: Convert these to url helpers + expire_page '/blog' + expire_page '/blog/feed.rss' + end + + end +end diff --git a/app/views/.gitkeep b/app/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/views/admin/blog/_submenu.html.erb b/app/views/admin/blog/_submenu.html.erb deleted file mode 100644 index dcf2f4e..0000000 --- a/app/views/admin/blog/_submenu.html.erb +++ /dev/null @@ -1,89 +0,0 @@ - -<% if Refinery.version < '0.9.9' %> - <% content_for :head do %> - <%= stylesheet_link_tag('refinery/refinerycms-blog') %> - <%# this javascript is not even required in >= 0.9.9 because we made this sort of menu core. %> - <%= javascript_include_tag('refinery/refinerycms-blog') %> - <% end %> -<% else %> - <% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog')%> -<% end %> diff --git a/app/views/admin/blog/categories/_form.html.erb b/app/views/admin/blog/categories/_form.html.erb deleted file mode 100644 index 28227ae..0000000 --- a/app/views/admin/blog/categories/_form.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<% form_for [:admin, @blog_category] do |f| -%> - <% if Rails.version < '3.0.0'%> - <%= f.error_messages %> - <% else %> - <%= render :partial => "/shared/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - <% end %> - -
- <%= f.label :title -%> - <%= f.text_field :title, :class => 'larger widest' -%> -
- - <%= render :partial => "/shared/admin/form_actions", - :locals => { - :f => f, - :continue_editing => false, - :delete_title => t('admin.blog.categories.category.delete') - } %> -<% end %> diff --git a/app/views/admin/blog/categories/edit.html.erb b/app/views/admin/blog/categories/edit.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/admin/blog/categories/edit.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/admin/blog/categories/index.html.erb b/app/views/admin/blog/categories/index.html.erb deleted file mode 100644 index d9ccae6..0000000 --- a/app/views/admin/blog/categories/index.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<%= render :partial => '/admin/blog/submenu' %> -
- <% if searching? %> -

<%= t('shared.admin.search.results_for', :query => params[:search]) %>

- <% if @blog_categories.any? %> - <%= render :partial => "blog_categories", - :collection => @blog_categories %> - <% else %> -

<%= t('admin.search_no_results') %>

- <% end %> - <% else %> - <% if @blog_categories.any? %> - <%= will_paginate @blog_categories, - :previous_label => '«', - :next_label => '»' %> - - <%= render :partial => "sortable_list" %> - - <%= will_paginate @blog_categories, - :previous_label => '«', - :next_label => '»' %> - <% else %> -

- - <%= t('.no_items_yet', :create => t('admin.blog.submenu.categories.new')) %> - -

- <% end %> - <% end %> -
diff --git a/app/views/admin/blog/categories/new.html.erb b/app/views/admin/blog/categories/new.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/admin/blog/categories/new.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/admin/blog/comments/index.html.erb b/app/views/admin/blog/comments/index.html.erb deleted file mode 100644 index fbf268d..0000000 --- a/app/views/admin/blog/comments/index.html.erb +++ /dev/null @@ -1,35 +0,0 @@ -<%= render :partial => '/admin/blog/submenu' %> -
- <% if searching? %> -

<%= t('shared.admin.search.results_for', :query => params[:search]) %>

- <% if @blog_comments.any? %> - <%=# will_paginate @blog_comments - %> - -
    - <%= render :partial => "blog_comments", - :collection => @blog_comments %> -
- - <%=# will_paginate @blog_comments - %> - <% else %> -

<%= t('admin.search_no_results') %>

- <% end %> - <% else %> - <% if @blog_comments.any? %> - <%=# will_paginate @blog_comments - %> - - <%= render :partial => "sortable_list" %> - - <%=# will_paginate @blog_comments - %> - <% else %> -

- <%= t('.no_items_yet', - :type => t("admin.blog.submenu.comments.#{action_name.gsub('index', 'new')}").downcase) %> -

- <% end %> - <% end %> -
diff --git a/app/views/admin/blog/comments/show.html.erb b/app/views/admin/blog/comments/show.html.erb deleted file mode 100644 index 4faa2de..0000000 --- a/app/views/admin/blog/comments/show.html.erb +++ /dev/null @@ -1,66 +0,0 @@ -
-

<%= t('.details')%>

-

- <%= t('.age') %>: <%= time_ago_in_words(@blog_comment.created_at) %> -

-

<%= t('.actions') %>

-
    -
  • - <%= link_to t('.back'), {:action => 'index'}, :class => "back_icon" %> -
  • -
  • - <%= link_to t('.reject'), rejected_admin_blog_comment_path(@blog_comment, :return_to => 'rejected'), - :class => 'comment_cross_icon' unless @blog_comment.rejected? %> -
  • -
  • - <%= link_to t('.approve'), approved_admin_blog_comment_path(@blog_comment, :return_to => 'approved'), - :class => 'comment_tick_icon' unless @blog_comment.approved? %> -
  • -
-
-
-

<%= t('.comment') %>

- - - - - - - - - - - - - - - - - -
- <%= t('.blog_post') %> - - <%= link_to @blog_comment.post.title, - blog_post_url(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"), - :target => '_blank' %> -
- <%= t('.from') %> - - <%= @blog_comment.name %> [<%= mail_to @blog_comment.email, @blog_comment.email, {:title => t('.click_to_email')} %>] -
- <%= t('.date') %> - - <%= l(Date.parse(@blog_comment.created_at.to_s), :format => :long) %> -
- <%= t('.message') %> - -

- <%= @blog_comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "

") %> -

-
-
-<% if Refinery.version < '0.9.9' %> - <% content_for :head, stylesheet_link_tag('refinery/refinerycms-blog') %> -<% else %> - <% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog') %> -<% end %> diff --git a/app/views/admin/blog/posts/_form.css.erb b/app/views/admin/blog/posts/_form.css.erb deleted file mode 100644 index 05c18cf..0000000 --- a/app/views/admin/blog/posts/_form.css.erb +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb deleted file mode 100644 index 5779e4c..0000000 --- a/app/views/admin/blog/posts/_form.html.erb +++ /dev/null @@ -1,69 +0,0 @@ -<% form_for [:admin, @blog_post] do |f| -%> - <% if Rails.version < '3.0.0'%> - <%= f.error_messages %> - <% else %> - <%= render :partial => "/shared/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - <% end %> - -
- <%= f.label :title -%> - <%= f.text_field :title, :class => 'larger widest' -%> -
- -
- <%= f.label :body -%> - <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%> -
-
-

- <%= link_to t('.advanced_options'), "#", - :id => 'toggle_advanced_options', - :title => t('.toggle_advanced_options') %> -

- - <%= f.check_box :draft %> - <%= f.label :draft, t('.save_as_draft'), :class => "stripped" %> - -
- - <%= render :partial => "/shared/admin/form_actions", - :locals => { - :f => f, - :continue_editing => true, - :delete_title => t('admin.blog.posts.post.delete') - } %> -<% end -%> - -<% if Refinery.version < '0.9.9' %> - <% content_for :head do %> - <%= render :partial => 'form.css' %> - <%= render :partial => 'form.js' %> - <% end %> -<% else %> - <% content_for :stylesheets, render(:partial => 'form.css') -%> - <% content_for :javascripts, render(:partial => 'form.js') -%> -<% end %> diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb deleted file mode 100644 index 1d65448..0000000 --- a/app/views/admin/blog/posts/_form.js.erb +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/app/views/admin/blog/posts/_post.html.erb b/app/views/admin/blog/posts/_post.html.erb deleted file mode 100644 index a768279..0000000 --- a/app/views/admin/blog/posts/_post.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -
  • - - <%=h post.title %> -   - - - <%= link_to refinery_icon_tag("application_go.png"), blog_post_url(post), - :title => t('.view_live'), - :target => "_blank" %> - <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_blog_post_path(post), - :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), admin_blog_post_path(post), - :class => "cancel confirm-delete", - :title => t('.delete'), - :'data-method' => 'delete', - :'data-confirm' => t('shared.admin.delete.message', :title => post.title) %> - -
  • diff --git a/app/views/admin/blog/posts/edit.html.erb b/app/views/admin/blog/posts/edit.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/admin/blog/posts/edit.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/admin/blog/posts/index.html.erb b/app/views/admin/blog/posts/index.html.erb deleted file mode 100644 index d8c45a9..0000000 --- a/app/views/admin/blog/posts/index.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<%= render :partial => '/admin/blog/submenu' %> -
    - <% if searching? %> -

    <%= t('shared.admin.search.results_for', :query => params[:search]) %>

    - <% if @blog_posts.any? %> - <%= render :partial => "blog_posts", - :collection => @blog_posts %> - <% else %> -

    <%= t('admin.search_no_results') %>

    - <% end %> - <% else %> - <% if @blog_posts.any? %> - <%= will_paginate @blog_posts, - :previous_label => '«', - :next_label => '»' %> - - <%= render :partial => "sortable_list" %> - - <%= will_paginate @blog_posts, - :previous_label => '«', - :next_label => '»' %> - <% else %> -

    - - <%= t('.no_items_yet', :create => t('admin.blog.submenu.posts.new')) %> - -

    - <% end %> - <% end %> -
    diff --git a/app/views/admin/blog/posts/new.html.erb b/app/views/admin/blog/posts/new.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/admin/blog/posts/new.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/blog/categories/show.html.erb b/app/views/blog/categories/show.html.erb deleted file mode 100644 index 324c0fe..0000000 --- a/app/views/blog/categories/show.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<% content_for :body_content_title, @category.title %> - -<% content_for :body_content_left do %> - <% if @category.posts.any? %> -
    - <%= render :partial => "/blog/shared/post", :collection => @category.posts %> -
    - <% else %> -

    - <%= t('.no_posts') %> -

    - <% end %> -<% end %> - -<% content_for :body_content_right do %> - <%= render :partial => "/blog/shared/categories" %> -<% end %> - -<%= render :partial => "/shared/content_page" %> -<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> diff --git a/app/views/blog/comment_mailer/notification.html.erb b/app/views/blog/comment_mailer/notification.html.erb deleted file mode 100644 index b75020d..0000000 --- a/app/views/blog/comment_mailer/notification.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<%= t('.greeting') %>, - -<%= t('.you_recieved_new_comment') %> - -<%= t('.comment_starts') %> - -<%= t('.from') %>: <%= @comment.name %> -<%= t('.email') %>: <%= @comment.email %> -<%= t('.message') %>: -<%= @comment.body %> - -<%= t('.comment_ends') %> - -<%= t('.closing_line') %>, -<%= RefinerySetting[:site_name] %> - -<%= t('.ps') %> diff --git a/app/views/blog/posts/_comment.html.erb b/app/views/blog/posts/_comment.html.erb deleted file mode 100644 index 71eab30..0000000 --- a/app/views/blog/posts/_comment.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -
    -

    - <%= simple_format auto_link(comment.message.to_s) %> -

    -
    -

    - <%= t('blog.posts.comments.by', :who => comment.name) %>, - <%= t('blog.posts.comments.time_ago', :time => time_ago_in_words(comment.created_at)) %> -

    -
    -
    diff --git a/app/views/blog/posts/_nav.html.erb b/app/views/blog/posts/_nav.html.erb deleted file mode 100644 index 50391ee..0000000 --- a/app/views/blog/posts/_nav.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<% if next_or_previous?(@blog_post) -%> - -<% end -%> diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb deleted file mode 100644 index 6fb8e64..0000000 --- a/app/views/blog/posts/_post.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<% flash.each do |key, value| %> -
    - <%= value %> -
    -<% end %> -
    -
    -

    <%= @blog_post.title %>

    -
    - - <% if (categories = @blog_post.categories).any? %> - - <% end %> -
    -
    - <%= @blog_post.body.html_safe %> - - <% if BlogPost::ShareThis.enabled? %> - - <% end %> -
    -<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%> -<% if next_or_previous?(@blog_post) -%> - -<% end -%> diff --git a/app/views/blog/posts/archive.html.erb b/app/views/blog/posts/archive.html.erb deleted file mode 100644 index abeb0c1..0000000 --- a/app/views/blog/posts/archive.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<% content_for :body_content_left do %> - <%= @page[Page.default_parts.first.to_sym] %> -

    Blog Archive for <%= @archive_date.strftime('%B %Y') %>

    -
    - <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> -
    - <%= "There are no blog articles posted for #{@archive_date.strftime('%B %Y')}. Stay tuned." unless @blog_posts.any? %> - <%# TODO: Add locale logic here - hubble is a n00b at that %> -<% end %> - -<% content_for :body_content_right do %> - <%= @page[Page.default_parts.second.to_sym] %> - <%= render :partial => "/blog/shared/categories" %> - <%= render :partial => "/blog/shared/rss_feed" %> - <%= blog_archive_list %> -<% end %> - -<%= render :partial => "/shared/content_page" %> -<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> diff --git a/app/views/blog/posts/index.html.erb b/app/views/blog/posts/index.html.erb deleted file mode 100644 index ab0abf0..0000000 --- a/app/views/blog/posts/index.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<% content_for :body_content_left do %> - <%= @page[Page.default_parts.first.to_sym] %> - -
    - <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> -
    - <%= "

    There are no blog articles posted yet. Stay tuned.

    ".html_safe unless @blog_posts.any? %> - <%# TODO: Add locale logic here - hubble is a n00b at that %> -<% end %> - -<% content_for :body_content_right do %> - <%= @page[Page.default_parts.second.to_sym] %> - - <%= render :partial => "/blog/shared/categories" %> - <%= render :partial => "/blog/shared/rss_feed" %> - <%= blog_archive_list %> -<% end %> - -<%= render :partial => "/shared/content_page" %> -<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> diff --git a/app/views/blog/posts/index.rss.builder b/app/views/blog/posts/index.rss.builder deleted file mode 100644 index 51fa4da..0000000 --- a/app/views/blog/posts/index.rss.builder +++ /dev/null @@ -1,17 +0,0 @@ -xml.instruct! :xml, :version => "1.0" -xml.rss :version => "2.0" do - xml.channel do - xml.title RefinerySetting.find_or_set(:site_name, "Company Name") - xml.description RefinerySetting.find_or_set(:site_name, "Company Name") + " Blog Posts" - xml.link blog_root_url - - @blog_posts.each do |post| - xml.item do - xml.title post.title - xml.description post.body - xml.pubDate post.published_at.to_s(:rfc822) - xml.link blog_post_url(post) - end - end - end -end \ No newline at end of file diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb deleted file mode 100644 index 72916f3..0000000 --- a/app/views/blog/posts/show.html.erb +++ /dev/null @@ -1,86 +0,0 @@ -<% content_for :body_content_left do %> -
    - <%= render 'post' %> -
    - - <% if BlogPost.comments_allowed? %> - - <% end %> -<% end %> - -<% content_for :body_content_right do %> - <%= render :partial => "/blog/shared/categories" %> - <%= render :partial => "/blog/shared/posts" %> - <%= render :partial => "/blog/shared/rss_feed" %> - <%= blog_archive_list %> -<% end %> - -<%= render :partial => "/shared/content_page", :locals => { :remove_automatic_sections => true } %> - -<% if Refinery.version < '0.9.9' %> - <% content_for :head_libraries, jquery_include_tags(:jquery_ui => false) %> - <% content_for :head do %> - <%= stylesheet_link_tag 'refinerycms-blog' %> - <%= javascript_include_tag('refinerycms-blog') %> - <% if BlogPost::ShareThis.enabled? %> - - - <% end %> - <% end %> -<% else %> - <% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> - <% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %> - <% content_for :javascripts do %> - <%= javascript_include_tag 'refinerycms-blog' %> - - - <% end if BlogPost::ShareThis.enabled? %> -<% end %> diff --git a/app/views/blog/shared/_categories.html.erb b/app/views/blog/shared/_categories.html.erb deleted file mode 100644 index 675271c..0000000 --- a/app/views/blog/shared/_categories.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

    <%= t('.title') %>

    - diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb deleted file mode 100644 index 7b243a0..0000000 --- a/app/views/blog/shared/_post.html.erb +++ /dev/null @@ -1,38 +0,0 @@ -<% if post.live? %> -
    -
    -

    <%= link_to post.title, blog_post_url(post) %>

    -
    - - <% if (categories = post.categories).any? %> - - <% end %> -
    -
    -
    - <%= truncate(post.body, - :length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250), - :preserve_html_tags => true) %> -
    -
    -

    - <%= link_to t('blog.shared.posts.read_more'), blog_post_url(post) %> - -

    -

    -
    -
    -<% end %> diff --git a/app/views/blog/shared/_posts.html.erb b/app/views/blog/shared/_posts.html.erb deleted file mode 100644 index cbf865f..0000000 --- a/app/views/blog/shared/_posts.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

    <%= t('.other') %>

    - diff --git a/app/views/blog/shared/_rss_feed.html.erb b/app/views/blog/shared/_rss_feed.html.erb deleted file mode 100644 index 047298e..0000000 --- a/app/views/blog/shared/_rss_feed.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

    <%= t('.title') %>

    -<%= link_to "Subscribe", blog_rss_feed_url, :id => "rss_feed_subscribe"%> diff --git a/app/views/refinery/blog/admin/_submenu.html.erb b/app/views/refinery/blog/admin/_submenu.html.erb new file mode 100644 index 0000000..ba34188 --- /dev/null +++ b/app/views/refinery/blog/admin/_submenu.html.erb @@ -0,0 +1,96 @@ + + +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> diff --git a/app/views/admin/blog/categories/_category.html.erb b/app/views/refinery/blog/admin/categories/_category.html.erb similarity index 52% rename from app/views/admin/blog/categories/_category.html.erb rename to app/views/refinery/blog/admin/categories/_category.html.erb index 7997d68..b7d352f 100644 --- a/app/views/admin/blog/categories/_category.html.erb +++ b/app/views/refinery/blog/admin/categories/_category.html.erb @@ -1,16 +1,16 @@
  • - <%=h category.title %> + <%= category.title %>   <%= link_to refinery_icon_tag("application_edit.png"), - edit_admin_blog_category_path(category, :dialog => true, :height => 325), + refinery.edit_blog_admin_category_path(category, :dialog => true, :height => 325), :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), admin_blog_category_path(category), + <%= link_to refinery_icon_tag("delete.png"), refinery.blog_admin_category_path(category), :class => "cancel confirm-delete", :title => t('.delete'), - :'data-method' => 'delete', - :'data-confirm' => t('shared.admin.delete.message', :title => category.title) %> + :method => :delete, + :confirm => t('message', :scope => 'refinery.admin.delete', :title => category.title) %>
  • diff --git a/app/views/refinery/blog/admin/categories/_form.html.erb b/app/views/refinery/blog/admin/categories/_form.html.erb new file mode 100644 index 0000000..b1cf16c --- /dev/null +++ b/app/views/refinery/blog/admin/categories/_form.html.erb @@ -0,0 +1,19 @@ +<%= form_for [refinery, :blog_admin, @category] do |f| -%> + <%= render :partial => "/refinery/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %> + +
    + <%= f.label :title -%> + <%= f.text_field :title, :class => 'larger widest' -%> +
    + + <%= render :partial => "/refinery/admin/form_actions", + :locals => { + :f => f, + :continue_editing => false, + :delete_title => t('delete', :scope => 'refinery.blog.admin.categories.category') + } %> +<% end %> diff --git a/app/views/admin/blog/comments/_sortable_list.html.erb b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb similarity index 57% rename from app/views/admin/blog/comments/_sortable_list.html.erb rename to app/views/refinery/blog/admin/categories/_sortable_list.html.erb index e141dee..8040dc0 100644 --- a/app/views/admin/blog/comments/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb @@ -1,7 +1,7 @@ -<%= render :partial => "/shared/admin/sortable_list", +<%= render :partial => "/refinery/admin/sortable_list", :locals => { :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) } %> diff --git a/app/views/refinery/blog/admin/categories/edit.html.erb b/app/views/refinery/blog/admin/categories/edit.html.erb new file mode 100644 index 0000000..e0f80e7 --- /dev/null +++ b/app/views/refinery/blog/admin/categories/edit.html.erb @@ -0,0 +1 @@ +<%= render "form" %> diff --git a/app/views/refinery/blog/admin/categories/index.html.erb b/app/views/refinery/blog/admin/categories/index.html.erb new file mode 100644 index 0000000..451abc5 --- /dev/null +++ b/app/views/refinery/blog/admin/categories/index.html.erb @@ -0,0 +1,27 @@ +<%= render '/refinery/blog/admin/submenu' %> +
    + <% if searching? %> +

    <%= t('results_for', :scope => 'refinery.admin.search', + :query => params[:search]) %>

    + <% if @categories.any? %> + <%= render :partial => "blog_categories", + :collection => @categories %> + <% else %> +

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    + <% end %> + <% else %> + <% if @categories.any? %> + <%= will_paginate @categories %> + + <%= render "sortable_list" %> + + <%= will_paginate @categories %> + <% else %> +

    + + <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.blog.admin.submenu.categories')) %> + +

    + <% end %> + <% end %> +
    diff --git a/app/views/refinery/blog/admin/categories/new.html.erb b/app/views/refinery/blog/admin/categories/new.html.erb new file mode 100644 index 0000000..e0f80e7 --- /dev/null +++ b/app/views/refinery/blog/admin/categories/new.html.erb @@ -0,0 +1 @@ +<%= render "form" %> diff --git a/app/views/admin/blog/comments/_comment.html.erb b/app/views/refinery/blog/admin/comments/_comment.html.erb similarity index 54% rename from app/views/admin/blog/comments/_comment.html.erb rename to app/views/refinery/blog/admin/comments/_comment.html.erb index 1817c48..c007294 100644 --- a/app/views/admin/blog/comments/_comment.html.erb +++ b/app/views/refinery/blog/admin/comments/_comment.html.erb @@ -1,20 +1,20 @@
  • "> - <%=h comment.name %> + <%= comment.name %> - <%= truncate(comment.message, :length => 75) %> <%= link_to refinery_icon_tag("application_go.png"), - blog_post_url(comment.post, :anchor => "comment-#{comment.to_param}"), - :title => t('.view_live'), + refinery.blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), + :title => t('.view_live_html'), :target => "_blank" unless comment.unmoderated? %> - <%= link_to refinery_icon_tag('zoom.png'), admin_blog_comment_path(comment), + <%= link_to refinery_icon_tag('zoom.png'), refinery.blog_admin_comment_path(comment), :title => t('.read') %> <%= link_to refinery_icon_tag("cross.png"), - rejected_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + refinery.rejected_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.reject') unless comment.rejected? %> <%= link_to refinery_icon_tag("tick.png"), - approved_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + refinery.approved_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.approve') unless comment.approved? %>
  • diff --git a/app/views/admin/blog/categories/_sortable_list.html.erb b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb similarity index 57% rename from app/views/admin/blog/categories/_sortable_list.html.erb rename to app/views/refinery/blog/admin/comments/_sortable_list.html.erb index df6a39b..9f8bbbc 100644 --- a/app/views/admin/blog/categories/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb @@ -1,7 +1,7 @@ -<%= render :partial => "/shared/admin/sortable_list", +<%= render :partial => "/refinery/admin/sortable_list", :locals => { :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) } %> diff --git a/app/views/refinery/blog/admin/comments/index.html.erb b/app/views/refinery/blog/admin/comments/index.html.erb new file mode 100644 index 0000000..53c368e --- /dev/null +++ b/app/views/refinery/blog/admin/comments/index.html.erb @@ -0,0 +1,30 @@ +<%= render '/refinery/blog/admin/submenu' %> +
    + <% if searching? %> +

    <%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %>

    + <% if @comments.any? %> + <%= will_paginate @comments %> + +
      + <%= render :partial => "blog_comments", + :collection => @comments %> +
    + + <%= will_paginate @comments %> + <% else %> +

    <%= t('search_no_results', :scope => 'admin') %>

    + <% end %> + <% else %> + <% if @comments.any? %> + <%= will_paginate @comments %> + + <%= render "sortable_list" %> + + <%= will_paginate @comments %> + <% else %> +

    + <%= t('.no_items_yet', :type => action_name.gsub('index', 'new').downcase) %> +

    + <% end %> + <% end %> +
    diff --git a/app/views/refinery/blog/admin/comments/show.html.erb b/app/views/refinery/blog/admin/comments/show.html.erb new file mode 100644 index 0000000..2246c2f --- /dev/null +++ b/app/views/refinery/blog/admin/comments/show.html.erb @@ -0,0 +1,63 @@ +
    +

    <%= t('.details')%>

    +

    + <%= t('.age') %>: <%= time_ago_in_words(@comment.created_at) %> +

    +

    <%= t('.actions') %>

    +
      +
    • + <%= link_to t('.back'), refinery.blog_admin_comments_path, :class => "back_icon" %> +
    • +
    • + <%= link_to t('.reject'), refinery.rejected_blog_admin_comment_path(@comment, :return_to => 'rejected'), + :class => 'comment_cross_icon' unless @comment.rejected? %> +
    • +
    • + <%= link_to t('.approve'), refinery.approved_blog_admin_comment_path(@comment, :return_to => 'approved'), + :class => 'comment_tick_icon' unless @comment.approved? %> +
    • +
    +
    +
    +

    <%= t('.comment') %>

    + + + + + + + + + + + + + + + + + +
    + <%= t('.blog_post') %> + + <%= link_to @comment.post.title, + refinery.blog_post_path(@comment.post, :anchor => "comment-#{@comment.to_param}"), + :target => '_blank' %> +
    + <%= t('.from') %> + + <%= @comment.name %> [<%= mail_to @comment.email, @comment.email, {:title => t('.click_to_email')} %>] +
    + <%= t('.date') %> + + <%= l(Date.parse(@comment.created_at.to_s), :format => :long) %> +
    + <%= t('.message') %> + +

    + <%= @comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "

    ") %> +

    +
    +
    + +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb new file mode 100644 index 0000000..a977754 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -0,0 +1,127 @@ +<%= form_for [refinery, :blog_admin, @post] do |f| -%> + <%= render :partial => "/refinery/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %> + +
    + <%= f.label :title -%> + <%= f.text_field :title, :class => 'larger widest' -%> +
    + +
    +

    + <%= f.check_box :draft %> + <%= f.label :draft, t('.save_as_draft'), :class => "stripped" %> +

    +
    + +
    +
    +
      +
    • + <%= link_to t('body', :scope => 'activerecord.attributes.refinery/blog_post'), "#page_part_body" %> +
    • +
    • + <%= link_to t('teaser', :scope => 'activerecord.attributes.refinery/blog_post'), "#page_part_teaser" %> +
    • + <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %> +
    • + <%= link_to tab.name.titleize, "#custom_tab_#{tab_index}" %> +
    • + <% end %> +
    + +
    + <% part_index = -1 %> + <%= render 'form_part', :f => f, :part_index => (part_index += 1) -%> + <%= render 'teaser_part', :f => f, :part_index => (part_index += 1) if f.object.respond_to?(:custom_teaser) -%> + <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %> +
    + <%= render tab.partial, :f => f %> +
    + <% end %> +
    +
    +
    + +
    + <%= f.label :tag_list, t('refinery.blog.shared.tags.title') -%> + <%= f.text_field :tag_list, :class => 'larger' -%> +
    + +
    +

    + <%= link_to t('.advanced_options'), "#", + :id => 'toggle_advanced_options', + :title => t('.toggle_advanced_options') %> +

    +
    + + <%= render :partial => "/refinery/admin/form_actions", + :locals => { + :f => f, + :continue_editing => true, + :delete_title => t('delete', :scope => 'refinery.blog.admin.posts.post') + } %> +<% end -%> + +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> +<% content_for :javascripts, javascript_include_tag('refinery/blog/backend') %> +<%= render 'refinery/shared/admin/autocomplete', :dom_id => '#blog_post_tag_list', :url => refinery.tags_blog_admin_posts_url %> diff --git a/app/views/refinery/blog/admin/posts/_form_part.html.erb b/app/views/refinery/blog/admin/posts/_form_part.html.erb new file mode 100644 index 0000000..114e493 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_form_part.html.erb @@ -0,0 +1,3 @@ +
    + <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%> +
    diff --git a/app/views/refinery/blog/admin/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb new file mode 100644 index 0000000..fea3eb8 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_post.html.erb @@ -0,0 +1,25 @@ +
  • + + <%= post.title %> + + <%= " by #{post.author.username}" if post.author.present? %> + <% if post.draft? %> + <%= t('refinery.blog.admin.posts.post.draft') %> + <% else %> + <%= post.published_at.strftime('%b %d, %Y') %> + <% end %> + + + + <%= link_to refinery_icon_tag("application_go.png"), refinery.blog_post_path(post), + :title => t('.view_live_html'), + :target => "_blank" %> + <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_blog_admin_post_path(post), + :title => t('.edit') %> + <%= link_to refinery_icon_tag("delete.png"), refinery.blog_admin_post_path(post), + :class => "cancel confirm-delete", + :title => t('.delete'), + :method => :delete, + :confirm => t('message', :scope => 'refinery.admin.delete', :title => post.title) %> + +
  • diff --git a/app/views/admin/blog/posts/_sortable_list.html.erb b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb similarity index 58% rename from app/views/admin/blog/posts/_sortable_list.html.erb rename to app/views/refinery/blog/admin/posts/_sortable_list.html.erb index 7ae0ad3..471d4f0 100644 --- a/app/views/admin/blog/posts/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb @@ -1,7 +1,7 @@ -<%= render :partial => "/shared/admin/sortable_list", +<%= render :partial => "/refinery/admin/sortable_list", :locals => { :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) } %> diff --git a/app/views/refinery/blog/admin/posts/_teaser_part.html.erb b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb new file mode 100644 index 0000000..461a10c --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb @@ -0,0 +1,11 @@ +
    + <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%> +

    + + <%= link_to t('copy_body', :scope => 'refinery.blog.admin.posts.form'), "#", + :id => 'copy_body_link', + :title => t('copy_body_help', :scope => 'refinery.blog.admin.posts.form') %> + +

    +
    + diff --git a/app/views/refinery/blog/admin/posts/edit.html.erb b/app/views/refinery/blog/admin/posts/edit.html.erb new file mode 100644 index 0000000..e0f80e7 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/edit.html.erb @@ -0,0 +1 @@ +<%= render "form" %> diff --git a/app/views/refinery/blog/admin/posts/index.html.erb b/app/views/refinery/blog/admin/posts/index.html.erb new file mode 100644 index 0000000..19c4ccf --- /dev/null +++ b/app/views/refinery/blog/admin/posts/index.html.erb @@ -0,0 +1,27 @@ +<%= render '/refinery/blog/admin/submenu' %> +
    + <% if searching? %> +

    <%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %>

    + <% if @posts.any? %> +
      + <%= render :partial => "post", :collection => @posts %> +
    + <% else %> +

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    + <% end %> + <% else %> + <% if @posts.any? %> + <%= will_paginate @posts %> + + <%= render "sortable_list" %> + + <%= will_paginate @posts %> + <% else %> +

    + + <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.blog.admin.submenu.posts')) %> + +

    + <% end %> + <% end %> +
    diff --git a/app/views/refinery/blog/admin/posts/new.html.erb b/app/views/refinery/blog/admin/posts/new.html.erb new file mode 100644 index 0000000..e0f80e7 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/new.html.erb @@ -0,0 +1 @@ +<%= render "form" %> diff --git a/app/views/refinery/blog/admin/posts/uncategorized.html.erb b/app/views/refinery/blog/admin/posts/uncategorized.html.erb new file mode 100644 index 0000000..21e7c04 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/uncategorized.html.erb @@ -0,0 +1,27 @@ +<%= render '/refinery/blog/admin/submenu' %> +
    + <% if searching? %> +

    <%= t('results_for', :scope => 'refinery.admin.search', + :query => params[:search]) %>

    + <% if @posts.any? %> + <%= render :partial => "blog_posts", + :collection => @posts %> + <% else %> +

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    + <% end %> + <% else %> + <% if @posts.any? %> + <%= will_paginate @posts %> + + <%= render "sortable_list" %> + + <%= will_paginate @posts %> + <% else %> +

    + + <%= t('.no_items_yet') %> + +

    + <% end %> + <% end %> +
    diff --git a/app/views/admin/blog/settings/notification_recipients.html.erb b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb similarity index 69% rename from app/views/admin/blog/settings/notification_recipients.html.erb rename to app/views/refinery/blog/admin/settings/notification_recipients.html.erb index ea36af1..132ab17 100644 --- a/app/views/admin/blog/settings/notification_recipients.html.erb +++ b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb @@ -1,4 +1,4 @@ -<% form_tag do %> +<%= form_tag refinery.notification_recipients_blog_admin_settings_path do %>
    @@ -14,11 +14,11 @@ <%= t('.example') %>

    - <%= render :partial => "/shared/admin/form_actions", + <%= render :partial => "/refinery/admin/form_actions", :locals => { :f => nil, :continue_editing => false, - :cancel_url => admin_blog_posts_url, + :cancel_url => refinery.blog_admin_posts_url, :hide_delete => true } %> <% end %> diff --git a/app/views/refinery/blog/categories/show.html.erb b/app/views/refinery/blog/categories/show.html.erb new file mode 100644 index 0000000..3a4a617 --- /dev/null +++ b/app/views/refinery/blog/categories/show.html.erb @@ -0,0 +1,21 @@ +<% content_for :body_content_title, @category.title %> + +<% content_for :body do %> + <% if @posts.any? %> +
    + <%= render :partial => "/refinery/blog/shared/post", :collection => @posts %> + <%= will_paginate @posts %> +
    + <% else %> +

    + <%= t('.no_posts') %> +

    + <% end %> +<% end %> + +<% content_for :side_body do %> + <%= render "/refinery/blog/shared/categories" %> +<% end %> + +<%= render "/refinery/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/comment_mailer/notification.html.erb b/app/views/refinery/blog/comment_mailer/notification.html.erb new file mode 100644 index 0000000..8bf642e --- /dev/null +++ b/app/views/refinery/blog/comment_mailer/notification.html.erb @@ -0,0 +1,17 @@ +<%=raw t('.greeting') %>, + +<%=raw t('.you_recieved_new_comment') %> + +<%=raw t('.comment_starts') %> + +<%=raw t('.from') %>: <%= @comment.name %> +<%=raw t('.email') %>: <%= @comment.email %> +<%=raw t('.message') %>: +<%=simple_format strip_tags(@comment.body) %> + +<%=raw t('.comment_ends') %> + +<%=raw t('.closing_line') %>, +<%=raw Refinery::Core.site_name %> + +<%=raw t('.ps') %> diff --git a/app/views/refinery/blog/posts/_comment.html.erb b/app/views/refinery/blog/posts/_comment.html.erb new file mode 100644 index 0000000..659f433 --- /dev/null +++ b/app/views/refinery/blog/posts/_comment.html.erb @@ -0,0 +1,10 @@ +
    + <%= image_tag comment.avatar_url, :alt => comment.name, :class => 'avatar' %> + <%= simple_format auto_link(comment.message.to_s) %> +
    +

    + <%= t('by', :scope => 'refinery.blog.posts.comments', :who => comment.name) %>, + <%= t('time_ago', :scope => 'refinery.blog.posts.comments', :time => time_ago_in_words(comment.created_at)) %> +

    +
    +
    diff --git a/app/views/refinery/blog/posts/_comments.html.erb b/app/views/refinery/blog/posts/_comments.html.erb new file mode 100644 index 0000000..d662a1f --- /dev/null +++ b/app/views/refinery/blog/posts/_comments.html.erb @@ -0,0 +1,40 @@ + diff --git a/app/views/refinery/blog/posts/_nav.html.erb b/app/views/refinery/blog/posts/_nav.html.erb new file mode 100644 index 0000000..eafd35e --- /dev/null +++ b/app/views/refinery/blog/posts/_nav.html.erb @@ -0,0 +1,17 @@ + diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb new file mode 100644 index 0000000..9811dd2 --- /dev/null +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -0,0 +1,37 @@ +<% flash.each do |key, value| %> +
    + <%= value %> +
    +<% end %> +
    +
    +

    <%= @post.title %>

    +
    + + <%= 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? %> +
    + <%= "#{t('source', :scope => 'refinery.blog.posts.show')}: " %> + <%= link_to (@post.source_url_title.blank? ? @post.source_url : @post.source_url_title), @post.source_url %> +
    + <% end %> + <% if (categories = @post.categories).any? %> + + <% end %> +
    +
    + <%= @post.body.html_safe %> + + <% if Refinery::Blog::Post::ShareThis.enabled? %> + + <% end %> +
    +<%= render '/refinery/draft_page_message' unless @post.nil? or @post.live? -%> +<%= render 'nav' if next_or_previous?(@post) %> diff --git a/app/views/refinery/blog/posts/archive.html.erb b/app/views/refinery/blog/posts/archive.html.erb new file mode 100644 index 0000000..31b5c1e --- /dev/null +++ b/app/views/refinery/blog/posts/archive.html.erb @@ -0,0 +1,17 @@ +<% content_for :title, "#{t('.blog_archive_for', :date => @archive_date.strftime('%B %Y'))}" %> + +<% content_for :body do %> +

    <%= t('.blog_archive_for', :date => @archive_date.strftime('%B %Y')) %>

    + <% if @posts.any? %> +
    + <%= render :partial => "/refinery/blog/shared/post", :collection => @posts %> +
    + <% else %> +

    <%= t('.no_blog_articles_posted', :date => @archive_date.strftime('%B %Y')) %>

    + <% end %> +<% end %> + +<%= render '/refinery/blog/shared/body_content_right' %> + +<%= render "/refinery/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/posts/index.html.erb b/app/views/refinery/blog/posts/index.html.erb new file mode 100644 index 0000000..772f2ec --- /dev/null +++ b/app/views/refinery/blog/posts/index.html.erb @@ -0,0 +1,20 @@ +<% content_for :body do %> + <%= raw @page.content_for(Refinery::Pages.default_parts.first.to_sym) if Refinery::Pages.default_parts.any? %> + + <% if @posts.any? %> +
    + <%= render :partial => "/refinery/blog/shared/post", :collection => @posts %> + <%= will_paginate @posts %> +
    + <% else %> +

    <%= t('.no_blog_articles_yet') %>

    + <% end %> +<% end %> + +<% content_for :side_body_prepend do -%> + <%= raw @page.content_for(Refinery::Pages.default_parts.second.to_sym) %> +<% end if Refinery::Pages.default_parts.many? -%> +<%= render '/refinery/blog/shared/body_content_right' %> + +<%= render "/refinery/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/posts/index.rss.builder b/app/views/refinery/blog/posts/index.rss.builder new file mode 100644 index 0000000..8ffacd4 --- /dev/null +++ b/app/views/refinery/blog/posts/index.rss.builder @@ -0,0 +1,17 @@ +xml.instruct! :xml, :version => "1.0" +xml.rss :version => "2.0" do + xml.channel do + xml.title Refinery::Core.site_name + xml.description Refinery::Core.site_name + " Blog Posts" + xml.link refinery.blog_root_url + + @posts.each do |post| + xml.item do + xml.title post.title + xml.description post.body + xml.pubDate post.published_at.to_s(:rfc822) + xml.link refinery.blog_post_url(post) + end + end + end +end \ No newline at end of file diff --git a/app/views/refinery/blog/posts/show.html.erb b/app/views/refinery/blog/posts/show.html.erb new file mode 100644 index 0000000..d7abd1e --- /dev/null +++ b/app/views/refinery/blog/posts/show.html.erb @@ -0,0 +1,21 @@ +<% content_for :body do %> +
    + <%= render 'post' %> +
    + + <% if Refinery::Blog::Post.comments_allowed? %> + <%= render 'comments'%> + <% end %> +<% end %> + +<%= render '/refinery/blog/shared/body_content_right' %> + +<%= render :partial => "/refinery/content_page", :locals => { :remove_automatic_sections => true } %> + +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> +<% content_for :javascripts do %> + <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> + <%#= javascript_include_tag('refinery/blog/frontend') %> + + +<% end if Refinery::Blog::Post::ShareThis.enabled? %> diff --git a/app/views/refinery/blog/posts/tagged.html.erb b/app/views/refinery/blog/posts/tagged.html.erb new file mode 100644 index 0000000..c22e55b --- /dev/null +++ b/app/views/refinery/blog/posts/tagged.html.erb @@ -0,0 +1,19 @@ +<% content_for :title, "#{t('.posts_tagged')} '#{@tag_name.titleize}'" %> + +<% content_for :body_content_title, "#{t('.posts_tagged')} “#{@tag_name.titleize}”".html_safe -%> + +<% content_for :body do %> + <% if @posts.any? %> +
    + <%= render :partial => "/refinery/blog/shared/post", :collection => @posts %> + <%= will_paginate @posts %> +
    + <% else %> +

    <%= t('.no_blog_articles_yet') %>

    + <% end %> +<% end %> + +<%= render '/refinery/blog/shared/body_content_right' %> + +<%= render "/refinery/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/shared/_body_content_right.html.erb b/app/views/refinery/blog/shared/_body_content_right.html.erb new file mode 100644 index 0000000..b614dca --- /dev/null +++ b/app/views/refinery/blog/shared/_body_content_right.html.erb @@ -0,0 +1,9 @@ +<% content_for :side_body do %> + <%= yield(:side_body_prepend) %> + <%= render "/refinery/blog/shared/rss_feed" %> + <%= render "/refinery/blog/shared/categories" %> + <%= render "/refinery/blog/shared/tags" %> + <%= render "/refinery/blog/shared/posts" %> + <%= blog_archive_widget %> + <%= yield(:side_body_append) %> +<% end %> diff --git a/app/views/refinery/blog/shared/_categories.html.erb b/app/views/refinery/blog/shared/_categories.html.erb new file mode 100644 index 0000000..64f4ee6 --- /dev/null +++ b/app/views/refinery/blog/shared/_categories.html.erb @@ -0,0 +1,10 @@ +<% if @categories.any? %> +

    <%= t('.title') %>

    +
      + <% @categories.each do |category| %> + > + <%= link_to "#{category.title} (#{category.post_count})", refinery.blog_category_path(category) %> + + <% end %> +
    +<% end %> \ No newline at end of file diff --git a/app/views/refinery/blog/shared/_post.html.erb b/app/views/refinery/blog/shared/_post.html.erb new file mode 100644 index 0000000..5b90c8e --- /dev/null +++ b/app/views/refinery/blog/shared/_post.html.erb @@ -0,0 +1,48 @@ +<% if post.live? %> +
    +
    +

    <%= link_to post.title, refinery.blog_post_path(post) %>

    +
    + + <%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{post.author.username}" if post.author.present? %>. + <% if (categories = post.categories).any? %> + + <% end %> + <% if (tags = post.tags).any? %> + + <% end %> +
    +
    +
    + <% if blog_post_teaser_enabled? %> + <%= blog_post_teaser(post) %> + <% else %> + <%= post.body.html_safe %> + <% end %> +
    +
    +

    + <% if blog_post_teaser_enabled? && post.custom_teaser.present? %> + <%= link_to t('read_more', :scope => 'refinery.blog.shared.posts'), refinery.blog_post_path(post) %> + <% end %> +

    + +
    +
    +<% end %> diff --git a/app/views/refinery/blog/shared/_posts.html.erb b/app/views/refinery/blog/shared/_posts.html.erb new file mode 100644 index 0000000..a8064c4 --- /dev/null +++ b/app/views/refinery/blog/shared/_posts.html.erb @@ -0,0 +1,10 @@ +<% if @posts.many? %> +

    <%= t('.other') %>

    +
      + <% @posts.each do |blog_post| %> +
    • + <%= link_to blog_post.title, refinery.blog_post_path(blog_post) %> +
    • + <% end %> +
    +<% end %> \ No newline at end of file diff --git a/app/views/refinery/blog/shared/_rss_feed.html.erb b/app/views/refinery/blog/shared/_rss_feed.html.erb new file mode 100644 index 0000000..27ddf23 --- /dev/null +++ b/app/views/refinery/blog/shared/_rss_feed.html.erb @@ -0,0 +1,2 @@ +

    <%= t('.title') %>

    +<%= link_to t('.subscribe'), refinery.blog_rss_feed_path, :id => "rss_feed_subscribe"%> diff --git a/app/views/refinery/blog/shared/_tags.html.erb b/app/views/refinery/blog/shared/_tags.html.erb new file mode 100644 index 0000000..af91d50 --- /dev/null +++ b/app/views/refinery/blog/shared/_tags.html.erb @@ -0,0 +1,8 @@ +<% if @tags.any? %> +

    <%= t('.title') %>

    + +<% end %> \ No newline at end of file diff --git a/app/views/refinery/blog/widgets/_blog_archive.html.erb b/app/views/refinery/blog/widgets/_blog_archive.html.erb new file mode 100644 index 0000000..b3522c6 --- /dev/null +++ b/app/views/refinery/blog/widgets/_blog_archive.html.erb @@ -0,0 +1,10 @@ +
    +

    <%= t('archives', :scope => 'refinery.blog.shared') %>

    + +
    diff --git a/app/views/refinery/shared/admin/_autocomplete.html.erb b/app/views/refinery/shared/admin/_autocomplete.html.erb new file mode 100644 index 0000000..bf495e0 --- /dev/null +++ b/app/views/refinery/shared/admin/_autocomplete.html.erb @@ -0,0 +1,5 @@ +<% content_for :stylesheets, stylesheet_link_tag("refinery/blog/ui-lightness/jquery-ui-1.8.13.custom") %> + +<% content_for :javascripts do %> + <%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js" %> +<% end %> \ No newline at end of file diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..e6415e6 --- /dev/null +++ b/changelog.md @@ -0,0 +1,69 @@ +## 1.6.3 [UNRELEASED] +* Bulgarian translations [mirosr](https://github.com/mirosr) +* posts/tagged... params[:tag_name] is optional [joemsak](https://github.com/joemsak) + +## 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) + +## 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) + +## 1.6 [20 June 2011] +* Category bug fixes and cleanup [wikyd](https://github.com/wikyd) +* Cleaned up deprecated code [ugisozols](https://github.com/ugisozols) +* Performance boosts (cached slugs) [joemsak](https://github.com/joemsak) +* More translations [cerebroso](https://github.com/cerebroso), [peresleguine](https://github.com/peresleguine) +* 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) + +## 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) + +## 1.4 [26 May 2011] + +* Spanish language fixes [scambra](https://github.com/scambra) +* Bug fixes [scambra](https://github.com/scambra) +* Tags [joemsak](https://github.com/joemsak) +* Tagged posts route / view [joemsak](https://github.com/joemsak) +* Tag cloud in sidebar +* Czech & slovak translations [karem](https://github.com/keram) +* SEO fields and migration [parndt](https://github.com/parndt) [ugisozols](https://github.com/ugisozols) +* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.3...1.4) + +## 1.3 [03 March 2011] + +* Moved to EngineInstaller [parndt](https://github.com/parndt) +* Off Rails 2 support [parndt](https://github.com/parndt) +* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.2...1.3) + +## 1.2 [01 March 2011] + +* Posts can be authored [joemsak](https://github.com/joemsak) +* Front-end pagination [joemsak](https://github.com/joemsak) +* Archives start grouping by year after 2 years [joemsak](https://github.com/joemsak) +* Removed ajax blog post navigation [joemsak](https://github.com/joemsak) +* Administrate uncategorized posts [joemsak](https://github.com/joemsak) +* Categories in has_many :through relationship [joemsak](https://github.com/joemsak) +* General bug fixing & test coverage [parndt](https://github.com/parndt) [joemsak](https://github.com/joemsak) +* Russian translation [iband](https://github.com/iband) +* French translation [AdrienGiboire](https://github.com/AdrienGiboire) +* Polish translation [murbanski](https://github.com/murbanski) +* German translation [gern](https://github.com/gern) +* Spanish translation help [xavib](https://github.com/xavib) +* Rails 3 cleanup & optimization [ugisozols](https://github.com/ugisozols) +* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.1...1.2) + + +## 1.1 [02 December 2010] + +* Rails 3 Support +* Archives +* Categories +* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.0...1.1) \ No newline at end of file diff --git a/config/initializers/url_validator.rb b/config/initializers/url_validator.rb new file mode 100644 index 0000000..d956d04 --- /dev/null +++ b/config/initializers/url_validator.rb @@ -0,0 +1,84 @@ +require 'net/http' + +class UrlValidator < ActiveModel::EachValidator + + def validate_each(record, attribute, value) + url = value + + # Regex code by 'Arsenic' from http://snippets.dzone.com/posts/show/3654 + if url =~ /^ +( (https?):\/\/ )? +( [a-z\d]+([\-\.][a-z\d]+)*\.[a-z]{2,6} ) +( +(: +( \d{1,5} ) +)? +( \/.* )? +)? +$/ix + url = "http#{'s' if $7 == '81'}://#{url}" unless $1 + else + record.errors[attribute] << 'Not a valid URL' + end + + if options[:verify] + begin + url_response = RedirectFollower.new(url).resolve + url = url_response.url if options[:verify] == [:resolve_redirects] + rescue RedirectFollower::TooManyRedirects + record.errors[attribute] << 'URL is redirecting too many times' + rescue + record.errors[attribute] << 'could not be resolved' + end + end + + if options[:update] + value.replace url + end + end +end + +# Code below written by John Nunemaker +# See blog post at http://railstips.org/blog/archives/2009/03/04/following-redirects-with-nethttp/ +class RedirectFollower + class TooManyRedirects < StandardError; end + + attr_accessor :url, :body, :redirect_limit, :response + + def initialize(url, limit=5) + @url, @redirect_limit = url, limit + end + + def logger + @logger ||= Rails.logger + end + + def resolve + raise TooManyRedirects if redirect_limit < 0 + + self.response = Net::HTTP.get_response(URI.parse(url)) + + logger.info "redirect limit: #{redirect_limit}" + logger.info "response code: #{response.code}" + logger.debug "response body: #{response.body}" + + if response.kind_of?(Net::HTTPRedirection) + self.url = redirect_url + self.redirect_limit -= 1 + + logger.info "redirect found, headed to #{url}" + resolve + end + + self.body = response.body + self + end + + def redirect_url + if response['location'].nil? + response.body.match(/]+)\">/i)[1] + else + response['location'] + end + end +end diff --git a/config/locales/bg.yml b/config/locales/bg.yml new file mode 100644 index 0000000..400aa8a --- /dev/null +++ b/config/locales/bg.yml @@ -0,0 +1,158 @@ +bg: + refinery: + plugins: + refinerycms_blog: + title: Блог + blog: + admin: + categories: + category: + edit: Редактиране на тази категория + delete: Изтриване на тази категория завинаги + index: + no_items_yet: 'Все още няма категории. Натиснете "%{create}", за да въведете нова.' + comments: + approved: 'Коментара от "%{author}" бе одобрен.' + comment: + view_live_html: 'Преглед на този коментар
    (ще се отвори се в нов прозорец)' + read: Прочитане на този коментар + reject: Отхвърляне на този коментар + approve: Одобряване на този коментар + rejected: 'Коментара от "%{author}" бе отхвърлен.' + index: + no_items_yet: '%{type} коментари не бяха намерени.' + show: + comment: Коментар + blog_post: Публикация + from: Публикувано от + date: Публикувано на + message: Коментар + details: Детайли + age: Възраст + actions: Действия + back: Обратно към всички коментари + reject: Отхвърляне на този коментар + approve: Одобряване на този коментар + posts: + form: + advanced_options: Разширени настройки + toggle_advanced_options: Натиснете, за да достъпите настройките за етикета "meta" и менюто + save_as_draft: Запис като чернова + published_at: Дата на публикуване + custom_url: Уеб адрес по избор + custom_url_help: Вместо от заглавието, генерирайте уеб адреса за тази публикация чрез този текст. + copy_body: Копиране на съдържанието на публикацията като извадка + copy_body_help: Съдържанието на публикацията ще се копира като извадка. Оставете извадката празна и Refinery автоматично ще я сглоби. + index: + no_items_yet: 'Все още няма публикации. Натиснете "%{create}", за да въведете нова.' + uncategorized: + no_items_yet: 'Не съществуват некатегоризирани публикации.' + post: + view_live_html: 'Преглед на този публикация
    (ще се отвори се в нов прозорец)' + edit: Редактиране на тази публикация + delete: Изтриване на тази публикация завинаги + settings: + notification_recipients: + value: Изпращане на уведомления до + explanation: 'Всеки път, когато някой коментира публикация, Refinery ще изпраща е-писмо, за да уведоми, че съществува нов коментар.' + hint: 'При добавяне на коментар, Refinery ще Ви уведоми по е-пощата.' + example: "Въведете адреса(ите) на Вашата е-поща. Например: jack@work.com, jill@office.com" + updated: 'Уведомления бяха изпратени до "%{recipients}"' + submenu: + categories: + title: Категории + manage: Управление + new: Добавяне на нова категория + comments: + title: Коментари + title_with_count: 'Коментари (%{new_count} нови)' + new: Нови + unmoderated: Нови + approved: Одобрени + rejected: Отхвърлени + posts: + title: Публикации + manage: Управление на публикации + new: Добавяне на нова публикация + uncategorized: Некатегоризирани публикации + settings: + title: Настройки + moderation: Модерация + update_notified: Получатели на уведомления + comments: Коментари + comment_mailer: + notification: + greeting: Здравейте + you_recieved_new_comment: Току що получихте нов коментар на Вашия уебсайт. + comment_starts: --- Начало на коментара --- + comment_ends: --- Край на коментара --- + from: От + email: Е-поща + message: Съобщение + closing_line: Поздрави + ps: 'П.П. Всички Ваши коментари се съхраняват от Refinery в секция "Блог" в подменю "Коментари" и могат да бъдат прегледани по-късно.' + shared: + categories: + title: Категории + rss_feed: + title: RSS хранилка + subscribe: Абониране + posts: + other: Други публикации + created_at: 'Публикувано на %{when}' + read_more: Цялата публикация + comments: + singular: коментар + none: няма коментари + archives: Архиви + tags: + title: "Етикети" + categories: + show: + no_posts: Тук все още няма публикации. + posts: + post: + filed_in: Категория + comment: коментар + comments: + by: 'Публикувано от %{who}' + time_ago: 'преди %{time}' + thank_you: 'Благодаря за Вашия коментар.' + thank_you_moderated: 'Благодаря за Вашия коментар. Съобщението Ви е в опашката за модерация и скоро ще бъде показано.' + index: + no_blog_articles_yet: Все още няма публикувани статии. Очаквайте скоро. + show: + blog_home: Обратно към началото на блога + comments: + title: Коментари + add: Вашият коментар + other: Други публикации + filed_in: Категория + tagged: Отбелязано с + submit: Изпращане на коментар + name: Име + email: Е-поща + message: Съобщение + by: от + tagged: + no_blog_articles_yet: Все още няма публикувани статии. Очаквайте скоро. + posts_tagged: Публикации отбелязани с + archive: + blog_archive_for: 'Архив на блога за %{date}' + no_blog_articles_posted: 'Все още няма публикувани статии за %{date}. Очаквайте скоро.' + activerecord: + models: + refinery/blog_category: Категория + refinery/blog_comment: Коментар + refinery/blog_post: Публикация + attributes: + refinery/blog_category: + title: Заглавие + refinery/blog_comment: + name: Име + email: Е-поща + message: Съобщение + refinery/blog_post: + title: Заглавие + body: Съдържание + teaser: Извадка diff --git a/config/locales/cs.yml b/config/locales/cs.yml new file mode 100644 index 0000000..28b0fb4 --- /dev/null +++ b/config/locales/cs.yml @@ -0,0 +1,128 @@ +cs: + refinery: + plugins: + refinerycms_blog: + title: Blog + blog: + admin: + categories: + category: + edit: Upravit kategorii + delete: Smazat kategorii + index: + no_items_yet: 'Nejsou zde žádné kategorie. Klikni na "%{create}" pro přidání první.' + comments: + approved: 'Komentář od "%{author}" byl schválen.' + comment: + view_live_html: 'Zobrazit živý náhled
    (otevře nové okno)' + read: Zobrazit komentář + reject: Zamítnout komentář + approve: Schválit + rejected: 'Komentář od "%{author}" byl zamítnut.' + index: + no_items_yet: 'Nejsou zde žádné %{type} komentáře.' + show: + comment: Komentář + blog_post: Blog článek + from: Odeslal + date: Datum + message: Komentář + details: Detaily + age: Věk + actions: Akce + back: Zpět na seznam komentářů + reject: Zamítnout komentář + approve: Schváliť komentář + posts: + form: + advanced_options: Pokročilé nastavení + toggle_advanced_options: Klikni pro přístup k nastavením meta tagů a menu + save_as_draft: Uložit jako koncept + published_at: Datum publikování + index: + no_items_yet: 'Nejsou žádné články na blogu. Klikni na "%{create}" pro přidání prvního.' + uncategorized: + no_items_yet: 'Nejsou žádné nekategorizované články.' + post: + view_live_html: 'Zobrazit článek
    (otevře jej v novém okně)' + edit: Upravit článek + delete: Smazat článek + settings: + notification_recipients: + value: Poslat notifikaci pro + explanation: 'Vždycky když někdo přidá komentář, Refinery zašle oznámení.' + hint: 'Vždycky když někdo přidá komentář, Refinery ti pošle oznámení.' + example: "Zadej tvou emailovou adresu(y) jako například: jack@work.com, jill@office.com" + updated: 'Seznam příjemců notifikací "%{recipients}"' + submenu: + categories: + title: Kategorie + manage: Spravovat + new: Nová kategórie + comments: + title: Komentáře + title_with_count: 'Komentáře (%{new_count} nových)' + new: Nový + unmoderated: Nový + approved: Schválený + rejected: Zamítnutý + posts: + title: Články + manage: Spravovat články + new: Vytvořit nový článek + uncategorized: Nekategorizované články + settings: + title: Nastavení + moderation: Moderování + update_notified: Upravit seznam notifikovaných + comments: Komentáře + comment_mailer: + notification: + greeting: Ahoj + you_recieved_new_comment: Máš nový komentář na stránce + comment_starts: --- začátek komentáře --- + comment_ends: --- konec komentáře --- + from: Od + email: Email + message: Zpráva + closing_line: S pozdravem + ps: 'P.S. Všechny komentáře jsou uloženy v sekci "Blog" pod záložkou "Komentáře" v případě pokud by je bylo třeba zobrazit později.' + shared: + categories: + title: Kategorie + rss_feed: + title: RSS zdroj článků + subscribe: Přihlásit k odběru + posts: + other: Další články + created_at: 'Publikován %{when}' + read_more: Celý článek + comments: + singular: komentář + none: žiadne komentáře + archives: Archiv + categories: + show: + no_posts: Nejsou zde žádné články. + posts: + post: + filed_in: Podaný + comment: komentář + comments: + by: 'Odeslal %{who}' + time_ago: '%{time} zpět' + thank_you: 'Díky za komentář.' + thank_you_moderated: 'Děkujeme za Váš komentář. Vaše zpráva čeká na schválení a objeví se v nejbližší době.' + index: + no_blog_articles_yet: Právě nejsou žádné články na blogu. Zůstaňte naladěni. + show: + blog_home: Hlavní stránka blogu + comments: + title: Komentáře + add: Přidat komentář + other: Další články + filed_in: Podaný + submit: Odeslat komentář + archive: + blog_archive_for: 'Blog archiv pro %{date}' + no_blog_articles_posted: 'Nejsou žádné články publikované %{date}.' diff --git a/config/locales/de.yml b/config/locales/de.yml new file mode 100644 index 0000000..30cdc54 --- /dev/null +++ b/config/locales/de.yml @@ -0,0 +1,130 @@ +de: + refinery: + plugins: + refinerycms_blog: + title: Blog + blog: + admin: + categories: + category: + edit: Diese Kategorie bearbeiten + delete: Diese Kategorie dauerhaft entfernen + index: + no_items_yet: 'Es sind noch keine Kategorien vorhanden. Klicken Sie auf "%{create}", um Ihre erste Kategorie hinzuzufügen.' + comments: + approved: 'Der Kommentar von "%{author}" wurde genehmigt.' + comment: + view_live: 'Diesen Kommentar live betrachten
    (öffnet sich in einem neuen Fenster)' + read: Kommentar lesen + reject: Kommentar ablehnen + approve: Kommentar genehmigen + rejected: 'Der Kommentar von "%{author}" wurde abgelehnt.' + index: + no_items_yet: 'Es sind keine %{type}en Kommentare vorhanden.' + show: + comment: Kommentar + blog_post: Artikel + from: Verfasst von + date: Verfasst am + message: Kommentar + details: Details + age: Alter + actions: Aktionen + back: Zurück zu allen Kommentaren + reject: Kommentar ablehnen + approve: Kommentar genehmigen + posts: + form: + advanced_options: Erweiterte Optionen + toggle_advanced_options: 'Klicken, um auf Meta-Tag-Einstellungen und Menüoptionen zuzugreifen' + save_as_draft: Als Entwurf speichern + published_at: Veröffentlichungsdatum + index: + no_items_yet: 'Es sind noch keine Artikel vorhanden. Klicken Sie auf "%{create}", um Ihren ersten Artikel hinzuzufügen.' + uncategorized: + no_items_yet: 'Es sind keine unkategorisierten Artikel vorhanden.' + post: + view_live: 'Diesen Artikel live betrachten
    (öffnet sich in einem neuen Fenster)' + edit: Diesen Artikel bearbeiten + delete: Diesen Artikel dauerhaft entfernen + settings: + notification_recipients: + value: Sende Benachrichtigungen an + explanation: 'Jedes Mal, wenn jemand einen Artikel kommentiert, sendet Refinery eine E-Mail Benachrichtigung aus, um über den neuen Kommentar zu informieren.' + hint: 'Refinery sendet eine E-Mail Benachrichtigung an Sie, wenn ein neuer Kommentar hinzugefügt wurde.' + example: 'Geben Sie Ihre E-Mail-Adresse(n) wie folgt ein: jack@work.com, jill@office.com' + updated: 'Empfänger für Benachrichtigungen wurden auf "%{recipients}" gesetzt' + submenu: + categories: + title: Kategorien + manage: Verwalten + new: Neue Kategorie anlegen + comments: + title: Kommentare + title_with_count: 'Kommentare (%{new_count} neu)' + new: Neu + unmoderated: Neu + approved: Genehmigt + rejected: Abgelehnt + posts: + title: Artikel + manage: Artikel verwalten + new: Neuen Artikel anlegen + uncategorized: Unkategorisierte Artikel + settings: + title: Einstellungen + moderation: Moderation + update_notified: Empfänger für Benachrichtigungen bearbeiten + comments: Kommentare + comment_mailer: + notification: + greeting: Hallo + you_recieved_new_comment: Auf Ihrer Website wurde soeben ein neuer Kommentar hinzugefügt. + comment_starts: --- Kommentar beginnt --- + comment_ends: --- Kommentar endet --- + from: Von + email: E-Mail + message: Nachricht + closing_line: Mit besten Grüßen + ps: 'P.S. Alle Kommentare sind im "Blog" Abschnitt von Refinery - im Untermenü "Kommentare" - gespeichert, falls Sie diese später dort lesen möchten.' + shared: + categories: + title: Kategorien + rss_feed: + title: RSS Feed + subscribe: Abonnieren + posts: + other: Andere Artikel + created_at: 'Verfasst am %{when}' + read_more: Mehr lesen + comments: + singular: Kommentar + none: Keine Kommentare + archives: Archiv + tags: + title: Kategorien + categories: + show: + no_posts: Es sind noch keine Artikel vorhanden. + posts: + post: + filed_in: Gespeichert unter + comment: Kommentar + comments: + by: 'Verfasst von %{who}' + time_ago: 'vor %{time}' + thank_you: 'Danke für den Kommentar.' + thank_you_moderated: 'Danke für den Kommentar. Die Nachricht wurde in die Warteschlange der Moderation gestellt und erscheint in Kürze.' + index: + no_blog_articles_yet: Es wurden noch keine Artikel verfasst. + show: + blog_home: Blog Startseite + comments: + title: Kommentare + add: Neuen Kommentar hinzufügen + other: Andere Artikel + filed_in: Gespeichert unter + submit: Kommentar senden + archive: + blog_archive_for: 'Blog Archiv für %{date}' + no_blog_articles_posted: 'Für %{date} wurden keine Artikel verfasst.' diff --git a/config/locales/en.yml b/config/locales/en.yml index d12605c..1d40e6d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,114 +1,167 @@ en: - plugins: - refinerycms_blog: - title: Blog - admin: + refinery: + plugins: + refinerycms_blog: + title: Blog blog: - categories: - category: - edit: Edit this category - delete: Delete this category forever - index: - no_items_yet: 'There are no categories yet. Click "{{create}}" to add your first category.' - comments: - approved: 'The comment from "{{author}}" has been approved.' - comment: - view_live: View this comment live
    (opens in a new window) - read: Read this comment - reject: Reject this comment - approve: Approve this comment - rejected: 'The comment from "{{author}}" has been rejected.' - index: - no_items_yet: 'There are no {{type}} comments.' - show: - comment: Comment - blog_post: Blog Post - from: Posted by - date: Posted at - message: Comment - details: Details - age: Age - actions: Actions - back: Back to all comments - reject: Reject this comment - approve: Approve this comment - posts: - form: - advanced_options: Advanced Options - toggle_advanced_options: Click to access meta tag settings and menu options - save_as_draft: Save as Draft - published_at: Publish Date - index: - no_items_yet: 'There are no Blog Posts yet. Click "{{create}}" to add your first blog post.' - post: - view_live: View this blog post live
    (opens in a new window) - edit: Edit this blog post - delete: Remove this blog post forever - settings: - notification_recipients: - value: Send notifications to - explanation: 'Every time someone comments on a blog post, Refinery sends out an email to say there is a new comment.' - hint: 'When a new comment is added, Refinery will send an email notification to you.' - example: "Enter your email address(es) like: jack@work.com, jill@office.com" - updated: 'Notification recipients have been set to "{{recipients}}"' - submenu: + admin: + categories: + category: + edit: Edit this category + delete: Delete this category forever + index: + no_items_yet: 'There are no categories yet. Click "%{create}" to add your first category.' + comments: + approved: 'The comment from "%{author}" has been approved.' + comment: + view_live_html: 'View this comment live
    (opens in a new window)' + read: Read this comment + reject: Reject this comment + approve: Approve this comment + rejected: 'The comment from "%{author}" has been rejected.' + index: + no_items_yet: 'There are no %{type} comments.' + show: + comment: Comment + blog_post: Blog Post + from: Posted by + date: Posted at + message: Comment + details: Details + age: Age + actions: Actions + back: Back to all comments + reject: Reject this comment + approve: Approve this comment + posts: + form: + advanced_options: Advanced Options + toggle_advanced_options: Click to access meta tag settings and menu options + save_as_draft: Save as Draft + published_at: Publish Date + custom_url: Custom Url + custom_url_help: Generate the url for the blog post from this text instead of the title. + source_url: Source Url + source_url_help: Stores the url for the source of the post material. + source_url_title: Source Url Title + source_url_title_help: Title for the source url for the post. + author: Author + author_help: Set which user this post will show as the author. + copy_body: Copy Post Body to Teaser + copy_body_help: Copies the post body to the teaser. Leave teaser blank to let Refinery automatically make the teaser. + index: + no_items_yet: 'There are no Blog Posts yet. Click "%{create}" to add your first blog post.' + uncategorized: + no_items_yet: 'There are no Uncategorized Blog Posts.' + post: + view_live_html: 'View this blog post live
    (opens in a new window)' + edit: Edit this blog post + delete: Remove this blog post forever + draft: Draft + settings: + notification_recipients: + value: Send notifications to + explanation: 'Every time someone comments on a blog post, Refinery sends out an email to say there is a new comment.' + hint: 'When a new comment is added, Refinery will send an email notification to you.' + example: "Enter your email address(es) like: jack@work.com, jill@office.com" + updated: 'Notification recipients have been set to "%{recipients}"' + submenu: + categories: + title: Categories + manage: Manage + new: Create new category + comments: + title: Comments + title_with_count: 'Comments (%{new_count} new)' + new: New + unmoderated: New + approved: Approved + rejected: Rejected + posts: + title: Posts + manage: Manage posts + new: Create new post + uncategorized: Uncategorized posts + settings: + title: Settings + moderation: Moderation + update_notified: Update who gets notified + comments: Comments + teasers: Teasers + comment_mailer: + notification: + greeting: Hi there + you_recieved_new_comment: You just received a new comment on your website. + comment_starts: --- comment starts --- + comment_ends: --- comment ends --- + from: From + email: Email + message: Message + closing_line: Kind Regards + ps: 'P.S. All your comments are stored in the "Blog" section of Refinery under the "Comments" submenu should you ever want to view it there later.' + shared: categories: title: Categories - manage: Manage - new: Create new category - comments: - title: Comments - title_with_count: 'Comments ({{new_count}} new)' - new: New - unmoderated: New - approved: Approved - rejected: Rejected + rss_feed: + title: RSS Feed + subscribe: Subscribe posts: - title: Posts - manage: Manage posts - new: Create new post - settings: - title: Settings - moderation: Moderation - update_notified: Update who gets notified - blog: - comment_mailer: - notification: - greeting: Hi there - you_recieved_new_comment: You just received a new comment on your website. - comment_starts: --- comment starts --- - comment_ends: --- comment ends --- - from: From + other: Other Posts + created_at: 'Posted on %{when}' + read_more: Read more + comments: + singular: comment + none: no comments + archives: Archives + tags: + title: "Tags" + categories: + show: + no_posts: There are no posts here yet. + posts: + post: + filed_in: Filed in + comment: comment + comments: + by: 'Posted by %{who}' + time_ago: '%{time} ago' + thank_you: 'Thank you for commenting.' + thank_you_moderated: 'Thank you for commenting. Your message has been placed in the moderation queue and will appear shortly.' + index: + no_blog_articles_yet: There are no blog articles posted yet. Stay tuned. + show: + blog_home: Blog Home + comments: + title: Comments + add: Make a Comment + other: Other Blog Posts + filed_in: Filed in + tagged: Tagged + submit: Send comment + name: Name + email: Email + message: Message + by: By + source: Source + tagged: + no_blog_articles_yet: There are no blog articles posted yet. Stay tuned. + posts_tagged: Posts tagged + archive: + blog_archive_for: 'Archive for %{date}' + no_blog_articles_posted: 'There are no blog articles posted for %{date}. Stay tuned.' + activerecord: + models: + refinery/blog_category: Category + refinery/blog_comment: Comment + refinery/blog_post: Blog post + attributes: + refinery/blog_category: + title: Title + refinery/blog_comment: + name: Name email: Email message: Message - closing_line: Kind Regards - ps: P.S. All your comments are stored in the "Blog" section of Refinery under the "Comments" submenu should you ever want to view it later there. - shared: - categories: - title: Categories - rss_feed: - title: RSS Feed - posts: - other: Other Posts - created_at: 'Posted on {{when}}' - read_more: Read more - comments: - singular: comment - none: no comments - categories: - show: - no_posts: There are no posts here yet. - posts: - comment: comment - comments: - by: 'Posted by {{who}}' - time_ago: '{{time}} ago' - thank_you: 'Thank you for commenting.' - thank_you_moderated: 'Thank you for commenting. Your message has been placed in the moderation queue and will appear shortly.' - show: - comments: - title: Comments - add: Make a Comment - other: Other Blog Posts - filed_in: Filed in - submit: Send comment \ No newline at end of file + refinery/blog_post: + title: Title + body: Body + teaser: Teaser diff --git a/config/locales/es.yml b/config/locales/es.yml new file mode 100644 index 0000000..8c275a7 --- /dev/null +++ b/config/locales/es.yml @@ -0,0 +1,128 @@ +es: + refinery: + plugins: + refinerycms_blog: + title: Blog + blog: + admin: + categories: + category: + edit: Editar esta categoría + delete: Borrar esta categoría para siempre + index: + no_items_yet: 'Todavía no hay categorías. Haz click en "%{create}" para añadir la primera.' + comments: + approved: 'El comentario de "%{author}" ha sido aprobado.' + comment: + view_live_html: 'Ver este comentario
    (se abrirá en una ventana nueva)' + read: Leer este comentario + reject: Rechazar este comentario + approve: Aprovar este comentario + rejected: 'El comentario de "%{author}" ha sido rechazado.' + index: + no_items_yet: 'No hay comentarios %{type}.' + show: + comment: Comentario + blog_post: Entrada en el Blog + from: Enviado por + date: Enviado el + message: Mensaje + details: Detalles + age: Edad + actions: Acciones + back: Volver a todos los comentarios + reject: Rechazar este comentario + approve: Aprovar este comentario + posts: + form: + advanced_options: Opciones avanzadas + toggle_advanced_options: Click para acceder a las opciones de menú y etiquetas + save_as_draft: Guardar Borrador + published_at: Fecha de publicación + index: + no_items_yet: 'Aún no hay entradas en el Blog. Haz click en "%{create}" para añadir el primero' + uncategorized: + no_items_yet: 'No hay entradas en el Blog sin categoría.' + post: + view_live_html: 'Ver entrada
    (se abrirá en una ventana nueva)' + edit: Editar esta entrada + delete: Eliminar esta entrada para siempre + settings: + notification_recipients: + value: Enviar notificaciones a + explanation: 'Cada vez que alguien comente en una entrada, Refinery envia un email para avisar de que hay un nuevo comentario.' + hint: 'Refinery te avisará con un email cada vez que haya un nuevo comentario en tu Blog.' + example: 'Si deseas que las notificaciones lleguen a más de una cuenta, puedes usar comas para separarlas (pepe@direccionpersonal.com, jose@direccionlaboral.com, ...)' + updated: 'Las notifiaciones han sido enviadas a "%{recipients}"' + submenu: + categories: + title: Categorías + manage: Gestionar + new: Añadir categoría + comments: + title: Comentarios + title_with_count: 'Comentarios (%{new_count} nuevos)' + new: Nuevo + unmoderated: Nuevos + approved: Aprobados + rejected: Rechazados + posts: + title: Entradas + manage: Gestionar entradas + new: Crear nueva entrada + uncategorized: Entradas sin categoría + settings: + title: Configuración + moderation: Moderación + update_notified: '¿Quién recibe las notificaciones?' + comments: Comentarios + comment_mailer: + notification: + greeting: Hola + you_recieved_new_comment: Han hecho un nuevo comentario en una de las entradas de tu Blog. + comment_starts: --- inicio comentario --- + comment_ends: --- fin comentario --- + from: De + email: Email + message: Mensaje + closing_line: Saludos + ps: 'P.D. Recuerda que puedes ver todos los comentarios en el apartado "Comentarios" dentro de la sección "Blog".' + shared: + categories: + title: Categorías + rss_feed: + title: Feed RSS + subscribe: Suscribirse + posts: + other: Otras entradas + created_at: 'Enviado hace %{when}' + read_more: Leer más + comments: + singular: comentario + none: no hay comentarios + archives: Archivos + categories: + show: + no_posts: Todavía no hay entradas. + posts: + post: + filed_in: Archivado en + comment: comentario + comments: + by: 'Enviado por %{who}' + time_ago: 'Hace %{time}' + thank_you: Gracias por tu comentario. + thank_you_moderated: 'Gracias por tu comentario. Ha sido enviado a la cola de moderación y, si lo aprobamos, aparecerá dentro de poco.' + index: + no_blog_articles_yet: 'Todavía no hay artículos. ¡Pero vuelve pronto!' + show: + blog_home: 'Página principal del Blog' + comments: + title: Comentarios + add: 'Envía tu comentario' + other: Otros posts + filed_in: Archivado en + submit: Enviar comentario + archive: + blog_archive_for: 'Archivo del blog en %{date}' + no_blog_articles_posted: 'No hay entradas publicadas en %{date}.' diff --git a/config/locales/fr.yml b/config/locales/fr.yml new file mode 100644 index 0000000..661dd9f --- /dev/null +++ b/config/locales/fr.yml @@ -0,0 +1,154 @@ +fr: + refinery: + plugins: + refinerycms_blog: + title: Blog + blog: + admin: + categories: + category: + edit: Modifier cette catégorie + delete: Supprimer cett catégorie + index: + no_items_yet: 'Il n''y a aucune catégorie pour le moment. Cliquez sur "%{create}" pour ajouter votre première catégorie.' + comments: + approved: 'Le commentaire de "%{author}" a été approuvé.' + comment: + view_live_html: 'Voir ce commentaire
    (Ouvre une nouvelle fenêtre)' + read: Lire ce commentaire + reject: Rejeter ce commentaire + approve: Approuver ce commentaire + rejected: 'Le commentaire de "%{author}" a été rejeté.' + index: + no_items_yet: 'Il n''y aucun %{type} de commentaires.' + show: + comment: Commenter + blog_post: Article + from: Écrit par + date: Écrit le + message: Commentaire + details: Détails + age: Âge + actions: Actions + back: Retour à la liste des commentaires + reject: Rejeter ce commentaire + approve: Approuver ce commentaire + posts: + form: + advanced_options: Options avancées + toggle_advanced_options: Cliquez ici pour accéder aux paramêtres des meta-tags et au menu des options + save_as_draft: Enregistrer comme Brouillon + published_at: Date de publication + index: + no_items_yet: 'Il n''y a aucun article pour l''instant. Cliquez sur "%{create}" pour ajouter votre premier article.' + uncategorized: + no_items_yet: 'Il n''y a aucun article non catégorisé.' + post: + view_live_html: 'Voir cet article sur le site
    (Ouvre une nouvelle fenêtre)' + edit: Modifier cet article + delete: Supprimer cet article + settings: + notification_recipients: + value: Envoyer les notifications à + explanation: 'Chaque fois que quelqu''un écrit un commentaire sur un article, Refinery envoie un e-mail pour prévenir qu''il y a un nouveau commentaire.' + hint: 'Quand un nouveau commentaire est ajouté, Refinery vous enverra un e-mail de notifications.' + example: "Entrez une/des adresse(s) e-mail comme : jack@work.com, jill@office.com" + updated: 'Les destinataires des notifications sont définis : "%{recipients}"' + submenu: + categories: + title: Catégories + manage: Gérer + new: Créer une nouvelle catégorie + comments: + title: Commentaires + title_with_count: 'Commentaires (%{new_count} nouveau(x))' + new: Nouveau + unmoderated: Nouveau + approved: Approuvé + rejected: Rejeté + posts: + title: Articles + manage: Gérer les articles + new: Créer un nouvel article + uncategorized: Aricles non catégorisés + settings: + title: Paramêtres + moderation: Modération + update_notified: Mettre à jour les personnes à notifier + comments: Commentaires + comment_mailer: + notification: + greeting: Bonjour + you_recieved_new_comment: Il y a un nouveau commentaire sur le blog. + comment_starts: --- comment starts --- + comment_ends: --- comment ends --- + from: De + email: Email + message: Message + closing_line: Cordialement + ps: P.S. Tous les commentaires sont stockés dans la section "Blog" de Refinery dans le menu "Commentaires" si vous voulez les revoir plus tard. + shared: + categories: + title: Catégories + rss_feed: + title: Flux RSS + subscribe: Souscrire + posts: + other: Autres articles + created_at: 'Écrit le %{when}' + read_more: Lire la suite + by: 'par' + comments: + singular: commentaire + none: aucun commentaire + archives: Archives + tags: + title: "Mots clés" + categories: + show: + no_posts: 'Il n''y a aucun article pour cette catégorie.' + posts: + post: + filed_in: Classé dans + comment: commentaire + comments: + by: 'Écrit par %{who}' + time_ago: 'il y a %{time} ' + thank_you: 'Merci pour votre commentaire.' + thank_you_moderated: 'Merci pour votre commentaire. Votre message a été placé en attente de validation et apparaitra bientôt.' + index: + no_blog_articles_yet: "Il n'y a aucun article pour l'instant. Restez en alerte." + show: + blog_home: Accueil du blog + comments: + title: Commentaires + add: Ajouter un commentaire + other: Autres articles + filed_in: Classé dans + tagged: Taggé + submit: Envoyer le commentaire + name: Nom + email: Email + message: Message + by: par + tagged: + no_blog_articles_yet: "Il n'y a aucun article pour l'instant. Restez en alerte." + posts_tagged: Articles taggés + archive: + blog_archive_for: 'Archive du blog pour le %{date}' + no_blog_articles_posted: "Il n'y a aucun article pour la date du %{date}. Restez en alerte." + activerecord: + models: + refinery/blog_category: Categorie + refinery/blog_comment: Commentaire + refinery/blog_post: Article + attributes: + refinery/blog_category: + title: Titre + refinery/blog_comment: + name: Nom + email: Email + message: Message + refinery/blog_post: + title: Titre + body: Corps diff --git a/config/locales/it.yml b/config/locales/it.yml index 93fdaf6..11fa53a 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1,104 +1,156 @@ it: - plugins: - refinerycms_blog: - title: Blog - admin: + refinery: + plugins: + refinerycms_blog: + title: Blog blog: - categories: - category: - edit: Modifica questa categoria - delete: Elimina questa categoria per sempre - index: - no_items_yet: 'Nessuna categoria ancora presente. Fare click su "{{create}}" per aggiungere la tua prima categoria.' - comments: - approved: 'Il commento di "{{author}}" è stato approvato.' - comment: - view_live: Visualizza questo commento
    live (si apre in una nuova finestra) - read: Leggi questo commento - reject: Rifiuta questo commento - approve: Approva questo commento - rejected: 'Il commento di "{{author}}" è stato rifiutato.' - index: - no_items_yet: 'Non ci sono {{type}} commenti.' - show: - comment: Commento - blog_post: Messaggio del Blog - from: Pubblicato da - date: Pubblicato il - message: Commento - details: Dettagli - age: età - actions: Azioni - back: Torna a tutti i commenti - reject: Rifiuta questo commento - approve: Approva questo commento - posts: - form: - advanced_options: Opzioni Avanzate - toggle_advanced_options: Clicca per accedere alle impostationi dei meta tag e del menu - save_as_draft: Salva come Bozza - published_at: Data di Pubblicazione - index: - no_items_yet: 'Non ci sono ancora Messaggi per questo Blog. Clicca "{{create}}" per aggiungere il tuo primo messaggio.' - post: - view_live: Visualizza questo messaggio live
    (si apre in una nuova finestra) - edit: Modifica questo messaggio - delete: Rimuovi questo messaggio per sempre - settings: - notification_recipients: - value: Inviare notifiche a - explanation: "Ogni volta che qualcuno commenta un messaggio del blog, Refinery invia una mail per avvisare che c'è un nuovo comemnto" - hint: 'Quando viene aggiunto un nuovo commento Refinery ti invierà una email di notifica.' - example: "Inserisci il tuo indirizzo email. È possibile insierire più indirizzi separati dalla virgola. Es: jack@work.com, jill@office.com" - updated: 'I destinatari delle notifiche sono stati impostati "{{recipients}}"' - submenu: + admin: + categories: + category: + edit: Modifica questa categoria + delete: Elimina questa categoria per sempre + index: + no_items_yet: 'Nessuna categoria ancora presente. Fare click su "%{create}" per aggiungere la tua prima categoria.' + comments: + approved: 'Il commento di "%{author}" è stato approvato.' + comment: + view_live_html: 'Visualizza questo commento
    live (si apre in una nuova finestra)
    ' + read: Leggi questo commento + reject: Rifiuta questo commento + approve: Approva questo commento + rejected: 'Il commento di "%{author}" è stato rifiutato.' + index: + no_items_yet: 'Non ci sono %{type} commenti.' + show: + comment: Commento + blog_post: Articolo + from: Pubblicato da + date: Pubblicato il + message: Commento + details: Dettagli + age: età + actions: Azioni + back: Torna a tutti i commenti + reject: Rifiuta questo commento + approve: Approva questo commento + posts: + form: + advanced_options: Opzioni Avanzate + toggle_advanced_options: Clicca per accedere alle impostationi dei meta tag e del menu + save_as_draft: Salva come Bozza + published_at: Data di Pubblicazione + custom_url: Url personalizzato + custom_url_help: Puoi scegliere un url specifico per questo articolo. Lasciando questo campo vuoto verrà utilizzato il titolo. + copy_body: Copia il testo dell'articolo nel teaser + copy_body_help: Lascia il teaser bianco per creare il teaser automaticamente. + index: + no_items_yet: 'Non ci sono ancora articoli in questo Blog. Clicca su "%{create}" per aggiungerne uno.' + uncategorized: + no_items_yet: 'Non ci sono articoli senza categoria.' + post: + view_live_html: 'Visualizza questo articolo sul sito
    (si aprirà in una nuova finestra)' + edit: Modifica questo articolo + delete: Rimuovi questo articolo per sempre + settings: + notification_recipients: + value: Inviare notifiche a + explanation: "Ogni volta che qualcuno commenta un articolo, Refinery invia una mail per avvisare che c'è un nuovo comemnto" + hint: 'Quando viene aggiunto un nuovo commento Refinery ti invierà una email di notifica.' + example: "Inserisci il tuo indirizzo email. È possibile insierire più indirizzi separati dalla virgola. Es: jack@work.com, jill@office.com" + updated: 'I destinatari delle notifiche sono stati impostati "%{recipients}"' + submenu: + categories: + title: Categorie + manage: Gestione categorie + new: Crea una nuova categoria + comments: + title: Commenti + title_with_count: 'Commenti (%{new_count} nuovi)' + new: Nuovo + unmoderated: Nuovo + approved: Approvato + rejected: Rifiutato + posts: + title: Articoli + manage: Gestione articoli + new: Crea un nuovo articolo + uncategorized: Articoli senza categoria + settings: + title: Impostazioni + moderation: Moderazione + update_notified: Aggiornare i destinatari delle notifiche + comments: Commenti + comment_mailer: + notification: + greeting: Ciao + you_recieved_new_comment: Hai ricevuto un commento sul tuo sito. + comment_starts: --- inizio commento --- + comment_ends: --- fine commento --- + from: Da + email: Email + message: Testo + closing_line: Saluti + ps: 'P.S. Tutti i commenti sono memorizzati nella sezione "Blog di Refinery sotto la voce "Commenti" se mai volessi visualizzarli lì.' + shared: categories: title: Categorie - manage: Gestione categorie - new: Crea nuova categoria - comments: - title: Commenti - title_with_count: 'Comment1 ({{new_count}} nuovi)' - new: Nuovo - unmoderated: Nuovo - approved: Approvato - rejected: Rifiutato + rss_feed: + title: RSS Feed + subscribe: Iscriviti posts: - title: Messaggi - manage: Gestione post - new: Crea nuovo post - settings: - title: Impostazioni - moderation: Moderazione - update_notified: Aggiornare destinatario notifica - blog: - shared: - categories: - title: Categorie - rss_feed: - title: RSS Feed - posts: - other: Altri Messaggi - created_at: 'Pubblicato il {{when}}' - read_more: Per saperne di più - comments: - singular: commento - plural: commenti - none: nessun commento - categories: - show: - no_posts: Nessun messaggio ancora presente. - posts: - comment: commento - comments: - by: 'Pubblicato da {{who}}' - time_ago: '{{time}} fa' - thank_you: 'Grazie per aver scritto un commento.' - thank_you_moderated: 'Grazie per aver scritto un commento. Il tuo messaggio è stato inserito nella coda di moderazione e sarà visibile a breve.' - show: + other: Altri Articoli + created_at: 'Pubblicato il %{when}' + read_more: Continua a leggere comments: - title: Commenti - add: Scrivi un Commento - other: Altri Messaggi del Blog - filed_in: Archiviato in - submit: Invia commento \ No newline at end of file + singular: commento + plural: commenti + none: nessun commento + tags: + title: "Tags" + categories: + show: + no_posts: Non sono ancora presenti articoli. + posts: + post: + filed_in: Archiviato in + comment: commento + comments: + by: 'Pubblicato da %{who}' + time_ago: '%{time} fa' + thank_you: 'Grazie per aver scritto un commento.' + thank_you_moderated: 'Grazie per aver scritto un commento. Il tuo messaggio è stato inserito nella coda di moderazione e sarà visibile a breve.' + index: + no_blog_articles_yet: Non sono stati ancora pubblicati articoli nel blog. Continuate a seguirci. + show: + comments: + title: Commenti + add: Scrivi un Commento + other: Altri Articoli + filed_in: Archiviato in + submit: Invia commento + tagged: Taggato + name: Nome + email: Email + message: Articolo + by: da + tagged: + no_blog_articles_yet: Non sono stati ancora pubblicati articoli nel blog. Continuate a seguirci. + posts_tagged: Articoli taggati + archive: + blog_archive_for: 'Articoli pubblicati il %{date}' + no_blog_articles_posted: Non sono stati pubblicati articoli nel blog il %{date}. Continuate a seguirci. + activerecord: + models: + refinery/blog_category: Categoria + refinery/blog_comment: Commento + refinery/blog_post: Articolo + attributes: + refinery/blog_category: + title: Titolo + refinery/blog_comment: + name: Nome + email: Email + message: Testo + refinery/blog_post: + title: Titolo + body: Testo diff --git a/config/locales/ja.yml b/config/locales/ja.yml new file mode 100644 index 0000000..1ffd25f --- /dev/null +++ b/config/locales/ja.yml @@ -0,0 +1,158 @@ +ja: + refinery: + plugins: + refinerycms_blog: + title: ブログ + blog: + admin: + categories: + category: + edit: このカテゴリを編集 + delete: このカテゴリを削除 + index: + no_items_yet: 'まだカテゴリが一つも登録されていません。「%{create}」をクリックし、カテゴリを作成して下さい。' + comments: + approved: '「%{author}さん」の投稿が承認されました。' + comment: + view_live_html: 'このコメントを見る
    (新規ウインドウに開かれます)' + read: このコメントを読む + reject: このコメントを却下する + approve: このコメントを承認する + rejected: '「%{author}」によるコメントが却下されました。' + index: + no_items_yet: '%{type}に関するコメントがありません。' + show: + comment: コメント + blog_post: 投稿 + from: 投稿者 + date: 投稿時刻 + message: コメント + details: 詳細 + age: 投稿から + actions: アクション + back: 全てのコメントに戻る + reject: このコメントを却下する + approve: このコメントを承認する + posts: + form: + advanced_options: 詳細オプション + toggle_advanced_options: メタタグの設定メニューをアクセスするにはここをクリックして下さい + save_as_draft: 下書きとして保存 + published_at: 公開時刻 + custom_url: カスタムURL + custom_url_help: 投稿のURLをここのテキストとして登録する。 + copy_body: 本文を短説明文にコピーする + copy_body_help: 短説明文として本文を引用します。短説明文を空にすると自動的に反映されます。 + index: + no_items_yet: '投稿がありません。「%{create}」をクリックし、作成して下さい。' + uncategorized: + no_items_yet: '未分類の投稿がありませす。' + post: + view_live_html: 'この投稿を見る。
    (新規ウィンドウに開かれます)' + edit: この投稿を編集する + delete: この投稿を削除する + settings: + notification_recipients: + value: 通知の受信者 + explanation: '投稿にコメントが出される度にRefineryが通知を送れます。' + hint: 'コメントが追加されたらメールで通知されます。' + example: "複数のメールアドを登録することが出来ます。入力例: jack@work.com, jill@office.com" + updated: '通知受信者の「%{recipients}」に通知が送信されました。' + submenu: + categories: + title: カテゴリ + manage: 管理 + new: 新規カテゴリ作成 + comments: + title: コメント + title_with_count: 'コメント (新規%{new_count}通)' + new: 新規 + unmoderated: 新規 + approved: 承認された + rejected: 却下された + posts: + title: 投稿 + manage: 投稿管理 + new: 新規投稿 + uncategorized: 未分類 + settings: + title: 設定 + moderation: 管理する + update_notified: 通知者を変更・更新する + comments: コメント + comment_mailer: + notification: + greeting: こんにちわ + you_recieved_new_comment: サイトに新規コメントが投稿されました。 + comment_starts: --- コメント開始 --- + comment_ends: --- コメント終了 --- + from: 差出人 + email: メール + message: メッセージ + closing_line: 以上、 + ps: '追記: 全てのコメントを見るにはRefineryブログの「コメント」に参照して下さい。' + shared: + categories: + title: カテゴリ + rss_feed: + title: RSSフィード + subscribe: フィードを登録する + posts: + other: 他の投稿 + created_at: '%{when}に投稿' + read_more: もっと読む + comments: + singular: コメント + none: コメントが未登録 + archives: アーカイブ + tags: + title: "タグ" + categories: + show: + no_posts: 投稿がありません。 + posts: + post: + filed_in: に分類されている + comment: コメント + comments: + by: '%{who}より' + time_ago: '%{time}前に' + thank_you: 'コメントをありがとうございます。' + thank_you_moderated: 'コメントをありがとうございます。コメントが承認待ちとされています。承認次第公開されます。' + index: + no_blog_articles_yet: ブログ記事がまだ投稿されてません。 + show: + blog_home: ブログ・ホーム + comments: + title: コメント + add: コメントを投稿 + other: 他のブログ投稿 + filed_in: に分類されている + tagged: とのタグが付いている + submit: コメントを送信 + name: 名前 + email: メール + message: メッセージ + by: '投稿者:' + tagged: + no_blog_articles_yet: ブログ記事がまだ投稿されてません。 + posts_tagged: 投稿タグ + archive: + blog_archive_for: '%{date}搭載のブログ記事' + no_blog_articles_posted: '%{date}付のブログ記事が投稿されてません。' + activerecord: + models: + refinery/blog_category: カテゴリ + refinery/blog_comment: コメント + refinery/blog_post: 投稿 + attributes: + refinery/blog_category: + title: 題名 + refinery/blog_comment: + name: 名前 + email: メール + message: メッセージ + refinery/blog_post: + title: 題名 + body: 本文 + teaser: 短紹介文 diff --git a/config/locales/nb.yml b/config/locales/nb.yml index de79479..5ee8057 100644 --- a/config/locales/nb.yml +++ b/config/locales/nb.yml @@ -1,23 +1,31 @@ nb: - plugins: - refinerycms_blog: - title: Blog - admin: + refinery: + plugins: + refinerycms_blog: + title: Blog blog: - posts: - index: - no_items_yet: Det er ingen Blog Posts enda. Klikk på "Lag en ny Blog Posts" for å legge til din første blog posts. - post: - view_live: Vis hvordan denne blog post ser ut offentlig
    (åpner i et nytt vindu) - edit: Rediger denne blog post - delete: Fjern denne blog post permanent - submenu: - comments: - new: ny + admin: posts: - new: Lag en ny post - settings: - update_notified: Oppdater hvem som blir informert - blog_posts: - show: - other: Andre Blog Posts \ No newline at end of file + form: + seo_override_title: Nettleser tittel + seo_override_title_help: Skriv inn en tittel på 5-10 ord som oppsummerer innholdet på siden. + meta_keywords_title: Meta stikkord + meta_keywords_help: Skriv inn 5-10 stikkord som relaterer til denne siden. Separer stikkordene med komma. + meta_description_title: Meta beskrivelse + meta_description_help: Skriv en kort beskrivelse på to eller tre setninger som forteller hva denne siden inneholder. + index: + no_items_yet: 'Det er ingen Blog Posts enda. Klikk på "Lag en ny Blog Posts" for å legge til din første blog posts.' + post: + view_live: 'Vis hvordan denne blog post ser ut offentlig
    (åpner i et nytt vindu)' + edit: Rediger denne blog post + delete: Fjern denne blog post permanent + submenu: + comments: + new: ny + posts: + new: Lag en ny post + settings: + update_notified: Oppdater hvem som blir informert + blog_posts: + show: + other: Andre Blog Posts diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 41077ac..6842d4a 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1,23 +1,134 @@ nl: - plugins: - refinerycms_blog: - title: Blog - admin: + refinery: + plugins: + refinerycms_blog: + title: Blog blog: - posts: - index: - no_items_yet: Er zijn nog geen Blog Post. Druk op 'Maak een nieuwe Blog Post' om de eerste aan te maken. - post: - view_live: Bekijk deze blog posts op de website
    (opent een nieuw venster) - edit: Bewerk deze blog post - delete: Verwijder deze blog post voor eeuwig - submenu: + admin: + categories: + category: + edit: Bewerk deze categorie + delete: Verwijder deze categorie definitief + index: + no_items_yet: 'Er zijn momenteel geen categorien. Klik op "%{create}" om uw eerste categorie toe te voegen.' comments: - new: Nieuwe + approved: 'De reactie van "%{author}" is goedgekeurd.' + comment: + view_live_html: 'Bekijk deze reactie op de website
    (opent in een nieuw venster)' + read: Lees deze reactie + reject: Keur deze reactie af + approve: Keur deze reactie goed + rejected: 'De reactie van "%{author}" is afgekeurd.' + index: + no_items_yet: 'Er zijn geen %{type} reacties.' + show: + comment: Reactie + blog_post: Blogpost + from: Gepost door + date: Gepost op + message: Reactie + details: Details + age: Leeftijd + actions: Acties + back: Terug naar alle reacties + reject: Keur deze reactie af + approve: Keur deze reactie goed posts: - new: Maak een nieuwe post + form: + advanced_options: Geavanceerde eigenschappen + toggle_advanced_options: Klik voor toegang tot meta tag instellingen en menu opties + save_as_draft: Sla op als concept + published_at: Publicatiedatum + index: + no_items_yet: 'Er zijn momenteel geen blogposts. Klik op "%{create}" om uw eerste blogpost toe te voegen.' + uncategorized: + no_items_yet: 'Er zijn geen ongecategoriseerde blogposts.' + post: + view_live_html: 'Bekijk deze blogpost op de website
    (opent in een nieuw venster)' + edit: Bewerk deze blogpost + delete: Verwijder deze blogpost definitief settings: - update_notified: Wijzig wie een notificatie ontvangt - blog_posts: - show: - other: Andere Blog Post \ No newline at end of file + notification_recipients: + value: Stuur notificaties naar + explanation: 'Bij elke nieuwe reactie op een blogpost stuurt Refinery u een e-mail om dit te melden.' + hint: 'Als er een reactie is toegevoegd stuurt Refinery een e-mail notificatie naar u.' + example: "Voer uw e-mailadres(sen) in, bijvoorbeeld: jack@work.com, jill@office.com" + updated: 'De ontvanger(s) van notificaties is/zijn gewijzigd naar "%{recipients}"' + submenu: + categories: + title: Categorien + manage: Beheren + new: Voeg een nieuwe categorie toe + comments: + title: Reacties + title_with_count: 'Reacties (%{new_count} nieuwe)' + new: Nieuw + unmoderated: Nieuw + approved: Goedgekeurd + rejected: Afgekeurd + posts: + title: Posts + manage: Beheer posts + new: Voeg een nieuwe post toe + uncategorized: Ongecategoriseerde posts + settings: + title: Instellingen + moderation: Stuur notificaties + update_notified: Wijzig wie notificaties ontvangt + comments: Reacties + teasers: Teasers + comment_mailer: + notification: + greeting: Hallo + you_recieved_new_comment: Er is zojuist een reactie geplaatst op uw website. + comment_starts: --- begin reactie --- + comment_ends: --- einde reactie --- + from: Van + email: E-mail + message: Bericht + closing_line: Met vriendelijke groet + ps: 'P.S. Alle reacties worden opgeslagen in de "Blog" sectie van Refinery onder het submenu "Comments", voor als u deze reacties later wilt bekijken.' + shared: + categories: + title: Categorien + rss_feed: + title: RSS Feed + subscribe: Aanmelden + posts: + other: Andere posts + created_at: 'Gepost op %{when}' + read_more: Lees verder + comments: + singular: Reactie + none: Geen reacties + archives: Archief + tags: + title: "Tags" + categories: + show: + no_posts: Er zijn momenteel geen posts. + posts: + post: + filed_in: Toegevoegd aan + comment: Reactie + comments: + by: 'Gepost door %{who}' + time_ago: '%{time} geleden' + thank_you: 'Bedankt voor uw reactie.' + thank_you_moderated: 'Bedankt voor uw reactie. Uw reactie is in de wachtrij geplaatst en zal binnenkort verschijnen.' + index: + no_blog_articles_yet: Er zijn momenteel nog geen blogposts. Neem regelmatig een kijkje. + show: + blog_home: Blog Home + comments: + title: Reacties + add: Plaats een reactie + other: Andere blogposts + filed_in: Toegevoegd aan + tagged: Tagged + submit: Verstuur reactie + tagged: + no_blog_articles_yet: Er zijn momenteel nog geen blogposts. Neem regelmatig een kijkje. + archive: + blog_archive_for: 'Blog archief voor %{date}' + no_blog_articles_posted: 'Er zijn geen blogposts voor %{date}. Neem regelmatig een kijkje.' diff --git a/config/locales/pl.yml b/config/locales/pl.yml new file mode 100644 index 0000000..ade7e83 --- /dev/null +++ b/config/locales/pl.yml @@ -0,0 +1,134 @@ +pl: + refinery: + plugins: + refinerycms_blog: + title: Blog + blog: + admin: + categories: + category: + edit: Edytuj tą kategorię + delete: Usuń na zawsze + index: + no_items_yet: 'W tej chwili nie ma żadnych kategorii. Kliknij "%{create}" aby dodać pierwszą.' + comments: + approved: 'Komentarz "%{author}" został zaakceptowany.' + comment: + view_live: 'Zobacz ten komentarz na żywo
    (otwiera w nowym oknie)' + read: Pokaż ten komentarz + reject: Odrzuć ten komentarz + approve: Zaakceptuj ten komentarz + rejected: 'Komentarz "%{author}" został odrzucony.' + index: + no_items_yet: 'Nie ma więcej komentarzy typu "%{type}".' + show: + comment: Komentarz + blog_post: Post + from: Autor + date: Data + message: Komentarz + details: Szczegóły + age: Wiek + actions: Akcje + back: Powrót do listy komentarzy + reject: Odrzuć ten komentarz + approve: Zaakceptuj ten komentarz + posts: + form: + advanced_options: Opcje zaawansowane + toggle_advanced_options: 'Kliknij, aby zarządzać meta-ustawieniami' + save_as_draft: Zapisz jako szkic + published_at: Data publikacji + index: + no_items_yet: 'Na blogu nie ma jeszcze żadnych wpisów. Kliknij "%{create}" aby dodać pierwszy post.' + uncategorized: + no_items_yet: 'Brak nieskategoryzowanych wpisów na blogu.' + post: + view_live: 'Zobacz ten post na żywo
    (otwiera w nowym oknie)' + edit: Edytuj ten post + delete: Usuń ten post na zawsze + settings: + notification_recipients: + value: Powiadomienia wysyłane do + explanation: 'Gdy zostanie dodany nowy komentarz, system wyśle powiadomienie przez e-mail.' + hint: 'Gdy zostanie dodany nowy komentarz, system wyśle powiadomienie przez e-mail.' + example: 'Podaj adresy e-mail oddzielone przecinkiem, np: jack@work.com, jill@office.com' + updated: 'Powiadomienia będą wysyłane do "%{recipients}"' + submenu: + categories: + title: Kategorie + manage: Zarządzaj kategoriami + new: Dodaj nową kategorię + comments: + title: Komentarze + title_with_count: 'Komentarze (%{new_count} nowych)' + new: Nowe + unmoderated: Nowe + approved: Zaakceptowane + rejected: Odrzucone + posts: + title: Posty + manage: Zarządzaj postami + new: Dodaj nowy post + uncategorized: Posty bez kategorii + settings: + title: Ustawienia + moderation: Wł./wył. moderację + update_notified: Powiadamianie przez e-mail + comments: Komentarze + comment_mailer: + notification: + greeting: Witaj:) + you_recieved_new_comment: Właśnie otrzymałeś nowy komentarz na swojej stronie! + comment_starts: --- początek komentarza --- + comment_ends: --- koniec komentarza --- + from: Od + email: Email + message: Treść + closing_line: Pozdrawiamy + ps: 'P.S. Wszystkie komentarze przechowywane są w panelu zarządzania, w sekcji "Blog" i podmenu "Komentarze". ' + shared: + categories: + title: Kategorie + rss_feed: + title: RSS Feed + subscribe: Sukskrybuj + posts: + other: Pozostałe posty + created_at: 'Data: %{when}' + read_more: Więcej + comments: + singular: komentarz + none: brak komentarzy + archives: Archiwum + categories: + show: + no_posts: Nie ma jeszcze żadnych postów. + posts: + post: + filed_in: 'kategorie:' + comment: komentarz + comments: + by: 'Autor: %{who}' + time_ago: '%{time} temu' + thank_you: 'Dziękujemy za Twój komentarz.' + thank_you_moderated: 'Dziękujemy za Twój komentarz. Został on przekazany do moderacji i niedługo pojawi się na stronie.' + index: + no_blog_articles_yet: W tej chwili nie ma jeszcze żadnych postów. Cierpliwości:) + show: + blog_home: Blog + comments: + title: Komentarze + add: Dodaj komentarz + other: Pozostałe wpisy + filed_in: 'kategorie:' + submit: Dodaj komentarz + archive: + blog_archive_for: 'Archiwum dla %{date}' + no_blog_articles_posted: 'Brak wpisów dla daty %{date}.' + activerecord: + attributes: + refinery/blog_comment: + name: "Imię" + email: "Email" + message: "Treść" diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml new file mode 100644 index 0000000..f5fe701 --- /dev/null +++ b/config/locales/pt-BR.yml @@ -0,0 +1,138 @@ +pt-BR: + refinery: + plugins: + refinerycms_blog: + title: Blog + blog: + admin: + categories: + category: + edit: Editar esta categoria + delete: Apagar esta categoria para sempre + index: + no_items_yet: 'Não há categorias ainda. Clique em "%{create}" para adicionar a primeira categoria.' + comments: + approved: 'O comentário de "%{author}" foi aprovado.' + comment: + view_live_html: 'Ver este comentário
    (será aberto em outra janela)' + read: Ler este comentário + reject: Rejeitar este comentário + approve: Aprovar este comentário + rejected: 'O comentário de "%{author}" foi rejeitado.' + index: + no_items_yet: 'Não há %{type} comentários.' + show: + comment: Comentário + blog_post: Post + from: Postado por + date: Postado em + message: Comentário + details: Detalhes + age: Idade + actions: Ações + back: Voltar para todos os comentários + reject: Rejeitar este comentário + approve: Aprovar este comentário + posts: + form: + advanced_options: Opções avançadas + 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 + index: + no_items_yet: 'Ainda não há Posts no Blog. Clique em "%{create}" para adicionar o primeiro post.' + uncategorized: + no_items_yet: 'Ainda não há posts sem categoria.' + post: + view_live_html: 'Ver este comentário
    (será aberto em outra janela)' + edit: Editar este post + delete: Remover esse post para sempre + settings: + notification_recipients: + value: Enviar notificações para + explanation: 'Cada vez que alguém comenta em um post no blog, é enviado um e-mail para informar que há um novo comentário.' + hint: 'Quando um novo comentário é adicionado, será enviado uma notificação por e-mail para você.' + example: 'Entre com o(s) seu(s) endereço(s) de email, como: jack@work.com, jill@office.com' + updated: 'As notificações foram enviadas para "%{recipients}"' + submenu: + categories: + title: Categorias + manage: Gerenciar + new: Criar nova categoria + comments: + title: Comentários + title_with_count: 'Comentários (%{new_count} novos)' + new: Novo + unmoderated: Novo + approved: Aprovado + rejected: Rejeitado + posts: + title: Posts + manage: Gerenciar posts + new: Criar novo post + uncategorized: Posts sem categoria + settings: + title: Configurações + moderation: Moderação + update_notified: Quem receberá a notificação? + comments: Comentários + comment_mailer: + notification: + greeting: Olá + you_recieved_new_comment: Você acaba de receber um novo comentário em seu site. + comment_starts: --- Início do comentário --- + comment_ends: --- Fim do comentário --- + from: De + email: Email + message: Mensagem + closing_line: Atenciosamente + ps: 'P.S. Lembre-se que você pode ver todos os comentários em "Comentários" dentro da seção "Blog".' + shared: + categories: + title: Categorias + rss_feed: + title: Feed RSS + subscribe: Assinar + posts: + other: Últimos posts + created_at: 'Postado em %{when}' + read_more: Continue lendo... + comments: + singular: comentário + none: não há comentários + archives: Arquivos + tags: + title: Tags + categories: + show: + no_posts: Não há posts aqui ainda. + posts: + comment: commentário + comments: + by: 'Postado por %{who}' + time_ago: '%{time} atrás' + thank_you: 'Obrigado por comentar.' + thank_you_moderated: 'Obrigado por comentar. Sua mensagem foi colocada na fila de moderação e será exibida em breve.' + index: + no_blog_articles_yet: Ainda não há artigos postados no blog. + show: + blog_home: Blog Home + comments: + title: Comentários + add: Fazer um comentário + other: Outros posts + filed_in: Arquivado em + submit: Enviar comentário + archive: + blog_archive_for: 'Arquivo do blog em %{date}' + no_blog_articles_posted: 'Não há arquivos do blog em %{date}.' + post: + filed_in: Arquivado em + activerecord: + attributes: + refinery/blog_post: + title: Título + body: Corpo + refinery/blog_comment: + name: Nome + message: Mensagem diff --git a/config/locales/ru.yml b/config/locales/ru.yml new file mode 100644 index 0000000..b6d9d0b --- /dev/null +++ b/config/locales/ru.yml @@ -0,0 +1,128 @@ +ru: + refinery: + plugins: + refinerycms_blog: + title: Блог + blog: + admin: + categories: + category: + edit: Редактировать эту категорию + delete: Удалить эту категорию навсегда + index: + no_items_yet: 'Категории пока не созданы. Нажмите "%{create}", чтобы добавить вашу первую категорию.' + comments: + approved: 'Комментарий от "%{author}" был опубликован.' + comment: + view_live_html: Посмотреть комментарий на сайте
    (откроется в новом окне) + read: Прочитать комментарий + reject: Отклонить комментарий + approve: Принять комментарий + rejected: 'Комментарий от "%{author}" был отклонен.' + index: + no_items_yet: '%{type} комментарии: отсутствуют.' + show: + comment: Комментарий + blog_post: Запись в блоге + from: Опубликовал + date: Опубликовано + message: Комментарий + details: Детали + age: Возраст + actions: Действия + back: Вернуться к списку комментариев + reject: Отклонить этот комментарий + approve: Принять этот комментарий + posts: + form: + advanced_options: Дополнительные настройки + toggle_advanced_options: 'Нажмите, чтобы получить доступ к настройкам мета-тегов и меню' + save_as_draft: Сохранить как черновик + published_at: Дата публикации + index: + no_items_yet: 'Записи в блоге отстутствуют. Нажмите "%{create}", чтобы добавить первую запись.' + uncategorized: + no_items_yet: 'Записи без категорий отсутствуют.' + post: + view_live_html: Посмотреть запись на сайте
    (откроется в новом окне) + edit: Редактировать запись + delete: Удалить запись + settings: + notification_recipients: + value: Отправлять уведомления + explanation: 'При появлении новых комментариев Refinery пришлет уведомление на email.' + hint: 'При появлении новых комментариев Refinery пришлет уведомление на email.' + example: "Введите адреса эл. почты, например: jack@work.com, jill@office.com" + updated: 'Получателем уведомлений является "%{recipients}"' + submenu: + categories: + title: Категории + manage: Редактировать категории + new: Создать новую категорию + comments: + title: Комментарии + title_with_count: 'Комментарии (%{new_count} новых)' + new: Новые + unmoderated: Новые + approved: Принятые + rejected: Отклоненные + posts: + title: Записи + manage: Редактировать записи + new: Создать новую запись + uncategorized: Записи без категорий + settings: + title: Настройки + moderation: Модерирование + update_notified: Настроить уведомления + comments: Комментарии + comment_mailer: + notification: + greeting: Здравствуйте + you_recieved_new_comment: Новый комментарий опубликован на вашем сайте. + comment_starts: --- начало комментария --- + comment_ends: --- конец комментария --- + from: От + email: Эл. почта + message: Сообщение + closing_line: С уважением + ps: P.S. Все комментарии находятся в разделе "Блог" Refinery CMS в подменю "Комментарии". + shared: + categories: + title: Категории + rss_feed: + title: RSS-лента + subscribe: Подписаться + posts: + other: Другие записи + created_at: 'Опубликовано %{when}' + read_more: Читать дальше + comments: + singular: комментарий + none: нет комментариев + archives: Архивы + categories: + show: + no_posts: Записей пока нет. + posts: + post: + filed_in: Категория + comment: комментарий + comments: + by: 'Опубликовал %{who}' + time_ago: '%{time} назад' + thank_you: 'Спасибо за комментарий.' + thank_you_moderated: 'Спасибо за комментарий. Ваше сообщение модерируется и скоро появится на сайте.' + index: + no_blog_articles_yet: Пока ни одной записи не опубликовано. Следите за новостями. + show: + blog_home: Вернуться к списку записей + comments: + title: Комментарии + add: Написать комментарий + other: Другие записи + filed_in: Категория + submit: Отправить комментарий + archive: + blog_archive_for: 'Архив %{date}' + no_blog_articles_posted: 'Ни одной записи за %{date} не опубликовано. Следите за новостями.' diff --git a/config/locales/sk.yml b/config/locales/sk.yml new file mode 100644 index 0000000..99888af --- /dev/null +++ b/config/locales/sk.yml @@ -0,0 +1,128 @@ +sk: + refinery: + plugins: + refinerycms_blog: + title: Blog + blog: + admin: + categories: + category: + edit: Upraviť kategóriu + delete: Zmazať kategóriu + index: + no_items_yet: 'Niesu tu žiadne kategórie. Klikni "%{create}" pre pridanie prvej.' + comments: + approved: 'Komentár od "%{author}" bol schválený.' + comment: + view_live_html: 'Zobraziť živý náhľad
    (otvorí nové okno)' + read: Zobraziť komentár + reject: Zamietnuť komentár + approve: Schváliť + rejected: 'Komentár od "%{author}" bol zamietnutý.' + index: + no_items_yet: 'Niesu tu žiadne %{type} komentáre.' + show: + comment: Komentár + blog_post: Blog článok + from: Odoslal + date: Dátum + message: Správa + details: Detaily + age: Vek + actions: Akcie + back: Späť na zoznam komentárov. + reject: Zamietnuť komentár + approve: Schváliť komentár + posts: + form: + advanced_options: Pokročilé nastavenia + toggle_advanced_options: Klikni pre prístup k nastaveniam meta tagov a menu + save_as_draft: Uložiť ako koncept + published_at: Dátum publikovania + index: + no_items_yet: 'Niesu žiadne články na blogu. Klikni na "%{create}" pre pridanie prvého.' + uncategorized: + no_items_yet: 'Niesu žiadne nekategorizované články.' + post: + view_live_html: 'Zobraziť článok
    (otvorí ho v novom okne)' + edit: Upraviť článok + delete: Zmazať článok + settings: + notification_recipients: + value: Poslať notifikáciu pre + explanation: 'Vždy keď niekto pridá komentár, Refinery pošle notifikáciu.' + hint: 'Vždy keď niekto pridá komentár, Refinery ti pošle notifikáciu.' + example: "Zadaj tvoju emailovú adresu(y) ako napríklad: jack@work.com, jill@office.com" + updated: 'Zoznam príjemcov notifikácií "%{recipients}"' + submenu: + categories: + title: Kategórie + manage: Spravovať + new: Nová kategória + comments: + title: Komentáre + title_with_count: 'Komentáre (%{new_count} nových)' + new: Nový + unmoderated: Nový + approved: Schválený + rejected: Zamietnutý + posts: + title: Články + manage: Spravovať články + new: Vytvoriť nový článok + uncategorized: Nekategorizované články + settings: + title: Nastavenia + moderation: Moderovanie + update_notified: Upraviť zoznam notifikovaných + comments: Komentáre + comment_mailer: + notification: + greeting: Ahoj + you_recieved_new_comment: Máš nový komentár na stránke + comment_starts: --- začiatok komentára --- + comment_ends: --- koniec komentára --- + from: Od + email: Email + message: Správa + closing_line: S pozdravom + ps: 'P.S. Všetky komentáre su uložené v sekcii "Blog" pod záložkou "Komentáre" v prípade ak by ich bolo potrebné zobraziť neskôr.' + shared: + categories: + title: Kategórie + rss_feed: + title: RSS zdroj článkov + subscribe: Prihlásiť k odberu + posts: + other: Ďaľšie články + created_at: 'Publikovaný %{when}' + read_more: Celý článok + comments: + singular: komentár + none: Niesu tu žiadne komentáre + archives: Archív + categories: + show: + no_posts: Niesu tu žiadne články momentálne. + posts: + post: + filed_in: Podaný + comment: komentár + comments: + by: 'Odoslal %{who}' + time_ago: '%{time} späť' + thank_you: 'Vďaka za komentár.' + thank_you_moderated: 'Ďakujeme za Váš komentár. Vaša správa čaká na schválenie a objaví sa v najbližšej dobe.' + index: + no_blog_articles_yet: Práve niesu žiadne články na blogu. Zostante naladení. + show: + blog_home: Hlavná stránka blogu + comments: + title: Komentáre + add: Pridať komentár + other: Ďalšie články + filed_in: Podaný + submit: Odoslať komentár + archive: + blog_archive_for: 'Blog archív pre %{date}' + no_blog_articles_posted: 'Niesu žiadne články publikované %{date}.' diff --git a/config/locales/sv.yml b/config/locales/sv.yml new file mode 100644 index 0000000..24f1bac --- /dev/null +++ b/config/locales/sv.yml @@ -0,0 +1,167 @@ +sv: + refinery: + plugins: + refinerycms_blog: + title: Blogg + blog: + admin: + categories: + category: + edit: Editera kategori + delete: Radera kategori + index: + no_items_yet: 'Det finns inga kategorier än. Klicka på "%{create}" för att lägga till den första kategorin.' + comments: + approved: 'Kommentaren från "%{author}" Har godkänts.' + comment: + view_live_html: 'Visa kommentaren på webbplatsen.
    (öppnas i ett nytt fönster)' + read: Läs denna kommentar + reject: Avslå kommentar + approve: Godkänn kommentar + rejected: 'Kommentaren från "%{author}" har avslagits.' + index: + no_items_yet: 'Det finns inga %{type} kommentarer.' + show: + comment: Kommentar + blog_post: Blogg post + from: Postat av + date: Postat + message: Kommentar + details: Detaljer + age: Ålder + actions: Actions + back: Tillbaka till alla kommentarer + reject: Avslå denna kommentar + approve: Godkänn denna kommentar + posts: + form: + advanced_options: Avancerat + toggle_advanced_options: Klicka för att ställa in metataggar och menyinställningar + save_as_draft: Spara som utkast + published_at: Publiceringsdatum + custom_url: Anpassad URL + custom_url_help: Skapa URL för bloggposten med denna text istället för ttieln + source_url: Källans URL + source_url_help: Sparar URL för postens källa + source_url_title: Källhänvisning (titel) + source_url_title_help: Källhänvisning för posten (URL). + author: Författare + author_help: Ställ in författare för denna post. + copy_body: Kopiera innehåll i posten till en teaser. + copy_body_help: Kopierar inneållet i posten till en teaser, lämna tom om du vill att det ska ske automatiskt. + index: + no_items_yet: 'Det finns inga poster än. Klicka "%{create}" för att lägga till din första post.' + uncategorized: + no_items_yet: 'Det finns inga okategoriserade poster.' + post: + view_live_html: 'Visa denna post i en webbläsare
    (öppnas i ett nytt fönster)' + edit: Redigera denna bloggpost + delete: Ta bort denna bloggpost + draft: Utkast + settings: + notification_recipients: + value: Skicka notis till + explanation: 'Varje gång någon kommenterar på en post, skickas ett mail om kommentaren.' + hint: 'När en kommentar läggs till, så skickar vi en notis till dig.' + example: "Lägg till epostadress(er) i detta format: kalle@home.se, pelle@work.com" + updated: 'Notiser har blivit skickade till: "%{recipients}"' + submenu: + categories: + title: Kategorier + manage: Hantera + new: Skapa ny kategori + comments: + title: Kommentarer + title_with_count: 'Det finns (%{new_count} nya kommentarer)' + new: Ny + unmoderated: Ny + approved: Godkänd + rejected: Avslagen + posts: + title: Poster + manage: Hantera poster + new: Skapa ny post + uncategorized: Okategoriserade poster + settings: + title: Inställningar + moderation: Moderering + update_notified: Uppdarea vilka som får notiser + comments: Kommentarer + teasers: Teasers + comment_mailer: + notification: + greeting: Hej! + you_recieved_new_comment: Du har fått en ny kommentar på bloggenYou just received a new comment on your website. + comment_starts: --- kommentar --- + comment_ends: --- // kommentar --- + from: Från + email: E-post + message: Meddelande + closing_line: Vänliga hälsningar + ps: 'P.S. Alla dina kommentarer finns lagrade i bloggsektionen av ditt CMS i undermenyn kommentarer, om du vill se dem senare.' + shared: + categories: + title: Kategorier + rss_feed: + title: RSS + subscribe: Prenumerera + posts: + other: Övriga poster + created_at: 'Postat den %{when}' + read_more: Läs mer + comments: + singular: Kommentar + none: Inga kommentarer + archives: Arkiv + tags: + title: "Taggar" + categories: + show: + no_posts: Det finns inga poster än. + posts: + post: + filed_in: Kategoriserat som + comment: kommentar + comments: + by: 'Postad av %{who}' + time_ago: 'för %{time} sedan' + thank_you: 'Tack för din kommentar.' + thank_you_moderated: 'Tack för din kommentar. Ditt meddelande har placerats i modereringskön och kommer snart att bli publicerat.' + index: + no_blog_articles_yet: Det finns inga bloggposter än. + show: + blog_home: Blogg hem + comments: + title: Kommentarer + add: Kommentera + other: Andra bloggposter + filed_in: Kategoriserat i + tagged: Taggar + submit: Skicka kommentar + name: Namn + email: E-post + message: Meddelande + by: av + source: Källa + tagged: + no_blog_articles_yet: Det finns inga bloggposter än. + posts_tagged: Poster taggade med + archive: + blog_archive_for: 'Arkiv för %{date}' + no_blog_articles_posted: 'Det finns inga artiklar för %{date}.' + activerecord: + models: + refinery/blog_category: Kategori + refinery/blog_comment: Kommentarer + refinery/blog_post: Bloggposter + attributes: + refinery/blog_category: + title: Titel + refinery/blog_comment: + name: Namn + email: E-post + message: Meddelande + refinery/blog_post: + title: Titel + body: Innehåll + teaser: Teaser diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml new file mode 100644 index 0000000..894140d --- /dev/null +++ b/config/locales/zh-CN.yml @@ -0,0 +1,128 @@ +zh-CN: + refinery: + plugins: + refinerycms_blog: + title: 博客 + blog: + admin: + categories: + category: + edit: 编辑此类别 + delete: 永久删除此类别 + index: + no_items_yet: '没有此类别。 点击 "%{create}" 添加第一次类别。' + comments: + approved: '评论来自 "%{author}" 已被审批。' + comment: + view_live_html: '查看此评论
    (opens in a new window)' + read: 阅读此评论 + reject: 驳回此评论 + approve: 批准此评论 + rejected: '评论来自 "%{author}" 已被驳回。' + index: + no_items_yet: '没有 %{type} 评论。' + show: + comment: 评论 + blog_post: 发博 + from: 发布由 + date: 发布在 + message: 评论 + details: 详情 + age: 年龄 + actions: 行动 + back: 返回至所有评论 + reject: 驳回此评论 + approve: 批准此评论 + posts: + form: + advanced_options: 高级选项 + toggle_advanced_options: 点击进入标签详解设置和菜单选项 + save_as_draft: 保存为草稿 + published_at: 发布日期 + index: + no_items_yet: '目前尚未发博。 点击 "%{create}" 添加您的第一篇博文。' + uncategorized: + no_items_yet: '没有未归类的博文。' + post: + view_live_html: '查看此博
    (opens in a new window)' + edit: 编辑此博 + delete: 永久删除此博 + settings: + notification_recipients: + value: 发送通知 + explanation: '每次有人发表评论,发送邮件告知有新评论。' + hint: '增加新评论时,将会发送邮件告知您。' + example: "输入您的邮件地址,如: jack@work.com, jill@office.com" + updated: '通知收件人已被设为 "%{recipients}"' + submenu: + categories: + title: 分类 + manage: 管理 + new: 创建新的类别 + comments: + title: 评论 + title_with_count: '评论 (%{new_count} new)' + new: 新 + unmoderated: 新 + approved: 批准 + rejected: 驳回 + posts: + title: 博文 + manage: 管理博文 + new: 创建新博文 + uncategorized: 未归类博文 + settings: + title: 设置 + moderation: 等待审核 + update_notified: 更新获得通知的人 + comments: 评论 + comment_mailer: + notification: + greeting: 您好 + you_recieved_new_comment: 您刚收到来自网站的一条新评论 + comment_starts: --- 评论开始 --- + comment_ends: --- 评论结束 --- + from: 来自 + email: 邮件 + message: 信息 + closing_line: 亲切问候 + ps: 'P.S. All your comments are stored in the "Blog" section of Refinery under the "Comments" submenu should you ever want to view it later there.' + shared: + categories: + title: 分类 + rss_feed: + title: RSS源 + subscribe: 订阅 + posts: + other: 其他博文 + created_at: '发表于 %{when}' + read_more: 阅读更多 + comments: + singular: 评论 + none: 没有评论 + archives: 档案 + categories: + show: + no_posts: 此处没有文章。 + posts: + post: + filed_in: 用户体验 + comment: 评论 + comments: + by: '发布由 %{who}' + time_ago: '%{time} 之前' + thank_you: '感谢您的评论。' + thank_you_moderated: '感谢您的评论。 您的信息已被列入等待审核队列,并会在短期内出现。' + index: + no_blog_articles_yet: 尚未发布文章。敬请关注。 + show: + blog_home: 博客首页 + comments: + title: 评论 + add: 发表评论 + other: 其他博文 + filed_in: 用户体验 + submit: 发送评论 + archive: + blog_archive_for: '博客存档 %{date}' + no_blog_articles_posted: '没有发布文章 %{date}。敬请关注。' diff --git a/config/routes.rb b/config/routes.rb index 2cb4723..fd7272d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,52 +1,26 @@ -if Rails.version < '3.0.0' - ActionController::Routing::Routes.draw do |map| - map.namespace(:blog) do |blog| - blog.rss_feed 'feed.rss', :controller => 'posts', :action => 'index', :format => 'rss' - blog.root :controller => "posts", :action => 'index' - blog.post ':id', :controller => "posts", :action => 'show' - blog.category 'categories/:id', :controller => "categories", :action => 'show' - blog.post_blog_comments ':id/comments', :controller => 'posts', :action => 'comment' +Refinery::Core::Engine.routes.draw do + namespace :blog do + root :to => "posts#index" + resources :posts, :only => [:show] - ## what is the rails2 syntax for this? sorry ;__; - # get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' - end - - map.namespace(:admin, :path_prefix => 'refinery') do |admin| - admin.namespace :blog do |blog| - blog.resources :posts - - blog.resources :categories - - blog.resources :comments, :collection => { - :approved => :get, - :rejected => :get - }, :member => { - :approved => :get, - :rejected => :get - } - - blog.resources :settings, :collection => { - :notification_recipients => [:get, :post], - :moderation => :get - } - end - end + match 'feed.rss', :to => 'posts#index', :as => 'rss_feed', :defaults => {:format => "rss"} + match 'categories/:id', :to => 'categories#show', :as => 'category' + match ':id/comments', :to => 'posts#comment', :as => 'comments' + get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_posts' + get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts' end -else - Refinery::Application.routes.draw do - scope(:path => 'blog', :module => 'blog') do - root :to => 'posts#index', :as => 'blog_root' - match 'feed.rss', :to => 'posts#index.rss', :as => 'blog_rss_feed' - match ':id', :to => 'posts#show', :as => 'blog_post' - match 'categories/:id', :to => 'categories#show', :as => 'blog_category' - match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' - get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' - end - scope(:path => 'refinery', :as => 'admin', :module => 'admin') do - scope(:path => 'blog', :as => 'blog', :module => 'blog') do - root :to => 'posts#index' - resources :posts + namespace :blog, :path => '' do + namespace :admin, :path => 'refinery' do + scope :path => 'blog' do + root :to => "posts#index" + + resources :posts do + collection do + get :uncategorized + get :tags + end + end resources :categories @@ -67,6 +41,8 @@ else post :notification_recipients get :moderation + get :comments + get :teasers end end end diff --git a/db/migrate/20110803223522_create_blog_structure.rb b/db/migrate/20110803223522_create_blog_structure.rb new file mode 100644 index 0000000..010102f --- /dev/null +++ b/db/migrate/20110803223522_create_blog_structure.rb @@ -0,0 +1,52 @@ +class CreateBlogStructure < ActiveRecord::Migration + + def up + create_table Refinery::Blog::Post.table_name, :id => true do |t| + t.string :title + t.text :body + t.boolean :draft + t.datetime :published_at + t.timestamps + end + + add_index Refinery::Blog::Post.table_name, :id + + create_table Refinery::Blog::Comment.table_name, :id => true do |t| + t.integer :blog_post_id + t.boolean :spam + t.string :name + t.string :email + t.text :body + t.string :state + t.timestamps + end + + add_index Refinery::Blog::Comment.table_name, :id + + create_table Refinery::Blog::Category.table_name, :id => true do |t| + t.string :title + t.timestamps + end + + add_index Refinery::Blog::Category.table_name, :id + + create_table Refinery::Categorization.table_name, :id => true do |t| + t.integer :blog_category_id + t.integer :blog_post_id + end + + add_index Refinery::Categorization.table_name, [:blog_category_id, :blog_post_id], :name => 'index_blog_categories_blog_posts_on_bc_and_bp' + end + + def down + Refinery::UserPlugin.destroy_all({:name => "refinerycms_blog"}) + + Refinery::Page.delete_all({:link_url => "/blog"}) + + drop_table Refinery::Blog::Post.table_name + drop_table Refinery::Blog::Comment.table_name + drop_table Refinery::Blog::Category.table_name + drop_table Refinery::Categorization.table_name + end + +end diff --git a/db/migrate/20110803223523_add_user_id_to_blog_posts.rb b/db/migrate/20110803223523_add_user_id_to_blog_posts.rb new file mode 100644 index 0000000..2fadb28 --- /dev/null +++ b/db/migrate/20110803223523_add_user_id_to_blog_posts.rb @@ -0,0 +1,7 @@ +class AddUserIdToBlogPosts < ActiveRecord::Migration + + def change + add_column Refinery::Blog::Post.table_name, :user_id, :integer + end + +end \ No newline at end of file diff --git a/db/migrate/20110803223524_acts_as_taggable_on_migration.rb b/db/migrate/20110803223524_acts_as_taggable_on_migration.rb new file mode 100644 index 0000000..812daf4 --- /dev/null +++ b/db/migrate/20110803223524_acts_as_taggable_on_migration.rb @@ -0,0 +1,28 @@ +class ActsAsTaggableOnMigration < ActiveRecord::Migration + def up + create_table :tags do |t| + t.string :name + end + + create_table :taggings do |t| + t.references :tag + + # You should make sure that the column created is + # long enough to store the required class names. + t.references :taggable, :polymorphic => true + t.references :tagger, :polymorphic => true + + t.string :context + + t.datetime :created_at + end + + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type, :context] + end + + def down + drop_table :taggings + drop_table :tags + end +end diff --git a/db/migrate/20110803223526_add_cached_slugs.rb b/db/migrate/20110803223526_add_cached_slugs.rb new file mode 100644 index 0000000..1024323 --- /dev/null +++ b/db/migrate/20110803223526_add_cached_slugs.rb @@ -0,0 +1,6 @@ +class AddCachedSlugs < ActiveRecord::Migration + def change + add_column Refinery::Blog::Category.table_name, :cached_slug, :string + add_column Refinery::Blog::Post.table_name, :cached_slug, :string + end +end diff --git a/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb b/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb new file mode 100644 index 0000000..7d3a225 --- /dev/null +++ b/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb @@ -0,0 +1,5 @@ +class AddCustomUrlFieldToBlogPosts < ActiveRecord::Migration + def change + add_column Refinery::Blog::Post.table_name, :custom_url, :string + end +end diff --git a/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb b/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb new file mode 100644 index 0000000..895acb5 --- /dev/null +++ b/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb @@ -0,0 +1,6 @@ +class AddCustomTeaserFieldToBlogPosts < ActiveRecord::Migration + def change + add_column Refinery::Blog::Post.table_name, :custom_teaser, :text + end +end + diff --git a/db/migrate/20110803223529_add_primary_key_to_categorizations.rb b/db/migrate/20110803223529_add_primary_key_to_categorizations.rb new file mode 100644 index 0000000..5bbfcf3 --- /dev/null +++ b/db/migrate/20110803223529_add_primary_key_to_categorizations.rb @@ -0,0 +1,14 @@ +class AddPrimaryKeyToCategorizations < ActiveRecord::Migration + def up + unless Refinery::Categorization.column_names.include?("id") + add_column Refinery::Categorization.table_name, :id, :primary_key + end + end + + def down + if Refinery::Categorization.column_names.include?("id") + remove_column Refinery::Categorization.table_name, :id + end + end +end + diff --git a/db/migrate/20120103055909_add_source_url_to_blog_posts.rb b/db/migrate/20120103055909_add_source_url_to_blog_posts.rb new file mode 100644 index 0000000..cd6fd27 --- /dev/null +++ b/db/migrate/20120103055909_add_source_url_to_blog_posts.rb @@ -0,0 +1,7 @@ +class AddSourceUrlToBlogPosts < ActiveRecord::Migration + def change + add_column Refinery::Blog::Post.table_name, :source_url, :string + add_column Refinery::Blog::Post.table_name, :source_url_title, :string + + end +end diff --git a/db/migrate/20120223022021_add_access_count_to_posts.rb b/db/migrate/20120223022021_add_access_count_to_posts.rb new file mode 100644 index 0000000..02cd131 --- /dev/null +++ b/db/migrate/20120223022021_add_access_count_to_posts.rb @@ -0,0 +1,8 @@ +class AddAccessCountToPosts < ActiveRecord::Migration + def change + add_column Refinery::Blog::Post.table_name, :access_count, :integer, :default => 0 + + add_index Refinery::Blog::Post.table_name, :access_count + + end +end \ No newline at end of file diff --git a/db/migrate/20120227022021_add_slug_to_posts_and_categories.rb b/db/migrate/20120227022021_add_slug_to_posts_and_categories.rb new file mode 100644 index 0000000..87d1291 --- /dev/null +++ b/db/migrate/20120227022021_add_slug_to_posts_and_categories.rb @@ -0,0 +1,9 @@ +class AddSlugToPostsAndCategories < ActiveRecord::Migration + def change + add_column Refinery::Blog::Post.table_name, :slug, :string + add_index Refinery::Blog::Post.table_name, :slug + + add_column Refinery::Blog::Category.table_name, :slug, :string + add_index Refinery::Blog::Category.table_name, :slug + end +end \ No newline at end of file diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..91018db --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,19 @@ +Refinery::User.all.each do |user| + if user.plugins.where(:name => 'refinerycms_blog').blank? + user.plugins.create(:name => "refinerycms_blog", + :position => (user.plugins.maximum(:position) || -1) +1) + end +end if defined?(Refinery::User) + +if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => '/blog') + page = Refinery::Page.create( + :title => "Blog", + :link_url => "/blog", + :deletable => false, + :menu_match => "^/blogs?(\/|\/.+?|)$" + ) + + Refinery::Pages.default_parts.each do |default_page_part| + page.parts.create(:title => default_page_part, :body => nil) + end +end diff --git a/features/support/factories/blog_categories.rb b/features/support/factories/blog_categories.rb deleted file mode 100644 index 10b51b5..0000000 --- a/features/support/factories/blog_categories.rb +++ /dev/null @@ -1,4 +0,0 @@ -Factory.define(:blog_category) do |f| - f.title "Shopping" - f.posts {|p| [p.association(:post)]} -end diff --git a/features/support/factories/blog_comments.rb b/features/support/factories/blog_comments.rb deleted file mode 100644 index d5c5b1d..0000000 --- a/features/support/factories/blog_comments.rb +++ /dev/null @@ -1,10 +0,0 @@ -Factory.sequence :email do |n| - "person#{n}@example.com" -end - -Factory.define(:blog_comment) do |f| - f.name "Joe Commenter" - f.email { Factory.next(:email) } - f.body "Which one is the best for picking up new shoes?" - f.association :post -end diff --git a/features/support/factories/blog_posts.rb b/features/support/factories/blog_posts.rb deleted file mode 100644 index 8dd3f54..0000000 --- a/features/support/factories/blog_posts.rb +++ /dev/null @@ -1,4 +0,0 @@ -Factory.define(:post, :class => BlogPost) do |f| - f.title "Top Ten Shopping Centers in Chicago" - f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." -end diff --git a/features/support/paths.rb b/features/support/paths.rb deleted file mode 100644 index dbd04dd..0000000 --- a/features/support/paths.rb +++ /dev/null @@ -1,24 +0,0 @@ -module NavigationHelpers - module Refinery - module Blog - def path_to(page_name) - case page_name - when /the list of blog posts/ - admin_blog_posts_path - when /the new blog posts? form/ - new_admin_blog_post_path - else - begin - if page_name =~ /the blog post titled "?([^\"]*)"?/ and (page = BlogPost.find_by_title($1)).present? - self.url_for(page.url) - else - nil - end - rescue - nil - end - end - end - end - end -end diff --git a/generators/refinerycms_blog/refinerycms_blog_generator.rb b/generators/refinerycms_blog/refinerycms_blog_generator.rb deleted file mode 100644 index f967df3..0000000 --- a/generators/refinerycms_blog/refinerycms_blog_generator.rb +++ /dev/null @@ -1,69 +0,0 @@ -class RefinerycmsBlogGenerator < Rails::Generator::NamedBase - - def initialize(*runtime_args) - # set argument for the user. - runtime_args[0] = %w(refinerycms_blog) - super(*runtime_args) - end - - def banner - 'Usage: script/generate refinerycms_blog' - end - - def manifest - record do |m| - matches = Dir[ - File.expand_path('../../../public/images/**/*', __FILE__), - File.expand_path('../../../public/stylesheets/**/*', __FILE__), - File.expand_path('../../../public/javascripts/**/*', __FILE__), - ] - matches.reject{|d| !File.directory?(d)}.each do |dir| - m.directory((%w(public) | dir.split('public/').last.split('/')).join('/')) - end - matches.reject{|f| File.directory?(f)}.each do |image| - path = (%w(public) | image.split('public/').last.split('/'))[0...-1].join('/') - m.template "../../../#{path}/#{image.split('/').last}", "#{path}/#{image.split('/').last}" - end - - m.directory('db/seeds') - m.template('db/seeds/seed.rb', 'db/seeds/refinerycms_blog.rb') - - m.migration_template('db/migrate/migration.rb', 'db/migrate', - :migration_file_name => 'create_blog_structure', - :assigns => { - :migration_name => 'CreateBlogStructure', - :tables => [{ - :table_name => 'blog_posts', - :attributes => [ - Rails::Generator::GeneratedAttribute.new('title', 'string'), - Rails::Generator::GeneratedAttribute.new('body', 'text'), - Rails::Generator::GeneratedAttribute.new('draft', 'boolean'), - Rails::Generator::GeneratedAttribute.new('published_at', 'datetime') - ], :id => true - },{ - :table_name => 'blog_comments', - :attributes => [ - Rails::Generator::GeneratedAttribute.new('blog_post_id', 'integer'), - Rails::Generator::GeneratedAttribute.new('spam', 'boolean'), - Rails::Generator::GeneratedAttribute.new('name', 'string'), - Rails::Generator::GeneratedAttribute.new('email', 'string'), - Rails::Generator::GeneratedAttribute.new('body', 'text'), - Rails::Generator::GeneratedAttribute.new('state', 'string'), - ], :id => true - },{ - :table_name => 'blog_categories', - :attributes => [ - Rails::Generator::GeneratedAttribute.new('title', 'string') - ], :id => true - },{ - :table_name => 'blog_categories_blog_posts', - :attributes => [ - Rails::Generator::GeneratedAttribute.new('blog_category_id', 'integer'), - Rails::Generator::GeneratedAttribute.new('blog_post_id', 'integer') - ], :id => false - }] - }) - end - end - -end if defined?(Rails::Generator::NamedBase) diff --git a/generators/refinerycms_blog/templates/db/migrate/migration.rb b/generators/refinerycms_blog/templates/db/migrate/migration.rb deleted file mode 100644 index 5ba29c6..0000000 --- a/generators/refinerycms_blog/templates/db/migrate/migration.rb +++ /dev/null @@ -1,26 +0,0 @@ -class <%= migration_name %> < ActiveRecord::Migration - - def self.up<% tables.each do |table| %> - create_table :<%= table[:table_name] %>, :id => <%= table[:id].to_s %> do |t| -<% table[:attributes].each do |attribute| -%> - t.<%= attribute.type %> :<%= attribute.name %> -<% end -%> - <%= 't.timestamps' if table[:id] %> - end - - <%= "add_index :#{table[:table_name]}, :id" if table[:id] %> -<% end -%> - load(Rails.root.join('db', 'seeds', 'refinerycms_blog.rb').to_s) - end - - def self.down - UserPlugin.destroy_all({:name => "refinerycms_blog"}) - - Page.delete_all({:link_url => "/blog"}) - -<% tables.each do |table| -%> - drop_table :<%= table[:table_name] %> -<% end -%> - end - -end diff --git a/generators/refinerycms_blog/templates/db/seeds/seed.rb b/generators/refinerycms_blog/templates/db/seeds/seed.rb deleted file mode 100644 index 228fc7b..0000000 --- a/generators/refinerycms_blog/templates/db/seeds/seed.rb +++ /dev/null @@ -1,16 +0,0 @@ -User.find(:all).each do |user| - user.plugins.create(:name => "<%= singular_name %>", - :position => (user.plugins.maximum(:position) || -1) +1) -end - -page = Page.create( - :title => "Blog", - :link_url => "/blog", - :deletable => false, - :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1), - :menu_match => "^/blogs?(\/|\/.+?|)$" -) - -RefinerySetting.find_or_set(:default_page_parts, %w(Body Side\ Body)).each do |default_page_part| - page.parts.create(:title => default_page_part, :body => nil) -end diff --git a/lib/gemspec.rb b/lib/gemspec.rb deleted file mode 100644 index 5e3606b..0000000 --- a/lib/gemspec.rb +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../refinerycms-blog.rb', __FILE__) -version = ::Refinery::Blog.version -raise "Could not get version so gemspec can not be built" if version.nil? -files = Dir.glob("**/*").flatten.reject do |file| - file =~ /\.gem(spec)?$/ -end - -gemspec = <= 0.9.7.13' - s.add_dependency 'filters_spam', '~> 0.2' - - s.files = %w( - #{files.join("\n ")} - ) - #{"s.test_files = %w( - #{Dir.glob("test/**/*.rb").join("\n ")} - )" if File.directory?("test")} -end -EOF - -File.open(File.expand_path("../../refinerycms-blog.gemspec", __FILE__), 'w').puts(gemspec) diff --git a/lib/generators/refinery/blog/blog_generator.rb b/lib/generators/refinery/blog/blog_generator.rb new file mode 100644 index 0000000..26e37d3 --- /dev/null +++ b/lib/generators/refinery/blog/blog_generator.rb @@ -0,0 +1,27 @@ +module Refinery + class BlogGenerator < Rails::Generators::Base + + source_root File.expand_path("../templates", __FILE__) + + def generate_blog_initializer + template "config/initializers/refinery/blog.rb.erb", File.join(destination_root, "config", "initializers", "refinery", "blog.rb") + end + + def rake_db + rake("refinery_blog:install:migrations") + rake("refinery_settings:install:migrations") + end + + def append_load_seed_data + create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb')) + append_file 'db/seeds.rb', :verbose => true do + <<-EOH + +# Added by Refinery CMS Blog engine +Refinery::Blog::Engine.load_seed + EOH + end + end + + end +end diff --git a/lib/generators/refinery/blog/templates/config/initializers/refinery/blog.rb.erb b/lib/generators/refinery/blog/templates/config/initializers/refinery/blog.rb.erb new file mode 100644 index 0000000..ac340d7 --- /dev/null +++ b/lib/generators/refinery/blog/templates/config/initializers/refinery/blog.rb.erb @@ -0,0 +1,11 @@ +Refinery::Blog.configure do |config| + # config.validate_source_url = <%= Refinery::Blog.validate_source_url.inspect %> + + # config.comments_per_page = <%= Refinery::Blog.comments_per_page.inspect %> + + # config.posts_per_page = <%= Refinery::Blog.posts_per_page.inspect %> + + # config.post_teaser_length = <%= Refinery::Blog.post_teaser_length.inspect %> + + # config.share_this_key = <%= Refinery::Blog.share_this_key.inspect %> +end diff --git a/lib/generators/refinerycms_blog/templates/db/migrate/migration_number_create_singular_name.rb b/lib/generators/refinerycms_blog/templates/db/migrate/migration_number_create_singular_name.rb deleted file mode 100644 index badb213..0000000 --- a/lib/generators/refinerycms_blog/templates/db/migrate/migration_number_create_singular_name.rb +++ /dev/null @@ -1,26 +0,0 @@ -class Create<%= singular_name.camelize %> < ActiveRecord::Migration - - def self.up<% @refinerycms_blog_tables.each do |table| %> - create_table :<%= table[:table_name] %>, :id => <%= table[:id].to_s %> do |t| -<% table[:attributes].each do |attribute| -%> - t.<%= attribute.type %> :<%= attribute.name %> -<% end -%> - <%= 't.timestamps' if table[:id] %> - end - - <%= "add_index :#{table[:table_name]}, :id" if table[:id] %> -<% end -%> - load(Rails.root.join('db', 'seeds', 'refinerycms_blog.rb').to_s) - end - - def self.down - UserPlugin.destroy_all({:name => "refinerycms_blog"}) - - Page.delete_all({:link_url => "/blog"}) - -<% @refinerycms_blog_tables.each do |table| -%> - drop_table :<%= table[:table_name] %> -<% end -%> - end - -end diff --git a/lib/generators/refinerycms_blog/templates/db/seeds/seed.rb b/lib/generators/refinerycms_blog/templates/db/seeds/seed.rb deleted file mode 100644 index f958fab..0000000 --- a/lib/generators/refinerycms_blog/templates/db/seeds/seed.rb +++ /dev/null @@ -1,16 +0,0 @@ -User.find(:all).each do |user| - user.plugins.create(:name => "refinerycms_blog", - :position => (user.plugins.maximum(:position) || -1) +1) -end - -page = Page.create( - :title => "Blog", - :link_url => "/blog", - :deletable => false, - :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1), - :menu_match => "^/blogs?(\/|\/.+?|)$" -) - -Page.default_parts.each do |default_page_part| - page.parts.create(:title => default_page_part, :body => nil) -end diff --git a/lib/generators/refinerycms_blog_generator.rb b/lib/generators/refinerycms_blog_generator.rb deleted file mode 100644 index a801353..0000000 --- a/lib/generators/refinerycms_blog_generator.rb +++ /dev/null @@ -1,80 +0,0 @@ -require 'rails/generators/migration' - -class RefinerycmsBlogGenerator < Rails::Generators::NamedBase - include Rails::Generators::Migration - - source_root File.expand_path('../refinerycms_blog/templates/', __FILE__) - argument :name, :type => :string, :default => 'blog_structure', :banner => '' - - def generate - # seed file - template 'db/seeds/seed.rb', Rails.root.join('db/seeds/refinerycms_blog.rb') - - # migration file - @refinerycms_blog_tables = [{ - :table_name => 'blog_posts', - :attributes => [ - Rails::Generators::GeneratedAttribute.new('title', 'string'), - Rails::Generators::GeneratedAttribute.new('body', 'text'), - Rails::Generators::GeneratedAttribute.new('draft', 'boolean'), - Rails::Generators::GeneratedAttribute.new('published_at', 'datetime') - ], :id => true - },{ - :table_name => 'blog_comments', - :attributes => [ - Rails::Generators::GeneratedAttribute.new('blog_post_id', 'integer'), - Rails::Generators::GeneratedAttribute.new('spam', 'boolean'), - Rails::Generators::GeneratedAttribute.new('name', 'string'), - Rails::Generators::GeneratedAttribute.new('email', 'string'), - Rails::Generators::GeneratedAttribute.new('body', 'text'), - Rails::Generators::GeneratedAttribute.new('state', 'string'), - ], :id => true - },{ - :table_name => 'blog_categories', - :attributes => [ - Rails::Generators::GeneratedAttribute.new('title', 'string') - ], :id => true - },{ - :table_name => 'blog_categories_blog_posts', - :attributes => [ - Rails::Generators::GeneratedAttribute.new('blog_category_id', 'integer'), - Rails::Generators::GeneratedAttribute.new('blog_post_id', 'integer') - ], :id => false - }] - next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__)) - template('db/migrate/migration_number_create_singular_name.rb', - Rails.root.join("db/migrate/#{next_migration_number}_create_#{singular_name}.rb")) - - puts "------------------------" - puts "Now run:" - puts "rake db:migrate" - puts "------------------------" - end -end - -# Below is a hack until this issue: -# https://rails.lighthouseapp.com/projects/8994/tickets/3820-make-railsgeneratorsmigrationnext_migration_number-method-a-class-method-so-it-possible-to-use-it-in-custom-generators -# is fixed on the Rails project. - -require 'rails/generators/named_base' -require 'rails/generators/migration' -require 'rails/generators/active_model' -require 'active_record' - -module ActiveRecord - module Generators - class Base < Rails::Generators::NamedBase #:nodoc: - include Rails::Generators::Migration - - # Implement the required interface for Rails::Generators::Migration. - def self.next_migration_number(dirname) #:nodoc: - next_migration_number = current_migration_number(dirname) + 1 - if ActiveRecord::Base.timestamped_migrations - [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max - else - "%.3d" % next_migration_number - end - end - end - end -end diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb new file mode 100644 index 0000000..52f73e0 --- /dev/null +++ b/lib/refinery/blog.rb @@ -0,0 +1,38 @@ +require 'refinerycms-core' +require 'refinerycms-settings' +require 'filters_spam' +require 'rails_autolink' +require 'acts_as_indexed' + +module Refinery + autoload :BlogGenerator, 'generators/refinery/blog/blog_generator' + + module Blog + require 'refinery/blog/engine' + require 'refinery/blog/configuration' + + autoload :Version, 'refinery/blog/version' + autoload :Tab, 'refinery/blog/tabs' + + class << self + attr_writer :root + attr_writer :tabs + + def root + @root ||= Pathname.new(File.expand_path('../../../', __FILE__)) + end + + def tabs + @tabs ||= [] + end + + def version + ::Refinery::Blog::Version.to_s + end + + def factory_paths + @factory_paths ||= [ root.join("spec/factories").to_s ] + end + end + end +end diff --git a/lib/refinery/blog/configuration.rb b/lib/refinery/blog/configuration.rb new file mode 100644 index 0000000..0f00501 --- /dev/null +++ b/lib/refinery/blog/configuration.rb @@ -0,0 +1,14 @@ +module Refinery + module Blog + include ActiveSupport::Configurable + + config_accessor :validate_source_url, :comments_per_page, :posts_per_page, + :post_teaser_length, :share_this_key + + self.validate_source_url = false + self.comments_per_page = 10 + self.posts_per_page = 10 + self.post_teaser_length = 250 + self.share_this_key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + end +end diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb new file mode 100644 index 0000000..f81e110 --- /dev/null +++ b/lib/refinery/blog/engine.rb @@ -0,0 +1,23 @@ +module Refinery + module Blog + class Engine < Rails::Engine + include Refinery::Engine + + isolate_namespace Refinery::Blog + + initializer "register refinerycms_blog plugin" do + Refinery::Plugin.register do |plugin| + plugin.pathname = root + plugin.name = "refinerycms_blog" + plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.blog_admin_posts_path } + plugin.menu_match = /refinery\/blog\/?(posts|comments|categories)?/ + plugin.activity = { :class_name => :'refinery/blog/post' } + end + end + + config.after_initialize do + Refinery.register_engine(Refinery::Blog) + end + end + end +end diff --git a/lib/refinery/blog/tabs.rb b/lib/refinery/blog/tabs.rb new file mode 100644 index 0000000..519b90e --- /dev/null +++ b/lib/refinery/blog/tabs.rb @@ -0,0 +1,22 @@ +module Refinery + module Blog + 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/refinery/blog/version.rb b/lib/refinery/blog/version.rb new file mode 100644 index 0000000..25ffc26 --- /dev/null +++ b/lib/refinery/blog/version.rb @@ -0,0 +1,18 @@ +module Refinery + module Blog + class Version + @major = 2 + @minor = 1 + @tiny = 0 + @build = 'dev' + + class << self + attr_reader :major, :minor, :tiny, :build + + def to_s + [@major, @minor, @tiny, @build].compact.join('.') + end + end + end + end +end diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 41d7093..e08f070 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -1,49 +1 @@ -if defined?(Bundler) and !defined?(FiltersSpam) - # this will tell the user what to do - load(File.expand_path('../../Gemfile', __FILE__)) - require 'filters_spam' -end - -module Refinery - module Blog - - class Engine < Rails::Engine - initializer 'blog serves assets' do |app| - app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public" - end - - config.after_initialize do - Refinery::Plugin.register do |plugin| - plugin.name = "refinerycms_blog" - plugin.url = {:controller => '/admin/blog/posts', :action => 'index'} - plugin.menu_match = /^\/?(admin|refinery)\/blog\/?(posts|comments|categories)?/ - plugin.activity = { - :class => BlogPost - } - end - - # refinery 0.9.8 had a bug that we later found through using this engine. - # the bug was that the plugin urls were not :controller => '/admin/whatever' - if Refinery.version == '0.9.8' - ::Refinery::Plugin.class_eval %{ - alias_method :old_url, :url - - def url - if (plugin_url = self.old_url).is_a?(Hash) and plugin_url[:controller] =~ %r{^admin} - plugin_url[:controller] = "/\#{plugin_url[:controller]}" - end - - plugin_url - end - } - end - end - end if defined?(Rails::Engine) - - class << self - def version - %q{1.0.rc16} - end - end - end -end +require 'refinery/blog' diff --git a/public/javascripts/refinery/refinerycms-blog.js b/public/javascripts/refinery/refinerycms-blog.js deleted file mode 100644 index 3ddbcc2..0000000 --- a/public/javascripts/refinery/refinerycms-blog.js +++ /dev/null @@ -1,50 +0,0 @@ -$(document).ready(function(){ - $('nav#actions.multilist > ul:not(.search_list) li a[href$=' + window.location.pathname + ']') - .parent().addClass('selected'); - if($('nav#actions.multilist > ul:not(.search_list) li.selected').length == 0) { - $('nav#actions.multilist > ul:not(.search_list) li a:nth(1)').parent().addClass('selected'); - } - - $('nav#actions.multilist > ul:not(.search_list) li > a').each(function(i,a){ - if ($(this).data('dialog-title') == null) { - $(this).bind('click', function(){ - $(this).css('background-image', "url('/images/refinery/icons/ajax-loader.gif') !important"); - }); - } - }); - - $('ul.collapsible_menu').each(function(i, ul) { - (first_li = $(this).children('li:first')).after(div=$("
    ")); - - $(" ").appendTo(first_li) - - if (($(this).children('li.selected')).length == 0) { - div.hide(); - first_li.addClass("closed"); - } - $(this).children('li:not(:first)').appendTo(div); - - first_li.find('> a, > span.arrow').click(function(e){ - $(this).parent().toggleClass("closed"); - $(this).parent().toggleClass("open"); - - $(this).parent().next('div').animate({ - opacity: 'toggle' - , height: 'toggle' - }, 250, $.proxy(function(){ - $(this).css('background-image', null); - }, $(this)) - ); - e.preventDefault(); - }); - }); - - $('.success_icon, .failure_icon').bind('click', function(e) { - $.get($(this).attr('href'), $.proxy(function(data){ - $(this).css('background-image', null) - .removeClass('failure_icon').removeClass('success_icon') - .addClass(data.enabled ? 'success_icon' : 'failure_icon'); - }, $(this))); - e.preventDefault(); - }); -}); \ No newline at end of file diff --git a/public/stylesheets/refinery/refinerycms-blog.css b/public/stylesheets/refinery/refinerycms-blog.css deleted file mode 100644 index 3df86f0..0000000 --- a/public/stylesheets/refinery/refinerycms-blog.css +++ /dev/null @@ -1,55 +0,0 @@ -.comments_icon { - background-image: url('/images/refinerycms-blog/icons/comments.png'); -} -.comment_icon { - background-image: url('/images/refinerycms-blog/icons/comment.png'); -} -.comment_cross_icon { - background-image: url('/images/refinerycms-blog/icons/comment_cross.png'); -} -.comment_tick_icon { - background-image: url('/images/refinerycms-blog/icons/comment_tick.png'); -} -.folder_icon { - background-image: url('/images/refinerycms-blog/icons/folder.png'); -} -.folder_add_icon { - background-image: url('/images/refinerycms-blog/icons/folder_add.png'); -} -.folder_edit_icon { - background-image: url('/images/refinerycms-blog/icons/folder_edit.png'); -} -.settings_icon { - background-image: url('/images/refinerycms-blog/icons/cog.png'); -} -.page_icon { - background-image: url('/images/refinerycms-blog/icons/page.png'); -} -.page_copy_icon { - background-image: url('/images/refinerycms-blog/icons/page_copy.png'); -} -.page_add_icon { - background-image: url('/images/refinerycms-blog/icons/page_add.png'); -} -ul.collapsible_menu li { - position: relative; -} -ul.collapsible_menu li span.arrow { - background-repeat: no-repeat; - position: absolute; - right: 10px; - top: 13px; - width: 11px; - height: 7px; - cursor: pointer; -} -ul.collapsible_menu li span.arrow { - background-image: url('/images/refinerycms-blog/icons/up.gif'); -} -ul.collapsible_menu li.closed span.arrow { - background-image: url('/images/refinerycms-blog/icons/down.gif'); -} -ul.collapsible_menu > div { - width: 93%; - margin: 0px auto; -} diff --git a/rails/init.rb b/rails/init.rb deleted file mode 100644 index 658936e..0000000 --- a/rails/init.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.expand_path('../../lib/refinerycms-blog', __FILE__) - -Refinery::Plugin.register do |plugin| - plugin.name = "refinerycms_blog" - plugin.url = {:controller => '/admin/blog/posts', :action => 'index'} - plugin.menu_match = /^\/?(admin|refinery)\/blog\/?(posts|comments|categories)?/ - plugin.activity = { - :class => BlogPost - } -end diff --git a/readme.md b/readme.md index 20d6187..dfb2b64 100644 --- a/readme.md +++ b/readme.md @@ -1,28 +1,60 @@ -# About +# Refinery CMS Blog Simple blog engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments. +This version of `refinerycms-blog` supports Rails 3.2.x. To use Rails 2.3.x use the [refinerycms-blog "Rails 2.3.x stable branch"](http://github.com/resolve/refinerycms-blog/tree/rails2-stable). + Options: * Comment moderation -* [ShareThis.com](http://sharethis.com) support on posts. Set your key in Refinery's settings area to enable this. +* [ShareThis.com](http://sharethis.com) support on posts. To enable, set your key in Refinery's settings area. -# Install +## Requirements -Open up your ``Gemfile`` and add at the bottom this line +Refinery CMS version 2.0.1 or above. - gem 'refinerycms-blog', '= 1.0.rc16' +## Install -Now run ``bundle install`` +Open up your ``Gemfile`` and add at the bottom this line: -Next to install the blog plugin run (for Rails 2): +```ruby +gem 'refinerycms-blog', '~> 2.0.0' +``` - ruby script/generate refinerycms_blog +Now, run ``bundle install`` -Or, for Rails 3: +Next, to install the blog plugin run: - rails generate refinerycms_blog + rails generate refinery:blog -Finally migrate your database and you're done. +Run database migrations: - rake db:migrate \ No newline at end of file + rake db:migrate + +Finally seed your database and you're done. + + rake db:seed + +## Developing & Contributing + +The version of Refinery to develop this engine against is defined in the gemspec. To override the version of refinery to develop against, edit the project Gemfile to point to a local path containing a clone of refinerycms. + +### Testing + +Generate the dummy application to test against + + $ bundle exec rake refinery:testing:dummy_app + +Run the test suite with [Guard](https://github.com/guard/guard) + + $ bundle exec guard start + +Or just with rake spec + + $ bundle exec rake spec + +## More Information +* Check out our [Website](http://refinerycms.com/) +* Documentation is available in the [guides](http://refinerycms.com/guides) +* Questions can be asked on our [Google Group](http://group.refinerycms.org) +* Questions can also be asked in our IRC room, [#refinerycms on freenode](irc://irc.freenode.net/refinerycms) \ No newline at end of file diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 348f27c..3449c93 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,149 +1,27 @@ +# Encoding: UTF-8 +$:.push File.expand_path('../lib', __FILE__) +require 'refinery/blog/version' + +version = Refinery::Blog::Version.to_s + Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.0.rc16} - s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2010-11-22} - s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} + s.version = version + s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with Refinery CMS.} + s.summary = %q{Ruby on Rails blogging engine for Refinery CMS.} s.email = %q{info@refinerycms.com} - s.homepage = %q{http://refinerycms.com} - s.authors = %w(Resolve\ Digital Neoteric\ Design) + s.homepage = %q{http://refinerycms.com/blog} + s.authors = ['Resolve Digital', 'Neoteric Design'] s.require_paths = %w(lib) - s.add_dependency 'refinerycms', '>= 0.9.7.13' - s.add_dependency 'filters_spam', '~> 0.2' - s.files = %w( - app - app/controllers - app/controllers/admin - app/controllers/admin/blog - app/controllers/admin/blog/categories_controller.rb - app/controllers/admin/blog/comments_controller.rb - app/controllers/admin/blog/posts_controller.rb - app/controllers/admin/blog/settings_controller.rb - app/controllers/blog - app/controllers/blog/categories_controller.rb - app/controllers/blog/posts_controller.rb - app/controllers/blog_controller.rb - app/helpers - app/helpers/blog_posts_helper.rb - app/mailers - app/mailers/blog - app/mailers/blog/comment_mailer.rb - app/models - app/models/blog - app/models/blog/comment_mailer.rb - app/models/blog_category.rb - app/models/blog_comment.rb - app/models/blog_post.rb - app/views - app/views/admin - app/views/admin/blog - app/views/admin/blog/_submenu.html.erb - app/views/admin/blog/categories - app/views/admin/blog/categories/_category.html.erb - app/views/admin/blog/categories/_form.html.erb - app/views/admin/blog/categories/_sortable_list.html.erb - app/views/admin/blog/categories/edit.html.erb - app/views/admin/blog/categories/index.html.erb - app/views/admin/blog/categories/new.html.erb - app/views/admin/blog/comments - app/views/admin/blog/comments/_comment.html.erb - app/views/admin/blog/comments/_sortable_list.html.erb - app/views/admin/blog/comments/index.html.erb - app/views/admin/blog/comments/show.html.erb - app/views/admin/blog/posts - app/views/admin/blog/posts/_form.css.erb - app/views/admin/blog/posts/_form.html.erb - app/views/admin/blog/posts/_form.js.erb - app/views/admin/blog/posts/_post.html.erb - app/views/admin/blog/posts/_sortable_list.html.erb - app/views/admin/blog/posts/edit.html.erb - app/views/admin/blog/posts/index.html.erb - app/views/admin/blog/posts/new.html.erb - app/views/admin/blog/settings - app/views/admin/blog/settings/notification_recipients.html.erb - app/views/blog - app/views/blog/categories - app/views/blog/categories/show.html.erb - app/views/blog/comment_mailer - app/views/blog/comment_mailer/notification.html.erb - 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/shared - 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/_rss_feed.html.erb - config - config/locales - config/locales/en.yml - config/locales/it.yml - config/locales/nb.yml - config/locales/nl.yml - config/routes.rb - Gemfile - Gemfile.lock - generators - generators/refinerycms_blog - generators/refinerycms_blog/refinerycms_blog_generator.rb - generators/refinerycms_blog/templates - generators/refinerycms_blog/templates/db - generators/refinerycms_blog/templates/db/migrate - generators/refinerycms_blog/templates/db/migrate/migration.rb - generators/refinerycms_blog/templates/db/seeds - generators/refinerycms_blog/templates/db/seeds/seed.rb - lib - lib/gemspec.rb - lib/generators - lib/generators/refinerycms_blog - lib/generators/refinerycms_blog/templates - lib/generators/refinerycms_blog/templates/db - lib/generators/refinerycms_blog/templates/db/migrate - lib/generators/refinerycms_blog/templates/db/migrate/migration_number_create_singular_name.rb - lib/generators/refinerycms_blog/templates/db/seeds - lib/generators/refinerycms_blog/templates/db/seeds/seed.rb - lib/generators/refinerycms_blog_generator.rb - lib/refinerycms-blog.rb - public - public/images - public/images/refinerycms-blog - public/images/refinerycms-blog/icons - public/images/refinerycms-blog/icons/cog.png - public/images/refinerycms-blog/icons/comment.png - public/images/refinerycms-blog/icons/comment_cross.png - public/images/refinerycms-blog/icons/comment_tick.png - public/images/refinerycms-blog/icons/comments.png - public/images/refinerycms-blog/icons/down.gif - public/images/refinerycms-blog/icons/folder.png - public/images/refinerycms-blog/icons/folder_add.png - public/images/refinerycms-blog/icons/folder_edit.png - public/images/refinerycms-blog/icons/page.png - public/images/refinerycms-blog/icons/page_add.png - public/images/refinerycms-blog/icons/page_copy.png - public/images/refinerycms-blog/icons/up.gif - public/images/refinerycms-blog/rss-feed.png - public/javascripts - public/javascripts/refinery - public/javascripts/refinery/refinerycms-blog.js - public/javascripts/refinerycms-blog.js - public/stylesheets - public/stylesheets/refinery - public/stylesheets/refinery/refinerycms-blog.css - public/stylesheets/refinerycms-blog.css - rails - rails/init.rb - readme.md - spec - spec/models - spec/models/blog_categories_spec.rb - spec/models/blog_comments_spec.rb - spec/models/blog_posts_spec.rb - ) - + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- spec/*`.split("\n") + + # Runtime dependencies + s.add_dependency 'refinerycms-core', '~> 2.1.0.dev' + s.add_dependency 'refinerycms-settings', '~> 2.1.0.dev' + s.add_dependency 'filters_spam', '~> 0.2' + s.add_dependency 'acts-as-taggable-on' + s.add_dependency 'seo_meta', '~> 1.3.0' + s.add_dependency 'rails_autolink', '~> 1.0.7' end diff --git a/script/rails b/script/rails new file mode 100755 index 0000000..4309856 --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +ENGINE_PATH = File.expand_path('../..', __FILE__) +load File.expand_path('../../spec/dummy/script/rails', __FILE__) diff --git a/spec/factories/blog_categories.rb b/spec/factories/blog_categories.rb new file mode 100644 index 0000000..82f629b --- /dev/null +++ b/spec/factories/blog_categories.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :blog_category, :class => Refinery::Blog::Category do + sequence(:title) { |n| "Shopping #{n}" } + end +end diff --git a/spec/factories/blog_comments.rb b/spec/factories/blog_comments.rb new file mode 100644 index 0000000..e0309b2 --- /dev/null +++ b/spec/factories/blog_comments.rb @@ -0,0 +1,19 @@ +FactoryGirl.define do + factory :blog_comment, :class => Refinery::Blog::Comment do + name "Joe Commenter" + sequence(:email) { |n| "person#{n}@example.com" } + body "Which one is the best for picking up new shoes?" + association :post, :factory => :blog_post + + trait :approved do + state 'approved' + end + + trait :rejected do + state 'rejected' + end + + factory :approved_comment, :traits => [:approved] + factory :rejected_comment, :traits => [:rejected] + end +end diff --git a/spec/factories/blog_posts.rb b/spec/factories/blog_posts.rb new file mode 100644 index 0000000..1ad2bd2 --- /dev/null +++ b/spec/factories/blog_posts.rb @@ -0,0 +1,13 @@ +FactoryGirl.define do + factory :blog_post, :class => Refinery::Blog::Post do + sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } + body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." + draft false + tag_list "chicago, shopping, fun times" + published_at Time.now + + factory :blog_post_draft do + draft true + end + end +end diff --git a/spec/helpers/refinery/blog/posts_helper_spec.rb b/spec/helpers/refinery/blog/posts_helper_spec.rb new file mode 100644 index 0000000..b8c8911 --- /dev/null +++ b/spec/helpers/refinery/blog/posts_helper_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' + +module Refinery + module Blog + describe PostsHelper do + describe "#blog_archive_widget" do + let(:html) { helper.blog_archive_widget(dates) } + let(:links) { Capybara.string(html).find("#blog_archive_widget ul") } + + context "with no archive dates" do + let(:dates) { [] } + + it "does not display anything" do + html.should be_blank + end + end + + context "with archive dates" do + let(:recent_post) { 2.months.ago } + let(:old_post) { 4.years.ago } + + let(:dates) do + [old_post, recent_post].map do |date| + [date, date.beginning_of_month, date.end_of_month] + end.flatten + end + + it "has a link for the month of dates not older than one year" do + month = Date::MONTHNAMES[recent_post.month] + year = recent_post.year + + links.should have_link("#{month} #{year} (3)") + end + + it "has a link for the year of dates older than one year" do + year = old_post.year + + links.should have_link("#{year} (3)") + end + + it "sorts recent links before old links" do + links.find("li:first").should have_content(recent_post.year.to_s) + links.find("li:last").should have_content(old_post.year.to_s) + end + end + + context "with multiple recent dates" do + let(:dates) { [3.months.ago, 2.months.ago] } + + it "sorts by the more recent date" do + first, second = dates.map {|p| Date::MONTHNAMES[p.month] } + + links.find("li:first").should have_content(second) + links.find("li:last").should have_content(first) + end + end + + context "with multiple old dates" do + let(:dates) { [5.years.ago, 4.years.ago] } + + it "sorts by the more recent date" do + first, second = dates.map {|p| p.year.to_s } + + links.find("li:first").should have_content(second) + links.find("li:last").should have_content(first) + end + end + end + end + end +end diff --git a/spec/lib/refinery/blog/engine_spec.rb b/spec/lib/refinery/blog/engine_spec.rb new file mode 100644 index 0000000..b64601a --- /dev/null +++ b/spec/lib/refinery/blog/engine_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +module Refinery + module Blog + describe Engine do + describe "plugin activity" do + let(:activity) do + Refinery::Plugins.registered.find_by_name("refinerycms_blog").activity.first + end + + it "sets the correct path for activity entries" do + activity.url.should eq("refinery.edit_blog_admin_post_path") + end + end + + describe ".load_seed" do + it "is idempotent" do + Engine.load_seed + Engine.load_seed + + Refinery::Page.where(:link_url => '/blog').count.should eq(1) + end + end + end + end +end diff --git a/spec/models/blog_categories_spec.rb b/spec/models/blog_categories_spec.rb deleted file mode 100644 index af10b3a..0000000 --- a/spec/models/blog_categories_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} - -describe BlogCategory do - context "wiring up" do - - before(:each) do - @category = Factory(:blog_category) - end - - it "saves" do - @category.should_not be_nil - end - - it "has a blog post" do - BlogPost.last.categories.should include(@category) - end - - end - -end diff --git a/spec/models/blog_comments_spec.rb b/spec/models/blog_comments_spec.rb deleted file mode 100644 index a7c1d33..0000000 --- a/spec/models/blog_comments_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} - -describe BlogComment do - - context "wiring up" do - - before(:each) do - @comment = Factory(:blog_comment) - end - - it "saves" do - @comment.should_not be_nil - end - - it "has a blog post" do - @comment.post.should_not be_nil - end - - end -end diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb deleted file mode 100644 index 179197d..0000000 --- a/spec/models/blog_posts_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'spec_helper' -Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} - -describe BlogPost do - context "wiring up" do - - before(:each) do - @post = Factory(:post) - end - - it "saves to the database" do - @post.should_not be_nil - end - - end -end diff --git a/spec/models/refinery/blog/category_spec.rb b/spec/models/refinery/blog/category_spec.rb new file mode 100644 index 0000000..9c4a7d3 --- /dev/null +++ b/spec/models/refinery/blog/category_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +module Refinery + module Blog + describe Category do + let(:category) { FactoryGirl.create(:blog_category) } + + describe "validations" do + it "requires title" do + FactoryGirl.build(:blog_category, :title => "").should_not be_valid + end + + it "won't allow duplicate titles" do + FactoryGirl.build(:blog_category, :title => category.title).should_not be_valid + end + end + + describe "blog posts association" do + it "has a posts attribute" do + category.should respond_to(:posts) + end + + it "returns posts by published_at date in descending order" do + first_post = category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday }) + latest_post = category.posts.create!({ :title => "parndt is p. okay", :body => "For a Kiwi.", :published_at => Time.now }) + + category.posts.first.should == latest_post + end + + end + + describe "#post_count" do + it "returns post count in category" do + 2.times do + category.posts << FactoryGirl.create(:blog_post) + end + category.post_count.should == 2 + end + end + end + end +end \ No newline at end of file diff --git a/spec/models/refinery/blog/comment_spec.rb b/spec/models/refinery/blog/comment_spec.rb new file mode 100644 index 0000000..3a77100 --- /dev/null +++ b/spec/models/refinery/blog/comment_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +module Refinery + module Blog + describe Comment do + context "wiring up" do + let(:comment) { FactoryGirl.create(:blog_comment) } + + it "saves" do + comment.should_not be_nil + end + + it "has a blog post" do + comment.post.should_not be_nil + end + end + end + end +end diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb new file mode 100644 index 0000000..7b0c9be --- /dev/null +++ b/spec/models/refinery/blog/post_spec.rb @@ -0,0 +1,233 @@ +require 'spec_helper' + +module Refinery + module Blog + describe Post do + let(:post) { FactoryGirl.create(:blog_post) } + + describe "validations" do + it "requires title" do + FactoryGirl.build(:blog_post, :title => "").should_not be_valid + end + + it "won't allow duplicate titles" do + FactoryGirl.build(:blog_post, :title => post.title).should_not be_valid + end + + it "requires body" do + FactoryGirl.build(:blog_post, :body => nil).should_not be_valid + end + end + + describe "comments association" do + + it "have a comments attribute" do + post.should respond_to(:comments) + end + + it "destroys associated comments" do + FactoryGirl.create(:blog_comment, :blog_post_id => post.id) + post.destroy + Blog::Comment.where(:blog_post_id => post.id).should be_empty + end + end + + describe "categories association" do + it "have categories attribute" do + post.should respond_to(:categories) + end + end + + describe "tags" do + it "acts as taggable" do + post.should respond_to(:tag_list) + + #the factory has default tags, including 'chicago' + post.tag_list.should include("chicago") + end + end + + describe "authors" do + it "are authored" do + described_class.instance_methods.map(&:to_sym).should include(:author) + end + end + + describe "by_month" do + before do + @post1 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 11)) + @post2 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 12)) + + #2 months before + FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 1, 10)) + end + + it "returns all posts from specified month" do + #check for this month + date = "03/2011" + described_class.by_month(Time.parse(date)).count.should be == 2 + described_class.by_month(Time.parse(date)).should == [@post2, @post1] + end + end + + describe ".published_dates_older_than" do + before do + @post1 = FactoryGirl.create(:blog_post, :published_at => Time.utc(2012, 05, 01, 15, 20)) + @post2 = FactoryGirl.create(:blog_post, :published_at => Time.utc(2012, 05, 01, 15, 30)) + FactoryGirl.create(:blog_post, :published_at => Time.now) + end + + it "returns all published dates older than the argument" do + expected = [@post2.published_at, @post1.published_at] + + described_class.published_dates_older_than(5.minutes.ago).should eq(expected) + end + end + + describe "live" do + before do + @post1 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -2)) + @post2 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1)) + FactoryGirl.create(:blog_post, :draft => true) + FactoryGirl.create(:blog_post, :published_at => Time.now + 1.minute) + end + + it "returns all posts which aren't in draft and pub date isn't in future" do + described_class.live.count.should be == 2 + described_class.live.should == [@post2, @post1] + end + end + + describe "uncategorized" do + before do + @uncategorized_post = FactoryGirl.create(:blog_post) + @categorized_post = FactoryGirl.create(:blog_post) + + @categorized_post.categories << FactoryGirl.create(:blog_category) + end + + it "returns uncategorized posts if they exist" do + described_class.uncategorized.should include @uncategorized_post + described_class.uncategorized.should_not include @categorized_post + end + end + + describe "#live?" do + it "returns true if post is not in draft and it's published" do + Factory.build(:blog_post).should be_live + end + + it "returns false if post is in draft" do + Factory.build(:blog_post, :draft => true).should_not be_live + end + + it "returns false if post pub date is in future" do + Factory.build(:blog_post, :published_at => Time.now.advance(:minutes => 1)).should_not be_live + end + end + + describe "#next" do + before do + FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:days => -1)) + @post = FactoryGirl.create(:blog_post) + end + + it "returns next article when called on current article" do + described_class.last.next.should == @post + end + end + + describe "#prev" do + before do + FactoryGirl.create(:blog_post) + @post = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:days => -1)) + end + + it "returns previous article when called on current article" do + described_class.first.prev.should == @post + end + end + + describe ".comments_allowed?" do + context "with Refinery::Setting comments_allowed set to true" do + before do + Refinery::Setting.set(:comments_allowed, { :scoping => 'blog', :value => true }) + end + + it "should be true" do + described_class.comments_allowed?.should be_true + end + end + + context "with Refinery::Setting comments_allowed set to false" do + before do + Refinery::Setting.set(:comments_allowed, { :scoping => 'blog', :value => false }) + end + + it "should be false" do + described_class.comments_allowed?.should be_false + end + end + end + + describe "custom teasers" do + it "should allow a custom teaser" do + FactoryGirl.create(:blog_post, :custom_teaser => 'This is some custom content').should be_valid + end + end + + describe ".teasers_enabled?" do + context "with Refinery::Setting teasers_enabled set to true" do + before do + Refinery::Setting.set(:teasers_enabled, { :scoping => 'blog', :value => true }) + end + + it "should be true" do + described_class.teasers_enabled?.should be_true + end + end + + context "with Refinery::Setting teasers_enabled set to false" do + before do + Refinery::Setting.set(:teasers_enabled, { :scoping => 'blog', :value => false }) + end + + it "should be false" do + described_class.teasers_enabled?.should be_false + end + end + end + + describe "source url" do + it "should allow a source url and title" do + p = FactoryGirl.create(:blog_post, :source_url => 'google.com', :source_url_title => 'author') + p.should be_valid + p.source_url.should include('google') + p.source_url_title.should include('author') + end + end + + describe ".validate_source_url?" do + context "with Refinery::Blog.validate_source_url set to true" do + before do + Refinery::Blog.validate_source_url = true + end + it "should have canonical url" do + p = FactoryGirl.create(:blog_post, :source_url => 'google.com', :source_url_title => 'google') + p.source_url.should include('www') + end + end + context "with Refinery::Blog.validate_source_url set to false" do + before do + Refinery::Blog.validate_source_url = false + end + it "should have original url" do + p = FactoryGirl.create(:blog_post, :source_url => 'google.com', :source_url_title => 'google') + p.source_url.should_not include('www') + end + end + end + + end + end +end diff --git a/spec/requests/refinery/blog/admin/categories_spec.rb b/spec/requests/refinery/blog/admin/categories_spec.rb new file mode 100644 index 0000000..c1809f7 --- /dev/null +++ b/spec/requests/refinery/blog/admin/categories_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "Categories admin" do + refinery_login_with :refinery_user + + let(:title) { "lol" } + + it "can create categories" do + visit refinery.admin_root_path + + within("nav#menu") { click_link "Blog" } + within("nav.multilist") { click_link "Create new category" } + + fill_in "Title", :with => title + click_button "Save" + + category = Refinery::Blog::Category.first + category.title.should eq(title) + end +end diff --git a/spec/requests/refinery/blog/admin/comments_spec.rb b/spec/requests/refinery/blog/admin/comments_spec.rb new file mode 100644 index 0000000..c834d13 --- /dev/null +++ b/spec/requests/refinery/blog/admin/comments_spec.rb @@ -0,0 +1,121 @@ +require "spec_helper" + +module Refinery + module Blog + module Admin + describe Comment do + refinery_login_with :refinery_user + + describe "#index" do + context "when has no new unapproved comments" do + before(:each) do + subject.class.delete_all + visit refinery.blog_admin_comments_path + end + + it "should list no comments" do + visit refinery.blog_admin_comments_path + + page.should have_content('There are no new comments') + end + end + context "when has new unapproved comments" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + before(:each) { visit refinery.blog_admin_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to approve a comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + + it "should allow me to reject a comment" do + click_link "Reject this comment" + + page.should have_content("has been rejected") + end + end + end + + describe "#approved" do + context "when has no approved comments" do + before(:each) do + subject.class.delete_all + visit refinery.approved_blog_admin_comments_path + end + + it "should list no comments" do + page.should have_content('There are no approved comments') + end + end + context "when has approved comments" do + let!(:blog_comment) do + FactoryGirl.create(:blog_comment, :state => 'approved') + end + before(:each) { visit refinery.approved_blog_admin_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to reject a comment" do + click_link "Reject this comment" + + page.should have_content("has been rejected") + end + end + end + + describe "#rejected" do + context "when has no rejected comments" do + before(:each) do + subject.class.delete_all + visit refinery.rejected_blog_admin_comments_path + end + + it "should list no comments" do + page.should have_content('There are no rejected comments') + end + end + context "when has rejected comments" do + let!(:blog_comment) do + FactoryGirl.create(:blog_comment, :state => 'rejected') + end + before(:each) { visit refinery.rejected_blog_admin_comments_path } + + it "should list comments" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + + it "should allow me to approve a comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + end + end + + describe "#show" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + before(:each) { visit refinery.blog_admin_comment_path(blog_comment) } + it "should display the comment" do + page.should have_content(blog_comment.body) + page.should have_content(blog_comment.name) + end + it "should allow me to approve the comment" do + click_link "Approve this comment" + + page.should have_content("has been approved") + end + end + end + end + end +end diff --git a/spec/requests/refinery/blog/admin/menu_spec.rb b/spec/requests/refinery/blog/admin/menu_spec.rb new file mode 100644 index 0000000..ba10ffe --- /dev/null +++ b/spec/requests/refinery/blog/admin/menu_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +describe "Blog menu entry" do + refinery_login_with :refinery_user + + it "is highlighted when managing the blog" do + visit refinery.admin_root_path + + within("#menu") { click_link "Blog" } + + page.should have_css("a.active", :text => "Blog") + end +end diff --git a/spec/requests/refinery/blog/admin/posts_spec.rb b/spec/requests/refinery/blog/admin/posts_spec.rb new file mode 100644 index 0000000..7972162 --- /dev/null +++ b/spec/requests/refinery/blog/admin/posts_spec.rb @@ -0,0 +1,175 @@ +require "spec_helper" + +module Refinery + module Blog + module Admin + describe Post do + refinery_login_with :refinery_user + + let!(:blog_category) { FactoryGirl.create(:blog_category, :title => "Video Games") } + + context "when no blog posts" do + before(:each) { subject.class.destroy_all } + + describe "blog post listing" do + before(:each) { visit refinery.blog_admin_posts_path } + + it "invites to create new post" do + page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.") + end + end + + describe "new blog post form" do + before(:each) do + visit refinery.blog_admin_posts_path + click_link "Create new post" + end + + it "should have Tags" do + page.should have_content("Tags") + end + + it "should have Video Games" do + page.should have_content(blog_category.title) + end + + describe "create blog post" do + before(:each) do + fill_in "Title", :with => "This is my blog post" + fill_in "post_body", :with => "And I love it" + check blog_category.title + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + subject.class.all.size.should eq(1) + end + + it "should belong to me" do + subject.class.first.author.should eq(::Refinery::User.last) + end + + it "should save categories" do + subject.class.last.categories.count.should eq(1) + subject.class.last.categories.first.title.should eq(blog_category.title) + end + end + + describe "create blog post with tags" do + before(:each) do + @tag_list = "chicago, bikes, beers, babes" + fill_in "Title", :with => "This is a tagged blog post" + fill_in "post_body", :with => "And I also love it" + fill_in "Tags", :with => @tag_list + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + subject.class.all.size.should eq(1) + end + + it "should have the specified tags" do + subject.class.last.tag_list.sort.should eq(@tag_list.split(', ').sort) + end + end + end + end + + context "when has blog posts" do + let!(:blog_post) { FactoryGirl.create(:blog_post) } + + describe "blog post listing" do + before(:each) { visit refinery.blog_admin_posts_path } + + describe "edit blog post" do + it "should succeed" do + page.should have_content(blog_post.title) + + click_link("Edit this blog post") + current_path.should == refinery.edit_blog_admin_post_path(blog_post) + + fill_in "Title", :with => "hax0r" + click_button "Save" + + page.should_not have_content(blog_post.title) + page.should have_content("'hax0r' was successfully updated.") + end + end + + describe "deleting blog post" do + it "should succeed" do + page.should have_content(blog_post.title) + + click_link "Remove this blog post forever" + + page.should have_content("'#{blog_post.title}' was successfully removed.") + end + end + + describe "view live" do + it "redirects to blog post in the frontend" do + click_link "View this blog post live" + + current_path.should == refinery.blog_post_path(blog_post) + page.should have_content(blog_post.title) + end + end + end + + context "when uncategorized post" do + it "shows up in the list" do + visit refinery.uncategorized_blog_admin_posts_path + page.should have_content(blog_post.title) + end + end + + context "when categorized post" do + it "won't show up in the list" do + blog_post.categories << blog_category + blog_post.save! + + visit refinery.uncategorized_blog_admin_posts_path + page.should_not have_content(blog_post.title) + end + end + end + + context "with multiple users" do + let!(:other_guy) { Factory(:refinery_user, :username => "Other Guy") } + + describe "create blog post with alternate author" do + before(:each) do + visit refinery.blog_admin_posts_path + click_link "Create new post" + + fill_in "Title", :with => "This is some other guy's blog post" + fill_in "post_body", :with => "I totally didn't write it." + + click_link "Advanced Options" + + select other_guy.username, :from => "Author" + + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "belongs to another user" do + subject.class.last.author.should eq(other_guy) + end + end + end + end + end + end +end diff --git a/spec/requests/refinery/blog/categories_spec.rb b/spec/requests/refinery/blog/categories_spec.rb new file mode 100644 index 0000000..3834992 --- /dev/null +++ b/spec/requests/refinery/blog/categories_spec.rb @@ -0,0 +1,24 @@ +require "spec_helper" + +module Refinery + describe "BlogCategories" do + refinery_login_with :refinery_user + + context "has one category and post" do + before(:each) do + @post = FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") + @category = FactoryGirl.create(:blog_category, :title => "Video Games") + @post.categories << @category + @post.save! + end + + describe "show categories blog posts" do + before(:each) { visit refinery.blog_category_path(@category) } + it "should displays categories blog posts" do + page.should have_content("Refinery CMS blog post") + page.should have_content("Video Games") + end + end + end + end +end diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb new file mode 100644 index 0000000..3422dd2 --- /dev/null +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -0,0 +1,160 @@ +require "spec_helper" + +module Refinery + describe "Blog::Posts" do + refinery_login_with :refinery_user + + context "when has blog posts" do + let!(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") } + + it "should display blog post" do + visit refinery.blog_post_path(blog_post) + + page.should have_content(blog_post.title) + end + + it "should display the blog rss feed" do + get refinery.blog_rss_feed_path + + response.should be_success + response.content_type.should eq("application/rss+xml") + end + end + + describe "list tagged posts" do + context "when has tagged blog posts" do + before(:each) do + @tag_name = "chicago" + @post = FactoryGirl.create(:blog_post, + :title => "I Love my city", + :tag_list => @tag_name) + @tag = ::Refinery::Blog::Post.tag_counts_on(:tags).first + end + it "should have one tagged post" do + visit refinery.blog_tagged_posts_path(@tag.id, @tag_name.parameterize) + + page.should have_content(@tag_name) + page.should have_content(@post.title) + end + end + end + + describe "#show" do + context "when has no comments" do + let(:blog_post) { FactoryGirl.create(:blog_post) } + + it "should display the blog post" do + visit refinery.blog_post_path(blog_post) + page.should have_content(blog_post.title) + page.should have_content(blog_post.body) + end + end + context "when has approved comments" do + let(:approved_comment) { FactoryGirl.create(:approved_comment) } + + it "should display the comments" do + visit refinery.blog_post_path(approved_comment.post) + + page.should have_content(approved_comment.body) + page.should have_content("Posted by #{approved_comment.name}") + end + end + context "when has rejected comments" do + let(:rejected_comment) { FactoryGirl.create(:rejected_comment) } + + it "should not display the comments" do + visit refinery.blog_post_path(rejected_comment.post) + + page.should_not have_content(rejected_comment.body) + end + end + context "when has new comments" do + let(:blog_comment) { FactoryGirl.create(:blog_comment) } + + it "should not display the comments" do + visit refinery.blog_post_path(blog_comment.post) + + page.should_not have_content(blog_comment.body) + end + end + + context "when posting comments" do + let(:blog_post) { Factory(:blog_post) } + let(:name) { "pete" } + let(:email) { "pete@mcawesome.com" } + let(:body) { "Witty comment." } + + before do + visit refinery.blog_post_path(blog_post) + + fill_in "Name", :with => name + fill_in "Email", :with => email + fill_in "Message", :with => body + click_button "Send comment" + end + + it "creates the comment" do + comment = blog_post.reload.comments.last + + comment.name.should eq(name) + comment.email.should eq(email) + comment.body.should eq(body) + end + end + + context "post popular" do + let(:blog_post) { FactoryGirl.create(:blog_post) } + let(:blog_post2) { FactoryGirl.create(:blog_post) } + + before do + visit refinery.blog_post_path(blog_post) + end + + it "should increment access count" do + blog_post.reload.access_count.should eq(1) + visit refinery.blog_post_path(blog_post) + blog_post.reload.access_count.should eq(2) + end + + it "should be most popular" do + Refinery::Blog::Post.popular(2).first.should eq(blog_post) + end + end + + context "post recent" do + let(:blog_post) { FactoryGirl.create(:blog_post) } + let(:blog_post2) { FactoryGirl.create(:blog_post) } + + before do + visit refinery.blog_post_path(blog_post2) + visit refinery.blog_post_path(blog_post) + end + + it "should be the most recent" do + Refinery::Blog::Post.recent(2).first.should eq(blog_post2) + end + end + + end + + describe "#show draft preview" do + let(:blog_post) { FactoryGirl.create(:blog_post_draft) } + context "when logged in as admin" do + it "should display the draft notification" do + visit refinery.blog_post_path(blog_post) + + page.should have_content('This page is NOT live for public viewing.') + end + end + context "when not logged in as an admin" do + before(:each) { visit refinery.destroy_refinery_user_session_path } + + it "should not display the blog post" do + visit refinery.blog_post_path(blog_post) + + page.should have_content("The page you were looking for doesn't exist (404)") + end + end + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..a313bbb --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,56 @@ +require 'rubygems' + +def setup_environment + # Configure Rails Environment + ENV["RAILS_ENV"] ||= 'test' + + require File.expand_path("../dummy/config/environment", __FILE__) + + require 'rspec/rails' + require 'capybara/rspec' + require 'factory_girl_rails' + + Rails.backtrace_cleaner.remove_silencers! + + RSpec.configure do |config| + config.mock_with :rspec + config.treat_symbols_as_metadata_keys_with_true_values = true + config.filter_run :focus => true + config.run_all_when_everything_filtered = true + end + + # set javascript driver for capybara + Capybara.javascript_driver = :selenium +end + +def each_run + ActiveSupport::Dependencies.clear + + FactoryGirl.reload + + # Requires supporting files with custom matchers and macros, etc, + # in ./support/ and its subdirectories including factories. + ([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p| + Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s] + }.flatten.sort.each do |support_file| + require support_file + end +end + +# If spork is available in the Gemfile it'll be used but we don't force it. +unless (begin; require 'spork'; rescue LoadError; nil end).nil? + Spork.prefork do + # Loading more in this block will cause your tests to run faster. However, + # if you change any configuration or code from libraries loaded here, you'll + # need to restart spork for it take effect. + setup_environment + end + + Spork.each_run do + # This code will be run each time you run your specs. + each_run + end +else + setup_environment + each_run +end diff --git a/tasks/rspec.rake b/tasks/rspec.rake new file mode 100644 index 0000000..2ce7751 --- /dev/null +++ b/tasks/rspec.rake @@ -0,0 +1,4 @@ +require 'rspec/core/rake_task' + +desc "Run specs" +RSpec::Core::RakeTask.new diff --git a/todo.md b/todo.md new file mode 100644 index 0000000..f32af48 --- /dev/null +++ b/todo.md @@ -0,0 +1,5 @@ +## Why not, let's get this list going, eh? + +* Replace comments with disqus? +* Facebook/twitter login for comments? +* What else? Add your ideas... \ No newline at end of file