CMS: Article management controller

Source: Internet
Author: User

With the experience of Writing user-managed controllers, writing this should not be a problem. However, the article management controller still needs to consider how to write this question, because the view involves classification operations and article operations. This is indeed a tough task. Here, the focus of the problem is that you do not need to split it. According to the principle of loose coupling, it is inevitable to split, but the split is too small, too messy, and it is quite painful to write code, especially for a flexible but less rigorous language like JavaScript.

I don't have much experience in developing large systems, so I always prefer to do whatever I want, so it is convenient and easy to get in the way. Therefore, I am inclined to use a single controller without splitting, if you are interested, you can try splitting it yourself.

In the scripts \ app \ controoler directory, create a controller named content. js. Based on the experience of the controller managed by the user, write the following code:

Ext. Define ('simplecms. Controller. content ',{

Extend: 'ext. App. controller ',

Models :[

'Category', 'categorytree', 'categorycombo ', 'content'

],

 

Stores :[

'Categoriestree', 'categoriescombo ', 'contents'

],

 

Views :[

],

 

Refs :[

],

 

Init: function (){

Me. Control ({

});

}

 

});

 

Code to include all models and stores into the controller. The view has not been created and is not defined yet. The same is true for references.

Switch to the mainpanel controller. Under the activate event listening code of "# contentpanel", delete the console. Log Code and add the following code:

This. application. getcontroller ('content'). INIT ();

 

In this way, the Controller managed by the article is loaded into the application, and the subsequent work is to load the view in the init method of the article management controller.

Modify the activetab configuration item in the mainpanel view and return it to 0 so that the Article management tab is displayed as the default tab.

So far, the Controller's work has come to an end. The next step is to define the view and then complete the operations on the controller.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.