Sha256: c2d516ccca2a67e8c7495480da105f016019f7f2686021b89d224d9c31ca2101

Contents?: true

Size: 1.74 KB

Versions: 19

Compression:

Stored size: 1.74 KB

Contents

class MessageRequestsController < ApplicationController
  load_and_authorize_resource

  # GET /message_requests
  # GET /message_requests.json
  def index
    case params[:mode]
    when 'sent'
      @message_requests = MessageRequest.sent.order('created_at DESC').page(params[:page])
    when 'all'
      @message_requests = MessageRequest.order('created_at DESC').page(params[:page])
    else
      @message_requests = MessageRequest.not_sent.order('created_at DESC').page(params[:page])
    end

    respond_to do |format|
      format.html # index.html.erb
      format.json { render :json => @message_requests }
    end
  end

  # GET /message_requests/1
  # GET /message_requests/1.json
  def show
    respond_to do |format|
      format.html # show.html.erb
      format.json { render :json => @message_request }
    end
  end

  # GET /message_requests/1/edit
  def edit
    @message_templates = MessageTemplate.all
  end

  # PUT /message_requests/1
  # PUT /message_requests/1.json
  def update
    respond_to do |format|
      if @message_request.update_attributes(params[:message_request])
        flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.message_request'))
        format.html { redirect_to(@message_request) }
        format.json { head :ok }
      else
        @message_templates = MessageTemplate.all
        format.html { render :action => "edit" }
        format.json { render :json => @message_request.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /message_requests/1
  # DELETE /message_requests/1.json
  def destroy
    @message_request.destroy

    respond_to do |format|
      format.html { redirect_to(message_requests_url) }
      format.json { head :ok }
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
enju_message-0.1.2 app/controllers/message_requests_controller.rb
enju_message-0.0.19 app/controllers/message_requests_controller.rb
enju_message-0.1.1 app/controllers/message_requests_controller.rb
enju_message-0.1.0 app/controllers/message_requests_controller.rb
enju_message-0.0.18 app/controllers/message_requests_controller.rb
enju_message-0.0.17 app/controllers/message_requests_controller.rb
enju_message-0.0.16 app/controllers/message_requests_controller.rb
enju_message-0.0.15 app/controllers/message_requests_controller.rb
enju_message-0.0.14 app/controllers/message_requests_controller.rb
enju_message-0.0.13 app/controllers/message_requests_controller.rb
enju_message-0.0.12 app/controllers/message_requests_controller.rb
enju_message-0.0.11 app/controllers/message_requests_controller.rb
enju_message-0.0.10 app/controllers/message_requests_controller.rb
enju_message-0.0.9 app/controllers/message_requests_controller.rb
enju_message-0.0.7 app/controllers/message_requests_controller.rb
enju_message-0.0.6 app/controllers/message_requests_controller.rb
enju_message-0.0.5 app/controllers/message_requests_controller.rb
enju_message-0.0.4 app/controllers/message_requests_controller.rb
enju_message-0.0.3 app/controllers/message_requests_controller.rb