Sha256: 1ad443e07e689af6480361a841e67cbc3f57899f7f09ebbcf23a8a11fbd7c690

Contents?: true

Size: 1.47 KB

Versions: 6

Compression:

Stored size: 1.47 KB

Contents

require_dependency "fastui/application_controller"

module Fastui
  class MMenusController < ApplicationController
    respond_to :html, :xml, :json
    def index
      @m_menus = MMenu.scoped
      data = paginate(@m_menus)
      respond_with(data.to_json(:include => [:m_menu_items,:createdbyorg, :createdby, :updatedby]))
    end

    def show
      @m_menu = MMenu.find(params[:id])
      respond_with(@m_menu)
    end

    def edit
      @m_menu = MMenu.find(params[:id])
      respond_with(@m_menu.to_json(:include => [:createdbyorg, :createdby, :updatedby]))
    end

    def new
      @m_menu = MMenu.new
      respond_with(@m_menu)
    end

    def create
      @m_menu = MMenu.new(params[:m_menu])
      respond_with(@m_menu) do |format|
        if @m_menu.save
          format.json { render :json => {:success => true, :msg => 'ok'} }
        else
          format.json { render :json => {:success => false, :msg => 'failure'} }
        end
      end

    end

    def update
      @m_menu = MMenu.find(params[:id])

      respond_with(@m_menu) do |format|
        if @m_menu.update_attributes(params[:m_menu])
          format.json { render :json => {:success => true, :msg => 'ok'} }
        else
          format.json { render :json => {:success => false, :msg => 'false'} }
        end
      end
    end

    def destroy
      @m_menu = MMenu.find(params[:id])
      @m_menu.destroy
      respond_with(@m_menu)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fastui-0.1.8 app/controllers/fastui/m_menus_controller.rb
fastui-0.1.7 app/controllers/fastui/m_menus_controller.rb
fastui-0.1.6 app/controllers/fastui/m_menus_controller.rb
fastui-0.1.4 app/controllers/fastui/m_menus_controller.rb
fastui-0.1.3 app/controllers/fastui/m_menus_controller.rb
fastui-0.1.2 app/controllers/fastui/m_menus_controller.rb