Fossil SCM

Several layout tweaks. The 'Prefer delta?' option is now checked by default if the repo contains any deltas and the forbid-delta-manifests setting is not true (that setting trumps this checkbox, in any case).

stephan 2020-05-17 03:35 fileedit-ajaxify
Commit 25f5f592d17569411c5dca976885156029df487d31c08f54ca5ad5006f9fbdb2
+7 -5
--- src/fileedit.c
+++ src/fileedit.c
@@ -1836,31 +1836,30 @@
18361836
/* Main tab container... */
18371837
CX("<div id='fileedit-tabs' class='tab-container'></div>");
18381838
18391839
/***** File/version info tab *****/
18401840
{
1841
- CX("<div id='fileedit-tab-version' "
1841
+ CX("<div id='fileedit-tab-fileselect' "
18421842
"data-tab-parent='fileedit-tabs' "
18431843
"data-tab-label='File Info &amp; Selection'"
18441844
">");
18451845
CX("<fieldset id='file-version-details'>"
18461846
"<legend>File/Version</legend>"
18471847
"<div>No file loaded.</div>"
18481848
"</fieldset>");
18491849
CX("<h1>Select a file to edit:</h1>");
18501850
CX("<div id='fileedit-file-selector'></div>");
1851
- CX("</div>"/*#fileedit-tab-version*/);
1851
+ CX("</div>"/*#fileedit-tab-fileselect*/);
18521852
}
18531853
18541854
/******* Content tab *******/
18551855
{
18561856
CX("<div id='fileedit-tab-content' "
18571857
"data-tab-parent='fileedit-tabs' "
18581858
"data-tab-label='File Content'"
18591859
">");
1860
- CX("<div class='fileedit-options "
1861
- "flex-container flex-row child-gap-small'>");
1860
+ CX("<div class='flex-container flex-row child-gap-small'>");
18621861
CX("<button class='fileedit-content-reload confirmer' "
18631862
"title='Reload the file from the server, discarding "
18641863
"any local edits. To help avoid accidental loss of "
18651864
"edits, it requires confirmation (a second click) within "
18661865
"a few seconds or it will not reload.'"
@@ -2028,11 +2027,14 @@
20282027
"what appear to be fossil merge conflict "
20292028
"markers?");
20302029
style_labeled_checkbox("cb-prefer-delta",
20312030
"prefer_delta",
20322031
"Prefer delta manifest?", "1",
2033
- cimi.flags & CIMINI_PREFER_DELTA,
2032
+ db_get_boolean("forbid-delta-manifests",0)
2033
+ ? 0
2034
+ : (db_get_boolean("seen-delta-manifest",0)
2035
+ || cimi.flags & CIMINI_PREFER_DELTA),
20342036
"Will create a delta manifest, instead of "
20352037
"baseline, if conditions are favorable to "
20362038
"do so. This option is only a suggestion.");
20372039
style_select_list_int("select-eol-style",
20382040
"eol", "EOL Style",
20392041
--- src/fileedit.c
+++ src/fileedit.c
@@ -1836,31 +1836,30 @@
1836 /* Main tab container... */
1837 CX("<div id='fileedit-tabs' class='tab-container'></div>");
1838
1839 /***** File/version info tab *****/
1840 {
1841 CX("<div id='fileedit-tab-version' "
1842 "data-tab-parent='fileedit-tabs' "
1843 "data-tab-label='File Info &amp; Selection'"
1844 ">");
1845 CX("<fieldset id='file-version-details'>"
1846 "<legend>File/Version</legend>"
1847 "<div>No file loaded.</div>"
1848 "</fieldset>");
1849 CX("<h1>Select a file to edit:</h1>");
1850 CX("<div id='fileedit-file-selector'></div>");
1851 CX("</div>"/*#fileedit-tab-version*/);
1852 }
1853
1854 /******* Content tab *******/
1855 {
1856 CX("<div id='fileedit-tab-content' "
1857 "data-tab-parent='fileedit-tabs' "
1858 "data-tab-label='File Content'"
1859 ">");
1860 CX("<div class='fileedit-options "
1861 "flex-container flex-row child-gap-small'>");
1862 CX("<button class='fileedit-content-reload confirmer' "
1863 "title='Reload the file from the server, discarding "
1864 "any local edits. To help avoid accidental loss of "
1865 "edits, it requires confirmation (a second click) within "
1866 "a few seconds or it will not reload.'"
@@ -2028,11 +2027,14 @@
2028 "what appear to be fossil merge conflict "
2029 "markers?");
2030 style_labeled_checkbox("cb-prefer-delta",
2031 "prefer_delta",
2032 "Prefer delta manifest?", "1",
2033 cimi.flags & CIMINI_PREFER_DELTA,
 
 
 
2034 "Will create a delta manifest, instead of "
2035 "baseline, if conditions are favorable to "
2036 "do so. This option is only a suggestion.");
2037 style_select_list_int("select-eol-style",
2038 "eol", "EOL Style",
2039
--- src/fileedit.c
+++ src/fileedit.c
@@ -1836,31 +1836,30 @@
1836 /* Main tab container... */
1837 CX("<div id='fileedit-tabs' class='tab-container'></div>");
1838
1839 /***** File/version info tab *****/
1840 {
1841 CX("<div id='fileedit-tab-fileselect' "
1842 "data-tab-parent='fileedit-tabs' "
1843 "data-tab-label='File Info &amp; Selection'"
1844 ">");
1845 CX("<fieldset id='file-version-details'>"
1846 "<legend>File/Version</legend>"
1847 "<div>No file loaded.</div>"
1848 "</fieldset>");
1849 CX("<h1>Select a file to edit:</h1>");
1850 CX("<div id='fileedit-file-selector'></div>");
1851 CX("</div>"/*#fileedit-tab-fileselect*/);
1852 }
1853
1854 /******* Content tab *******/
1855 {
1856 CX("<div id='fileedit-tab-content' "
1857 "data-tab-parent='fileedit-tabs' "
1858 "data-tab-label='File Content'"
1859 ">");
1860 CX("<div class='flex-container flex-row child-gap-small'>");
 
1861 CX("<button class='fileedit-content-reload confirmer' "
1862 "title='Reload the file from the server, discarding "
1863 "any local edits. To help avoid accidental loss of "
1864 "edits, it requires confirmation (a second click) within "
1865 "a few seconds or it will not reload.'"
@@ -2028,11 +2027,14 @@
2027 "what appear to be fossil merge conflict "
2028 "markers?");
2029 style_labeled_checkbox("cb-prefer-delta",
2030 "prefer_delta",
2031 "Prefer delta manifest?", "1",
2032 db_get_boolean("forbid-delta-manifests",0)
2033 ? 0
2034 : (db_get_boolean("seen-delta-manifest",0)
2035 || cimi.flags & CIMINI_PREFER_DELTA),
2036 "Will create a delta manifest, instead of "
2037 "baseline, if conditions are favorable to "
2038 "do so. This option is only a suggestion.");
2039 style_select_list_int("select-eol-style",
2040 "eol", "EOL Style",
2041
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -445,19 +445,17 @@
445445
Widget for listing and selecting $stash entries.
446446
*/
447447
P.stashWidget = {
448448
e:{/*DOM element(s)*/},
449449
init: function(domInsertPoint/*insert widget BEFORE this element*/){
450
- const flow = D.addClass(D.div(), 'flex-container','flex-column');
451450
const wrapper = D.addClass(
452451
D.attr(D.div(),'id','fileedit-stash-selector'),
453452
'input-with-label'
454453
);
455454
const sel = this.e.select = D.select();
456455
const btnClear = this.e.btnClear
457456
= D.addClass(D.button("Clear"),'hidden');
458
- D.append(flow, wrapper);
459457
D.append(wrapper, "Local edits (",
460458
D.append(D.code(),
461459
F.storage.storageImplName()),
462460
"):",
463461
sel, btnClear);
@@ -477,18 +475,19 @@
477475
F.confirmer(btnClear, {
478476
confirmText: "REALLY delete ALL local edits?",
479477
onconfirm: (e)=>P.clearStash().loadFile(/*in case P.finfo() was in the stash*/),
480478
ticks: 3
481479
});
482
- if(F.storage.isTransient()){/*Warn if transient storage is in use...*/
483
- D.append(flow, D.append(D.addClass(D.div(),'warning'),
484
- "Warning: persistent storage is not avaible, "+
485
- "so uncomitted edits will not survive a page reload.")
486
- );
487
- }
488
- domInsertPoint.parentNode.insertBefore(flow, domInsertPoint);
489
- $stash._fireStashEvent(/*update this object with the load-time stash*/);
480
+ if(F.storage.isTransient()){/*Warn if our storage is particularly transient...*/
481
+ D.append(wrapper, D.append(
482
+ D.addClass(D.span(),'warning'),
483
+ "Warning: persistent storage is not available, "+
484
+ "so uncomitted edits will not survive a page reload."
485
+ ));
486
+ }
487
+ domInsertPoint.parentNode.insertBefore(wrapper, domInsertPoint);
488
+ $stash._fireStashEvent(/*read the page-load-time stash*/);
490489
delete this.init;
491490
},
492491
/**
493492
Regenerates the edit selection list.
494493
*/
@@ -571,12 +570,11 @@
571570
taCommentSmall: E('#fileedit-comment'),
572571
taCommentBig: E('#fileedit-comment-big'),
573572
taComment: undefined/*gets set to one of taComment{Big,Small}*/,
574573
ajaxContentTarget: E('#ajax-target'),
575574
btnCommit: E("#fileedit-btn-commit"),
576
- btnReload: E("#fileedit-tab-content > .fileedit-options > "
577
- +"button.fileedit-content-reload"),
575
+ btnReload: E("#fileedit-tab-content button.fileedit-content-reload"),
578576
selectPreviewMode: E('#select-preview-mode select'),
579577
selectHtmlEmsWrap: E('#select-preview-html-ems'),
580578
selectEolWrap: E('#select-eol-style'),
581579
selectEol: E('#select-eol-style select[name=eol]'),
582580
selectFontSizeWrap: E('#select-font-size'),
@@ -591,11 +589,12 @@
591589
fsFileVersionDetails: E('#file-version-details'),
592590
tabs:{
593591
content: E('#fileedit-tab-content'),
594592
preview: E('#fileedit-tab-preview'),
595593
diff: E('#fileedit-tab-diff'),
596
- commit: E('#fileedit-tab-commit')
594
+ commit: E('#fileedit-tab-commit'),
595
+ fileSelect: E('#fileedit-tab-fileselect')
597596
}
598597
};
599598
/* Figure out which comment editor to show by default and
600599
hide the other one. By default we take the one which does
601600
not have the 'hidden' CSS class. If neither do, we default
@@ -621,18 +620,31 @@
621620
/* Set up auto-refresh of the preview tab... */
622621
'before-switch-to', function(ev){
623622
if(ev.detail===P.e.tabs.preview){
624623
P.baseHrefForFile();
625624
if(P.e.cbAutoPreview.checked) P.preview();
625
+ }else if(ev.detail===P.e.tabs.diff){
626
+ /* Work around a weird bug where the page gets wider than
627
+ the window when the diff tab is NOT in view and the
628
+ current SBS diff widget is wider than the window. When
629
+ the diff IS in view then CSS overflow magically reduces
630
+ the page size again. Weird. Maybe FF-specific. Note that
631
+ this weirdness happens even though P.e.diffTarget's parent
632
+ is hidden (and therefore P.e.diffTarget is also hidden).
633
+ */
634
+ D.removeClass(P.e.diffTarget, 'hidden');
626635
}
627636
}
628637
);
629638
P.tabs.addEventListener(
630639
/* Set up auto-refresh of the preview tab... */
631640
'before-switch-from', function(ev){
632641
if(ev.detail===P.e.tabs.preview){
633642
P.baseHrefRestore();
643
+ }else if(ev.detail===P.e.tabs.diff){
644
+ /* See notes in the before-switch-to handler. */
645
+ D.addClass(P.e.diffTarget, 'hidden');
634646
}
635647
}
636648
);
637649
638650
F.connectPagePreviewers(
@@ -722,11 +734,14 @@
722734
}
723735
}
724736
);
725737
726738
P.fileSelectWidget.init();
727
- P.stashWidget.init(P.e.tabs.content.lastElementChild);
739
+ P.stashWidget.init(
740
+ P.e.tabs.content.lastElementChild
741
+ //P.e.tabs.fileSelect.querySelector("h1")
742
+ );
728743
}/*F.onPageLoad()*/);
729744
730745
/**
731746
Getter (if called with no args) or setter (if passed an arg) for
732747
the current file content.
733748
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -445,19 +445,17 @@
445 Widget for listing and selecting $stash entries.
446 */
447 P.stashWidget = {
448 e:{/*DOM element(s)*/},
449 init: function(domInsertPoint/*insert widget BEFORE this element*/){
450 const flow = D.addClass(D.div(), 'flex-container','flex-column');
451 const wrapper = D.addClass(
452 D.attr(D.div(),'id','fileedit-stash-selector'),
453 'input-with-label'
454 );
455 const sel = this.e.select = D.select();
456 const btnClear = this.e.btnClear
457 = D.addClass(D.button("Clear"),'hidden');
458 D.append(flow, wrapper);
459 D.append(wrapper, "Local edits (",
460 D.append(D.code(),
461 F.storage.storageImplName()),
462 "):",
463 sel, btnClear);
@@ -477,18 +475,19 @@
477 F.confirmer(btnClear, {
478 confirmText: "REALLY delete ALL local edits?",
479 onconfirm: (e)=>P.clearStash().loadFile(/*in case P.finfo() was in the stash*/),
480 ticks: 3
481 });
482 if(F.storage.isTransient()){/*Warn if transient storage is in use...*/
483 D.append(flow, D.append(D.addClass(D.div(),'warning'),
484 "Warning: persistent storage is not avaible, "+
485 "so uncomitted edits will not survive a page reload.")
486 );
487 }
488 domInsertPoint.parentNode.insertBefore(flow, domInsertPoint);
489 $stash._fireStashEvent(/*update this object with the load-time stash*/);
 
490 delete this.init;
491 },
492 /**
493 Regenerates the edit selection list.
494 */
@@ -571,12 +570,11 @@
571 taCommentSmall: E('#fileedit-comment'),
572 taCommentBig: E('#fileedit-comment-big'),
573 taComment: undefined/*gets set to one of taComment{Big,Small}*/,
574 ajaxContentTarget: E('#ajax-target'),
575 btnCommit: E("#fileedit-btn-commit"),
576 btnReload: E("#fileedit-tab-content > .fileedit-options > "
577 +"button.fileedit-content-reload"),
578 selectPreviewMode: E('#select-preview-mode select'),
579 selectHtmlEmsWrap: E('#select-preview-html-ems'),
580 selectEolWrap: E('#select-eol-style'),
581 selectEol: E('#select-eol-style select[name=eol]'),
582 selectFontSizeWrap: E('#select-font-size'),
@@ -591,11 +589,12 @@
591 fsFileVersionDetails: E('#file-version-details'),
592 tabs:{
593 content: E('#fileedit-tab-content'),
594 preview: E('#fileedit-tab-preview'),
595 diff: E('#fileedit-tab-diff'),
596 commit: E('#fileedit-tab-commit')
 
597 }
598 };
599 /* Figure out which comment editor to show by default and
600 hide the other one. By default we take the one which does
601 not have the 'hidden' CSS class. If neither do, we default
@@ -621,18 +620,31 @@
621 /* Set up auto-refresh of the preview tab... */
622 'before-switch-to', function(ev){
623 if(ev.detail===P.e.tabs.preview){
624 P.baseHrefForFile();
625 if(P.e.cbAutoPreview.checked) P.preview();
 
 
 
 
 
 
 
 
 
 
626 }
627 }
628 );
629 P.tabs.addEventListener(
630 /* Set up auto-refresh of the preview tab... */
631 'before-switch-from', function(ev){
632 if(ev.detail===P.e.tabs.preview){
633 P.baseHrefRestore();
 
 
 
634 }
635 }
636 );
637
638 F.connectPagePreviewers(
@@ -722,11 +734,14 @@
722 }
723 }
724 );
725
726 P.fileSelectWidget.init();
727 P.stashWidget.init(P.e.tabs.content.lastElementChild);
 
 
 
728 }/*F.onPageLoad()*/);
729
730 /**
731 Getter (if called with no args) or setter (if passed an arg) for
732 the current file content.
733
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -445,19 +445,17 @@
445 Widget for listing and selecting $stash entries.
446 */
447 P.stashWidget = {
448 e:{/*DOM element(s)*/},
449 init: function(domInsertPoint/*insert widget BEFORE this element*/){
 
450 const wrapper = D.addClass(
451 D.attr(D.div(),'id','fileedit-stash-selector'),
452 'input-with-label'
453 );
454 const sel = this.e.select = D.select();
455 const btnClear = this.e.btnClear
456 = D.addClass(D.button("Clear"),'hidden');
 
457 D.append(wrapper, "Local edits (",
458 D.append(D.code(),
459 F.storage.storageImplName()),
460 "):",
461 sel, btnClear);
@@ -477,18 +475,19 @@
475 F.confirmer(btnClear, {
476 confirmText: "REALLY delete ALL local edits?",
477 onconfirm: (e)=>P.clearStash().loadFile(/*in case P.finfo() was in the stash*/),
478 ticks: 3
479 });
480 if(F.storage.isTransient()){/*Warn if our storage is particularly transient...*/
481 D.append(wrapper, D.append(
482 D.addClass(D.span(),'warning'),
483 "Warning: persistent storage is not available, "+
484 "so uncomitted edits will not survive a page reload."
485 ));
486 }
487 domInsertPoint.parentNode.insertBefore(wrapper, domInsertPoint);
488 $stash._fireStashEvent(/*read the page-load-time stash*/);
489 delete this.init;
490 },
491 /**
492 Regenerates the edit selection list.
493 */
@@ -571,12 +570,11 @@
570 taCommentSmall: E('#fileedit-comment'),
571 taCommentBig: E('#fileedit-comment-big'),
572 taComment: undefined/*gets set to one of taComment{Big,Small}*/,
573 ajaxContentTarget: E('#ajax-target'),
574 btnCommit: E("#fileedit-btn-commit"),
575 btnReload: E("#fileedit-tab-content button.fileedit-content-reload"),
 
576 selectPreviewMode: E('#select-preview-mode select'),
577 selectHtmlEmsWrap: E('#select-preview-html-ems'),
578 selectEolWrap: E('#select-eol-style'),
579 selectEol: E('#select-eol-style select[name=eol]'),
580 selectFontSizeWrap: E('#select-font-size'),
@@ -591,11 +589,12 @@
589 fsFileVersionDetails: E('#file-version-details'),
590 tabs:{
591 content: E('#fileedit-tab-content'),
592 preview: E('#fileedit-tab-preview'),
593 diff: E('#fileedit-tab-diff'),
594 commit: E('#fileedit-tab-commit'),
595 fileSelect: E('#fileedit-tab-fileselect')
596 }
597 };
598 /* Figure out which comment editor to show by default and
599 hide the other one. By default we take the one which does
600 not have the 'hidden' CSS class. If neither do, we default
@@ -621,18 +620,31 @@
620 /* Set up auto-refresh of the preview tab... */
621 'before-switch-to', function(ev){
622 if(ev.detail===P.e.tabs.preview){
623 P.baseHrefForFile();
624 if(P.e.cbAutoPreview.checked) P.preview();
625 }else if(ev.detail===P.e.tabs.diff){
626 /* Work around a weird bug where the page gets wider than
627 the window when the diff tab is NOT in view and the
628 current SBS diff widget is wider than the window. When
629 the diff IS in view then CSS overflow magically reduces
630 the page size again. Weird. Maybe FF-specific. Note that
631 this weirdness happens even though P.e.diffTarget's parent
632 is hidden (and therefore P.e.diffTarget is also hidden).
633 */
634 D.removeClass(P.e.diffTarget, 'hidden');
635 }
636 }
637 );
638 P.tabs.addEventListener(
639 /* Set up auto-refresh of the preview tab... */
640 'before-switch-from', function(ev){
641 if(ev.detail===P.e.tabs.preview){
642 P.baseHrefRestore();
643 }else if(ev.detail===P.e.tabs.diff){
644 /* See notes in the before-switch-to handler. */
645 D.addClass(P.e.diffTarget, 'hidden');
646 }
647 }
648 );
649
650 F.connectPagePreviewers(
@@ -722,11 +734,14 @@
734 }
735 }
736 );
737
738 P.fileSelectWidget.init();
739 P.stashWidget.init(
740 P.e.tabs.content.lastElementChild
741 //P.e.tabs.fileSelect.querySelector("h1")
742 );
743 }/*F.onPageLoad()*/);
744
745 /**
746 Getter (if called with no args) or setter (if passed an arg) for
747 the current file content.
748

Keyboard Shortcuts

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