Fossil SCM

Attempts at beautification: (1) Simplify names of some links/buttons in diff pages. (2) Omit the "Hide Diffs" links, as those are now redundant. (3) Remove the accordion menu from the /ckout page.

drh 2024-12-13 13:29 trunk
Commit 4d2d62d017b08ce1eb9f47bb07d56d07730a8ecaa7922e8f81ece129d94ae881
2 files changed +2 -2 +18 -22
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -50,11 +50,11 @@
5050
has a single file to show (and also a different DOM layout). */
5151
document.querySelectorAll('table.diff').forEach(addToggle);
5252
}
5353
const icm = allToggles.length>1 ? window.fossil.page.diffControlContainer : 0;
5454
if(icm) {
55
- const btnAll = D.addClass(D.a("#", "Toggle all diffs"), "button");
55
+ const btnAll = D.addClass(D.a("#", "Show/Hide"), "button");
5656
D.append( icm, btnAll );
5757
btnAll.addEventListener('click', function(ev){
5858
ev.preventDefault();
5959
ev.stopPropagation();
6060
/* Figure out whether we want to show all or hide all: if any diffs are
@@ -704,11 +704,11 @@
704704
persists across page loads and different apps. */
705705
cbSync = D.checkbox(keySbsScroll, F.storage.getBool(keySbsScroll,true));
706706
D.append(eToggleParent, D.append(
707707
D.addClass(D.create('span'), 'input-with-label'),
708708
D.append(D.create('label'),
709
- cbSync, "Sync side-by-side scrolling")
709
+ cbSync, "Scroll Sync")
710710
));
711711
cbSync.addEventListener('change', function(e){
712712
F.storage.set(keySbsScroll, e.target.checked);
713713
});
714714
}
715715
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -50,11 +50,11 @@
50 has a single file to show (and also a different DOM layout). */
51 document.querySelectorAll('table.diff').forEach(addToggle);
52 }
53 const icm = allToggles.length>1 ? window.fossil.page.diffControlContainer : 0;
54 if(icm) {
55 const btnAll = D.addClass(D.a("#", "Toggle all diffs"), "button");
56 D.append( icm, btnAll );
57 btnAll.addEventListener('click', function(ev){
58 ev.preventDefault();
59 ev.stopPropagation();
60 /* Figure out whether we want to show all or hide all: if any diffs are
@@ -704,11 +704,11 @@
704 persists across page loads and different apps. */
705 cbSync = D.checkbox(keySbsScroll, F.storage.getBool(keySbsScroll,true));
706 D.append(eToggleParent, D.append(
707 D.addClass(D.create('span'), 'input-with-label'),
708 D.append(D.create('label'),
709 cbSync, "Sync side-by-side scrolling")
710 ));
711 cbSync.addEventListener('change', function(e){
712 F.storage.set(keySbsScroll, e.target.checked);
713 });
714 }
715
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -50,11 +50,11 @@
50 has a single file to show (and also a different DOM layout). */
51 document.querySelectorAll('table.diff').forEach(addToggle);
52 }
53 const icm = allToggles.length>1 ? window.fossil.page.diffControlContainer : 0;
54 if(icm) {
55 const btnAll = D.addClass(D.a("#", "Show/Hide"), "button");
56 D.append( icm, btnAll );
57 btnAll.addEventListener('click', function(ev){
58 ev.preventDefault();
59 ev.stopPropagation();
60 /* Figure out whether we want to show all or hide all: if any diffs are
@@ -704,11 +704,11 @@
704 persists across page loads and different apps. */
705 cbSync = D.checkbox(keySbsScroll, F.storage.getBool(keySbsScroll,true));
706 D.append(eToggleParent, D.append(
707 D.addClass(D.create('span'), 'input-with-label'),
708 D.append(D.create('label'),
709 cbSync, "Scroll Sync")
710 ));
711 cbSync.addEventListener('change', function(e){
712 F.storage.set(keySbsScroll, e.target.checked);
713 });
714 }
715
+18 -22
--- src/info.c
+++ src/info.c
@@ -623,10 +623,11 @@
623623
char *zCwd;
624624
int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
625625
DiffConfig DCfg,*pCfg; /* Diff details */
626626
const char *zHome; /* Home directory */
627627
const char *zW; /* The "w" query parameter */
628
+ int nChng; /* Number of changes */
628629
Stmt q;
629630
630631
if( !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){
631632
cgi_redirect("%R/home");
632633
return;
@@ -651,15 +652,18 @@
651652
if( zHostname ){
652653
style_header("Checkout Status: %h on %h", zCwd, zHostname);
653654
}else{
654655
style_header("Checkout Status: %h", zCwd);
655656
}
656
- builtin_request_js("accordion.js");
657
- @ <div class="section accordion">Context</div>
658
- @ <div class="accordion_panel"> <!-- ap-001 -->
659657
render_checkin_context(vid, 0, 0, 0);
660
- @ </div> <!-- ap-001 -->
658
+ nChng = db_int(0, "SELECT count(*) FROM vfile"
659
+ " WHERE vid=%d AND (deleted OR chnged OR rid==0)", vid);
660
+ if( nChng==0 ){
661
+ @ <p>No uncommitted changes</p>
662
+ style_finish_page();
663
+ return;
664
+ }
661665
db_prepare(&q,
662666
/* 0 1 2 3 4 5 6 */
663667
"SELECT pathname, deleted, chnged , rid==0, rid, islink, uuid"
664668
" FROM vfile LEFT JOIN blob USING(rid)"
665669
" WHERE vid=%d"
@@ -670,22 +674,22 @@
670674
if( DCfg.diffFlags & DIFF_SIDEBYSIDE ){
671675
DCfg.diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
672676
}else{
673677
DCfg.diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
674678
}
675
- @ <div class="section accordion">Uncommitted Changes</div>
676
- @ <div class="accordion_panel"> <!-- ap-002 -->
679
+ if( nChng>1 ){
680
+ @ <div class="section">%d(nChng) Uncommitted Changes</div>
681
+ } else {
682
+ @ <div class="section">1 Uncommitted Change</div>
683
+ }
677684
@ <div class="sectionmenu info-changes-menu">
678685
zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
679
- if( diffType!=0 ){
680
- @ %z(chref("button","%R?diff=0"))Hide&nbsp;Diffs</a>
681
- }
682686
if( diffType!=1 ){
683
- @ %z(chref("button","%R?diff=1%s",zW))Unified&nbsp;Diffs</a>
687
+ @ %z(chref("button","%R?diff=1%s",zW))Unified&nbsp;Diff</a>
684688
}
685689
if( diffType!=2 ){
686
- @ %z(chref("button","%R?diff=2%s",zW))Side-by-Side&nbsp;Diffs</a>
690
+ @ %z(chref("button","%R?diff=2%s",zW))Side-by-Side&nbsp;Diff</a>
687691
}
688692
if( diffType!=0 ){
689693
if( *zW ){
690694
@ %z(chref("button","%R?diff=%d",diffType))\
691695
@ Show&nbsp;Whitespace&nbsp;Changes</a>
@@ -750,11 +754,11 @@
750754
blob_reset(&old);
751755
blob_reset(&new);
752756
}
753757
}
754758
db_finalize(&q);
755
- @ </div> <!-- ap-002 -->
759
+ // @ </div> <!-- ap-002 -->
756760
append_diff_javascript(diffType);
757761
style_finish_page();
758762
}
759763
760764
/*
@@ -780,11 +784,10 @@
780784
const char *zParent; /* Hash of the parent check-in (if any) */
781785
const char *zRe; /* regex parameter */
782786
ReCompiled *pRe = 0; /* regex */
783787
const char *zW; /* URL param for ignoring whitespace */
784788
const char *zPage = "vinfo"; /* Page that shows diffs */
785
- const char *zPageHide = "ci"; /* Page that hides diffs */
786789
const char *zBrName; /* Branch name */
787790
DiffConfig DCfg,*pCfg; /* Type of diff */
788791
789792
login_check_credentials();
790793
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
@@ -1050,21 +1053,17 @@
10501053
@ <div class="sectionmenu info-changes-menu">
10511054
/* ^^^ .info-changes-menu is used by diff scroll sync */
10521055
pCfg = construct_diff_flags(diffType, &DCfg);
10531056
DCfg.pRe = pRe;
10541057
zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
1055
- if( diffType!=0 ){
1056
- @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
1057
- @ Hide&nbsp;Diffs</a>
1058
- }
10591058
if( diffType!=1 ){
10601059
@ %z(chref("button","%R/%s/%T?diff=1%s",zPage,zName,zW))\
1061
- @ Unified&nbsp;Diffs</a>
1060
+ @ Unified&nbsp;Diff</a>
10621061
}
10631062
if( diffType!=2 ){
10641063
@ %z(chref("button","%R/%s/%T?diff=2%s",zPage,zName,zW))\
1065
- @ Side-by-Side&nbsp;Diffs</a>
1064
+ @ Side-by-Side&nbsp;Diff</a>
10661065
}
10671066
if( diffType!=0 ){
10681067
if( *zW ){
10691068
@ %z(chref("button","%R/%s/%T",zPage,zName))
10701069
@ Show&nbsp;Whitespace&nbsp;Changes</a>
@@ -1420,13 +1419,10 @@
14201419
cgi_check_for_malice();
14211420
style_set_current_feature("vdiff");
14221421
if( zBranch==0 ){
14231422
style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
14241423
}
1425
- if( diffType!=0 ){
1426
- style_submenu_element("Hide Diff", "%R/vdiff?diff=0&%b%b", &qp, &qpGlob);
1427
- }
14281424
if( diffType!=2 ){
14291425
style_submenu_element("Side-by-Side Diff", "%R/vdiff?diff=2&%b%b", &qp,
14301426
&qpGlob);
14311427
}
14321428
if( diffType!=1 ) {
14331429
--- src/info.c
+++ src/info.c
@@ -623,10 +623,11 @@
623 char *zCwd;
624 int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
625 DiffConfig DCfg,*pCfg; /* Diff details */
626 const char *zHome; /* Home directory */
627 const char *zW; /* The "w" query parameter */
 
628 Stmt q;
629
630 if( !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){
631 cgi_redirect("%R/home");
632 return;
@@ -651,15 +652,18 @@
651 if( zHostname ){
652 style_header("Checkout Status: %h on %h", zCwd, zHostname);
653 }else{
654 style_header("Checkout Status: %h", zCwd);
655 }
656 builtin_request_js("accordion.js");
657 @ <div class="section accordion">Context</div>
658 @ <div class="accordion_panel"> <!-- ap-001 -->
659 render_checkin_context(vid, 0, 0, 0);
660 @ </div> <!-- ap-001 -->
 
 
 
 
 
 
661 db_prepare(&q,
662 /* 0 1 2 3 4 5 6 */
663 "SELECT pathname, deleted, chnged , rid==0, rid, islink, uuid"
664 " FROM vfile LEFT JOIN blob USING(rid)"
665 " WHERE vid=%d"
@@ -670,22 +674,22 @@
670 if( DCfg.diffFlags & DIFF_SIDEBYSIDE ){
671 DCfg.diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
672 }else{
673 DCfg.diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
674 }
675 @ <div class="section accordion">Uncommitted Changes</div>
676 @ <div class="accordion_panel"> <!-- ap-002 -->
 
 
 
677 @ <div class="sectionmenu info-changes-menu">
678 zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
679 if( diffType!=0 ){
680 @ %z(chref("button","%R?diff=0"))Hide&nbsp;Diffs</a>
681 }
682 if( diffType!=1 ){
683 @ %z(chref("button","%R?diff=1%s",zW))Unified&nbsp;Diffs</a>
684 }
685 if( diffType!=2 ){
686 @ %z(chref("button","%R?diff=2%s",zW))Side-by-Side&nbsp;Diffs</a>
687 }
688 if( diffType!=0 ){
689 if( *zW ){
690 @ %z(chref("button","%R?diff=%d",diffType))\
691 @ Show&nbsp;Whitespace&nbsp;Changes</a>
@@ -750,11 +754,11 @@
750 blob_reset(&old);
751 blob_reset(&new);
752 }
753 }
754 db_finalize(&q);
755 @ </div> <!-- ap-002 -->
756 append_diff_javascript(diffType);
757 style_finish_page();
758 }
759
760 /*
@@ -780,11 +784,10 @@
780 const char *zParent; /* Hash of the parent check-in (if any) */
781 const char *zRe; /* regex parameter */
782 ReCompiled *pRe = 0; /* regex */
783 const char *zW; /* URL param for ignoring whitespace */
784 const char *zPage = "vinfo"; /* Page that shows diffs */
785 const char *zPageHide = "ci"; /* Page that hides diffs */
786 const char *zBrName; /* Branch name */
787 DiffConfig DCfg,*pCfg; /* Type of diff */
788
789 login_check_credentials();
790 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
@@ -1050,21 +1053,17 @@
1050 @ <div class="sectionmenu info-changes-menu">
1051 /* ^^^ .info-changes-menu is used by diff scroll sync */
1052 pCfg = construct_diff_flags(diffType, &DCfg);
1053 DCfg.pRe = pRe;
1054 zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
1055 if( diffType!=0 ){
1056 @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
1057 @ Hide&nbsp;Diffs</a>
1058 }
1059 if( diffType!=1 ){
1060 @ %z(chref("button","%R/%s/%T?diff=1%s",zPage,zName,zW))\
1061 @ Unified&nbsp;Diffs</a>
1062 }
1063 if( diffType!=2 ){
1064 @ %z(chref("button","%R/%s/%T?diff=2%s",zPage,zName,zW))\
1065 @ Side-by-Side&nbsp;Diffs</a>
1066 }
1067 if( diffType!=0 ){
1068 if( *zW ){
1069 @ %z(chref("button","%R/%s/%T",zPage,zName))
1070 @ Show&nbsp;Whitespace&nbsp;Changes</a>
@@ -1420,13 +1419,10 @@
1420 cgi_check_for_malice();
1421 style_set_current_feature("vdiff");
1422 if( zBranch==0 ){
1423 style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
1424 }
1425 if( diffType!=0 ){
1426 style_submenu_element("Hide Diff", "%R/vdiff?diff=0&%b%b", &qp, &qpGlob);
1427 }
1428 if( diffType!=2 ){
1429 style_submenu_element("Side-by-Side Diff", "%R/vdiff?diff=2&%b%b", &qp,
1430 &qpGlob);
1431 }
1432 if( diffType!=1 ) {
1433
--- src/info.c
+++ src/info.c
@@ -623,10 +623,11 @@
623 char *zCwd;
624 int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
625 DiffConfig DCfg,*pCfg; /* Diff details */
626 const char *zHome; /* Home directory */
627 const char *zW; /* The "w" query parameter */
628 int nChng; /* Number of changes */
629 Stmt q;
630
631 if( !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){
632 cgi_redirect("%R/home");
633 return;
@@ -651,15 +652,18 @@
652 if( zHostname ){
653 style_header("Checkout Status: %h on %h", zCwd, zHostname);
654 }else{
655 style_header("Checkout Status: %h", zCwd);
656 }
 
 
 
657 render_checkin_context(vid, 0, 0, 0);
658 nChng = db_int(0, "SELECT count(*) FROM vfile"
659 " WHERE vid=%d AND (deleted OR chnged OR rid==0)", vid);
660 if( nChng==0 ){
661 @ <p>No uncommitted changes</p>
662 style_finish_page();
663 return;
664 }
665 db_prepare(&q,
666 /* 0 1 2 3 4 5 6 */
667 "SELECT pathname, deleted, chnged , rid==0, rid, islink, uuid"
668 " FROM vfile LEFT JOIN blob USING(rid)"
669 " WHERE vid=%d"
@@ -670,22 +674,22 @@
674 if( DCfg.diffFlags & DIFF_SIDEBYSIDE ){
675 DCfg.diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
676 }else{
677 DCfg.diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
678 }
679 if( nChng>1 ){
680 @ <div class="section">%d(nChng) Uncommitted Changes</div>
681 } else {
682 @ <div class="section">1 Uncommitted Change</div>
683 }
684 @ <div class="sectionmenu info-changes-menu">
685 zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
 
 
 
686 if( diffType!=1 ){
687 @ %z(chref("button","%R?diff=1%s",zW))Unified&nbsp;Diff</a>
688 }
689 if( diffType!=2 ){
690 @ %z(chref("button","%R?diff=2%s",zW))Side-by-Side&nbsp;Diff</a>
691 }
692 if( diffType!=0 ){
693 if( *zW ){
694 @ %z(chref("button","%R?diff=%d",diffType))\
695 @ Show&nbsp;Whitespace&nbsp;Changes</a>
@@ -750,11 +754,11 @@
754 blob_reset(&old);
755 blob_reset(&new);
756 }
757 }
758 db_finalize(&q);
759 // @ </div> <!-- ap-002 -->
760 append_diff_javascript(diffType);
761 style_finish_page();
762 }
763
764 /*
@@ -780,11 +784,10 @@
784 const char *zParent; /* Hash of the parent check-in (if any) */
785 const char *zRe; /* regex parameter */
786 ReCompiled *pRe = 0; /* regex */
787 const char *zW; /* URL param for ignoring whitespace */
788 const char *zPage = "vinfo"; /* Page that shows diffs */
 
789 const char *zBrName; /* Branch name */
790 DiffConfig DCfg,*pCfg; /* Type of diff */
791
792 login_check_credentials();
793 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
@@ -1050,21 +1053,17 @@
1053 @ <div class="sectionmenu info-changes-menu">
1054 /* ^^^ .info-changes-menu is used by diff scroll sync */
1055 pCfg = construct_diff_flags(diffType, &DCfg);
1056 DCfg.pRe = pRe;
1057 zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
 
 
 
 
1058 if( diffType!=1 ){
1059 @ %z(chref("button","%R/%s/%T?diff=1%s",zPage,zName,zW))\
1060 @ Unified&nbsp;Diff</a>
1061 }
1062 if( diffType!=2 ){
1063 @ %z(chref("button","%R/%s/%T?diff=2%s",zPage,zName,zW))\
1064 @ Side-by-Side&nbsp;Diff</a>
1065 }
1066 if( diffType!=0 ){
1067 if( *zW ){
1068 @ %z(chref("button","%R/%s/%T",zPage,zName))
1069 @ Show&nbsp;Whitespace&nbsp;Changes</a>
@@ -1420,13 +1419,10 @@
1419 cgi_check_for_malice();
1420 style_set_current_feature("vdiff");
1421 if( zBranch==0 ){
1422 style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
1423 }
 
 
 
1424 if( diffType!=2 ){
1425 style_submenu_element("Side-by-Side Diff", "%R/vdiff?diff=2&%b%b", &qp,
1426 &qpGlob);
1427 }
1428 if( diffType!=1 ) {
1429

Keyboard Shortcuts

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