Patch #29395 » 0003-adds-file-preview-prev-next-navigation-with-arrow-ke.patch
| app/views/layouts/_file.html.erb | ||
|---|---|---|
|
</div>
|
||
|
<%= yield %>
|
||
|
<span class="pagination">
|
||
|
<span class="pagination filepreview">
|
||
|
<%= render_pagination %>
|
||
|
</span>
|
||
| app/views/repositories/entry.html.erb | ||
|---|---|---|
|
:class => 'icon icon-download') : nil } %>
|
||
|
<% end %>
|
||
|
<span class="pagination">
|
||
|
<span class="pagination filepreview">
|
||
|
<%= render_pagination %>
|
||
|
</span>
|
||
| public/javascripts/application.js | ||
|---|---|---|
|
}
|
||
|
}
|
||
|
function setupFilePreviewNavigation() {
|
||
|
// only bind arrow keys when preview navigation is present
|
||
|
const element = $('.pagination.filepreview').first();
|
||
|
if (element) {
|
||
|
const handleArrowKey = function(selector, e){
|
||
|
const href = $(element).find(selector).attr('href');
|
||
|
if (href) {
|
||
|
window.location = href;
|
||
|
e.preventDefault();
|
||
|
}
|
||
|
};
|
||
|
$(document).keydown(function(e) {
|
||
|
if(e.shiftKey || e.metaKey || e.ctrlKey || e.altKey) return;
|
||
|
switch(e.key) {
|
||
|
case 'ArrowLeft':
|
||
|
handleArrowKey('.previous a', e);
|
||
|
break;
|
||
|
case 'ArrowRight':
|
||
|
handleArrowKey('.next a', e);
|
||
|
break;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
function hideOnLoad() {
|
||
|
$('.hol').hide();
|
||
|
}
|
||
| ... | ... | |
|
$(document).ready(addFormObserversForDoubleSubmit);
|
||
|
$(document).ready(defaultFocus);
|
||
|
$(document).ready(setupTabs);
|
||
|
$(document).ready(setupFilePreviewNavigation);
|
||
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »