This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SectionsCell < BaseCell | |
tracks_cache_references :recent_articles, :track => ['@section', '@articles'] | |
exposes_states :recent_articles => { | |
:name => 'Recent articles', | |
:description => 'A cell containing a given number of recent articles, optionally from a certain section.' | |
} | |
def recent_articles | |
# TODO make these before filters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def has_authorized_tag(*args) | |
# @response.body.should have_authorized_tag(*args) | |
has_tag "span[class^=newsletter_stats]" do | |
has_tag *args | |
end | |
end | |
def have_authorized_tag(*args) | |
have_tag('.newsletter_stats') # { |tag| tag.should have_tag(*args) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
applyOrRemoveFCKeditors = function() { | |
filter = $$('select.columnsFilter').first(); | |
// transform all textareas to FCKeditors, but only if filter is set to plain HTML | |
if(filter && $F(filter) == '') { | |
// by default, apply FCKeditor to all textareas | |
$$('textarea.use-wysiwyg').each(function(t) { | |
// some calculations | |
height = t.getDimensions()['height']; | |
if(height == 0) height = 200; // default height = 200px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Processing UsersController#update (for 127.0.0.1 at 2009-02-10 20:50:19) [PUT] | |
Parameters: {"user"=>{"profile_attributes"=>{"dog_color"=>"gold", "race_id"=>"1", "dog_preferences"=>"nix", "dog_age"=>"4", "dog_name"=>"Coba", "picture"=>#<File:/tmp/CGI.9218.9>, "dog_gender"=>"f"}}, "step"=>"1", "commit"=>"Speichern!", "action"=>"update", "_method"=>"put", "authenticity_token"=>"ffb9373e16afccea668e046c96acd7f8c2b1e1bc", "controller"=>"users", "locale"=>"de"} | |
[4;36;1mSite Load (0.7ms)[0m [0;1mSELECT * FROM "sites" WHERE ("sites"."host" = 'hunde-date.local') LIMIT 1[0m | |
[4;35;1mSection Load (0.9ms)[0m [0mSELECT * FROM "sections" WHERE ("sections"."parent_id" IS NULL) AND ("sections".site_id = 1) ORDER BY lft, lft LIMIT 1[0m | |
[4;36;1mTheme Load (0.3ms)[0m [0;1mSELECT * FROM "themes" WHERE ("themes".site_id = 1 AND (active = 1)) [0m | |
[4;35;1mUser Load (0.5ms)[0m [0mSELECT * FROM "users" WHERE ("users"."id" = 1) LIMIT 1[0m | |
[4;36;1mCACHE (0.0ms)[0m [0;1mSELECT * FROM "sites" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clemens-koflers-computer:url_history clemens$ rg test/all.rb | |
Loaded suite test/all | |
Started | |
.F..FFF...F.F.. | |
Finished in 0.086139 seconds. | |
1) Failure: | |
test_registers_the_after_filter(UrlHistoryActMacroTest) | |
[./test/act_macro_test.rb:17:in `test_registers_the_after_filter' | |
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM locations | |
WHERE ( | |
SELECT COUNT(*) FROM taggings | |
WHERE tag_id IN ( | |
SELECT tags.id FROM tags | |
WHERE tags.name = 'Bar' OR tags.name = 'Restaurant' | |
) AND taggable_type = 'Location' AND taggable_id = locations.id | |
) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
:en => { | |
:salutation => { | |
:gender => { | |
:male => "Mr", | |
:female => "Mrs", | |
:female_unmarried => "Ms" | |
} | |
:full => lambda { |attributes| | |
gender_salutation = I18n.t(:"salutation.#{attributes[:gender]}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# UNTESTED! | |
# spec | |
it_should_require_admin_for_actions :new => :get, :create => :post, :edit => :get, :update => :put, :destroy => :delete | |
# macro | |
def it_should_require_admin_for_actions(actions={}) | |
actions.each do |action, method| | |
it "#{action} action (with method #{method}) should require admin" do | |
send(method, action, :id => 1) | |
response.should redirect_to(login_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# highly experimental Capistrano recipe for adva-cms-based apps | |
# UNTESTED | |
set :adva_cms_repository, "git://github.com/svenfuchs/adva_cms.git" # set this to something different if you want to use a fork | |
set :adva_engines, :core # list desired engines as array or use :all to install all engines | |
set :adva_plugins, [] # list desired plugins as array or use :all to install all plugins | |
namespace :adva do | |
desc "Install selected engines." | |
task :install do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calendar_proc | |
lambda do |day| | |
content = returning '' do |content| | |
content << content_tag(:span, day.day) | |
content << "<ul>" | |
Event.all.select { |e| e.on_day?(day) }.each do |event| | |
content << content_tag(:li, link_to(event.title, event_path(event)) | |
end | |
content << "</ul>" | |
end |