Skip to content
This repository has been archived by the owner on Aug 12, 2018. It is now read-only.

Commit

Permalink
got a login dialog/form working
Browse files Browse the repository at this point in the history
  • Loading branch information
slmyers committed Feb 10, 2016
1 parent 52c5327 commit fa12d67
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var express = require('express'),

app.use(express.static('./web'));
app.get('*', function(req, res) {
res.sendFile(__dirname + 'web/index.html');
res.sendFile(__dirname + '/web/index.html');
});
app.listen(5000);
console.log('listening on localhost:5000');
8 changes: 5 additions & 3 deletions frontend/web/app/controllers/loginController.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// web token stuff not done yet


angular.module('chemGeno')
.controller('loginController', ['$scope','$mdMedia', '$mdDialog', function($scope, $mdMedia, $mdDialog) {
// https://github.com/angular/material/issues/1413 passing stuff to dialog
$scope.login = function($event) {
var useFullScreen = ($mdMedia('sm') || $mdMedia('xs')) && $scope.customFullscreen;
$mdDialog.show({
controller: loginController,
templateUrl: 'dialog1.tmpl.html',
controller: 'loginDialogController',
templateUrl: '/app/views/loginDialog.html',
parent: angular.element(document.body),
targetEvent: ev,
targetEvent: $event,
clickOutsideToClose:true,
fullscreen: useFullScreen
});
Expand Down
10 changes: 10 additions & 0 deletions frontend/web/app/controllers/loginDialogController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
angular.module('chemGeno')
.controller('loginDialogController', ['$scope', '$mdDialog', function($scope, $mdDialog) {
$scope.submit = function(user) {
console.log(user);
};

$scope.cancel = function() {
$mdDialog.cancel();
};
}]);
19 changes: 19 additions & 0 deletions frontend/web/app/views/loginDialog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<md-dialog aria-label="login dialog" ng-cloak>
<form name="userForm">
<md-input-container class="md-block" flex-gt-xs>
<label>Username</label>
<input ng-model="user.username">
</md-input-container>
<md-input-container class="md-block" flex-gt-xs>
<label>Password</label>
<input ng-model="user.password">
</md-input-container>
<md-button class="md-raised md-primary" ng-click="submit(user)">
login
</md-button>
<md-button class="md-raised md-primary" ng-click="cancel()">
cancel
</md-button>
</form>

</md-dialog>
5 changes: 5 additions & 0 deletions frontend/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>

<!-- our code -->
<!-- app level -->
<script src="app/module.js"></script>
<script src="app/routes.js"></script>

<!-- controllers -->
<script src="app/controllers/loginDialogController.js"></script>
<script src="app/controllers/loginController.js"></script>


<title>Chemistry Genealogy</title>

<!-- for 'html5Mode' -->
Expand Down

0 comments on commit fa12d67

Please sign in to comment.