Skip to content

Commit

Permalink
LFE now indicates when it has saved.
Browse files Browse the repository at this point in the history
  • Loading branch information
lethain committed Jun 1, 2008
1 parent 2ecfd41 commit a8e99c7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
10 changes: 10 additions & 0 deletions media/lifeflow/editor/editor.css
Expand Up @@ -98,6 +98,16 @@ div.error-msg {
background-color: red;
}

div.normal-msg {
background-color: #0099FF;
z-index: 100;
margin: 0px;
padding: 0px;
position: absolute;
width: 100%;
text-align: center;
}

div.editing {
margin-top: 10px;
margin-left: 10%;
Expand Down
16 changes: 15 additions & 1 deletion media/lifeflow/editor/lfe.js
Expand Up @@ -4,6 +4,12 @@ var display_error = function(txt, elem) {
msg.insertAfter($(elem)).fadeIn('slow').animate({opacity: 1.0}, 5000).fadeOut('slow', function() { msg.remove(); });
};

var display_message = function(txt, elem) {
if (elem == undefined) { elem = "#messages" };
var msg = $('<div class="normal-msg"><span>'+txt+'</span></div>');
msg.insertAfter($(elem)).fadeIn('slow').animate({opacity: 1.0}, 1000).fadeOut('slow', function() { msg.remove(); });
};


/* Talking with the LifeFlow API */

Expand All @@ -22,10 +28,18 @@ var create_model = function(model, args, onCompleteFunc) {
}

var update_model = function(model, pk, args) {
var onComplete = function(res,status) {
if (status == "success") {
display_message("Saved.");
}
else {
display_error(res.responseText);
}
}
if (!args) args = {};
args["model"] = model;
args["pk"] = pk;
$.ajax({type:"POST", url:'/editor/update/', data:args});
$.ajax({type:"POST", url:'/editor/update/', data:args, complete:onComplete});
};

/* Used by projects.html */
Expand Down
3 changes: 3 additions & 0 deletions templates/lifeflow/editor/base.html
Expand Up @@ -14,6 +14,7 @@
</head>

<body>
<div class="normal-msg" id="messages"></div>
<div class="control-bar">
{% if not login_screen %}
<a class="right" href="/editor/logout/">logout</a>
Expand All @@ -25,6 +26,8 @@
{% endif %}
</div>
<div class="error-msg" id="errors"></div>


{% block body %}{% endblock %}
</body>
</html>

0 comments on commit a8e99c7

Please sign in to comment.