Class: FastExt::MMenuItemsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FastExt::MMenuItemsController
- Defined in:
- app/controllers/fast_ext/m_menu_items_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/fast_ext/m_menu_items_controller.rb', line 34 def create @m_menu_item = MMenuItem.new() respond_with(@m_menu_item) do |format| if @m_menu_item.save format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'failure'} } end end end |
#destroy ⇒ Object
58 59 60 61 62 |
# File 'app/controllers/fast_ext/m_menu_items_controller.rb', line 58 def destroy #@m_menu_item = MMenuItem.find(params[:id]) @m_menu_item.destroy respond_with(@m_menu_item) end |
#edit ⇒ Object
24 25 26 27 |
# File 'app/controllers/fast_ext/m_menu_items_controller.rb', line 24 def edit #@m_menu_item = MMenuItem.find(params[:id]) respond_with(@m_menu_item.to_json(:include => [:m_menu, :createdbyorg, :createdby, :updatedby])) end |
#index ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/fast_ext/m_menu_items_controller.rb', line 9 def index if params[:node] == 'root' @m_menu_items = MMenuItem.roots.where({:m_menu_id => params[:m_menu_id]}.delete_if { |k, v| v.blank? }) else @m_menu_items = MMenuItem.where({:parent_id => params[:node]}.delete_if { |k, v| v.blank?}) #@m_menu_items = paginate(@items) end respond_with(@m_menu_items.to_json(:include => [:m_menu, :createdbyorg, :createdby, :updatedby], :methods => [:leaf, :expanded])) end |
#new ⇒ Object
29 30 31 32 |
# File 'app/controllers/fast_ext/m_menu_items_controller.rb', line 29 def new @m_menu_item = MMenuItem.new respond_with(@m_menu_item) end |
#show ⇒ Object
19 20 21 22 |
# File 'app/controllers/fast_ext/m_menu_items_controller.rb', line 19 def show #@m_menu_item = MMenuItem.find(params[:id]) respond_with(@m_menu_item) end |
#update ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/fast_ext/m_menu_items_controller.rb', line 46 def update #@m_menu_item = MMenuItem.find(params[:id]) respond_with(@m_menu_item) do |format| if @m_menu_item.update_attributes() format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end |