Fossil SCM
Determine which comment editing mode to enable based on which of the editor fields is hidden by default, so that we stay in sync if the C side changes.
Commit
a4314603f726bed3e3ca35bf578777abc65fac81b56f53a0a9590c5cb85cbc5b
Parent
4d5004ef2d8cdf0…
2 files changed
+8
-8
+16
-1
+8
-8
| --- src/fileedit.c | ||
| +++ src/fileedit.c | ||
| @@ -1788,24 +1788,23 @@ | ||
| 1788 | 1788 | CX("</div>"/*checkboxes*/); |
| 1789 | 1789 | } |
| 1790 | 1790 | |
| 1791 | 1791 | { /******* Commit comment, button, and result manifest *******/ |
| 1792 | 1792 | CX("<fieldset class='fileedit-options'>" |
| 1793 | - "<legend>Message (required) " | |
| 1794 | - "</legend><div>"); | |
| 1793 | + "<legend>Message (required)</legend><div>\n"); | |
| 1795 | 1794 | /* We have two comment input fields, defaulting to single-line |
| 1796 | 1795 | ** mode. JS code sets up the ability to toggle between single- |
| 1797 | 1796 | ** and multi-line modes. */ |
| 1798 | 1797 | CX("<input type='text' name='comment' " |
| 1799 | - "id='fileedit-comment'></input>\n"); | |
| 1800 | - CX("<textarea name='commentBig' class='hidden' " | |
| 1801 | - "rows='5' id='fileedit-comment-big'></textarea>"); | |
| 1798 | + "id='fileedit-comment'></input>"); | |
| 1799 | + CX("<textarea name='commentBig' class='hidden' " | |
| 1800 | + "rows='5' id='fileedit-comment-big'></textarea>\n"); | |
| 1802 | 1801 | { /* comment options... */ |
| 1803 | 1802 | CX("<div class='fileedit-options flex-container row'>"); |
| 1804 | 1803 | CX("<button id='comment-toggle' " |
| 1805 | 1804 | "title='Toggle between single- and multi-line comment mode, " |
| 1806 | - "noting that switching from multi- to single-line may cause " | |
| 1805 | + "noting that switching from multi- to single-line will cause " | |
| 1807 | 1806 | "newlines to get stripped.'" |
| 1808 | 1807 | ">toggle single-/multi-line</button> "); |
| 1809 | 1808 | style_select_list_str("comment-mimetype", "comment_mimetype", |
| 1810 | 1809 | "Comment style:", |
| 1811 | 1810 | "Specify how fossil will interpret the " |
| @@ -1818,15 +1817,16 @@ | ||
| 1818 | 1817 | CX("</div>\n"); |
| 1819 | 1818 | CX("<div class='fileedit-hint flex-container row'>" |
| 1820 | 1819 | "(Warning: switching from multi- to single-line mode will " |
| 1821 | 1820 | "strip out all newlines!)</div>"); |
| 1822 | 1821 | } |
| 1823 | - CX("</div></fieldset>\n"/*commit comment*/); | |
| 1822 | + CX("</div></fieldset>\n"/*commit comment options*/); | |
| 1824 | 1823 | CX("<div class='flex-container row'>" |
| 1825 | 1824 | "<button id='fileedit-btn-commit'>Commit</button>" |
| 1826 | 1825 | "</div>\n"); |
| 1827 | - CX("<div id='fileedit-manifest'></div>\n"); | |
| 1826 | + CX("<div id='fileedit-manifest'></div>\n" | |
| 1827 | + /* Manifest gets rendered here after a commit. */); | |
| 1828 | 1828 | } |
| 1829 | 1829 | |
| 1830 | 1830 | CX("</div>"/*#fileedit-tab-commit*/); |
| 1831 | 1831 | |
| 1832 | 1832 | /* Dynamically populate the editor... */ |
| 1833 | 1833 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1788,24 +1788,23 @@ | |
| 1788 | CX("</div>"/*checkboxes*/); |
| 1789 | } |
| 1790 | |
| 1791 | { /******* Commit comment, button, and result manifest *******/ |
| 1792 | CX("<fieldset class='fileedit-options'>" |
| 1793 | "<legend>Message (required) " |
| 1794 | "</legend><div>"); |
| 1795 | /* We have two comment input fields, defaulting to single-line |
| 1796 | ** mode. JS code sets up the ability to toggle between single- |
| 1797 | ** and multi-line modes. */ |
| 1798 | CX("<input type='text' name='comment' " |
| 1799 | "id='fileedit-comment'></input>\n"); |
| 1800 | CX("<textarea name='commentBig' class='hidden' " |
| 1801 | "rows='5' id='fileedit-comment-big'></textarea>"); |
| 1802 | { /* comment options... */ |
| 1803 | CX("<div class='fileedit-options flex-container row'>"); |
| 1804 | CX("<button id='comment-toggle' " |
| 1805 | "title='Toggle between single- and multi-line comment mode, " |
| 1806 | "noting that switching from multi- to single-line may cause " |
| 1807 | "newlines to get stripped.'" |
| 1808 | ">toggle single-/multi-line</button> "); |
| 1809 | style_select_list_str("comment-mimetype", "comment_mimetype", |
| 1810 | "Comment style:", |
| 1811 | "Specify how fossil will interpret the " |
| @@ -1818,15 +1817,16 @@ | |
| 1818 | CX("</div>\n"); |
| 1819 | CX("<div class='fileedit-hint flex-container row'>" |
| 1820 | "(Warning: switching from multi- to single-line mode will " |
| 1821 | "strip out all newlines!)</div>"); |
| 1822 | } |
| 1823 | CX("</div></fieldset>\n"/*commit comment*/); |
| 1824 | CX("<div class='flex-container row'>" |
| 1825 | "<button id='fileedit-btn-commit'>Commit</button>" |
| 1826 | "</div>\n"); |
| 1827 | CX("<div id='fileedit-manifest'></div>\n"); |
| 1828 | } |
| 1829 | |
| 1830 | CX("</div>"/*#fileedit-tab-commit*/); |
| 1831 | |
| 1832 | /* Dynamically populate the editor... */ |
| 1833 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1788,24 +1788,23 @@ | |
| 1788 | CX("</div>"/*checkboxes*/); |
| 1789 | } |
| 1790 | |
| 1791 | { /******* Commit comment, button, and result manifest *******/ |
| 1792 | CX("<fieldset class='fileedit-options'>" |
| 1793 | "<legend>Message (required)</legend><div>\n"); |
| 1794 | /* We have two comment input fields, defaulting to single-line |
| 1795 | ** mode. JS code sets up the ability to toggle between single- |
| 1796 | ** and multi-line modes. */ |
| 1797 | CX("<input type='text' name='comment' " |
| 1798 | "id='fileedit-comment'></input>"); |
| 1799 | CX("<textarea name='commentBig' class='hidden' " |
| 1800 | "rows='5' id='fileedit-comment-big'></textarea>\n"); |
| 1801 | { /* comment options... */ |
| 1802 | CX("<div class='fileedit-options flex-container row'>"); |
| 1803 | CX("<button id='comment-toggle' " |
| 1804 | "title='Toggle between single- and multi-line comment mode, " |
| 1805 | "noting that switching from multi- to single-line will cause " |
| 1806 | "newlines to get stripped.'" |
| 1807 | ">toggle single-/multi-line</button> "); |
| 1808 | style_select_list_str("comment-mimetype", "comment_mimetype", |
| 1809 | "Comment style:", |
| 1810 | "Specify how fossil will interpret the " |
| @@ -1818,15 +1817,16 @@ | |
| 1817 | CX("</div>\n"); |
| 1818 | CX("<div class='fileedit-hint flex-container row'>" |
| 1819 | "(Warning: switching from multi- to single-line mode will " |
| 1820 | "strip out all newlines!)</div>"); |
| 1821 | } |
| 1822 | CX("</div></fieldset>\n"/*commit comment options*/); |
| 1823 | CX("<div class='flex-container row'>" |
| 1824 | "<button id='fileedit-btn-commit'>Commit</button>" |
| 1825 | "</div>\n"); |
| 1826 | CX("<div id='fileedit-manifest'></div>\n" |
| 1827 | /* Manifest gets rendered here after a commit. */); |
| 1828 | } |
| 1829 | |
| 1830 | CX("</div>"/*#fileedit-tab-commit*/); |
| 1831 | |
| 1832 | /* Dynamically populate the editor... */ |
| 1833 |
+16
-1
| --- src/fossil.page.fileedit.js | ||
| +++ src/fossil.page.fileedit.js | ||
| @@ -26,13 +26,28 @@ | ||
| 26 | 26 | preview: E('#fileedit-tab-preview'), |
| 27 | 27 | diff: E('#fileedit-tab-diff'), |
| 28 | 28 | commit: E('#fileedit-tab-commit') |
| 29 | 29 | } |
| 30 | 30 | }; |
| 31 | - P.e.taComment = P.e.taCommentSmall; | |
| 31 | + /* Figure out which comment editor to show by default and | |
| 32 | + hide the other one. By default we take the one which does | |
| 33 | + not have the 'hidden' CSS class. If neither do, we default | |
| 34 | + to single-line mode. */ | |
| 35 | + if(D.hasClass(P.e.taCommentSmall, 'hidden')){ | |
| 36 | + P.e.taComment = P.e.taCommentBig; | |
| 37 | + }else if(D.hasClass(P.e.taCommentBig,'hidden')){ | |
| 38 | + P.e.taComment = P.e.taCommentSmall; | |
| 39 | + }else{ | |
| 40 | + P.e.taComment = P.e.taCommentSmall; | |
| 41 | + D.addClass(P.e.taCommentBig, 'hidden'); | |
| 42 | + } | |
| 43 | + D.removeClass(P.e.taComment, 'hidden'); | |
| 32 | 44 | |
| 33 | 45 | P.tabs.e.container.insertBefore( |
| 46 | + /* Move the status bar between the tab buttons and | |
| 47 | + tab panels. Seems to be the best fit in terms of | |
| 48 | + functionality and visibility. */ | |
| 34 | 49 | E('#fossil-status-bar'), P.tabs.e.tabs |
| 35 | 50 | ); |
| 36 | 51 | |
| 37 | 52 | const stopEvent = function(e){ |
| 38 | 53 | //e.preventDefault(); |
| 39 | 54 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -26,13 +26,28 @@ | |
| 26 | preview: E('#fileedit-tab-preview'), |
| 27 | diff: E('#fileedit-tab-diff'), |
| 28 | commit: E('#fileedit-tab-commit') |
| 29 | } |
| 30 | }; |
| 31 | P.e.taComment = P.e.taCommentSmall; |
| 32 | |
| 33 | P.tabs.e.container.insertBefore( |
| 34 | E('#fossil-status-bar'), P.tabs.e.tabs |
| 35 | ); |
| 36 | |
| 37 | const stopEvent = function(e){ |
| 38 | //e.preventDefault(); |
| 39 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -26,13 +26,28 @@ | |
| 26 | preview: E('#fileedit-tab-preview'), |
| 27 | diff: E('#fileedit-tab-diff'), |
| 28 | commit: E('#fileedit-tab-commit') |
| 29 | } |
| 30 | }; |
| 31 | /* Figure out which comment editor to show by default and |
| 32 | hide the other one. By default we take the one which does |
| 33 | not have the 'hidden' CSS class. If neither do, we default |
| 34 | to single-line mode. */ |
| 35 | if(D.hasClass(P.e.taCommentSmall, 'hidden')){ |
| 36 | P.e.taComment = P.e.taCommentBig; |
| 37 | }else if(D.hasClass(P.e.taCommentBig,'hidden')){ |
| 38 | P.e.taComment = P.e.taCommentSmall; |
| 39 | }else{ |
| 40 | P.e.taComment = P.e.taCommentSmall; |
| 41 | D.addClass(P.e.taCommentBig, 'hidden'); |
| 42 | } |
| 43 | D.removeClass(P.e.taComment, 'hidden'); |
| 44 | |
| 45 | P.tabs.e.container.insertBefore( |
| 46 | /* Move the status bar between the tab buttons and |
| 47 | tab panels. Seems to be the best fit in terms of |
| 48 | functionality and visibility. */ |
| 49 | E('#fossil-status-bar'), P.tabs.e.tabs |
| 50 | ); |
| 51 | |
| 52 | const stopEvent = function(e){ |
| 53 | //e.preventDefault(); |
| 54 |