Close #55 - on Login success set username, add the user to project if not done yet
--- a/src/hdalab/static/hdalab/js/renkan-manual-save.js Fri Jan 09 11:51:40 2015 +0100
+++ b/src/hdalab/static/hdalab/js/renkan-manual-save.js Fri Jan 09 16:09:23 2015 +0100
@@ -45,6 +45,13 @@
});
};
var _save = function() {
+ if (_opts.login_user==true){
+ _proj.addUser({
+ _id:_opts.user_id,
+ title:_opts.user_name
+ });
+ _opts.login_user=false;
+ }
_proj.set("saved_at", new Date());
var _data = _proj.toJSON();
Rkns.$.ajax({
--- a/src/hdalab/templates/ajax_identification/ajax_login_ok.html Fri Jan 09 11:51:40 2015 +0100
+++ b/src/hdalab/templates/ajax_identification/ajax_login_ok.html Fri Jan 09 16:09:23 2015 +0100
@@ -1,8 +1,5 @@
{% load i18n %}
-<div>
- <div class="ok"><p>OK</p><p class="close hand">{% trans "Close window" %}</p></div>
- <div class="username">
- <li><a href="{% url 'profile_home' %}">{{ user.username }}</a></li>
+<div id="{{ user.id }}" class="ok">
+ <li class="{% block profile_actif %}{% endblock %}"><a id="username" href="{% url 'profile_home' %}">{{ user.username }}</a></li>
<li><a href="{% url 'logout' %}?next={% url 'home' %}">{% trans "Log out" %}</a></li>
- </div>
</div>
\ No newline at end of file
--- a/src/hdalab/templates/renkan_edit.html Fri Jan 09 11:51:40 2015 +0100
+++ b/src/hdalab/templates/renkan_edit.html Fri Jan 09 16:09:23 2015 +0100
@@ -36,6 +36,7 @@
var _renkan = new Rkns.Renkan({
manual_save: true,
user_color_editable: false,
+ user_name_editable: false,
show_user_color: false,
{% if user.is_authenticated %}
user_id:"{{ user.id }}",
@@ -92,7 +93,6 @@
dialog = $( "#dialog-form" ).dialog({
autoOpen: false,
- height: 398,
width: 520,
modal: true,
create: function (event, ui) {
@@ -111,13 +111,14 @@
data: f.serialize(),
success: function(data, textStatus, jqXHR) {
var d = $(data);
- if($(".ok",d).length==1){
- console.log("ok");
- $("#dialog-form").html($(".ok",d)[0]);
- $(".hello-user").remove();
- $("#nav").append($(".username",d).children());
+ if(d.hasClass("ok")){
io_options.user_authenticated = true;
- $(".Rk-Save-Button").addClass("Rk-Save-Online");
+ io_options.login_user = true;
+ io_options.user_id= d.attr("id");
+ io_options.user_name= $("#username",d).html();
+
+ $("#menu.profile").html(d.html());
+ $(".Rk-CurrentUser-Name").html(io_options.user_name);
dialog.dialog( "close" );
$(".Rk-Save-Button").click();
return true;