Skip to content

Instantly share code, notes, and snippets.

View ugisozols's full-sized avatar

Uģis Ozols ugisozols

View GitHub Profile
@ugisozols
ugisozols / gist:6948325
Created October 12, 2013 10:17
Specifying custom layout only for Refinery::Blog::Post part.
# app/decorators/controllers/refinery/blog/posts_controller_decorator.rb
Refinery::Blog::PostsController.class_eval do
layout "my_custom_layout"
end
@ugisozols
ugisozols / gist:6805942
Last active April 18, 2017 09:26
Refinery CMS - updated MenuPresenter guide
h2. Additional Menus
This guide will show you how to:
* configure and use +Refinery::Pages::MenuPresenter+
* use a decorator to add custom functionality to +Refinery::Page+ class
* override Refinery's view
endprologue.
h3. Requirements
@ugisozols
ugisozols / gist:6778058
Last active April 4, 2019 17:18
Refinery CMS + Dragonfly + Amazon S3 + Amazon Cloudfront
# config/environments/production.rb:
config.action_controller.asset_host = "http://cdn%d.example.com"
# config/initializers/refinery/images.rb:
config.dragonfly_url_format = "/images/:job/:basename.:ext"
if Rails.env.production?
config.dragonfly_url_host = "http://cdn4.example.com"
end
# config/initializers/refinery/resources.rb:
require "rspec"
class Grid
attr_reader :cells, :ships
SIZE = 10
def initialize
@cells = SIZE.times.map { [nil] * SIZE }
@ships = []
require "rspec"
class Grid
attr_reader :cells, :ships
SIZE = 10
def initialize
@cells = SIZE.times.map { [nil] * SIZE }
@ships = []
# app/decorators/mailers/refinery/inquiries/inquiry_mailer_decorator.rb
Refinery::Inquiries::InquiryMailer.class_eval do
def confirmation(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.confirmation_subject(Globalize.locale),
:to => inquiry.email,
:from => "my_custom_from_name@something.com",
:reply_to => Refinery::Inquiries::Setting.notification_recipients.split(',').first
end
diff --git a/pages/app/controllers/refinery/admin/pages_controller.rb b/pages/app/controllers/refinery/admin/pages_controller.rb
index 4dd16da..01b2096 100644
--- a/pages/app/controllers/refinery/admin/pages_controller.rb
+++ b/pages/app/controllers/refinery/admin/pages_controller.rb
@@ -91,8 +91,7 @@ module Refinery
@valid_layout_templates = Pages.layout_template_whitelist &
Pages.valid_templates('app', 'views', '{layouts,refinery/layouts}', '*html*')
- @valid_view_templates = Pages.view_template_whitelist &
- Pages.valid_templates('app', 'views', '{pages,refinery/pages}', '*html*')
diff --git a/pages/app/controllers/refinery/pages_controller.rb b/pages/app/controllers/refinery/pages_controller.rb
index d4d6dbf..b6526f0 100644
--- a/pages/app/controllers/refinery/pages_controller.rb
+++ b/pages/app/controllers/refinery/pages_controller.rb
@@ -10,7 +10,7 @@ module Refinery
# This action is usually accessed with the root path, normally '/'
def home
- render_with_templates?
+ render_with_templates?(page, :template => "refinery/pages/home")
@ugisozols
ugisozols / gist:6002320
Created July 15, 2013 18:42
What's new/changed/removed in Refinery CMS 2.1.0

What’s new, changed and removed in version 2.1.0

This guide will provide a list of bullet points of the stuff that has been added, changed and removed in version 2.1.0.

endprologue.

Changes in behaviour

WARNING. Starting from 2.1.0 we dropped support for Ruby 1.8.×. 1.9.3 is the lowest version of
Ruby that is accepted. We strongly recommend upgrading if you’re still on 1.8.×.

@ugisozols
ugisozols / gist:5998256
Last active December 19, 2015 18:19
Refinery CMS long index name fix when upgrading from 2.0.x to 2.1.x
class RemoveMetaKeywordsFromSeoMeta < ActiveRecord::Migration
def up
with_index_name_fix do
remove_column :seo_meta, :meta_keywords
end
end
def down
add_column :seo_meta, :meta_keywords, :string
end