giix-haml Giix-Haml - Extends the giix extension adding Haml templates and more

  1. Overview
  2. Features
  3. Before installing
  4. Installing
  5. Using
  6. Resources

Overview

Giix-Haml is based on Giix 1.9

From the giix extension...

giix is gii Extended, a code generator for Yii PHP framework.

giix is inspired and based on gii-template-collection (gtc), by Herbert Maschke (thyseus).

giix is free software and is dual-licensed under the terms of the new BSD License and under the terms of GNU GPL v3. See the LICENSE file.

giix-haml simply adds haml templates

Features

Addded Features
  • Ability to generate Haml views
  • Auto singularization of table name (i.e. posts become Post, user_posts_comments becomes UserPostComment)
  • Increased semantics in generated views (e.g. form fields are inside a <li class="field"> on a <ul class="fields-list">)
Coming soon
  • Ability to generate Sass style sheets
Inherited from Giix
  • Proper handling of related model attributes, rendering appropriate form fields based on relation type.
  • More support for HAS_MANY and MANY_MANY relations.
  • Native support for saving MANY_MANY relations with the new method GxActiveRecord::saveWithRelated.
  • Native support for saving multiple (related or not) records with the new method GxActiveRecord::saveMultiple.
  • Automatic string representation for a model via GxActiveRecord::representingColumn() and GxActiveRecord::__toString().
  • Better i18n support and easier to maintain: support to active record labels. You change the label once in the model and it is automatically updated in the views. This is especially useful for plurals.
  • Out-of-the box i18n support by using Yii::t().
  • Appropriate form fields are rendered based on model attribute/table field data type.
  • Separated model and basemodel. Basemodel can be regenerated without overwriting your code in the model.
  • Smart methods can query your database for just the needed data (usually the primary key and the field with the string representantion), avoiding manual setup or a "select *".
  • Extensive use of default method parameters. Appropriate data is found automatically.
  • Some (incipient) support for tables with composite primary keys.
  • Generated code is completely free from styling and formatting. Your CSS controls the presentation.
  • Generated code is (almost) free of comments.
  • Well documented and commented source code. Ohloh says that 40% of the lines in the code are comments! You can understand and modify anything you want.

And a lot more! Read the CHANGELOG file and the (richly commented) source code to fully leverage giix's power.

Some of these features come from gtc.

Before installing

This extension requires the haml-and-sass extension. Please install it first.

Giix-Haml should run with:

  • Yii 1.1.7+ (tested with revision 3340)
  • Linux
  • Apache 2.2 or nginx 0.8+
  • MySQL 5.x
  • PHP 5.2+

Giix-Haml may run on other setups, but there is no official suppport for them. There is no planned official support for other setups, including Windows/IIS, XAMPP/etc or other DBMS.

Installing

  1. Copy the directoryies "core" and "components" from the downloaded archive, or clone this repository, into your application's protected/extensions/giix directory. You'll have to create the giix directory.

  2. Configure the gii generator path in your application, like:

'modules' => array(
            'gii' => array(
                'class' => 'system.gii.GiiModule',
                    'generatorPaths' => array(
                        'ext.giix.core', // giix generators
                    ),
                ),
            ),
        . . .

  1. Configure your application to automatically load the giix component classes when needed, like:
'import' => array(
            ...
            'ext.giix.components.*', // giix components
        ),

It is recommended to set at least the 'password' and 'ipFilters' properties in gii for security.

For more information see the gii documentation at http://www.yiiframework.com/doc/api/GiiModule.

Additionaly, you may remove the entire 'giix.core' directory and generator configuration (step 2 above) when releasing your Web application for improved security.

Using

After installing, you will see the giix generators on the gii page. The giix generators' names start with "giix". When generating CRUD, select the haml template under Read the gii doumentation at http://www.yiiframework.com/doc/api/GiiModule on how to use it.

If you want to use the GxActiveRecord::saveWithRelated method, you must first generate the pivot model for the cross-reference table of the relationship. The pivot model class is the active record between two other active records that have a MANY_MANY relationship. If you have already generated models for every table in your schema, you are ready to use the method to save your MANY_MANY relations. If you use the support for saving MANY_MANY relations as generated, you will need to manually write code to support scenarios. This is an important security concern.

Resources

You can fork it on github

3 0
5 followers
699 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Developed by: Saulo Vallory
Created on: Sep 23, 2011
Last updated: 12 years ago

Downloads

show all

Related Extensions