Skip to content

Instantly share code, notes, and snippets.

View andreferraro's full-sized avatar
🎯
Focusing

Andre Ferraro andreferraro

🎯
Focusing
  • Brazil
  • 17:59 (UTC -03:00)
View GitHub Profile
#!/bin/bash
wget -c http://www.famfamfam.com/lab/icons/silk/famfamfam_silk_icons_v013.zip
unzip famfamfam_silk_icons_v013.zip
rm readme.html
rm readme.txt
cd icons
mv * ../public/images/web-app-theme/
cd ..
rm -R icons
rm famfamfam_silk_icons_v013.zip
# Removendo as paginas que nao iremos utilizar
run "rm README"
run "rm doc/README_FOR_APP"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
#Colando a rota padrao
route %(map.root :controller => "dashboard")
pt-BR:
# formatos de data e hora
date:
formats:
default: "%d/%m/%Y"
short: "%d de %B"
long: "%d de %B de %Y"
day_names: [Domingo, Segunda, Terça, Quarta, Quinta, Sexta, Sábado]
abbr_day_names: [Dom, Seg, Ter, Qua, Qui, Sex, Sáb]
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
#BREADCRUMBS
before_filter :trail
class Backend::DashboardController < ApplicationController
layout "backend"
def index
end
end
# exportação de TODOS os dados no formato xml e json
def export
@ufs = Uf.find(:all, :order => "uf")
prawnto :prawn => {:page_layout => :landscape}
respond_to do |format|
format.xml { render :xml => @ufs }
format.json { render :json => @ufs }
format.csv do
@output_encoding = 'ISO-8859-1'
@filename = "ufs.csv"
pdf.stroke_color "CCCCCC"
pdf.font "Helvetica", :size => 14
pdf.text @uf.uf.to_s, :size => 30, :style => :bold
pdf.stroke_horizontal_rule
pdf.move_down(20)
pdf.text "Id: " + @uf.id.to_s
pdf.text "Uf: " + @uf.uf.to_s
pdf.text "Sigla: " + @uf.sigla.to_s
if [email protected]_content_type.index("image/gif") && (@uf.bandeira_content_type.index("image/png") || @uf.bandeira_content_type.index("image/jpeg") || @uf.bandeira_content_type.index("image/jpg"))
pdf.image "#{RAILS_ROOT}/public/images/" + @uf.bandeira.to_s.gsub(/\?.[0-9]*/,""), :at => [500, 480]
require 'prawn/layout'
require 'prawn/format'
bill_address = @order.bill_address
ship_address = @order.ship_address
font "Helvetica"
image Spree::PrintInvoice::Config[:print_invoice_logo_path], :at => [0,720], :scale => 0.65
# Infelizmente não é possível colocar todas as regras...
#
# http://pt.wikipedia.org/wiki/Plural e
# http://pt.wikipedia.org/wiki/Singular
module Inflector
ActiveSupport::Inflector.inflections do |inflect|
inflect.clear
inflect.plural(/$/, 's')
inflect.plural(/(s)$/i, '\1')
pt-BR:
new: "novo"
edit: "editar"
show: "detalhes"