Skip to content

Commit

Permalink
Extract onclick handlers into script files
Browse files Browse the repository at this point in the history
These are the handlers for deleting files and reverting changes.
  • Loading branch information
acant committed Jul 29, 2014
1 parent 336ce93 commit d4adb4a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions lib/gitdocs/public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,13 @@ $('a[data-method]').live('click', function(e) {
form.hide().append(metadata_input).appendTo('body');
form.submit();
});

// Deletion tab
$('ul.tabs a.delete').live('click', function(e) {
return confirm('Are you sure?')
});

// Revert a revision from the revision table
$('#revisions td.revert a').live('click', function(e) {
return confirm('Are you sure?')
});
2 changes: 1 addition & 1 deletion lib/gitdocs/views/_header.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
%li
%a{ href: '?mode=revisions' } Revisions
%li
%a{ href: '?mode=delete', onclick: "javascript:return confirm('Are you sure?')" } Delete
%a.delete{ href: '?mode=delete' } Delete
2 changes: 1 addition & 1 deletion lib/gitdocs/views/revisions.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
%td.author= r[:author]
%td.date.reldate= r[:date].iso8601
%td.revert
%a{ href: "?mode=revert&revision=#{r[:commit]}", onclick: "javascript:return confirm('Are you sure?')" }
%a{ href: "?mode=revert&revision=#{r[:commit]}" }
= r[:commit]
- if revisions.empty?
%p No revisions for this file could be found.

0 comments on commit d4adb4a

Please sign in to comment.