Skip to content

Commit

Permalink
Merge pull request #372 from khoa-nd/master
Browse files Browse the repository at this point in the history
Merged
  • Loading branch information
khoa-nd committed Aug 26, 2015
2 parents 55f4bea + ca212c1 commit d9558a8
Show file tree
Hide file tree
Showing 16 changed files with 241 additions and 249 deletions.
Binary file modified src/main/webapp/assets/images/freelancers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ techlooper.config(["$routeProvider", "$translateProvider", "$authProvider", "loc
templateUrl: "modules/events/events.html",
controller: "eventsController"
})
.when("/event-details", {
.when("/event-details/:id", {
templateUrl: "modules/event-details/event-details.html",
controller: "eventDetailsController"
})
Expand All @@ -247,174 +247,13 @@ techlooper.config(["$routeProvider", "$translateProvider", "$authProvider", "loc
return "/home";
},
resolve: {
resolvedVal: function($http) {
resolvedVal: function ($http) {
return $http.get('http://endpoint.com/test');
}
}
});
}]);

techlooper.run(function (shortcutFactory, connectionFactory, loadingBoxFactory, cleanupFactory,
signInService, historyFactory, userService, routerService, $location,
utils, $rootScope, $translate, jsonValue, localStorageService, securityService,
apiService, resourcesService) {
shortcutFactory.initialize();
connectionFactory.initialize();
loadingBoxFactory.initialize();
cleanupFactory.initialize();
historyFactory.initialize();
routerService.initialize();
userService.initialize();
securityService.initialize();
//resourcesService.initialize();

$rootScope.apiService = apiService;
$rootScope.resourcesService = resourcesService;

var doTranslate = function () {
$translate(["newGradLevel", "experienced", "manager", "timeline", "numberOfJobs", "jobs", "isRequired", "exItSoftware", "ex149",
"salaryRangeJob", "jobNumber", "salaryRangeInJob", "jobNumberLabel", "allLevel", "newGradLevel", "exHoChiMinh", "exManager",
"experienced", "manager", "maximum5", "maximum3", "hasExist", "directorAndAbove", "requiredThisField",
"genderMale", "genderFemale", "exMale", "exYob", 'exDay', 'day', 'week', 'month', "maximum50", "whoJoinAndWhyEx"]).then(function (translate) {
$rootScope.translate = translate;
});
}

var campaign = $location.search();
var langKey = (campaign && campaign.lang);
langKey !== $translate.use() && ($translate.use(langKey));
$rootScope.$on('$translateChangeSuccess', function () {
langKey !== $translate.use() && ($translate.use(langKey));
doTranslate();
});

doTranslate();

$rootScope.jsonValue = jsonValue;

$('html, body').animate({scrollTop: 0});

//$rootScope.$on("$loginSuccess", function () {
// var protectedPage = localStorageService.get("protectedPage");
// if (protectedPage) {
// localStorageService.remove("protectedPage");
// return $location.url(protectedPage);
// }
// securityService.getCurrentUser();
//});

var param = $location.search();
if (!$.isEmptyObject(param)) {
switch (param.action) {
case "registerVnwUser":
localStorageService.set("lastName", param.lastName);
localStorageService.set("firstName", param.firstName);
localStorageService.set("email", param.email);
break;

//TODO route user to login by social
case "loginBySocial":
securityService.login(param.code, param.social, param.social);
break;

case "redirectJA":
window.location.href = param.targetUrl;
break;
}

//localStorageService.set("redirectUrl", $location.url());

//http://localhost:8080/#/salary-review?campaign=email&lang=en&id=MTQzOTUyNjczMDI4Ng==&utm_source=salaryreportemail&utm_medium=updatereportbutton&utm_campaign=sendmereport

//var lastFoot = localStorageService.get("lastFoot");
//console.log(lastFoot);
//localStorageService.remove("lastFoot");
//if (lastFoot && !param.utm_campaign) {
// if (lastFoot !== "/login" && lastFoot !== "/user-type") {
// return $location.url(lastFoot);
// }
//}
}

$rootScope.today = moment().format(jsonValue.dateFormat);



//$('body').click(function(e) {
// $rootScope.$broadcast("bodyClicked", e);
//});

//if (utils.getView() === jsonValue.views.userType) {
// utils.sendNotification(jsonValue.notifications.loading, $(window).height());
//}

});

techlooper.directive("navigation", function () {
return {
restrict: "A",
replace: true,
templateUrl: "modules/navigation/navigation.tem.html",
controller: "navigationController"
}
})
.directive("findjobs", function () {
return {
restrict: "A",
replace: true,
templateUrl: "modules/job/findJobs.tem.html"
}
})
.directive('onlyDigits', function ($filter) {
return {
require: 'ngModel',
restrict: 'A',
link: function (scope, element, attr, ctrl) {
function inputValue(val) {
if (val) {
var digits = val.replace(/[^0-9.]/g, '');
if (digits !== val) {
ctrl.$setViewValue(digits);
ctrl.$render();
}
var number = parseFloat(digits);
if (!isNaN(number)) {
//number = $filter('number')(number, 2);
//ctrl.$setViewValue(number);
//ctrl.$render();
return number;
}
return "";
}
return '';
}

ctrl.$parsers.push(inputValue);
}
}
})
.directive('onlyDigitsString', function () {
return {
require: 'ngModel',
restrict: 'A',
link: function (scope, element, attr, ctrl) {
function inputValue(val) {
if (val) {
var digits = val.replace(/[^0-9.]/g, '');

if (digits !== val) {
ctrl.$setViewValue(digits);
ctrl.$render();
}
var number = parseFloat(digits);
return isNaN(number) ? "" : val;

}
return '';
}

ctrl.$parsers.push(inputValue);
}
}
});

67 changes: 67 additions & 0 deletions src/main/webapp/assets/modules/_appDirective.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
techlooper.directive("navigation", function () {
return {
restrict: "A",
replace: true,
templateUrl: "modules/navigation/navigation.tem.html",
controller: "navigationController"
}
})
.directive("findjobs", function () {
return {
restrict: "A",
replace: true,
templateUrl: "modules/job/findJobs.tem.html"
}
})
.directive('onlyDigits', function ($filter) {
return {
require: 'ngModel',
restrict: 'A',
link: function (scope, element, attr, ctrl) {
function inputValue(val) {
if (val) {
var digits = val.replace(/[^0-9.]/g, '');
if (digits !== val) {
ctrl.$setViewValue(digits);
ctrl.$render();
}
var number = parseFloat(digits);
if (!isNaN(number)) {
//number = $filter('number')(number, 2);
//ctrl.$setViewValue(number);
//ctrl.$render();
return number;
}
return "";
}
return '';
}

ctrl.$parsers.push(inputValue);
}
}
})
.directive('onlyDigitsString', function () {
return {
require: 'ngModel',
restrict: 'A',
link: function (scope, element, attr, ctrl) {
function inputValue(val) {
if (val) {
var digits = val.replace(/[^0-9.]/g, '');

if (digits !== val) {
ctrl.$setViewValue(digits);
ctrl.$render();
}
var number = parseFloat(digits);
return isNaN(number) ? "" : val;

}
return '';
}

ctrl.$parsers.push(inputValue);
}
}
});
62 changes: 62 additions & 0 deletions src/main/webapp/assets/modules/_appStart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
techlooper.run(function (shortcutFactory, connectionFactory, loadingBoxFactory, cleanupFactory,
signInService, historyFactory, userService, routerService, $location,
utils, $rootScope, $translate, jsonValue, localStorageService, securityService,
apiService, resourcesService, seoService) {
shortcutFactory.initialize();
connectionFactory.initialize();
loadingBoxFactory.initialize();
cleanupFactory.initialize();
historyFactory.initialize();
routerService.initialize();
userService.initialize();
securityService.initialize();
seoService.initialize();

$rootScope.apiService = apiService;
$rootScope.resourcesService = resourcesService;

var doTranslate = function () {
$translate(["newGradLevel", "experienced", "manager", "timeline", "numberOfJobs", "jobs", "isRequired", "exItSoftware", "ex149",
"salaryRangeJob", "jobNumber", "salaryRangeInJob", "jobNumberLabel", "allLevel", "newGradLevel", "exHoChiMinh", "exManager",
"experienced", "manager", "maximum5", "maximum3", "hasExist", "directorAndAbove", "requiredThisField",
"genderMale", "genderFemale", "exMale", "exYob", 'exDay', 'day', 'week', 'month', "maximum50", "whoJoinAndWhyEx"]).then(function (translate) {
$rootScope.translate = translate;
});
}

var campaign = $location.search();
var langKey = (campaign && campaign.lang);
langKey !== $translate.use() && ($translate.use(langKey));
$rootScope.$on('$translateChangeSuccess', function () {
langKey !== $translate.use() && ($translate.use(langKey));
doTranslate();
});

doTranslate();

$rootScope.jsonValue = jsonValue;

$('html, body').animate({scrollTop: 0});

var param = $location.search();
if (!$.isEmptyObject(param)) {
switch (param.action) {
case "registerVnwUser":
localStorageService.set("lastName", param.lastName);
localStorageService.set("firstName", param.firstName);
localStorageService.set("email", param.email);
break;

//TODO route user to login by social
case "loginBySocial":
securityService.login(param.code, param.social, param.social);
break;

case "redirectJA":
window.location.href = param.targetUrl;
break;
}
}

$rootScope.today = moment().format(jsonValue.dateFormat);
});
6 changes: 6 additions & 0 deletions src/main/webapp/assets/modules/common/json.val.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ techlooper.factory("jsonValue", function () {
name: "userType",
url: "/user-type",
type: "LOGIN"
},
{
name: "eventDetails",
url: "/event-details",
regex: /\/event-details\//i,
type: "SEO"
}
],

Expand Down
27 changes: 27 additions & 0 deletions src/main/webapp/assets/modules/common/seoService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
techlooper.factory("seoService", function ($rootScope, utils) {

$rootScope.$on("$routeChangeStart", function (event, next, current) {
var uiView = utils.getUiView();
switch (uiView.type) {
case "SEO":
if (!next || !next.params) break;
var parts = next.params.id.split("-");
var lastPart = parts.pop();
if (parts.length < 2 || (lastPart !== "id")) {
return $location.path("/");
}

var id = parts.pop();
var title = parts.join("-");
if (utils.hasNonAsciiChar(title)) {
title = utils.toAscii(title);
event.preventDefault();
return $location.url(sprintf("%s/%s-%s-id", uiView.url, title, id));
}
}
});

return {
initialize: function () {}
}
});
16 changes: 8 additions & 8 deletions src/main/webapp/assets/modules/common/timestampFilter.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
techlooper.filter("timestamp", function (jsonValue) {
return function (input) {
return function (input, type) {
var date = input;

// ...
// Posted 23 hours ago
//Posted 1 day ago
//Posted x days ago
// ...
// Posted 7 days ago
//Posted on DD/MM/YYYY HH:MM
switch (type) {
case 'hour':
return moment(input, jsonValue.dateTimeFormat).format('h:mm A');

case 'shortDate':
return moment(input, jsonValue.dateFormat).format('ddd, DD MMMM');
}

var duration = Math.abs(moment(date).diff(moment(), "days"));
if (duration > 7) {
Expand Down
Loading

0 comments on commit d9558a8

Please sign in to comment.