Compare commits
1 commit
master
...
rails2-sta
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1a666d4a73 |
10
.gitignore
vendored
|
@ -14,7 +14,6 @@ doc/*
|
|||
*.autobackupbyrefinery.*
|
||||
/refinerycms-blog*.gem
|
||||
.autotest
|
||||
spec/dummy
|
||||
|
||||
# Mac
|
||||
.DS_Store
|
||||
|
@ -43,12 +42,3 @@ nbproject
|
|||
|
||||
# Capybara Bug
|
||||
capybara-*html
|
||||
|
||||
# rvm
|
||||
.rvmrc
|
||||
|
||||
#rbenv
|
||||
.rbenv-version
|
||||
|
||||
Gemfile.lock
|
||||
.rbx
|
1
.rspec
|
@ -1 +0,0 @@
|
|||
--colour
|
20
.travis.yml
|
@ -1,20 +0,0 @@
|
|||
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
|
72
Gemfile
|
@ -1,70 +1,2 @@
|
|||
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'
|
||||
gem 'filters_spam', '~> 0.3'
|
||||
gem "will_paginate", ">= 2.3.14"
|
11
Gemfile.lock
Normal file
|
@ -0,0 +1,11 @@
|
|||
GEM
|
||||
specs:
|
||||
filters_spam (0.3)
|
||||
will_paginate (2.3.14)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
filters_spam (~> 0.3)
|
||||
will_paginate (>= 2.3.14)
|
20
Guardfile
|
@ -1,20 +0,0 @@
|
|||
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
|
19
Rakefile
|
@ -1,19 +0,0 @@
|
|||
#!/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__)
|
|
@ -1,115 +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=$("<div></div>"));
|
||||
|
||||
$("<span class='arrow'> </span>").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;
|
||||
}
|
||||
})
|
||||
});
|
|
@ -1,73 +0,0 @@
|
|||
.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;
|
||||
}
|
Before Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 104 B |
Before Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 105 B |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 90 B |
Before Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB |
|
@ -1,330 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
7
app/controllers/admin/blog/categories_controller.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Admin::Blog::CategoriesController < Admin::BaseController
|
||||
|
||||
crudify :blog_category,
|
||||
:title_attribute => :title,
|
||||
:order => 'title ASC'
|
||||
|
||||
end
|
36
app/controllers/admin/blog/comments_controller.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
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
|
14
app/controllers/admin/blog/posts_controller.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
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
|
27
app/controllers/admin/blog/settings_controller.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
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 => "<script type='text/javascript'>parent.window.location = '#{admin_blog_posts_path}';</script>"
|
||||
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
|
7
app/controllers/blog/categories_controller.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Blog::CategoriesController < BlogController
|
||||
|
||||
def show
|
||||
@category = BlogCategory.find(params[:id])
|
||||
end
|
||||
|
||||
end
|
68
app/controllers/blog/posts_controller.rb
Normal file
|
@ -0,0 +1,68 @@
|
|||
class Blog::PostsController < BlogController
|
||||
|
||||
before_filter :find_all_blog_posts, :except => [:archive]
|
||||
before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
|
||||
|
||||
def index
|
||||
# TODO: respond_to block
|
||||
end
|
||||
|
||||
def show
|
||||
@blog_comment = BlogComment.new
|
||||
|
||||
# TODO: respond_to block
|
||||
end
|
||||
|
||||
def comment
|
||||
if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
|
||||
if BlogComment::Moderation.enabled? or @blog_comment.ham?
|
||||
begin
|
||||
Blog::CommentMailer.deliver_notification(@blog_comment, request)
|
||||
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)
|
||||
})
|
||||
# TODO: respond_to block
|
||||
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
|
16
app/controllers/blog_controller.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
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
|
|
@ -1,12 +0,0 @@
|
|||
module Refinery
|
||||
module Blog
|
||||
module Admin
|
||||
class CategoriesController < ::Refinery::AdminController
|
||||
|
||||
crudify :'refinery/blog/category',
|
||||
:order => 'title ASC'
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,49 +0,0 @@
|
|||
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
|
|
@ -1,90 +0,0 @@
|
|||
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 => "<script>parent.window.location = '#{refinery.blog_admin_posts_url}';</script>"
|
||||
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
|
|
@ -1,55 +0,0 @@
|
|||
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 => "<script type='text/javascript'>parent.window.location = '#{refinery.blog_admin_posts_path}';</script>",
|
||||
: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
|
|
@ -1,17 +0,0 @@
|
|||
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
|
|
@ -1,12 +0,0 @@
|
|||
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
|
|
@ -1,85 +0,0 @@
|
|||
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
|
28
app/helpers/blog_posts_helper.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
module BlogPostsHelper
|
||||
def blog_archive_list
|
||||
posts = BlogPost.select('published_at').all_previous
|
||||
return nil if posts.blank?
|
||||
html = '<section id="blog_archive_list"><h2>Archives</h2><nav><ul>'
|
||||
links = []
|
||||
|
||||
posts.each do |e|
|
||||
links << e.published_at.strftime('%m/%Y')
|
||||
end
|
||||
links.uniq!
|
||||
links.each do |l|
|
||||
year = l.split('/')[1]
|
||||
month = l.split('/')[0]
|
||||
count = BlogPost.by_archive(Time.parse(l)).size
|
||||
text = "#{Date::MONTHNAMES[month.to_i]} #{year} (#{count})"
|
||||
html += "<li>"
|
||||
html += link_to(text, archive_blog_posts_path(:year => year, :month => month))
|
||||
html += "</li>"
|
||||
end
|
||||
html += '</ul></nav></section>'
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
def next_or_previous?(post)
|
||||
post.next.present? or post.prev.present?
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
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
|
|
@ -1,72 +0,0 @@
|
|||
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
|
11
app/mailers/blog/comment_mailer.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class Blog::CommentMailer < ActionMailer::Base
|
||||
|
||||
def notification(comment, request)
|
||||
subject BlogComment::Notification.subject
|
||||
recipients BlogComment::Notification.recipients
|
||||
from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
|
||||
sent_on Time.now
|
||||
@comment = comment
|
||||
end
|
||||
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
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}\" <no-reply@#{request.domain}>"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
1
app/models/blog/comment_mailer.rb
Normal file
|
@ -0,0 +1 @@
|
|||
require File.expand_path('../../../mailers/blog/comment_mailer', __FILE__)
|
23
app/models/blog_category.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
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
|
116
app/models/blog_comment.rb
Normal file
|
@ -0,0 +1,116 @@
|
|||
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
|
||||
|
||||
named_scope :unmoderated, :conditions => {:state => nil}
|
||||
named_scope :approved, :conditions => {:state => 'approved'}
|
||||
named_scope :rejected, :conditions => {:state => 'rejected'}
|
||||
|
||||
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
|
65
app/models/blog_post.rb
Normal file
|
@ -0,0 +1,65 @@
|
|||
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
|
||||
|
||||
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"} }
|
||||
|
||||
named_scope :all_previous, :conditions => ['published_at <= ?', Time.now.beginning_of_month], :order => "published_at DESC"
|
||||
|
||||
named_scope :live, lambda { {:conditions => ["published_at < ? and draft = ?", Time.now, false], :order => "published_at DESC"} }
|
||||
|
||||
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 } }
|
||||
|
||||
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
|
|
@ -1,25 +0,0 @@
|
|||
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
|
|
@ -1,135 +0,0 @@
|
|||
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
|
|
@ -1,120 +0,0 @@
|
|||
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
|
|
@ -1,10 +0,0 @@
|
|||
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
|
|
@ -1,26 +0,0 @@
|
|||
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
|
89
app/views/admin/blog/_submenu.html.erb
Normal file
|
@ -0,0 +1,89 @@
|
|||
<nav id='actions' class='multilist'>
|
||||
<ul class='search_list'>
|
||||
<li>
|
||||
<%= render :partial => "/shared/admin/search",
|
||||
:locals => {
|
||||
:url => admin_blog_posts_url
|
||||
} %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class='collapsible_menu'>
|
||||
<li>
|
||||
<%= link_to t('.posts.title'), '#',
|
||||
:class => 'page_copy_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.posts.manage'), admin_blog_posts_path,
|
||||
:class => 'page_icon' %>
|
||||
<li>
|
||||
<%= link_to t('.posts.new'), new_admin_blog_post_url,
|
||||
:class => 'page_add_icon' %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class='collapsible_menu'>
|
||||
<li>
|
||||
<% if BlogComment.unmoderated.any? %>
|
||||
<% title = t('.comments.title_with_count', :new_count => BlogComment.unmoderated.size) %>
|
||||
<% else %>
|
||||
<% title = t('.comments.title') %>
|
||||
<% end %>
|
||||
<%= link_to title, '#',
|
||||
:class => 'comments_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.comments.new'), admin_blog_comments_path,
|
||||
:class => 'comment_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.comments.approved'), approved_admin_blog_comments_path,
|
||||
:class => 'comment_tick_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.comments.rejected'), rejected_admin_blog_comments_path,
|
||||
:class => 'comment_cross_icon' %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class='collapsible_menu'>
|
||||
<li>
|
||||
<%= link_to t('.categories.title'), '#',
|
||||
:class => 'folder_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.categories.manage'), admin_blog_categories_url,
|
||||
:class => 'folder_edit_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.categories.new'), new_admin_blog_category_url(:dialog => true, :height => 325),
|
||||
:class => 'folder_add_icon' %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class='collapsible_menu'>
|
||||
<li>
|
||||
<%= link_to t('.settings.title'), admin_blog_settings_path,
|
||||
:class => 'settings_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.settings.moderation'), moderation_admin_blog_settings_url,
|
||||
:class => "#{BlogComment::Moderation.enabled? ? 'success' : 'failure'}_icon" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.settings.update_notified'),
|
||||
notification_recipients_admin_blog_settings_url(:dialog => true, :height => 400),
|
||||
:class => 'user_comment_icon' %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
<% 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 %>
|
|
@ -1,16 +1,16 @@
|
|||
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(category) -%>">
|
||||
<span class='title'>
|
||||
<%= category.title %>
|
||||
<%=h category.title %>
|
||||
<span class="preview"> </span>
|
||||
</span>
|
||||
<span class='actions'>
|
||||
<%= link_to refinery_icon_tag("application_edit.png"),
|
||||
refinery.edit_blog_admin_category_path(category, :dialog => true, :height => 325),
|
||||
edit_admin_blog_category_path(category, :dialog => true, :height => 325),
|
||||
:title => t('.edit') %>
|
||||
<%= link_to refinery_icon_tag("delete.png"), refinery.blog_admin_category_path(category),
|
||||
<%= link_to refinery_icon_tag("delete.png"), admin_blog_category_path(category),
|
||||
:class => "cancel confirm-delete",
|
||||
:title => t('.delete'),
|
||||
:method => :delete,
|
||||
:confirm => t('message', :scope => 'refinery.admin.delete', :title => category.title) %>
|
||||
:'data-method' => 'delete',
|
||||
:'data-confirm' => t('shared.admin.delete.message', :title => category.title) %>
|
||||
</span>
|
||||
</li>
|
15
app/views/admin/blog/categories/_form.html.erb
Normal file
|
@ -0,0 +1,15 @@
|
|||
<% form_for [:admin, @blog_category] do |f| -%>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<div class='field'>
|
||||
<%= f.label :title -%>
|
||||
<%= f.text_field :title, :class => 'larger widest' -%>
|
||||
</div>
|
||||
|
||||
<%= render :partial => "/shared/admin/form_actions",
|
||||
:locals => {
|
||||
:f => f,
|
||||
:continue_editing => false,
|
||||
:delete_title => t('admin.blog.categories.category.delete')
|
||||
} %>
|
||||
<% end %>
|
|
@ -1,7 +1,7 @@
|
|||
<ul id='sortable_list'>
|
||||
<%= render :partial => 'comment', :collection => @comments %>
|
||||
<%= render :partial => 'category', :collection => @blog_categories %>
|
||||
</ul>
|
||||
<%= render :partial => "/refinery/admin/sortable_list",
|
||||
<%= render :partial => "/shared/admin/sortable_list",
|
||||
:locals => {
|
||||
:continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)
|
||||
} %>
|
1
app/views/admin/blog/categories/edit.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render :partial => "form" %>
|
30
app/views/admin/blog/categories/index.html.erb
Normal file
|
@ -0,0 +1,30 @@
|
|||
<%= render :partial => '/admin/blog/submenu' %>
|
||||
<div id='records'>
|
||||
<% if searching? %>
|
||||
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
|
||||
<% if @blog_categories.any? %>
|
||||
<%= render :partial => "blog_categories",
|
||||
:collection => @blog_categories %>
|
||||
<% else %>
|
||||
<p><%= t('admin.search_no_results') %></p>
|
||||
<% 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 %>
|
||||
<p>
|
||||
<strong>
|
||||
<%= t('.no_items_yet', :create => t('admin.blog.submenu.categories.new')) %>
|
||||
</strong>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
1
app/views/admin/blog/categories/new.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render :partial => "form" %>
|
|
@ -1,20 +1,20 @@
|
|||
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= "comment-#{comment.to_param}" -%>">
|
||||
<span class='title'>
|
||||
<%= comment.name %>
|
||||
<%=h comment.name %>
|
||||
<span class="preview"> - <%= truncate(comment.message, :length => 75) %></span>
|
||||
</span>
|
||||
<span class='actions'>
|
||||
<%= link_to refinery_icon_tag("application_go.png"),
|
||||
refinery.blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"),
|
||||
:title => t('.view_live_html'),
|
||||
blog_post_url(comment.post, :anchor => "comment-#{comment.to_param}"),
|
||||
:title => t('.view_live'),
|
||||
:target => "_blank" unless comment.unmoderated? %>
|
||||
<%= link_to refinery_icon_tag('zoom.png'), refinery.blog_admin_comment_path(comment),
|
||||
<%= link_to refinery_icon_tag('zoom.png'), admin_blog_comment_path(comment),
|
||||
:title => t('.read') %>
|
||||
<%= link_to refinery_icon_tag("cross.png"),
|
||||
refinery.rejected_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
|
||||
rejected_admin_blog_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"),
|
||||
refinery.approved_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
|
||||
approved_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
|
||||
:title => t('.approve') unless comment.approved? %>
|
||||
</span>
|
||||
</li>
|
|
@ -1,7 +1,7 @@
|
|||
<ul id='sortable_list'>
|
||||
<%= render :partial => 'category', :collection => @categories %>
|
||||
<%= render :partial => 'comment', :collection => @blog_comments %>
|
||||
</ul>
|
||||
<%= render :partial => "/refinery/admin/sortable_list",
|
||||
<%= render :partial => "/shared/admin/sortable_list",
|
||||
:locals => {
|
||||
:continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)
|
||||
} %>
|
35
app/views/admin/blog/comments/index.html.erb
Normal file
|
@ -0,0 +1,35 @@
|
|||
<%= render :partial => '/admin/blog/submenu' %>
|
||||
<div id='records'>
|
||||
<% if searching? %>
|
||||
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
|
||||
<% if @blog_comments.any? %>
|
||||
<%=# will_paginate @blog_comments
|
||||
%>
|
||||
|
||||
<ul>
|
||||
<%= render :partial => "blog_comments",
|
||||
:collection => @blog_comments %>
|
||||
</ul>
|
||||
|
||||
<%=# will_paginate @blog_comments
|
||||
%>
|
||||
<% else %>
|
||||
<p><%= t('admin.search_no_results') %></p>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @blog_comments.any? %>
|
||||
<%=# will_paginate @blog_comments
|
||||
%>
|
||||
|
||||
<%= render :partial => "sortable_list" %>
|
||||
|
||||
<%=# will_paginate @blog_comments
|
||||
%>
|
||||
<% else %>
|
||||
<h3>
|
||||
<%= t('.no_items_yet',
|
||||
:type => t("admin.blog.submenu.comments.#{action_name.gsub('index', 'new')}").downcase) %>
|
||||
</h3>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
66
app/views/admin/blog/comments/show.html.erb
Normal file
|
@ -0,0 +1,66 @@
|
|||
<div id='actions'>
|
||||
<h2><%= t('.details')%></h2>
|
||||
<p>
|
||||
<strong><%= t('.age') %>:</strong> <%= time_ago_in_words(@blog_comment.created_at) %>
|
||||
</p>
|
||||
<h2><%= t('.actions') %></h2>
|
||||
<ul>
|
||||
<li>
|
||||
<%= link_to t('.back'), {:action => 'index'}, :class => "back_icon" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.reject'), rejected_admin_blog_comment_path(@blog_comment, :return_to => 'rejected'),
|
||||
:class => 'comment_cross_icon' unless @blog_comment.rejected? %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.approve'), approved_admin_blog_comment_path(@blog_comment, :return_to => 'approved'),
|
||||
:class => 'comment_tick_icon' unless @blog_comment.approved? %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id='records'>
|
||||
<h2><%= t('.comment') %></h2>
|
||||
<table id='inquiry'>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><%= t('.blog_post') %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to @blog_comment.post.title,
|
||||
blog_post_url(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"),
|
||||
:target => '_blank' %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><%= t('.from') %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= @blog_comment.name %> [<%= mail_to @blog_comment.email, @blog_comment.email, {:title => t('.click_to_email')} %>]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><%= t('.date') %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= l(Date.parse(@blog_comment.created_at.to_s), :format => :long) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<strong><%= t('.message') %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<p style='margin-top: 0px'>
|
||||
<%= @blog_comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "</p><p>") %>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% 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 %>
|
7
app/views/admin/blog/posts/_form.css.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<style type='text/css'>
|
||||
ul.blog_categories, ul.blog_categories li {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
61
app/views/admin/blog/posts/_form.html.erb
Normal file
|
@ -0,0 +1,61 @@
|
|||
<% form_for [:admin, @blog_post] do |f| -%>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<div class='field'>
|
||||
<%= f.label :title -%>
|
||||
<%= f.text_field :title, :class => 'larger widest' -%>
|
||||
</div>
|
||||
|
||||
<div class='field'>
|
||||
<%= f.label :body -%>
|
||||
<%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%>
|
||||
</div>
|
||||
<div id='more_options_field'>
|
||||
<p>
|
||||
<%= link_to t('.advanced_options'), "#",
|
||||
:id => 'toggle_advanced_options',
|
||||
:title => t('.toggle_advanced_options') %>
|
||||
</p>
|
||||
<span id='draft_field'>
|
||||
<%= f.check_box :draft %>
|
||||
<%= f.label :draft, t('.save_as_draft'), :class => "stripped" %>
|
||||
</span>
|
||||
</div>
|
||||
<div id='more_options' style="display:none;">
|
||||
<div class="hemisquare">
|
||||
<h3><%= t('admin.blog.submenu.categories.title') %></h3>
|
||||
<ul class='blog_categories'>
|
||||
<% @blog_categories.each do |category| %>
|
||||
<li>
|
||||
<%= check_box_tag 'blog_post[category_ids][]', category.id,
|
||||
@blog_post.categories.include?(category),
|
||||
:id => (id="blog_post_category_ids_#{category.id}") %>
|
||||
<%= label_tag 'blog_post[category_ids][]', category.title,
|
||||
:class => 'stripped',
|
||||
:for => id %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<h3><%= t('admin.blog.posts.form.published_at') %></h3>
|
||||
<%= f.datetime_select :published_at %>
|
||||
</div>
|
||||
<div class='hemisquare right_side'>
|
||||
</div>
|
||||
</div>
|
||||
<%= 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 %>
|
13
app/views/admin/blog/posts/_form.js.erb
Normal file
|
@ -0,0 +1,13 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#toggle_advanced_options').click(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
$('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250);
|
||||
|
||||
$('html,body').animate({
|
||||
scrollTop: $('#toggle_advanced_options').parent().offset().top
|
||||
}, 250);
|
||||
});
|
||||
});
|
||||
</script>
|
18
app/views/admin/blog/posts/_post.html.erb
Normal file
|
@ -0,0 +1,18 @@
|
|||
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(post) -%>">
|
||||
<span class='title'>
|
||||
<%=h post.title %>
|
||||
<span class="preview"> </span>
|
||||
</span>
|
||||
<span class='actions'>
|
||||
<%= 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) %>
|
||||
</span>
|
||||
</li>
|
|
@ -1,7 +1,7 @@
|
|||
<ul id='sortable_list'>
|
||||
<%= render :partial => 'post', :collection => @posts %>
|
||||
<%= render :partial => 'post', :collection => @blog_posts %>
|
||||
</ul>
|
||||
<%= render :partial => "/refinery/admin/sortable_list",
|
||||
<%= render :partial => "/shared/admin/sortable_list",
|
||||
:locals => {
|
||||
:continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)
|
||||
} %>
|
1
app/views/admin/blog/posts/edit.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render :partial => "form" %>
|
30
app/views/admin/blog/posts/index.html.erb
Normal file
|
@ -0,0 +1,30 @@
|
|||
<%= render :partial => '/admin/blog/submenu' %>
|
||||
<div id='records'>
|
||||
<% if searching? %>
|
||||
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
|
||||
<% if @blog_posts.any? %>
|
||||
<%= render :partial => "blog_posts",
|
||||
:collection => @blog_posts %>
|
||||
<% else %>
|
||||
<p><%= t('admin.search_no_results') %></p>
|
||||
<% 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 %>
|
||||
<p>
|
||||
<strong>
|
||||
<%= t('.no_items_yet', :create => t('admin.blog.submenu.posts.new')) %>
|
||||
</strong>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
1
app/views/admin/blog/posts/new.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render :partial => "form" %>
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_tag refinery.notification_recipients_blog_admin_settings_path do %>
|
||||
<% form_tag do %>
|
||||
|
||||
<div class='field'>
|
||||
<span class='label_with_help'>
|
||||
|
@ -14,11 +14,11 @@
|
|||
<%= t('.example') %>
|
||||
</p>
|
||||
|
||||
<%= render :partial => "/refinery/admin/form_actions",
|
||||
<%= render :partial => "/shared/admin/form_actions",
|
||||
:locals => {
|
||||
:f => nil,
|
||||
:continue_editing => false,
|
||||
:cancel_url => refinery.blog_admin_posts_url,
|
||||
:cancel_url => admin_blog_posts_url,
|
||||
:hide_delete => true
|
||||
} %>
|
||||
<% end %>
|
20
app/views/blog/categories/show.html.erb
Normal file
|
@ -0,0 +1,20 @@
|
|||
<% content_for :body_content_title, @category.title %>
|
||||
|
||||
<% content_for :body_content_left do %>
|
||||
<% if @category.posts.any? %>
|
||||
<article id="blog_posts">
|
||||
<%= render :partial => "/blog/shared/post", :collection => @category.posts %>
|
||||
</article>
|
||||
<% else %>
|
||||
<p>
|
||||
<%= t('.no_posts') %>
|
||||
</p>
|
||||
<% 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') %>
|
17
app/views/blog/comment_mailer/notification.html.erb
Normal file
|
@ -0,0 +1,17 @@
|
|||
<%= 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') %>
|
11
app/views/blog/posts/_comment.html.erb
Normal file
|
@ -0,0 +1,11 @@
|
|||
<article class='blog_comment_message' id='<%= "comment-#{comment.to_param}" %>'>
|
||||
<p>
|
||||
<%= simple_format auto_link(comment.message.to_s) %>
|
||||
</p>
|
||||
<footer class='blog_comment_author'>
|
||||
<p>
|
||||
<%= t('blog.posts.comments.by', :who => comment.name) %>,
|
||||
<%= t('blog.posts.comments.time_ago', :time => time_ago_in_words(comment.created_at)) %>
|
||||
</p>
|
||||
</footer>
|
||||
</article>
|
13
app/views/blog/posts/_nav.html.erb
Normal file
|
@ -0,0 +1,13 @@
|
|||
<% if next_or_previous?(@blog_post) -%>
|
||||
<nav id="next_prev_article">
|
||||
<% if @blog_post.next.present? -%>
|
||||
<%= link_to raw(truncate(@blog_post.next.title) + " »"), @blog_post.next, :class => 'next' %>
|
||||
<% end -%>
|
||||
|
||||
<%= link_to 'Blog Home', blog_root_path, :class => 'home' %>
|
||||
|
||||
<% if @blog_post.prev.present? -%>
|
||||
<%= link_to "« ".html_safe + truncate(@blog_post.prev.title), @blog_post.prev, :class => 'prev' %>
|
||||
<% end -%>
|
||||
</nav><!-- /next_prev_article -->
|
||||
<% end -%>
|
34
app/views/blog/posts/_post.html.erb
Normal file
|
@ -0,0 +1,34 @@
|
|||
<% flash.each do |key, value| %>
|
||||
<div id='flash' class="flash flash_<%= key %>">
|
||||
<%= value %>
|
||||
</div>
|
||||
<% end %>
|
||||
<article id="blog_post">
|
||||
<header>
|
||||
<h1><%= @blog_post.title %></h1>
|
||||
<details>
|
||||
<time datetime="<%= @blog_post.published_at.strftime('%Y-%m-%d') %>" class='posted_at'>
|
||||
<%= t('blog.shared.posts.created_at', :when => @blog_post.published_at.strftime('%d %B %Y')) %>.
|
||||
</time>
|
||||
<% if (categories = @blog_post.categories).any? %>
|
||||
<aside class='filed_in'>
|
||||
<%= t('.filed_in') %>
|
||||
<% categories.each_with_index do |category, index| %>
|
||||
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
|
||||
<% end %>
|
||||
</aside>
|
||||
<% end %>
|
||||
</details>
|
||||
</header>
|
||||
<%= @blog_post.body.html_safe %>
|
||||
|
||||
<% if BlogPost::ShareThis.enabled? %>
|
||||
<span class="st_sharethis" displayText="ShareThis"></span>
|
||||
<% end %>
|
||||
</article>
|
||||
<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%>
|
||||
<% if next_or_previous?(@blog_post) -%>
|
||||
<nav id="next_prev_article">
|
||||
<%= render 'nav' %>
|
||||
</nav><!-- /next_prev_article -->
|
||||
<% end -%>
|
19
app/views/blog/posts/archive.html.erb
Normal file
|
@ -0,0 +1,19 @@
|
|||
<% content_for :body_content_left do %>
|
||||
<%= @page[Page.default_parts.first.to_sym] %>
|
||||
<h1>Blog Archive for <%= @archive_date.strftime('%B %Y') %></h1>
|
||||
<section id="blog_posts">
|
||||
<%= render :partial => "/blog/shared/post", :collection => @blog_posts %>
|
||||
</section>
|
||||
<%= "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') %>
|
20
app/views/blog/posts/index.html.erb
Normal file
|
@ -0,0 +1,20 @@
|
|||
<% content_for :body_content_left do %>
|
||||
<%= @page[Page.default_parts.first.to_sym] %>
|
||||
|
||||
<section id="blog_posts">
|
||||
<%= render :partial => "/blog/shared/post", :collection => @blog_posts %>
|
||||
</section>
|
||||
<%= "<p>There are no blog articles posted yet. Stay tuned.</p>".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') %>
|
17
app/views/blog/posts/index.rss.builder
Normal file
|
@ -0,0 +1,17 @@
|
|||
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
|
75
app/views/blog/posts/show.html.erb
Normal file
|
@ -0,0 +1,75 @@
|
|||
<% content_for :body_content_left do %>
|
||||
<div id="show_blog_post">
|
||||
<%= render 'post' %>
|
||||
</div>
|
||||
|
||||
<% if BlogPost.comments_allowed? %>
|
||||
<aside id="comments">
|
||||
<h2><%= t('.comments.title') %></h2>
|
||||
|
||||
<% if (comments = @blog_post.comments.approved).any? %>
|
||||
<%= render :partial => "comment", :collection => comments %>
|
||||
<% else %>
|
||||
<p>
|
||||
<%= t('blog.shared.comments.none') %>.
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% flash.each do |key, value| %>
|
||||
<div id='flash' class="flash flash_<%= key %>">
|
||||
<%= value %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h2><%= t('.comments.add') %></h2>
|
||||
<% form_for [:blog_post, @blog_comment] do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<div class='field'>
|
||||
<%= f.label :name %>
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class='field'>
|
||||
<%= f.label :email %>
|
||||
<%= f.text_field :email %>
|
||||
</div>
|
||||
<div class='field message_field'>
|
||||
<%= f.label :message %>
|
||||
<%= f.text_area :message, :rows => 6 %>
|
||||
</div>
|
||||
<div class='field form-actions'>
|
||||
<%= f.submit t('.submit') %>
|
||||
</div>
|
||||
<% end %>
|
||||
</aside>
|
||||
<% 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? %>
|
||||
<script src="http://w.sharethis.com/button/buttons.js"></script>
|
||||
<script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script>
|
||||
<% 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' %>
|
||||
<script src="http://w.sharethis.com/button/buttons.js"></script>
|
||||
<script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script>
|
||||
<% end if BlogPost::ShareThis.enabled? %>
|
||||
<% end %>
|
8
app/views/blog/shared/_categories.html.erb
Normal file
|
@ -0,0 +1,8 @@
|
|||
<h2><%= t('.title') %></h2>
|
||||
<ul id='categories'>
|
||||
<% @blog_categories.each do |category| %>
|
||||
<li<%= " class='selected'" if @category.present? and @category.id == category.id %>>
|
||||
<%= link_to "#{category.title} (#{category.post_count})", blog_category_url(category) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
38
app/views/blog/shared/_post.html.erb
Normal file
|
@ -0,0 +1,38 @@
|
|||
<% if post.live? %>
|
||||
<article class="blog_post" id="<%= dom_id(post) %>">
|
||||
<header>
|
||||
<h1><%= link_to post.title, blog_post_url(post) %></h1>
|
||||
<details>
|
||||
<time datetime="<%= post.published_at.strftime('%Y-%m-%d') %>" class='posted_at'>
|
||||
<%= t('blog.shared.posts.created_at', :when => post.published_at.strftime('%d %B %Y')) %>.
|
||||
</time>
|
||||
<% if (categories = post.categories).any? %>
|
||||
<aside class='filed_in'>
|
||||
<%= t('filed_in', :scope => 'blog.posts.show') %>
|
||||
<% categories.each_with_index do |category, index| %>
|
||||
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
|
||||
<% end %>
|
||||
</aside>
|
||||
<% end %>
|
||||
</details>
|
||||
</header>
|
||||
<section class='clearfix'>
|
||||
<%= truncate(post.body,
|
||||
:length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250),
|
||||
:preserve_html_tags => true) %>
|
||||
</section>
|
||||
<footer>
|
||||
<p>
|
||||
<%= link_to t('blog.shared.posts.read_more'), blog_post_url(post) %>
|
||||
|
||||
<aside class='comment_count'>
|
||||
<% if post.comments.any? %>
|
||||
(<%= pluralize(post.comments.approved.count, t('blog.shared.comments.singular')) %>)
|
||||
<% else %>
|
||||
(<%= t('blog.shared.comments.none') %>)
|
||||
<% end %>
|
||||
</aside>
|
||||
</p>
|
||||
</footer>
|
||||
</article>
|
||||
<% end %>
|
8
app/views/blog/shared/_posts.html.erb
Normal file
|
@ -0,0 +1,8 @@
|
|||
<h2><%= t('.other') %></h2>
|
||||
<ul id="blog_posts">
|
||||
<% @blog_posts.each do |blog_post| %>
|
||||
<li class='clearfix'>
|
||||
<%= link_to blog_post.title, blog_post_url(blog_post) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
2
app/views/blog/shared/_rss_feed.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h2><%= t('.title') %></h2>
|
||||
<%= link_to "Subscribe", blog_rss_feed_url, :id => "rss_feed_subscribe"%>
|
|
@ -1,96 +0,0 @@
|
|||
<nav id='actions' class='multilist'>
|
||||
<ul class='search_list'>
|
||||
<li class='not_a_link'>
|
||||
<%= render :partial => "/refinery/admin/search",
|
||||
:locals => {
|
||||
:url => refinery.blog_admin_posts_path
|
||||
} %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class='collapsible_menu'>
|
||||
<li class='not_a_link'>
|
||||
<%= link_to t('.posts.title'), '#',
|
||||
:class => 'page_copy_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.posts.manage'), refinery.blog_admin_posts_path,
|
||||
:class => 'page_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.posts.uncategorized'), refinery.uncategorized_blog_admin_posts_path,
|
||||
:class => 'page_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.posts.new'), refinery.new_blog_admin_post_path,
|
||||
:class => 'page_add_icon' %>
|
||||
</li>
|
||||
</ul>
|
||||
<% if Refinery::Blog::Post.comments_allowed? %>
|
||||
<ul class='collapsible_menu'>
|
||||
<li class='not_a_link'>
|
||||
<% if Refinery::Blog::Comment.unmoderated.any? %>
|
||||
<% title = t('.comments.title_with_count', :new_count => Refinery::Blog::Comment.unmoderated.size) %>
|
||||
<% else %>
|
||||
<% title = t('.comments.title') %>
|
||||
<% end %>
|
||||
<%= link_to title, '#',
|
||||
:class => 'comments_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.comments.new'), refinery.blog_admin_comments_path,
|
||||
:class => 'comment_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.comments.approved'), refinery.approved_blog_admin_comments_path,
|
||||
:class => 'comment_tick_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.comments.rejected'), refinery.rejected_blog_admin_comments_path,
|
||||
:class => 'comment_cross_icon' %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<ul class='collapsible_menu'>
|
||||
<li class='not_a_link'>
|
||||
<%= link_to t('.categories.title'), '#',
|
||||
:class => 'folder_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.categories.manage'), refinery.blog_admin_categories_path,
|
||||
:class => 'folder_edit_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.categories.new'), refinery.new_blog_admin_category_path,
|
||||
:class => 'folder_add_icon' %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class='collapsible_menu'>
|
||||
<li class='not_a_link'>
|
||||
<%= link_to t('.settings.title'), refinery.blog_admin_settings_path,
|
||||
:class => 'settings_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.settings.comments'), refinery.comments_blog_admin_settings_path,
|
||||
:class => "#{Refinery::Blog::Post.comments_allowed? ? 'success' : 'failure'}_icon" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.settings.moderation'), refinery.moderation_blog_admin_settings_path,
|
||||
:class => "#{Refinery::Blog::Comment::Moderation.enabled? ? 'success' : 'failure'}_icon" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.settings.update_notified'),
|
||||
refinery.notification_recipients_blog_admin_settings_path(:dialog => true, :height => 400),
|
||||
:class => 'user_comment_icon' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.settings.teasers'),
|
||||
refinery.teasers_blog_admin_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
|
||||
<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %>
|
|
@ -1,19 +0,0 @@
|
|||
<%= form_for [refinery, :blog_admin, @category] do |f| -%>
|
||||
<%= render :partial => "/refinery/admin/error_messages",
|
||||
:locals => {
|
||||
:object => f.object,
|
||||
:include_object_name => true
|
||||
} %>
|
||||
|
||||
<div class='field'>
|
||||
<%= f.label :title -%>
|
||||
<%= f.text_field :title, :class => 'larger widest' -%>
|
||||
</div>
|
||||
|
||||
<%= render :partial => "/refinery/admin/form_actions",
|
||||
:locals => {
|
||||
:f => f,
|
||||
:continue_editing => false,
|
||||
:delete_title => t('delete', :scope => 'refinery.blog.admin.categories.category')
|
||||
} %>
|
||||
<% end %>
|
|
@ -1 +0,0 @@
|
|||
<%= render "form" %>
|
|
@ -1,27 +0,0 @@
|
|||
<%= render '/refinery/blog/admin/submenu' %>
|
||||
<div id='records'>
|
||||
<% if searching? %>
|
||||
<h2><%= t('results_for', :scope => 'refinery.admin.search',
|
||||
:query => params[:search]) %></h2>
|
||||
<% if @categories.any? %>
|
||||
<%= render :partial => "blog_categories",
|
||||
:collection => @categories %>
|
||||
<% else %>
|
||||
<p><%= t('no_results', :scope => 'refinery.admin.search') %></p>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @categories.any? %>
|
||||
<%= will_paginate @categories %>
|
||||
|
||||
<%= render "sortable_list" %>
|
||||
|
||||
<%= will_paginate @categories %>
|
||||
<% else %>
|
||||
<p>
|
||||
<strong>
|
||||
<%= t('.no_items_yet', :create => t('new', :scope => 'refinery.blog.admin.submenu.categories')) %>
|
||||
</strong>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1 +0,0 @@
|
|||
<%= render "form" %>
|
|
@ -1,30 +0,0 @@
|
|||
<%= render '/refinery/blog/admin/submenu' %>
|
||||
<div id='records'>
|
||||
<% if searching? %>
|
||||
<h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
|
||||
<% if @comments.any? %>
|
||||
<%= will_paginate @comments %>
|
||||
|
||||
<ul>
|
||||
<%= render :partial => "blog_comments",
|
||||
:collection => @comments %>
|
||||
</ul>
|
||||
|
||||
<%= will_paginate @comments %>
|
||||
<% else %>
|
||||
<p><%= t('search_no_results', :scope => 'admin') %></p>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @comments.any? %>
|
||||
<%= will_paginate @comments %>
|
||||
|
||||
<%= render "sortable_list" %>
|
||||
|
||||
<%= will_paginate @comments %>
|
||||
<% else %>
|
||||
<h3>
|
||||
<%= t('.no_items_yet', :type => action_name.gsub('index', 'new').downcase) %>
|
||||
</h3>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,63 +0,0 @@
|
|||
<div id='actions'>
|
||||
<h2><%= t('.details')%></h2>
|
||||
<p>
|
||||
<strong><%= t('.age') %>:</strong> <%= time_ago_in_words(@comment.created_at) %>
|
||||
</p>
|
||||
<h2><%= t('.actions') %></h2>
|
||||
<ul>
|
||||
<li>
|
||||
<%= link_to t('.back'), refinery.blog_admin_comments_path, :class => "back_icon" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.reject'), refinery.rejected_blog_admin_comment_path(@comment, :return_to => 'rejected'),
|
||||
:class => 'comment_cross_icon' unless @comment.rejected? %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.approve'), refinery.approved_blog_admin_comment_path(@comment, :return_to => 'approved'),
|
||||
:class => 'comment_tick_icon' unless @comment.approved? %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id='records'>
|
||||
<h2><%= t('.comment') %></h2>
|
||||
<table id='inquiry'>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><%= t('.blog_post') %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to @comment.post.title,
|
||||
refinery.blog_post_path(@comment.post, :anchor => "comment-#{@comment.to_param}"),
|
||||
:target => '_blank' %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><%= t('.from') %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= @comment.name %> [<%= mail_to @comment.email, @comment.email, {:title => t('.click_to_email')} %>]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><%= t('.date') %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= l(Date.parse(@comment.created_at.to_s), :format => :long) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<strong><%= t('.message') %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<p style='margin-top: 0px'>
|
||||
<%= @comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "</p><p>") %>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %>
|
|
@ -1,127 +0,0 @@
|
|||
<%= form_for [refinery, :blog_admin, @post] do |f| -%>
|
||||
<%= render :partial => "/refinery/admin/error_messages",
|
||||
:locals => {
|
||||
:object => f.object,
|
||||
:include_object_name => true
|
||||
} %>
|
||||
|
||||
<div class='field'>
|
||||
<%= f.label :title -%>
|
||||
<%= f.text_field :title, :class => 'larger widest' -%>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<p>
|
||||
<%= f.check_box :draft %>
|
||||
<%= f.label :draft, t('.save_as_draft'), :class => "stripped" %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class='field'>
|
||||
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
||||
<ul id='page_parts'>
|
||||
<li class='ui-state-default ui-state-active'>
|
||||
<%= link_to t('body', :scope => 'activerecord.attributes.refinery/blog_post'), "#page_part_body" %>
|
||||
</li>
|
||||
<li class='ui-state-default'>
|
||||
<%= link_to t('teaser', :scope => 'activerecord.attributes.refinery/blog_post'), "#page_part_teaser" %>
|
||||
</li>
|
||||
<% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
|
||||
<li class='ui-state-default' id="custom_<%= tab.name %>_tab">
|
||||
<%= link_to tab.name.titleize, "#custom_tab_#{tab_index}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div id='page_part_editors'>
|
||||
<% part_index = -1 %>
|
||||
<%= render '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| %>
|
||||
<div class='page_part' id='<%= "custom_tab_#{tab_index}" %>'>
|
||||
<%= render tab.partial, :f => f %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='field'>
|
||||
<%= f.label :tag_list, t('refinery.blog.shared.tags.title') -%>
|
||||
<%= f.text_field :tag_list, :class => 'larger' -%>
|
||||
</div>
|
||||
|
||||
<div id='more_options_field'>
|
||||
<p>
|
||||
<%= link_to t('.advanced_options'), "#",
|
||||
:id => 'toggle_advanced_options',
|
||||
:title => t('.toggle_advanced_options') %>
|
||||
</p>
|
||||
</div>
|
||||
<div id='more_options' style="display:none;">
|
||||
<div class="hemisquare">
|
||||
<h3><%= t('title', :scope => 'refinery.blog.admin.submenu.categories') %></h3>
|
||||
<ul class='blog_categories'>
|
||||
<% @categories.each do |category| %>
|
||||
<li>
|
||||
<%= check_box_tag 'post[category_ids][]', category.id,
|
||||
@post.categories.include?(category),
|
||||
:id => (id="post_category_ids_#{category.id}") %>
|
||||
<%= label_tag 'post[category_ids][]', category.title,
|
||||
:class => 'stripped',
|
||||
:for => id %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<h3><%= t('.published_at') %></h3>
|
||||
<%= f.datetime_select :published_at %>
|
||||
|
||||
<div class='field'>
|
||||
<span class='label_with_help'>
|
||||
<%= f.label :custom_url, t('.custom_url') %>
|
||||
<%= refinery_help_tag t('.custom_url_help') %>
|
||||
</span>
|
||||
<%= f.text_field :custom_url, :class => "widest" %>
|
||||
</div>
|
||||
|
||||
<div class='field'>
|
||||
<span class='label_with_help'>
|
||||
<%= f.label :source_url_title, t('.source_url_title') %>
|
||||
<%= refinery_help_tag t('.source_url_title_help') %>
|
||||
</span>
|
||||
<%= f.text_field :source_url_title, :class => "widest" %>
|
||||
</div>
|
||||
|
||||
<div class='field'>
|
||||
<span class='label_with_help'>
|
||||
<%= f.label :source_url, t('.source_url') %>
|
||||
<%= refinery_help_tag t('.source_url_help') %>
|
||||
</span>
|
||||
<%= f.text_field :source_url, :class => "widest" %>
|
||||
</div>
|
||||
|
||||
<div class='field'>
|
||||
<span class='label_with_help'>
|
||||
<%= f.label :user_id, t('.author') %>
|
||||
<%= refinery_help_tag t('.author_help') %>
|
||||
<br/>
|
||||
<%= f.collection_select :user_id, ::Refinery::User.all, :id, :username %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class='hemisquare right_side'>
|
||||
<%= render '/seo_meta/form', :form => f %>
|
||||
</div>
|
||||
</div>
|
||||
<%= 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 %>
|