merge with november_presentation
This commit is contained in:
1 parent
fa27bfc86b
commit
d465febca7
27 files changed
+437
-6
No files matched your search
+84
@@ -0,0 +1,84 @@
|
||||
class Panel::Blog::BackEnd::PostsController < ApplicationController
|
||||
|
||||
layout 'admin'
|
||||
|
||||
def index
|
||||
@posts = Post.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @posts }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /posts/1
|
||||
# GET /posts/1.xml
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @post }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /posts/new
|
||||
# GET /posts/new.xml
|
||||
def new
|
||||
@post = Post.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @post }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /posts/1/edit
|
||||
def edit
|
||||
@post = Post.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /posts
|
||||
# POST /posts.xml
|
||||
def create
|
||||
@post = Post.new(params[:post])
|
||||
|
||||
respond_to do |format|
|
||||
if @post.save
|
||||
format.html { redirect_to(panel_blog_post_url(@post), :notice => t('blog.create_post_success')) }
|
||||
format.xml { render :xml => @post, :status => :created, :location => @post }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /posts/1
|
||||
# PUT /posts/1.xml
|
||||
def update
|
||||
@post = Post.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @post.update_attributes(params[:post])
|
||||
format.html { redirect_to(panel_blog_post_url(@post), :notice => t('blog.update_post_success')) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /posts/1
|
||||
# DELETE /posts/1.xml
|
||||
def destroy
|
||||
@post = Post.find(params[:id])
|
||||
@post.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_blog_posts_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
<%= f.error_messages %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :title %><br />
|
||||
<%= f.text_field :title %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :body %><br />
|
||||
<%= f.text_area :body %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
<% 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.list_post') %></h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('blog.title') %></th>
|
||||
<th><%= t('blog.body') %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @posts.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.title %></td>
|
||||
<td><%= truncate(post.body,:length=>15) %></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>
|
||||
|
||||
<br />
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<h2><%=@post.title%></h2>
|
||||
<p>
|
||||
<%= @post.body%>
|
||||
</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<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_back_end_posts_path do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
<%= link_back %>
|
||||
@@ -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 %>
|
||||
@@ -0,0 +1,32 @@
|
||||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t('blog.new_post'), new_panel_blog_post_path, :class => 'seclink1' %></li>
|
||||
</ul>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<h1><%= t('blog.list_post') %></h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('blog.title') %></th>
|
||||
<th><%= t('blog.body') %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @posts.each do |post| %>
|
||||
<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>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<h2><%=@post.title%></h2>
|
||||
<p>
|
||||
<%= @post.body%>
|
||||
</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t('blog.index'), panel_blog_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| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
<%= link_back %>
|
||||
@@ -0,0 +1,38 @@
|
||||
<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_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 %>
|
||||
|
||||
|
||||
<%= link_to t('blog.edit'), edit_panel_blog_post_path(@post) %> |
|
||||
<%= link_back %>
|
||||
@@ -0,0 +1,16 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<div class="widget_index">
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('blog.title') %></th>
|
||||
<th><%= t('blog.body') %></th>
|
||||
</tr>
|
||||
|
||||
<% @posts.each do |post| %>
|
||||
<tr>
|
||||
<td><%= link_to post.title,panel_blog_post_path(post) %></td>
|
||||
<td><%= post.body.truncate(14) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<div class="widget_latest_post">
|
||||
<h2><%= @post.title %> </h2>
|
||||
<p>
|
||||
<%= @post.body %>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,16 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<div class="widget_index">
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('blog.title') %></th>
|
||||
<th><%= t('blog.body') %></th>
|
||||
</tr>
|
||||
|
||||
<% @posts.each do |post| %>
|
||||
<tr>
|
||||
<td><%= link_to post.title,panel_blog_front_end_post_path(post) %></td>
|
||||
<td><%= post.body.truncate(14) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<div class="widget_latest_post">
|
||||
<h2><%= @post.title %> </h2>
|
||||
<p>
|
||||
<%= @post.body %>
|
||||
</p>
|
||||
</div>
|
||||
Reference in new issue
Block a user