Class: Share::MenusController
- Inherits:
-
BaseController
- Object
- BaseController
- Share::MenusController
- Defined in:
- app/controllers/wechat/share/menus_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #edit_parent ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #new_parent ⇒ Object
- #show ⇒ Object
- #sync ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 29 def create @menu = @app..new() unless @menu.save render :new, locals: { model: @menu }, status: :unprocessable_entity end end |
#destroy ⇒ Object
60 61 62 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 60 def destroy @menu.destroy end |
#edit ⇒ Object
45 46 47 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 45 def edit @parents = Menu.where(type: 'Wechat::ParentMenu', parent_id: nil, appid: @menu.appid) end |
#edit_parent ⇒ Object
49 50 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 49 def edit_parent end |
#index ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 8 def index q_params = {} q_params.merge! params.permit(:name) @default_menus = Menu.roots.where(appid: nil).where(q_params).order(parent_id: :desc, position: :asc) @menus = @app..roots.where(q_params).order(parent_id: :desc, position: :asc) @scene_menu_ids = @scene..pluck(:menu_id) end |
#new ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 18 def new @menu = @app..build(type: 'Wechat::ViewMenu') @menu..build @parents = Menu.where(type: 'Wechat::ParentMenu', parent_id: nil, appid: params[:appid]) end |
#new_parent ⇒ Object
25 26 27 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 25 def new_parent @menu = Menu.new(appid: params[:appid]) end |
#show ⇒ Object
42 43 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 42 def show end |
#sync ⇒ Object
37 38 39 40 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 37 def sync r = @app. render 'sync', locals: { notice: r.to_s } end |
#update ⇒ Object
52 53 54 55 56 57 58 |
# File 'app/controllers/wechat/share/menus_controller.rb', line 52 def update @menu.assign_attributes() unless @menu.save render :edit, locals: { model: @menu }, status: :unprocessable_entity end end |