Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'admin-fixes'

  • Loading branch information...
commit a8ef4e220a63f8ffe6741061d23a23df574fb8c2 2 parents bd91490 + 83caf02
@xaviershay xaviershay authored
View
3  app/assets/javascripts/admin/comments.js
@@ -1,3 +0,0 @@
-$(document).ready(function() {
- destroyAndUndoBehaviour('comments')
-}); // Defined in admin/common.js
View
7 app/assets/javascripts/admin/common.js
@@ -107,3 +107,10 @@ function destroyAndUndoBehaviour(type) {
}
}
+$(document).ready(function() {
+ $(['posts', 'comments', 'pages']).each(function() {
+ if ($('#' + this).length > 0) {
+ destroyAndUndoBehaviour(this)();
+ }
+ });
+});
View
40 app/assets/javascripts/admin/dashboard.js
@@ -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;
+ });
+ }
})
View
1  app/assets/javascripts/admin/pages.js
@@ -1 +0,0 @@
-$(document).ready(destroyAndUndoBehaviour('pages')); // Defined in admin/common.js
View
1  app/assets/javascripts/admin/posts.js
@@ -1 +0,0 @@
-$(document).ready(destroyAndUndoBehaviour('posts')); // Defined in admin/common.js
View
3  app/views/admin/comments/index.html.erb
@@ -1,5 +1,6 @@
<h1>Comments</h1>
-<table>
+
+<table id='comments'>
<thead>
<tr>
<th>Created At</th>
View
2  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>
View
2  app/views/admin/posts/_post.html.erb
@@ -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>
View
3  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>
Please sign in to comment.
Something went wrong with that request. Please try again.