Class: WeixinPam::DiymenusController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WeixinPam::DiymenusController
- Defined in:
- app/controllers/weixin_pam/diymenus_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /diymenus.
-
#destroy ⇒ Object
DELETE /diymenus/1.
- #download ⇒ Object
-
#edit ⇒ Object
GET /diymenus/1/edit.
-
#index ⇒ Object
GET /diymenus.
-
#new ⇒ Object
GET /diymenus/new.
- #sort ⇒ Object
-
#update ⇒ Object
PATCH/PUT /diymenus/1.
- #upload ⇒ Object
Instance Method Details
#create ⇒ Object
POST /diymenus
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 24 def create @diymenu = @public_account..new() if @diymenu.save redirect_to (@public_account), notice: '菜单创建成功.' else render :new end end |
#destroy ⇒ Object
DELETE /diymenus/1
43 44 45 46 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 43 def destroy @diymenu.destroy redirect_to (@public_account), notice: '删除菜单成功.' end |
#download ⇒ Object
66 67 68 69 70 71 72 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 66 def download @public_account. flash[:notice] = '下载成功.' render js: "Turbolinks.visit('#{(@public_account)}');" rescue ApiError::FailedResult => ex render json: { action: :download, error: "#{ex.} - #{ex.result.cn_msg}" } end |
#edit ⇒ Object
GET /diymenus/1/edit
20 21 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 20 def edit end |
#index ⇒ Object
GET /diymenus
9 10 11 12 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 9 def index @page_name = 'diymenus_index' @diymenus = @public_account. end |
#new ⇒ Object
GET /diymenus/new
15 16 17 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 15 def new @diymenu = @public_account..new end |
#sort ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 48 def sort state = JSON.parse(params[:state]) , = state , true , false render json: { action: :sort } end |
#update ⇒ Object
PATCH/PUT /diymenus/1
35 36 37 38 39 40 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 35 def update if @diymenu.update() flash[:notice] = '修改成功.' end render :edit end |
#upload ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'app/controllers/weixin_pam/diymenus_controller.rb', line 57 def upload result = @public_account. render json: { action: :upload, ok: result.ok?, msg: result.cn_msg } end |