diff --git a/src/extensions/default/RecentProjects/close_btn.svg b/src/extensions/default/RecentProjects/close_btn.svg new file mode 100644 index 00000000000..1588c01c792 --- /dev/null +++ b/src/extensions/default/RecentProjects/close_btn.svg @@ -0,0 +1,15 @@ + diff --git a/src/extensions/default/RecentProjects/main.js b/src/extensions/default/RecentProjects/main.js index e8d8bd37bec..2c1b870d2e4 100644 --- a/src/extensions/default/RecentProjects/main.js +++ b/src/extensions/default/RecentProjects/main.js @@ -95,7 +95,11 @@ define(function (require, exports, module) { var folderSpan = $("").addClass("recent-folder").text(folder), restSpan = $("").addClass("recent-folder-path").text(" - " + rest); - return $("").addClass("recent-folder-link").append(folderSpan).append(restSpan); + return $("").addClass("recent-folder-link").append(folderSpan).append(restSpan).data("path", path); + } + + function renderDelete() { + return $("
").addClass("trash-icon"); } /** @@ -148,13 +152,45 @@ define(function (require, exports, module) { } }); closeDropdown(); + }) + .mouseenter(function (e) { + var $target = $(e.currentTarget), + $del = renderDelete() + .click(function () { + // remove the project from the preferences. + var prefs = PreferencesManager.getPreferenceStorage(PREFERENCES_KEY), + recentProjects = getRecentProjects(), + index = recentProjects.indexOf($(this).data("path")), + newProjects = [], + i; + for (i = 0; i < recentProjects.length; i++) { + if (i !== index) { + newProjects.push(recentProjects[i]); + } + } + prefs.setValue("recentProjects", newProjects); + closeDropdown(); + }); + + $(this).append($del); + + $del.css("right", 5); + $del.css("top", $target.position().top + 11); + $del.css("display", "inline-block"); + $del.data("path", $(this).data("path")); + }) + .mouseleave(function () { + $("#recent-folder-delete").remove(); }); + $("") .append($link) .appendTo($dropdown); hasProject = true; } }); + + if (hasProject) { $("