aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2010-08-25 16:15:02 +1200
committerPhilip Arndt <parndt@gmail.com>2010-08-25 16:15:02 +1200
commit11f16cd66e86396bda09e3bdede88fd08f35bc1c (patch)
tree9bef7375acf9fc9b79865ff23d42ca0f823e6182 /app
parent4fbe3219386f68654ffaf123e30a219b4959de78 (diff)
downloadrefinerycms-blog-11f16cd66e86396bda09e3bdede88fd08f35bc1c.tar.gz
refinerycms-blog-11f16cd66e86396bda09e3bdede88fd08f35bc1c.tar.bz2
refinerycms-blog-11f16cd66e86396bda09e3bdede88fd08f35bc1c.zip
Added categories section
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/blog/categories_controller.rb2
-rw-r--r--app/views/admin/blog/_submenu.html.erb8
-rw-r--r--app/views/admin/blog/categories/_category.html.erb13
-rw-r--r--app/views/admin/blog/categories/_form.html.erb15
-rw-r--r--app/views/admin/blog/categories/_sortable_list.html.erb7
-rw-r--r--app/views/admin/blog/categories/edit.html.erb1
-rw-r--r--app/views/admin/blog/categories/index.html.erb30
-rw-r--r--app/views/admin/blog/categories/new.html.erb1
-rw-r--r--app/views/admin/blog/comments/index.html.erb22
-rw-r--r--app/views/admin/blog/posts/_form.html.erb20
10 files changed, 99 insertions, 20 deletions
diff --git a/app/controllers/admin/blog/categories_controller.rb b/app/controllers/admin/blog/categories_controller.rb
index 09fa802..9682e3b 100644
--- a/app/controllers/admin/blog/categories_controller.rb
+++ b/app/controllers/admin/blog/categories_controller.rb
@@ -1,7 +1,7 @@
class Admin::Blog::CategoriesController < Admin::BaseController
crudify :blog_category,
- :title_attribute => :name,
+ :title_attribute => :title,
:order => 'created_at DESC'
end
diff --git a/app/views/admin/blog/_submenu.html.erb b/app/views/admin/blog/_submenu.html.erb
index 7eccba7..db3064f 100644
--- a/app/views/admin/blog/_submenu.html.erb
+++ b/app/views/admin/blog/_submenu.html.erb
@@ -1,4 +1,4 @@
-<div id='actions' class='multilist'>
+<nav id='actions' class='multilist'>
<ul class='search_list'>
<li>
<%= render :partial => "/shared/admin/search",
@@ -43,7 +43,7 @@
<ul class='collapsible_menu'>
<li>
- <%= link_to t('.categories.title'), admin_blog_categories_url,
+ <%= link_to t('.categories.title'), '#',
:class => 'folder_icon' %>
</li>
<li>
@@ -51,7 +51,7 @@
:class => 'folder_edit_icon' %>
</li>
<li>
- <%= link_to t('.categories.new'), new_admin_blog_category_url(:dialog => true),
+ <%= link_to t('.categories.new'), new_admin_blog_category_url(:dialog => true, :height => 325),
:class => 'folder_add_icon' %>
</li>
</ul>
@@ -72,7 +72,7 @@
</li>
</ul>
-</div>
+</nav>
<% content_for :head do %>
<!-- uses famfamfam icons and a couple Dave made -->
<style type='text/css'>
diff --git a/app/views/admin/blog/categories/_category.html.erb b/app/views/admin/blog/categories/_category.html.erb
new file mode 100644
index 0000000..109f4e6
--- /dev/null
+++ b/app/views/admin/blog/categories/_category.html.erb
@@ -0,0 +1,13 @@
+<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(category) -%>">
+ <span class='title'>
+ <%=h category.title %>
+ <span class="preview">&nbsp;</span>
+ </span>
+ <span class='actions'>
+ <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_blog_category_path(category),
+ :title => t('.edit') %>
+ <%= link_to refinery_icon_tag("delete.png"), admin_blog_category_path(category),
+ :class => "cancel confirm-delete",
+ :title => t('.delete') %>
+ </span>
+</li>
diff --git a/app/views/admin/blog/categories/_form.html.erb b/app/views/admin/blog/categories/_form.html.erb
new file mode 100644
index 0000000..f1ee0bc
--- /dev/null
+++ b/app/views/admin/blog/categories/_form.html.erb
@@ -0,0 +1,15 @@
+<% form_for [:admin, @blog_category] do |f| -%>
+ <%= f.error_messages %>
+
+ <div class='field'>
+ <%= f.label :title -%>
+ <%= f.text_field :title, :class => 'larger widest' -%>
+ </div>
+
+ <%= render :partial => "/shared/admin/form_actions",
+ :locals => {
+ :f => f,
+ :continue_editing => false,
+ :delete_title => t('admin.blogs.categories.delete')
+ } %>
+<% end %> \ No newline at end of file
diff --git a/app/views/admin/blog/categories/_sortable_list.html.erb b/app/views/admin/blog/categories/_sortable_list.html.erb
new file mode 100644
index 0000000..df6a39b
--- /dev/null
+++ b/app/views/admin/blog/categories/_sortable_list.html.erb
@@ -0,0 +1,7 @@
+<ul id='sortable_list'>
+ <%= render :partial => 'category', :collection => @blog_categories %>
+</ul>
+<%= render :partial => "/shared/admin/sortable_list",
+ :locals => {
+ :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)
+ } %>
diff --git a/app/views/admin/blog/categories/edit.html.erb b/app/views/admin/blog/categories/edit.html.erb
new file mode 100644
index 0000000..42509a2
--- /dev/null
+++ b/app/views/admin/blog/categories/edit.html.erb
@@ -0,0 +1 @@
+<%= render :partial => "form" %> \ No newline at end of file
diff --git a/app/views/admin/blog/categories/index.html.erb b/app/views/admin/blog/categories/index.html.erb
new file mode 100644
index 0000000..824b1c3
--- /dev/null
+++ b/app/views/admin/blog/categories/index.html.erb
@@ -0,0 +1,30 @@
+<%= render :partial => '/admin/blog/submenu' %>
+<div id='records'>
+ <% if searching? %>
+ <h2><%= t('admin.search_results_for', :query => params[:search]) %></h2>
+ <% if @blog_categories.any? %>
+ <%= render :partial => "blog_categories",
+ :collection => @blog_categories %>
+ <% else %>
+ <p><%= t('admin.search_no_results') %></p>
+ <% end %>
+ <% else %>
+ <% if @blog_categories.any? %>
+ <%= will_paginate @blog_categories,
+ :previous_label => '&laquo;',
+ :next_label => '&raquo;' %>
+
+ <%= render :partial => "sortable_list" %>
+
+ <%= will_paginate @blog_categories,
+ :previous_label => '&laquo;',
+ :next_label => '&raquo;' %>
+ <% else %>
+ <p>
+ <strong>
+ <%= t('.no_items_yet') %>
+ </strong>
+ </p>
+ <% end %>
+ <% end %>
+</div> \ No newline at end of file
diff --git a/app/views/admin/blog/categories/new.html.erb b/app/views/admin/blog/categories/new.html.erb
new file mode 100644
index 0000000..42509a2
--- /dev/null
+++ b/app/views/admin/blog/categories/new.html.erb
@@ -0,0 +1 @@
+<%= render :partial => "form" %> \ No newline at end of file
diff --git a/app/views/admin/blog/comments/index.html.erb b/app/views/admin/blog/comments/index.html.erb
index 6b5a3e8..20fceb8 100644
--- a/app/views/admin/blog/comments/index.html.erb
+++ b/app/views/admin/blog/comments/index.html.erb
@@ -3,26 +3,28 @@
<% if searching? %>
<h2><%= t('admin.search_results_for', :query => params[:search]) %></h2>
<% if @blog_comments.any? %>
- <%= render :partial => "blog_comments",
- :collection => @blog_comments %>
+ <%= will_paginate @blog_comments %>
+
+ <ul>
+ <%= render :partial => "blog_comments",
+ :collection => @blog_comments %>
+ </ul>
+
+ <%= will_paginate @blog_comments %>
<% else %>
<p><%= t('admin.search_no_results') %></p>
<% end %>
<% else %>
<% if @blog_comments.any? %>
- <%= will_paginate @blog_comments,
- :previous_label => '&laquo;',
- :next_label => '&raquo;' %>
+ <%= will_paginate @blog_comments %>
<%= render :partial => "sortable_list" %>
- <%= will_paginate @blog_comments,
- :previous_label => '&laquo;',
- :next_label => '&raquo;' %>
+ <%= will_paginate @blog_comments %>
<% else %>
<h3>
- <%= t('.no_items_yet',
- :type => (t("admin.blog.submenu.comments.#{action_name}").downcase unless action_name == 'index')) %>
+ <%= t('.no_items_yet',
+ :type => (t("admin.blog.submenu.comments.#{action_name}").downcase unless action_name == 'index')) %>
</h3>
<% end %>
<% end %>
diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb
index a03ff82..da3f132 100644
--- a/app/views/admin/blog/posts/_form.html.erb
+++ b/app/views/admin/blog/posts/_form.html.erb
@@ -24,11 +24,14 @@
<div id='more_options' style="display:none;">
<div class="hemisquare">
<h3><%= t('admin.blog.submenu.categories.title') %></h3>
- <ul class='categories'>
- <% @blog_categories.each do |category| %>
- <li>
- checkboxes for category <%= category.title %>
- </li>
+ <ul class='blog_categories'>
+ <% f.fields_for :categories do |c| %>
+ <% @blog_categories.each do |category| %>
+ <li>
+ <%= c.check_box :id, :value => category.id %>
+ <%= c.label :id, category.title, :class => 'stripped' %>
+ </li>
+ <% end %>
<% end %>
</ul>
</div>
@@ -43,6 +46,13 @@
} %>
<% end -%>
<% content_for :head do %>
+ <style type='text/css'>
+ ul.blog_categories, ul.blog_categories li {
+ list-style: none;
+ margin: 0px;
+ padding: 0px;
+ }
+ </style>
<script type='text/javascript'>
$(document).ready(function(){
$('#toggle_advanced_options').click(function(e){