Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
lots more stuff done
Browse files Browse the repository at this point in the history
  • Loading branch information
Joni-Aaltonen committed Jun 30, 2015
1 parent 65dc4dd commit 4b833dc
Show file tree
Hide file tree
Showing 16 changed files with 404 additions and 382 deletions.
4 changes: 3 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/angular-ui-select/dist/select.css" />
<!-- endbower -->
<link rel="stylesheet" href="bower_components/angular-worldskills-utils/src/spinner.css" />
<!-- endbuild -->
Expand Down Expand Up @@ -53,7 +54,7 @@
<li ng-hide='auth.loggedIn'><a ui-sref="signup">Sign Up</a></li>

<li ng-show='auth.loggedIn' class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown">
John Doe&nbsp;<span ng-show="user.data.inbox.total_count > 0" class="label label-danger label-xs">{{user.data.inbox.total_count}}</span>&nbsp;<b class="caret"></b>
{{user.data.first_name + " " + user.data.last_name}}&nbsp;<span ng-show="user.data.inbox.total_count > 0" class="label label-danger label-xs">{{user.data.inbox.total_count}}</span>&nbsp;<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a ui-sref-active='active' ui-sref='user.profile' href="#">Profile</a></li>
Expand Down Expand Up @@ -162,6 +163,7 @@
<script src="bower_components/angular-translate-storage-local/angular-translate-storage-local.js"></script>
<script src="bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js"></script>
<script src="bower_components/angular-worldskills-utils/src/angular-worldskills-utils.js"></script>
<script src="bower_components/angular-ui-select/dist/select.js"></script>
<!-- endbower -->
<!-- endbuild -->

Expand Down
1 change: 1 addition & 0 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ angular
'ngResource',
'ngRoute',
'ngSanitize',
'ui.select',
'ngTouch',
'ui.router',
'ui.bootstrap',
Expand Down
1 change: 0 additions & 1 deletion app/scripts/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ angular.module('connectApp')
$scope.loading = {};
$scope.userId = $state.params.userId;
$scope.myProfile = false;
$scope.editable = false;
$scope.profile = {};
$scope.connected = false;
$scope.connectedAndAccepted = false;
Expand Down
37 changes: 31 additions & 6 deletions app/scripts/controllers/userprofile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,35 @@
* Controller of the connectApp
*/
angular.module('connectApp')
.controller('UserProfileCtrl', function ($scope) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
.controller('UserProfileCtrl', function ($scope, User, WSAlert, $q) {

$scope.tmp_user = {};
$scope.countries = [
{"id":1,"abbreviation":"FI","name":{"lang_code":"en","text":"Finland"}},
{"id":2,"abbreviation":"AU","name":{"lang_code":"en","text":"Australia"}},
{"id":3,"abbreviation":"SE","name":{"lang_code":"en","text":"Sweden"}},
{"id":4,"abbreviation":"AT","name":{"lang_code":"en","text":"Austria"}},
{"id":5,"abbreviation":"CH","name":{"lang_code":"en","text":"Switzerland"}}
];

$scope.init = function(){
$q.when(User.data.promise).then(function(){
$scope.tmp_user = User.data;
});
};

$scope.init();

//edit
$scope.saveProfile = function(){
User.saveProfile().then(function(result){
console.log(result);
WSAlert.success("Profile information saved");
State.go('user.profile', {userId: $scope.userId});
},
function(error){
WSAlert.danger(error);
});
};

});
18 changes: 15 additions & 3 deletions app/scripts/services/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ angular.module('connectApp')

};

User.saveProfile = function(){
var deferred = $q.defer();

var postData = {

};
deferred.resolve(User.data);

return deferred.promise;
};


User.setAttendance = function(event, status){
var deferred = $q.defer();
Expand Down Expand Up @@ -202,11 +213,12 @@ angular.module('connectApp')
return connected;
};

User.connectionExists = function(uid){
var connected = false;

User.connectionExists = function(uid){
var deferred = $q.defer();

//if self
if(uid == User.data.id) deferred.reject();

$http.get(API_CONNECT + "/connections/user/" + User.data.id + "?include_pending=1").then(function(result){
//go through results
angular.forEach(result.data.connections, function(val, key){
Expand Down
4 changes: 2 additions & 2 deletions app/styles/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ li.active a {
fieldset{ margin-bottom: 3em; }
legend{ color: #003d56; }
.contentRow{ padding-bottom: .5em; }
.contentRow div:first-child{ text-align: right; font-weight: bold; color: #003d56; }
.contentRow div:first-child.checkbox{ text-align: left; font-weight: normal; color: #000; }
.contentRow > div:first-child{ text-align: right; font-weight: bold; color: #003d56; }
.contentRow > div:first-child.checkbox{ text-align: left; font-weight: normal; color: #000; }
/* copied FROM people */

a.eventLink > .thumbnail .caption{ font-size: 85%; font-weight: normal;}
Expand Down
2 changes: 1 addition & 1 deletion app/views/event.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h2>WorldSkills Sao Paulo 2015</h2>
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

<ws-spinner ng-show='loading.events'></ws-spinner>
<ws-spinner ng-show='loading.event'></ws-spinner>
<div class="btn-group" dropdown dropdown-append-to-body>
<button ng-class="{
'btn-success': user.data.subscriptions[eventId].status.id == STATUS.YES,
Expand Down
4 changes: 2 additions & 2 deletions app/views/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ <h2>What is WorldSkills Connect</h2>
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>&nbsp;</p>
<div class='text-center'>
<!-- <iframe class='video-intro' src="https://www.youtube.com/embed/4hfPE-O1IeM" frameborder="0" allowfullscreen></iframe> -->
<iframe class='video-intro' src="https://www.youtube.com/embed/4hfPE-O1IeM" frameborder="0" allowfullscreen></iframe>
</div>
<p>&nbsp;</p>
</div>

<div class='col-xs-12 col-sm-3 sidebar'>
<h4>Featured Events</h4>

<div class='featured-event' ng-repeat="i in [1, 2, 3] track by $index">
<div class='featured-event' ng-repeat="i in [1, 2] track by $index">
<!-- <div>WorldSkills Sao Paulo 2015</div>
<div class='featured-event-image'>
<a ui-sref="events"><img class='thumbnail' src='http://lorempixel.com/250/160/city/' alt='Sao Paulo 2015' /></a>
Expand Down
2 changes: 2 additions & 0 deletions app/views/signup.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<alerts/>
<div class='jumbotron'>
To be implemented</div>
<p>This is the signup view.</p>
2 changes: 1 addition & 1 deletion app/views/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<button ng-show="showActions" ng-click="reset();" class='btn btn-warning'>Reset</button> -->
<!-- //TODO if not own profile -->
<requestbtn></requestbtn>
<button ng-show='editable' class="btn btn-primary" ui-sref="user.edit({userId:userId})">Edit my profile<spinner ng-show="loading.request" class="ng-hide"></spinner></button>
<button ng-show='myProfile' class="btn btn-primary" ui-sref="user.edit({userId:userId})">Edit my profile<spinner ng-show="loading.request" class="ng-hide"></spinner></button>
</p>
</div>

Expand Down
42 changes: 0 additions & 42 deletions app/views/userinbox.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<fieldset><legend>Inbox - Received Connection Requests</legend>
{{loading.inbox}}
<ws-spinner class='bigSpinner' ng-show='loading.inbox'></ws-spinner>
<div ng-hide='loading.inbox' class="media media-inbox" ng-repeat="connection in user.data.inbox.connections">
<ws-spinner ng-show='loading.inboxItem[connection.id]'></ws-spinner>
Expand Down Expand Up @@ -42,45 +41,4 @@ <h4 class="media-heading"><a ui-sref='user.profile({userId:connection.from.id})'
</div>
</div>
</div>

<div class="media media-inbox" ng-repeat="i in [1, 2, 3, 4, 5] track by $index">
<div class='row'>
<div class='col-xs-12 col-sm-10'>
<div class="media-left media-top">
<a ui-sref='user.profile({userId:1})'><img class="media-object" src="http://lorempixel.com/120/120/people" alt="name"></a>
</div>
<div class="media-body">
<h4 class="media-heading"><a ui-sref='user.profile({userId:1})'>Joni Aaltonen</a></h4>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Company</strong>
</div>
<div class='col-xs-8 col-md-9 col-lg-10'>
WorldSkills International
</div>
</div>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Job Title</strong>
</div>
<div class='col-xs-8 col-md-9 col-lg-10'>
Senior Web Developer
</div>
</div>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Country</strong>
</div>
<div class='col-xs-8 col-md-9 col-lg-10'>
Finland
</div>
</div>
</div>
</div>
<div class='inboxActions col-xs-12 col-sm-2'>
<button class='fullWidth btn btn-success btn-sm'>Accept</button>
<button class='fullWidth btn btn-danger btn-sm'>Deny</button>
</div>
</div>
</div>
</fieldset>
53 changes: 50 additions & 3 deletions app/views/userprofileedit.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,52 @@
<fieldset>
<legend>Personal Information</legend>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Name</strong>
</div>
<div class='col-xs-3 col-md-4 col-lg-4'>
<input type='text' name='first' required placeholder="First" ng-model='tmp_user.first_name' class='form-control input-sm' />
</div>
<div class='col-xs-5 col-md-5 col-lg-6'>
<input type='text' name='last' required placeholder="Last" ng-model='tmp_user.last_name' class='form-control input-sm' />
</div>
</div>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Gender</strong>
</div>
<div class='col-xs-8 col-md-9 col-lg-10'>
<div class="radio-inline">
<label>
<input type="radio" name="gender" value="M"> Male
</label>
</div>
<div class="radio-inline">
<label>
<input type="radio" name="gender" value="F"> Female
</label>
</div>
</div>
</div>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Country</strong>
</div>
<div class='col-xs-8 col-md-9 col-lg-10'>

<ui-select ng-model="tmp_user.country" theme="bootstrap">
<ui-select-match placeholder="Select or search a country in the list...">{{$select.selected.name.text}} - {{$select.selected.abbreviation}}</ui-select-match>
<ui-select-choices repeat="country in countries | filter: $select.search">
<div ng-bind-html="country.name.text | highlight: $select.search"></div>
<small ng-bind-html="country.abbreviation | highlight: $select.search"></small>
</ui-select-choices>
</ui-select>
</div>
</div>
</fieldset>

<fieldset><legend>Description</legend>
<textarea name="description" ng-minlength='10' rows='5' required class="form-control" placeholder='Lorem ipsum, dolor sit amet...'></textarea>
<textarea ng-model="user.data.profile_description" name="description" ng-minlength='10' rows='5' required class="form-control" placeholder='Lorem ipsum, dolor sit amet...'></textarea>
</fieldset>

<fieldset>
Expand Down Expand Up @@ -47,8 +94,8 @@
<div class='row'>
<div class='xs-4 col-md-3 col-lg-2'></div>
<div class='col-xs-8 col-md-9 col-lg-10'>
<button class='btn btn-success btn-md'>Save profile</button>
<button class='btn btn-warning btn-md'>Cancel</button>
<button ng-click='saveProfile()' class='btn btn-success btn-md'>Save profile</button>
<button ui-sref='user.profile({userId:userId})' class='btn btn-warning btn-md'>Cancel</button>
</div>
</div>

Expand Down
41 changes: 0 additions & 41 deletions app/views/usersent.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,45 +42,4 @@ <h4 class="media-heading"><a ui-sref='user.profile({userId:connection.from.id})'
</div>
</div>
</div>
<hr />

<div class="media media-inbox" ng-repeat="i in [1, 2, 3, 4, 5] track by $index">
<div class='row'>
<div class='col-xs-12 col-sm-10'>
<div class="media-left media-top">
<a ui-sref='user.profile({userId:1})'><img class="media-object" src="http://lorempixel.com/120/120/people" alt="name"></a>
</div>
<div class="media-body media-middle">
<h4 class="media-heading"><a ui-sref='user.profile({userId:1})'>Joni Aaltonen</a></h4>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Company</strong>
</div>
<div class='col-xs-8 col-md-9 col-lg-10'>
WorldSkills International
</div>
</div>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Job Title</strong>
</div>
<div class='col-xs-8 col-md-9 col-lg-10'>
Senior Web Developer
</div>
</div>
<div class='row contentRow'>
<div class='col-xs-4 col-md-3 col-lg-2'>
<strong>Country</strong>
</div>
<div class='col-xs-8 col-md-9 col-lg-10'>
Finland
</div>
</div>
</div>
</div>
<div class='inboxActions col-xs-12 col-sm-2'>
<button class='fullWidth btn btn-warning btn-sm'>Cancel request</button>
</div>
</div>
</div>
</fieldset>
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"angular-translate-loader-url": "~2.7.2",
"angular-translate-storage-local": "~2.7.2",
"angular-translate-loader-static-files": "~2.7.2",
"angular-worldskills-utils": "~0.0.19"
"angular-worldskills-utils": "~0.0.19",
"angular-ui-select": "~0.12.0"
},
"devDependencies": {
"angular-mocks": "~1.4.1"
Expand Down
1 change: 1 addition & 0 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = function(config) {
'bower_components/angular-translate-storage-local/angular-translate-storage-local.js',
'bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js',
'bower_components/angular-worldskills-utils/src/angular-worldskills-utils.js',
'bower_components/angular-ui-select/dist/select.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
"app/scripts/**/*.js",
Expand Down
Loading

0 comments on commit 4b833dc

Please sign in to comment.