Skip to content

Commit 423037d

Browse files
committed
Doubleclicking on items in sitemap
* Double clicking on a page should take user to edit * Double clicking on a section/link should take user to properties.
1 parent 1af61eb commit 423037d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

app/assets/javascripts/cms/new-sitemap.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ var Sitemap = function() {
3030
// @return [Selector] The currently selected section in the sitemap. If a page or other child is selected, this will be
3131
// that element's parent.
3232
Sitemap.prototype.currentSection = function(){
33-
console.log(this.selectedSection);
3433
return $(this.selectedSection);
3534
};
3635

@@ -42,6 +41,20 @@ Sitemap.prototype.clearSelection = function() {
4241
$('.active').removeClass('active');
4342
};
4443

44+
// Different Content types have different behaviors when double clicked.
45+
Sitemap.prototype._doubleClick = function(event){
46+
var type = $(event.target).data('type');
47+
switch(type)
48+
{
49+
case 'section':
50+
case 'link':
51+
$('#properties-button')[0].click();
52+
break;
53+
default:
54+
$('#edit-button')[0].click();
55+
}
56+
};
57+
4558
// @return [Selector]
4659
Sitemap.prototype.selectedContent = function() {
4760
return $(this.selectedRow);
@@ -130,7 +143,7 @@ $(function() {
130143
$('.selectable').click(function() {
131144
sitemap.selectRow($(this));
132145
});
133-
146+
$('.selectable').dblclick(sitemap._doubleClick);
134147
sitemap.clickWebsite();
135148
});
136149

todo_ui_Revamp.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Tasks:
66
* Keep open/closed/last selected state of sitemap
77
* Audit/Delete/merge js/cms/sitemap.js.erb
88
* No visual indicator of an empty section
9-
* Doubleclicking on items
109
* page_editor.css/page_content_editing.css shouldn't have been deleted.
1110
* Can't edit the root section
1211
* Delete old sitemap pages (_section.old.erb, etc)

0 commit comments

Comments
 (0)