Change NewBlog to new_blog
This commit is contained in:
parent
79f778ad8c
commit
cae3daa9c4
|
@ -28,7 +28,7 @@ class Admin::PagePartsController < ApplicationController
|
|||
@partial = 'edit_text'
|
||||
@part_locale = params[:part_locale] || I18n.locale.to_s
|
||||
when 'module'
|
||||
@plugins=[{:module=>"Blog",:widgets=>[{:name=>"Blog",:path=>"panel/blog/widget_latest_post"},{:name=>"Blog",:path=>"panel/blog/widget_index"}]}]
|
||||
@plugins=[{:module=>"Blog",:widgets=>[{:name=>"Blog",:path=>"panel/new_blog/widget_latest_post"},{:name=>"Blog",:path=>"panel/new_blog/widget_index"}]}]
|
||||
when 'snippet'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,12 +9,12 @@ class ApplicationController < ActionController::Base
|
|||
def front_end_available(module_app_title='')
|
||||
app_controller = ModuleApp.first(conditions: {:title => module_app_title} )
|
||||
unless app_controller.enable_frontend?
|
||||
render :text => 'View not available'
|
||||
render :nothing
|
||||
end
|
||||
end
|
||||
|
||||
def get_all_app_engines
|
||||
ary = ["vender/plugins/NewBlog"]
|
||||
ary = ["vender/plugins/new_blog"]
|
||||
app_engines = ary.collect{|t|
|
||||
Rails::Engine.find t
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
class ObitFrontendComponentController< ApplicationController
|
||||
before_filter {|c| c.front_end_available(@app_title)}
|
||||
layout 'production'
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class ObitFrontendController< ObitFrontendComponentController
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class ObitWidgetController< ObitFrontendComponentController
|
||||
|
||||
end
|
BIN
lib/NewBlog.zip
BIN
lib/NewBlog.zip
Binary file not shown.
|
@ -26,8 +26,8 @@
|
|||
<div id="main_content" class="content">
|
||||
<r:content name='content_1' main='true'>
|
||||
</r:content>
|
||||
<div class="dymanic_load" path="/panel/blog/widget/latest_post"></div>
|
||||
<div class="dymanic_load" path="/panel/blog/widget/"></div>
|
||||
<div class="dymanic_load" path="/panel/new_blog/widget/latest_post"></div>
|
||||
<div class="dymanic_load" path="/panel/new_blog/widget/"></div>
|
||||
</div>
|
||||
|
||||
<div id="footer" class="footer">
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace :dev do
|
|||
|
||||
home = Page.create!( :i18n_variable_id => var_10.id, :design_id => design_1.id, :name => 'home', :is_published => true, :theme_id => theme.id )
|
||||
home.page_parts.create!( :name => 'content_1', :content => File.open("#{Rails.root}/lib/template/home.page").read, :kind => 'text', :i18n_variable_id => var_13.id )
|
||||
ModuleApp.create.from_json(File.open("#{Rails.root}/vendor/built_in_modules/NewBlog/NewBlog.json").read).save
|
||||
ModuleApp.create.from_json(File.open("#{Rails.root}/vendor/built_in_modules/new_blog/new_blog.json").read).save
|
||||
Post.create(:title=>"1st post",:body=>"Long long time ago.....")
|
||||
Post.create(:title=>"2ec post",:body=>"And?.....")
|
||||
|
||||
|
|
|
@ -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,5 +0,0 @@
|
|||
require "NewBlog/engine"
|
||||
|
||||
|
||||
module NewBlog
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
<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><%= post.body %></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 />
|
||||
|
||||
<%= link_to t('blog.new_post'), new_panel_blog_back_end_post_path %>
|
|
@ -1,4 +1,4 @@
|
|||
class Panel::Blog::BackEnd::PostsController < ApplicationController
|
||||
class Panel::NewBlog::BackEnd::PostsController < ApplicationController
|
||||
|
||||
layout 'admin'
|
||||
|
||||
|
@ -45,7 +45,7 @@ class Panel::Blog::BackEnd::PostsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
if @post.save
|
||||
format.html { redirect_to(panel_blog_post_url(@post), :notice => t('blog.create_post_success')) }
|
||||
format.html { redirect_to(panel_new_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" }
|
||||
|
@ -61,7 +61,7 @@ class Panel::Blog::BackEnd::PostsController < ApplicationController
|
|||
|
||||
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.html { redirect_to(panel_new_blog_post_url(@post), :notice => t('blog.update_post_success')) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
|
@ -77,7 +77,7 @@ class Panel::Blog::BackEnd::PostsController < ApplicationController
|
|||
@post.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_blog_posts_url) }
|
||||
format.html { redirect_to(panel_new_blog_posts_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class Panel::NewBlog::FrontEnd::CommentsController < ObitFrontendController
|
||||
def create
|
||||
@post = Post.find(params[:post_id])
|
||||
@comment = @post.comments.create!(params[:comment])
|
||||
redirect_to panel_new_blog_front_end_post_url(@post)
|
||||
end
|
||||
end
|
21
vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb
vendored
Normal file
21
vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
class Panel::NewBlog::FrontEnd::PostsController < ObitFrontendController
|
||||
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = NewBlog::MOUDLEAPP_TITLE
|
||||
end
|
||||
|
||||
# GET /posts
|
||||
# GET /posts.xml
|
||||
|
||||
def index
|
||||
@posts = Post.all
|
||||
end
|
||||
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class Panel::Blog::Widget::PostsController < ObitWidgetController
|
||||
class Panel::NewBlog::Widget::PostsController < ObitWidgetController
|
||||
|
||||
layout 'production'
|
||||
|
8
vendor/built_in_modules/new_blog/app/views/panel/new_blog/back_end/posts/edit.html.erb
vendored
Normal file
8
vendor/built_in_modules/new_blog/app/views/panel/new_blog/back_end/posts/edit.html.erb
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
<h1><%= t('blog.editing_post') %></h1>
|
||||
|
||||
<%= form_for @post, :url => panel_new_blog_back_end_post_path(@post) do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to t('blog.show'), panel_new_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_back_end_post_path, :class => 'seclink1' %></li>
|
||||
<li><%= link_to t('blog.new_post'), new_panel_new_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_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>
|
||||
<td><%= link_to t('blog.show'), panel_new_blog_back_end_post_path(post) %></td>
|
||||
<td><%= link_to t('blog.edit'), edit_panel_new_blog_back_end_post_path(post) %></td>
|
||||
<td><%= link_to t('blog.delete'), panel_new_blog_back_end_post_path(post), :confirm => t('blog.sure?'), :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
|
@ -1,4 +1,4 @@
|
|||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<%=stylesheet_link_tag "new_blog/application"%>
|
||||
<h2><%=@post.title%></h2>
|
||||
<p>
|
||||
<%= @post.body%>
|
|
@ -1,12 +1,12 @@
|
|||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t('blog.index'), panel_blog_back_end_posts_path, :class => 'seclink2' %></li>
|
||||
<li><%= link_to t('blog.index'), panel_new_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| %>
|
||||
<%= form_for @post, :url => panel_new_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_front_end_comments_path do |f| %>
|
||||
<%= form_for Comment.new, :url => panel_new_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_back_end_post_path(@post) %> |
|
||||
<%= link_to t('blog.edit'), edit_panel_new_blog_back_end_post_path(@post) %> |
|
||||
<%= link_back %>
|
|
@ -2,6 +2,6 @@
|
|||
<%= post_frontend.title %><br />
|
||||
<p>
|
||||
<%= truncate(post_frontend.body,:length=>25) %>
|
||||
<%= link_to 'Read more...',panel_blog_front_end_post_path(post_frontend) %>
|
||||
<%= link_to 'Read more...',panel_new_blog_front_end_post_path(post_frontend) %>
|
||||
</p>
|
||||
</div>
|
|
@ -1,6 +1,6 @@
|
|||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t('blog.new_post'), new_panel_blog_back_end_post_path, :class => 'seclink1' %></li>
|
||||
<li><%= link_to t('blog.new_post'), new_panel_new_blog_back_end_post_path, :class => 'seclink1' %></li>
|
||||
</ul>
|
||||
<% end -%>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= form_for Comment.new, :url => panel_blog_front_end_comments_path do |f| %>
|
||||
<%= form_for Comment.new, :url => panel_new_blog_front_end_comments_path do |f| %>
|
||||
<p>
|
||||
|
||||
<%= f.label :name, "Author" %><br />
|
|
@ -1,4 +1,4 @@
|
|||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<%=stylesheet_link_tag "new_blog/application"%>
|
||||
<div class="widget_index">
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -8,7 +8,7 @@
|
|||
|
||||
<% @posts.each do |post| %>
|
||||
<tr>
|
||||
<td><%= link_to post.title,panel_blog_front_end_post_path(post) %></td>
|
||||
<td><%= link_to post.title,panel_new_blog_front_end_post_path(post) %></td>
|
||||
<td><%= post.body.truncate(14) %></td>
|
||||
</tr>
|
||||
<% end %>
|
|
@ -1,4 +1,4 @@
|
|||
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||
<%=stylesheet_link_tag "new_blog/application"%>
|
||||
<div class="widget_latest_post">
|
||||
<h2><%= @post.title %> </h2>
|
||||
<p>
|
|
@ -0,0 +1,18 @@
|
|||
# module NewBlog
|
||||
# class MyEngine < Rails::Engine
|
||||
# # Add a load path for this specific Engine
|
||||
# # config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
|
||||
# put "ABC"
|
||||
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
|
||||
#
|
||||
# # initializer "my_engine.add_middleware" do |app|
|
||||
# # app.middleware.use MyEngine::Middleware
|
||||
# # end
|
||||
# end
|
||||
#
|
||||
# end
|
||||
module NewBlog
|
||||
VERSION = "0.0.1"
|
||||
MOUDLEAPP_TITLE = "NewBlog"
|
||||
end
|
||||
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
|
|
@ -0,0 +1,25 @@
|
|||
Rails.application.routes.draw do
|
||||
|
||||
namespace :panel do
|
||||
namespace :new_blog do
|
||||
namespace :back_end do
|
||||
root :to => "posts#index"
|
||||
resources :posts
|
||||
resources :comments
|
||||
end
|
||||
namespace :front_end do
|
||||
root :to => "posts#index"
|
||||
match "show/:id" => "posts#show" ,:as => :post
|
||||
match "comments" => "comments#create",:as => :comments
|
||||
end
|
||||
namespace :widget do
|
||||
root :to => "posts#index"
|
||||
match "latest_post" => "posts#latest_post"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# match "appfront/blog/front_end/show/:id" => "posts#frontend_show" ,:as => :appfront_blog_show
|
||||
|
||||
match "/appfront/*path" => redirect("/panel/*path")
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require "new_blog/engine"
|
||||
|
||||
|
||||
module NewBlog
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
module NewBlog
|
||||
class Engine < Rails::Engine
|
||||
isolate_namespace NewBlog
|
||||
isolate_namespace new_blog
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"title": "NewBlog",
|
||||
"version": "0.1",
|
||||
"organization": "Rulingcom",
|
||||
"author": "RD dep",
|
||||
"intro": "A simple blog……",
|
||||
"update_info": "Some info",
|
||||
"create_date": "11-11-2011",
|
||||
"app_pages": ["/panel/new_blog/front_end/"],
|
||||
"widgets": ["/panel/new_blog/widget/latest_post","/panel/new_blog/widget/"],
|
||||
"enable_frontend": false
|
||||
}
|
Loading…
Reference in New Issue