Merge pull request #38 from sagidayan/UI

Ui
This commit is contained in:
Sagi Dayan 2015-06-16 20:33:51 +03:00
commit e7be15b692
4 changed files with 64 additions and 41 deletions

View file

@ -147,9 +147,9 @@ body.noscroll
.createCampus .createCampus
{ {
position:relative; position:relative;
/*float:right;*/
} }
/*div.img campusAvatar /*div.img campusAvatar
{ {
border: 1px solid #0000ff; border: 1px solid #0000ff;

View file

@ -6,5 +6,4 @@ angular.module('SeHub')
{ {
}]); }]);

View file

@ -76,37 +76,69 @@ angular.module('SeHub')
}; };
$scope.lecturer = function(ev) $scope.createCampus = function(ev)
{ {
console.log("inside");
$scope.createCampusClicked = true; $scope.createCampusClicked = true;
if(!$scope.isLecturer) // if i am a lecturer (when pressing -> getting last data value before pressing) = "!isLecturer" it means => I Am Lecturer if(!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing)
{ {
// var jsonCreateCampus = if($scope.user.campusSuffixMail != null)
// {
// "title": "Create Campus",
// "email": "email_ending",
// "avatar": "self.avatar.url"
// }
console.log("YES lecturer " + $scope.jsonCreateCampus.title);
if($scope.user.lecAcMail != null)
{ {
apiService.sendValidationMail($scope.user.seToken, $scope.user.lecAcMail).success(function(data) validateEmail($scope.user.campusSuffixMail);
{
console.log("DONE - 200");
$mdDialog.show($mdDialog.alert().title('E-mail Verification').content('A verification e-mail has been sent to your email address.')
.ariaLabel('Email verification alert dialog').ok('Got it!').targetEvent(ev)); // Pop-up alert for e-mail verification
// TODO ADD delete cookies and redirect only after pressed 'Got it'
$cookieStore.remove("com.sehub.www"); // Removing the cookies
$window.location.href = 'http://se-hub.appspot.com'; // Reference to 'welcome' page
}).error(function()
{
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address or in the campus name.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
});
} }
} }
} }
validateEmail = function(email) // TODO ADD IT
{
var result = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
console.log("Email: " + email);
if (!result.test(email))
{
console.log(email + ", Error in email, should alert");
alert('Please provide a valid e-mail address');
}
if(result.test(email))
{
console.log("Im good");
apiService.sendValidationMail($scope.user.seToken, email).success(function(data)
{
console.log("DONE - 200");
$mdDialog.show($mdDialog.alert().title('E-mail Verification').content('A verification e-mail has been sent to your email address.')
.ariaLabel('Email verification alert dialog').ok('Got it!').targetEvent(email)); // Pop-up alert for e-mail verification
// TODO ADD delete cookies and redirect only after pressed 'Got it'
$cookieStore.remove("com.sehub.www"); // Removing the cookies
$window.location.href = 'http://se-hub.appspot.com'; // Reference to 'welcome' page
}).error(function()
{
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address or in the campus name.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(email));
});
}
}
// TODO FOR LATER - toast
// TODO FOR LATER
// $scope.getPopWindowPosition = function()
// {
// return Object.keys($scope.toastPosition).filter(function(pos)
// {
// return $scope.toastPosition[pos];
// }).join(' ');
// };
// $scope.toastPosition =
// {
// bottom: false,
// top: true,
// left: false,
// right: true
// };
// TODO FOR LATER
// TODO FOR LATER
}]); }]);

View file

@ -25,19 +25,19 @@
<div> <div>
<div ng-if="user.isLecturer"> <div ng-if="user.isLecturer">
<div> <div>
<md-button ng-click = "lecturer($event)" ng-model="jsonCreateCampus" class="md-raised">Create Campus</md-button> <md-button ng-click = "createCampus($event)" ng-model="jsonCreateCampus" class="md-raised">Create Campus</md-button>
<div class = "createCampus" ng-if="createCampusClicked"> <div class = "createCampus" ng-if="createCampusClicked">
<md-input-container> <md-input-container>
<label>Academic Lecturer Email</label> <label>Academic Suffix Email</label>
<input type="text" ng-disabled="!createCampusClicked" ng-model="user.lecAcMail" required/> <input type="text" ng-model="user.campusSuffixMail" ng-minlength="1" required/>
</md-input-container> </md-input-container>
<md-input-container> <md-input-container>
<label>Campus Name</label> <label>Campus Name</label>
<input type="text" ng-disabled="!createCampusClicked" ng-model="user.campusName" required/> <input type="text" ng-if="createCampusClicked" ng-model="user.campusName" ng-minlength="1" required !important/>
</md-input-container> </md-input-container>
<md-input-container> <md-input-container>
<label>Campus Avatar Url (optional)</label> <label>Campus Avatar Url (optional)</label>
<input type="text" ng-disabled="!createCampusClicked" ng-model="user.newCampusAvatar" required/> <input type="text" ng-if="createCampusClicked" ng-model="user.newCampusAvatar"/>
</md-input-container> </md-input-container>
</div> </div>
</div> </div>
@ -48,7 +48,6 @@
</md-select> </md-select>
</div> </div>
</div> </div>
<div layout="col" layout-align="center center"> <div layout="col" layout-align="center center">
<div> <div>
<div class="campusAvatar" ng-if="campusChecked"> <div class="campusAvatar" ng-if="campusChecked">
@ -76,13 +75,6 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div> // TODO return
<p>
<b>Note:</b> This setting can be changed in the future. <br>
But Choose Now for easy Registration...
</p>
</div> -->
</md-card> </md-card>
</md-content> </md-content>
</div> </div>