Fossil SCM

Fixed multi-line commit comment (was not being submitted with commit) and change page title to reflect the file being edited, both per forum feedback.

stephan 2020-05-15 02:39 fileedit-ajaxify
Commit ef2166a0ac4cb33527722813818dcc5da8f76085a5729ec8a7cc5b8d64529988
--- src/fossil.bootstrap.js
+++ src/fossil.bootstrap.js
@@ -316,7 +316,17 @@
316316
console.error(eventName,"event listener threw:",e);
317317
}
318318
}
319319
return this;
320320
};
321
+
322
+ /**
323
+ Sets the innerText of the page's TITLE tag to
324
+ the given text and returns this object.
325
+ */
326
+ F.page.setPageTitle = function(title){
327
+ const t = document.querySelector('title');
328
+ if(t) t.innerText = title;
329
+ return this;
330
+ };
321331
322332
})(window);
323333
--- src/fossil.bootstrap.js
+++ src/fossil.bootstrap.js
@@ -316,7 +316,17 @@
316 console.error(eventName,"event listener threw:",e);
317 }
318 }
319 return this;
320 };
 
 
 
 
 
 
 
 
 
 
321
322 })(window);
323
--- src/fossil.bootstrap.js
+++ src/fossil.bootstrap.js
@@ -316,7 +316,17 @@
316 console.error(eventName,"event listener threw:",e);
317 }
318 }
319 return this;
320 };
321
322 /**
323 Sets the innerText of the page's TITLE tag to
324 the given text and returns this object.
325 */
326 F.page.setPageTitle = function(title){
327 const t = document.querySelector('title');
328 if(t) t.innerText = title;
329 return this;
330 };
331
332 })(window);
333
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -468,11 +468,11 @@
468468
*/
469469
const affirmHasFile = function(){
470470
if(!P.finfo) F.error("No file is loaded.");
471471
return !!P.finfo;
472472
};
473
-
473
+
474474
/**
475475
updateVersion() updates the filename and version in various UI
476476
elements...
477477
478478
Returns this object.
@@ -482,10 +482,12 @@
482482
this.finfo = arguments[0];
483483
file = this.finfo.filename;
484484
rev = this.finfo.checkin;
485485
}else if(0===arguments.length){
486486
if(!affirmHasFile()) return this;
487
+ file = this.finfo.filename;
488
+ rev = this.finfo.checkin;
487489
}else{
488490
this.finfo = {filename:file,checkin:rev};
489491
}
490492
const eTgt = this.e.fsFileVersionDetails.querySelector('div'),
491493
rHuman = F.hashDigits(rev),
@@ -514,10 +516,11 @@
514516
},false,true);
515517
const purl = F.repoUrl('fileedit',purlArgs);
516518
D.append(
517519
eTgt,"[",D.a(purl,"Editor permalink"),"]"
518520
);
521
+ this.setPageTitle("Edit: "+this.finfo.filename);
519522
return this;
520523
};
521524
522525
/**
523526
Removes the default editor widget (and any dependent elements)
@@ -728,16 +731,19 @@
728731
fd.append('checkin', this.finfo.checkin);
729732
fd.append('content',content);
730733
fd.append('dry_run',isDryRun ? 1 : 0);
731734
fd.append('eol', this.e.selectEol.value || 0);
732735
/* Text fields or select lists... */
733
- ['comment_mimetype',
734
- 'comment'
735
- ].forEach(function(name){
736
- var e = E('[name='+name+']');
737
- if(e) fd.append(name,e.value);
738
- });
736
+ fd.append('comment', this.e.taComment.value);
737
+ if(0){
738
+ // Comment mimetype is currently not supported by the UI...
739
+ ['comment_mimetype'
740
+ ].forEach(function(name){
741
+ var e = E('[name='+name+']');
742
+ if(e) fd.append(name,e.value);
743
+ });
744
+ }
739745
/* Checkboxes: */
740746
['allow_fork',
741747
'allow_older',
742748
'exec_bit',
743749
'allow_merge_conflict',
744750
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -468,11 +468,11 @@
468 */
469 const affirmHasFile = function(){
470 if(!P.finfo) F.error("No file is loaded.");
471 return !!P.finfo;
472 };
473
474 /**
475 updateVersion() updates the filename and version in various UI
476 elements...
477
478 Returns this object.
@@ -482,10 +482,12 @@
482 this.finfo = arguments[0];
483 file = this.finfo.filename;
484 rev = this.finfo.checkin;
485 }else if(0===arguments.length){
486 if(!affirmHasFile()) return this;
 
 
487 }else{
488 this.finfo = {filename:file,checkin:rev};
489 }
490 const eTgt = this.e.fsFileVersionDetails.querySelector('div'),
491 rHuman = F.hashDigits(rev),
@@ -514,10 +516,11 @@
514 },false,true);
515 const purl = F.repoUrl('fileedit',purlArgs);
516 D.append(
517 eTgt,"[",D.a(purl,"Editor permalink"),"]"
518 );
 
519 return this;
520 };
521
522 /**
523 Removes the default editor widget (and any dependent elements)
@@ -728,16 +731,19 @@
728 fd.append('checkin', this.finfo.checkin);
729 fd.append('content',content);
730 fd.append('dry_run',isDryRun ? 1 : 0);
731 fd.append('eol', this.e.selectEol.value || 0);
732 /* Text fields or select lists... */
733 ['comment_mimetype',
734 'comment'
735 ].forEach(function(name){
736 var e = E('[name='+name+']');
737 if(e) fd.append(name,e.value);
738 });
 
 
 
739 /* Checkboxes: */
740 ['allow_fork',
741 'allow_older',
742 'exec_bit',
743 'allow_merge_conflict',
744
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -468,11 +468,11 @@
468 */
469 const affirmHasFile = function(){
470 if(!P.finfo) F.error("No file is loaded.");
471 return !!P.finfo;
472 };
473
474 /**
475 updateVersion() updates the filename and version in various UI
476 elements...
477
478 Returns this object.
@@ -482,10 +482,12 @@
482 this.finfo = arguments[0];
483 file = this.finfo.filename;
484 rev = this.finfo.checkin;
485 }else if(0===arguments.length){
486 if(!affirmHasFile()) return this;
487 file = this.finfo.filename;
488 rev = this.finfo.checkin;
489 }else{
490 this.finfo = {filename:file,checkin:rev};
491 }
492 const eTgt = this.e.fsFileVersionDetails.querySelector('div'),
493 rHuman = F.hashDigits(rev),
@@ -514,10 +516,11 @@
516 },false,true);
517 const purl = F.repoUrl('fileedit',purlArgs);
518 D.append(
519 eTgt,"[",D.a(purl,"Editor permalink"),"]"
520 );
521 this.setPageTitle("Edit: "+this.finfo.filename);
522 return this;
523 };
524
525 /**
526 Removes the default editor widget (and any dependent elements)
@@ -728,16 +731,19 @@
731 fd.append('checkin', this.finfo.checkin);
732 fd.append('content',content);
733 fd.append('dry_run',isDryRun ? 1 : 0);
734 fd.append('eol', this.e.selectEol.value || 0);
735 /* Text fields or select lists... */
736 fd.append('comment', this.e.taComment.value);
737 if(0){
738 // Comment mimetype is currently not supported by the UI...
739 ['comment_mimetype'
740 ].forEach(function(name){
741 var e = E('[name='+name+']');
742 if(e) fd.append(name,e.value);
743 });
744 }
745 /* Checkboxes: */
746 ['allow_fork',
747 'allow_older',
748 'exec_bit',
749 'allow_merge_conflict',
750

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button