merge with november_presentation

This commit is contained in:
chris2tof committed 2011-12-20 16:47:17 +08:00
1 parent afbffe37d5
commit a09f8e4551
101 files changed
+891 -10632

No files matched your search

@@ -1,17 +1,7 @@
class Panel::Blog::PostsController < ApplicationController
class Panel::Blog::BackEnd::PostsController < ApplicationController
layout 'admin'
# GET /posts
# GET /posts.xml
def widget_index
@posts = Post.all
widget_default_layout
end
def widget_latest_post
@post = Post.all.last
widget_default_layout
end
def index
@posts = Post.all
@@ -92,20 +82,3 @@ class Panel::Blog::PostsController < ApplicationController
end
end
end
def widget_default_layout
respond_to do |format|
format.html {
if params[:edit_view]
#in the case of editing,should be displayed in modal window and
#be restricted by the border developer sat.
render :layout => 'admin'
else
#in the case of fetching data for ajax display,should
render :layout => 'production'
end
}
format.xml { render :xml => @posts }
end
end
@@ -1,7 +0,0 @@
class Panel::Blog::CommentsController < ApplicationController
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.create!(params[:comment])
redirect_to panel_blog_post_url(@post)
end
end
@@ -0,0 +1,7 @@
class Panel::Blog::FrontEnd::CommentsController < ApplicationController
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.create!(params[:comment])
redirect_to panel_blog_front_end_post_url(@post)
end
end
@@ -0,0 +1,17 @@
class Panel::Blog::FrontEnd::PostsController < ApplicationController
layout 'production'
# GET /posts
# GET /posts.xml
def index
@posts = Post.all
end
def show
@post = Post.find(params[:id])
end
end
@@ -0,0 +1,15 @@
class Panel::Blog::Widget::PostsController < ApplicationController
layout 'production'
# GET /posts
# GET /posts.xml
def index
@posts = Post.all
end
def latest_post
@post = Post.all.last
end
end
@@ -0,0 +1,8 @@
<h1><%= t('blog.editing_post') %></h1>
<%= form_for @post, :url => panel_blog_back_end_post_path(@post) do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= link_to t('blog.show'), panel_blog_back_end_post_path(@post) %> |
<%= link_back %>
@@ -1,6 +1,6 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t('blog.new_post'), new_panel_blog_post_path, :class => 'seclink1' %></li>
<li><%= link_to t('blog.new_post'), new_panel_blog_back_end_post_path, :class => 'seclink1' %></li>
</ul>
<% end -%>
@@ -21,9 +21,9 @@
<tr>
<td><%= post.title %></td>
<td><%= truncate(post.body,:length=>15) %></td>
<td><%= link_to t('blog.show'), panel_blog_post_path(post) %></td>
<td><%= link_to t('blog.edit'), edit_panel_blog_post_path(post) %></td>
<td><%= link_to t('blog.delete'), panel_blog_post_path(post), :confirm => t('blog.sure?'), :method => :delete %></td>
<td><%= link_to t('blog.show'), panel_blog_back_end_post_path(post) %></td>
<td><%= link_to t('blog.edit'), edit_panel_blog_back_end_post_path(post) %></td>
<td><%= link_to t('blog.delete'), panel_blog_back_end_post_path(post), :confirm => t('blog.sure?'), :method => :delete %></td>
</tr>
<% end %>
</table>
@@ -1,12 +1,12 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t('blog.index'), panel_blog_posts_path, :class => 'seclink2' %></li>
<li><%= link_to t('blog.index'), panel_blog_back_end_posts_path, :class => 'seclink2' %></li>
</ul>
<% end -%>
<%= flash_messages %>
<h1><%= t('blog.new_post') %></h1>
<%= form_for @post, :url => panel_blog_posts_path do |f| %>
<%= form_for @post, :url => panel_blog_back_end_posts_path do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
@@ -18,7 +18,7 @@
</p>
<% end %>
<%= form_for Comment.new, :url => panel_blog_comments_path do |f| %>
<%= form_for Comment.new, :url => panel_blog_front_end_comments_path do |f| %>
<p>
<%= f.label :name, "Author" %><br />
@@ -34,5 +34,5 @@
<% end %>
<%= link_to t('blog.edit'), edit_panel_blog_post_path(@post) %> |
<%= link_to t('blog.edit'), edit_panel_blog_back_end_post_path(@post) %> |
<%= link_back %>
@@ -0,0 +1,7 @@
<div>
<%= post_frontend.title %><br />
<p>
<%= truncate(post_frontend.body,:length=>25) %>
<%= link_to 'Read more...',panel_blog_front_end_post_path(post_frontend) %>
</p>
</div>
@@ -0,0 +1,11 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t('blog.new_post'), new_panel_blog_back_end_post_path, :class => 'seclink1' %></li>
</ul>
<% end -%>
<%= flash_messages %>
<h1><%= t('blog.front_end_index') %></h1>
<%= render :partial => "post_frontend", :collection => @posts %>
@@ -0,0 +1,34 @@
<p id="notice"><%= flash_messages %></p>
<p>
<b><%= t('blog.body') %></b>
<%=h @post.body %>
</p>
<h2><%= t('blog.comments') %></h2>
<% @post.comments.each do |c| %>
<p>
<b><%=h c.name %> said:</b><br />
<%= time_ago_in_words(c.created_at) %> ago
</p>
<p>
<%=h c.body %>
</p>
<% end %>
<%= form_for Comment.new, :url => panel_blog_front_end_comments_path do |f| %>
<p>
<%= f.label :name, "Author" %><br />
<%= f.text_field :name %><br />
<%= f.label :body, "Comment Description" %><br />
<%= f.text_area :body %>
<%= hidden_field_tag :post_id, @post.id %>
</p>
<p>
<%= f.submit "Add Comment" %>
</p>
<% end %>
@@ -1,8 +0,0 @@
<h1><%= t('blog.editing_post') %></h1>
<%= form_for @post, :url => panel_blog_post_path(@post) do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= link_to t('blog.show'), panel_blog_post_path(@post) %> |
<%= link_back %>
@@ -8,7 +8,7 @@
<% @posts.each do |post| %>
<tr>
<td><%= link_to post.title,panel_blog_post_path(post) %></td>
<td><%= link_to post.title,panel_blog_front_end_post_path(post) %></td>
<td><%= post.body.truncate(14) %></td>
</tr>
<% end %>