Skip to content

Commit a002e33

Browse files
committed
WebHistoryView: Also use the tree context menu
1 parent 1199c56 commit a002e33

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

PBWebHistoryController.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ - (NSArray *) webView:(WebView *)sender
8888
NSLog(@"Could not find selected ref!");
8989
return defaultMenuItems;
9090
}
91+
if ([node hasAttributes] && [[node attributes] getNamedItem:@"representedFile"])
92+
return [historyController menuItemsForPaths:[NSArray arrayWithObject:[[[node attributes] getNamedItem:@"representedFile"] value]]];
9193

9294
node = [node parentNode];
9395
}

html/views/history/history.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,26 +202,32 @@ var showDiff = function() {
202202
var link = document.createElement("a");
203203
link.setAttribute("href", "#" + id);
204204
p.appendChild(link);
205-
var buttonType = ""
205+
var buttonType = "";
206+
var finalFile = "";
206207
if (name1 == name2) {
207208
buttonType = "changed"
208-
link.appendChild(document.createTextNode(name1));
209+
finalFile = name1;
209210
if (mode_change)
210211
p.appendChild(document.createTextNode(" mode " + old_mode + " -> " + new_mode));
211212
}
212213
else if (name1 == "/dev/null") {
213214
buttonType = "created";
214-
link.appendChild(document.createTextNode(name2));
215+
finalFile = name2;
215216
}
216217
else if (name2 == "/dev/null") {
217218
buttonType = "deleted";
218-
link.appendChild(document.createTextNode(name1));
219+
finalFile = name1;
219220
}
220221
else {
221222
buttonType = "renamed";
222-
link.appendChild(document.createTextNode(name2));
223+
finalFile = name2;
223224
p.insertBefore(document.createTextNode(name1 + " -> "), link);
224225
}
226+
227+
link.appendChild(document.createTextNode(finalFile));
228+
button.setAttribute("representedFile", finalFile);
229+
link.setAttribute("representedFile", finalFile);
230+
225231
button.setAttribute("class", "button " + buttonType);
226232
button.appendChild(document.createTextNode(buttonType));
227233
$("files").appendChild(button);

0 commit comments

Comments
 (0)