Fossil SCM
Get /vinfo's About view ported to a DETAILS tag, collapsed by default.
Commit
5628e2c9eddecfeb783b15d3a3de38950dcfae089999f18731c95e6ba0281f2b
Parent
eaf8ba3c80a7b77…
2 files changed
+4
-1
+21
-4
+4
-1
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -1244,13 +1244,16 @@ | ||
| 1244 | 1244 | display: none; |
| 1245 | 1245 | } |
| 1246 | 1246 | .accordion_closed > .accordion_btn_plus { |
| 1247 | 1247 | display: inline-block; |
| 1248 | 1248 | } |
| 1249 | -.accordion_panel { | |
| 1249 | +.accordion_panel, details > div { | |
| 1250 | 1250 | overflow-y: clip; |
| 1251 | 1251 | transition: max-height 0.25s ease-out; |
| 1252 | +} | |
| 1253 | +details > summary.section { | |
| 1254 | + cursor: pointer; | |
| 1252 | 1255 | } |
| 1253 | 1256 | .error { |
| 1254 | 1257 | color: darkred; |
| 1255 | 1258 | background: yellow; |
| 1256 | 1259 | } |
| 1257 | 1260 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1244,13 +1244,16 @@ | |
| 1244 | display: none; |
| 1245 | } |
| 1246 | .accordion_closed > .accordion_btn_plus { |
| 1247 | display: inline-block; |
| 1248 | } |
| 1249 | .accordion_panel { |
| 1250 | overflow-y: clip; |
| 1251 | transition: max-height 0.25s ease-out; |
| 1252 | } |
| 1253 | .error { |
| 1254 | color: darkred; |
| 1255 | background: yellow; |
| 1256 | } |
| 1257 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1244,13 +1244,16 @@ | |
| 1244 | display: none; |
| 1245 | } |
| 1246 | .accordion_closed > .accordion_btn_plus { |
| 1247 | display: inline-block; |
| 1248 | } |
| 1249 | .accordion_panel, details > div { |
| 1250 | overflow-y: clip; |
| 1251 | transition: max-height 0.25s ease-out; |
| 1252 | } |
| 1253 | details > summary.section { |
| 1254 | cursor: pointer; |
| 1255 | } |
| 1256 | .error { |
| 1257 | color: darkred; |
| 1258 | background: yellow; |
| 1259 | } |
| 1260 |
+21
-4
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -2527,10 +2527,11 @@ | ||
| 2527 | 2527 | #if INTERFACE |
| 2528 | 2528 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 2529 | 2529 | #define WIKIASSOC_MENU_READ 0x00002 /* Add submenu link to read wiki */ |
| 2530 | 2530 | #define WIKIASSOC_MENU_WRITE 0x00004 /* Add submenu link to add wiki */ |
| 2531 | 2531 | #define WIKIASSOC_ALL 0x00007 /* All of the above */ |
| 2532 | +#define WIKIASSOC_REVEAL 0x00008 /* Reveal content by default */ | |
| 2532 | 2533 | #endif |
| 2533 | 2534 | |
| 2534 | 2535 | /* |
| 2535 | 2536 | ** Show the default Section label for an associated wiki page. |
| 2536 | 2537 | */ |
| @@ -2544,10 +2545,24 @@ | ||
| 2544 | 2545 | }else if( zPrefix[0]=='c' ){ /* checkin/... */ |
| 2545 | 2546 | @ <div class="section accordion">About check-in %.20h(zName)</div> |
| 2546 | 2547 | }else{ |
| 2547 | 2548 | @ <div class="section accordion">About %s(zPrefix) %h(zName)</div> |
| 2548 | 2549 | } |
| 2550 | +} | |
| 2551 | +/* Temporary refactoring crutch */ | |
| 2552 | +static void wiki_section_label_v2( | |
| 2553 | + const char *zPrefix, /* "branch", "tag", or "checkin" */ | |
| 2554 | + const char *zName, /* Name of the object */ | |
| 2555 | + unsigned int mFlags /* Zero or more WIKIASSOC_* flags */ | |
| 2556 | +){ | |
| 2557 | + if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){ | |
| 2558 | + @ <summary class="section">About</summary> | |
| 2559 | + }else if( zPrefix[0]=='c' ){ /* checkin/... */ | |
| 2560 | + @ <summary class="section accordion">About check-in %.20h(zName)</summary> | |
| 2561 | + }else{ | |
| 2562 | + @ <summary class="section accordion">About %s(zPrefix) %h(zName)</summary> | |
| 2563 | + } | |
| 2549 | 2564 | } |
| 2550 | 2565 | |
| 2551 | 2566 | /* |
| 2552 | 2567 | ** Add an "Wiki" button in a submenu that links to the read-wiki page. |
| 2553 | 2568 | */ |
| @@ -2604,20 +2619,21 @@ | ||
| 2604 | 2619 | style_submenu_element("Add Wiki", "%R/wikiedit?name=%s/%t", |
| 2605 | 2620 | zPrefix, zName); |
| 2606 | 2621 | } |
| 2607 | 2622 | return 0; |
| 2608 | 2623 | } |
| 2624 | + @ <details %s((WIKIASSOC_REVEAL & mFlags) ? "open" : "")> | |
| 2609 | 2625 | if( fossil_strcmp(pWiki->zMimetype, "text/x-markdown")==0 ){ |
| 2610 | 2626 | Blob tail = BLOB_INITIALIZER; |
| 2611 | 2627 | Blob title = BLOB_INITIALIZER; |
| 2612 | 2628 | Blob markdown; |
| 2613 | 2629 | blob_init(&markdown, pWiki->zWiki, -1); |
| 2614 | 2630 | markdown_to_html(&markdown, &title, &tail); |
| 2615 | 2631 | if( blob_size(&title) ){ |
| 2616 | - @ <div class="section accordion">%h(blob_str(&title))</div> | |
| 2632 | + @ <summary class="section">%h(blob_str(&title))</summary> | |
| 2617 | 2633 | }else{ |
| 2618 | - wiki_section_label(zPrefix, zName, mFlags); | |
| 2634 | + wiki_section_label_v2(zPrefix, zName, mFlags); | |
| 2619 | 2635 | } |
| 2620 | 2636 | wiki_submenu_to_read_wiki(zPrefix, zName, mFlags); |
| 2621 | 2637 | wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags); |
| 2622 | 2638 | @ <div class="accordion_panel"> |
| 2623 | 2639 | safe_html_context(DOCSRC_WIKI); |
| @@ -2638,14 +2654,14 @@ | ||
| 2638 | 2654 | Blob title = BLOB_INITIALIZER; |
| 2639 | 2655 | Blob wiki; |
| 2640 | 2656 | Blob *pBody; |
| 2641 | 2657 | blob_init(&wiki, pWiki->zWiki, -1); |
| 2642 | 2658 | if( wiki_find_title(&wiki, &title, &tail) ){ |
| 2643 | - @ <div class="section accordion">%h(blob_str(&title))</div> | |
| 2659 | + @ <summary class="section">%h(blob_str(&title))</summary> | |
| 2644 | 2660 | pBody = &tail; |
| 2645 | 2661 | }else{ |
| 2646 | - wiki_section_label(zPrefix, zName, mFlags); | |
| 2662 | + wiki_section_label_v2(zPrefix, zName, mFlags); | |
| 2647 | 2663 | pBody = &wiki; |
| 2648 | 2664 | } |
| 2649 | 2665 | wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags); |
| 2650 | 2666 | @ <div class="accordion_panel"><div class="wiki"> |
| 2651 | 2667 | wiki_convert(pBody, 0, WIKI_BUTTONS); |
| @@ -2652,9 +2668,10 @@ | ||
| 2652 | 2668 | @ </div></div> |
| 2653 | 2669 | blob_reset(&tail); |
| 2654 | 2670 | blob_reset(&title); |
| 2655 | 2671 | blob_reset(&wiki); |
| 2656 | 2672 | } |
| 2673 | + @ </details> | |
| 2657 | 2674 | manifest_destroy(pWiki); |
| 2658 | 2675 | builtin_request_js("accordion.js"); |
| 2659 | 2676 | return 1; |
| 2660 | 2677 | } |
| 2661 | 2678 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -2527,10 +2527,11 @@ | |
| 2527 | #if INTERFACE |
| 2528 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 2529 | #define WIKIASSOC_MENU_READ 0x00002 /* Add submenu link to read wiki */ |
| 2530 | #define WIKIASSOC_MENU_WRITE 0x00004 /* Add submenu link to add wiki */ |
| 2531 | #define WIKIASSOC_ALL 0x00007 /* All of the above */ |
| 2532 | #endif |
| 2533 | |
| 2534 | /* |
| 2535 | ** Show the default Section label for an associated wiki page. |
| 2536 | */ |
| @@ -2544,10 +2545,24 @@ | |
| 2544 | }else if( zPrefix[0]=='c' ){ /* checkin/... */ |
| 2545 | @ <div class="section accordion">About check-in %.20h(zName)</div> |
| 2546 | }else{ |
| 2547 | @ <div class="section accordion">About %s(zPrefix) %h(zName)</div> |
| 2548 | } |
| 2549 | } |
| 2550 | |
| 2551 | /* |
| 2552 | ** Add an "Wiki" button in a submenu that links to the read-wiki page. |
| 2553 | */ |
| @@ -2604,20 +2619,21 @@ | |
| 2604 | style_submenu_element("Add Wiki", "%R/wikiedit?name=%s/%t", |
| 2605 | zPrefix, zName); |
| 2606 | } |
| 2607 | return 0; |
| 2608 | } |
| 2609 | if( fossil_strcmp(pWiki->zMimetype, "text/x-markdown")==0 ){ |
| 2610 | Blob tail = BLOB_INITIALIZER; |
| 2611 | Blob title = BLOB_INITIALIZER; |
| 2612 | Blob markdown; |
| 2613 | blob_init(&markdown, pWiki->zWiki, -1); |
| 2614 | markdown_to_html(&markdown, &title, &tail); |
| 2615 | if( blob_size(&title) ){ |
| 2616 | @ <div class="section accordion">%h(blob_str(&title))</div> |
| 2617 | }else{ |
| 2618 | wiki_section_label(zPrefix, zName, mFlags); |
| 2619 | } |
| 2620 | wiki_submenu_to_read_wiki(zPrefix, zName, mFlags); |
| 2621 | wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags); |
| 2622 | @ <div class="accordion_panel"> |
| 2623 | safe_html_context(DOCSRC_WIKI); |
| @@ -2638,14 +2654,14 @@ | |
| 2638 | Blob title = BLOB_INITIALIZER; |
| 2639 | Blob wiki; |
| 2640 | Blob *pBody; |
| 2641 | blob_init(&wiki, pWiki->zWiki, -1); |
| 2642 | if( wiki_find_title(&wiki, &title, &tail) ){ |
| 2643 | @ <div class="section accordion">%h(blob_str(&title))</div> |
| 2644 | pBody = &tail; |
| 2645 | }else{ |
| 2646 | wiki_section_label(zPrefix, zName, mFlags); |
| 2647 | pBody = &wiki; |
| 2648 | } |
| 2649 | wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags); |
| 2650 | @ <div class="accordion_panel"><div class="wiki"> |
| 2651 | wiki_convert(pBody, 0, WIKI_BUTTONS); |
| @@ -2652,9 +2668,10 @@ | |
| 2652 | @ </div></div> |
| 2653 | blob_reset(&tail); |
| 2654 | blob_reset(&title); |
| 2655 | blob_reset(&wiki); |
| 2656 | } |
| 2657 | manifest_destroy(pWiki); |
| 2658 | builtin_request_js("accordion.js"); |
| 2659 | return 1; |
| 2660 | } |
| 2661 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -2527,10 +2527,11 @@ | |
| 2527 | #if INTERFACE |
| 2528 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 2529 | #define WIKIASSOC_MENU_READ 0x00002 /* Add submenu link to read wiki */ |
| 2530 | #define WIKIASSOC_MENU_WRITE 0x00004 /* Add submenu link to add wiki */ |
| 2531 | #define WIKIASSOC_ALL 0x00007 /* All of the above */ |
| 2532 | #define WIKIASSOC_REVEAL 0x00008 /* Reveal content by default */ |
| 2533 | #endif |
| 2534 | |
| 2535 | /* |
| 2536 | ** Show the default Section label for an associated wiki page. |
| 2537 | */ |
| @@ -2544,10 +2545,24 @@ | |
| 2545 | }else if( zPrefix[0]=='c' ){ /* checkin/... */ |
| 2546 | @ <div class="section accordion">About check-in %.20h(zName)</div> |
| 2547 | }else{ |
| 2548 | @ <div class="section accordion">About %s(zPrefix) %h(zName)</div> |
| 2549 | } |
| 2550 | } |
| 2551 | /* Temporary refactoring crutch */ |
| 2552 | static void wiki_section_label_v2( |
| 2553 | const char *zPrefix, /* "branch", "tag", or "checkin" */ |
| 2554 | const char *zName, /* Name of the object */ |
| 2555 | unsigned int mFlags /* Zero or more WIKIASSOC_* flags */ |
| 2556 | ){ |
| 2557 | if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){ |
| 2558 | @ <summary class="section">About</summary> |
| 2559 | }else if( zPrefix[0]=='c' ){ /* checkin/... */ |
| 2560 | @ <summary class="section accordion">About check-in %.20h(zName)</summary> |
| 2561 | }else{ |
| 2562 | @ <summary class="section accordion">About %s(zPrefix) %h(zName)</summary> |
| 2563 | } |
| 2564 | } |
| 2565 | |
| 2566 | /* |
| 2567 | ** Add an "Wiki" button in a submenu that links to the read-wiki page. |
| 2568 | */ |
| @@ -2604,20 +2619,21 @@ | |
| 2619 | style_submenu_element("Add Wiki", "%R/wikiedit?name=%s/%t", |
| 2620 | zPrefix, zName); |
| 2621 | } |
| 2622 | return 0; |
| 2623 | } |
| 2624 | @ <details %s((WIKIASSOC_REVEAL & mFlags) ? "open" : "")> |
| 2625 | if( fossil_strcmp(pWiki->zMimetype, "text/x-markdown")==0 ){ |
| 2626 | Blob tail = BLOB_INITIALIZER; |
| 2627 | Blob title = BLOB_INITIALIZER; |
| 2628 | Blob markdown; |
| 2629 | blob_init(&markdown, pWiki->zWiki, -1); |
| 2630 | markdown_to_html(&markdown, &title, &tail); |
| 2631 | if( blob_size(&title) ){ |
| 2632 | @ <summary class="section">%h(blob_str(&title))</summary> |
| 2633 | }else{ |
| 2634 | wiki_section_label_v2(zPrefix, zName, mFlags); |
| 2635 | } |
| 2636 | wiki_submenu_to_read_wiki(zPrefix, zName, mFlags); |
| 2637 | wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags); |
| 2638 | @ <div class="accordion_panel"> |
| 2639 | safe_html_context(DOCSRC_WIKI); |
| @@ -2638,14 +2654,14 @@ | |
| 2654 | Blob title = BLOB_INITIALIZER; |
| 2655 | Blob wiki; |
| 2656 | Blob *pBody; |
| 2657 | blob_init(&wiki, pWiki->zWiki, -1); |
| 2658 | if( wiki_find_title(&wiki, &title, &tail) ){ |
| 2659 | @ <summary class="section">%h(blob_str(&title))</summary> |
| 2660 | pBody = &tail; |
| 2661 | }else{ |
| 2662 | wiki_section_label_v2(zPrefix, zName, mFlags); |
| 2663 | pBody = &wiki; |
| 2664 | } |
| 2665 | wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags); |
| 2666 | @ <div class="accordion_panel"><div class="wiki"> |
| 2667 | wiki_convert(pBody, 0, WIKI_BUTTONS); |
| @@ -2652,9 +2668,10 @@ | |
| 2668 | @ </div></div> |
| 2669 | blob_reset(&tail); |
| 2670 | blob_reset(&title); |
| 2671 | blob_reset(&wiki); |
| 2672 | } |
| 2673 | @ </details> |
| 2674 | manifest_destroy(pWiki); |
| 2675 | builtin_request_js("accordion.js"); |
| 2676 | return 1; |
| 2677 | } |
| 2678 |