This file contains hidden or 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_filter :load_generos | |
def index | |
@livros = Livro.all | |
@generos = Genero.all | |
@livros = @genero.livros | |
This file contains hidden or 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 LivrosController < ApplicationController | |
# GET /livros | |
# GET /livros.xml | |
before_filter :load_generos | |
def index | |
@livros = Livro.all | |
@generos = Genero.all | |
respond_to do |format| |
This file contains hidden or 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
<h3>Generos</h3> | |
<ul class="squared"> | |
<% @generos.each do |genero| %> | |
<li><%= link_to_unless_current genero.nome, livros_path(:genero_id => genero.id) %></li> | |
<% end %> | |
</ul> | |
Livraria::Application.routes.draw do |
This file contains hidden or 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
model Ticket.rb | |
def self.filter(options={}) | |
return Ticket.paginate_by_sql(sql, :page => options[:page]) | |
tickets_controller.rb | |
@open_tickets = Ticket.filter( | |
:assigned_user_id => params[:filter].nil? ? "" : params[:filter]['assigned_user_id'], | |
:di_version => params[:filter].nil? ? "" : params[:filter]['di_version'], |
This file contains hidden or 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
rufus/sc/jobs.rb:253:in `trigger' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/jobqueues.rb:60:in `trigger_matching_jobs' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:283:in `step' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:347:in `start' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:345:in `loop' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:345:in `start' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:344:in `initialize' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:344:in `new' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:344:in `start' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p |
This file contains hidden or 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
rufus/sc/jobs.rb:253:in `trigger' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/jobqueues.rb:60:in `trigger_matching_jobs' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:283:in `step' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:347:in `start' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:345:in `loop' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:345:in `start' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:344:in `initialize' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:344:in `new' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p302@rails2/gems/rufus-scheduler-2.0.6/lib/rufus/sc/scheduler.rb:344:in `start' | |
/home/andrelima/.rvm/gems/ruby-1.8.7-p |
This file contains hidden or 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 req_noticias(request): | |
noticias = Noticia.objects.all() | |
paginator = Paginator(noticias, 3) # Show 25 contacts per page | |
page = int(request.GET.get('page', '1')) | |
# If page request (9999) is out of range, deliver last page of results. | |
try: | |
news = paginator.page(page) |
This file contains hidden or 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
{% extends "base.html" %} | |
{% block head %} | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#portfolio-list').filterable(); | |
}); | |
</script> | |
{% endblock %} | |
{% block conteudo %} | |
<ul id="portfolio-filter"> |
This file contains hidden or 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
views: | |
from django.core.paginator import Paginator, InvalidPage, EmptyPage | |
def requisicao_empresa(request): | |
empresa = Empresa.objects.all() | |
t = loader.get_template("empresa.html") | |
c = Context({'empresas' : empresa }) | |
paginator = Paginator(empresa, 3) # Show 25 contacts per page | |
# Make sure page request is an int. If not, deliver first page. |
This file contains hidden or 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 requisicao_empresa(request): | |
empresa = Empresa.objects.all() | |
t = loader.get_template("empresa.html") | |
c = Context({'empresa' : empresa }) | |
return HttpResponse(t.render(c)) | |
<h2>{{ empresa.titulo }}</h2> | |
<p>{{ empresa.texto }}</p> | |
<p>{{ empresa.imagem }}</p> |