Fossil SCM
Moved the hard-coded edit state markers to fossil.page.config so that skins can change them.
Commit
4c1a2dd4e1f78c843b8b5c436e2da2a1ca1083be8ac09f03fcb0c02298999bfa
Parent
d7d231c9337741d…
2 files changed
+15
-5
+1
-2
+15
-5
| --- src/fossil.page.wikiedit.js | ||
| +++ src/fossil.page.wikiedit.js | ||
| @@ -64,11 +64,19 @@ | ||
| 64 | 64 | */ |
| 65 | 65 | const E = (s)=>document.querySelector(s), |
| 66 | 66 | D = F.dom, |
| 67 | 67 | P = F.page; |
| 68 | 68 | |
| 69 | - P.config = {}; | |
| 69 | + P.config = { | |
| 70 | + /* Symbolic markers to denote certain edit state. Note that | |
| 71 | + the symbols themselves are *actually* defined in CSS, so if | |
| 72 | + they're changed there they also need to be changed here.*/ | |
| 73 | + editStateMarkers: { | |
| 74 | + isNew: '[+]', | |
| 75 | + isModified: '[*]' | |
| 76 | + } | |
| 77 | + }; | |
| 70 | 78 | |
| 71 | 79 | /** |
| 72 | 80 | $stash is an internal-use-only object for managing "stashed" |
| 73 | 81 | local edits, to help avoid that users accidentally lose content |
| 74 | 82 | by switching tabs or following links or some such. The basic |
| @@ -400,12 +408,14 @@ | ||
| 400 | 408 | fsLegendBody = D.div(); |
| 401 | 409 | D.append(fsLegend, fsLegendBody); |
| 402 | 410 | D.addClass(fsLegendBody, 'flex-container', 'flex-column', 'stretch'); |
| 403 | 411 | D.append( |
| 404 | 412 | fsLegendBody, |
| 405 | - D.append(D.span(), "[*] = page has local edits"), | |
| 406 | - D.append(D.span(), "[+] = page is new/unsaved") | |
| 413 | + D.append(D.span(), P.config.editStateMarkers.isModified, | |
| 414 | + " = page has local edits"), | |
| 415 | + D.append(D.span(), P.config.editStateMarkers.isNew, | |
| 416 | + " = page is new/unsaved") | |
| 407 | 417 | ); |
| 408 | 418 | |
| 409 | 419 | D.append( |
| 410 | 420 | parentElem, |
| 411 | 421 | D.append(D.addClass(D.div(), 'fieldset-wrapper'), |
| @@ -686,12 +696,12 @@ | ||
| 686 | 696 | f.titleElement = document.head.querySelector('title'); |
| 687 | 697 | f.pageTitleHeader = document.querySelector('div.header .title'); |
| 688 | 698 | } |
| 689 | 699 | var title = ['Wiki Editor:']; |
| 690 | 700 | if(P.winfo){ |
| 691 | - if(!P.winfo.version) title.push('[+]'); | |
| 692 | - else if($stash.getWinfo(P.winfo)) title.push('[*]') | |
| 701 | + if(!P.winfo.version) title.push(P.config.editStateMarkers.isNew); | |
| 702 | + else if($stash.getWinfo(P.winfo)) title.push(P.config.editStateMarkers.isModified) | |
| 693 | 703 | title.push(P.winfo.name); |
| 694 | 704 | }else{ |
| 695 | 705 | title.push('(no page loaded)'); |
| 696 | 706 | } |
| 697 | 707 | title = title.join(' '); |
| 698 | 708 |
| --- src/fossil.page.wikiedit.js | |
| +++ src/fossil.page.wikiedit.js | |
| @@ -64,11 +64,19 @@ | |
| 64 | */ |
| 65 | const E = (s)=>document.querySelector(s), |
| 66 | D = F.dom, |
| 67 | P = F.page; |
| 68 | |
| 69 | P.config = {}; |
| 70 | |
| 71 | /** |
| 72 | $stash is an internal-use-only object for managing "stashed" |
| 73 | local edits, to help avoid that users accidentally lose content |
| 74 | by switching tabs or following links or some such. The basic |
| @@ -400,12 +408,14 @@ | |
| 400 | fsLegendBody = D.div(); |
| 401 | D.append(fsLegend, fsLegendBody); |
| 402 | D.addClass(fsLegendBody, 'flex-container', 'flex-column', 'stretch'); |
| 403 | D.append( |
| 404 | fsLegendBody, |
| 405 | D.append(D.span(), "[*] = page has local edits"), |
| 406 | D.append(D.span(), "[+] = page is new/unsaved") |
| 407 | ); |
| 408 | |
| 409 | D.append( |
| 410 | parentElem, |
| 411 | D.append(D.addClass(D.div(), 'fieldset-wrapper'), |
| @@ -686,12 +696,12 @@ | |
| 686 | f.titleElement = document.head.querySelector('title'); |
| 687 | f.pageTitleHeader = document.querySelector('div.header .title'); |
| 688 | } |
| 689 | var title = ['Wiki Editor:']; |
| 690 | if(P.winfo){ |
| 691 | if(!P.winfo.version) title.push('[+]'); |
| 692 | else if($stash.getWinfo(P.winfo)) title.push('[*]') |
| 693 | title.push(P.winfo.name); |
| 694 | }else{ |
| 695 | title.push('(no page loaded)'); |
| 696 | } |
| 697 | title = title.join(' '); |
| 698 |
| --- src/fossil.page.wikiedit.js | |
| +++ src/fossil.page.wikiedit.js | |
| @@ -64,11 +64,19 @@ | |
| 64 | */ |
| 65 | const E = (s)=>document.querySelector(s), |
| 66 | D = F.dom, |
| 67 | P = F.page; |
| 68 | |
| 69 | P.config = { |
| 70 | /* Symbolic markers to denote certain edit state. Note that |
| 71 | the symbols themselves are *actually* defined in CSS, so if |
| 72 | they're changed there they also need to be changed here.*/ |
| 73 | editStateMarkers: { |
| 74 | isNew: '[+]', |
| 75 | isModified: '[*]' |
| 76 | } |
| 77 | }; |
| 78 | |
| 79 | /** |
| 80 | $stash is an internal-use-only object for managing "stashed" |
| 81 | local edits, to help avoid that users accidentally lose content |
| 82 | by switching tabs or following links or some such. The basic |
| @@ -400,12 +408,14 @@ | |
| 408 | fsLegendBody = D.div(); |
| 409 | D.append(fsLegend, fsLegendBody); |
| 410 | D.addClass(fsLegendBody, 'flex-container', 'flex-column', 'stretch'); |
| 411 | D.append( |
| 412 | fsLegendBody, |
| 413 | D.append(D.span(), P.config.editStateMarkers.isModified, |
| 414 | " = page has local edits"), |
| 415 | D.append(D.span(), P.config.editStateMarkers.isNew, |
| 416 | " = page is new/unsaved") |
| 417 | ); |
| 418 | |
| 419 | D.append( |
| 420 | parentElem, |
| 421 | D.append(D.addClass(D.div(), 'fieldset-wrapper'), |
| @@ -686,12 +696,12 @@ | |
| 696 | f.titleElement = document.head.querySelector('title'); |
| 697 | f.pageTitleHeader = document.querySelector('div.header .title'); |
| 698 | } |
| 699 | var title = ['Wiki Editor:']; |
| 700 | if(P.winfo){ |
| 701 | if(!P.winfo.version) title.push(P.config.editStateMarkers.isNew); |
| 702 | else if($stash.getWinfo(P.winfo)) title.push(P.config.editStateMarkers.isModified) |
| 703 | title.push(P.winfo.name); |
| 704 | }else{ |
| 705 | title.push('(no page loaded)'); |
| 706 | } |
| 707 | title = title.join(' '); |
| 708 |
+1
-2
| --- src/style.wikiedit.css | ||
| +++ src/style.wikiedit.css | ||
| @@ -56,12 +56,11 @@ | ||
| 56 | 56 | margin: 0.5em 0; |
| 57 | 57 | } |
| 58 | 58 | body.wikiedit .wikiedit-page-list-wrapper select option.stashed::before { |
| 59 | 59 | /* Maintenance reminder: the option.stashed/stashed-new "content" values |
| 60 | 60 | are duplicated in fossil.page.wikiedit.js and need to be changed there |
| 61 | - if they are changed here. i.e. they're not "really" customizable | |
| 62 | - by client code. */ | |
| 61 | + if they are changed here: see fossil.page.config.editStateMarkers */ | |
| 63 | 62 | content: "[*] "; |
| 64 | 63 | } |
| 65 | 64 | body.wikiedit .wikiedit-page-list-wrapper select option.stashed-new::before { |
| 66 | 65 | content: "[+] "; |
| 67 | 66 | } |
| 68 | 67 |
| --- src/style.wikiedit.css | |
| +++ src/style.wikiedit.css | |
| @@ -56,12 +56,11 @@ | |
| 56 | margin: 0.5em 0; |
| 57 | } |
| 58 | body.wikiedit .wikiedit-page-list-wrapper select option.stashed::before { |
| 59 | /* Maintenance reminder: the option.stashed/stashed-new "content" values |
| 60 | are duplicated in fossil.page.wikiedit.js and need to be changed there |
| 61 | if they are changed here. i.e. they're not "really" customizable |
| 62 | by client code. */ |
| 63 | content: "[*] "; |
| 64 | } |
| 65 | body.wikiedit .wikiedit-page-list-wrapper select option.stashed-new::before { |
| 66 | content: "[+] "; |
| 67 | } |
| 68 |
| --- src/style.wikiedit.css | |
| +++ src/style.wikiedit.css | |
| @@ -56,12 +56,11 @@ | |
| 56 | margin: 0.5em 0; |
| 57 | } |
| 58 | body.wikiedit .wikiedit-page-list-wrapper select option.stashed::before { |
| 59 | /* Maintenance reminder: the option.stashed/stashed-new "content" values |
| 60 | are duplicated in fossil.page.wikiedit.js and need to be changed there |
| 61 | if they are changed here: see fossil.page.config.editStateMarkers */ |
| 62 | content: "[*] "; |
| 63 | } |
| 64 | body.wikiedit .wikiedit-page-list-wrapper select option.stashed-new::before { |
| 65 | content: "[+] "; |
| 66 | } |
| 67 |