Further work on web interface.
This commit is contained in:
parent
19fc37c772
commit
ddc12cec64
@ -4,9 +4,13 @@
|
||||
pwd_salt,
|
||||
name,
|
||||
email,
|
||||
join_date
|
||||
join_date%,
|
||||
% ext_data % other extensible data
|
||||
}).
|
||||
|
||||
% ts_user.ext_data can be:
|
||||
% [{last_timeline, TimelineId}]
|
||||
|
||||
-record(ts_timeline, {
|
||||
ref, % {username, timelineid}
|
||||
created,% {{year, month, day}, {hour, minute, second}}
|
||||
|
@ -10,6 +10,7 @@ create_table(TableOpts) ->
|
||||
TableOpts ++ [{attributes, record_info(fields, ts_user)},
|
||||
{type, ordered_set}]).
|
||||
|
||||
% expects the password in clear
|
||||
new(UR = #ts_user{}) ->
|
||||
case mnesia:dirty_read(ts_user, UR#ts_user.username) of
|
||||
[ExistingRecord] -> {error, {record_exists, ExistingRecord}};
|
||||
@ -19,7 +20,13 @@ new(UR = #ts_user{}) ->
|
||||
update(UR = #ts_user{}) ->
|
||||
case mnesia:dirty_read(ts_user, UR#ts_user.username) of
|
||||
[] -> no_record;
|
||||
[_Record] -> mnesia:dirty_write(hash_input_record(UR))
|
||||
[Record] ->
|
||||
UpdatedRecord = ts_common:update_record(Record, UR),
|
||||
HashedRecord = case UR#ts_user.password of
|
||||
undefined -> UpdatedRecord;
|
||||
_Password -> hash_input_record(UpdatedRecord)
|
||||
end.
|
||||
mnesia:dirty_write(HashedRecord)
|
||||
end.
|
||||
|
||||
lookup(Username) ->
|
||||
|
@ -99,11 +99,11 @@ form {
|
||||
padding-right: 2em; }
|
||||
form .form-col input.text-input {
|
||||
width: 10em; }
|
||||
form .form-submit {
|
||||
form div.form-submit {
|
||||
float: left;
|
||||
width: 100%;
|
||||
overflow: hidden; }
|
||||
form .form-submit input {
|
||||
form div.form-submit input, form input.form-submit {
|
||||
border: 1px solid #979681;
|
||||
background: #f6f3ea; }
|
||||
|
||||
|
@ -123,16 +123,16 @@ form {
|
||||
input.text-input { width: 10em; }
|
||||
}
|
||||
|
||||
.form-submit {
|
||||
div.form-submit {
|
||||
float: left;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
input {
|
||||
div.form-submit input, input.form-submit {
|
||||
border: 1px solid $bbor;
|
||||
background: lighten($bbg, 10%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#user {
|
||||
|
@ -31,6 +31,11 @@ function showNewNotes(event) {
|
||||
$("#add-notes").slideToggle("slow");
|
||||
}
|
||||
|
||||
function newEntry(event) {
|
||||
alert("TODO: create entry vi AJAX");
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function logout(event) {
|
||||
alert("TODO: log user out via AJAX.");
|
||||
event.preventDefault();
|
||||
|
@ -87,12 +87,16 @@
|
||||
</div>
|
||||
|
||||
<div id="new-entry" class="bar last-bar">
|
||||
<form action="/ts/new-entry.yaws" onclick="newEntry(event)">
|
||||
<form action="/ts/new-entry.yaws" onsubmit="newEntry(event)">
|
||||
<span for="new-entry">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="showNewNotes(event)"/>add notes</a>
|
||||
</div>
|
||||
</span>
|
||||
<div id="add-notes">
|
||||
<label for="new-notes">notes:</label>
|
||||
|
Loading…
x
Reference in New Issue
Block a user