Fixing dev config. Starting to implement sign-up.
Added 'default' make target to only compile. Reset development configuration. Commented out starts of tests. Added sign-up GUI to login panel. Moved application from /ts/ to /
This commit is contained in:
parent
1b981b206c
commit
4d124ffeba
2
Makefile
2
Makefile
@ -4,6 +4,8 @@ TEST_MODS = $(wildcard test/*.erl)
|
||||
TEST_BEAMS = $(TEST_MODS:test/%.erl=test/%.beam)
|
||||
YAWS_ROOT=/usr/lib/yaws/timestamper
|
||||
|
||||
default: compile
|
||||
|
||||
all : compile test
|
||||
|
||||
compile : $(BEAMS)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,7 +3,7 @@
|
||||
|
||||
start() ->
|
||||
ok = application:load(mnesia),
|
||||
ok = application:set_env(mnesia, dir, "/usr/lib/yaws"),
|
||||
ok = application:set_env(mnesia, dir, "/home/jdbernard/projects/timestamper/web-app/db/test"),
|
||||
ok = mnesia:start(),
|
||||
error_logger:info_report("TimeStampter app started."),
|
||||
ok.
|
||||
|
@ -16,11 +16,10 @@ joe_user() -> #ts_user{username=joeuser, name="Joe User", pwd="ohmy",
|
||||
|
||||
% ======== TESTS ======== %
|
||||
|
||||
new_delete_test_() ->
|
||||
%new_delete_test_() ->
|
||||
% test data
|
||||
JoeUser = joe_user(),
|
||||
|
||||
{setup, fun setup/0, fun cleanup/1, {inorder, [
|
||||
?_test(new(JoeUser)),
|
||||
?_test(lookup(JoeUser#ts_user.username, JoeUser)),
|
||||
%JoeUser = joe_user(),
|
||||
|
||||
%{setup, fun setup/0, fun cleanup/1, {inorder, [
|
||||
% ?_test(new(JoeUser)),
|
||||
% ?_test(lookup(JoeUser#ts_user.username, JoeUser)),
|
||||
|
@ -241,8 +241,6 @@ body {
|
||||
|
||||
#login-dialog {
|
||||
font-size: small; }
|
||||
#login-dialog label, #login-dialog input {
|
||||
display: block; }
|
||||
#login-dialog input.text {
|
||||
margin-bottom: 1em;
|
||||
width: 95%;
|
||||
@ -256,3 +254,9 @@ body {
|
||||
|
||||
#ui-dialog-title-login-dialog, .ui-dialog-buttonset {
|
||||
font-size: medium; }
|
||||
|
||||
.signup {
|
||||
display: none; }
|
||||
|
||||
#signup-checkbox {
|
||||
display: inline; }
|
||||
|
@ -307,7 +307,7 @@ body {
|
||||
#login-dialog {
|
||||
font-size: small;
|
||||
|
||||
label, input { display: block }
|
||||
//label, input { display: block }
|
||||
input.text {
|
||||
margin-bottom: 1em;
|
||||
width: 95%;
|
||||
@ -324,3 +324,7 @@ body {
|
||||
#ui-dialog-title-login-dialog, .ui-dialog-buttonset {
|
||||
font-size: medium;
|
||||
}
|
||||
|
||||
.signup { display: none; }
|
||||
|
||||
#signup-checkbox { display: inline; }
|
||||
|
205
www/index.yaws
205
www/index.yaws
@ -2,23 +2,206 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>TimeStamper - Simple time tracking</title>
|
||||
<title>TimeStamper - Simple Time Tracking</title>
|
||||
<link rel="stylesheet" media="screen" href="/css/dot-luv/jquery-ui-1.8.10.custom.css" type="text/css"/>
|
||||
<link rel="stylesheet" media="screen" href="/css/ts-screen.css" type="text/css"/>
|
||||
<!-- Needed for IE, but I'm not going to support IE with this tool. -->
|
||||
<!--<script type="text/javascript" src="/js/json2.js"></script>-->
|
||||
<!-- PROD -->
|
||||
<!--
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
|
||||
-->
|
||||
<!-- DEV -->
|
||||
<script type="text/javascript" src="/js/jquery-1.5.min.js"></script>
|
||||
<script type="text/javascript" src="/js/jquery-ui-1.8.10.custom.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="/js/underscore-min.js"></script>
|
||||
<script type="text/javascript" src="/js/ICanHaz.js"></script>
|
||||
<script type="text/javascript" src="/js/ts.js"></script>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
|
||||
<script id="entry" type="text/html">
|
||||
<div class="entry-bar" id="entry-{{entry_id}}">
|
||||
<div class="entry-display">
|
||||
<span class="id">{{entry_id}}</span>
|
||||
<div class="details">
|
||||
<div class="entry-mark">{{mark}}</div>
|
||||
<div class="entry-notes">{{notes}}</div>
|
||||
</div>
|
||||
<div class="control-links">
|
||||
<a onclick="$('#entry-{{entry_id}} .entry-display .entry-notes').slideToggle('slow');"
|
||||
href="#">show notes</a>
|
||||
<a onclick="toggleEditEntry(event, {{entry_id}})"
|
||||
href="#">edit</a>
|
||||
<a onclick="deleteEntry(event, {{entry_id}})"
|
||||
href="#">del</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="entry-edit">
|
||||
<form action="/ts/update-entry.yaws"
|
||||
onsubmit="updateEntry(event, {{entry_id}})">
|
||||
<input type="text" id="entry-{{entry_id}}-id-input"
|
||||
class="id" value="{{entry_id}}"/>
|
||||
<div class="details">
|
||||
<input type="text" id="entry-{{entry_id}}-mark-input"
|
||||
class="entry-mark" value="{{mark}}"/></br>
|
||||
<textarea id="entry-{{entry_id}}-notes-input"
|
||||
class="entry-notes" rows="8" cols="40" >{{notes}}</textarea>
|
||||
</div>
|
||||
</form>
|
||||
<div class="control-links">
|
||||
<a onclick="$('#entry-{{entry_id}} .entry-edit .entry-notes').slideToggle('slow');"
|
||||
href="#">show notes</a>
|
||||
<a onclick="updateEntry(event, {{entry_id}})"
|
||||
href="#">save changes</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="header">
|
||||
<div>
|
||||
<h1>TimeStamper</h1>
|
||||
<h4>Simple time tracking.</h4>
|
||||
|
||||
<div id="user" class="bar">
|
||||
<span id="fullname">Not Logged In</span>
|
||||
<span id="username">- no_user</span>
|
||||
<div class="control-links">
|
||||
<a href="/ts/edit-user.yaws"
|
||||
onclick="$('#user-info').slideToggle('slow'); return false;">
|
||||
user info</a>
|
||||
<a href="/ts/logout.yaws" onclick="logout(event)">logout</a>
|
||||
</div>
|
||||
<div id="form-panel">
|
||||
<form action="/ts/" method="post">
|
||||
<label for="uname">username: </label>
|
||||
<input name="uname" type="text"/>
|
||||
<label for="pwd">password: </label>
|
||||
<input name="pwd" type="password"/>
|
||||
|
||||
<div id="user-info">
|
||||
<form action="/ts/update-user.yaws" onsubmit="updateUser(event)">
|
||||
<div class="form-col">
|
||||
<label for="fullname-input"><span>name:</span>
|
||||
<input id="fullname-input" name="fullname"
|
||||
class="text-input" type="text"/>
|
||||
</label>
|
||||
<label for="email-input"><span>email:</span>
|
||||
<input id="email-input" name="email"
|
||||
class="text-input" type="text"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-col">
|
||||
<div id="change-pwd">
|
||||
<label for="old-pwd-input"><span>password:</span>
|
||||
<input id="old-pwd-input" name="old-pwd"
|
||||
class="text-input" type="password"/>
|
||||
</label>
|
||||
<label for="new-pwd-input"><span>new pwd:</span>
|
||||
<input id="new-pwd-input" name="new-pwd"
|
||||
class="text-input" type="password"/>
|
||||
</label>
|
||||
<label for="new-pwd-conf-input"><span>confirm:</span>
|
||||
<input id="new-pwd-conf-input" name="new-pwd-conf"
|
||||
class="text-input" type="password"/>
|
||||
</label>
|
||||
</div>
|
||||
<label for="enable-pwd-change-input">
|
||||
<input name="enable-pwd-change" type="checkbox"
|
||||
id="enable-pwd-change-input"
|
||||
onclick="$('#change-pwd').slideToggle('slow');"/>
|
||||
change password
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-submit">
|
||||
<div>
|
||||
<input name="submit-user" type="submit"
|
||||
value="save changes"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="timeline" class="bar">
|
||||
<span id="timeline-name">timeline |</span>
|
||||
<span id="timeline-desc">timeline description</span>
|
||||
<div class="control-links">
|
||||
<a href="/ts/edit-timeline.yaws"
|
||||
onclick="$('#timeline-info').slideToggle('slow'); return false;">
|
||||
timeline info</a>
|
||||
<a href="/ts/select-timeline.yaws"
|
||||
onclick="showTimelineMenu(event)">change timelines</a>
|
||||
</div>
|
||||
|
||||
<div id="timeline-info">
|
||||
<form action="/ts/update-timeline.yaws"
|
||||
onsubmit="updateTimeline(event); false">
|
||||
<label for="timeline-desc-input"><span>description:</span>
|
||||
<input id="timeline-desc-input" class="text-input"
|
||||
name="timeline-desc" type="text"/>
|
||||
</label>
|
||||
<div class="form-submit">
|
||||
<div><input name="submit-timeline" type="submit"
|
||||
value="save changes"/></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="new-entry" class="bar">
|
||||
<form action="/ts/new-entry.yaws" onsubmit="newEntry(event)">
|
||||
begin a new activity:
|
||||
<input name="new-entry" id="new-entry-input"
|
||||
class="text-input" type="text"/>
|
||||
<input name="submit-entry" id="submit-entry"
|
||||
class="form-submit" type="submit" value="create entry"/>
|
||||
<div class="control-links">
|
||||
<a id="show-notes" href="#"
|
||||
onclick="$('#add-notes').slideToggle('slow');">
|
||||
add notes</a>
|
||||
</div>
|
||||
<div id="add-notes" class="form-col">
|
||||
<label for="new-notes-input">notes:</label>
|
||||
<textarea name="new-notes" id="new-notes-input"
|
||||
class="text-input" rows="8" cols="40" ></textarea>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="more-entries" class="last-bar top-entry">
|
||||
<div>
|
||||
<a href="#" onclick="loadEntries(user, activeTimeline, 'old');event.preventDefault()">load more entries</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="login-dialog" title="Login">
|
||||
<form>
|
||||
<fieldset>
|
||||
<label for="login-name">Username:</label>
|
||||
<input type="text" name="login-name" id="login-name"
|
||||
class="text ui-widget-content ui-corner-all"></input>
|
||||
<div class="signup">
|
||||
<label for="signup-fullname">Full name:</label>
|
||||
<input type="text" name="signup-fullname" id="signup-fullname"
|
||||
class="text ui-widget-content ui-corner-all"></input>
|
||||
<label for="signup-email">eMail address:</label>
|
||||
<input type="text" name="signup-email" id="signup-email"
|
||||
class="text ui-widget-content ui-corner-all"></input>
|
||||
</div>
|
||||
<label for="login-password">Password:</label>
|
||||
<input type="password" name="login-password" id="login-password"
|
||||
class="text ui-widget-content ui-corner-all"></input>
|
||||
|
||||
<div class="signup">
|
||||
<label for="confirm-password">Confirm password:</label>
|
||||
<input type="password" name="confirm-password" id="confirm-password"
|
||||
class="text ui-widget-content ui-corner-all"></input>
|
||||
</div>
|
||||
<label for="signup-checkbox">
|
||||
<input type="checkbox" id="signup-checkbox" name="signup-checkbox"
|
||||
onclick="toggleSignUp(event)"/>
|
||||
I'm a new user!
|
||||
</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<p class="validate-tips"></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
26
www/js/ts.js
26
www/js/ts.js
@ -9,6 +9,8 @@ var moreEntriesbar;
|
||||
var currentEntryOffset = 0;
|
||||
var loadLength = 20;
|
||||
|
||||
var loginTop;
|
||||
|
||||
/* Setup after the document is ready for manipulation. */
|
||||
$(document).ready(function(){
|
||||
|
||||
@ -22,7 +24,9 @@ $(document).ready(function(){
|
||||
height: 300,
|
||||
width: 300,
|
||||
modal: true,
|
||||
buttons: { Login: function(){login()} }
|
||||
buttons: {
|
||||
"Sign Up": function(){signup()},
|
||||
Login: function(){login()} }
|
||||
});
|
||||
|
||||
// TODO: add a hook to AJAX requests to check for 401 unauth
|
||||
@ -73,6 +77,26 @@ function login() {
|
||||
}});
|
||||
}
|
||||
|
||||
function toggleSignUp(event) {
|
||||
var signUpCB = $("#signup-checkbox");
|
||||
|
||||
if (signUpCB.attr("checked")) {
|
||||
loginTop = $("#login-dialog").dialog("widget").offset().top;
|
||||
$("#login-dialog").animate({height: 350}, 500);
|
||||
$("#login-dialog").dialog("widget").animate({top: loginTop - 200}, 500);
|
||||
$(".signup").slideDown("slow");
|
||||
} else {
|
||||
$("#login-dialog").animate({height: 180}, 500);
|
||||
$("#login-dialog").dialog("widget").animate({top: loginTop}, 500);
|
||||
$(".signup").slideUp("slow");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function signUp() {
|
||||
|
||||
}
|
||||
|
||||
/* End the current user session and expire any session credentials we
|
||||
* have aquired. */
|
||||
function logout(event) {
|
||||
|
@ -1,181 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>TimeStamper - Simple Time Tracking</title>
|
||||
<link rel="stylesheet" media="screen" href="/css/dot-luv/jquery-ui-1.8.10.custom.css" type="text/css"/>
|
||||
<link rel="stylesheet" media="screen" href="/css/ts-screen.css" type="text/css"/>
|
||||
<!-- Needed for IE, but I'm not going to support IE with this tool. -->
|
||||
<!--<script type="text/javascript" src="/js/json2.js"></script>-->
|
||||
<script type="text/javascript" src="/js/jquery-1.5.min.js"></script>
|
||||
<script type="text/javascript" src="/js/jquery-ui-1.8.10.custom.min.js"></script>
|
||||
<script type="text/javascript" src="/js/underscore-min.js"></script>
|
||||
<script type="text/javascript" src="/js/ICanHaz.js"></script>
|
||||
<script type="text/javascript" src="/js/ts.js"></script>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
|
||||
<script id="entry" type="text/html">
|
||||
<div class="entry-bar" id="entry-{{entry_id}}">
|
||||
<div class="entry-display">
|
||||
<span class="id">{{entry_id}}</span>
|
||||
<div class="details">
|
||||
<div class="entry-mark">{{mark}}</div>
|
||||
<div class="entry-notes">{{notes}}</div>
|
||||
</div>
|
||||
<div class="control-links">
|
||||
<a onclick="$('#entry-{{entry_id}} .entry-display .entry-notes').slideToggle('slow');"
|
||||
href="#">show notes</a>
|
||||
<a onclick="toggleEditEntry(event, {{entry_id}})"
|
||||
href="#">edit</a>
|
||||
<a onclick="deleteEntry(event, {{entry_id}})"
|
||||
href="#">del</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="entry-edit">
|
||||
<form action="/ts/update-entry.yaws"
|
||||
onsubmit="updateEntry(event, {{entry_id}})">
|
||||
<input type="text" id="entry-{{entry_id}}-id-input"
|
||||
class="id" value="{{entry_id}}"/>
|
||||
<div class="details">
|
||||
<input type="text" id="entry-{{entry_id}}-mark-input"
|
||||
class="entry-mark" value="{{mark}}"/></br>
|
||||
<textarea id="entry-{{entry_id}}-notes-input"
|
||||
class="entry-notes" rows="8" cols="40" >{{notes}}</textarea>
|
||||
</div>
|
||||
</form>
|
||||
<div class="control-links">
|
||||
<a onclick="$('#entry-{{entry_id}} .entry-edit .entry-notes').slideToggle('slow');"
|
||||
href="#">show notes</a>
|
||||
<a onclick="updateEntry(event, {{entry_id}})"
|
||||
href="#">save changes</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="user" class="bar">
|
||||
<span id="fullname">Not Logged In</span>
|
||||
<span id="username">- no_user</span>
|
||||
<div class="control-links">
|
||||
<a href="/ts/edit-user.yaws"
|
||||
onclick="$('#user-info').slideToggle('slow'); return false;">
|
||||
user info</a>
|
||||
<a href="/ts/logout.yaws" onclick="logout(event)">logout</a>
|
||||
</div>
|
||||
|
||||
<div id="user-info">
|
||||
<form action="/ts/update-user.yaws" onsubmit="updateUser(event)">
|
||||
<div class="form-col">
|
||||
<label for="fullname-input"><span>name:</span>
|
||||
<input id="fullname-input" name="fullname"
|
||||
class="text-input" type="text"/>
|
||||
</label>
|
||||
<label for="email-input"><span>email:</span>
|
||||
<input id="email-input" name="email"
|
||||
class="text-input" type="text"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-col">
|
||||
<div id="change-pwd">
|
||||
<label for="old-pwd-input"><span>password:</span>
|
||||
<input id="old-pwd-input" name="old-pwd"
|
||||
class="text-input" type="password"/>
|
||||
</label>
|
||||
<label for="new-pwd-input"><span>new pwd:</span>
|
||||
<input id="new-pwd-input" name="new-pwd"
|
||||
class="text-input" type="password"/>
|
||||
</label>
|
||||
<label for="new-pwd-conf-input"><span>confirm:</span>
|
||||
<input id="new-pwd-conf-input" name="new-pwd-conf"
|
||||
class="text-input" type="password"/>
|
||||
</label>
|
||||
</div>
|
||||
<label for="enable-pwd-change-input">
|
||||
<input name="enable-pwd-change" type="checkbox"
|
||||
id="enable-pwd-change-input"
|
||||
onclick="$('#change-pwd').slideToggle('slow');"/>
|
||||
change password
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-submit">
|
||||
<div>
|
||||
<input name="submit-user" type="submit"
|
||||
value="save changes"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="timeline" class="bar">
|
||||
<span id="timeline-name">timeline |</span>
|
||||
<span id="timeline-desc">timeline description</span>
|
||||
<div class="control-links">
|
||||
<a href="/ts/edit-timeline.yaws"
|
||||
onclick="$('#timeline-info').slideToggle('slow'); return false;">
|
||||
timeline info</a>
|
||||
<a href="/ts/select-timeline.yaws"
|
||||
onclick="showTimelineMenu(event)">change timelines</a>
|
||||
</div>
|
||||
|
||||
<div id="timeline-info">
|
||||
<form action="/ts/update-timeline.yaws"
|
||||
onsubmit="updateTimeline(event); false">
|
||||
<label for="timeline-desc-input"><span>description:</span>
|
||||
<input id="timeline-desc-input" class="text-input"
|
||||
name="timeline-desc" type="text"/>
|
||||
</label>
|
||||
<div class="form-submit">
|
||||
<div><input name="submit-timeline" type="submit"
|
||||
value="save changes"/></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="new-entry" class="bar">
|
||||
<form action="/ts/new-entry.yaws" onsubmit="newEntry(event)">
|
||||
begin a new activity:
|
||||
<input name="new-entry" id="new-entry-input"
|
||||
class="text-input" type="text"/>
|
||||
<input name="submit-entry" id="submit-entry"
|
||||
class="form-submit" type="submit" value="create entry"/>
|
||||
<div class="control-links">
|
||||
<a id="show-notes" href="#"
|
||||
onclick="$('#add-notes').slideToggle('slow');">
|
||||
add notes</a>
|
||||
</div>
|
||||
<div id="add-notes" class="form-col">
|
||||
<label for="new-notes-input">notes:</label>
|
||||
<textarea name="new-notes" id="new-notes-input"
|
||||
class="text-input" rows="8" cols="40" ></textarea>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="more-entries" class="last-bar top-entry">
|
||||
<div>
|
||||
<a href="#" onclick="loadEntries(user, activeTimeline, 'old');event.preventDefault()">load more entries</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="login-dialog" title="Login">
|
||||
<form>
|
||||
<fieldset>
|
||||
<label for="login-name">Username:</label>
|
||||
<input type="text" name="login-name" id="login-name"
|
||||
class="text ui-widget-content ui-corner-all"></input>
|
||||
<label for="login-password">Password:</label>
|
||||
<input type="password" name="login-password" id="login-password"
|
||||
class="text ui-widget-content ui-corner-all"></input>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<p class="validate-tips"></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,7 +1,7 @@
|
||||
ebin_dir = /home/jdbernard/projects/timestamper/web-app/ebin
|
||||
#include_dir = /home/jdbernard/projects/timestamper/web-app/src
|
||||
|
||||
runmod = timestamper
|
||||
runmod = timestamper_dev
|
||||
|
||||
<server timestamper-test>
|
||||
port = 8000
|
||||
|
Loading…
x
Reference in New Issue
Block a user