Merge branch 'master' into design_team

This commit is contained in:
Christophe Vilayphiou 2012-01-16 08:07:49 +08:00
commit b4f2354642
124 changed files with 557 additions and 347 deletions

View File

@ -19,6 +19,8 @@ gem 'sprockets'
gem 'radius' gem 'radius'
gem 'exception_notification'
# For linux # For linux
gem 'therubyracer' gem 'therubyracer'

View File

@ -69,6 +69,8 @@ GEM
warden (~> 1.1) warden (~> 1.1)
diff-lcs (1.1.3) diff-lcs (1.1.3)
erubis (2.7.0) erubis (2.7.0)
exception_notification (2.5.2)
actionmailer (>= 3.0.4)
execjs (1.2.9) execjs (1.2.9)
multi_json (~> 1.0) multi_json (~> 1.0)
factory_girl (2.3.2) factory_girl (2.3.2)
@ -97,7 +99,7 @@ GEM
multi_json (1.0.4) multi_json (1.0.4)
orm_adapter (0.0.5) orm_adapter (0.0.5)
polyglot (0.3.3) polyglot (0.3.3)
rack (1.3.5) rack (1.3.6)
rack-cache (1.1) rack-cache (1.1)
rack (>= 0.4) rack (>= 0.4)
rack-mount (0.8.3) rack-mount (0.8.3)
@ -196,6 +198,7 @@ DEPENDENCIES
database_cleaner database_cleaner
delorean delorean
devise devise
exception_notification
execjs execjs
factory_girl_rails factory_girl_rails
jquery-rails jquery-rails

View File

@ -6,7 +6,7 @@ $("#page_design_id").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes'); $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
}); });
$("#page_module_app").live('change', function() { $("#page_module_app_id").live('change', function() {
var app_id = $(this).val(); var app_id = $(this).val();
if(app_id!=''){ if(app_id!=''){
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_frontend_pages',function(data, textStatus){ $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_frontend_pages',function(data, textStatus){
@ -16,6 +16,6 @@ $("#page_module_app").live('change', function() {
}); });
} }
else{ else{
$("#app_page_url").remove(); $("#app_page_url").children().remove();
} }
}); });

View File

@ -392,7 +392,6 @@ modalWindow : function(settings,callbackFn){
tempwidth=maxwidth; tempwidth=maxwidth;
}else{tempwidth="auto";} }else{tempwidth="auto";}
$rss("body").append('<div class="rgmask" id="rgsheath" style="height:'+rgmaskHeight+'px"></div>'); $rss("body").append('<div class="rgmask" id="rgsheath" style="height:'+rgmaskHeight+'px"></div>');
$rss("#rgsheath").css({background: "#000", width: "100%", position: "fixed", top: 0, left: 0,opacity:0.9,'z-index':199}); $rss("#rgsheath").css({background: "#000", width: "100%", position: "fixed", top: 0, left: 0,opacity:0.9,'z-index':199});
$rss("body").append('<div id="rgWindow"></div>'); $rss("body").append('<div id="rgWindow"></div>');

View File

@ -4,14 +4,15 @@ class Admin::AppAuthsController < ApplicationController
before_filter :is_admin? before_filter :is_admin?
def index def index
@user_roles = UserRole.all.entries # @roles = Role.all.entries
apps = Purchase.where(:type =>"App") # apps = Purchase.where(:type =>"App")
@app_auth_data = apps.entries.map do |app| # @app_auth_data = apps.entries.map do |app|
app_c = eval(app.app_controller) # app_c = eval(app.app_controller)
obj = app_c.new # obj = app_c.new
obj_auth = obj.send "auth" # obj_auth = obj.send "auth"
[:app_obj => app,:auth_field => obj_auth] # [:app_obj => app,:auth_field => obj_auth]
end # end
@module_apps = ModuleApp.all
end end
end end

View File

@ -1,9 +1,33 @@
class Admin::ModuleAppsController < ApplicationController class Admin::ModuleAppsController < ApplicationController
layout "admin"
def reload_frontend_pages def index
@module_app = ModuleApp.find(params[:id]) @module_apps = ModuleApp.all.entries
respond_to do |format| end
format.js {}
def reload_frontend_pages
@module_app = ModuleApp.find(params[:id])
respond_to do |format|
format.js {}
end
end
def edit
@module_app = ModuleApp.find(params[:id])
end
def update
@module_app = ModuleApp.find(params[:id])
unless params['module_app']['enable_frontend'].nil?
@module_app.update_attribute('enable_frontend',params['module_app']['enable_frontend'])
@module_app.save!
end
@attribute = @module_app
respond_to do |format|
format.html { redirect_to :action => :index }
format.js { render 'admin/attributes/toggle_enable' }
end
end end
end end
end

View File

@ -28,7 +28,7 @@ class Admin::PagePartsController < ApplicationController
@partial = 'edit_text' @partial = 'edit_text'
@part_locale = params[:part_locale] || I18n.locale.to_s @part_locale = params[:part_locale] || I18n.locale.to_s
when 'module' 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' when 'snippet'
end end
end end

View File

@ -32,6 +32,7 @@ class Admin::PagesController < ApplicationController
@i18n_variable = @item.i18n_variable @i18n_variable = @item.i18n_variable
@designs = Design.all.entries @designs = Design.all.entries
@design = @item.design @design = @item.design
@app_frontend_urls = @item.module_app.app_pages
end end
def create def create

View File

@ -6,8 +6,15 @@ class ApplicationController < ActionController::Base
helper :all helper :all
before_filter :set_locale, :set_site before_filter :set_locale, :set_site
def front_end_available(module_app_title='')
app_controller = ModuleApp.first(conditions: {:title => module_app_title} )
unless app_controller.enable_frontend?
render :nothing
end
end
def get_all_app_engines def get_all_app_engines
ary = ["vender/plugins/NewBlog"] ary = ["vender/plugins/new_blog"]
app_engines = ary.collect{|t| app_engines = ary.collect{|t|
Rails::Engine.find t Rails::Engine.find t
} }

View File

@ -0,0 +1,4 @@
class ObitFrontendComponentController< ApplicationController
before_filter {|c| c.front_end_available(@app_title)}
layout 'production'
end

View File

@ -0,0 +1,3 @@
class ObitFrontendController< ObitFrontendComponentController
end

View File

@ -0,0 +1,3 @@
class ObitWidgetController< ObitFrontendComponentController
end

View File

@ -0,0 +1,6 @@
module Admin::AppAuthHelper
def on_off_switch(attribute,attribute_type)
link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch'
link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch'
end
end

View File

@ -15,55 +15,72 @@ class AppAuth
has_and_belongs_to_many :roles has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles
attr_protected :roles,:sub_roles,:privilege_users,:blocked_users,:users
def add_role role
add_operation(:roles,role)
end
def add_sub_role role
add_operation(:sub_roles,role)
end
def remove_role role
remove_operation(:roles,role)
end
def remove_sub_role role
remove_operation(:sub_roles,role)
end
def add_user_to_black_list user def add_user_to_black_list user
unless self.blocked_users.include?(user) add_operation(:blocked_users,user)
self.blocked_users << user
self.save!
else
false #should put error message for user existed in list already
end
end end
def remove_user_from_black_list user def remove_user_from_black_list user
if self.blocked_users.include? user remove_operation(:blocked_users,user)
self.blocked_users.delete user end
def add_user_to_privilege_list user
add_operation(:privilege_users,user)
end
def remove_user_from_privilege_list user
remove_operation(:privilege_users,user)
end
def remove_operation(item,obj)
if (self.send item).include? obj
(self.send item).delete obj
self.save! self.save!
else else
false #should put error message for user not existed in list false #should put error message for user not existed in list
end end
end end
def add_operation(item,obj)
def add_user_to_privilege_list user unless (self.send item).include?(obj)
unless self.privilege_users.include? user (self.send item) << obj
self.privilege_users << user
self.save! self.save!
else else
false #should put error message for user existed in list already false #should put error message for user existed in list already
end end
end end
def remove_user_from_privilege_list user
if self.privilege_users.include? user
self.privilege_users.delete user
self.save!
else
false #should put error message for user not existed in list
end
end
def auth_users def auth_users
if self.all? if self.all?
User.all.entries User.all.entries
else else
ary= self.roles.collect do |role| ary=[]
role.users [:roles,:sub_roles].each do |t_role|
ary += (self.send t_role).collect do |role|
role.users
end
end end
ary << self.privilege_users ary << self.privilege_users
ary.flatten! ary.flatten!.uniq
end end
end end

View File

@ -9,6 +9,14 @@ class ModuleApp
field :intro field :intro
field :update_info field :update_info
field :create_date field :create_date
field :enable_frontend,type: Boolean
field :app_pages ,type: Array
field :widgets ,type: Array
has_one :app_auth,dependent: :delete
field :app_pages ,type: Array field :app_pages ,type: Array

View File

@ -19,7 +19,10 @@ class User
accepts_nested_attributes_for :attribute_values, :allow_destroy => true accepts_nested_attributes_for :attribute_values, :allow_destroy => true
def avb_apps def avb_apps
query = AppAuth.any_of({all: true},{privilege_user_ids: self.id},{roles: self.role.id}).excludes(blocked_user_ids: self.id) sub_role_ids_ary=self.sub_roles.collect{|t| t.id}
query1 = AppAuth.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: self.id)
query2 = AppAuth.any_of({all: true},{privilege_user_ids: self.id},{role_ids: self.role.id}).excludes(blocked_user_ids: self.id)
(query1 + query2).uniq
end end
def name def name

View File

@ -1,32 +1,52 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<div id='user_list'> <% #render 'side_bar' %>
<div class="role_list"> <% end %>
<h1>User Role</h1>
<ul class="list"> <div class="main_list">
<% @roles.each do |role| %> <%= flash_messages %>
<li class="set_1"><%= link_to content_tag(:span, "Role") %></li> <div class="button_bar up">
<% end -%> <% #link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
</ul> </div>
<table>
<thead>
<tr>
<td><%= t('admin.app.title') %></td>
<td><%= t('admin.app.description') %></td>
<td><%= t('admin.app.use_status') %></td>
<td><%= t('admin.app.autdor') %></td>
<td><%= t('admin.app.organization') %></td>
<td><%= t('admin.app.version') %></td>
<td class="action"><%= t('admin.action') %></td>
</tr>
</thead>
<tbody>
<% @module_apps.each do |module_app| %>
<tr class="have" id="attribute_<%= module_app.id %>" class="have <%= "#{module_app.enable_frontend? ? 'disable' : ''}" %>">
<td class="name"><%= module_app.title %></td>
<td class="name"><%= module_app.intro %></td>
<td>
<% attribute_type = "module_app" %>
<% attribute = module_app %>
<%= link_to t(:enable), admin_module_app_path(attribute, :authenticity_token => form_authenticity_token, :module_app => {:enable_frontend => true}), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.enable_frontend ? 'none' : ''}", :class => 'switch' %>
<%= link_to t(:disable), admin_module_app_path(attribute, :authenticity_token => form_authenticity_token, :module_app => {:enable_frontend => false}), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.enable_frontend ? '' : 'none'}", :class => 'switch' %>
</td>
<td class="email"><%= module_app.author %></td>
<td class="email"><%= module_app.organization %></td>
<td class="admin"><%= module_app.version %></td>
<td class="action">
<%= link_to t(:show), admin_module_app_path(module_app), :class => 'show' %>
<%= link_to t(:edit), edit_admin_module_app_path(module_app), :class => 'edit' %>
<%= link_to t(:delete), admin_module_app_path(module_app), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
</td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
<% end %>
</tbody>
</table>
<div class="button_bar">
<%# link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
</div> </div>
</div> </div>
<% end -%>
<h1><%= t('admin.list_app_auths') %></h1>
<table>
<tr>
<th><%= t('admin.app.name') %></th>
<th><%= t('admin.description') %></th>
</tr>
<% @app_auth_data.each do |app| %>
<tr>
<td><%= app[0][:app_obj].title %></td>
<% app[0][:auth_field].each do |unit| %>
<td>
<%= render :partial => "auth_unit",:locals => {:unit => unit } %>
</td>
<%end%>
</tr>
<% end %>
</table>

View File

@ -38,7 +38,7 @@
<%= f.hidden_field :to_save, :value => true %> <%= f.hidden_field :to_save, :value => true %>
<% end %> <% end %>
<% else %> <% else %>
<%= File.basename (@design.default_css.file.url) %> <%= File.basename (@design.default_css.file.url) rescue "" %>
<% end %> <% end %>
</p> </p>
<p> <p>

View File

@ -1,6 +1,6 @@
<h1><%= t('admin.new_design') %></h1> <h1><%= t('admin.new_design') %></h1>
<%= form_for :design, :url => admin_designs_path do |f| %> <%= form_for @design, :url => admin_design_path(@design),:html => {:multipart => true} do |f| %>
<%= f.error_messages %> <%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %> <%= render :partial => "form", :locals => { :f => f } %>

View File

@ -1 +1 @@
<%= f.select :module_app, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %> <%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>

View File

@ -33,7 +33,7 @@
<p> <p>
<%= t('admin.module_app') %> <%= t('admin.module_app') %>
<%= render :partial => "admin/module_apps/app_selector", :locals => { :f => f } %> <%= render :partial => "admin/module_apps/app_selector", :locals => { :f => f } %>
<span id="app_page_url"></span> <span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls ) rescue ''%> </span>
</p> </p>
<p> <p>
<%= f.label :is_published, "#{t('admin.is_published')} ?" %> <%= f.label :is_published, "#{t('admin.is_published')} ?" %>

View File

@ -1,59 +1,59 @@
<div class="info_input"> <div class="info_input">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<thead class="list_head"> <thead class="list_head">
<tr> <tr>
<td><%= t('admin.key') %></td> <td><%= t('admin.key') %></td>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td> <td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
<% end %> <% end %>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr class="list_item"> <tr class="list_item">
<td><%= sub_role.new_record? ? (f.text_field :key, {:style => "width:150px"}) : sub_role.key %></td> <td><%= sub_role.new_record? ? (f.text_field :key, {:style => "width:150px"}) : sub_role.key %></td>
<%= f.fields_for :i18n_variable, (sub_role.new_record? ? sub_role.build_i18n_variable : sub_role.i18n_variable) do |f| %> <%= f.fields_for :i18n_variable, (sub_role.new_record? ? sub_role.build_i18n_variable : sub_role.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<td><%= f.text_field locale, :style => "width:150px" %></td> <td><%= f.text_field locale, :style => "width:150px" %></td>
<% end %> <% end %>
<% end %>
</tr>
</tbody>
</table>
<div class="group">
<h2>Attributes</h2>
<div class="info_input">
<table class="sub_role_attributes" border="0" cellspacing="0" cellpadding="0">
<thead class="list_head">
<tr>
<td><%= t('admin.key') %></td>
<td><%= t('admin.multilingual') %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
<% end %>
<td><%= t('admin.type')%></td>
<td>&nbsp;</td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
<div id='add_attribute'>
<%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %>
<a href="#" class="add"><%= t(:add) %></a>
<%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% sub_role.attribute_fields.each do |attribute_field| %>
<%= render :partial => 'attribute_field', :object => attribute_field, :locals => {:f => f} %>
<% end %> <% end %>
</tr> </tbody>
</tbody> </table>
</table>
<div class="group">
<h2>Attributes</h2>
<div class="info_input">
<table class="sub_role_attributes" border="0" cellspacing="0" cellpadding="0">
<thead class="list_head">
<tr>
<td><%= t('admin.key') %></td>
<td><%= t('admin.multilingual') %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
<% end %>
<td><%= t('admin.type')%></td>
<td>&nbsp;</td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
<div id='add_attribute'>
<%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %>
<a href="#" class="add"><%= t(:add) %></a>
<%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% sub_role.attribute_fields.each do |attribute_field| %>
<%= render :partial => 'attribute_field', :object => attribute_field, :locals => {:f => f} %>
<% end %>
</tbody>
</table>
</div>
</div> </div>
</div> </div>
</div>
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<script> <script>

View File

@ -1,39 +1,39 @@
<div id="sub_role_<%= sub_role.id %>" class="group" <%= raw(' style="display: none;"') unless @user.sub_role_ids.include?(sub_role.id) %>> <div id="sub_role_<%= sub_role.id %>" class="group" <%= raw(' style="display: none;"') unless @user.sub_role_ids.include?(sub_role.id) %>>
<h2><%= sub_role.i18n_variable[I18n.locale] %></h2> <h2><%= sub_role.i18n_variable[I18n.locale] %></h2>
<div class="info_input"> <div class="info_input">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<thead class="list_head"> <thead class="list_head">
<tr> <tr>
<td><%= t("admin.key") %></td> <td><%= t("admin.key") %></td>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td> <td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
<% end %> <% end %>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% sub_role.get_enabled_attribute_fields.each do |attr| %> <% sub_role.get_enabled_attribute_fields.each do |attr| %>
<%= f.fields_for :attribute_values, @user.get_value_from_field_id(attr.id) do |f| %> <%= f.fields_for :attribute_values, @user.get_value_from_field_id(attr.id) do |f| %>
<tr class="list_item"> <tr class="list_item">
<td><%= attr.i18n_variable[I18n.locale] %></td> <td><%= attr.i18n_variable[I18n.locale] %></td>
<% if attr["locale"] && attr["markup"] == 'text_field' %> <% if attr["locale"] && attr["markup"] == 'text_field' %>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<td><%= f.text_field locale %></td> <td><%= f.text_field locale %></td>
<% end %> <% end %>
<% else %> <% else %>
<td colspan=<%= @site_valid_locales.size %>> <td colspan=<%= @site_valid_locales.size %>>
<% if attr["markup"] == "text_field" %> <% if attr["markup"] == "text_field" %>
<%= f.text_field :non_locale %> <%= f.text_field :non_locale %>
<% elsif attr["markup"] == "select" %> <% elsif attr["markup"] == "select" %>
<%= f.select :non_locale, options_for_select(attr["options"], value['non_locale']) %> <%= f.select :non_locale, options_for_select(attr["options"], value['non_locale']) %>
<% end -%> <% end -%>
</td> </td>
<% end -%> <% end -%>
<%= f.hidden_field :attribute_field_id, :value => attr.id %> <%= f.hidden_field :attribute_field_id, :value => attr.id %>
<%= f.hidden_field :key, :value => attr.key %> <%= f.hidden_field :key, :value => attr.key %>
</tr> </tr>
<% end %> <% end %>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@
<%= render 'side_bar' %> <%= render 'side_bar' %>
<% end %> <% end %>
<div id="profile" class="clear">> <div id="profile" class="clear">
<%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %> <%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %>
<%= f.error_messages %> <%= f.error_messages %>
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'form', :locals => { :f => f } %>

View File

@ -23,5 +23,22 @@ PrototypeR4::Application.configure do
# Only use best-standards-support built into browsers # Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin config.action_dispatch.best_standards_support = :builtin
config.middleware.use ExceptionNotifier,
:email_prefix => "[R4_error]",
:sender_address => %{"notifier" <redmine@rulingcom.com>},
:exception_recipients => %w{chris@rulingcom.com}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:tls => true,
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => '587',
:domain => "smtp.gmail.com",
:authentication => "plain",
:user_name => "redmine@rulingcom.com",
:password => "rulingredmine" }
end end

Binary file not shown.

View File

@ -26,8 +26,8 @@
<div id="main_content" class="content"> <div id="main_content" class="content">
<r:content name='content_1' main='true'> <r:content name='content_1' main='true'>
</r:content> </r:content>
<div class="dymanic_load" path="/panel/blog/widget/latest_post"></div> <div class="dymanic_load" path="/panel/new_blog/widget/latest_post"></div>
<div class="dymanic_load" path="/panel/blog/widget/"></div> <div class="dymanic_load" path="/panel/new_blog/widget/"></div>
</div> </div>
<div id="footer" class="footer"> <div id="footer" class="footer">

View File

@ -84,7 +84,7 @@ module ParserBackEnd
c.define_tag 'content' do |tag| c.define_tag 'content' do |tag|
ret = '' ret = ''
if (tag.attributes["main"] == "true" && !page.module_app.nil?) if (tag.attributes["main"] == "true" && !page.module_app.nil?)
# ret << "<div id='appfrontend' class='dymanic_load' path='#{page.app_frontend_url}'></div>" ret << "<div id='appfrontend' class='dymanic_load' path='#{page.app_frontend_url}'></div>"
else else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
ret << "<div id='#{tag.attr['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" ret << "<div id='#{tag.attr['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>"

View File

@ -40,5 +40,4 @@ module ParserLayout
} }
} }
end end
end end

View File

@ -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.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 ) 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=>"1st post",:body=>"Long long time ago.....")
Post.create(:title=>"2ec post",:body=>"And?.....") Post.create(:title=>"2ec post",:body=>"And?.....")

View File

@ -6,129 +6,210 @@ describe AppAuth do
before do before do
User.all.destroy User.all.destroy
UserRole.all.destroy Role.all.destroy
SubRole.all.destroy
AppAuth.all.destroy AppAuth.all.destroy
ModuleApp.all.destroy ModuleApp.all.destroy
#Create some fixtures of Main Role #Create some fixtures of Main Role
main_role_key = ["Stud","Teacher","Staff"] main_role_key = ["Stud","Teacher","Staff"]
@new_main_role_list = main_role_key.each do |role| @new_main_role_list = main_role_key.each do |role|
new_role = UserRole.new :key => role new_role = Role.new :key => role
new_role.save new_role.save
end end
#Create Some SubRoles
sub_role_key = ["graduated_school","undergraduated_school","TA","Senior"]
@new_main_role_list = sub_role_key.each do |role|
new_role = SubRole.new :key => role
new_role.save
end
#Create some users of User #Create some users of User
user_emails = ["a_good_stud","a_bad_stud","a_teacher","a_staff"] user_emails = ["a_good_ug_stud_1","a_good_ug_stud_2","a_bad_ug_stud","a_good_g_stud","a_bad_g_stud","a_teacher","a_staff"]
user_emails.each do |user_email| user_emails.each do |user_email|
email=user_email+"@rulingcom.com" email=user_email+"@rulingcom.com"
new_user = User.new :email=> email new_user = User.new :email=> email
new_user.save new_user.save
end end
#MRK = Member Role Key SRK=Sub Role Key
@stud_MRK = Role.first(conditions:{key:"Stud"})
@teacher_MRK = Role.first(conditions:{key:"Teacher"})
@staff_MRK = Role.first(conditions:{key:"Staff"})
@stud_MRK = UserRole.first(conditions:{key:"Stud"}) @graduated_SRK = SubRole.first(conditions:{key:"graduated_school"})
@teacher_MRK = UserRole.first(conditions:{key:"Teacher"}) @under_graduated_SRK = SubRole.first(conditions:{key:"undergraduated_school"})
@staff_MRK = UserRole.first(conditions:{key:"Staff"}) @ta_SRK = SubRole.first(conditions:{key:"TA"})
@senior_SRK = SubRole.first(conditions:{key:"Senior"})
@good_stu = User.first(conditions:{email:"a_good_stud@rulingcom.com"}) @stud_MRK.sub_roles += [@graduated,@under_graduated,@ta]
@bad_stu = User.first(conditions:{email:"a_bad_stud@rulingcom.com"}) @stud_MRK.save!
@teacher_MRK.sub_roles = [@senior]
@teacher_MRK.save!
@good_ug_stu_1 = User.first(conditions:{email:"a_good_ug_stud_1@rulingcom.com"})
@good_ug_stu_2 = User.first(conditions:{email:"a_good_ug_stud_2@rulingcom.com"})
@bad_ug_stu = User.first(conditions:{email:"a_bad_ug_stud@rulingcom.com"})
@good_g_stu = User.first(conditions:{email:"a_good_g_stud@rulingcom.com"})
@bad_g_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"})
@teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"}) @teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"})
@staff = User.first(conditions:{email:"a_staff@rulingcom.com"}) @staff = User.first(conditions:{email:"a_staff@rulingcom.com"})
#setting Roles for users #setting Roles for users
@good_stu.user_role = @stud_MRK @good_g_stu.role = @stud_MRK
@bad_stu.user_role = @stud_MRK @bad_g_stu.role = @stud_MRK
@teacher.user_role = @teacher_MRK @good_ug_stu_1.role = @stud_MRK
@staff.user_role = @staff_MRK @good_ug_stu_2.role = @stud_MRK
@bad_ug_stu.role = @stud_MRK
@good_g_stu.sub_roles = [@graduated_SRK,@ta_SRK]
@bad_g_stu.sub_roles << @graduated_SRK
@good_ug_stu_1.sub_roles << @under_graduated_SRK
@good_ug_stu_2.sub_roles << @under_graduated_SRK
@bad_ug_stu.sub_roles << @under_graduated_SRK
@teacher.role = @teacher_MRK
@staff.role = @staff_MRK
@good_g_stu.save!
@bad_g_stu.save!
@good_ug_stu_1.save!
@good_ug_stu_2.save!
@bad_ug_stu.save!
@good_stu.save!
@bad_stu.save!
@teacher.save! @teacher.save!
@staff.save! @staff.save!
end end
describe "Testing basic structure" do describe "Starting a ClassBulletin Auth for teacher , staff and ta" do
before do before do
@app_auth = AppAuth.new() @bulletin_app_auth = AppAuth.new()
#all stud has access right #all teacher and staff has access right
@app_auth.user_roles << @stud_MRK @bulletin_app_auth.roles = [@teacher_MRK,@staff_MRK]
#all person with TA sub_role has access right
@bulletin_app_auth.sub_roles << @ta_SRK
#a_bad_stud add to block to app_auth #a_bad_ug_stud add to block to bulletin_app_auth
@app_auth.blocked_users << @bad_stu #@bulletin_app_auth.blocked_users << @bad_ug_stu
#all teacher has access right #all teacher has access right
@app_auth.user_roles << @teacher_MRK # @bulletin_app_auth.roles << @teacher_MRK
@app_auth.privilege_users << @staff # @bulletin_app_auth.privilege_users << @staff
@app_auth.save! @bulletin_app_auth.save!
end end
context "Should just initialize all obj that is needed" do context "Should just initialize all obj that is needed" do
it "Testing @app_auth init result" do it "Testing @bulletin_app_auth init result" do
@app_auth.user_roles.should have(2).item @bulletin_app_auth.roles.should have(2).item #teacher staff
@bulletin_app_auth.sub_roles.should have(1).item #ta
end end
it "@app_auth should have UserRoles: Stud , Teacher " do it "@bulletin_app_auth should have Roles: Staff , Teacher " do
key_ary = @app_auth.user_roles.collect do |role| key_ary = @bulletin_app_auth.roles.collect do |role|
role.key role.key
end end
key_ary.should == ["Stud","Teacher"] key_ary.sort.should == ["Staff","Teacher"].sort
end end
it "@app_auth should have one Privialage user which is belongs to Staff" do it "bulletin_app_auth should have 3 auth users" do
p_user_ary = @app_auth.privilege_users.collect do |p_user| user_ary = [@teacher,@staff,@good_g_stu]
p_user.user_role.key @bulletin_app_auth.auth_users.sort.should == user_ary.sort
check_user_has_app user_ary
end
it "Adding a undergraduate stud into app_auth by privilege list" do
user_ary = [@teacher,@staff,@good_g_stu,@good_ug_stu_1]
@bulletin_app_auth.add_user_to_privilege_list @good_ug_stu_1
@bulletin_app_auth.auth_users.sort.should == user_ary.sort
check_user_has_app user_ary
end
it "Adding all graudated-stud into app_auth" do
user_ary = [@teacher,@staff,@good_g_stu,@bad_g_stu]
@bulletin_app_auth.add_sub_role @graduated_SRK
@bulletin_app_auth.auth_users.sort.should == user_ary.sort
check_user_has_app user_ary
end
it "Blocking bad-graduate student" do
user_ary =[@teacher,@staff,@good_g_stu]
@bulletin_app_auth.add_sub_role @graduated_SRK
@bulletin_app_auth.add_user_to_black_list @bad_g_stu
@bulletin_app_auth.auth_users_after_block_list.sort.should == user_ary.sort
check_user_has_app user_ary
end
it "Removing all graudated-stud from app_auth" do
user_ary =[@teacher,@staff,@good_g_stu]
@bulletin_app_auth.add_sub_role @graduated_SRK
@bulletin_app_auth.remove_sub_role @graduated_SRK
@bulletin_app_auth.auth_users.sort.should == user_ary.sort
check_user_has_app user_ary
end
# it "@bulletin_app_auth should have one Privialage user which is belongs to Staff" do
# p_user_ary = @bulletin_app_auth.privilege_users.collect do |p_user|
# p_user.roles.key
# end
# p_user_ary.should include("Staff")
# end
# it "@bulletin_app_auth should have one student listed at blocklist" do
# @bad_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"})
# @bulletin_app_auth.blocked_users.should have(1).item
# @bulletin_app_auth.blocked_users.should include(@bad_stu)
# end
# it "[Development #1]-1.Authorizing roles: roles + blocklist" do
# @good_stu = User.first(conditions:{email:"a_good_g_stud@rulingcom.com"})
# @teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"})
# @staff = User.first(conditions:{email:"a_staff@rulingcom.com"})
# ary = [@good_stu,@teacher,@staff]
# @bulletin_app_auth.auth_users_after_block_list.should == ary
# end
#
# it "[Development #1]-2.Authorizing single users: list of users [new_user1~2]" do
# user_emails = ["new_user1","new_user2","new_user3","new_user4"]
# user_emails.each do |user_email|
# email=user_email+"@rulingcom.com"
# new_user = User.new :email=> email
# new_user.save
# end
# user1= User.first(conditions:{email:"new_user1@rulingcom.com"})
# user2= User.first(conditions:{email:"new_user2@rulingcom.com"})
# user3= User.first(conditions:{email:"new_user3@rulingcom.com"})
# user4= User.first(conditions:{email:"new_user4@rulingcom.com"})
#
# @bulletin_app_auth.privilege_users << user1
# @bulletin_app_auth.privilege_users << user2
#
# @bulletin_app_auth.auth_users_after_block_list.should include(user1,user2)
# @bulletin_app_auth.auth_users_after_block_list.should_not include(user3,user4)
#
# end
#
# it "[Development #1]-3.Authorizing roles and single users: roles + blocklist + list of users" do
# @bulletin_app_auth.auth_users.should have(7).item
# end
#
# it "[Development #1]-4.Authorizing all: blocklist" do
# @bad_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"})
# @new_bulletin_app_auth = (AppAuth.new :all => true)
# @new_bulletin_app_auth.blocked_users << @bad_stu
#
# @new_bulletin_app_auth.auth_users.should == User.all.entries
# @new_bulletin_app_auth.auth_users_after_block_list.should_not include(@bad_stu)
# @new_bulletin_app_auth.save!
# end
def check_user_has_app(user_ary)
user_ary.each do |user|
user.avb_apps.should include(@bulletin_app_auth)
end end
p_user_ary.should include("Staff")
end end
end
it "@app_auth should have one student listed at blocklist" do
@bad_stu = User.first(conditions:{email:"a_bad_stud@rulingcom.com"})
@app_auth.blocked_users.should have(1).item
@app_auth.blocked_users.should include(@bad_stu)
end
it "[Development #1]-1.Authorizing roles: roles + blocklist" do
@good_stu = User.first(conditions:{email:"a_good_stud@rulingcom.com"})
@teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"})
@staff = User.first(conditions:{email:"a_staff@rulingcom.com"})
ary = [@good_stu,@teacher,@staff]
@app_auth.auth_users_after_block_list.should == ary
end
it "[Development #1]-2.Authorizing single users: list of users [new_user1~2]" do
user_emails = ["new_user1","new_user2","new_user3","new_user4"]
user_emails.each do |user_email|
email=user_email+"@rulingcom.com"
new_user = User.new :email=> email
new_user.save
end
user1= User.first(conditions:{email:"new_user1@rulingcom.com"})
user2= User.first(conditions:{email:"new_user2@rulingcom.com"})
user3= User.first(conditions:{email:"new_user3@rulingcom.com"})
user4= User.first(conditions:{email:"new_user4@rulingcom.com"})
@app_auth.privilege_users << user1
@app_auth.privilege_users << user2
@app_auth.auth_users_after_block_list.should include(user1,user2)
@app_auth.auth_users_after_block_list.should_not include(user3,user4)
end
it "[Development #1]-3.Authorizing roles and single users: roles + blocklist + list of users" do
@app_auth.auth_users.should have(4).item
end
it "[Development #1]-4.Authorizing all: blocklist" do
@bad_stu = User.first(conditions:{email:"a_bad_stud@rulingcom.com"})
@new_app_auth = (AppAuth.new :all => true)
@new_app_auth.blocked_users << @bad_stu
@new_app_auth.auth_users.should == User.all.entries
@new_app_auth.auth_users_after_block_list.should_not include(@bad_stu)
@new_app_auth.save!
end
end

View File

@ -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

View File

@ -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

View File

@ -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 %>

View File

@ -1,5 +0,0 @@
require "NewBlog/engine"
module NewBlog
end

View File

@ -1,6 +0,0 @@
module NewBlog
class Engine < Rails::Engine
isolate_namespace NewBlog
PrototypeR4::Application::Orbit_Apps << "NewBlog"
end
end

View File

@ -1,2 +0,0 @@
module ApplicationHelper
end

View File

@ -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 %>

View File

@ -1,4 +1,4 @@
class Panel::Blog::BackEnd::PostsController < ApplicationController class Panel::NewBlog::BackEnd::PostsController < ApplicationController
layout 'admin' layout 'admin'
@ -45,7 +45,7 @@ class Panel::Blog::BackEnd::PostsController < ApplicationController
respond_to do |format| respond_to do |format|
if @post.save 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 } format.xml { render :xml => @post, :status => :created, :location => @post }
else else
format.html { render :action => "new" } format.html { render :action => "new" }
@ -61,7 +61,7 @@ class Panel::Blog::BackEnd::PostsController < ApplicationController
respond_to do |format| respond_to do |format|
if @post.update_attributes(params[:post]) 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 } format.xml { head :ok }
else else
format.html { render :action => "edit" } format.html { render :action => "edit" }
@ -77,7 +77,7 @@ class Panel::Blog::BackEnd::PostsController < ApplicationController
@post.destroy @post.destroy
respond_to do |format| 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 } format.xml { head :ok }
end end
end end

View File

@ -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

View 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

View File

@ -1,7 +1,12 @@
class Panel::Blog::Widget::PostsController < ApplicationController class Panel::NewBlog::Widget::PostsController < ObitWidgetController
layout 'production' layout 'production'
def initialize
super
@app_title = NewBlog::MOUDLEAPP_TITLE
end
# GET /posts # GET /posts
# GET /posts.xml # GET /posts.xml
def index def index

View File

@ -0,0 +1,6 @@
module ApplicationHelper
def check_show_frontend
front_end_available(NewBlog::MOUDLEAPP_TITLE)
end
end

View File

@ -0,0 +1,5 @@
module NewBlogHelper
def self.check_show_frontend
ApplicationController.front_end_available(NewBlog::MOUDLEAPP_TITLE)
end
end

View 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 %>

View File

@ -1,6 +1,6 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<ul class="list"> <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> </ul>
<% end -%> <% end -%>
@ -21,9 +21,9 @@
<tr> <tr>
<td><%= post.title %></td> <td><%= post.title %></td>
<td><%= truncate(post.body,:length=>15) %></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.show'), panel_new_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.edit'), edit_panel_new_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.delete'), panel_new_blog_back_end_post_path(post), :confirm => t('blog.sure?'), :method => :delete %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>

View File

@ -1,4 +1,4 @@
<%=stylesheet_link_tag "NewBlog/application"%> <%=stylesheet_link_tag "new_blog/application"%>
<h2><%=@post.title%></h2> <h2><%=@post.title%></h2>
<p> <p>
<%= @post.body%> <%= @post.body%>

View File

@ -1,12 +1,12 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<ul class="list"> <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> </ul>
<% end -%> <% end -%>
<%= flash_messages %> <%= flash_messages %>
<h1><%= t('blog.new_post') %></h1> <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} %> <%= render :partial => 'form', :locals => {:f => f} %>
<% end %> <% end %>

View File

@ -18,7 +18,7 @@
</p> </p>
<% end %> <% 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> <p>
<%= f.label :name, "Author" %><br /> <%= f.label :name, "Author" %><br />
@ -34,5 +34,5 @@
<% end %> <% 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 %> <%= link_back %>

View File

@ -2,6 +2,6 @@
<%= post_frontend.title %><br /> <%= post_frontend.title %><br />
<p> <p>
<%= truncate(post_frontend.body,:length=>25) %> <%= 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> </p>
</div> </div>

View File

@ -1,6 +1,6 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<ul class="list"> <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> </ul>
<% end -%> <% end -%>

View File

@ -18,7 +18,7 @@
</p> </p>
<% end %> <% 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> <p>
<%= f.label :name, "Author" %><br /> <%= f.label :name, "Author" %><br />

View File

@ -1,4 +1,4 @@
<%=stylesheet_link_tag "NewBlog/application"%> <%=stylesheet_link_tag "new_blog/application"%>
<div class="widget_index"> <div class="widget_index">
<table> <table>
<tr> <tr>
@ -8,7 +8,7 @@
<% @posts.each do |post| %> <% @posts.each do |post| %>
<tr> <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> <td><%= post.body.truncate(14) %></td>
</tr> </tr>
<% end %> <% end %>

View File

@ -1,4 +1,4 @@
<%=stylesheet_link_tag "NewBlog/application"%> <%=stylesheet_link_tag "new_blog/application"%>
<div class="widget_latest_post"> <div class="widget_latest_post">
<h2><%= @post.title %> </h2> <h2><%= @post.title %> </h2>
<p> <p>

View File

@ -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"

View File

@ -1,7 +1,7 @@
Rails.application.routes.draw do Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :blog do namespace :new_blog do
namespace :back_end do namespace :back_end do
root :to => "posts#index" root :to => "posts#index"
resources :posts resources :posts

View File

@ -0,0 +1,5 @@
require "new_blog/engine"
module NewBlog
end

View File

@ -0,0 +1,5 @@
module NewBlog
class Engine < Rails::Engine
isolate_namespace new_blog
end
end

View File

@ -6,5 +6,7 @@
"intro": "A simple blog……", "intro": "A simple blog……",
"update_info": "Some info", "update_info": "Some info",
"create_date": "11-11-2011", "create_date": "11-11-2011",
"app_pages": ["/panel/blog/front_end/"] "app_pages": ["/panel/new_blog/front_end/"],
"widgets": ["/panel/new_blog/widget/latest_post","/panel/new_blog/widget/"],
"enable_frontend": false
} }

Some files were not shown because too many files have changed in this diff Show More