Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
alexk-restoin committed Jun 28, 2016
0 parents commit 0b5b21b
Show file tree
Hide file tree
Showing 56 changed files with 1,244 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.DS_Store

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
bower_components

# Build files
build
templates.js

#webstorm
.idea
20 changes: 20 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"node": true,
"jasmine": true,
"browser": true,
"esnext": true,
"bitwise": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"noarg": true,
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"newcap": false
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project is based on https://github.com/jakemmarsh/angularjs-gulp-browserify-boilerplate
Binary file added app/images/angular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/browserify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/gulp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html class="no-js">
<head>
<base href="/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title ng-bind="pageTitle"></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">

<link rel="stylesheet" href="css/main.css">
</head>
<body>

<div ui-view></div>

<script src="js/main.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions app/js/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

const AppSettings = {
appTitle: 'Example Application',
apiUrl: '/api/v1'
};

export default AppSettings;
16 changes: 16 additions & 0 deletions app/js/controllers/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

function ExampleCtrl() {

// ViewModel
const vm = this;

vm.title = 'AngularJS, Gulp, and Browserify! Written with keyboards and love!';
vm.number = 1234;

}

export default {
name: 'ExampleCtrl',
fn: ExampleCtrl
};
16 changes: 16 additions & 0 deletions app/js/controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

import angular from 'angular';
const bulk = require('bulk-require');

const controllersModule = angular.module('app.controllers', []);

const controllers = bulk(__dirname, ['./**/!(*index|*.spec).js']);

Object.keys(controllers).forEach((key) => {
let item = controllers[key];

controllersModule.controller(item.name, item.fn);
});

export default controllersModule;
23 changes: 23 additions & 0 deletions app/js/directives/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

function ExampleDirective() {

return {
restrict: 'EA',
templateUrl: 'directives/example.html',
scope: {
title: '@',
message: '@exampleDirective'
},
link: (scope, element) => {
element.on('click', () => {
window.alert('Element clicked: ' + scope.message);
});
}
};
}

export default {
name: 'exampleDirective',
fn: ExampleDirective
};
16 changes: 16 additions & 0 deletions app/js/directives/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

import angular from 'angular';
const bulk = require('bulk-require');

const directivesModule = angular.module('app.directives', []);

const directives = bulk(__dirname, ['./**/!(*index|*.spec).js']);

Object.keys(directives).forEach((key) => {
let item = directives[key];

directivesModule.directive(item.name, item.fn);
});

export default directivesModule;
14 changes: 14 additions & 0 deletions app/js/filters/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

function ExampleFilter() {

return function(input) {
return input.replace(/keyboard/ig,'leopard');
};

}

export default {
name: 'ExampleFilter',
fn: ExampleFilter
};
16 changes: 16 additions & 0 deletions app/js/filters/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

import angular from 'angular';
const bulk = require('bulk-require');

const filtersModule = angular.module('app.filters', []);

const filters = bulk(__dirname, ['./**/!(*index|*.spec).js']);

Object.keys(filters).forEach((key) => {
let item = filters[key];

filtersModule.filter(item.name, item.fn);
});

export default filtersModule;
34 changes: 34 additions & 0 deletions app/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

import angular from 'angular';

// angular modules
import 'angular-ui-router';
import './templates';
import './filters';
import './controllers';
import './services';
import './directives';

// create and bootstrap application
const requires = [
'ui.router',
'templates',
'app.filters',
'app.controllers',
'app.services',
'app.directives'
];

// mount on window for testing
window.app = angular.module('app', requires);

angular.module('app').constant('AppSettings', require('./constants'));

angular.module('app').config(require('./on_config'));

angular.module('app').run(require('./on_run'));

angular.bootstrap(document, ['app'], {
strictDi: true
});
20 changes: 20 additions & 0 deletions app/js/on_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

function OnConfig($stateProvider, $locationProvider, $urlRouterProvider) {
'ngInject';

$locationProvider.html5Mode(true);

$stateProvider
.state('Home', {
url: '/',
controller: 'ExampleCtrl as home',
templateUrl: 'home.html',
title: 'Home'
});

$urlRouterProvider.otherwise('/');

}

export default OnConfig;
20 changes: 20 additions & 0 deletions app/js/on_run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

function OnRun($rootScope, AppSettings) {
'ngInject';

// change page title based on state
$rootScope.$on('$stateChangeSuccess', (event, toState) => {
$rootScope.pageTitle = '';

if ( toState.title ) {
$rootScope.pageTitle += toState.title;
$rootScope.pageTitle += ' \u2014 ';
}

$rootScope.pageTitle += AppSettings.appTitle;
});

}

export default OnRun;
25 changes: 25 additions & 0 deletions app/js/services/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

function ExampleService($http) {
'ngInject';

const service = {};

service.get = function() {
return new Promise((resolve, reject) => {
$http.get('apiPath').success((data) => {
resolve(data);
}).error((err, status) => {
reject(err, status);
});
});
};

return service;

}

export default {
name: 'ExampleService',
fn: ExampleService
};
16 changes: 16 additions & 0 deletions app/js/services/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

import angular from 'angular';
const bulk = require('bulk-require');

const servicesModule = angular.module('app.services', []);

const services = bulk(__dirname, ['./**/!(*index|*.spec).js']);

Object.keys(services).forEach((key) => {
let item = services[key];

servicesModule.service(item.name, item.fn);
});

export default servicesModule;
42 changes: 42 additions & 0 deletions app/styles/_typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
p {
margin-bottom: 1em;
}

.heading {
margin-bottom: 0.618em;

&.-large {
font-size: $font-size--lg;
font-weight: bold;
line-height: $half-space * 3 / 2;
}

&.-medium {
font-size: $font-size--md;
font-weight: normal;
line-height: $half-space;
}

&.-small {
font-size: $font-size--sm;
font-weight: bold;
line-height: $half-space * 2 / 3;
}

&.-smallest {
font-size: $font-size--xs;
font-weight: bold;
}
}

h1 {
@extend .heading.-large;
}

h2 {
@extend .heading.-medium;
}

h3 {
@extend .heading.-small;
}
25 changes: 25 additions & 0 deletions app/styles/_vars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// colors
// #26283B //Ebony Clay
// #C41E3A //Cardinal
// #FF4D00 //Vermilion
// #FEA904 //Yellow Sea
// #1AB385 //Mountain Meadow
// #F4F4F4 //Wild Sand
$font-color--dark: #333;
$font-color--light: #fff;
$background--light: #eee;
$background--dark: #222;
$blue: #1f8de2;
$green: #1fe27b;
$red: #e21f3f;

// spacing
$full-space: 40px;
$half-space: 20px;

// font sizing
$font-size--xs: 10px;
$font-size--sm: 12px;
$font-size--md: 16px;
$font-size--lg: 24px;
$font-size--xl: 32px;
Loading

0 comments on commit 0b5b21b

Please sign in to comment.