Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 86fbdf6

Browse files
committed
[FT] Remake demo and add build-doc task
1 parent ff1b829 commit 86fbdf6

File tree

4 files changed

+129
-39
lines changed

4 files changed

+129
-39
lines changed

demo/demo.html

Lines changed: 80 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,80 @@
1-
<!DOCTYPE html>
2-
<!--[if lt IE 7]>
3-
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
4-
<!--[if IE 7]>
5-
<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
6-
<!--[if IE 8]>
7-
<html class="no-js lt-ie9"> <![endif]-->
8-
<!--[if gt IE 8]><!-->
9-
<html class="no-js"> <!--<![endif]-->
10-
<head>
11-
<meta charset="utf-8">
12-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
13-
<title>AngularUI - Date Picker Demo</title>
14-
<base href=".."></base>
15-
<script type="text/javascript" src="components/ace-builds/src-min-noconflict/ace.js"></script>
16-
<script type="text/javascript" src="components/angular/angular.js"></script>
17-
<script type="text/javascript" src="ui-ace.js"></script>
18-
19-
<link rel="stylesheet" href="http://necolas.github.io/normalize.css/2.1.1/normalize.css">
20-
<link rel="stylesheet" href="demo/style.css"/>
21-
</head>
22-
<body ng-app="ui.ace">
23-
<div ui-ace>Hello</div>
24-
<div ui-ace>World</div>
25-
</body>
26-
</html>
1+
<style>
2+
.ace_editor_wrapper {
3+
position: relative;
4+
height: 200px
5+
}
6+
7+
.ace_editor {
8+
top: 0;
9+
bottom: 0;
10+
right: 0;
11+
left: 0;;
12+
}
13+
</style>
14+
<script>
15+
16+
$("#ace").hide();
17+
requirejs(
18+
{
19+
paths: {
20+
'ui.ace': "build/ui-ace.min"
21+
},
22+
shim: {
23+
'ui.ace': { deps: ['components/ace-builds/src-min-noconflict/ace.js'] }
24+
}
25+
},
26+
['ui.ace'],
27+
function () {
28+
29+
angular.module('doc.ui-ace', ['ui.ace', 'prettifyDirective'])
30+
.controller('AceCtrl', ['$scope', function ($scope) {
31+
$scope.aceModel = "Ace Hello World";
32+
}])
33+
;
34+
e$ = $("#ace");
35+
e$.removeAttr("ng-non-bindable");
36+
37+
angular.bootstrap(e$[0], ['doc.ui-ace']);
38+
e$.show();
39+
$("#ace-l").slideUp();
40+
41+
42+
}
43+
);
44+
</script>
45+
46+
<!-- Le loading
47+
================================================== -->
48+
49+
<div id="ace-l" class="loadingAnimation">
50+
<div class="bowl_ringG">
51+
<div class="ball_holderG">
52+
<div class="ballG">
53+
</div>
54+
</div>
55+
</div>
56+
</div>
57+
58+
<section id="ace" ng-non-bindable ng-controller="AceCtrl">
59+
60+
<div ui-ace ng-model="aceModel">Hello</div>
61+
<div ui-ace>World</div>
62+
63+
64+
<h3>How?</h3>
65+
<pre class="prettyprint">
66+
&lt;div ui-ace ng-model="aceModel"&gt;Hello&lt;/div&gt;
67+
&lt;div ui-ace&gt;World&lt;/div&gt;
68+
69+
&lt;style&gt;
70+
.ace_editor_wrapper { position : relative; height: 200px}
71+
72+
.ace_editor {
73+
top: 0;
74+
bottom: 0;
75+
right: 0;
76+
left: 0;;
77+
}
78+
&lt;/style&gt;
79+
</pre>
80+
</section>

demo/style.css

Lines changed: 0 additions & 9 deletions
This file was deleted.

gruntFile.js

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,36 @@ module.exports = function (grunt) {
22

33
grunt.loadNpmTasks('grunt-karma');
44
grunt.loadNpmTasks('grunt-contrib-jshint');
5+
grunt.loadNpmTasks('grunt-contrib-uglify');
6+
grunt.loadNpmTasks('grunt-contrib-copy');
57

68
// Default task.
79
grunt.registerTask('default', ['jshint', 'karma']);
810

9-
var testConfig = function(configFile, customOptions) {
10-
var options = { configFile: configFile, singleRun: true};
11-
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox'], reporters: ['dots'] };
11+
grunt.registerTask('build-doc', ['uglify', 'copy']);
12+
13+
var testConfig = function (configFile, customOptions) {
14+
var options = { configFile: configFile, singleRun: true };
15+
var travisOptions = process.env.TRAVIS && { browsers: [ 'Firefox', 'PhantomJS'], reporters: ['dots'] };
1216
return grunt.util._.extend(options, customOptions, travisOptions);
1317
};
1418

1519
// Project configuration.
1620
grunt.initConfig({
21+
pkg: grunt.file.readJSON('package.json'),
22+
meta: {
23+
banner: ['/**',
24+
' * <%= pkg.name %> - <%= pkg.description %>',
25+
' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>',
26+
' * @link <%= pkg.homepage %>',
27+
' * @license <%= pkg.license %>',
28+
' */',
29+
''].join('\n'),
30+
view : {
31+
humaName : "UI Ace",
32+
repoName : "ui-ace"
33+
}
34+
},
1735
karma: {
1836
unit: testConfig('test/karma.conf.js')
1937
},
@@ -31,6 +49,31 @@ module.exports = function (grunt) {
3149
eqnull:true,
3250
globals:{}
3351
}
52+
},
53+
uglify: {
54+
options: {banner: '<%= meta.banner %>'},
55+
build: {
56+
files: {
57+
'out/build/<%= meta.view.repoName %>.min.js': ['<%= meta.view.repoName %>.js']
58+
}
59+
}
60+
},
61+
copy: {
62+
main: {
63+
files: [
64+
{src: ['<%= meta.view.repoName %>.js'], dest: 'out/build/<%= meta.view.repoName %>.js', filter: 'isFile'},
65+
{src: ['demo/demo.html'], dest: 'out/demos.html', filter: 'isFile'},
66+
{src: ['components/ace-builds/src-min-noconflict/ace.js'], dest: 'out/components/ace-builds/src-min-noconflict/ace.js', filter: 'isFile'}
67+
]
68+
},
69+
template : {
70+
options : {processContent : function(content){
71+
return grunt.template.process(content);
72+
}},
73+
files: [
74+
{src: ['out/.tmpl/index.tmpl'], dest: 'out/index.html'}
75+
]
76+
}
3477
}
3578
});
3679

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"devDependencies": {
1111
"grunt": "~0.4.1",
1212
"grunt-karma": "~0.4.x",
13-
"grunt-contrib-jshint": "~0.2.0"
13+
"grunt-contrib-jshint": "~0.5.4",
14+
"grunt-contrib-uglify": "~0.2.1",
15+
"grunt-contrib-copy": "~0.4.1"
1416
},
1517
"scripts": {},
1618
"repository": {

0 commit comments

Comments
 (0)