Merge with new_blog
This commit is contained in:
1 parent
2e86d8081f
commit
64c68fcdeb
80 files changed
+906
-79
No files matched your search
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
*This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||
*and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||
*the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||
*= require_self
|
||||
*= require_tree .
|
||||
*/
|
||||
@@ -0,0 +1,9 @@
|
||||
.preview h2 {
|
||||
font-size: large;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.production h2 {
|
||||
font-size: large;
|
||||
background-color: green;
|
||||
}
|
||||
@@ -4,6 +4,14 @@ class Panel::Blog::PostsController < ApplicationController
|
||||
|
||||
# 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
|
||||
|
||||
@@ -84,3 +92,20 @@ 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
|
||||
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Blog</title>
|
||||
<%= stylesheet_link_tag :all %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= csrf_meta_tag %>
|
||||
</head>
|
||||
<body class="edit preview">
|
||||
<div class="wapper">
|
||||
<%= yield %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,4 @@
|
||||
<%= stylesheet_link_tag "production"%>
|
||||
<div class="wapper">
|
||||
<%= yield %>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<h2><%=@post.title%></h2>
|
||||
<p>
|
||||
<%= @post.body%>
|
||||
</p>
|
||||
@@ -0,0 +1,14 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('blog.title') %></th>
|
||||
<th><%= t('blog.body') %></th>
|
||||
</tr>
|
||||
|
||||
<% @posts.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.title %></td>
|
||||
<td><%= post.body.truncate(14) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
@@ -0,0 +1,5 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<h1><%= @post.title %> </h1>
|
||||
<p>
|
||||
<%= @post.body %>
|
||||
</p>
|
||||
Reference in new issue
Block a user