Home

Awesome

Angular Yii - Gallery Manager.

By Spiros Kabasakalis

Overview

A Gallery Manager demo application with Yii REST backend and AngularJS frontend. The application is more involved than the typical introductory todo demo used in js frameworks. It is recommended that you have a basic knowledge of AngularJS,Grunt,and require.js before you dive into the source code.

Live Demo

Features

For best experience,use Chrome.Other browsers may complain here and there.Sorry,no patience to make happy every freaking browser out there!

Setup

Download and copy the project files to some public folder in your development environment. Create an empty assets folder in project root.

Backend

   defined('LOCAL_DOMAIN') or define('LOCAL_DOMAIN','[localhost or Virtual Host]');

This will make your config.php functional both in local development and production environment.

Frontend

You will need Command line tools so it would be ideal if you could use these in your IDE. For example in PHPStorm you can configure Command line tools in Settings/IDE Settings/Command Line Tool Support.

<IfModule mod_headers.c>
#Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Headers "Content-Type, Authorization,
X_REST_USERNAME,X_REST_PASSWORD,X-Requested-With"
Header always set Access-Control-Allow-Methods "POST, GET,PUT,DELETE, OPTIONS"
  </IfModule>

Compiling

The frontend source files reside in /ng-yii/src folder.These are the files that you edit in your IDE.There are three main grunt-tasks configured in Gruntfile.js that compile the src folder:

Running the app.

Provided you use a LAMP stack in your localhost,just point your browser to dev or prod folder,after you have compiled the source. Optionally you can start a local node.js server with grunt server in command line and then point your browser to http://localhost:3005/ . The compiled app in dev folder will run.If you use a non-localhost virtual host domain for your yii backend you must take care of the cross domain security issue already mentioned above.

Tests.

The Jasmine framework is used for testing.There are 8 simple demo unit tests in two files.( in ng-yii/test/scripts/services). Just point your browser to /ng-yii/test/runner.html to run the tests.

Karma (ex-Testacular):Test Runner.

Karma is a test runner which works with any js testing framework. In a nutshell,the usefulness of this command line tool is that it can run tests in the browser automatically every time you edit your source code, so that you always know on the spot if your new additions break something. To start the Karma server,in command line grunt karma:unit.After that,a new command grunt dev.Any changes in your src folder will trigger Karma Test Runner and recompile the dev folder.

Cheers!

Spiros 'drumaddict' Kabasakalis

Acknowledgement

AngularFun by Cary Landholt.

License

angular-yii is released under the WTFPL license.This means that you can literally do whatever you want with this software.

Resources