Skip to content
This repository was archived by the owner on Dec 16, 2019. It is now read-only.

Commit 8016cdb

Browse files
committed
init
1 parent b50b3fc commit 8016cdb

13 files changed

+324
-13
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ results
1515

1616
node_modules
1717

18-
bower_components
18+
#Actually, need to track these for site to run on Github Pages..
19+
#bower_components

Gruntfile.js

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/**
2+
@toc
3+
2. load grunt plugins
4+
3. init
5+
4. setup variables
6+
5. grunt.initConfig
7+
6. register grunt tasks
8+
9+
*/
10+
11+
'use strict';
12+
13+
module.exports = function(grunt) {
14+
15+
/**
16+
Load grunt plugins
17+
@toc 2.
18+
*/
19+
grunt.loadNpmTasks('grunt-contrib-concat');
20+
grunt.loadNpmTasks('grunt-contrib-less');
21+
grunt.loadNpmTasks('grunt-contrib-uglify');
22+
grunt.loadNpmTasks('grunt-contrib-cssmin');
23+
grunt.loadNpmTasks('grunt-contrib-jshint');
24+
grunt.loadNpmTasks('grunt-karma');
25+
26+
/**
27+
Function that wraps everything to allow dynamically setting/changing grunt options and config later by grunt task. This init function is called once immediately (for using the default grunt options, config, and setup) and then may be called again AFTER updating grunt (command line) options.
28+
@toc 3.
29+
@method init
30+
*/
31+
function init(params) {
32+
/**
33+
Project configuration.
34+
@toc 5.
35+
*/
36+
grunt.initConfig({
37+
concat: {
38+
devCss: {
39+
src: [],
40+
dest: []
41+
}
42+
},
43+
jshint: {
44+
options: {
45+
//force: true,
46+
globalstrict: true,
47+
//sub: true,
48+
node: true,
49+
loopfunc: true,
50+
browser: true,
51+
devel: true,
52+
globals: {
53+
angular: false,
54+
$: false,
55+
moment: false,
56+
Pikaday: false,
57+
module: false,
58+
forge: false
59+
}
60+
},
61+
beforeconcat: {
62+
options: {
63+
force: false,
64+
ignores: ['**.min.js']
65+
},
66+
files: {
67+
src: []
68+
}
69+
},
70+
//quick version - will not fail entire grunt process if there are lint errors
71+
beforeconcatQ: {
72+
options: {
73+
force: true,
74+
ignores: ['**.min.js']
75+
},
76+
files: {
77+
src: ['**.js']
78+
}
79+
}
80+
},
81+
uglify: {
82+
options: {
83+
mangle: false
84+
},
85+
build: {
86+
files: {},
87+
src: 'js-dropdown-multiselect.js',
88+
dest: 'js-dropdown-multiselect.min.js'
89+
}
90+
},
91+
less: {
92+
development: {
93+
options: {
94+
},
95+
files: {
96+
"main.css": "_base.less",
97+
"js-dropdown-multiselect.css": "_js-dropdown-multiselect.less"
98+
}
99+
}
100+
},
101+
cssmin: {
102+
dev: {
103+
src: ['js-dropdown-multiselect.css'],
104+
dest: 'js-dropdown-multiselect.min.css'
105+
}
106+
}/*,
107+
karma: {
108+
unit: {
109+
configFile: publicPathRelativeRoot+'config/karma.conf.js',
110+
singleRun: true,
111+
browsers: ['PhantomJS']
112+
}
113+
}*/
114+
});
115+
116+
117+
/**
118+
register/define grunt tasks
119+
@toc 6.
120+
*/
121+
// Default task(s).
122+
// grunt.registerTask('default', ['jshint:beforeconcat', 'less:development', 'concat:devJs', 'concat:devCss']);
123+
grunt.registerTask('default', ['jshint:beforeconcatQ', 'less:development', 'cssmin', 'uglify:build']);
124+
125+
}
126+
init({}); //initialize here for defaults (init may be called again later within a task)
127+
128+
};

_base.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import url('js-dropdown-multiselect.less');

_js-dropdown-multiselect.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//mixins
2+
//@import url('bower_components/lesshat/build/lesshat.less');
3+
4+
@import url('js-dropdown-multiselect.less');

app.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
@toc
3+
1. setup - whitelist, appPath, html5Mode
4+
*/
5+
6+
'use strict';
7+
8+
angular.module('myApp', [
9+
'ngRoute', 'ngSanitize', 'ngTouch', 'ngAnimate', //additional angular modules
10+
'Dotan Simha.angularjs-dropdown-multiselect'
11+
]).
12+
config(['$routeProvider', '$locationProvider', '$compileProvider', function($routeProvider, $locationProvider, $compileProvider) {
13+
/**
14+
setup - whitelist, appPath, html5Mode
15+
@toc 1.
16+
*/
17+
$locationProvider.html5Mode(false); //can't use this with github pages / if don't have access to the server
18+
19+
// var staticPath ='/';
20+
var staticPath;
21+
// staticPath ='/angular-directives/angularjs-dropdown-multiselect/'; //local
22+
staticPath ='/'; //nodejs (local)
23+
// staticPath ='/angularjs-dropdown-multiselect/'; //gh-pages
24+
var appPathRoute ='/';
25+
var pagesPath =staticPath+'pages/';
26+
27+
28+
$routeProvider.when(appPathRoute+'home', {templateUrl: pagesPath+'home/home.html'});
29+
30+
$routeProvider.otherwise({redirectTo: appPathRoute+'home'});
31+
32+
}]);

bower.json

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
{
2-
"name": "angularjs-dropdown-multiselect",
3-
"version": "1.0.0",
2+
"name": "angularjs-dropdown-multiselect-demo",
3+
"version": "0.0.0",
44
"authors": [
55
"Dotan Simha <[email protected]>"
66
],
7-
"description": "AngularJS Dropdown Multiselect",
7+
"description": "Demo",
88
"keywords": [
9-
"angularjs",
10-
"angular",
11-
"dropdown",
12-
"multiselect",
13-
"directive",
14-
"list",
15-
"checklist",
16-
"bootstrap"
179
],
1810
"license": "MIT",
1911
"ignore": [
@@ -27,7 +19,8 @@
2719
"angular":"~1.2.0",
2820
"angular-animate":"~1.2.0",
2921
"angular-sanitize":"~1.2.0",
30-
"angular-touch":"~1.2.0"
22+
"angular-touch":"~1.2.0",
23+
"angular-route":"~1.2.0"
3124
},
3225
"devDependencies": {
3326
}

index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en" ng-app="myApp">
3+
<head>
4+
<meta charset="utf-8">
5+
6+
<title>angularjs-dropdown-multiselect</title>
7+
8+
<link rel="stylesheet" href="main.css"/>
9+
10+
</head>
11+
<body>
12+
<div ng-view></div>
13+
14+
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
15+
<script type="text/javascript" src="bower_components/angular-route/angular-route.min.js"></script>
16+
<script type="text/javascript" src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
17+
<script type="text/javascript" src="bower_components/angular-touch/angular-touch.min.js"></script>
18+
<script type="text/javascript" src="bower_components/angular-animate/angular-animate.min.js"></script>
19+
20+
<script type="text/javascript" src="js-dropdown-multiselect.js"></script>
21+
<!--<script type="text/javascript" src="js-dropdown-multiselect.min.js"></script>-->
22+
23+
<script type="text/javascript" src="app.js"></script>
24+
25+
<script type="text/javascript" src="pages/home/HomeCtrl.js"></script>
26+
</body>
27+
</html>

js-dropdown-multiselect.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
@toc
3+
4+
@param {Object} scope (attrs that must be defined on the scope (i.e. in the controller) - they can't just be defined in the partial html). REMEMBER: use snake-case when setting these on the partial!
5+
TODO
6+
7+
@param {Object} attrs REMEMBER: use snake-case when setting these on the partial! i.e. my-attr='1' NOT myAttr='1'
8+
TODO
9+
10+
@dependencies
11+
TODO
12+
13+
@usage
14+
partial / html:
15+
TODO
16+
17+
controller / js:
18+
TODO
19+
20+
//end: usage
21+
*/
22+
23+
'use strict';
24+
25+
angular.module('Dotan Simha.angularjs-dropdown-multiselect', []).directive('JsDropdownMultiselect', [ function () {
26+
27+
return {
28+
restrict: 'A',
29+
scope: {
30+
},
31+
32+
// replace: true,
33+
template: function(element, attrs) {
34+
var defaultsAttrs ={
35+
};
36+
for(var xx in defaultsAttrs) {
37+
if(attrs[xx] ===undefined) {
38+
attrs[xx] =defaultsAttrs[xx];
39+
}
40+
}
41+
42+
var html ="<div>";
43+
html+="</div>";
44+
return html;
45+
},
46+
47+
link: function(scope, element, attrs) {
48+
},
49+
50+
controller: function($scope, $element, $attrs) {
51+
}
52+
};
53+
}]);

js-dropdown-multiselect.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* jrg-js-dropdown-multiselect */

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"author": "",
3+
"name": "angularjs-dropdown-multiselect-demo",
4+
"version": "0.0.0",
5+
"description": "",
6+
"homepage": "",
7+
"dependencies": {
8+
},
9+
"devDependencies": {
10+
"express":"~3.4.4",
11+
"grunt": "~0.4.1",
12+
"grunt-contrib-concat": "~0.3.0",
13+
"grunt-contrib-less": "~0.8.1",
14+
"grunt-contrib-uglify": "~0.2.5",
15+
"grunt-contrib-cssmin": "~0.7.0",
16+
"grunt-contrib-jshint": "~0.7.0",
17+
"grunt-karma": "~0.6.2"
18+
},
19+
"scripts": {
20+
"test": "echo \"Error: no test specified\" && exit 1"
21+
},
22+
"repository": "",
23+
"engines":{
24+
"node":"0.10.10"
25+
}
26+
}

pages/home/HomeCtrl.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
*/
3+
4+
'use strict';
5+
6+
angular.module('myApp').controller('HomeCtrl', ['$scope', function($scope) {
7+
//TODO - put any directive code here
8+
}]);

pages/home/home.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div ng-controller='HomeCtrl'>
2+
<!-- TODO: place directive call here -->
3+
</div>

server.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use strict';
2+
3+
var fs =require('fs'); //for image upload file handling
4+
5+
var express = require('express');
6+
var app = express();
7+
8+
var port =3000;
9+
var host ='localhost';
10+
var serverPath ='/';
11+
var staticPath ='/';
12+
13+
var staticFilePath = __dirname + serverPath;
14+
// remove trailing slash if present
15+
if(staticFilePath.substr(-1) === '/'){
16+
staticFilePath = staticFilePath.substr(0, staticFilePath.length - 1);
17+
}
18+
19+
app.configure(function(){
20+
// compress static content
21+
app.use(express.compress());
22+
app.use(serverPath, express.static(staticFilePath)); //serve static files
23+
24+
app.use(express.bodyParser()); //for post content / files - not sure if this is actually necessary?
25+
});
26+
27+
//catch all route to serve index.html (main frontend app)
28+
app.get('*', function(req, res){
29+
res.sendfile(staticFilePath + staticPath+ 'index.html');
30+
});
31+
32+
app.listen(port);
33+
34+
console.log('Server running at http://'+host+':'+port.toString()+'/');

0 commit comments

Comments
 (0)