This article discusses one of the basic services provided in ROR: Action view. Action views enable you to present data more quickly to the user. The services for some action views are described in this article, and an example is given to illustrate how to use the action view.
In the MVC pattern V, view, which is used to show the data in the form that the user needs, and unlike traditional patterns, the view can save a lot of unnecessary detail when presenting the data. In other words, any framework based on the MVC pattern should provide an easier way to extract and display the data that is needed. ROR is such a framework. It takes the action view as one of its core components.
In this article, the basic services for the action view are discussed primarily. The first section describes the services associated with action view. Some basic features of the action view are discussed in the second and third sections, and in the last part, an example is given to illustrate how to use the action view.
Services for Action views
The function of a view is to present data to the user. The main services in the Action view are listed below:
• templates
• layout
• Paging
Of course, there are a lot of services in action view, but the top three services are the most important in action view.
Template
The so-called template, is in a file predefined some common resources, the application through the use of these shared resources, the application can simplify the development process, so as to achieve the purpose of reuse. The templates in action view include the resources that are layout information, the paths that some data holds, and so on. There are many templates in the action view, such as HTML-formatted login templates, as well as email template.
Layout
From software, including web and desktop programs, the layout is to organize and arrange the controls in the GUI, which means that the layout controls how the GUI controls (such as buttons, text boxes, and so on) are placed on the interface. For example, a layout can be arranged vertically and evenly spaced by vertically spaced controls.
Paging
The role of pagination is to display a large number of data in batches on the page, through the "previous" and "Next" page to switch between pages. Paging Some like using a printer to hit a large document, a piece of paper can not hit, the data into multiple pieces of paper to play. Although it is possible to apply the paging data to the program to solve the problem of large amount of data display, this brings another problem, that is, if the data is navigated, that is, the paging problem.
In addition to the services mentioned above, there are other services in the action view, such as formatting assistants. But the three services described above are most important in the action view. In the next section, we'll discuss how to use these services.