Skip to content

Commit 16d8962

Browse files
committed
backup
1 parent 735691a commit 16d8962

29 files changed

+885
-65
lines changed

Gruntfile.js

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ module.exports = function(grunt) {
4848
bower: {
4949
dist: {
5050
dest: 'assets/',
51-
js_dest: 'assets/scripts',
52-
css_dest: 'assets/styles',
53-
fonts_dest: 'assets/fonts',
54-
less_dest: 'client/styles',
51+
js_dest: 'assets/scripts/',
52+
css_dest: 'assets/styles/',
53+
fonts_dest: 'assets/fonts/',
54+
less_dest: 'client/styles/',
5555
/**
5656
* Modify options what you want to import.
5757
*/
@@ -65,9 +65,17 @@ module.exports = function(grunt) {
6565
keepExpandedHierarchy: true,
6666
stripGlobBase: true,
6767
files: [
68-
'dist/scripts/*.js',
68+
'dist/js/*.js',
6969
'dist/fonts/*.{eot,svg,ttf,woff,woff2}',
70-
'dist/styles/*.css'
70+
'dist/css/*.css'
71+
]
72+
},
73+
'font-awesome': {
74+
keepExpandedHierarchy: true,
75+
stripGlobBase: true,
76+
files: [
77+
'css/*.css',
78+
'fonts/*.{eot,svg,ttf,woff,woff2}'
7179
]
7280
},
7381
'lesshat': {
@@ -127,7 +135,7 @@ module.exports = function(grunt) {
127135
assets: {
128136
cwd: 'client/public/',
129137
dest: 'assets/',
130-
src: ['audio/**', 'fonts/**'],
138+
src: ['audio/**', 'fonts/**', 'panels/*.{png,jpg,gif,ico}'],
131139
expand: true
132140
}
133141
},
@@ -234,6 +242,20 @@ module.exports = function(grunt) {
234242
PUBLIC: 'client/public/templates/',
235243
}
236244
}
245+
},
246+
templates: {
247+
dest: 'assets/templates/',
248+
cwd: 'client/apps/',
249+
src: ['*/templates/*.jade'],
250+
ext: '.html',
251+
expand: true,
252+
rename: function(distPath, filePath, options) {
253+
var map = filePath.split('/')
254+
, app = map.shift()
255+
, name = path.basename(filePath)
256+
257+
return distPath + app + '/' + name;
258+
}
237259
}
238260
},
239261

@@ -293,14 +315,14 @@ module.exports = function(grunt) {
293315
options: {
294316
event: ['added', 'deleted']
295317
},
296-
files: ['client/public/styles/*/*.less', 'client/apps/*/styles/*/*.less'],
318+
files: ['client/public/styles/**', 'client/apps/*/styles/*/*.less'],
297319
tasks: ['lessToCss']
298320
},
299321
'style-public': {
300322
options: {
301323
event: ['changed'],
302324
},
303-
files: ['client/public/styles/*/*.less', 'client/apps/*/styles/*/*.less'],
325+
files: ['client/public/styles/**'],
304326
tasks: ['less:public']
305327
},
306328

@@ -387,7 +409,7 @@ module.exports = function(grunt) {
387409
options: {
388410
event: ['changed'],
389411
},
390-
files: ['client/apps/' + name + '/styles/*.less'],
412+
files: ['client/apps/' + name + '/styles/**'],
391413
tasks: ['loadState', 'less:$' + name]
392414
})
393415
})
@@ -538,7 +560,7 @@ module.exports = function(grunt) {
538560

539561
// Extend jade task.
540562
grunt.config('jade.$' + name, {
541-
dest: 'assets/templates/' + name + '.html',
563+
dest: 'assets/' + name + '.html',
542564
src: 'client/apps/' + name + '/index.jade'
543565
})
544566

@@ -547,7 +569,7 @@ module.exports = function(grunt) {
547569
options: {
548570
event: ['changed'],
549571
},
550-
files: [dir + '*.jade', dir + 'templates/*.jade'],
572+
files: [dir + '*.jade', dir + 'templates/**'],
551573
tasks: ['loadState', 'jade:$' + name]
552574
})
553575
})

bower.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"angular-mocks": "1.3.16-build.96+sha.abfbfd6",
99
"angular-route": "1.3.16-build.96+sha.abfbfd6",
1010
"angular-touch": "1.3.16-build.96+sha.abfbfd6",
11-
"script": "https://github.com/ded/script.js.git#2.5.7"
11+
"script": "https://github.com/ded/script.js.git#2.5.7",
12+
13+
"font-awesome": "4.3.0",
14+
"bootstrap": "3.3.4"
1215
},
1316
"devDependencies": {
1417
"lesshat": "3.0.2"

client/apps/index/index.jade

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,56 @@ html(lang="en-US")
77
meta(name="keywords", value= pkg.keywords)
88

99
//- lt styles
10-
link(href= makeVersion('css/font-awesome.min.css'), rel="stylesheet", media="screen")
11-
link(href= makeVersion('css/ngAdmin-" + pkg.version + ".min.css'), rel="stylesheet", media="screen")
12-
link(href= makeVersion('css/ngAdmin-" + pkg.version + ".docs.min.css'), rel="stylesheet", media="screen")
10+
link(href= makeVersion('/assets/styles/bootstrap/bootstrap.min.css'), rel="stylesheet", media="screen")
11+
link(href= makeVersion('/assets/styles/font-awesome/font-awesome.min.css'), rel="stylesheet", media="screen")
12+
link(href= makeVersion('/assets/styles/main/ngAdmin.min.css'), rel="stylesheet", media="screen")
13+
link(href= makeVersion('/assets/styles/main/apps/index.min.css'), rel="stylesheet", media="screen")
1314
title Index | ngAdmin
1415

1516
//- lt scripts
16-
script(src= makeVersion('scripts/script/script.min.js'))
17+
script(src= makeVersion('/assets/scripts/script/script.min.js'))
1718
script.
1819
'use strict'
1920

2021
var jsfile = {
21-
angular: '#{ makeVersion("scripts/angular/angular.min.js") }'
22-
, ngRoute: '#{ makeVersion("scripts/angular-route/angular-route.min.js") }'
23-
, ngTouch: '#{ makeVersion("scripts/angular-touch/angular-touch.min.js") }'
22+
angular: '#{ makeVersion("/assets/scripts/angular/angular.js") }'
23+
, ngRoute: '#{ makeVersion("/assets/scripts/angular-route/angular-route.js") }'
24+
, ngTouch: '#{ makeVersion("/assets/scripts/angular-touch/angular-touch.js") }'
2425

2526
, jQuery: '//code.jquery.com/jquery-1.11.0.min.js'
26-
, highcharts: '#{ makeVersion("scripts/highcharts-4.0.4.min.js") }'
27-
, ngHeightcharts: '#{ makeVersion("scripts/highcharts-ng-0.0.8.min.js") }'
27+
, highcharts: '#{ makeVersion("/assets/scripts/highcharts-4.0.4.min.js") }'
28+
, ngHeightcharts: '#{ makeVersion("/assets/scripts/highcharts-ng-0.0.8.min.js") }'
2829

29-
, public: '#{ makeVersion("/scripts/main/" + pkg.name + ".js") }'
30-
, app: '#{ makeVersion("/scripts/main/apps/index.js") }'
30+
, public: '#{ makeVersion("/assets/scripts/main/" + pkg.name + ".js") }'
31+
, app: '#{ makeVersion("/assets/scripts/main/apps/index.js") }'
3132
}
3233

3334
$script(jsfile.angular, function() {
3435
//- jQuery load after angular, because the angular will auto load jQuery instead jqlit
3536
//- etc. $event or origin event, jQuery will redefine the event object.
36-
$script(jsfile.jQuery, function() {
37-
$script(jsfile.highcharts, function() {
38-
$script(jsfile.ngHeightcharts)
39-
})
40-
})
37+
//- $script(jsfile.jQuery, function() {
38+
//- $script(jsfile.highcharts, function() {
39+
//- $script(jsfile.ngHeightcharts)
40+
//- })
41+
//- })
4142

4243
//- Loading public module, and the page module before angular and it's plugin is ready.
4344
$script([jsfile.ngRoute, jsfile.ngTouch], function() {
44-
$script([jsfile.public, jsfile.app], function() {
45-
//- Because js file was loaded in async, we must bootstrap the extrance module.
46-
angular.bootstrap(document, ['index'])
45+
$script([jsfile.public], function() {
46+
$script([jsfile.app], function() {
47+
//- Because js file was loaded in async, we must bootstrap the extrance module.
48+
angular.bootstrap(document, ['index'])
49+
})
4750
})
4851
})
4952
})
5053

5154
//- lt icons
52-
link(href= makeVersion("/assets/panels/ico/favicon.ico"), rel="shortcut icon")
53-
link(href= makeVersion("/assets/panels/ico/touch-icon-iphone.png"), rel="apple-touch-icon")
54-
link(href= makeVersion("/assets/panels/ico/touch-icon-ipad.png"), rel="apple-touch-icon", sizes="76x76")
55-
link(href= makeVersion("/assets/panels/ico/touch-icon-iphone-retina.png"), rel="apple-touch-icon", sizes="120x120")
56-
link(href= makeVersion("/assets/panels/ico/touch-icon-ipad-retina.png"), rel="apple-touch-icon", sizes="152x152")
55+
link(href= makeVersion("/assets/panels/favicon.ico"), rel="shortcut icon")
56+
link(href= makeVersion("/assets/panels/touch-icon-iphone.png"), rel="apple-touch-icon")
57+
link(href= makeVersion("/assets/panels/touch-icon-ipad.png"), rel="apple-touch-icon", sizes="76x76")
58+
link(href= makeVersion("/assets/panels/touch-icon-iphone-retina.png"), rel="apple-touch-icon", sizes="120x120")
59+
link(href= makeVersion("/assets/panels/touch-icon-ipad-retina.png"), rel="apple-touch-icon", sizes="152x152")
5760

5861
body.fixed-layout.minify-nav
5962
.container-layout

client/apps/index/scripts/index.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1+
angular.module('index', ['ngRoute', 'helpers.array', 'chat', 'header', 'nav'])
12

2-
3-
angular.module('index', [
4-
'ngRoute',
5-
'ui.ngAdmin',
6-
'chat', 'header', 'navigation',
7-
'charts'
8-
])
9-
10-
.constant('TEMPLATE_PATH', './templates/')
3+
.constant('TEMPLATE_PATH', '/assets/templates/')
114

125
.constant('NAVIGATION', [
136
{

client/apps/index/scripts/nav.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
2-
3-
angular.module('navigation', [])
1+
angular.module('nav', ['ui.slideMenu'])
42

53
.directive('navLayout', [
64
'$rootScope',

client/apps/index/styles/partials/navigation/main.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
line-height: 30px;
4848
color: #fff;
4949
font-size: 46px;
50-
font-family: "CrimsonTextBoldItalic";
50+
font-family: "Crimsontext";
5151
}
5252
}
5353

client/apps/index/templates/form-basic.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215

216216
.panel-collapse.in(collapse="isCollapsed")
217217
.panel-body
218-
form.form-horizontal(role="form", role="form")
218+
form.form-horizontal(role="form")
219219
.form-group
220220
label.col-sm-3.control-label Checkboxes
221221
.col-sm-5

client/apps/index/templates/partial/header.jade

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ header#header-container(ng-controller="HeaderController")
9494
li
9595
.item.message
9696
a.thumb
97-
img(src="./ico/apple-touch-icon-144-precomposed.png")
97+
img(src="//q.qlogo.cn/qqapp/100229475/70F82D66FE3FD280B8BC8D789E5CE979/100")
9898

9999
a.desc
100100
span.line
@@ -105,7 +105,7 @@ header#header-container(ng-controller="HeaderController")
105105
li
106106
.item.message
107107
a.thumb
108-
img(src="./ico/apple-touch-icon-144-precomposed.png")
108+
img(src="//q.qlogo.cn/qqapp/100229475/70F82D66FE3FD280B8BC8D789E5CE979/100")
109109

110110
a.desc
111111
span.line
@@ -116,7 +116,7 @@ header#header-container(ng-controller="HeaderController")
116116
li
117117
.item.message
118118
a.thumb
119-
img(src="./ico/apple-touch-icon-144-precomposed.png")
119+
img(src="//q.qlogo.cn/qqapp/100229475/70F82D66FE3FD280B8BC8D789E5CE979/100")
120120

121121
a.desc
122122
span.line
@@ -127,7 +127,7 @@ header#header-container(ng-controller="HeaderController")
127127
li
128128
.item.message
129129
a.thumb
130-
img(src="./ico/apple-touch-icon-144-precomposed.png")
130+
img(src="//q.qlogo.cn/qqapp/100229475/70F82D66FE3FD280B8BC8D789E5CE979/100")
131131

132132
a.desc
133133
span.line
@@ -194,7 +194,7 @@ header#header-container(ng-controller="HeaderController")
194194

195195
li.dropdown-submenu.profile(dropdown-menu)
196196
a.avator(dropdown-menu-toggle)
197-
img(src="./ico/apple-touch-icon-144-precomposed.png")
197+
img(src="//q.qlogo.cn/qqapp/100229475/70F82D66FE3FD280B8BC8D789E5CE979/100")
198198
span.name David Jones
199199

200200
ul.dropdown-menu-profile.dropdown-menu.pull-right

client/apps/index/templates/partial/nav.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
li.profile-sidebar.online
1414
.face.dropdown-submenu.pull-left.open
1515
a.avator
16-
img(src="./ico/apple-touch-icon-144-precomposed.png")
16+
img(src="//q.qlogo.cn/qqapp/100229475/70F82D66FE3FD280B8BC8D789E5CE979/100")
1717

1818
.info.dropdown-submenu
1919
a.name David Jones
Binary file not shown.
Binary file not shown.
8.72 KB
Loading
Loading
8.72 KB
Loading
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
angular.module('helpers.array', [])
2+
3+
.run([
4+
function() {
5+
'use strict'
6+
7+
/**
8+
* inArray 获取元素在数组中所在位置的键值
9+
* @param {Anything} value 要获取键值的元素
10+
* @param {Array} array 数组
11+
* @return {Integer} 键值
12+
*/
13+
angular.inArray = function(value, array) {
14+
if (Array.prototype.indexOf && angular.isFunction(array.indexOf)) {
15+
return array.indexOf(value);
16+
}
17+
else {
18+
for (var i = 0; i < array.length; i ++) {
19+
if (array[i] === value) return i;
20+
}
21+
22+
return -1;
23+
}
24+
};
25+
26+
angular.filter = function(array, callback) {
27+
if (Array.prototype.filter) {
28+
return Array.prototype.filter.call(array, callback);
29+
}
30+
else {
31+
for (var i = 0; i < array.length; i ++) {
32+
if (false === callback(array[i])) {
33+
array.splice(i --, 1);
34+
}
35+
}
36+
}
37+
};
38+
39+
/**
40+
* inArrayBy inArray 增强版,获取数组中元素拥有与要查询元素相同的属性值的键值
41+
* @param {Object|Integer} object_or_index 对象或数字(数字用于数组下标)
42+
* @return {Integer} 键值,不存在返回 -1;
43+
*/
44+
angular.inArrayBy = function(object_or_index, array, index_name) {
45+
var index,
46+
i = 0,
47+
l = array.length;
48+
49+
index = angular.isObject(object_or_index)
50+
? object_or_index[index_name]
51+
: index = object_or_index;
52+
53+
for (; i < l; i ++) {
54+
if (array[i][index_name] == index) {
55+
return i;
56+
}
57+
}
58+
59+
return -1;
60+
};
61+
62+
/**
63+
* unique 去重
64+
* @param {Array} arr 数组
65+
* @return {Array} 去重后的数组
66+
*/
67+
angular.unique = function(arr) {
68+
var n = {},
69+
r = [],
70+
i = 0;
71+
72+
for (i = 0; i < arr.length; i ++) {
73+
if (!n[arr[i]]) {
74+
n[arr[i]] = true;
75+
r.push(arr[i]);
76+
}
77+
}
78+
79+
return r;
80+
};
81+
82+
}
83+
])
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
!(function(angular, window) {'use strict';
2+
3+
/**
4+
* isBoolean 判断对象是否为 boolean 类型
5+
* @param {Anything} a 需要判断的对象
6+
* @return {Boolean} True|False
7+
*/
8+
angular.isBoolean = function(a) {
9+
return a === true || a === false || Object.prototype.toString.call(a) == '[object Boolean]';
10+
};
11+
12+
})(angular, window);

0 commit comments

Comments
 (0)