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)!
Commit
cf9293ad53b2717573d20a35af18077bc1d0a643
Parent
d0a9cda5606ae4d…
1 file changed
+13
-7
+13
-7
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2057,11 +2057,11 @@ | ||
| 2057 | 2057 | int fNewPropagateColor; /* True if color propagates after edit */ |
| 2058 | 2058 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2059 | 2059 | const char *zChngTime = 0; /* Value of chngtime= query param, if any */ |
| 2060 | 2060 | char *zUuid; |
| 2061 | 2061 | Blob comment; |
| 2062 | - char *zBranchName = 0; | |
| 2062 | + char *zBranchName = ""; | |
| 2063 | 2063 | Stmt q; |
| 2064 | 2064 | |
| 2065 | 2065 | login_check_credentials(); |
| 2066 | 2066 | if( !g.perm.Write ){ login_needed(); return; } |
| 2067 | 2067 | rid = name_to_typed_rid(P("r"), "ci"); |
| @@ -2198,10 +2198,21 @@ | ||
| 2198 | 2198 | } |
| 2199 | 2199 | blob_zero(&comment); |
| 2200 | 2200 | blob_append(&comment, zNewComment, -1); |
| 2201 | 2201 | zUuid[10] = 0; |
| 2202 | 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> | |
| 2203 | 2214 | if( P("preview") ){ |
| 2204 | 2215 | Blob suffix; |
| 2205 | 2216 | int nTag = 0; |
| 2206 | 2217 | @ <b>Preview:</b> |
| 2207 | 2218 | @ <blockquote> |
| @@ -2322,16 +2333,11 @@ | ||
| 2322 | 2333 | @ <tr><th align="right" valign="top">Branching:</th> |
| 2323 | 2334 | @ <td valign="top"> |
| 2324 | 2335 | @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) /> |
| 2325 | 2336 | @ Make this check-in the start of a new branch named:</label> |
| 2326 | 2337 | @ <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> | |
| 2333 | 2339 | if( !fHasClosed ){ |
| 2334 | 2340 | if( is_a_leaf(rid) ){ |
| 2335 | 2341 | @ <tr><th align="right" valign="top">Leaf Closure:</th> |
| 2336 | 2342 | @ <td valign="top"> |
| 2337 | 2343 | @ <label><input type="checkbox" name="close"%s(zCloseFlag) /> |
| 2338 | 2344 |
| --- 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 |