Skip to content

Commit

Permalink
Merge branch 'admin-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviershay committed Feb 25, 2012
2 parents bd91490 + 83caf02 commit a8ef4e2
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 28 deletions.
3 changes: 0 additions & 3 deletions app/assets/javascripts/admin/comments.js

This file was deleted.

7 changes: 7 additions & 0 deletions app/assets/javascripts/admin/common.js
Expand Up @@ -107,3 +107,10 @@ function destroyAndUndoBehaviour(type) {
}
}

$(document).ready(function() {
$(['posts', 'comments', 'pages']).each(function() {
if ($('#' + this).length > 0) {
destroyAndUndoBehaviour(this)();
}
});
});
40 changes: 21 additions & 19 deletions app/assets/javascripts/admin/dashboard.js
Expand Up @@ -4,30 +4,32 @@ function extractId(obj) {
}

$(document).ready(function (){
$('.comment-body').hide();
if ($('#recent-comments').length) {
$('.comment-body').hide();

$('.comment-link').click (function() {
comment_body_id = '#comment-body-' + extractId($(this));
$('.comment-link').click (function() {
comment_body_id = '#comment-body-' + extractId($(this));

$('.comment-body').not(comment_body_id).hide();
$(comment_body_id).toggle();
$('.comment-body').not(comment_body_id).hide();
$(comment_body_id).toggle();

return false;
})
return false;
})

$(document).click(function() {
$('.comment-body').hide();
});
$(document).click(function() {
$('.comment-body').hide();
});

asyncUndoBehaviour();
asyncUndoBehaviour();

$('form.delete-item').submit(function () {
asyncDeleteForm($(this));
$('form.delete-item').submit(function () {
asyncDeleteForm($(this));

// Assume success and remove comment
comment_link_id = '#comment-link-' + extractId($(this));
$(comment_link_id).remove();
$(this).parent('div').parent('div').remove();
return false;
});
// Assume success and remove comment
comment_link_id = '#comment-link-' + extractId($(this));
$(comment_link_id).remove();
$(this).parent('div').parent('div').remove();
return false;
});
}
})
1 change: 0 additions & 1 deletion app/assets/javascripts/admin/pages.js

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/javascripts/admin/posts.js

This file was deleted.

3 changes: 2 additions & 1 deletion app/views/admin/comments/index.html.erb
@@ -1,5 +1,6 @@
<h1>Comments</h1>
<table>

<table id='comments'>
<thead>
<tr>
<th>Created At</th>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/pages/index.html.erb
@@ -1,6 +1,6 @@
<h1>Your pages</h1>

<table>
<table id='pages'>
<thead>
<tr>
<th>Created At</th>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/posts/_post.html.erb
Expand Up @@ -6,7 +6,7 @@
<td>
<%= link_to(image_tag('silk/pencil.png', :alt => 'edit'), admin_post_path(post)) %>
<%= form_for(post, :as => :post, :url => admin_post_path(post), :html => {:class => 'delete-item', :method => :delete}) do |form| -%>
<%= image_submit_tag("silk/delete.png", :alt => 'Delete Comment') %>
<%= image_submit_tag("silk/delete.png", :alt => 'Delete Post') %>
<% end -%>
</td>
</tr>
3 changes: 2 additions & 1 deletion app/views/admin/posts/index.html.erb
@@ -1,5 +1,6 @@
<h1>Your posts</h1>
<table>

<table id='posts'>
<thead>
<tr>
<th>Published At</th>
Expand Down

0 comments on commit a8ef4e2

Please sign in to comment.