Sha256: 7ad336764f5d9f8f6496e99b365d23dc6e53ff7896f151b4031e3e278a374148
Contents?: true
Size: 1.94 KB
Versions: 22
Compression:
Stored size: 1.94 KB
Contents
Description: Stubs out a new portlet and its views. Pass the portlet name, either CamelCased or under_scored, and an optional list of attribute pairs as arguments. Attribute pairs are column_name:sql_type arguments specifying the model's attributes. By default, portlets include name:string and template:text attributes, so don't specify them. This generates a portlet class in app/portlets, a form in app/view/portlets and a default view to render the portlet in app/view/portlets, and a unit test in test/unit/portlets. The name you supply will have "portlet" added to it, much the same way controllers work. Example: `./script/generate portlet ListRecentArticles` A portlet to find and display a list of recent Article blocks. Portlet: app/portlets/list_recent_articles_portlet.rb Form View: app/views/portlets/list_recent_articles/_form.html.erb Default Template: app/views/portlets/list_recent_articles/render.html.erb Unit Test: test/unit/portlets/list_recent_articles_portlet_test.rb The _form.html.erb will have two fields, a text_field for name, and text_area for the default template, which will plug in whatever is in render.html.erb. Example with attributes: `./script/generate portlet find_top_x_articles number_to_show:integer description:string` A portlet to display a specific number of articles, as specified in the admin UI. Portlet: app/portlets/find_top_x_articles_portlet.rb Form View: app/views/portlets/find_top_x_articles/_form.html.erb Default Template: app/views/portlets/find_top_x_articles/render.html.erb Unit Test: test/unit/portlets/find_top_x_articles_portlet_test.rb The _form.html.erb will have text_fields for name, number_to_show and description, as well as a text_area for template.
Version data entries
22 entries across 22 versions & 8 rubygems