Permalink
Browse files

Fix for issue 38 related to '"new dependent action" from action doesn…

…'t tag with action/realm/context'.
  • Loading branch information...
1 parent 24ee7f6 commit d6a9d4e68177396e5c77810788199c6cb425c90e @gvictorv committed Mar 2, 2012
Showing with 15 additions and 2 deletions.
  1. +1 −1 layout/MonkeyGTDTheme.theme
  2. +13 −0 supporting/NewSavedTiddlerPlugin.js
  3. +1 −1 views/TitleButtons.tiddler
@@ -42,7 +42,7 @@
<span macro='toolbar closeTiddler closeOthers +editTiddler deleteTiddler > fields syncing permalink references jump'></span>
<span macro='newHere label:"new here" tag:Reference'></span>
<span macro='newJournalHere {{config.mGTD.getOptTxt("newjournaldateformat")?config.mGTD.getOptTxt("newjournaldateformat"):"DD-mmm-YY 0hh:0mm"}} tag:Reference'></span>
- <span macro="showWhenTagged Action"><span macro="newSavedTiddler title:'new dependent action' label:'new dependent action' tag:{{'Action Future [['+config.macros.mgtdList.getRealm()+']] [['+tiddler.getParent('Context')+']] [['+tiddler.getParent('Project')+']] [['+tiddler.title+']]'}}"></span></span>
+ <span macro="showWhenTagged Action"><span macro="newSavedTiddler title:'new dependent action' label:'new dependent action' tag:{{'Action Future \[\['+tiddler.getByIndex('Realm')+'\]\] \[\['+tiddler.getParent('Context').join('\]\] \[\[')+'\]\] \[\['+tiddler.getParent('Project')+'\]\] \[\['+tiddler.title+'\]\]'}}"></span></span>
</div>
<!--}}}-->
@@ -3,6 +3,11 @@ config.macros.newSavedTiddler.handler = function(place,macroName,params,wikifier
if (readOnly) {
return false;
}
+ //
+ // temporarily fix global tiddler reference for possible usage in executable params
+ //
+ var currentTiddler = window.tiddler;
+ window.tiddler = tiddler;
var p = paramString.parseParams("anon",null,true,false,false);
var label = getParam(p,"label","NewSavedTiddler");
var tooltip = getParam(p,"tooltip","");
@@ -28,10 +33,17 @@ config.macros.newSavedTiddler.handler = function(place,macroName,params,wikifier
}
var btn = createTiddlyButton(place,label,tooltip,this.onClick);
btn.params = paramString;
+ btn.tiddler = tiddler; // save tiddler reference this button relates to
+ window.tiddler = currentTiddler; // restore global tiddler reference
return false;
};
config.macros.newSavedTiddler.onClick = function(e) {
+ //
+ // temporarily fix global tiddler reference for possible usage in executable params
+ //
+ var currentTiddler = window.tiddler;
+ window.tiddler = this.tiddler;
var p = this.params.parseParams("anon",null,true,false,false);
var titlePrompt = getParam(p,"prompt","");
//
@@ -71,6 +83,7 @@ config.macros.newSavedTiddler.onClick = function(e) {
autoSaveChanges(null,[tiddler]);
story.displayTiddler(this,title);
}
+ window.tiddler = currentTiddler; // restore global tiddler reference
return false;
}
@@ -65,7 +65,7 @@
<br style="clear:left"/>
<div class="floatleft">
<span class="label">Depends on:</span><br/><span macro="multiSelectTag Action allowNone:on"></span><span macro="linkToParent Action"></span>
- <!-- fixme. broken in 2.4.1 but works in 2.4.3?: <span macro="newSavedTiddler title:'new dependent action' label:'+ dependent action' tag:{{'Action Future [['+config.macros.mgtdList.getRealm()+']] [['+tiddler.getParent('Context')+']] [['+tiddler.getParent('Project')+']] [['+tiddler.title +']]'}}"></span> -->
+ <span macro="newSavedTiddler title:'new dependent action' label:'+ dependent action' tag:{{'Action Future \[\['+tiddler.getByIndex('Realm')+'\]\] \[\['+tiddler.getParent('Context').join('\]\] \[\[')+'\]\] \[\['+tiddler.getParent('Project')+'\]\] \[\['+tiddler.title+'\]\]'}}"></span>
</div>
<div class="clearboth"></div>
</div>

0 comments on commit d6a9d4e

Please sign in to comment.