From a5fe9225fac33f15e972599132c7f569cc5cf397 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 9 Aug 2010 19:31:22 +1200 Subject: Namespaced blog posts under blog/posts to allow for blog/comments and blog/categories --- app/controllers/admin/blog/posts_controller.rb | 5 +++ app/controllers/admin/blog_posts_controller.rb | 5 --- app/views/admin/blog/posts/_form.html.erb | 25 +++++++++++++ app/views/admin/blog/posts/_post.html.erb | 16 ++++++++ app/views/admin/blog/posts/_sortable_list.html.erb | 7 ++++ app/views/admin/blog/posts/edit.html.erb | 1 + app/views/admin/blog/posts/index.html.erb | 43 ++++++++++++++++++++++ app/views/admin/blog/posts/new.html.erb | 1 + app/views/admin/blog_posts/_blog_post.html.erb | 16 -------- app/views/admin/blog_posts/_form.html.erb | 25 ------------- app/views/admin/blog_posts/_sortable_list.html.erb | 7 ---- app/views/admin/blog_posts/edit.html.erb | 1 - app/views/admin/blog_posts/index.html.erb | 43 ---------------------- app/views/admin/blog_posts/new.html.erb | 1 - 14 files changed, 98 insertions(+), 98 deletions(-) create mode 100644 app/controllers/admin/blog/posts_controller.rb delete mode 100644 app/controllers/admin/blog_posts_controller.rb create mode 100644 app/views/admin/blog/posts/_form.html.erb create mode 100644 app/views/admin/blog/posts/_post.html.erb create mode 100644 app/views/admin/blog/posts/_sortable_list.html.erb create mode 100644 app/views/admin/blog/posts/edit.html.erb create mode 100644 app/views/admin/blog/posts/index.html.erb create mode 100644 app/views/admin/blog/posts/new.html.erb delete mode 100644 app/views/admin/blog_posts/_blog_post.html.erb delete mode 100644 app/views/admin/blog_posts/_form.html.erb delete mode 100644 app/views/admin/blog_posts/_sortable_list.html.erb delete mode 100644 app/views/admin/blog_posts/edit.html.erb delete mode 100644 app/views/admin/blog_posts/index.html.erb delete mode 100644 app/views/admin/blog_posts/new.html.erb (limited to 'app') diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb new file mode 100644 index 0000000..291571c --- /dev/null +++ b/app/controllers/admin/blog/posts_controller.rb @@ -0,0 +1,5 @@ +class Admin::Blog::PostsController < Admin::BaseController + + crudify :blog_post, :title_attribute => :title, :order => 'created_at DESC' + +end diff --git a/app/controllers/admin/blog_posts_controller.rb b/app/controllers/admin/blog_posts_controller.rb deleted file mode 100644 index 0fd5a93..0000000 --- a/app/controllers/admin/blog_posts_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Admin::BlogPostsController < Admin::BaseController - - crudify :blog_post, :title_attribute => :title, :order => 'created_at DESC' - -end diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb new file mode 100644 index 0000000..5d9f347 --- /dev/null +++ b/app/views/admin/blog/posts/_form.html.erb @@ -0,0 +1,25 @@ +<% form_for [:admin, @blog_post] do |f| -%> + <%= f.error_messages %> + +
+ <%= f.label :title -%> + <%= f.text_field :title, :class => 'larger widest' -%> +
+ +
+ <%= f.label :body -%> + <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%> +
+ +
+ <%= f.label :draft -%> + <%= f.check_box :draft -%> +
+ + <%= render :partial => "/shared/admin/form_actions", + :locals => { + :f => f, + :continue_editing => false, + :delete_title => t('admin.blogs.blogs.delete') + } %> +<% end -%> diff --git a/app/views/admin/blog/posts/_post.html.erb b/app/views/admin/blog/posts/_post.html.erb new file mode 100644 index 0000000..3e15543 --- /dev/null +++ b/app/views/admin/blog/posts/_post.html.erb @@ -0,0 +1,16 @@ +
  • + + <%=h post.title %> +   + + + <%= link_to refinery_icon_tag("application_go.png"), blog_post_url(post), + :title => t('.view_live'), + :target => "_blank" %> + <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_blog_post_path(post), + :title => t('.edit') %> + <%= link_to refinery_icon_tag("delete.png"), admin_blog_post_path(post), + :class => "cancel confirm-delete", + :title => t('.delete') %> + +
  • diff --git a/app/views/admin/blog/posts/_sortable_list.html.erb b/app/views/admin/blog/posts/_sortable_list.html.erb new file mode 100644 index 0000000..7ae0ad3 --- /dev/null +++ b/app/views/admin/blog/posts/_sortable_list.html.erb @@ -0,0 +1,7 @@ + +<%= render :partial => "/shared/admin/sortable_list", + :locals => { + :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) + } %> diff --git a/app/views/admin/blog/posts/edit.html.erb b/app/views/admin/blog/posts/edit.html.erb new file mode 100644 index 0000000..2872e82 --- /dev/null +++ b/app/views/admin/blog/posts/edit.html.erb @@ -0,0 +1 @@ +<%= render :partial => "form" %> diff --git a/app/views/admin/blog/posts/index.html.erb b/app/views/admin/blog/posts/index.html.erb new file mode 100644 index 0000000..0bc14db --- /dev/null +++ b/app/views/admin/blog/posts/index.html.erb @@ -0,0 +1,43 @@ +
    + +
    +
    + <% if searching? %> +

    <%= t('admin.search_results_for', :query => params[:search]) %>

    + <% if @blog_posts.any? %> + <%= render :partial => "blog_posts", + :collection => @blog_posts %> + <% else %> +

    <%= t('admin.search_no_results') %>

    + <% end %> + <% else %> + <% if @blog_posts.any? %> + <%= will_paginate @blog_posts, + :previous_label => '«', + :next_label => '»' %> + + <%= render :partial => "sortable_list" %> + + <%= will_paginate @blog_posts, + :previous_label => '«', + :next_label => '»' %> + <% else %> +

    + + <%= t('.no_items_yet') %> + +

    + <% end %> + <% end %> +
    \ No newline at end of file diff --git a/app/views/admin/blog/posts/new.html.erb b/app/views/admin/blog/posts/new.html.erb new file mode 100644 index 0000000..2872e82 --- /dev/null +++ b/app/views/admin/blog/posts/new.html.erb @@ -0,0 +1 @@ +<%= render :partial => "form" %> diff --git a/app/views/admin/blog_posts/_blog_post.html.erb b/app/views/admin/blog_posts/_blog_post.html.erb deleted file mode 100644 index b56a050..0000000 --- a/app/views/admin/blog_posts/_blog_post.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -
  • - - <%=h blog_post.title %> -   - - - <%= link_to refinery_icon_tag("application_go.png"), blog_post_url(blog_post), - :title => t('.view_live'), - :target => "_blank" %> - <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_blog_post_path(blog_post), - :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), admin_blog_post_path(blog_post), - :class => "cancel confirm-delete", - :title => t('.delete') %> - -
  • diff --git a/app/views/admin/blog_posts/_form.html.erb b/app/views/admin/blog_posts/_form.html.erb deleted file mode 100644 index 5d9f347..0000000 --- a/app/views/admin/blog_posts/_form.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<% form_for [:admin, @blog_post] do |f| -%> - <%= f.error_messages %> - -
    - <%= f.label :title -%> - <%= f.text_field :title, :class => 'larger widest' -%> -
    - -
    - <%= f.label :body -%> - <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%> -
    - -
    - <%= f.label :draft -%> - <%= f.check_box :draft -%> -
    - - <%= render :partial => "/shared/admin/form_actions", - :locals => { - :f => f, - :continue_editing => false, - :delete_title => t('admin.blogs.blogs.delete') - } %> -<% end -%> diff --git a/app/views/admin/blog_posts/_sortable_list.html.erb b/app/views/admin/blog_posts/_sortable_list.html.erb deleted file mode 100644 index 3529b23..0000000 --- a/app/views/admin/blog_posts/_sortable_list.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - -<%= render :partial => "/shared/admin/sortable_list", - :locals => { - :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) - } %> diff --git a/app/views/admin/blog_posts/edit.html.erb b/app/views/admin/blog_posts/edit.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/admin/blog_posts/edit.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/admin/blog_posts/index.html.erb b/app/views/admin/blog_posts/index.html.erb deleted file mode 100644 index 0bc14db..0000000 --- a/app/views/admin/blog_posts/index.html.erb +++ /dev/null @@ -1,43 +0,0 @@ -
    - -
    -
    - <% if searching? %> -

    <%= t('admin.search_results_for', :query => params[:search]) %>

    - <% if @blog_posts.any? %> - <%= render :partial => "blog_posts", - :collection => @blog_posts %> - <% else %> -

    <%= t('admin.search_no_results') %>

    - <% end %> - <% else %> - <% if @blog_posts.any? %> - <%= will_paginate @blog_posts, - :previous_label => '«', - :next_label => '»' %> - - <%= render :partial => "sortable_list" %> - - <%= will_paginate @blog_posts, - :previous_label => '«', - :next_label => '»' %> - <% else %> -

    - - <%= t('.no_items_yet') %> - -

    - <% end %> - <% end %> -
    \ No newline at end of file diff --git a/app/views/admin/blog_posts/new.html.erb b/app/views/admin/blog_posts/new.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/admin/blog_posts/new.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> -- cgit v1.2.3