first commit
way too late.
This commit is contained in:
commit
d4f7dc57fc
53 files changed
+3518
No files matched your search
@@ -0,0 +1,7 @@
|
||||
logs/*
|
||||
!.gitkeep
|
||||
node_modules/
|
||||
bower_components/
|
||||
tmp
|
||||
.DS_Store
|
||||
.idea
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "angular-requirejs-seed",
|
||||
"description": "AngularJS seed project modified for requireJS support.",
|
||||
"version": "0.2.0",
|
||||
"homepage": "https://github.com/tnajdek/angular-requirejs-seed",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"angular": "~1.2.1",
|
||||
"angular-route": "~1.2.1",
|
||||
"angular-scenario": "~1.2.1",
|
||||
"angular-mocks": "~1.2.1",
|
||||
"requirejs": "~2.1.9",
|
||||
"requirejs-text": "~2.0.10",
|
||||
"foundation": "zurb/bower-foundation",
|
||||
"html5-boilerplate": "~4.3.0",
|
||||
"angularAMD": "~0.2.1",
|
||||
"angular-foundation": "~0.5.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
define [
|
||||
"angularAMD"
|
||||
"angular-route"
|
||||
"foundation"
|
||||
], (angularAMD) ->
|
||||
app = angular.module("webapp", ["ngRoute", "mm.foundation"])
|
||||
app.config ($routeProvider) ->
|
||||
$routeProvider.when("/", angularAMD.route(
|
||||
templateUrl: "partials/home.html"
|
||||
controller: "HomeCtrl"
|
||||
controllerUrl: "controllers/homeCtrl"
|
||||
)).when("/apispec", angularAMD.route(
|
||||
templateUrl: "partials/apispec.html"
|
||||
controller: "ApispecCtrl"
|
||||
controllerUrl: "controllers/apispecCtrl"
|
||||
)).when("/newdoorman", angularAMD.route(
|
||||
templateUrl: "partials/newdoorman.html"
|
||||
controller: "NewDoormanCtrl"
|
||||
controllerUrl: "controllers/newdoormanCtrl"
|
||||
)).when("/doormen", angularAMD.route(
|
||||
templateUrl: "partials/doormen.html"
|
||||
controller: "DoormenCtrl"
|
||||
controllerUrl: "controllers/doormenCtrl"
|
||||
)).when("/doormen/error/:error/:id", angularAMD.route(
|
||||
templateUrl: "partials/doormanError.html"
|
||||
controller: "DoormanErrorCtrl"
|
||||
controllerUrl: "controllers/doormanErrorCtrl"
|
||||
)).when("/doormen/:id", angularAMD.route(
|
||||
templateUrl: "partials/doorman.html"
|
||||
controller: "DoormanCtrl"
|
||||
controllerUrl: "controllers/doormanCtrl"
|
||||
)).otherwise redirectTo: "/"
|
||||
return
|
||||
|
||||
angularAMD.bootstrap(app)
|
||||
@@ -0,0 +1,28 @@
|
||||
define ["app", "angularAMD"], (app, angularAMD) ->
|
||||
app.controller "ApispecCtrl", ($scope) ->
|
||||
$scope.methods =
|
||||
get: "GET"
|
||||
post: "POST"
|
||||
|
||||
angularAMD.directive "wabMethod", () ->
|
||||
directive =
|
||||
restrict: 'E',
|
||||
scope:
|
||||
method: '@'
|
||||
link: (scope, element) ->
|
||||
scope.methods =
|
||||
get: "GET"
|
||||
put: "PUT"
|
||||
delete: "DELETE"
|
||||
post: "POST"
|
||||
|
||||
template: '<code style="width:5em; display: block; text-align: center;">{{ methods[method] }}</code>'
|
||||
return directive
|
||||
|
||||
angularAMD.directive "wabApi", () ->
|
||||
directive =
|
||||
restrict: 'E',
|
||||
scope:
|
||||
endpoint: '@'
|
||||
template: '<a>/api{{ endpoint }}</a>'
|
||||
return directive
|
||||
@@ -0,0 +1,30 @@
|
||||
define ["app"], (app) ->
|
||||
app.controller "DoormanCtrl", ["$scope", "$http","$routeParams","$location", ($scope, $http, $routeParams, $location) ->
|
||||
$scope.doorman = {values: []}
|
||||
$scope.apiurl = "/api/doormen/#{$routeParams.id}"
|
||||
$http.get($scope.apiurl).then((res) ->
|
||||
$scope.doorman = res.data
|
||||
).catch((res) ->
|
||||
if res.status == 404
|
||||
$location.path("/doormen/error/#{res.status}/#{$routeParams.id}")
|
||||
)
|
||||
|
||||
$scope.deleteDoorman = () ->
|
||||
console.log("not yet implemented")
|
||||
|
||||
$scope.validate = ()->
|
||||
ret = 0
|
||||
for val in $scope.doorman.values
|
||||
ret += val.probability
|
||||
return Math.abs(ret - 1.0) < 0.000001
|
||||
|
||||
$scope.updateDoorman = () ->
|
||||
if !$scope.validate()
|
||||
return
|
||||
$http.put($scope.apiurl, $scope.doorman).then((ret)->
|
||||
console.log "update"
|
||||
).catch((res) ->
|
||||
d = 9
|
||||
)
|
||||
]
|
||||
return
|
||||
@@ -0,0 +1,6 @@
|
||||
define ["app"], (app) ->
|
||||
app.controller "DoormanErrorCtrl", ["$scope","$routeParams", ($scope, $routeParams) ->
|
||||
$scope.id = $routeParams.id
|
||||
$scope.error = Number($routeParams.error)
|
||||
]
|
||||
return
|
||||
@@ -0,0 +1,9 @@
|
||||
define ["app"], (app) ->
|
||||
app.controller "DoormenCtrl",[ "$scope", "$http", ($scope, $http) ->
|
||||
$scope.doormen = []
|
||||
$http.get("/api/doormen").then (res) ->
|
||||
$scope.doormen = res.data.doormen
|
||||
return
|
||||
]
|
||||
|
||||
return
|
||||
@@ -0,0 +1,6 @@
|
||||
define ["app"], (app) ->
|
||||
app.controller "HomeCtrl", ($scope) ->
|
||||
$scope.message = "message from home ctrl"
|
||||
return
|
||||
|
||||
return
|
||||
@@ -0,0 +1,57 @@
|
||||
epsilon = 0.0001
|
||||
|
||||
define ["app"], (app) ->
|
||||
app.controller "NewDoormanCtrl", ["$scope", "$http", "$location", ($scope, $http, $location) ->
|
||||
$scope.error = ""
|
||||
$scope.value = {}
|
||||
$scope.payload =
|
||||
name: ""
|
||||
values: []
|
||||
|
||||
$scope.isValidValue = () ->
|
||||
return $scope.value.name and $scope.value.probability
|
||||
|
||||
$scope.addNewValue = () ->
|
||||
if !$scope.isValidValue()
|
||||
return
|
||||
$scope.payload.values.push($scope.value)
|
||||
$scope.value = {name: "", probability: 0}
|
||||
|
||||
$scope.removeValue = (idx) ->
|
||||
$scope.payload.values.splice(idx, 1);
|
||||
|
||||
$scope.getProbabilityRemaining = () ->
|
||||
ret = 0
|
||||
for v in $scope.payload.values
|
||||
ret += v.probability
|
||||
return 1 - ret
|
||||
|
||||
$scope.redirectToDoorman = (doormanLocation) ->
|
||||
$http.get(doormanLocation).then (res) ->
|
||||
id = res.data.id
|
||||
return $location.url("/doormen/#{id}")
|
||||
|
||||
$scope.createDoorman = () ->
|
||||
if not $scope.isDoormanValid()
|
||||
return
|
||||
$http.post("/api/doormen", $scope.payload).
|
||||
then((res, s) ->
|
||||
$scope.redirectToDoorman(res.headers("location"))
|
||||
).catch((res) ->
|
||||
$scope.error = res.data
|
||||
)
|
||||
|
||||
$scope.isDoormanValid = () ->
|
||||
if not $scope.payload.name
|
||||
return false
|
||||
if $scope.payload.values.length < 2
|
||||
return false
|
||||
if Math.abs($scope.getProbabilityRemaining()) > epsilon
|
||||
return false
|
||||
return true
|
||||
|
||||
|
||||
return
|
||||
]
|
||||
|
||||
return
|
||||
@@ -0,0 +1,6 @@
|
||||
define ["app"], (app) ->
|
||||
app.controller "sideBarCtrl", ($scope) ->
|
||||
$scope.message = "Message from MyCtrl1"
|
||||
return
|
||||
|
||||
return
|
||||
@@ -0,0 +1,20 @@
|
||||
require.config
|
||||
baseUrl: "js"
|
||||
|
||||
# alias libraries paths. Must set 'angular'
|
||||
paths:
|
||||
"angular" : "/bower_components/angular/angular.min"
|
||||
"angular-route": "/bower_components/angular-route/angular-route.min"
|
||||
"angularAMD" : "/bower_components/angularAMD/angularAMD.min"
|
||||
"foundation" : "/bower_components/angular-foundation/mm-foundation-tpls"
|
||||
|
||||
|
||||
# Add angular modules that does not support AMD out of the box, put it in a shim
|
||||
shim:
|
||||
"angularAMD": ["angular"]
|
||||
"angular-route": ["angular"]
|
||||
"foundation" : ["angular"]
|
||||
|
||||
|
||||
# kick start application
|
||||
deps: ["app"]
|
||||
@@ -0,0 +1,50 @@
|
||||
var bower = require('gulp-bower');
|
||||
var gulp = require('gulp');
|
||||
var coffee = require('gulp-coffee');
|
||||
var help = require('gulp-task-listing');
|
||||
var clean = require('gulp-clean');
|
||||
var sass = require('gulp-sass');
|
||||
var rjs = require("gulp-rjs");
|
||||
|
||||
|
||||
gulp.task('help', help);
|
||||
|
||||
gulp.task('bower', function() {
|
||||
return bower()
|
||||
.pipe(gulp.dest('bower_components/'))
|
||||
});
|
||||
|
||||
gulp.task('sass', ['bower'], function () {
|
||||
return gulp.src('./scss/*.scss')
|
||||
.pipe(sass({includePaths: ['bower_components/foundation/scss']}))
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
|
||||
gulp.task('coffee', ['bower'], function() {
|
||||
return gulp.src('coffee/**/*.coffee')
|
||||
.pipe(coffee({bare: true}))
|
||||
.pipe(gulp.dest('js/'))
|
||||
});
|
||||
|
||||
gulp.task('clean', function(){
|
||||
return gulp.src(["js/", "bower_components/", "css/"], {read: false})
|
||||
.pipe(clean())
|
||||
});
|
||||
|
||||
|
||||
gulp.task('rjs', ['coffee'], function(){
|
||||
return gulp.src('coffee/**/*.coffee')
|
||||
.pipe(coffee())
|
||||
.pipe(gulp.dest('./dist'))
|
||||
.pipe(rjs({baseUrl:'.'}))
|
||||
});
|
||||
|
||||
|
||||
gulp.task('default', ['bower', 'sass', 'coffee']);
|
||||
|
||||
|
||||
|
||||
gulp.task('dev', ['bower', 'sass', 'coffee'], function(){
|
||||
gulp.watch('coffee/**/*.coffee', ['coffee']);
|
||||
gulp.watch('./scss/*.scss', ['sass']);
|
||||
});
|
||||
Executable
Whitespace-only changes.
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>doorman</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<script data-main="/js/main" src="/bower_components/requirejs/require.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="off-canvas-wrap">
|
||||
<div class="inner-wrap">
|
||||
|
||||
<nav class="tab-bar">
|
||||
<section class="middle tab-bar-section">
|
||||
<h1 class="title">Doorman</h1>
|
||||
</section>
|
||||
|
||||
<section class="right-small">
|
||||
<a class="right-off-canvas-toggle menu-icon" ><span></span></a>
|
||||
</section>
|
||||
</nav>
|
||||
|
||||
<aside class="right-off-canvas-menu">
|
||||
<ul class="off-canvas-list">
|
||||
<li><a></a></li>
|
||||
<li><a href="#/doormen">doormen</a></li>
|
||||
<li><a href="#/newdoorman">new doorman</a></li>
|
||||
<li><a href="#/apispec">api specification</a></li>
|
||||
<li><a href="#/serverspec">server specification</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
<section class="main-section">
|
||||
<div class="large-12 small-12 columns" ng-view>
|
||||
</section>
|
||||
|
||||
|
||||
<a class="exit-off-canvas"></a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"gulp": "~3.8.9",
|
||||
"gulp-bower": "0.0.7",
|
||||
"gulp-clean": "~0.3.1",
|
||||
"gulp-coffee": "~2.2.0",
|
||||
"gulp-sass": "^1.2.4",
|
||||
"gulp-task-listing": "~0.3.0",
|
||||
"node-sass": "~1.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-rjs": "^0.1.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<div class="row wab-apispect">
|
||||
<div class="columns large-12">
|
||||
<h2>Api specification</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row wab-apispect">
|
||||
<table class="columns large-12">
|
||||
<thead>
|
||||
<tr>
|
||||
<th >api endpoint</th>
|
||||
<th>method</th>
|
||||
<th >description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><wab-api endpoint="/doormen"></wab-api></td>
|
||||
<td><wab-method method="get"></wab-method></td>
|
||||
<td>Get the list of all the public doormen.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><wab-api endpoint="/doormen"></wab-api></td>
|
||||
<td><wab-method method="post"></wab-method></td>
|
||||
<td>Create a new doorman.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><wab-api endpoint="/doormen/:id"></wab-api></td>
|
||||
<td><wab-method method="get"></wab-method></td>
|
||||
<td>Get the doorman</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><wab-api endpoint="/doormen/:id"></wab-api></td>
|
||||
<td><wab-method method="put"></wab-method></td>
|
||||
<td>Update the doorman with new probabilities</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><wab-api endpoint="/doormen/:id"></wab-api></td>
|
||||
<td><wab-method method="delete"></wab-method></td>
|
||||
<td>Delete the doorman</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<h2>{{ doorman.name }} </h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<span>doorman id: <code>{{ doorman.id }}</code></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-repeat="value in doorman.values">
|
||||
<div class="columns large-9 small-10">
|
||||
<label >name<input type="text" placeholder="value name" ng-value="value.name" disabled></label>
|
||||
</div>
|
||||
<div class="columns large-3 small-2">
|
||||
<label >probability<input type="number" placeholder="value probability" ng-model="value.probability" min="0" max="1" step="0.01"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="large-12 small-12 columns">
|
||||
<ul class="button-group">
|
||||
<li><a ng-click="updateDoorman()" class="small button" ng-class="{disabled: !validate()}">Update</a></li>
|
||||
<li><a ng-click="deleteDoorman()" class="small button">Delete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<span>Error {{ error }} getting doorman {{ id }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<h2>doormen</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<ul>
|
||||
<li ng-repeat="doorman in doormen"> <a href="#/doormen/{{ doorman.id }}"> {{ doorman.name }} </a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<h2>Welcome to the world best a/b testing library</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
<h2>New Doorman</h2>
|
||||
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<label >name<input type="text" placeholder="unique doorman name" ng-model="payload.name"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-repeat="value in payload.values">
|
||||
<div class="columns large-8">
|
||||
<label >value<input type="text" placeholder="value name" ng-model="value.name"></label>
|
||||
</div>
|
||||
<div class="columns large-3">
|
||||
<label >probability<input type="number" placeholder="value probability" ng-model="value.probability" min="0" max="1" step="0.01"></label>
|
||||
</div>
|
||||
<div class="columns large-1">
|
||||
<br>
|
||||
<a class="button round tiny" ng-click="removeValue( $index )">-</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-8">
|
||||
<label >name<input type="text" placeholder="value name" ng-model="value.name"></label>
|
||||
</div>
|
||||
<div class="columns large-3">
|
||||
<label >probability<input type="number" placeholder="value probability" ng-model="value.probability" min="0" max="1" step="0.01"></label>
|
||||
</div>
|
||||
|
||||
<div class="columns large-1">
|
||||
<br>
|
||||
<a class="button round tiny" ng-class="{disabled: !isValidValue()}" ng-click="addNewValue()">+</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="error">
|
||||
<div class="columns large-12">
|
||||
<code style="width:100%; height:100%; display:block; margin-bottom: 1em;">{{ error }}</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="large-11 columns">
|
||||
<button ng-click="createDoorman()" ng-class="{disabled: !isDoormanValid()}">create</button>
|
||||
</div>
|
||||
|
||||
<div class="large-1 columns">
|
||||
<span >propability remaning: {{ getProbabilityRemaining() }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -0,0 +1,21 @@
|
||||
@import "settings";
|
||||
@import url(http://fonts.googleapis.com/css?family=Orbitron:400,900,500,700);
|
||||
|
||||
h1, h2{
|
||||
font-family: 'Orbitron', sans-serif;
|
||||
}
|
||||
|
||||
|
||||
.wab-sidebar{
|
||||
background: $ghost;
|
||||
|
||||
h1{
|
||||
text-align: center;
|
||||
color: $primary-color;
|
||||
}
|
||||
}
|
||||
.wab-apispect{
|
||||
h2{
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,41 @@
|
||||
@import "settings";
|
||||
@import "foundation";
|
||||
@import "doorman";
|
||||
|
||||
// Or selectively include components
|
||||
// @import
|
||||
// "foundation/components/accordion",
|
||||
// "foundation/components/alert-boxes",
|
||||
// "foundation/components/block-grid",
|
||||
// "foundation/components/breadcrumbs",
|
||||
// "foundation/components/button-groups",
|
||||
// "foundation/components/buttons",
|
||||
// "foundation/components/clearing",
|
||||
// "foundation/components/dropdown",
|
||||
// "foundation/components/dropdown-buttons",
|
||||
// "foundation/components/flex-video",
|
||||
// "foundation/components/forms",
|
||||
// "foundation/components/grid",
|
||||
// "foundation/components/inline-lists",
|
||||
// "foundation/components/joyride",
|
||||
// "foundation/components/keystrokes",
|
||||
// "foundation/components/labels",
|
||||
// "foundation/components/magellan",
|
||||
// "foundation/components/orbit",
|
||||
// "foundation/components/pagination",
|
||||
// "foundation/components/panels",
|
||||
// "foundation/components/pricing-tables",
|
||||
// "foundation/components/progress-bars",
|
||||
// "foundation/components/reveal",
|
||||
// "foundation/components/side-nav",
|
||||
// "foundation/components/split-buttons",
|
||||
// "foundation/components/sub-nav",
|
||||
// "foundation/components/switch",
|
||||
// "foundation/components/tables",
|
||||
// "foundation/components/tabs",
|
||||
// "foundation/components/thumbs",
|
||||
// "foundation/components/tooltips",
|
||||
// "foundation/components/top-bar",
|
||||
// "foundation/components/type",
|
||||
// "foundation/components/offcanvas",
|
||||
// "foundation/components/visibility";
|
||||
Reference in new issue
Block a user