@@ -400,14 +400,18 @@ function sepiaFW_build_ui_cards(){
400400 if ( cardElementInfo . _id ) {
401401 Cards . findAllUserDataLists ( cardElementInfo . _id ) . forEach ( function ( l ) {
402402 if ( l . data && l . data . lastEdit != cardElementInfo . lastEdit ) {
403- $ ( l . ele ) . addClass ( "sepiaFW-card-out-of-sync" ) . find ( '.sepiaFW-cards-list-saveBtn' )
404- . addClass ( 'active' ) . find ( 'i' ) . html ( 'sync_problem' ) ; //cloud_off
403+ markUserDataListAsOutOfSync ( l ) ;
405404 }
406405 } ) ;
407406 }
408407
409408 return cardElement ;
410409 }
410+ //mark userDataList as oos
411+ function markUserDataListAsOutOfSync ( l ) {
412+ $ ( l . ele ) . addClass ( "sepiaFW-card-out-of-sync" ) . find ( '.sepiaFW-cards-list-saveBtn' )
413+ . addClass ( 'active' ) . find ( 'i' ) . html ( 'sync_problem' ) ; //cloud_off
414+ }
411415 //get userDataList
412416 function getUserDataList ( theList ) {
413417 var listInfo = JSON . parse ( theList . getAttribute ( 'data-list' ) ) ;
@@ -759,8 +763,8 @@ function sepiaFW_build_ui_cards(){
759763 newName = newName . replace ( / < b r > | < d i v > | < \/ d i v > / g, "" ) . trim ( ) ; //happens when the user presses enter(?)
760764 newName = newName . replace ( / - | _ | ! | \? | , | \. | ' / g, " " ) . trim ( ) ; //remove some special chars
761765 newName = ( newName . length > 100 ) ? newName . substring ( 0 , 99 ) : newName ; //brutally shorten name - TODO: improve
762- eleData . name = newName ;
763- $ ( this ) . html ( newName ) ;
766+ eleData . name = newName . trim ( ) ;
767+ $ ( this ) . html ( eleData . name ) ;
764768 $ ( timeEvent ) . attr ( 'data-element' , JSON . stringify ( eleData ) ) ;
765769 //update stored TIMER
766770 var Timer = SepiaFW . events . getRunningOrActivatedTimeEventById ( eleData . eventId ) ;
@@ -1509,8 +1513,7 @@ function sepiaFW_build_ui_cards(){
15091513 saveBtn . className = "sepiaFW-cards-list-saveBtn" ;
15101514 saveBtn . innerHTML = "<i class='material-icons md-mnu'>cloud_upload</i>" ;
15111515 var storeFun = function ( listInfoObj ) {
1512- var writeData = { } ;
1513- writeData . lists = listInfoObj ;
1516+ //TODO: check list timestamp?
15141517 SepiaFW . account . saveList ( listInfoObj , function ( data ) {
15151518 SepiaFW . debug . log ( 'Account - successfully stored list: ' + listInfoObj . indexType + ", " + listInfoObj . title ) ;
15161519 //deactivate save button
@@ -1520,12 +1523,12 @@ function sepiaFW_build_ui_cards(){
15201523 if ( listInfoObj . _id ) {
15211524 Cards . findAllUserDataLists ( listInfoObj . _id ) . forEach ( function ( l ) {
15221525 if ( l . ele != cardElement ) {
1523- $ ( l . ele ) . addClass ( "sepiaFW-card-out-of-sync" ) . find ( '.sepiaFW-cards-list-saveBtn' )
1524- . addClass ( 'active' ) . find ( 'i' ) . html ( 'sync_problem' ) ; //cloud_off
1526+ markUserDataListAsOutOfSync ( l ) ;
15251527 }
15261528 } ) ;
15271529 }
15281530 } , function ( msg ) {
1531+ //error
15291532 SepiaFW . ui . showPopup ( msg ) ;
15301533 } ) ;
15311534 }
@@ -1549,8 +1552,8 @@ function sepiaFW_build_ui_cards(){
15491552 //e.g. "timeEvents"
15501553 SepiaFW . ui . showPopup ( SepiaFW . local . g ( 'cantCopyList' ) ) ;
15511554 }
1555+ //same user
15521556 } else {
1553- //same user
15541557 if ( listContainer . className . indexOf ( "out-of-sync" ) >= 0 ) {
15551558 //ask because list may be out of sync
15561559 SepiaFW . ui . build . askConfirm ( SepiaFW . local . g ( 'listOutOfSync' ) , function ( ) {
0 commit comments