Skip to content

Instantly share code, notes, and snippets.

package test;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import javax.script.Compilable;
import javax.script.CompiledScript;
import javax.script.Invocable;
@asicfr
asicfr / gist:5033199
Created February 25, 2013 20:54
structure
+---webapp <===== la page index et le fichier appcache sont générés à la racine
+---cssext <===== css externes (bootstrap ...)
+---cssin <===== css propre à l'application
+---gen <===== tous les autres fichiers générés sont dans ce répertoire
¦ +---js <===== contrôleur principal de l'application
¦ +---jsmodules <===== fichiers javascript (contrôleur et service) pour chaque entité
¦ +---pages <===== pages html pour chaque entité
¦ +---partials <===== header et footer html
+---img <===== images de l'application (bootstrap)
+---jsext <===== librairies javascript externes (jquery, bootstrap ...)
@asicfr
asicfr / gist:5014121
Created February 22, 2013 15:16
binding
<div id="authorCreate" data-ng-controller="AuthorCreateCtrl">
<h2>Author Create</h2>
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="id">id</label>
<div class="controls">
@asicfr
asicfr / gist:5013977
Created February 22, 2013 14:53
json data store
{
"entities": {
"author": {
"uuid1": {
"firstName": "prenom",
"id": "1",
"lastName": "nom"
},
"uuid2": {}
},
@asicfr
asicfr / gist:5013596
Created February 22, 2013 14:02
bookStoreauthor.controller
bookStoreauthor.controller('AuthorDetailCtrl', ['$scope', '$location', '$routeParams', '$rootScope', 'ApiAuthor', 'ApiStorage', function ($scope, $location, $routeParams, $rootScope, ApiAuthor, ApiStorage) {
$rootScope.logMe("AuthorDetailCtrl");
$scope.idCurrent = $routeParams.id;
$rootScope.logMe("get author ");
$scope.oneauthor = ApiAuthor.get($scope.idCurrent);
...
@asicfr
asicfr / gist:5013444
Created February 22, 2013 13:41
sous controleur et methodes du crud
// author Controllers
bookStoreauthor.controller('AuthorListCtrl', ['$scope', '$location', '$routeParams', '$rootScope', 'ApiAuthor', 'ApiStorage', function ($scope, $location, $routeParams, $rootScope, ApiAuthor, ApiStorage) {
$rootScope.logMe("AuthorListCtrl");
var self = this;
$scope.authors = ApiAuthor.search();
$rootScope.logMe("search end");
// new Author call
@asicfr
asicfr / gist:5013415
Created February 22, 2013 13:36
entite route
// author module add into global module (see mainctrl.js)
var bookStoreauthor = angular.module('bookStore.author', ['bookStore.author.services'], function($routeProvider, $locationProvider) {
// author list
$routeProvider.when('/author', {
templateUrl: 'gen/pages/author/list.html'
});
// author create
@asicfr
asicfr / gist:5013392
Last active December 14, 2015 02:28
initialisation forcée
// Force template cache to allow offline for all partials
$http.get('gen/partials/footer.html', {cache:$templateCache});
$http.get('gen/partials/header.html', {cache:$templateCache});
$http.get('partials/inprogress.html', {cache:$templateCache});
$http.get('partials/welcome.html', {cache:$templateCache});
$http.get('gen/pages/author/create.html', {cache:$templateCache});
$http.get('gen/pages/author/edit.html', {cache:$templateCache});
$http.get('gen/pages/author/list.html', {cache:$templateCache});
@asicfr
asicfr / gist:5013369
Created February 22, 2013 13:28
Capacité HTML5 du navigateur
// Detect html5 compliance with Modernizr
$rootScope.localstorageEnable = Modernizr.localstorage;
$rootScope.offlineEnable = Modernizr.applicationcache;
$rootScope.logMe("localstorage : " + $rootScope.localstorageEnable);
$rootScope.logMe("offline : " + $rootScope.offlineEnable);
if (($rootScope.offlineEnable == false) || ($rootScope.localstorageEnable == false)) {
toastr.error("Your browser isn't applicationCache compliant !");
} else {
// localstorage conf and init
@asicfr
asicfr / gist:5013366
Last active December 14, 2015 02:28
Routes principales
// Welcome module
var bookStoremain = angular.module('bookStore.main', [], function($routeProvider, $locationProvider) {
// Declare welcome route
$routeProvider.when('/welcome', {
templateUrl : 'partials/welcome.html',
controller: 'MainCtrl'
});
// Declare futur route