File tree Expand file tree Collapse file tree 2 files changed +10
-39
lines changed
codepulse/src/main/resources/toserve/pages/projects Expand file tree Collapse file tree 2 files changed +10
-39
lines changed Original file line number Diff line number Diff line change 5656
5757 this . openLabelEditor = ( function ( ) {
5858
59-
60- // flag that gets when the save button is clicked,
61- // and checked by the closeEditor function to make
62- // it skip the normal close actions.
63- var saveClicked = false
64-
6559 // switch into our out of editing mode
6660 function setEditing ( isEditing ) {
6761 label . toggleClass ( 'editing' , isEditing )
7165 // use the text in the editor as the new title
7266 function saveEditor ( ) {
7367 var txt = labelTextEdit . val ( )
74- //setTitle(txt)
7568 labelEdits . push ( txt )
7669 setEditing ( false )
7770 }
7871
7972 // leave editing mode without saving
8073 function closeEditor ( ) {
81- if ( saveClicked ) {
82- saveClicked = false
83- } else {
84- labelTextEdit . val ( _label )
85- setEditing ( false )
86- }
74+ labelTextEdit . val ( _label )
75+ setEditing ( false )
8776 }
8877
8978 // Keypresses that leave the editor
9584 if ( e . which == 13 ) saveEditor ( )
9685 } )
9786
98- labelTextSave . click ( function ( ) {
99- saveClicked = true
100- saveEditor ( )
101- } )
102-
103- // Un-focusing the editor causes it to close
104- labelTextEdit . focusout ( function ( ) {
105- setTimeout ( closeEditor , 100 )
106- } )
87+ // save when the 'save' button is clicked or the user leaves the input box
88+ labelTextSave . click ( saveEditor )
89+ labelTextEdit . focusout ( saveEditor )
10790
10891 return function ( ) { setEditing ( true ) }
10992 } ) ( ) ;
Original file line number Diff line number Diff line change 3131 function Editable ( $elem ) {
3232 var $input = $elem . find ( '.editor input[type=text]' ) ,
3333 $save = $elem . find ( '.editor .editor-save' ) ,
34- $content = $elem . find ( '.edit-content' ) ,
35- saveClicked = false
34+ $content = $elem . find ( '.edit-content' )
3635
3736 function setEditing ( isEditing ) {
3837 $elem . toggleClass ( 'editing' , isEditing )
@@ -56,11 +55,7 @@ place.
5655 }
5756
5857 function closeEditor ( ) {
59- if ( saveClicked ) {
60- saveClicked = false
61- } else {
62- setEditing ( false )
63- }
58+ setEditing ( false )
6459 $elem . trigger ( 'editable.cancel' )
6560 }
6661
@@ -72,16 +67,9 @@ place.
7267 if ( e . which == 13 ) saveEditor ( )
7368 } )
7469
75- $save . click ( function ( ) {
76- saveClicked = true
77- saveEditor ( )
78- // clicking the save button also triggers an unfocus on the $input
79- } )
80-
81- $input . focusout ( function ( ) {
82- if ( $elem . hasClass ( 'editing' ) )
83- setTimeout ( closeEditor , 100 )
84- } )
70+ // save when the 'save' button is clicked or the user leaves the input box
71+ $save . click ( saveEditor )
72+ $input . focusout ( saveEditor )
8573
8674 this . open = function ( ) { setEditing ( true ) }
8775
You can’t perform that action at this time.
0 commit comments