From 7aa72351f3e3d5843fee229e4d59d1448f169da2 Mon Sep 17 00:00:00 2001 From: LCY Vincent Date: Sat, 20 Dec 2014 15:44:48 +0800 Subject: [PATCH 1/8] update gulpfile for deploy --- gulpfile.js | 48 +++++++++++++++++++++++++++++------------------- package.json | 3 ++- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 6a42099..eb49162 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,37 +8,47 @@ var livereload = require('gulp-livereload'); var concat = require('gulp-concat'); var less = require('gulp-less'); var bower = require('gulp-bower'); +var deploy = require('gulp-gh-pages'); server = lr(); gulp.task('bower', function() { - bower() - .pipe(gulp.dest('app/lib/')); + bower() + .pipe(gulp.dest('app/lib/')); }); gulp.task('build', ['bower'], function() { - gulp.src('less/*.less') - .pipe(less()) - .pipe(gulp.dest('app/css/')); + gulp.src('less/*.less') + .pipe(less()) + .pipe(gulp.dest('app/css/')); }); -gulp.task('default', ['bower','listen'], function() { - gulp.src('app/*') - .pipe(watch()) - .pipe(livereload(server)); +gulp.task('default', ['bower', 'listen'], function() { + gulp.src('app/*') + .pipe(watch()) + .pipe(livereload(server)); - gulp.src('less/*.less') - .pipe(watch()) - .pipe(less()) - .pipe(gulp.dest('app/css/')) - .pipe(livereload(server)); + gulp.src('less/*.less') + .pipe(watch()) + .pipe(less()) + .pipe(gulp.dest('app/css/')) + .pipe(livereload(server)); }); gulp.task('listen', function(next) { - server.listen(35729, function(err) { - if (err) return console.error(err); - next(); - }); -}); \ No newline at end of file + server.listen(35729, function(err) { + if (err) return console.error(err); + next(); + }); +}); + +var deployOptions = { + origin: "upstream" +}; + +gulp.task('deploy', function() { + return gulp.src('./dist/**/*') + .pipe(deploy(deployOptions)); +}); diff --git a/package.json b/package.json index db57619..83c5322 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "gulp-livereload": "~0.3.1", "gulp-concat": "2.1.*", "tiny-lr": "~0.0.5", - "gulp-bower": "0.0.2" + "gulp-bower": "0.0.2", + "gulp-gh-pages": "*" }, "bugs": { "url": "https://github.com/code4hk/site/issues" From 9616479b60277353d9a1d2cafa2183fccf82f453 Mon Sep 17 00:00:00 2001 From: LCY Vincent Date: Sat, 20 Dec 2014 16:23:12 +0800 Subject: [PATCH 2/8] add deploy flow --- .gitignore | 2 ++ app/index.html | 7 ++++--- gulpfile.js | 38 ++++++++++++++++++++++++++++++++++---- package.json | 4 +++- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index c4756cd..c3304c0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,7 @@ app/lib/ node_modules/ bower_components/ +dist/* + ## Vagrant .vagrant/ diff --git a/app/index.html b/app/index.html index 6dd4165..a9a8faa 100644 --- a/app/index.html +++ b/app/index.html @@ -17,7 +17,7 @@ Code for Hong Kong
- +

{{ 'Drive social changes by code' | t}}

@@ -48,7 +48,7 @@

{{ 'Open Gov' | t }}    {{'Civic hacking' | t }}    {{'O -
+
@@ -84,6 +84,7 @@

{{ 'Contacts' | t }}

+ @@ -94,13 +95,13 @@

{{ 'Contacts' | t }}

- + @@ -95,6 +52,7 @@

{{ 'Contacts' | t }}

+ @@ -117,6 +75,5 @@

{{ 'Contacts' | t }}

})(); - diff --git a/app/js/app.js b/app/js/app.js index fcf7936..841dfc9 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -2,72 +2,94 @@ // Declare app level module which depends on filters, and services angular.module('site', [ - 'ngRoute', - // 'ui.bootstrap', - 'site.filters', - 'site.services', - 'site.directives', - 'site.controllers', - 'jm.i18next' -]).config(['$routeProvider', - function($routeProvider) { - - } -]).filter('t',['$i18next',function(i18next){ - return function(input){ - return i18next(input); - } + 'ngRoute', + // 'ui.bootstrap', + 'site.filters', + 'site.services', + 'site.directives', + 'site.controllers', + 'jm.i18next' +]).config(['$routeProvider', '$locationProvider', + function($routeProvider, $locationProvider) { + $routeProvider + .when('/about', { + templateUrl: 'partials/about.html', + controller: 'AboutCtrl', + resolve: {} + }) + .when('/', { + templateUrl: 'partials/main.html', + controller: 'LandingCtrl', + resolve: {} + }) + .otherwise('/'); + $locationProvider.html5Mode(false); + } +]).filter('t', ['$i18next', function(i18next) { + return function(input) { + return i18next(input); + } }]); angular.module('jm.i18next') -.config(['$i18nextProvider',function ($i18nextProvider) { + .config(['$i18nextProvider', function($i18nextProvider) { $i18nextProvider.options = { - useCookie: false, - useLocalStorage: false, - load: 'current', - fallbackLng: 'zh-TW', - resGetPath: '../locales/__lng__/__ns__.json', - ns: { + useCookie: false, + useLocalStorage: false, + load: 'current', + fallbackLng: 'zh-TW', + resGetPath: '../locales/__lng__/__ns__.json', + ns: { namespaces: ['site_main'], defaultNs: 'site_main' } }; // http://localhost:8005/?setLng=en/ -}]); + }]); -angular.module('site.controllers', ["ngSanitize", "angular-lifestream"]). -controller('lifestreamCtrl', ['$scope', - function($scope) { +angular.module('site.controllers', ["ngSanitize", "angular-lifestream"]).controller( + 'lifestreamCtrl', ['$scope', + function($scope) { $scope.lifestreamConfig = { - theme: "lifestream-light-theme", - list: [{ - service: "github_org", - user: "code4hk", - }, { - service: "twitter", - user: "code4hk" - }, { - service: "facebook_page", - user: "code4hk" - }] + theme: "lifestream-light-theme", + list: [{ + service: "github_org", + user: "code4hk", + }, { + service: "twitter", + user: "code4hk" + }, { + service: "facebook_page", + user: "code4hk" + }] }; - } -]) -.controller('ScrollCtrl', ['$scope', '$location', '$anchorScroll', + } + ]) + .controller('LandingCtrl', ['$scope', '$location', '$anchorScroll', function($scope, $location, $anchorScroll) { - $scope.goTo = function(hash) { - console.log('hash=' + hash); - $location.hash(hash); - $anchorScroll(); - }; + $scope.goTo = function(hash) { + console.log('hash=' + hash); + $location.hash(hash); + $anchorScroll(); + }; + + } + ]) + .controller('ActivitiesCtrl', ['$scope', '$location', + function($scope, $location) { } -]); + ]) + .controller('AboutCtrl', ['$scope', '$location', + function($scope, $location) {} + ]); -angular.bootstrap(document, ["site"]); +angular.element(document).ready(function() { + angular.bootstrap(document, ["site"]); +}); diff --git a/app/locales/zh-TW/site_main.json b/app/locales/zh-TW/site_main.json index 513b037..fa9cba4 100644 --- a/app/locales/zh-TW/site_main.json +++ b/app/locales/zh-TW/site_main.json @@ -1,17 +1,17 @@ { - "language": "zh", - "We improve Hong Kong by coding": "用程式改變香港", - "Drive social changes by code":"用程式改變香港", - "Projects":"項目", - "Activities":"活動", - "Lifestream":"現在焦點", - "Blog": "部落格", - "Contacts": "聯絡我們", - "Open Gov":"開放政府", - "Civic hacking":"公民開發", - "Open Source":"開放源碼", - "Stay tuned by subscribing to our mailing list": "想知道我們第一手資訊?留下電郵地址!", - "email address" : "電郵地址", - "Our Blog" : "我們的部落格", - "Subscribe" : "留下" + "language": "zh", + "We improve Hong Kong by coding": "用程式改變香港", + "Drive social changes by code": "用程式改變香港", + "Projects": "項目", + "Activities": "活動", + "Lifestream": "最新動態", + "Blog": "部落格", + "Contacts": "聯絡我們", + "Open Gov": "開放政府", + "Civic hacking": "公民開發", + "Open Source": "開放源碼", + "Stay tuned by subscribing to our mailing list": "想知道我們第一手資訊?留下電郵地址!", + "email address": "電郵地址", + "Our Blog": "我們的部落格", + "Subscribe": "留下" } diff --git a/app/partials/about.html b/app/partials/about.html new file mode 100644 index 0000000..9247375 --- /dev/null +++ b/app/partials/about.html @@ -0,0 +1,8 @@ +

About

+

Manifesto:

+
+ +
+ + +

Curators:

diff --git a/app/partials/main.html b/app/partials/main.html new file mode 100644 index 0000000..c6f5ef2 --- /dev/null +++ b/app/partials/main.html @@ -0,0 +1,54 @@ +
+

{{ 'Open Gov' | t }}    {{'Civic hacking' | t }}    {{'Open Source' | t }}

+
+ +
+ +
+ +
+
+
+ +
+
+ {{ 'Activities' | t }} + + +
+
+ + +
+ +
+ +
+ + +
+ +

{{ 'Contacts' | t }}

+
    +
  • Facebook
  • +
  • Twitter
  • +
  • Email
  • +
+

{{'Curator Team'| t}}

+
diff --git a/app/partials/manifesto.html b/app/partials/manifesto.html new file mode 100644 index 0000000..f28d9a9 --- /dev/null +++ b/app/partials/manifesto.html @@ -0,0 +1,12 @@ +

Can be found in +https://github.com/code4hk/site

+
    +
  • S.1 Mission: +Drive social changes by code +Strengthen Hong Kong IT community as a whole +Motivate and facilitate Hong Kong IT community to do good to the society

    +
  • +
  • S.2 How to become a team of CODE4HK +Any team that compliant to the S.3 and show willingness to join the cause can become a team of CODE4HK. Every team of CODE4HK shall choose a Hong Kong street name as code name.

    +
  • +
diff --git a/app/partials/partial1.html b/app/partials/partial1.html deleted file mode 100644 index e35d528..0000000 --- a/app/partials/partial1.html +++ /dev/null @@ -1,4 +0,0 @@ -

This is the partial for view 1.

-

- Getting version from the scope: {{ scopedAppVersion }} -

diff --git a/bower.json b/bower.json index 48054ba..e6265d6 100755 --- a/bower.json +++ b/bower.json @@ -21,6 +21,6 @@ }, "resolutions": { - "angular": ">=1.2.14" + "angular": ">=1.3.9" } } diff --git a/gulpfile.js b/gulpfile.js index 1b6e63c..ea85ba8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,7 +11,7 @@ var bower = require('gulp-bower'); var deploy = require('gulp-gh-pages'); var minifyCss = require('gulp-minify-css'); var usemin = require('gulp-usemin'); - +var markdown = require('gulp-markdown'); server = lr(); var dist = 'dist'; @@ -30,6 +30,12 @@ var filesToMove = [ '!app/index.html', ]; +gulp.task('content', function() { + // markdown + gulp.src("app/contents/**/*") + .pipe(markdown()) + .pipe(gulp.dest("app/partials")); +}) gulp.task('usemin', function() { gulp.src(publicFolder + '/index.html') @@ -42,7 +48,7 @@ gulp.task('usemin', function() { }); -gulp.task('build', ['bower', 'usemin'], function() { +gulp.task('build', ['bower', 'usemin', 'content'], function() { gulp.src('less/*.less') .pipe(less()) @@ -53,7 +59,16 @@ gulp.task('build', ['bower', 'usemin'], function() { }); -gulp.task('default', ['bower', 'listen'], function() { + +// gulp.task('less', function() { +// gulp.src('less/*.less') +// .pipe(watch()) +// .pipe(less()) +// .pipe(gulp.dest('app/css/')) +// }); + + +gulp.task('default', ['bower', 'listen', 'content'], function() { gulp.src('app/*') .pipe(watch()) .pipe(livereload(server)); diff --git a/less/app.less b/less/app.less index c7a334f..3b57839 100644 --- a/less/app.less +++ b/less/app.less @@ -37,7 +37,7 @@ header { list-style:none; padding:0; li { - width:24%; + width:20%; display:inline-block; text-align: center; margin:0 auto; @@ -88,7 +88,7 @@ header { #mc_embed_signup .button {clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFFFFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;} #mc_embed_signup .button:hover {background-color:#777;} #mc_embed_signup .small-meta {font-size: 11px;} -#mc_embed_signup .nowrap {white-space:nowrap;} +#mc_embed_signup .nowrap {white-space:nowrap;} #mc_embed_signup .clear {clear:none; display:inline;} #mc_embed_signup label {display:block; font-size:16px; padding-bottom:10px; font-weight:bold;} @@ -135,7 +135,7 @@ footer { margin: 0 0 2em 0; } } - + [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; } diff --git a/package.json b/package.json index ac57f29..e593174 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "gulp-bower": "0.0.2", "gulp-gh-pages": "*", "gulp-minify-css": "*", - "gulp-usemin": "*" + "gulp-usemin": "*", + "gulp-markdown": "*" }, "bugs": { "url": "https://github.com/code4hk/site/issues"