Skip to content

Commit

Permalink
Merge pull request #368 from phuonghuynh/master
Browse files Browse the repository at this point in the history
Update changes
  • Loading branch information
phuonghuynh committed Aug 24, 2015
2 parents 2fe8682 + b54008f commit 25a029b
Show file tree
Hide file tree
Showing 26 changed files with 666 additions and 177 deletions.
12 changes: 8 additions & 4 deletions src/main/java/com/techlooper/controller/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,15 @@ public PersonalHomepageDto getPersonalHomepageDto() {
return personalHomepage;
}

@PreAuthorize("hasAnyAuthority('JOB_SEEKER')")
@PreAuthorize("hasAnyAuthority('JOB_SEEKER', 'EMPLOYER')")
@RequestMapping(value = "/user/current", method = RequestMethod.GET)
public UserProfileDto getUserProfile() {
UserProfileDto userProfile = (UserProfileDto) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return userProfile;
public UserProfileDto getUserProfile(HttpServletRequest request) {
Principal userPrincipal = request.getUserPrincipal();
Object principal = ((UsernamePasswordAuthenticationToken) userPrincipal).getPrincipal();
if (!(principal instanceof UserProfileDto)) {
return dozerMapper.map(userService.findVnwUserByUsername(request.getRemoteUser()), UserProfileDto.class);
}
return (UserProfileDto) principal;
}

@PreAuthorize("hasAnyAuthority('EMPLOYER')")
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/techlooper/entity/WebinarEntity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.techlooper.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.*;

import java.util.Date;
import java.util.Set;
Expand All @@ -17,20 +17,27 @@ public class WebinarEntity {

private String name;

@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "dd/MM/yyyy hh:mm a")
private String startDate;

@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "dd/MM/yyyy hh:mm a")
private String endDate;

private String description;

private Set<String> attendees;

@Field(index = FieldIndex.not_analyzed)
private String organiser;

@Field(index = FieldIndex.not_analyzed)
private String where = "Google Hangout";

@Field(index = FieldIndex.not_analyzed)
private String calendarUrl;


@Field(index = FieldIndex.not_analyzed)
private String hangoutLink;

private String whatEvent;
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/techlooper/model/UserProfileDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
public class UserProfileDto {

private String username;

private String name;

private String profileImageUrl;
Expand All @@ -19,6 +21,14 @@ public class UserProfileDto {

private RoleName roleName;

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public RoleName getRoleName() {
return roleName;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/local/techlooper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ web.baseUrl = http://localhost:8080/
usd2vnd = 21810

#value is one of [has-db, default]
spring.profiles.active = default
spring.profiles.active = has-db

jobAlert.period = 7
jobAlert.launchDate = 13/08/2015
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/assets/modules/all-events/all-events.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="abc">
sdvsdv
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
techlooper.controller("allEventsController", function ($scope) {

});
51 changes: 37 additions & 14 deletions src/main/webapp/assets/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,29 @@ techlooper.config(["$routeProvider", "$translateProvider", "$authProvider", "loc
templateUrl: "modules/create-event/create-event.html",
controller: "createEventController"
})
.when("/all-events", {
templateUrl: "modules/all-events/all-events.html",
controller: "allEventsController"
})
.when("/event-details", {
templateUrl: "modules/event-details/event-details.html",
controller: "eventDetailsController"
})
.otherwise({
redirectTo: function () {
redirectTo: function (err, path, params) {
if (!$.isEmptyObject(params)) {
return undefined;
}

if (window.location.host.indexOf("hiring") >= 0) {
return "/home";
}
return "/home";
},
resolve: {
resolvedVal: function($http) {
return $http.get('http://endpoint.com/test');
}
}
});
}]);
Expand Down Expand Up @@ -293,34 +310,40 @@ techlooper.run(function (shortcutFactory, connectionFactory, loadingBoxFactory,

//TODO route user to login by social
case "loginBySocial":
localStorageService.set("social", param.social);
localStorageService.set("code", param.code);
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");
localStorageService.remove("lastFoot");
if (lastFoot && !param.utm_campaign) {
if (lastFoot !== "/login" && lastFoot !== "/user-type") {
return $location.url(lastFoot);
}
//return $location.url(lastFoot);
}

//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());
}
//if (utils.getView() === jsonValue.views.userType) {
// utils.sendNotification(jsonValue.notifications.loading, $(window).height());
//}

});

techlooper.directive("navigation", function () {
Expand Down
15 changes: 8 additions & 7 deletions src/main/webapp/assets/modules/common/apiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ techlooper.factory("apiService", function ($rootScope, $location, jsonValue, $ht
* Get current login user info
* */
getCurrentUser: function (type) {
switch (type) {
case "social":
return $http.get("user/current");

default:
return $http.get("user/vnw-current");
}
//switch (type) {
// case "social":
// return $http.get("user/current");
//
// default:
// return $http.get("user/vnw-current");
//}
return $http.get("user/current");
},

logout: function () {
Expand Down
73 changes: 69 additions & 4 deletions src/main/webapp/assets/modules/common/json.val.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module("Common").constant("jsonValue", (function () {
techlooper.factory("jsonValue", function () {
var instance = {
pieChartType: {
salary: "SALARY",
Expand Down Expand Up @@ -219,9 +219,72 @@ angular.module("Common").constant("jsonValue", (function () {
userType: "userType",
howItWorks: "howItWorks",
jobListing: "jobListing",
createEvent: "createEvent"
createEvent: "createEvent",
allEvents: "allEvents",
eventDetails: "eventDetails"
},

uiViews: [
{
name: "rootPage",
url: "/"
},
{
name: "postEvent",
url: "/post-event",
roles: ["EMPLOYER", "JOB_SEEKER"],
loginUrl: "/user-type"
},
{
name: "freelancerPostProject",
url: "/freelancer/post-project",
roles: ["EMPLOYER"],
loginUrl: "/login"
},
{
name: "employerDashboard",
url: "/employer-dashboard",
roles: ["EMPLOYER"],
loginUrl: "/login"
},
{
name: "postChallenge",
url: "/post-challenge",
roles: ["EMPLOYER"],
loginUrl: "/login"
},
{
name: "hiring",
url: "/hiring",
header: "EMPLOYER"
},
{
name: "whyChallenge",
url: "/why-challenge",
header: "EMPLOYER"
},
{
name: "whyFreelancer",
url: "/freelancer/why-freelancer",
header: "EMPLOYER"
},
{
name: "priceJob",
url: "/price-job",
header: "EMPLOYER"
},
{
name: "login",
url: "/login",
type: "LOGIN"
},
{
name: "userType",
url: "/user-type",
type: "LOGIN"
}
],

httpUri: {
user: "user",
userSave: "user/save",
Expand All @@ -246,7 +309,9 @@ angular.module("Common").constant("jsonValue", (function () {
userType: "userType",
howItWorks: "howItWorks",
jobListing: "jobListing",
createEvent: "createEvent"
createEvent: "createEvent",
allEvents: "allEvents",
eventDetails: "eventDetails"
},

socketUri: {
Expand Down Expand Up @@ -907,4 +972,4 @@ angular.module("Common").constant("jsonValue", (function () {
instance.yobs = Array.apply(0, Array(84)).map(function (x, y) { return {value: currentYear - (y + 15)}; });

return instance;
})());
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ techlooper.directive("listInput", function () {
scope.listForm.$setSubmitted();
if (scope.listForm.$invalid) return;

if (scope.item === "") return;
if (!scope.item || scope.item.length == 0) return;

scope.ngModel.push(scope.item);

Expand Down
Loading

0 comments on commit 25a029b

Please sign in to comment.