Fossil SCM

If the "Branching" checkbox is unchecked, the "Branch Closure" label should return to its original branchname. Add a javascript handler doing exactly that.

jan.nijtmans 2013-12-13 12:26 trunk
Commit 2cb54f3981b7f00c964ad9ba2f32303f2de0452e
1 file changed +21 -6
+21 -6
--- 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 = "";
2062
+ char *zBranchName = 0;
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");
@@ -2199,16 +2199,23 @@
21992199
blob_zero(&comment);
22002200
blob_append(&comment, zNewComment, -1);
22012201
zUuid[10] = 0;
22022202
style_header("Edit Check-in [%s]", zUuid);
22032203
/*
2204
- ** chgbn: Handle change of branch name in remaining of form.
2204
+ ** chgcbn/chgbn: Handle change of (checkbox for) branch name in
2205
+ ** remaining of form.
22052206
*/
22062207
@ <script>
2208
+ @ function chgcbn(checked, branch){
2209
+ @ val = gebi('brname').value;
2210
+ @ if( !val || !checked) val = branch;
2211
+ @ cidbrid = document.getElementById('cbranch');
2212
+ @ if( cidbrid ) cidbrid.textContent = val;
2213
+ @ }
22072214
@ function chgbn(val, branch){
2208
- @ if (!val) val=branch;
2209
- @ gebi('newbr').checked=(val!=branch);
2215
+ @ if( !val ) val = branch;
2216
+ @ gebi('newbr').checked = (val!=branch);
22102217
@ cidbrid = document.getElementById('cbranch');
22112218
@ if( cidbrid ) cidbrid.textContent = val;
22122219
@ }
22132220
@ </script>
22142221
if( P("preview") ){
@@ -2328,15 +2335,23 @@
23282335
}
23292336
}
23302337
db_finalize(&q);
23312338
@ </td></tr>
23322339
2340
+ if( !zBranchName ){
2341
+ zBranchName = db_get("main-branch", "trunk");
2342
+ }
2343
+ if( !zNewBranch || !zNewBranch[0]){
2344
+ zNewBranch = zBranchName;
2345
+ }
23332346
@ <tr><th align="right" valign="top">Branching:</th>
23342347
@ <td valign="top">
2335
- @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) />
2348
+ @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag)
2349
+ @ onchange="chgcbn(this.checked,'%h(zBranchName)')" />
23362350
@ Make this check-in the start of a new branch named:</label>
2337
- @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)"
2351
+ @ <input id="brname" type="text" style="width:15;" name="brname"
2352
+ @ value="%h(zNewBranch)"
23382353
@ onkeyup="chgbn(this.value,'%h(zBranchName)')" /></td></tr>
23392354
if( !fHasClosed ){
23402355
if( is_a_leaf(rid) ){
23412356
@ <tr><th align="right" valign="top">Leaf Closure:</th>
23422357
@ <td valign="top">
23432358
--- 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");
@@ -2199,16 +2199,23 @@
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") ){
@@ -2328,15 +2335,23 @@
2328 }
2329 }
2330 db_finalize(&q);
2331 @ </td></tr>
2332
 
 
 
 
 
 
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
--- 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");
@@ -2199,16 +2199,23 @@
2199 blob_zero(&comment);
2200 blob_append(&comment, zNewComment, -1);
2201 zUuid[10] = 0;
2202 style_header("Edit Check-in [%s]", zUuid);
2203 /*
2204 ** chgcbn/chgbn: Handle change of (checkbox for) branch name in
2205 ** remaining of form.
2206 */
2207 @ <script>
2208 @ function chgcbn(checked, branch){
2209 @ val = gebi('brname').value;
2210 @ if( !val || !checked) val = branch;
2211 @ cidbrid = document.getElementById('cbranch');
2212 @ if( cidbrid ) cidbrid.textContent = val;
2213 @ }
2214 @ function chgbn(val, branch){
2215 @ if( !val ) val = branch;
2216 @ gebi('newbr').checked = (val!=branch);
2217 @ cidbrid = document.getElementById('cbranch');
2218 @ if( cidbrid ) cidbrid.textContent = val;
2219 @ }
2220 @ </script>
2221 if( P("preview") ){
@@ -2328,15 +2335,23 @@
2335 }
2336 }
2337 db_finalize(&q);
2338 @ </td></tr>
2339
2340 if( !zBranchName ){
2341 zBranchName = db_get("main-branch", "trunk");
2342 }
2343 if( !zNewBranch || !zNewBranch[0]){
2344 zNewBranch = zBranchName;
2345 }
2346 @ <tr><th align="right" valign="top">Branching:</th>
2347 @ <td valign="top">
2348 @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag)
2349 @ onchange="chgcbn(this.checked,'%h(zBranchName)')" />
2350 @ Make this check-in the start of a new branch named:</label>
2351 @ <input id="brname" type="text" style="width:15;" name="brname"
2352 @ value="%h(zNewBranch)"
2353 @ onkeyup="chgbn(this.value,'%h(zBranchName)')" /></td></tr>
2354 if( !fHasClosed ){
2355 if( is_a_leaf(rid) ){
2356 @ <tr><th align="right" valign="top">Leaf Closure:</th>
2357 @ <td valign="top">
2358

Keyboard Shortcuts

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