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
renderers: | |
boolean: &boolean_renderer | |
renderer: | __js__ | |
function(v, p, r){ | |
var tmp = (v!=undefined && v!=''); | |
return Ext.util.Format.boolRenderer(tmp, p, r) | |
} | |
editors: | |
checkbox: &checkbox |
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
error do | |
exception = request.env['sinatra.error'] | |
Hoptoad::Notifier.send_error exception, params, request.env if %w(staging production).include?(ENV['RACK_ENV']) | |
erb :five_hundred | |
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
# Install Padrino | |
gem install padrino --no-ri --no-rdoc | |
# Put this in your shell for create in few seconds a Padrino Project with Padrino Admin | |
padrino-gen project foo -d activerecord -b; cd foo; padrino-gen admin; padrino rake ar:migrate; padrino rake seed; padrino start |
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
# Defines our constants | |
PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development" unless defined?(PADRINO_ENV) | |
PADRINO_ROOT = File.dirname(__FILE__) + '/..' unless defined? PADRINO_ROOT | |
begin | |
# Require the preresolved locked set of gems. | |
require File.expand_path('../../.bundle/environment', __FILE__) | |
rescue LoadError | |
# Fallback on doing the resolve at runtime. | |
require 'rubygems' |
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
## | |
# This is an exception notifier for Padrino::Application with | |
# redmine bonus feature. | |
# | |
# ==== Usage | |
# | |
# class MyApp < Padrino::Application | |
# register ExceptionNotifier | |
# set :exceptions_from, "errors@localhost.local" | |
# set :exceptions_to, "foo@bar.local" |
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
## | |
# This is an extension for ActiveRecord where if I had: | |
# | |
# post.description_ru = "I'm Russian" | |
# post.description_en = "I'm English" | |
# post.description_it = "I'm Italian" | |
# | |
# with this extension if I had set: | |
# | |
# I18n.locale = :it |
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
## | |
# This extension give to padrino the ability to change | |
# their locale inspecting. | |
# | |
# ==== Usage | |
# | |
# class MyApp < Padrino::Application | |
# register AutoLocale | |
# set :locales, [:en, :ru, :de] # First locale is the default locale | |
# 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
## | |
# This module extend ActiveRecord. | |
# | |
# You need to to your model a column called +:permalink+ | |
# | |
# then use +has_permalink :title like: | |
# | |
# class Page < ActiveRecord::Base | |
# has_permalink :page | |
# 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
## | |
# Rspec way routes and context filters | |
# | |
MyApp.context :frontend do | |
context :posts do | |
get :index do; ... end | |
get :show, :with => :id do; ... end | |
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
# Before/After filters in padrino | |
SimpleApp.controllers :posts do | |
# These are public actions, no authentication required | |
get :index do; ... end; | |
get :show, :with => :id do; ... end; | |
# These actions require being authenticated | |
# Variant 1 |