Fossil SCM

When branchname in ci_edit page changes, adapt remaining form to the name-change using some javascript. Thanks to Andy Bradford for the idea (adapted/simplified from the "hidden-tag" branch)!

jan.nijtmans 2013-12-13 08:40 trunk
Commit cf9293ad53b2717573d20a35af18077bc1d0a643
1 file changed +13 -7
+13 -7
--- src/info.c
+++ src/info.c
@@ -2057,11 +2057,11 @@
20572057
int fNewPropagateColor; /* True if color propagates after edit */
20582058
int fHasClosed = 0; /* True if closed tag already set */
20592059
const char *zChngTime = 0; /* Value of chngtime= query param, if any */
20602060
char *zUuid;
20612061
Blob comment;
2062
- char *zBranchName = 0;
2062
+ char *zBranchName = "";
20632063
Stmt q;
20642064
20652065
login_check_credentials();
20662066
if( !g.perm.Write ){ login_needed(); return; }
20672067
rid = name_to_typed_rid(P("r"), "ci");
@@ -2198,10 +2198,21 @@
21982198
}
21992199
blob_zero(&comment);
22002200
blob_append(&comment, zNewComment, -1);
22012201
zUuid[10] = 0;
22022202
style_header("Edit Check-in [%s]", zUuid);
2203
+ /*
2204
+ ** chgbn: Handle change of branch name in remaining of form.
2205
+ */
2206
+ @ <script>
2207
+ @ function chgbn(val, branch){
2208
+ @ if (!val) val=branch;
2209
+ @ gebi('newbr').checked=(val!=branch);
2210
+ @ cidbrid = document.getElementById('cbranch');
2211
+ @ if( cidbrid ) cidbrid.textContent = val;
2212
+ @ }
2213
+ @ </script>
22032214
if( P("preview") ){
22042215
Blob suffix;
22052216
int nTag = 0;
22062217
@ <b>Preview:</b>
22072218
@ <blockquote>
@@ -2322,16 +2333,11 @@
23222333
@ <tr><th align="right" valign="top">Branching:</th>
23232334
@ <td valign="top">
23242335
@ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) />
23252336
@ Make this check-in the start of a new branch named:</label>
23262337
@ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)"
2327
- @ onkeyup="gebi('newbr').checked=!!this.value
2328
- if( zBranchName ){
2329
- @ && this.value!='%h(zBranchName)'
2330
- }
2331
- @ " /></td></tr>
2332
-
2338
+ @ onkeyup="chgbn(this.value,'%h(zBranchName)')" /></td></tr>
23332339
if( !fHasClosed ){
23342340
if( is_a_leaf(rid) ){
23352341
@ <tr><th align="right" valign="top">Leaf Closure:</th>
23362342
@ <td valign="top">
23372343
@ <label><input type="checkbox" name="close"%s(zCloseFlag) />
23382344
--- src/info.c
+++ src/info.c
@@ -2057,11 +2057,11 @@
2057 int fNewPropagateColor; /* True if color propagates after edit */
2058 int fHasClosed = 0; /* True if closed tag already set */
2059 const char *zChngTime = 0; /* Value of chngtime= query param, if any */
2060 char *zUuid;
2061 Blob comment;
2062 char *zBranchName = 0;
2063 Stmt q;
2064
2065 login_check_credentials();
2066 if( !g.perm.Write ){ login_needed(); return; }
2067 rid = name_to_typed_rid(P("r"), "ci");
@@ -2198,10 +2198,21 @@
2198 }
2199 blob_zero(&comment);
2200 blob_append(&comment, zNewComment, -1);
2201 zUuid[10] = 0;
2202 style_header("Edit Check-in [%s]", zUuid);
 
 
 
 
 
 
 
 
 
 
 
2203 if( P("preview") ){
2204 Blob suffix;
2205 int nTag = 0;
2206 @ <b>Preview:</b>
2207 @ <blockquote>
@@ -2322,16 +2333,11 @@
2322 @ <tr><th align="right" valign="top">Branching:</th>
2323 @ <td valign="top">
2324 @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) />
2325 @ Make this check-in the start of a new branch named:</label>
2326 @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)"
2327 @ onkeyup="gebi('newbr').checked=!!this.value
2328 if( zBranchName ){
2329 @ && this.value!='%h(zBranchName)'
2330 }
2331 @ " /></td></tr>
2332
2333 if( !fHasClosed ){
2334 if( is_a_leaf(rid) ){
2335 @ <tr><th align="right" valign="top">Leaf Closure:</th>
2336 @ <td valign="top">
2337 @ <label><input type="checkbox" name="close"%s(zCloseFlag) />
2338
--- src/info.c
+++ src/info.c
@@ -2057,11 +2057,11 @@
2057 int fNewPropagateColor; /* True if color propagates after edit */
2058 int fHasClosed = 0; /* True if closed tag already set */
2059 const char *zChngTime = 0; /* Value of chngtime= query param, if any */
2060 char *zUuid;
2061 Blob comment;
2062 char *zBranchName = "";
2063 Stmt q;
2064
2065 login_check_credentials();
2066 if( !g.perm.Write ){ login_needed(); return; }
2067 rid = name_to_typed_rid(P("r"), "ci");
@@ -2198,10 +2198,21 @@
2198 }
2199 blob_zero(&comment);
2200 blob_append(&comment, zNewComment, -1);
2201 zUuid[10] = 0;
2202 style_header("Edit Check-in [%s]", zUuid);
2203 /*
2204 ** chgbn: Handle change of branch name in remaining of form.
2205 */
2206 @ <script>
2207 @ function chgbn(val, branch){
2208 @ if (!val) val=branch;
2209 @ gebi('newbr').checked=(val!=branch);
2210 @ cidbrid = document.getElementById('cbranch');
2211 @ if( cidbrid ) cidbrid.textContent = val;
2212 @ }
2213 @ </script>
2214 if( P("preview") ){
2215 Blob suffix;
2216 int nTag = 0;
2217 @ <b>Preview:</b>
2218 @ <blockquote>
@@ -2322,16 +2333,11 @@
2333 @ <tr><th align="right" valign="top">Branching:</th>
2334 @ <td valign="top">
2335 @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) />
2336 @ Make this check-in the start of a new branch named:</label>
2337 @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)"
2338 @ onkeyup="chgbn(this.value,'%h(zBranchName)')" /></td></tr>
 
 
 
 
 
2339 if( !fHasClosed ){
2340 if( is_a_leaf(rid) ){
2341 @ <tr><th align="right" valign="top">Leaf Closure:</th>
2342 @ <td valign="top">
2343 @ <label><input type="checkbox" name="close"%s(zCloseFlag) />
2344

Keyboard Shortcuts

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