Class | ProposalsController
In: | app/controllers/proposals_controller.rb
Parent: | ApplicationController

### Methods

create index new ours show yours

### Public Instance methods

create()

[Source]

        # File app/controllers/proposals_controller.rb, line 55
    55:   def create
    56:     @proposal = current_user.proposals.new(params[:proposal])
    57:
    58:     if @proposal.save
    59:       if @proposal.approved?
    60:         flash[:notice] = t('proposals.gracias')
    61:       else
    62:         flash[:notice] = t('proposals.gracias_revisaremos')
    63:       end
    64:       redirect_to proposals_path(:s => "f")
    65:     else
    66:       render :action => "new"
    67:     end
    68:   end

index()

[Source]

        # File app/controllers/proposals_controller.rb, line 4
     4:   def index
     5:     @your_proposals = Proposal.from_citizens.approved.published.find :all,
     6:       :order => "published_at DESC",
     7:       :limit => "10"
     8:
     9:     @our_proposals = Proposal.governmental.approved.published.find :all,
    10:       :order => "published_at DESC",
    11:       :limit => "10"
    12:     @title = t('proposals.propuestas')
    13:   end

new()

[Source]

        # File app/controllers/proposals_controller.rb, line 50
    50:   def new
    51:     @proposal = current_user.proposals.new
    52:     @title = t('proposals.nueva_propuesta')
    53:   end

ours()

[Source]

        # File app/controllers/proposals_controller.rb, line 23
    23:   def ours
    24:     @title = t('proposals.propuestas_gubernamentales')
    25:     @proposals = Proposal.governmental.approved.published.paginate :order => "created_at DESC",
    26:       :per_page => 20, :page => params[:page]
    27:     @breadcrumbs_info = [[t('proposals.propuestas'), proposals_path], [t('proposals.propuestas_gubernamentales'), ours_proposals_path]]
    28:     @introductory_text = Proposal.ours_intro_page
    29:     render :action => "yours"
    30:   end

show()

[Source]

        # File app/controllers/proposals_controller.rb, line 32
    32:   def show
    33:     begin
    34:       @proposal = Proposal.approved.published.find(params[:id])
    35:     rescue ActiveRecord::RecordNotFound
    36:       if is_admin?
    37:         @proposal = Proposal.find(params[:id])
    38:       else
    39:         raise ActiveRecord::RecordNotFound
    40:       end
    41:     end
    42:
    43:     @parent = @proposal
    44:
    45:     @comments = @proposal.comments.approved.paginate :page => params[:page], :per_page => 50
    46:
    47:   end

yours()

[Source]

        # File app/controllers/proposals_controller.rb, line 15
    15:   def yours
    16:     @title = t('proposals.propuestas_ciudadanas')
    17:     @proposals = Proposal.from_citizens.approved.published.paginate :order => "created_at DESC",
    18:       :per_page => 20, :page => params[:page]
    19:     @breadcrumbs_info = [[t('proposals.propuestas'), proposals_path], [t('proposals.propuestas_ciudadanas'), yours_proposals_path]]
    20:     @introductory_text = Proposal.yours_intro_page
    21:   end

[Validate]