Merge pull request #2813 from NobodysNightmare/feature/19106_editing_pages_with_access_keys

Editing pages with access keys
pull/2825/head
Jan Sandbrink 10 years ago
commit d05a7a2966
  1. 2
      app/views/my/page.html.erb
  2. 22
      frontend/app/services/keyboard-shortcut-service.js

@ -28,7 +28,7 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<% breadcrumb_paths(l(:label_my_page)) %>
<% content_for :action_menu_specific do %>
<%= link_to l(:label_personalize_page), action: 'page_layout', accesskey: accesskey(:edit) %>
<%= link_to l(:label_personalize_page), { action: 'page_layout' }, accesskey: accesskey(:edit) %>
<% end %>
<h2><%=l(:label_my_page)%></h2>
<%= render :partial => 'layouts/action_menu_specific' %>

@ -77,6 +77,8 @@ module.exports = function($window, $rootScope, $timeout, PathHelper) {
$timeout(function() {
elem.focus();
});
} else if(elem.is('[href]')) {
clickLink(elem[0]);
} else {
elem.click();
}
@ -93,6 +95,26 @@ module.exports = function($window, $rootScope, $timeout, PathHelper) {
};
}
function clickLink(link) {
var cancelled = false;
if (document.createEvent) {
var event = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
cancelled = !link.dispatchEvent(event);
}
else if (link.fireEvent) {
cancelled = !link.fireEvent('onclick');
}
if (!cancelled) {
window.location = link.href;
}
}
function showHelpModal() {
modalHelperInstance.createModal(PathHelper.staticKeyboardShortcutsHelpPath());
}

Loading…
Cancel
Save