Move NewBlog to built_in_modules and delete "vendor/templates"
This commit is contained in:
1 parent
95c40d2e53
commit
e7c9816139
87 files changed
+524
-3
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -1,7 +0,0 @@
|
||||
/*
|
||||
*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 .
|
||||
*/
|
||||
@@ -1,51 +0,0 @@
|
||||
/* module */
|
||||
#module{
|
||||
float: left;
|
||||
width: 170px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.production {
|
||||
padding: 10px;
|
||||
font-size: 12px;
|
||||
border: 1px solid #e1e1e1;
|
||||
margin-bottom: 10px;
|
||||
background: #DDDAD0;
|
||||
color: #484339;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-moz-box-shadow: 0 0 5px #33322C;
|
||||
-webkit-box-shadow: 0 0 5px #33322C;
|
||||
box-shadow: 0 0 5px #33322C;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
line-height: 1.4;
|
||||
font-family: Arial;
|
||||
}
|
||||
.production h2{
|
||||
font-size: 18px;
|
||||
margin-bottom: 10px;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
border-left: 4px solid #B6300C;
|
||||
line-height: 20px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.production table{
|
||||
border: 1px solid #9b968c;
|
||||
padding: 5px;
|
||||
width: 145px;
|
||||
}
|
||||
.production th{
|
||||
background: #d3cfc3;
|
||||
font-weight: bold;
|
||||
}
|
||||
.production th, .production tr, .production td{
|
||||
border: 1px solid #9b968c;
|
||||
padding: 5px;
|
||||
}
|
||||
.production a{
|
||||
color: #9a460e;
|
||||
text-decoration: none;
|
||||
}
|
||||
.production a:hover{
|
||||
text-decoration: underline;
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,23 +0,0 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
before_filter :set_locale
|
||||
|
||||
# Set I18n.locale
|
||||
def set_locale
|
||||
# update session if passed
|
||||
session[:locale] = params[:locale] if params[:locale]
|
||||
|
||||
# set locale based on session or default
|
||||
begin
|
||||
# check if locale is valid for non site pages
|
||||
if !VALID_LOCALES.include?(session[:locale])
|
||||
I18n.locale = I18n.default_locale
|
||||
else
|
||||
I18n.locale = session[:locale]
|
||||
end
|
||||
rescue
|
||||
I18n.locale = I18n.default_locale
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
-84
@@ -1,84 +0,0 @@
|
||||
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
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
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
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
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
|
||||
@@ -1,15 +0,0 @@
|
||||
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
|
||||
Whitespace-only changes.
@@ -1,2 +0,0 @@
|
||||
module ApplicationHelper
|
||||
end
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -1,7 +0,0 @@
|
||||
class Comment
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
field :name, :type => String
|
||||
field :body, :type => String
|
||||
embedded_in :post, :inverse_of => :comments
|
||||
end
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
class Post
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
field :title, :type => String
|
||||
field :body, :type => String
|
||||
embeds_many :comments
|
||||
validates_presence_of :title, :body
|
||||
end
|
||||
Whitespace-only changes.
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Blog</title>
|
||||
<%= stylesheet_link_tag :all %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= csrf_meta_tag %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,3 +0,0 @@
|
||||
<div class="production">
|
||||
<%= yield %>
|
||||
</div>
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
<%= 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>
|
||||
@@ -1,8 +0,0 @@
|
||||
<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,32 +0,0 @@
|
||||
<% 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
@@ -1,5 +0,0 @@
|
||||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<h2><%=@post.title%></h2>
|
||||
<p>
|
||||
<%= @post.body%>
|
||||
</p>
|
||||
@@ -1,13 +0,0 @@
|
||||
<% 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 %>
|
||||
@@ -1,38 +0,0 @@
|
||||
<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 %>
|
||||
|
||||
|
||||
<%= link_to t('blog.edit'), edit_panel_blog_back_end_post_path(@post) %> |
|
||||
<%= link_back %>
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
<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>
|
||||
@@ -1,11 +0,0 @@
|
||||
<% 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 %>
|
||||
@@ -1,34 +0,0 @@
|
||||
<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,16 +0,0 @@
|
||||
<%=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>
|
||||
@@ -1,7 +0,0 @@
|
||||
<%=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