Commit 8cff6302a98ca85e85412cc52fc3df025cf00f3d

Authored by Leonardo Merlin
0 parents

Initial commit

Showing 62 changed files with 1504 additions and 0 deletions   Show diff stats
.bowerrc 0 → 100644
  1 +++ a/.bowerrc
... ... @@ -0,0 +1,3 @@
  1 +{
  2 + "directory": "bower_components"
  3 +}
... ...
.editorconfig 0 → 100644
  1 +++ a/.editorconfig
... ... @@ -0,0 +1,13 @@
  1 +# http://editorconfig.org
  2 +root = true
  3 +
  4 +[*]
  5 +indent_style = space
  6 +indent_size = 2
  7 +end_of_line = lf
  8 +charset = utf-8
  9 +trim_trailing_whitespace = true
  10 +insert_final_newline = true
  11 +
  12 +[*.md]
  13 +trim_trailing_whitespace = false
... ...
.gitignore 0 → 100644
  1 +++ a/.gitignore
... ... @@ -0,0 +1,6 @@
  1 +node_modules/
  2 +bower_components/
  3 +.sass-cache/
  4 +.idea/
  5 +.tmp/
  6 +dist/
... ...
.jshintrc 0 → 100644
  1 +++ a/.jshintrc
... ... @@ -0,0 +1,17 @@
  1 +{
  2 + "strict": true,
  3 + "bitwise": true,
  4 + "curly": true,
  5 + "eqeqeq": true,
  6 + "latedef": false,
  7 + "noarg": true,
  8 + "undef": true,
  9 + "unused": true,
  10 + "validthis": true,
  11 + "jasmine": true,
  12 + "globals": {
  13 + "angular": false,
  14 + "inject": false,
  15 + "module": false
  16 + }
  17 +}
... ...
.yo-rc.json 0 → 100644
  1 +++ a/.yo-rc.json
... ... @@ -0,0 +1,70 @@
  1 +{
  2 + "generator-gulp-angular": {
  3 + "version": "0.12.1",
  4 + "props": {
  5 + "angularVersion": "~1.4.0",
  6 + "angularModules": [
  7 + {
  8 + "key": "animate",
  9 + "module": "ngAnimate"
  10 + },
  11 + {
  12 + "key": "cookies",
  13 + "module": "ngCookies"
  14 + },
  15 + {
  16 + "key": "touch",
  17 + "module": "ngTouch"
  18 + },
  19 + {
  20 + "key": "sanitize",
  21 + "module": "ngSanitize"
  22 + }
  23 + ],
  24 + "jQuery": {
  25 + "key": "none"
  26 + },
  27 + "resource": {
  28 + "key": "restangular",
  29 + "module": "restangular"
  30 + },
  31 + "router": {
  32 + "key": "ui-router",
  33 + "module": "ui.router"
  34 + },
  35 + "ui": {
  36 + "key": "bootstrap",
  37 + "module": null
  38 + },
  39 + "bootstrapComponents": {
  40 + "key": "none",
  41 + "module": null
  42 + },
  43 + "cssPreprocessor": {
  44 + "key": "node-sass",
  45 + "extension": "scss"
  46 + },
  47 + "jsPreprocessor": {
  48 + "key": "none",
  49 + "extension": "js",
  50 + "srcExtension": "js"
  51 + },
  52 + "htmlPreprocessor": {
  53 + "key": "none",
  54 + "extension": "html"
  55 + },
  56 + "foundationComponents": {
  57 + "name": null,
  58 + "version": null,
  59 + "key": null,
  60 + "module": null
  61 + },
  62 + "paths": {
  63 + "src": "src",
  64 + "dist": "dist",
  65 + "e2e": "e2e",
  66 + "tmp": ".tmp"
  67 + }
  68 + }
  69 + }
  70 +}
0 71 \ No newline at end of file
... ...
README.md 0 → 100644
  1 +++ a/README.md
... ... @@ -0,0 +1,16 @@
  1 +# Dialoga App
  2 +
  3 +# Project Decisions
  4 +
  5 +- [generator-gulp-angular](https://github.com/Swiip/generator-gulp-angular)
  6 +- Angular
  7 + - angular-animate
  8 + - angular-cookies
  9 + - angular-touch
  10 + - angular-sanitize
  11 + - angular-ui-router
  12 + - restangular
  13 +- gulp (default task: serve)
  14 +- JS old style (no CoffeeScript or ES6 or ...)
  15 +- HTML pure (no JADE or HBS or ...)
  16 +- Bootstrap CSS only (without JS files)
... ...
bower.json 0 → 100644
  1 +++ a/bower.json
... ... @@ -0,0 +1,23 @@
  1 +{
  2 + "name": "dialoga",
  3 + "version": "0.0.0",
  4 + "dependencies": {
  5 + "angular-animate": "~1.4.0",
  6 + "angular-cookies": "~1.4.0",
  7 + "angular-touch": "~1.4.0",
  8 + "angular-sanitize": "~1.4.0",
  9 + "angular-ui-router": "~0.2.15",
  10 + "jquery": "~2.1.4",
  11 + "restangular": "~1.5.1",
  12 + "bootstrap-sass-official": "~3.3.4",
  13 + "animate.css": "~3.3.0",
  14 + "angular": "~1.4.0",
  15 + "modernizr": "~2.8.3"
  16 + },
  17 + "devDependencies": {
  18 + "angular-mocks": "~1.4.0"
  19 + },
  20 + "resolutions": {
  21 + "angular": "~1.4.0"
  22 + }
  23 +}
... ...
e2e/.jshintrc 0 → 100644
  1 +++ a/e2e/.jshintrc
... ... @@ -0,0 +1,10 @@
  1 +{
  2 + "extends": "../.jshintrc",
  3 + "globals": {
  4 + "browser": false,
  5 + "element": false,
  6 + "by": false,
  7 + "$": false,
  8 + "$$": false
  9 + }
  10 +}
... ...
e2e/main.po.js 0 → 100644
  1 +++ a/e2e/main.po.js
... ... @@ -0,0 +1,15 @@
  1 +/**
  2 + * This file uses the Page Object pattern to define the main page for tests
  3 + * https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
  4 + */
  5 +
  6 +'use strict';
  7 +
  8 +var MainPage = function() {
  9 + this.jumbEl = element(by.css('.jumbotron'));
  10 + this.h1El = this.jumbEl.element(by.css('h1'));
  11 + this.imgEl = this.jumbEl.element(by.css('img'));
  12 + this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in main.awesomeThings'));
  13 +};
  14 +
  15 +module.exports = new MainPage();
... ...
e2e/main.spec.js 0 → 100644
  1 +++ a/e2e/main.spec.js
... ... @@ -0,0 +1,21 @@
  1 +'use strict';
  2 +
  3 +describe('The main view', function () {
  4 + var page;
  5 +
  6 + beforeEach(function () {
  7 + browser.get('/index.html');
  8 + page = require('./main.po');
  9 + });
  10 +
  11 + it('should include jumbotron with correct data', function() {
  12 + expect(page.h1El.getText()).toBe('\'Allo, \'Allo!');
  13 + expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
  14 + expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
  15 + });
  16 +
  17 + it('should list more than 5 awesome things', function () {
  18 + expect(page.thumbnailEls.count()).toBeGreaterThan(5);
  19 + });
  20 +
  21 +});
... ...
gulp/.jshintrc 0 → 100644
  1 +++ a/gulp/.jshintrc
... ... @@ -0,0 +1,4 @@
  1 +{
  2 + "extends": "../.jshintrc",
  3 + "node": true
  4 +}
... ...
gulp/build.js 0 → 100644
  1 +++ a/gulp/build.js
... ... @@ -0,0 +1,94 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var gulp = require('gulp');
  5 +var conf = require('./conf');
  6 +
  7 +var $ = require('gulp-load-plugins')({
  8 + pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
  9 +});
  10 +
  11 +gulp.task('partials', function () {
  12 + return gulp.src([
  13 + path.join(conf.paths.src, '/app/**/*.html'),
  14 + path.join(conf.paths.tmp, '/serve/app/**/*.html')
  15 + ])
  16 + .pipe($.minifyHtml({
  17 + empty: true,
  18 + spare: true,
  19 + quotes: true
  20 + }))
  21 + .pipe($.angularTemplatecache('templateCacheHtml.js', {
  22 + module: 'dialoga',
  23 + root: 'app'
  24 + }))
  25 + .pipe(gulp.dest(conf.paths.tmp + '/partials/'));
  26 +});
  27 +
  28 +gulp.task('html', ['inject', 'partials'], function () {
  29 + var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), { read: false });
  30 + var partialsInjectOptions = {
  31 + starttag: '<!-- inject:partials -->',
  32 + ignorePath: path.join(conf.paths.tmp, '/partials'),
  33 + addRootSlash: false
  34 + };
  35 +
  36 + var htmlFilter = $.filter('*.html');
  37 + var jsFilter = $.filter('**/*.js');
  38 + var cssFilter = $.filter('**/*.css');
  39 + var assets;
  40 +
  41 + return gulp.src(path.join(conf.paths.tmp, '/serve/*.html'))
  42 + .pipe($.inject(partialsInjectFile, partialsInjectOptions))
  43 + .pipe(assets = $.useref.assets())
  44 + .pipe($.rev())
  45 + .pipe(jsFilter)
  46 + .pipe($.ngAnnotate())
  47 + .pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify'))
  48 + .pipe(jsFilter.restore())
  49 + .pipe(cssFilter)
  50 + .pipe($.replace('../../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/', '../fonts/'))
  51 + .pipe($.csso())
  52 + .pipe(cssFilter.restore())
  53 + .pipe(assets.restore())
  54 + .pipe($.useref())
  55 + .pipe($.revReplace())
  56 + .pipe(htmlFilter)
  57 + .pipe($.minifyHtml({
  58 + empty: true,
  59 + spare: true,
  60 + quotes: true,
  61 + conditionals: true
  62 + }))
  63 + .pipe(htmlFilter.restore())
  64 + .pipe(gulp.dest(path.join(conf.paths.dist, '/')))
  65 + .pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));
  66 +});
  67 +
  68 +// Only applies for fonts from bower dependencies
  69 +// Custom fonts are handled by the "other" task
  70 +gulp.task('fonts', function () {
  71 + return gulp.src($.mainBowerFiles())
  72 + .pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))
  73 + .pipe($.flatten())
  74 + .pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/')));
  75 +});
  76 +
  77 +gulp.task('other', function () {
  78 + var fileFilter = $.filter(function (file) {
  79 + return file.stat.isFile();
  80 + });
  81 +
  82 + return gulp.src([
  83 + path.join(conf.paths.src, '/**/*'),
  84 + path.join('!' + conf.paths.src, '/**/*.{html,css,js,scss}')
  85 + ])
  86 + .pipe(fileFilter)
  87 + .pipe(gulp.dest(path.join(conf.paths.dist, '/')));
  88 +});
  89 +
  90 +gulp.task('clean', function (done) {
  91 + $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')], done);
  92 +});
  93 +
  94 +gulp.task('build', ['html', 'fonts', 'other']);
... ...
gulp/conf.js 0 → 100644
  1 +++ a/gulp/conf.js
... ... @@ -0,0 +1,41 @@
  1 +/**
  2 + * This file contains the variables used in other gulp files
  3 + * which defines tasks
  4 + * By design, we only put there very generic config values
  5 + * which are used in several places to keep good readability
  6 + * of the tasks
  7 + */
  8 +
  9 +var gutil = require('gulp-util');
  10 +
  11 +/**
  12 + * The main paths of your project handle these with care
  13 + */
  14 +exports.paths = {
  15 + src: 'src',
  16 + dist: 'dist',
  17 + tmp: '.tmp',
  18 + e2e: 'e2e'
  19 +};
  20 +
  21 +/**
  22 + * Wiredep is the lib which inject bower dependencies in your project
  23 + * Mainly used to inject script tags in the index.html but also used
  24 + * to inject css preprocessor deps and js files in karma
  25 + */
  26 +exports.wiredep = {
  27 + exclude: [/jquery/, /bootstrap.js$/, /bootstrap-sass-official\/.*\.js/, /bootstrap\.css/],
  28 + directory: 'bower_components'
  29 +};
  30 +
  31 +/**
  32 + * Common implementation for an error handler of a Gulp plugin
  33 + */
  34 +exports.errorHandler = function(title) {
  35 + 'use strict';
  36 +
  37 + return function(err) {
  38 + gutil.log(gutil.colors.red('[' + title + ']'), err.toString());
  39 + this.emit('end');
  40 + };
  41 +};
... ...
gulp/e2e-tests.js 0 → 100644
  1 +++ a/gulp/e2e-tests.js
... ... @@ -0,0 +1,38 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var gulp = require('gulp');
  5 +var conf = require('./conf');
  6 +
  7 +var browserSync = require('browser-sync');
  8 +
  9 +var $ = require('gulp-load-plugins')();
  10 +
  11 +// Downloads the selenium webdriver
  12 +gulp.task('webdriver-update', $.protractor.webdriver_update);
  13 +
  14 +gulp.task('webdriver-standalone', $.protractor.webdriver_standalone);
  15 +
  16 +function runProtractor (done) {
  17 + var params = process.argv;
  18 + var args = params.length > 3 ? [params[3], params[4]] : [];
  19 +
  20 + gulp.src(path.join(conf.paths.e2e, '/**/*.js'))
  21 + .pipe($.protractor.protractor({
  22 + configFile: 'protractor.conf.js',
  23 + args: args
  24 + }))
  25 + .on('error', function (err) {
  26 + // Make sure failed tests cause gulp to exit non-zero
  27 + throw err;
  28 + })
  29 + .on('end', function () {
  30 + // Close browser sync server
  31 + browserSync.exit();
  32 + done();
  33 + });
  34 +}
  35 +
  36 +gulp.task('protractor', ['protractor:src']);
  37 +gulp.task('protractor:src', ['serve:e2e', 'webdriver-update'], runProtractor);
  38 +gulp.task('protractor:dist', ['serve:e2e-dist', 'webdriver-update'], runProtractor);
... ...
gulp/inject.js 0 → 100644
  1 +++ a/gulp/inject.js
... ... @@ -0,0 +1,36 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var gulp = require('gulp');
  5 +var conf = require('./conf');
  6 +
  7 +var $ = require('gulp-load-plugins')();
  8 +
  9 +var wiredep = require('wiredep').stream;
  10 +var _ = require('lodash');
  11 +
  12 +gulp.task('inject', ['scripts', 'styles'], function () {
  13 + var injectStyles = gulp.src([
  14 + path.join(conf.paths.tmp, '/serve/app/**/*.css'),
  15 + path.join('!' + conf.paths.tmp, '/serve/app/vendor.css')
  16 + ], { read: false });
  17 +
  18 + var injectScripts = gulp.src([
  19 + path.join(conf.paths.src, '/app/**/*.module.js'),
  20 + path.join(conf.paths.src, '/app/**/*.js'),
  21 + path.join('!' + conf.paths.src, '/app/**/*.spec.js'),
  22 + path.join('!' + conf.paths.src, '/app/**/*.mock.js')
  23 + ])
  24 + .pipe($.angularFilesort()).on('error', conf.errorHandler('AngularFilesort'));
  25 +
  26 + var injectOptions = {
  27 + ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve')],
  28 + addRootSlash: false
  29 + };
  30 +
  31 + return gulp.src(path.join(conf.paths.src, '/*.html'))
  32 + .pipe($.inject(injectStyles, injectOptions))
  33 + .pipe($.inject(injectScripts, injectOptions))
  34 + .pipe(wiredep(_.extend({}, conf.wiredep)))
  35 + .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve')));
  36 +});
... ...
gulp/scripts.js 0 → 100644
  1 +++ a/gulp/scripts.js
... ... @@ -0,0 +1,17 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var gulp = require('gulp');
  5 +var conf = require('./conf');
  6 +
  7 +var browserSync = require('browser-sync');
  8 +
  9 +var $ = require('gulp-load-plugins')();
  10 +
  11 +gulp.task('scripts', function () {
  12 + return gulp.src(path.join(conf.paths.src, '/app/**/*.js'))
  13 + .pipe($.jshint())
  14 + .pipe($.jshint.reporter('jshint-stylish'))
  15 + .pipe(browserSync.reload({ stream: true }))
  16 + .pipe($.size())
  17 +});
... ...
gulp/server.js 0 → 100644
  1 +++ a/gulp/server.js
... ... @@ -0,0 +1,63 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var gulp = require('gulp');
  5 +var conf = require('./conf');
  6 +
  7 +var browserSync = require('browser-sync');
  8 +var browserSyncSpa = require('browser-sync-spa');
  9 +
  10 +var util = require('util');
  11 +
  12 +var proxyMiddleware = require('http-proxy-middleware');
  13 +
  14 +function browserSyncInit(baseDir, browser) {
  15 + browser = browser === undefined ? 'default' : browser;
  16 +
  17 + var routes = null;
  18 + if(baseDir === conf.paths.src || (util.isArray(baseDir) && baseDir.indexOf(conf.paths.src) !== -1)) {
  19 + routes = {
  20 + '/bower_components': 'bower_components'
  21 + };
  22 + }
  23 +
  24 + var server = {
  25 + baseDir: baseDir,
  26 + routes: routes
  27 + };
  28 +
  29 + /*
  30 + * You can add a proxy to your backend by uncommenting the line bellow.
  31 + * You just have to configure a context which will we redirected and the target url.
  32 + * Example: $http.get('/users') requests will be automatically proxified.
  33 + *
  34 + * For more details and option, https://github.com/chimurai/http-proxy-middleware/blob/v0.0.5/README.md
  35 + */
  36 + // server.middleware = proxyMiddleware('/users', {target: 'http://jsonplaceholder.typicode.com', proxyHost: 'jsonplaceholder.typicode.com'});
  37 +
  38 + browserSync.instance = browserSync.init({
  39 + startPath: '/',
  40 + server: server,
  41 + browser: browser
  42 + });
  43 +}
  44 +
  45 +browserSync.use(browserSyncSpa({
  46 + selector: '[ng-app]'// Only needed for angular apps
  47 +}));
  48 +
  49 +gulp.task('serve', ['watch'], function () {
  50 + browserSyncInit([path.join(conf.paths.tmp, '/serve'), conf.paths.src]);
  51 +});
  52 +
  53 +gulp.task('serve:dist', ['build'], function () {
  54 + browserSyncInit(conf.paths.dist);
  55 +});
  56 +
  57 +gulp.task('serve:e2e', ['inject'], function () {
  58 + browserSyncInit([conf.paths.tmp + '/serve', conf.paths.src], []);
  59 +});
  60 +
  61 +gulp.task('serve:e2e-dist', ['build'], function () {
  62 + browserSyncInit(conf.paths.dist, []);
  63 +});
... ...
gulp/styles.js 0 → 100644
  1 +++ a/gulp/styles.js
... ... @@ -0,0 +1,46 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var gulp = require('gulp');
  5 +var conf = require('./conf');
  6 +
  7 +var browserSync = require('browser-sync');
  8 +
  9 +var $ = require('gulp-load-plugins')();
  10 +
  11 +var wiredep = require('wiredep').stream;
  12 +var _ = require('lodash');
  13 +
  14 +gulp.task('styles', function () {
  15 + var sassOptions = {
  16 + style: 'expanded'
  17 + };
  18 +
  19 + var injectFiles = gulp.src([
  20 + path.join(conf.paths.src, '/app/**/*.scss'),
  21 + path.join('!' + conf.paths.src, '/app/index.scss')
  22 + ], { read: false });
  23 +
  24 + var injectOptions = {
  25 + transform: function(filePath) {
  26 + filePath = filePath.replace(conf.paths.src + '/app/', '');
  27 + return '@import "' + filePath + '";';
  28 + },
  29 + starttag: '// injector',
  30 + endtag: '// endinjector',
  31 + addRootSlash: false
  32 + };
  33 +
  34 +
  35 + return gulp.src([
  36 + path.join(conf.paths.src, '/app/index.scss')
  37 + ])
  38 + .pipe($.inject(injectFiles, injectOptions))
  39 + .pipe(wiredep(_.extend({}, conf.wiredep)))
  40 + .pipe($.sourcemaps.init())
  41 + .pipe($.sass(sassOptions)).on('error', conf.errorHandler('Sass'))
  42 + .pipe($.autoprefixer()).on('error', conf.errorHandler('Autoprefixer'))
  43 + .pipe($.sourcemaps.write())
  44 + .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app/')))
  45 + .pipe(browserSync.reload({ stream: true }));
  46 +});
... ...
gulp/unit-tests.js 0 → 100644
  1 +++ a/gulp/unit-tests.js
... ... @@ -0,0 +1,25 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var gulp = require('gulp');
  5 +var conf = require('./conf');
  6 +
  7 +var karma = require('karma');
  8 +
  9 +function runTests (singleRun, done) {
  10 + karma.server.start({
  11 + configFile: path.join(__dirname, '/../karma.conf.js'),
  12 + singleRun: singleRun,
  13 + autoWatch: !singleRun
  14 + }, function() {
  15 + done();
  16 + });
  17 +}
  18 +
  19 +gulp.task('test', ['scripts'], function(done) {
  20 + runTests(true, done);
  21 +});
  22 +
  23 +gulp.task('test:auto', ['watch'], function(done) {
  24 + runTests(false, done);
  25 +});
... ...
gulp/watch.js 0 → 100644
  1 +++ a/gulp/watch.js
... ... @@ -0,0 +1,39 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var gulp = require('gulp');
  5 +var conf = require('./conf');
  6 +
  7 +var browserSync = require('browser-sync');
  8 +
  9 +function isOnlyChange(event) {
  10 + return event.type === 'changed';
  11 +}
  12 +
  13 +gulp.task('watch', ['inject'], function () {
  14 +
  15 + gulp.watch([path.join(conf.paths.src, '/*.html'), 'bower.json'], ['inject']);
  16 +
  17 + gulp.watch([
  18 + path.join(conf.paths.src, '/app/**/*.css'),
  19 + path.join(conf.paths.src, '/app/**/*.scss')
  20 + ], function(event) {
  21 + if(isOnlyChange(event)) {
  22 + gulp.start('styles');
  23 + } else {
  24 + gulp.start('inject');
  25 + }
  26 + });
  27 +
  28 + gulp.watch(path.join(conf.paths.src, '/app/**/*.js'), function(event) {
  29 + if(isOnlyChange(event)) {
  30 + gulp.start('scripts');
  31 + } else {
  32 + gulp.start('inject');
  33 + }
  34 + });
  35 +
  36 + gulp.watch(path.join(conf.paths.src, '/app/**/*.html'), function(event) {
  37 + browserSync.reload(event.path);
  38 + });
  39 +});
... ...
gulpfile.js 0 → 100644
  1 +++ a/gulpfile.js
... ... @@ -0,0 +1,30 @@
  1 +/**
  2 + * Welcome to your gulpfile!
  3 + * The gulp tasks are splitted in several files in the gulp directory
  4 + * because putting all here was really too long
  5 + */
  6 +
  7 +'use strict';
  8 +
  9 +var gulp = require('gulp');
  10 +var wrench = require('wrench');
  11 +
  12 +/**
  13 + * This will load all js or coffee files in the gulp directory
  14 + * in order to load all gulp tasks
  15 + */
  16 +wrench.readdirSyncRecursive('./gulp').filter(function(file) {
  17 + return (/\.(js|coffee)$/i).test(file);
  18 +}).map(function(file) {
  19 + require('./gulp/' + file);
  20 +});
  21 +
  22 +
  23 +/**
  24 + * Default task clean temporaries directories and launch the
  25 + * main optimization build task
  26 + */
  27 +gulp.task('default', ['clean'], function () {
  28 + // gulp.start('build');
  29 + gulp.start('serve');
  30 +});
... ...
karma.conf.js 0 → 100644
  1 +++ a/karma.conf.js
... ... @@ -0,0 +1,74 @@
  1 +'use strict';
  2 +
  3 +var path = require('path');
  4 +var conf = require('./gulp/conf');
  5 +
  6 +var _ = require('lodash');
  7 +var wiredep = require('wiredep');
  8 +
  9 +function listFiles() {
  10 + var wiredepOptions = _.extend({}, conf.wiredep, {
  11 + dependencies: true,
  12 + devDependencies: true
  13 + });
  14 +
  15 + return wiredep(wiredepOptions).js
  16 + .concat([
  17 + path.join(conf.paths.src, '/app/**/*.module.js'),
  18 + path.join(conf.paths.src, '/app/**/*.js'),
  19 + path.join(conf.paths.src, '/**/*.spec.js'),
  20 + path.join(conf.paths.src, '/**/*.mock.js'),
  21 + path.join(conf.paths.src, '/**/*.html')
  22 + ]);
  23 +}
  24 +
  25 +module.exports = function(config) {
  26 +
  27 + var configuration = {
  28 + files: listFiles(),
  29 +
  30 + singleRun: true,
  31 +
  32 + autoWatch: false,
  33 +
  34 + frameworks: ['jasmine', 'angular-filesort'],
  35 +
  36 + angularFilesort: {
  37 + whitelist: [path.join(conf.paths.src, '/**/!(*.html|*.spec|*.mock).js')]
  38 + },
  39 +
  40 + ngHtml2JsPreprocessor: {
  41 + stripPrefix: 'src/',
  42 + moduleName: 'dialoga'
  43 + },
  44 +
  45 + browsers : ['PhantomJS'],
  46 +
  47 + plugins : [
  48 + 'karma-phantomjs-launcher',
  49 + 'karma-angular-filesort',
  50 + 'karma-jasmine',
  51 + 'karma-ng-html2js-preprocessor'
  52 + ],
  53 +
  54 + preprocessors: {
  55 + 'src/**/*.html': ['ng-html2js']
  56 + }
  57 + };
  58 +
  59 + // This block is needed to execute Chrome on Travis
  60 + // If you ever plan to use Chrome and Travis, you can keep it
  61 + // If not, you can safely remove it
  62 + // https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076
  63 + if(configuration.browsers[0] === 'Chrome' && process.env.TRAVIS) {
  64 + configuration.customLaunchers = {
  65 + 'chrome-travis-ci': {
  66 + base: 'Chrome',
  67 + flags: ['--no-sandbox']
  68 + }
  69 + };
  70 + configuration.browsers = ['chrome-travis-ci'];
  71 + }
  72 +
  73 + config.set(configuration);
  74 +};
... ...
package.json 0 → 100644
  1 +++ a/package.json
... ... @@ -0,0 +1,55 @@
  1 +{
  2 + "name": "dialoga",
  3 + "version": "0.0.0",
  4 + "dependencies": {},
  5 + "scripts": {
  6 + "test": "gulp test"
  7 + },
  8 + "devDependencies": {
  9 + "gulp": "~3.9.0",
  10 + "gulp-autoprefixer": "~2.3.1",
  11 + "gulp-angular-templatecache": "~1.6.0",
  12 + "del": "~1.2.0",
  13 + "lodash": "~3.9.3",
  14 + "gulp-csso": "~1.0.0",
  15 + "gulp-filter": "~2.0.2",
  16 + "gulp-flatten": "~0.0.4",
  17 + "gulp-jshint": "~1.11.0",
  18 + "gulp-load-plugins": "~0.10.0",
  19 + "gulp-size": "~1.2.1",
  20 + "gulp-uglify": "~1.2.0",
  21 + "gulp-useref": "~1.2.0",
  22 + "gulp-util": "~3.0.5",
  23 + "gulp-ng-annotate": "~1.0.0",
  24 + "gulp-replace": "~0.5.3",
  25 + "gulp-rename": "~1.2.2",
  26 + "gulp-rev": "~5.0.0",
  27 + "gulp-rev-replace": "~0.4.2",
  28 + "gulp-minify-html": "~1.0.3",
  29 + "gulp-inject": "~1.3.1",
  30 + "gulp-protractor": "~1.0.0",
  31 + "gulp-sourcemaps": "~1.5.2",
  32 + "gulp-sass": "~2.0.1",
  33 + "gulp-angular-filesort": "~1.1.1",
  34 + "main-bower-files": "~2.8.0",
  35 + "merge-stream": "~0.1.7",
  36 + "jshint-stylish": "~2.0.0",
  37 + "wiredep": "~2.2.2",
  38 + "karma": "~0.12.36",
  39 + "karma-jasmine": "~0.3.5",
  40 + "karma-phantomjs-launcher": "~0.2.0",
  41 + "karma-angular-filesort": "~0.1.0",
  42 + "karma-ng-html2js-preprocessor": "~0.1.2",
  43 + "concat-stream": "~1.5.0",
  44 + "require-dir": "~0.3.0",
  45 + "browser-sync": "~2.7.12",
  46 + "browser-sync-spa": "~1.0.2",
  47 + "http-proxy-middleware": "~0.0.5",
  48 + "chalk": "~1.0.0",
  49 + "uglify-save-license": "~0.4.1",
  50 + "wrench": "~1.5.8"
  51 + },
  52 + "engines": {
  53 + "node": ">=0.10.0"
  54 + }
  55 +}
... ...
protractor.conf.js 0 → 100644
  1 +++ a/protractor.conf.js
... ... @@ -0,0 +1,27 @@
  1 +'use strict';
  2 +
  3 +var paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths;
  4 +
  5 +// An example configuration file.
  6 +exports.config = {
  7 + // The address of a running selenium server.
  8 + //seleniumAddress: 'http://localhost:4444/wd/hub',
  9 + //seleniumServerJar: deprecated, this should be set on node_modules/protractor/config.json
  10 +
  11 + // Capabilities to be passed to the webdriver instance.
  12 + capabilities: {
  13 + 'browserName': 'chrome'
  14 + },
  15 +
  16 + baseUrl: 'http://localhost:3000',
  17 +
  18 + // Spec patterns are relative to the current working directly when
  19 + // protractor is called.
  20 + specs: [paths.e2e + '/**/*.js'],
  21 +
  22 + // Options to be passed to Jasmine-node.
  23 + jasmineNodeOpts: {
  24 + showColors: true,
  25 + defaultTimeoutInterval: 30000
  26 + }
  27 +};
... ...
src/app/components/errorHandler/errorHandler.service.js 0 → 100644
  1 +++ a/src/app/components/errorHandler/errorHandler.service.js
... ... @@ -0,0 +1,20 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .service('ErrorService', ErrorService);
  7 +
  8 + /** @ngInject */
  9 + function ErrorService(){
  10 + var service = {
  11 + paramRequired: paramRequired
  12 + };
  13 +
  14 + return service;
  15 +
  16 + function paramRequired(paramName){
  17 + return 'param required: ' + paramName;
  18 + }
  19 + }
  20 +})();
... ...
src/app/components/navbar/navbar.directive.js 0 → 100644
  1 +++ a/src/app/components/navbar/navbar.directive.js
... ... @@ -0,0 +1,33 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .directive('appNavbar', appNavbar);
  7 +
  8 + /** @ngInject */
  9 + function appNavbar() {
  10 + var directive = {
  11 + restrict: 'E',
  12 + templateUrl: 'app/components/navbar/navbar.html',
  13 + scope: {
  14 + creationDate: '='
  15 + },
  16 + controller: NavbarController,
  17 + controllerAs: 'vm',
  18 + bindToController: true
  19 + };
  20 +
  21 + return directive;
  22 +
  23 + /** @ngInject */
  24 + function NavbarController($log) {
  25 + $log.debug('NavbarController');
  26 + // var vm = this;
  27 +
  28 + // "vm.creation" is avaible by directive option "bindToController: true"
  29 + // vm.relativeDate = moment(vm.creationDate).fromNow();
  30 + }
  31 + }
  32 +
  33 +})();
... ...
src/app/components/navbar/navbar.html 0 → 100644
  1 +++ a/src/app/components/navbar/navbar.html
... ... @@ -0,0 +1,24 @@
  1 +<nav class="navbar navbar-static-top">
  2 + <div class="container-fluid">
  3 + <div class="navbar-header">
  4 + <a class="navbar-brand" ui-sref="inicio">
  5 + <img src="/assets/images/logo.png" alt="Dialoga Brasil | O país fica melhor quando você participa" />
  6 + <!-- <span class="glyphicon glyphicon-home"></span> Início -->
  7 + </a>
  8 + </div>
  9 +
  10 + <div class="collapse navbar-collapse">
  11 + <ul class="nav navbar-nav">
  12 + <li><a ui-sref="sobre">Sobre</a></li>
  13 + <li><a ui-sref="programas">Programas</a></li>
  14 + <!-- <li><a ui-sref="ranking">Ranking</a></li> -->
  15 + <!-- <li><a ui-sref="duvidas">Dúvidas</a></li> -->
  16 + <!-- <li><a ui-sref="respostas">Respostas</a></li> -->
  17 + </ul>
  18 +
  19 + <ul class="nav navbar-nav navbar-right">
  20 + <li><a ui-sref="login"><span class="glyphicon glyphicon-user"></span> Entrar</a></li>
  21 + </ul>
  22 + </div>
  23 + </div>
  24 +</nav>
... ...
src/app/components/navbar/navbar.scss 0 → 100644
  1 +++ a/src/app/components/navbar/navbar.scss
... ... @@ -0,0 +1,8 @@
  1 +.navbar-brand {
  2 + height: auto;
  3 +}
  4 +
  5 +.navbar-nav > li > a {
  6 + padding-top: 30px;
  7 + padding-bottom: 30px;
  8 +}
... ...
src/app/components/programa/programa.directive.js 0 → 100644
  1 +++ a/src/app/components/programa/programa.directive.js
... ... @@ -0,0 +1,54 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .directive('programaBox', programaBox);
  7 +
  8 + /** @ngInject */
  9 + function programaBox(ProgramaService, $log) {
  10 +
  11 + /** @ngInject */
  12 + function ProgramaController() {
  13 + $log.debug('ProgramaController');
  14 +
  15 + var vm = this;
  16 +
  17 + $log.debug('this.programa', vm.programa);
  18 + vm.proposal = vm.programa;
  19 + }
  20 +
  21 + ProgramaController.prototype.getCategory = function () {
  22 + return this.proposal.categories[0];
  23 + };
  24 + ProgramaController.prototype.getCategoryName = function () {
  25 + return this.getCategory().name;
  26 + };
  27 +
  28 + ProgramaController.prototype.getImageUrl = function () {
  29 + return 'http://login.dialoga.gov.br/image_uploads/dialoga/0000/0053/requalif_redim.jpg';
  30 + };
  31 + ProgramaController.prototype.getImageAlt = function () {
  32 + return 'TODO: descrição da imagem.';
  33 + };
  34 +
  35 + ProgramaController.prototype.showContent = function () {
  36 + $log.debug('TODO: showContent()');
  37 + };
  38 +
  39 + var directive = {
  40 + restrict: 'E',
  41 + templateUrl: 'app/components/programa/programa.html',
  42 + scope: {
  43 + programa: '=programa'
  44 + },
  45 + controller: ProgramaController,
  46 + controllerAs: 'vm',
  47 + bindToController: true
  48 + };
  49 +
  50 +
  51 + return directive;
  52 + }
  53 +
  54 +})();
... ...
src/app/components/programa/programa.html 0 → 100644
  1 +++ a/src/app/components/programa/programa.html
... ... @@ -0,0 +1,6 @@
  1 +<div class="programa-box" ng-if="vm.proposal" ng-click="vm.showContent()">
  2 + <div class="category">{{::vm.getCategoryName()}}</div>
  3 + <div class="image-wrapper">
  4 + <image class="img-responsive" ng-src="{{::vm.getImageUrl()}}" alt="{{::vm.getImageAlt()}}" />
  5 + </div>
  6 +</div>
... ...
src/app/components/programa/programa.scss 0 → 100644
  1 +++ a/src/app/components/programa/programa.scss
... ... @@ -0,0 +1,32 @@
  1 +// Variables
  2 +$scale: 1.1;
  3 +$time: 0.3s;
  4 +
  5 +// sandbox
  6 +.programa-box {
  7 + cursor: pointer;
  8 +
  9 + .image-wrapper {
  10 + position: relative;
  11 + // width: 100%;
  12 + width: 370px;
  13 + // height: 170px;
  14 + background-color: red;
  15 + overflow: hidden;
  16 + text-align: center;
  17 + }
  18 +
  19 + .img-responsive {
  20 + -webkit-transition: all $time ease-in-out;
  21 + -moz-transition: all $time ease-in-out;
  22 + -o-transition: all $time ease-in-out;
  23 + transition: all $time ease-in-out;
  24 + }
  25 +
  26 + &:hover .img-responsive {
  27 + -webkit-transform: scale($scale); /* prefixo para browsers webkit */
  28 + -moz-transform: scale($scale); /* prefixo para browsers gecko */
  29 + -o-transform: scale($scale); /* prefixo para opera */
  30 + transform: scale($scale);
  31 + }
  32 +}
... ...
src/app/components/programa/programa.service.js 0 → 100644
  1 +++ a/src/app/components/programa/programa.service.js
... ... @@ -0,0 +1,129 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .factory('ProgramaService', ProgramaService);
  7 +
  8 + /** @ngInject */
  9 + function ProgramaService($http, $q, private_token, ErrorService, $log) {
  10 + var apiHost = 'http://login.dialoga.gov.br/api/v1';
  11 +
  12 + var endpoint = {
  13 + home: apiHost + '/articles/103358?private_token=null&fields=id,children,categories,abstract,title,image,url,setting,position',
  14 + articles: apiHost + '/articles?private_token=' + private_token + '&fields=id,children,created_by,categories,tag_list,abstract,setting,profile&content_type=ProposalsDiscussionPlugin::Proposal',
  15 + tasks: apiHost + '/task?private_token=' + private_token + '&fields=id,children,created_by,categories,tag_list,abstract,setting,profile&content_type=ProposalsDiscussionPlugin::Proposal'
  16 + };
  17 +
  18 + var service = {
  19 +
  20 + // mock
  21 + mockPrograma: mockPrograma,
  22 +
  23 + // api
  24 + getArticles: getArticles,
  25 + getProposal: getProposal
  26 + };
  27 +
  28 + return service;
  29 +
  30 + // ---
  31 + // PUBLIC METHODS
  32 + // ---
  33 +
  34 + /**
  35 + * Mock Data
  36 + * @return {Object} a new instance with dumb data;
  37 + */
  38 + function mockPrograma () {
  39 + return {
  40 + id: -1,
  41 + title: "Valorização dos Professores",
  42 + abstract: "<p>Caminho para uma educação de qualidade.</p>",
  43 + image: {url: "/image_uploads/dialoga/0000/0140/valorizacao_professor.jpg"},
  44 + categories: [{name: "[category]", id: -1, slug: "[category-slug]", image: null}],
  45 + author: '[author]',
  46 + position: -1, // ?
  47 + profile: { // ?
  48 + id: -1,
  49 + identifier: '[profile.identifier]',
  50 + name: '[profile.name]',
  51 + },
  52 + setting: { // ?
  53 + author_name: '[setting.author_name]',
  54 + comment_paragraph_plugin_activate: false
  55 + },
  56 + children: [], // ?
  57 + tag_list: []
  58 + };
  59 + }
  60 +
  61 + /**
  62 + * Get a list of articles
  63 + * @param {Number} limit per_page (default is 30)
  64 + * @return {Array} a list of articles
  65 + */
  66 + function getArticles (limit) {
  67 + if (!limit) {
  68 + limit = 30;
  69 + }
  70 +
  71 + return $http.get(endpoint.articles)
  72 + .then(handleSuccess)
  73 + .catch(handleError);
  74 + }
  75 +
  76 + /**
  77 + * Get a task by id
  78 + * @param {Number} id of task
  79 + * @return {Object} the wanted task or a new one.
  80 + */
  81 + function getProposal (id) {
  82 + if (!id) {
  83 + throw new Error(ErrorService.paramRequired('id'));
  84 + }
  85 +
  86 + return $http.get(endpoint.tasks)
  87 + .then(handleSuccess)
  88 + .catch(handleError);
  89 + }
  90 +
  91 + // ---
  92 + // PRIVATE METHODS
  93 + // ---
  94 +
  95 + /**
  96 + * Transform the successful response, unwrapping the application data
  97 + * from the API response payload.
  98 + *
  99 + * @param {Object} response from the server.
  100 + * @return {Object} the data unwrapped.
  101 + */
  102 + function handleSuccess (response){
  103 + return response.data;
  104 + }
  105 +
  106 + /**
  107 + * Transform the error response, unwrapping the application data from
  108 + * the API response payload.
  109 + *
  110 + * @param {Object} error from the server.
  111 + * @return {Promise} promise rejection called.
  112 + */
  113 + function handleError (error){
  114 +
  115 + $log.error('XHR Failed on ProgramaService.\n' + angular.toJson(error.data, true));
  116 +
  117 + // The API response from the server should be returned in a
  118 + // nomralized format. However, if the request was not handled by the
  119 + // server (or what not handles properly - ex. server error), then we
  120 + // may have to normalize it on our end, as best we can.
  121 + if ( !angular.isObject( error.data ) || !error.data.message) {
  122 + return( $q.reject( 'An unknown error occurred.' ) );
  123 + }
  124 +
  125 + // Otherwise, use expected error message.
  126 + return $q.reject(error.data.message);
  127 + }
  128 + }
  129 +})();
... ...
src/app/index.config.js 0 → 100644
  1 +++ a/src/app/index.config.js
... ... @@ -0,0 +1,16 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .config(config);
  7 +
  8 + /** @ngInject */
  9 + function config($logProvider) {
  10 + // Enable log
  11 + $logProvider.debugEnabled(true);
  12 +
  13 + // Set options third-party lib
  14 + }
  15 +
  16 +})();
... ...
src/app/index.constants.js 0 → 100644
  1 +++ a/src/app/index.constants.js
... ... @@ -0,0 +1,12 @@
  1 +/* global Modernizr:false */
  2 +(function() {
  3 + 'use strict';
  4 +
  5 + angular
  6 + .module('dialoga')
  7 + .constant('private_token', null)
  8 + .constant('Modernizr', Modernizr)
  9 + // .constant('key', value)
  10 + ;
  11 +
  12 +})();
... ...
src/app/index.module.js 0 → 100644
  1 +++ a/src/app/index.module.js
... ... @@ -0,0 +1,7 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'restangular', 'ui.router']);
  6 +
  7 +})();
... ...
src/app/index.route.js 0 → 100644
  1 +++ a/src/app/index.route.js
... ... @@ -0,0 +1,65 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .config(routeConfig);
  7 +
  8 + /** @ngInject */
  9 + function routeConfig($stateProvider, $urlRouterProvider) {
  10 + $stateProvider
  11 + .state('inicio', {
  12 + url: '/',
  13 + views: {
  14 + 'header': { templateUrl: 'app/partials/header/header.html' },
  15 + 'main': {
  16 + templateUrl: 'app/partials/inicio/inicio.html',
  17 + controller: 'InicioController',
  18 + controllerAs: 'inicio'
  19 + },
  20 + 'footer': { templateUrl: 'app/partials/footer/footer.html' }
  21 + }
  22 + })
  23 + .state('programas', {
  24 + url: '/programas',
  25 + views: {
  26 + 'header': { templateUrl: 'app/partials/header/header.html' },
  27 + 'main': {
  28 + templateUrl: 'app/partials/programas/programas.html',
  29 + controller: 'ProgramasController',
  30 + controllerAs: 'programas'
  31 + },
  32 + 'footer': { templateUrl: 'app/partials/footer/footer.html' }
  33 + }
  34 + })
  35 + .state('sobre', {
  36 + url: '/sobre',
  37 + views: {
  38 + 'header': { templateUrl: 'app/partials/header/header.html' },
  39 + 'main': {
  40 + templateUrl: 'app/partials/article/article.html',
  41 + controller: 'ArticleController',
  42 + controllerAs: 'article'
  43 + },
  44 + 'footer': { templateUrl: 'app/partials/footer/footer.html' }
  45 + }
  46 + })
  47 + .state('termos-de-uso', {
  48 + url: '/termos-de-uso',
  49 + controller: 'ArticleController',
  50 + views: {
  51 + 'header': { templateUrl: 'app/partials/header/header.html' },
  52 + 'main': {
  53 + templateUrl: 'app/partials/article/article.html',
  54 + controller: 'ArticleController',
  55 + controllerAs: 'article'
  56 + },
  57 + 'footer': { templateUrl: 'app/partials/footer/footer.html' }
  58 + }
  59 + })
  60 + ;
  61 +
  62 + $urlRouterProvider.otherwise('/');
  63 + }
  64 +
  65 +})();
... ...
src/app/index.run.js 0 → 100644
  1 +++ a/src/app/index.run.js
... ... @@ -0,0 +1,18 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .run(runBlock);
  7 +
  8 + /** @ngInject */
  9 + function runBlock($log) {
  10 +
  11 + $log.debug('runBlock end');
  12 +
  13 + window.skipToContent = function () {
  14 + console.log('TODO: skipToContent');
  15 + };
  16 + }
  17 +
  18 +})();
... ...
src/app/index.scss 0 → 100644
  1 +++ a/src/app/index.scss
... ... @@ -0,0 +1,41 @@
  1 +/**
  2 + * If you want to override some bootstrap variables, you have to change values here.
  3 + * The list of variables are listed here bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/_variables.scss
  4 + */
  5 +$navbar-inverse-link-color: #5AADBB;
  6 +$icon-font-path: "../../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/";
  7 +
  8 +/**
  9 + * Do not remove this comments bellow. It's the markers used by wiredep to inject
  10 + * sass dependencies when defined in the bower.json of your dependencies
  11 + */
  12 +// bower:scss
  13 +// endbower
  14 +
  15 +.browsehappy {
  16 + margin: 0.2em 0;
  17 + background: #ccc;
  18 + color: #000;
  19 + padding: 0.2em 0;
  20 +}
  21 +
  22 +$barra-theme: ("green": #00420c, "yellow": #2c66ce, "blue": #0042b1);
  23 +
  24 +.skip-links a:focus {
  25 + background-color: #fff !important;
  26 + opacity: 1;
  27 + z-index: 2;
  28 +}
  29 +
  30 +#footer-brasil {
  31 + background: none repeat scroll 0% 0% map-get($barra-theme, "blue");
  32 + padding: 1em 0px;
  33 + max-width: 100%;
  34 +}
  35 +
  36 +/**
  37 + * Do not remove this comments bellow. It's the markers used by gulp-inject to inject
  38 + * all your sass files automatically
  39 + */
  40 +// injector
  41 +// endinjector
... ...
src/app/partials/article/article.controller.js 0 → 100644
  1 +++ a/src/app/partials/article/article.controller.js
... ... @@ -0,0 +1,28 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .controller('ArticleController', ArticleController);
  7 +
  8 + /** @ngInject */
  9 + function ArticleController($state, $log) {
  10 + $log.debug('ArticleController');
  11 +
  12 + var vm = this;
  13 +
  14 + vm.page = $state.current.name;
  15 +
  16 + switch ( $state.current.name ) {
  17 + case 'sobre':
  18 + break;
  19 + case 'termos-de-uso':
  20 + break;
  21 + default:
  22 + $log.debug('$state.current.name', $state.current.name);
  23 + break;
  24 + }
  25 +
  26 + // page = $state.is('sobre');
  27 + }
  28 +})();
... ...
src/app/partials/article/article.controller.spec.js 0 → 100644
  1 +++ a/src/app/partials/article/article.controller.spec.js
... ... @@ -0,0 +1,15 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + describe('controllers', function(){
  5 +
  6 + beforeEach(module('dialoga'));
  7 +
  8 + // it('should define more than 5 awesome things', inject(function($controller) {
  9 + // var vm = $controller('SobreController');
  10 +
  11 + // // expect(angular.isArray(vm.awesomeThings)).toBeTruthy();
  12 + // // expect(vm.awesomeThings.length > 5).toBeTruthy();
  13 + // }));
  14 + });
  15 +})();
... ...
src/app/partials/article/article.html 0 → 100644
  1 +++ a/src/app/partials/article/article.html
... ... @@ -0,0 +1,5 @@
  1 +<article class="container" role="main">
  2 +
  3 + Artigo <span>{{article.page}}</span>
  4 +
  5 +</article>
... ...
src/app/partials/footer/footer.html 0 → 100644
  1 +++ a/src/app/partials/footer/footer.html
... ... @@ -0,0 +1,8 @@
  1 +<div class="container">
  2 + <div class="row">
  3 + <div class="col-xs-12 text-center">
  4 + <a ui-sref="termos-de-uso">Termos de uso</a>
  5 + </div>
  6 + </div>
  7 +</div>
  8 +<div id="footer-brasil"></div>
... ...
src/app/partials/header/header.controller.js 0 → 100644
  1 +++ a/src/app/partials/header/header.controller.js
... ... @@ -0,0 +1,39 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .controller('HeaderController', HeaderController);
  7 +
  8 + /** @ngInject */
  9 + function HeaderController($timeout, $log) {
  10 + $log.debug('HeaderController');
  11 +
  12 + this.$timeout = $timeout;
  13 + this.$log = $log;
  14 +
  15 + this.contrast = false;
  16 + }
  17 +
  18 + HeaderController.prototype.toggleContrast = function () {
  19 + this.contrast = !this.contrast;
  20 + console.debug('contrast', this.contrast);
  21 + };
  22 +
  23 + HeaderController.prototype.focusMainContent = function ($event) {
  24 +
  25 + // prevent skip link from redirecting
  26 + if ($event) { $event.preventDefault(); }
  27 +
  28 + var mainContentArea = document.querySelector("[role='main']");
  29 +
  30 + if ( mainContentArea ) {
  31 + this.$timeout(function(){
  32 + mainContentArea.focus();
  33 + },90);
  34 + }else{
  35 + this.$log.warn('role="main" not found.');
  36 + }
  37 + };
  38 +
  39 +})();
... ...
src/app/partials/header/header.html 0 → 100644
  1 +++ a/src/app/partials/header/header.html
... ... @@ -0,0 +1,18 @@
  1 +<header class="container" ng-controller="HeaderController as header">
  2 +
  3 + <div class="skip-links">
  4 + <a href="#content" class="sr-only" tabindex="0" ng-click="header.focusMainContent($event)">Ir para o conteúdo</a>
  5 + </div>
  6 +
  7 + <div class="row">
  8 + <div class="accessibility-wrapper">
  9 + <button type="button" id="display-contrast" class="btn btn-link" ng-click="header.toggleContrast()">
  10 + <span class="glyphicon glyphicon-adjust" aria-hidden="true"></span> Alto Contraste
  11 + </button>
  12 + </div>
  13 + </div>
  14 +
  15 + <div class="row">
  16 + <app-navbar></app-navbar>
  17 + </div>
  18 +</header>
... ...
src/app/partials/inicio/inicio.controller.js 0 → 100644
  1 +++ a/src/app/partials/inicio/inicio.controller.js
... ... @@ -0,0 +1,25 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .controller('InicioController', InicioController);
  7 +
  8 + /** @ngInject */
  9 + function InicioController($log) {
  10 + $log.debug('InicioController');
  11 + // var vm = this;
  12 +
  13 + // vm.awesomeThings = [];
  14 + // vm.classAnimation = '';
  15 + // vm.creationDate = 1438689506090;
  16 +
  17 + // activate();
  18 +
  19 + // function activate() {
  20 + // $timeout(function() {
  21 + // vm.classAnimation = 'rubberBand';
  22 + // }, 4000);
  23 + // }
  24 + }
  25 +})();
... ...
src/app/partials/inicio/inicio.controller.spec.js 0 → 100644
  1 +++ a/src/app/partials/inicio/inicio.controller.spec.js
... ... @@ -0,0 +1,15 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + describe('controllers', function(){
  5 +
  6 + beforeEach(module('dialoga'));
  7 +
  8 + // it('should define more than 5 awesome things', inject(function($controller) {
  9 + // var vm = $controller('InicioController');
  10 +
  11 + // expect(angular.isArray(vm.awesomeThings)).toBeTruthy();
  12 + // expect(vm.awesomeThings.length > 5).toBeTruthy();
  13 + // }));
  14 + });
  15 +})();
... ...
src/app/partials/inicio/inicio.html 0 → 100644
  1 +++ a/src/app/partials/inicio/inicio.html
... ... @@ -0,0 +1,3 @@
  1 +<div class="container">
  2 + Início
  3 +</div>
... ...
src/app/partials/programas/programas.controller.js 0 → 100644
  1 +++ a/src/app/partials/programas/programas.controller.js
... ... @@ -0,0 +1,19 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .controller('ProgramasController', ProgramasController);
  7 +
  8 + /** @ngInject */
  9 + function ProgramasController(ProgramaService, $log) {
  10 + $log.debug('ProgramasController');
  11 +
  12 + var vm = this;
  13 +
  14 + vm.programaList = [
  15 + ProgramaService.mockPrograma(),
  16 + ProgramaService.mockPrograma()
  17 + ];
  18 + }
  19 +})();
... ...
src/app/partials/programas/programas.controller.spec.js 0 → 100644
  1 +++ a/src/app/partials/programas/programas.controller.spec.js
... ... @@ -0,0 +1,15 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + describe('controllers', function(){
  5 +
  6 + beforeEach(module('dialoga'));
  7 +
  8 + // it('should define more than 5 awesome things', inject(function($controller) {
  9 + // var vm = $controller('SobreController');
  10 +
  11 + // // expect(angular.isArray(vm.awesomeThings)).toBeTruthy();
  12 + // // expect(vm.awesomeThings.length > 5).toBeTruthy();
  13 + // }));
  14 + });
  15 +})();
... ...
src/app/partials/programas/programas.html 0 → 100644
  1 +++ a/src/app/partials/programas/programas.html
... ... @@ -0,0 +1,8 @@
  1 +<div class="container">
  2 +
  3 + <h1>Programas:</h1>
  4 + <div ng-repeat="programa in programas.programaList">
  5 + <programa-box programa="programa"></programa-box>
  6 + </div>
  7 +
  8 +</div>
... ...
src/assets/images/angular.png 0 → 100644

13.2 KB

src/assets/images/bootstrap.png 0 → 100644

12.6 KB

src/assets/images/browsersync.png 0 → 100644

11.3 KB

src/assets/images/gulp.png 0 → 100644

10.4 KB

src/assets/images/jasmine.png 0 → 100644

15.5 KB

src/assets/images/karma.png 0 → 100644

9.89 KB

src/assets/images/logo.png 0 → 100644

23 KB

src/assets/images/node-sass.png 0 → 100644

4.85 KB

src/assets/images/protractor.png 0 → 100644

9.95 KB

src/assets/images/yeoman.png 0 → 100644

13.2 KB

src/favicon.ico 0 → 100644
No preview for this file type
src/index.html 0 → 100644
  1 +++ a/src/index.html
... ... @@ -0,0 +1,58 @@
  1 +<!doctype html>
  2 +<!--[if lt IE 7]> <html lang="pt-br" ng-app="dialoga" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
  3 +<!--[if IE 7]> <html lang="pt-br" ng-app="dialoga" class="no-js lt-ie9 lt-ie8"> <![endif]-->
  4 +<!--[if IE 8]> <html lang="pt-br" ng-app="dialoga" class="no-js lt-ie9"> <![endif]-->
  5 +<!--[if gt IE 8]><!--> <html class="no-js" lang="pt-br" ng-app="dialoga"> <!--<![endif]-->
  6 + <head>
  7 + <meta charset="utf-8">
  8 + <title>dialoga</title>
  9 + <meta name="description" content="">
  10 + <meta name="viewport" content="width=device-width">
  11 + <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
  12 +
  13 + <!-- build:css({.tmp/serve,src}) styles/vendor.css -->
  14 + <!-- bower:css -->
  15 + <!-- run `gulp inject` to automatically populate bower styles dependencies -->
  16 + <!-- endbower -->
  17 + <!-- endbuild -->
  18 +
  19 + <!-- build:css({.tmp/serve,src}) styles/app.css -->
  20 + <!-- inject:css -->
  21 + <!-- css files will be automatically insert here -->
  22 + <!-- endinject -->
  23 + <!-- endbuild -->
  24 + </head>
  25 + <body ng-cloak>
  26 + <div id="barra-brasil" style="background:#7F7F7F; height: 20px; padding:0 0 0 10px;display:block;">
  27 + <ul id="menu-barra-temp" style="list-style:none;">
  28 + <li style="display:inline; float:left;padding-right:10px; margin-right:10px; border-right:1px solid #EDEDED"><a href="http://brasil.gov.br" style="font-family:sans,sans-serif; text-decoration:none; color:white;">Portal do Governo Brasileiro</a></li>
  29 + <li><a style="font-family:sans,sans-serif; text-decoration:none; color:white;" href="http://epwg.governoeletronico.gov.br/barra/atualize.html">Atualize sua Barra de Governo</a></li>
  30 + </ul>
  31 + </div>
  32 +
  33 + <!--[if lt IE 9]>
  34 + <p class="browsehappy">Você está usando um navegador <strong>antigo</strong>. Por favor, <a href="http://browsehappy.com/">atualize o navegador</a> para melhorar a experiência de uso.</p>
  35 + <![endif]-->
  36 +
  37 + <div ui-view="header"></div>
  38 + <div id="content" ui-view="main"></div>
  39 + <div ui-view="footer"></div>
  40 +
  41 + <!-- build:js(src) scripts/vendor.js -->
  42 + <!-- bower:js -->
  43 + <!-- run `gulp inject` to automatically populate bower script dependencies -->
  44 + <!-- endbower -->
  45 + <!-- endbuild -->
  46 +
  47 + <!-- build:js({.tmp/serve,.tmp/partials,src}) scripts/app.js -->
  48 + <!-- inject:js -->
  49 + <!-- js files will be automatically insert here -->
  50 + <!-- endinject -->
  51 +
  52 + <!-- inject:partials -->
  53 + <!-- angular templates will be automatically converted in js and inserted here -->
  54 + <!-- endinject -->
  55 + <!-- endbuild -->
  56 + <script defer="defer" src="//barra.brasil.gov.br/barra.js" type="text/javascript"></script>
  57 + </body>
  58 +</html>
... ...