Skip to content

Commit

Permalink
Merge pull request #3 from eipm/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
zisimo authored Jan 17, 2019
2 parents 5bfe242 + 0d92209 commit d40e211
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 50 deletions.
5 changes: 2 additions & 3 deletions src/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
OUTPUT_DIR = '/output'
STATIC_DIR = '/stork/src'

ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])
ALLOWED_EXTENSIONS = set(['jpg'])

static_file_dir = os.path.join(STATIC_DIR, 'static')

Expand Down Expand Up @@ -58,8 +58,7 @@ def login():
username = request.form['username']
password = request.form['password']
if username and users_dict[username] == password:
redirect_to_index = redirect('/')
response = make_response(redirect_to_index)
response = make_response()
uuid = str(myuuid.uuid4())
response.set_cookie('stork-auth', uuid, max_age=3600)
return response
Expand Down
14 changes: 11 additions & 3 deletions src/static/assets/stork.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
}

body {
margin: 0;
padding: 0;
height: 100%;
padding-bottom:125px;
}

.wrapper {
margin:20px;
min-height:100%;
position:relative;
}

footer {
position: absolute;
right: 0;
left: 0;
position: fixed;
width: 100%;
bottom: 0;
text-align: center;
background-color: whitesmoke;
Expand Down
4 changes: 2 additions & 2 deletions src/static/assets/stork.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function average(array) {

function isAnImage(file) {
if (file && file.type) {
return file.type.startsWith('image/');
return file.type.startsWith('image/jpeg');
}

return false;
Expand Down Expand Up @@ -153,7 +153,7 @@ function postFormData(formData, baseApiUrl) {
const result = card.getElementsByClassName('results')[0];
result.classList.remove('hidden');
});
updateResultsUI(calculateMajorVoteResult());
// updateResultsUI(calculateMajorVoteResult());
} else {
alert('An error occurred!');
}
Expand Down
46 changes: 24 additions & 22 deletions src/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,34 @@
<link href="assets/stork.css" rel="stylesheet">
</head>
<body>
<div class="header center">
<img src="assets/logo.jpg" alt="Stork logo" height="60px">
</div>
<div class="block">

<div class="margin10 inline-block">
<label for="file-select" id="add-images-button" class="btn">
<i class="material-icons left">add</i>Add Images
</label>
<input type="file" id="file-select" multiple="multiple" accept="image/*" class="hidden" />
<div id="error-message" class="error-message hidden">You can add up to 7 images</div>
<div class="wrapper">
<div class="header center">
<img src="assets/logo.jpg" alt="Stork logo" height="60px">
</div>
<div id="clear-all-button" class="btn disabled inline-block margin10 float-right">Clear All</div>
<div class="block">

<div class="margin10 inline-block">
<label for="file-select" id="add-images-button" class="btn">
<i class="material-icons left">add</i>Add Images
</label>
<input type="file" id="file-select" multiple="multiple" accept="image/jpeg" class="hidden" />
<div id="error-message" class="error-message hidden">You can add up to 7 images</div>
</div>
<div id="clear-all-button" class="btn disabled inline-block margin10 float-right">Clear All</div>

</div>
<div>
<div id="imageCards-placeholder" class="margin10" ondrop="dropHandler(event);">
<div class="center info-text">Drag and drop your images here</div>
</div>
<div>
<div id="imageCards-placeholder" class="margin10" ondrop="dropHandler(event);">
<div class="center info-text">Drag and drop your JPG images here</div>
</div>
</div>


<div id="results-placeholder" class="margin10 hidden">
Major vote result: <strong></strong>
</div>
<div class="push"></div>
</div>


<div id="results-placeholder" class="margin10 hidden">
Major vote result: <strong></strong>
</div>

<footer>
<div>Copyright © 2019 Englander Institute for Precision Medicine</div>
<div>Stork Version 1.0.0</div>
Expand Down
41 changes: 21 additions & 20 deletions src/static/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@
<link href="assets/stork.css" rel="stylesheet">
</head>
<body>
<div class="header center">
<img src="assets/logo.jpg" alt="Stork logo" height="60px">
<div class="wrapper">
<div class="header center">
<img src="assets/logo.jpg" alt="Stork logo" height="60px">
</div>
<div class="block center login-container">
<h5 class="login-title">Log in</h5>
<form id="login-form">
<div class="input-field col">
<input class="validate" type="text" name="username" id="username" required/>
<label for="username">Enter your username</label>
</div>
<div class="input-field col">
<input class="validate" type="password" name="password" id="password" required/>
<label for="password">Enter your password</label>
</div>
<div class="center">
<button type="submit" name="btn_login" class="btn">Log in</button>
</div>
<div class="margin10 error-message hidden" id="login-form-username-password-error">Wrong username or password</div>
</form>
</div>
</div>
<div class="block center login-container">
<h5 class="login-title">Log in</h5>
<form id="login-form">
<div class="input-field col">
<input class="validate" type="text" name="username" id="username" required/>
<label for="username">Enter your username</label>
</div>
<div class="input-field col">
<input class="validate" type="password" name="password" id="password" required/>
<label for="password">Enter your password</label>
</div>
<div class="center">
<button type="submit" name="btn_login" class="btn">Log in</button>
</div>
<div class="margin10 error-message hidden" id="login-form-username-password-error">Wrong username or password</div>
</form>
</div>

<footer>
<div>Copyright © 2019 Englander Institute for Precision Medicine</div>
<div>Stork Version 1.0.0</div>
Expand Down

0 comments on commit d40e211

Please sign in to comment.