# HG changeset patch # User rougeronj # Date 1420816163 -3600 # Node ID 33a1260273bcfdcecccb3fa20d55f7ee0fdd48dd # Parent be82c14a0ad1c1ae30991156978a66fcc539b97e Close #55 - on Login success set username, add the user to project if not done yet diff -r be82c14a0ad1 -r 33a1260273bc src/hdalab/static/hdalab/js/renkan-manual-save.js --- 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({ diff -r be82c14a0ad1 -r 33a1260273bc src/hdalab/templates/ajax_identification/ajax_login_ok.html --- 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 %} -
-

OK

{% trans "Close window" %}

-
-
  • {{ user.username }}
  • +
    \ No newline at end of file diff -r be82c14a0ad1 -r 33a1260273bc src/hdalab/templates/renkan_edit.html --- 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;