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.

stephan 2020-05-09 12:54 fileedit-ajaxify
Commit a4314603f726bed3e3ca35bf578777abc65fac81b56f53a0a9590c5cb85cbc5b
+8 -8
--- src/fileedit.c
+++ src/fileedit.c
@@ -1788,24 +1788,23 @@
17881788
CX("</div>"/*checkboxes*/);
17891789
}
17901790
17911791
{ /******* Commit comment, button, and result manifest *******/
17921792
CX("<fieldset class='fileedit-options'>"
1793
- "<legend>Message (required) "
1794
- "</legend><div>");
1793
+ "<legend>Message (required)</legend><div>\n");
17951794
/* We have two comment input fields, defaulting to single-line
17961795
** mode. JS code sets up the ability to toggle between single-
17971796
** and multi-line modes. */
17981797
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");
18021801
{ /* comment options... */
18031802
CX("<div class='fileedit-options flex-container row'>");
18041803
CX("<button id='comment-toggle' "
18051804
"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 "
18071806
"newlines to get stripped.'"
18081807
">toggle single-/multi-line</button> ");
18091808
style_select_list_str("comment-mimetype", "comment_mimetype",
18101809
"Comment style:",
18111810
"Specify how fossil will interpret the "
@@ -1818,15 +1817,16 @@
18181817
CX("</div>\n");
18191818
CX("<div class='fileedit-hint flex-container row'>"
18201819
"(Warning: switching from multi- to single-line mode will "
18211820
"strip out all newlines!)</div>");
18221821
}
1823
- CX("</div></fieldset>\n"/*commit comment*/);
1822
+ CX("</div></fieldset>\n"/*commit comment options*/);
18241823
CX("<div class='flex-container row'>"
18251824
"<button id='fileedit-btn-commit'>Commit</button>"
18261825
"</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. */);
18281828
}
18291829
18301830
CX("</div>"/*#fileedit-tab-commit*/);
18311831
18321832
/* Dynamically populate the editor... */
18331833
--- 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
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -26,13 +26,28 @@
2626
preview: E('#fileedit-tab-preview'),
2727
diff: E('#fileedit-tab-diff'),
2828
commit: E('#fileedit-tab-commit')
2929
}
3030
};
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');
3244
3345
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. */
3449
E('#fossil-status-bar'), P.tabs.e.tabs
3550
);
3651
3752
const stopEvent = function(e){
3853
//e.preventDefault();
3954
--- 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

Keyboard Shortcuts

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