Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ local.properties
# PDT-specific
.buildpath

# sbteclipse plugin
# sbteclipse plugin
.target

# TeXlipse plugin
Expand Down Expand Up @@ -141,3 +141,8 @@ build/Release

# Destination folder
/www/

.idea

.idea/workspace.xml

88 changes: 68 additions & 20 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,16 @@ var gulp = require('gulp'),
spawn = require('child_process').spawn,
gutil = require('gulp-util');


/**
* Logs the error occured in the pipe without killing the gulp process
* emits an end event to the corresponding stream
* @function endErrorProcess
* @param {Error} err
*/
function endErrorProcess(err){
console.log(err);
this.emit('end');
}
/*================================================
= Report Errors to Console =
================================================*/
Expand All @@ -244,14 +253,16 @@ gulp.task('clean', function () {
path.join(config.dest, 'l10n'),
path.join(config.dest, 'app.manifest')
], { read: false })
.pipe(rimraf());
.pipe(rimraf())
.on('error', endErrorProcess);
});

gulp.task('clean:manifest', function () {
return gulp.src([
path.join(config.dest, 'app.manifest')
], { read: false })
.pipe(rimraf());
.pipe(rimraf())
.on('error', endErrorProcess);
});


Expand Down Expand Up @@ -279,7 +290,8 @@ gulp.task('connect', function() {

gulp.task('livereload', function () {
gulp.src(path.join(config.dest, '*.html'))
.pipe(connect.reload());
.pipe(connect.reload())
.on('error', endErrorProcess);
});


Expand All @@ -295,10 +307,12 @@ gulp.task('images', function () {
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngcrush()]
}));
}))
.on('error', endErrorProcess);
}

return stream.pipe(gulp.dest(path.join(config.dest, 'images')));
return stream.pipe(gulp.dest(path.join(config.dest, 'images')))
.on('error', endErrorProcess);
});


Expand All @@ -308,7 +322,8 @@ gulp.task('images', function () {

gulp.task('fonts', function() {
return gulp.src(config.vendor.fonts)
.pipe(gulp.dest(path.join(config.dest, 'fonts')));
.pipe(gulp.dest(path.join(config.dest, 'fonts')))
.on('error', endErrorProcess);
});

/*==================================
Expand All @@ -317,7 +332,8 @@ gulp.task('fonts', function() {

gulp.task('l10n', function() {
return gulp.src('src/l10n/**/*')
.pipe(gulp.dest(path.join(config.dest, 'l10n')));
.pipe(gulp.dest(path.join(config.dest, 'l10n')))
.on('error', endErrorProcess);
});


Expand Down Expand Up @@ -358,7 +374,9 @@ function buildHtml (env) {

return gulp.src(['src/html/**/*.html'])
.pipe(replace('<!-- inject:js -->', inject.join('\n ')))
.pipe(gulp.dest(config.dest));
.on('error', endErrorProcess)
.pipe(gulp.dest(config.dest))
.on('error', endErrorProcess);
}

gulp.task('html', function() {
Expand All @@ -377,10 +395,12 @@ gulp.task('html:production', function() {
gulp.task('sass', function () {
gulp.src('./src/sass/app.sass')
.pipe(sourcemaps.init())
.on('error', endErrorProcess)
.pipe(sass({
includePaths: [ path.resolve(__dirname, 'src/sass'), path.resolve(__dirname, 'bower_components'), path.resolve(__dirname, 'bower_components/bootstrap-sass/assets/stylesheets') ]
}).on('error', sass.logError))
.pipe(postcss([ autoprefixer({ browsers: ['last 2 versions', 'Android >= 4'] }) ]))
.on('error', endErrorProcess)
/* Currently not working with sourcemaps
.pipe(mobilizer('app.css', {
'app.css': {
Expand All @@ -394,11 +414,15 @@ gulp.task('sass', function () {
}))
*/
.pipe(gulpif(config.cssmin, cssmin()))
.on('error', endErrorProcess)
.pipe(rename({suffix: '.min'}))
.on('error', endErrorProcess)
.pipe(sourcemaps.write('.', {
sourceMappingURLPrefix: '/css/'
}))
.pipe(gulp.dest(path.join(config.dest, 'css')));
.on('error', endErrorProcess)
.pipe(gulp.dest(path.join(config.dest, 'css')))
.on('error', endErrorProcess);
});

/*====================================================================
Expand All @@ -408,7 +432,9 @@ gulp.task('sass', function () {
gulp.task('jshint', function() {
return gulp.src('./src/js/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
.on('error', endErrorProcess)
.pipe(jshint.reporter('jshint-stylish'))
.on('error', endErrorProcess);
});


Expand All @@ -422,44 +448,61 @@ gulp.task('js:app', function() {
return streamqueue({ objectMode: true },
// Vendor: angular, mobile-angular-ui, etc.
gulp.src(config.vendor.js)
.pipe(sourcemaps.init()),
.pipe(sourcemaps.init())
.on('error', endErrorProcess),
// app.js is configured
gulp.src('./src/js/app.js')
.pipe(sourcemaps.init())
.on('error', endErrorProcess)
.pipe(replace('value(\'config\', {}). // inject:app:config',
'value(\'config\', ' + JSON.stringify(config.app) + ').'))
.on('error', endErrorProcess)
.pipe(babel({
presets: ['es2015']
})),
}))
.on('error', endErrorProcess),
// rest of app logic
gulp.src(['./src/js/**/*.js', '!./src/js/app.js', '!./src/js/widgets.js'])
.pipe(sourcemaps.init())
.on('error', endErrorProcess)
.pipe(babel({
presets: ['es2015'],
plugins: ['transform-object-assign']
}))
.pipe(ngFilesort()),
.on('error', endErrorProcess)
.pipe(ngFilesort())
.on('error', endErrorProcess),
// app templates
gulp.src(['src/templates/**/*.html']).pipe(templateCache({ module: 'Teem' }))
.pipe(sourcemaps.init())
.on('error', endErrorProcess)
.pipe(babel({
presets: ['es2015']
}))
.on('error', endErrorProcess)
)
.pipe(concat('app.js'))
.on('error', endErrorProcess)
.pipe(ngAnnotate())
.on('error', endErrorProcess)
.pipe(gulpif(config.uglify, uglify()))
.on('error', endErrorProcess)
.pipe(rename({suffix: '.min'}))
.on('error', endErrorProcess)
.pipe(sourcemaps.write('.', {
sourceMappingURLPrefix: '/js/'
}))
.pipe(gulp.dest(path.join(config.dest, 'js')));
.on('error', endErrorProcess)
.pipe(gulp.dest(path.join(config.dest, 'js')))
.on('error', endErrorProcess);
});

gulp.task('js:widgets', function() {
return gulp.src('./src/js/widgets.js')
.pipe(uglify())
.pipe(gulp.dest(path.join(config.dest, 'js')));
.on('error', endErrorProcess)
.pipe(gulp.dest(path.join(config.dest, 'js')))
.on('error', endErrorProcess);
});


Expand All @@ -481,7 +524,8 @@ gulp.task('cordova:sync:clean', function() {

return gulp.src([dest],
{ read: false })
.pipe(rimraf());
.pipe(rimraf())
.on('error', endErrorProcess);


});
Expand All @@ -493,7 +537,8 @@ gulp.task('cordova:sync:copy', function() {


return gulp.src([ source + '{cordova.js,cordova_plugins.js,plugins/**/*}'])
.pipe(gulp.dest(dest));
.pipe(gulp.dest(dest))
.on('error', endErrorProcess);
});

gulp.task('cordova:sync', function(cb) {
Expand All @@ -503,7 +548,8 @@ gulp.task('cordova:sync', function(cb) {

gulp.task('cordova', function() {
return gulp.src('src/vendor/cordova/**/*')
.pipe(gulp.dest(path.join(config.dest, 'js/cordova')));
.pipe(gulp.dest(path.join(config.dest, 'js/cordova')))
.on('error', endErrorProcess);
});


Expand All @@ -530,7 +576,9 @@ function buildManifest (env) {
exclude: 'app.manifest',
hash: true
}))
.pipe(gulp.dest(config.dest));
.on('error', endErrorProcess)
.pipe(gulp.dest(config.dest))
.on('error', endErrorProcess);
}

gulp.task('manifest', function(){
Expand Down
35 changes: 25 additions & 10 deletions src/js/controllers/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ angular.module('Teem')
redirectTo: function(params) {
return '/teems/' + params.id + '?tab=' + params.tab;
}
})
.when('/trello/get/',{
controller: 'TrelloGetController',
template: '<h1>Redirecting ....</h1>'
});
}])
.controller('FetchProject', [
Expand Down Expand Up @@ -89,9 +93,9 @@ angular.module('Teem')
}])
.controller('ProjectCtrl', [
'SessionSvc', '$scope', '$rootScope', '$location', '$route', '$timeout', 'swellRT', '$filter',
'SharedState', 'ProjectsSvc', 'Loading', '$window', 'CommunitiesSvc', 'User', 'Selector', '$http', '$translate',
'SharedState', 'ProjectsSvc', 'Loading', '$window', 'CommunitiesSvc', 'User', 'Selector', '$http', '$translate','trelloSvc',
function (SessionSvc, $scope, $rootScope, $location, $route, $timeout, swellRT, $filter,
SharedState, ProjectsSvc, Loading, $window, CommunitiesSvc, User, Selector, $http, $translate) {
SharedState, ProjectsSvc, Loading, $window, CommunitiesSvc, User, Selector, $http, $translate, trelloSvc) {

// Prevent users from forging the form parameter
// and set the form order
Expand Down Expand Up @@ -255,7 +259,7 @@ angular.module('Teem')
$scope.pad.editing = false;
});

$scope.$on('$routeChangeStart', function(event, next, current) {
$scope.$on('$routeChangeStart', function(event, next, current) {
if (current.params.tab !== undefined && $scope.project!== undefined) {
$scope.project.setTimestampAccess(current.params.tab);
}
Expand All @@ -281,12 +285,12 @@ angular.module('Teem')

var lastChange = $scope.project.lastChange(section);
var lastAccess;
if ($scope.project.getTimestampAccess() &&
$scope.project.getTimestampAccess()[section]) {
lastAccess = new Date(($scope.project.getTimestampAccess()[section]).last);
} else {
lastAccess = new Date(0);
}
if ($scope.project.getTimestampAccess() &&
$scope.project.getTimestampAccess()[section]) {
lastAccess = new Date(($scope.project.getTimestampAccess()[section]).last);
} else {
lastAccess = new Date(0);
}
return lastChange > lastAccess;
};

Expand Down Expand Up @@ -361,7 +365,7 @@ angular.module('Teem')
url
}).then(function (response) {
angular.forEach(response.data.geonames, function(v) {
v.value = {
v.value = {
id: v.geonameId.toString(),
latitide: v.lat,
longitude: v.lng,
Expand Down Expand Up @@ -417,11 +421,22 @@ angular.module('Teem')

};

$scope.getToken = function () {
trelloSvc.getToken();
};

$scope.archiveProject = function() {
// TODO
};

}])
.controller('TrelloGetController', ['$location','ProjectsSvc','SessionSvc', function($location,ProjectsSvc,SessionSvc){
let token = $location.hash().split('=')[1];
localStorage.setItem('trelloTeemToken',token);
SessionSvc.onLoad(function(){
ProjectsSvc.updateTrello();
});
}])
.directive(
'hideTabs',
function (SharedState, $timeout) {
Expand Down
Loading