Merge branch 'fix_it'
Conflicts: app/assets/javascripts/page_edit.js app/assets/javascripts/rss.js app/assets/stylesheets/admin.css.erb app/assets/stylesheets/admin_back_end.css.erb app/controllers/admin/app_auths_controller.rb app/controllers/admin/module_apps_controller.rb app/controllers/admin/users_controller.rb app/controllers/application_controller.rb app/models/app_auth.rb app/models/user/user.rb app/views/admin/app_auths/index.html.erb app/views/admin/attributes/_attribute_field.html.erb app/views/admin/designs/_new.html.erb app/views/admin/designs/new.html.erb app/views/admin/infos/_form.html.erb app/views/admin/module_apps/_app_selector.html.erb app/views/admin/module_apps/index.html.erb app/views/admin/pages/_form.html.erb app/views/admin/roles/_form.html.erb app/views/admin/roles/_sub_role.html.erb app/views/admin/users/_form.html.erb app/views/admin/users/_show_sub_role.html.erb app/views/admin/users/_sub_role.html.erb app/views/admin/users/edit.html.erb app/views/admin/users/index.html.erb app/views/admin/users/new.html.erb app/views/admin/users/show.html.erb app/views/layouts/admin.html.erb lib/fraisier/layout.html lib/parsers/parser_back_end.rb lib/parsers/parser_layout.rb lib/tasks/dev.rake spec/models/app_auth_basic.rb vendor/built_in_modules/NewBlog/.gitignore vendor/built_in_modules/NewBlog/Gemfile vendor/built_in_modules/NewBlog/Gemfile.lock vendor/built_in_modules/NewBlog/MIT-LICENSE vendor/built_in_modules/NewBlog/NewBlog.gemspec vendor/built_in_modules/NewBlog/README.rdoc vendor/built_in_modules/NewBlog/Rakefile vendor/built_in_modules/NewBlog/app/assets/images/NewBlog/.gitkeep vendor/built_in_modules/NewBlog/app/assets/javascripts/NewBlog/.gitkeep vendor/built_in_modules/NewBlog/app/assets/stylesheets/NewBlog/.gitkeep vendor/built_in_modules/NewBlog/app/assets/stylesheets/NewBlog/application.css vendor/built_in_modules/NewBlog/app/assets/stylesheets/NewBlog/production.css vendor/built_in_modules/NewBlog/app/controllers/.gitkeep vendor/built_in_modules/NewBlog/app/controllers/application_controller.rb vendor/built_in_modules/NewBlog/app/controllers/panel/blog/back_end/posts_controller.rb vendor/built_in_modules/NewBlog/app/helpers/.gitkeep vendor/built_in_modules/NewBlog/app/helpers/application_helper.rb vendor/built_in_modules/NewBlog/app/mailers/.gitkeep vendor/built_in_modules/NewBlog/app/models/.gitkeep vendor/built_in_modules/NewBlog/app/models/comment.rb vendor/built_in_modules/NewBlog/app/models/post.rb vendor/built_in_modules/NewBlog/app/views/.gitkeep vendor/built_in_modules/NewBlog/app/views/layouts/application.html.erb vendor/built_in_modules/NewBlog/app/views/layouts/edit_view.html.erb vendor/built_in_modules/NewBlog/app/views/layouts/production.html.erb vendor/built_in_modules/NewBlog/app/views/panel/blog/back_end/posts/_form.html.erb vendor/built_in_modules/NewBlog/app/views/panel/blog/back_end/posts/index.html.erb vendor/built_in_modules/NewBlog/app/views/panel/blog/back_end/posts/latest_post.html.erb vendor/built_in_modules/NewBlog/app/views/panel/blog/back_end/posts/new.html.erb vendor/built_in_modules/NewBlog/app/views/panel/blog/back_end/posts/show.html.erb vendor/built_in_modules/NewBlog/app/views/panel/blog/front_end/posts/show.html.erb vendor/built_in_modules/NewBlog/app/views/panel/blog/widget/posts/index.html.erb vendor/built_in_modules/NewBlog/app/views/panel/blog/widget/posts/latest_post.html.erb vendor/built_in_modules/NewBlog/config/locales/en.yml vendor/built_in_modules/NewBlog/lib/NewBlog.rb vendor/built_in_modules/NewBlog/lib/NewBlog/engine.rb vendor/built_in_modules/NewBlog/lib/NewBlog/version.rb vendor/built_in_modules/NewBlog/lib/tasks/NewBlog_tasks.rake vendor/built_in_modules/NewBlog/script/rails vendor/built_in_modules/NewBlog/test/NewBlog_test.rb vendor/built_in_modules/NewBlog/test/dummy/Rakefile vendor/built_in_modules/NewBlog/test/dummy/app/assets/javascripts/application.js vendor/built_in_modules/NewBlog/test/dummy/app/assets/stylesheets/application.css vendor/built_in_modules/NewBlog/test/dummy/app/controllers/application_controller.rb vendor/built_in_modules/NewBlog/test/dummy/app/helpers/application_helper.rb vendor/built_in_modules/NewBlog/test/dummy/app/mailers/.gitkeep vendor/built_in_modules/NewBlog/test/dummy/app/models/.gitkeep vendor/built_in_modules/NewBlog/test/dummy/app/views/layouts/application.html.erb vendor/built_in_modules/NewBlog/test/dummy/config.ru vendor/built_in_modules/NewBlog/test/dummy/config/application.rb vendor/built_in_modules/NewBlog/test/dummy/config/boot.rb vendor/built_in_modules/NewBlog/test/dummy/config/database.yml vendor/built_in_modules/NewBlog/test/dummy/config/environment.rb vendor/built_in_modules/NewBlog/test/dummy/config/environments/development.rb vendor/built_in_modules/NewBlog/test/dummy/config/environments/production.rb vendor/built_in_modules/NewBlog/test/dummy/config/environments/test.rb vendor/built_in_modules/NewBlog/test/dummy/config/initializers/backtrace_silencers.rb vendor/built_in_modules/NewBlog/test/dummy/config/initializers/inflections.rb vendor/built_in_modules/NewBlog/test/dummy/config/initializers/mime_types.rb vendor/built_in_modules/NewBlog/test/dummy/config/initializers/secret_token.rb vendor/built_in_modules/NewBlog/test/dummy/config/initializers/session_store.rb vendor/built_in_modules/NewBlog/test/dummy/config/initializers/wrap_parameters.rb vendor/built_in_modules/NewBlog/test/dummy/config/locales/en.yml vendor/built_in_modules/NewBlog/test/dummy/config/mongoid.yml vendor/built_in_modules/NewBlog/test/dummy/config/routes.rb vendor/built_in_modules/NewBlog/test/dummy/lib/assets/.gitkeep vendor/built_in_modules/NewBlog/test/dummy/log/.gitkeep vendor/built_in_modules/NewBlog/test/dummy/public/404.html vendor/built_in_modules/NewBlog/test/dummy/public/422.html vendor/built_in_modules/NewBlog/test/dummy/public/500.html vendor/built_in_modules/NewBlog/test/dummy/public/favicon.ico vendor/built_in_modules/NewBlog/test/dummy/script/rails vendor/built_in_modules/NewBlog/test/integration/navigation_test.rb vendor/built_in_modules/NewBlog/test/test_helper.rb vendor/built_in_modules/blog/app/controllers/application_controller.rb vendor/built_in_modules/blog/app/controllers/panel/blog/posts_controller.rb vendor/built_in_modules/blog/app/helpers/application_helper.rb vendor/built_in_modules/blog/app/models/comment.rb vendor/built_in_modules/blog/app/models/post.rb vendor/built_in_modules/blog/app/views/layouts/application.html.erb vendor/built_in_modules/blog/app/views/panel/blog/posts/_form.html.erb vendor/built_in_modules/blog/app/views/panel/blog/posts/index.html.erb vendor/built_in_modules/blog/app/views/panel/blog/posts/show.html.erb vendor/built_in_modules/blog/config/initializers/backtrace_silencers.rb vendor/built_in_modules/blog/config/initializers/inflections.rb vendor/built_in_modules/blog/config/initializers/mime_types.rb vendor/built_in_modules/blog/public/404.html vendor/built_in_modules/blog/public/422.html vendor/built_in_modules/blog/public/500.html vendor/built_in_modules/blog/public/favicon.ico vendor/built_in_modules/blog/public/stylesheets/.gitkeep vendor/built_in_modules/blog/script/rails vendor/built_in_modules/blog/vendor/plugins/.gitkeep vendor/built_in_modules/new_blog/.gitignore vendor/built_in_modules/new_blog/Gemfile vendor/built_in_modules/new_blog/Gemfile.lock vendor/built_in_modules/new_blog/MIT-LICENSE vendor/built_in_modules/new_blog/README.rdoc vendor/built_in_modules/new_blog/Rakefile vendor/built_in_modules/new_blog/app/assets/images/NewBlog/.gitkeep vendor/built_in_modules/new_blog/app/assets/javascripts/NewBlog/.gitkeep vendor/built_in_modules/new_blog/app/assets/stylesheets/NewBlog/.gitkeep vendor/built_in_modules/new_blog/app/assets/stylesheets/NewBlog/application.css vendor/built_in_modules/new_blog/app/assets/stylesheets/NewBlog/production.css vendor/built_in_modules/new_blog/app/controllers/.gitkeep vendor/built_in_modules/new_blog/app/controllers/application_controller.rb vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/back_end/posts_controller.rb vendor/built_in_modules/new_blog/app/helpers/.gitkeep vendor/built_in_modules/new_blog/app/mailers/.gitkeep vendor/built_in_modules/new_blog/app/models/.gitkeep vendor/built_in_modules/new_blog/app/models/comment.rb vendor/built_in_modules/new_blog/app/models/post.rb vendor/built_in_modules/new_blog/app/views/.gitkeep vendor/built_in_modules/new_blog/app/views/layouts/application.html.erb vendor/built_in_modules/new_blog/app/views/layouts/edit_view.html.erb vendor/built_in_modules/new_blog/app/views/layouts/production.html.erb vendor/built_in_modules/new_blog/app/views/panel/new_blog/back_end/posts/_form.html.erb vendor/built_in_modules/new_blog/app/views/panel/new_blog/back_end/posts/index.html.erb vendor/built_in_modules/new_blog/app/views/panel/new_blog/back_end/posts/latest_post.html.erb vendor/built_in_modules/new_blog/app/views/panel/new_blog/back_end/posts/new.html.erb vendor/built_in_modules/new_blog/app/views/panel/new_blog/back_end/posts/show.html.erb vendor/built_in_modules/new_blog/app/views/panel/new_blog/front_end/posts/show.html.erb vendor/built_in_modules/new_blog/app/views/panel/new_blog/widget/posts/index.html.erb vendor/built_in_modules/new_blog/app/views/panel/new_blog/widget/posts/latest_post.html.erb vendor/built_in_modules/new_blog/config/locales/en.yml vendor/built_in_modules/new_blog/lib/new_blog/version.rb vendor/built_in_modules/new_blog/lib/tasks/NewBlog_tasks.rake vendor/built_in_modules/new_blog/new_blog.gemspec vendor/built_in_modules/new_blog/script/rails vendor/built_in_modules/new_blog/test/NewBlog_test.rb vendor/built_in_modules/new_blog/test/dummy/Rakefile vendor/built_in_modules/new_blog/test/dummy/app/assets/javascripts/application.js vendor/built_in_modules/new_blog/test/dummy/app/assets/stylesheets/application.css vendor/built_in_modules/new_blog/test/dummy/app/controllers/application_controller.rb vendor/built_in_modules/new_blog/test/dummy/app/helpers/application_helper.rb vendor/built_in_modules/new_blog/test/dummy/app/mailers/.gitkeep vendor/built_in_modules/new_blog/test/dummy/app/models/.gitkeep vendor/built_in_modules/new_blog/test/dummy/app/views/layouts/application.html.erb vendor/built_in_modules/new_blog/test/dummy/config.ru vendor/built_in_modules/new_blog/test/dummy/config/application.rb vendor/built_in_modules/new_blog/test/dummy/config/boot.rb vendor/built_in_modules/new_blog/test/dummy/config/database.yml vendor/built_in_modules/new_blog/test/dummy/config/environment.rb vendor/built_in_modules/new_blog/test/dummy/config/environments/development.rb vendor/built_in_modules/new_blog/test/dummy/config/environments/production.rb vendor/built_in_modules/new_blog/test/dummy/config/environments/test.rb vendor/built_in_modules/new_blog/test/dummy/config/initializers/backtrace_silencers.rb vendor/built_in_modules/new_blog/test/dummy/config/initializers/inflections.rb vendor/built_in_modules/new_blog/test/dummy/config/initializers/mime_types.rb vendor/built_in_modules/new_blog/test/dummy/config/initializers/secret_token.rb vendor/built_in_modules/new_blog/test/dummy/config/initializers/session_store.rb vendor/built_in_modules/new_blog/test/dummy/config/initializers/wrap_parameters.rb vendor/built_in_modules/new_blog/test/dummy/config/locales/en.yml vendor/built_in_modules/new_blog/test/dummy/config/mongoid.yml vendor/built_in_modules/new_blog/test/dummy/config/routes.rb vendor/built_in_modules/new_blog/test/dummy/lib/assets/.gitkeep vendor/built_in_modules/new_blog/test/dummy/log/.gitkeep vendor/built_in_modules/new_blog/test/dummy/public/404.html vendor/built_in_modules/new_blog/test/dummy/public/422.html vendor/built_in_modules/new_blog/test/dummy/public/500.html vendor/built_in_modules/new_blog/test/dummy/public/favicon.ico vendor/built_in_modules/new_blog/test/dummy/script/rails vendor/built_in_modules/new_blog/test/integration/navigation_test.rb vendor/built_in_modules/new_blog/test/test_helper.rb vendor/plugins/NewBlog/.gitignore vendor/plugins/NewBlog/Gemfile vendor/plugins/NewBlog/Gemfile.lock vendor/plugins/NewBlog/MIT-LICENSE vendor/plugins/NewBlog/NewBlog.gemspec vendor/plugins/NewBlog/README.rdoc vendor/plugins/NewBlog/Rakefile vendor/plugins/NewBlog/app/assets/images/NewBlog/.gitkeep vendor/plugins/NewBlog/app/assets/javascripts/NewBlog/.gitkeep vendor/plugins/NewBlog/app/assets/stylesheets/NewBlog/.gitkeep vendor/plugins/NewBlog/app/assets/stylesheets/NewBlog/application.css vendor/plugins/NewBlog/app/assets/stylesheets/NewBlog/production.css vendor/plugins/NewBlog/app/controllers/.gitkeep vendor/plugins/NewBlog/app/helpers/.gitkeep vendor/plugins/NewBlog/app/mailers/.gitkeep vendor/plugins/NewBlog/app/models/.gitkeep vendor/plugins/NewBlog/app/views/.gitkeep vendor/plugins/NewBlog/app/views/layouts/edit_view.html.erb vendor/plugins/NewBlog/app/views/layouts/production.html.erb vendor/plugins/NewBlog/app/views/panel/blog/posts/index.html.erb vendor/plugins/NewBlog/app/views/panel/blog/posts/latest_post.html.erb vendor/plugins/NewBlog/app/views/panel/blog/posts/new.html.erb vendor/plugins/NewBlog/app/views/panel/blog/posts/show.html.erb vendor/plugins/NewBlog/app/views/panel/blog/posts/widget_index.html.erb vendor/plugins/NewBlog/app/views/panel/blog/posts/widget_latest_post.html.erb vendor/plugins/NewBlog/config/locales/en.yml vendor/plugins/NewBlog/lib/NewBlog/version.rb vendor/plugins/NewBlog/lib/tasks/NewBlog_tasks.rake vendor/plugins/NewBlog/script/rails vendor/plugins/NewBlog/test/NewBlog_test.rb vendor/plugins/NewBlog/test/dummy/Rakefile vendor/plugins/NewBlog/test/dummy/app/assets/javascripts/application.js vendor/plugins/NewBlog/test/dummy/app/assets/stylesheets/application.css vendor/plugins/NewBlog/test/dummy/app/controllers/application_controller.rb vendor/plugins/NewBlog/test/dummy/app/mailers/.gitkeep vendor/plugins/NewBlog/test/dummy/app/models/.gitkeep vendor/plugins/NewBlog/test/dummy/app/views/layouts/application.html.erb vendor/plugins/NewBlog/test/dummy/config.ru vendor/plugins/NewBlog/test/dummy/config/application.rb vendor/plugins/NewBlog/test/dummy/config/boot.rb vendor/plugins/NewBlog/test/dummy/config/database.yml vendor/plugins/NewBlog/test/dummy/config/environment.rb vendor/plugins/NewBlog/test/dummy/config/environments/development.rb vendor/plugins/NewBlog/test/dummy/config/environments/production.rb vendor/plugins/NewBlog/test/dummy/config/environments/test.rb vendor/plugins/NewBlog/test/dummy/config/initializers/secret_token.rb vendor/plugins/NewBlog/test/dummy/config/initializers/session_store.rb vendor/plugins/NewBlog/test/dummy/config/initializers/wrap_parameters.rb vendor/plugins/NewBlog/test/dummy/config/locales/en.yml vendor/plugins/NewBlog/test/dummy/config/mongoid.yml vendor/plugins/NewBlog/test/dummy/config/routes.rb vendor/plugins/NewBlog/test/integration/navigation_test.rb vendor/plugins/NewBlog/test/test_helper.rb
This commit is contained in:
commit
4be97f6ea6
|
@ -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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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>');
|
||||||
|
|
|
@ -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
|
|
@ -1,4 +1,10 @@
|
||||||
class Admin::ModuleAppsController < ApplicationController
|
class Admin::ModuleAppsController < ApplicationController
|
||||||
|
layout "admin"
|
||||||
|
|
||||||
|
def index
|
||||||
|
@module_apps = ModuleApp.all.entries
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def reload_frontend_pages
|
def reload_frontend_pages
|
||||||
@module_app = ModuleApp.find(params[:id])
|
@module_app = ModuleApp.find(params[:id])
|
||||||
|
@ -6,4 +12,22 @@ def reload_frontend_pages
|
||||||
format.js {}
|
format.js {}
|
||||||
end
|
end
|
||||||
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
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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=[]
|
||||||
|
[:roles,:sub_roles].each do |t_role|
|
||||||
|
ary += (self.send t_role).collect do |role|
|
||||||
role.users
|
role.users
|
||||||
end
|
end
|
||||||
|
end
|
||||||
ary << self.privilege_users
|
ary << self.privilege_users
|
||||||
ary.flatten!
|
ary.flatten!.uniq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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">
|
|
||||||
<% @roles.each do |role| %>
|
|
||||||
<li class="set_1"><%= link_to content_tag(:span, "Role") %></li>
|
|
||||||
<% end -%>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<h1><%= t('admin.list_app_auths') %></h1>
|
|
||||||
|
|
||||||
|
<div class="main_list">
|
||||||
|
<%= flash_messages %>
|
||||||
|
<div class="button_bar up">
|
||||||
|
<% #link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
|
||||||
|
</div>
|
||||||
<table>
|
<table>
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t('admin.app.name') %></th>
|
<td><%= t('admin.app.title') %></td>
|
||||||
<th><%= t('admin.description') %></th>
|
<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>
|
</tr>
|
||||||
|
</thead>
|
||||||
<% @app_auth_data.each do |app| %>
|
<tbody>
|
||||||
<tr>
|
<% @module_apps.each do |module_app| %>
|
||||||
<td><%= app[0][:app_obj].title %></td>
|
<tr class="have" id="attribute_<%= module_app.id %>" class="have <%= "#{module_app.enable_frontend? ? 'disable' : ''}" %>">
|
||||||
<% app[0][:auth_field].each do |unit| %>
|
<td class="name"><%= module_app.title %></td>
|
||||||
|
<td class="name"><%= module_app.intro %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= render :partial => "auth_unit",:locals => {:unit => unit } %>
|
<% 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>
|
||||||
<%end%>
|
<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>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="button_bar">
|
||||||
|
<%# link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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 } %>
|
||||||
|
|
||||||
|
|
|
@ -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 } %>
|
||||||
|
|
|
@ -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')} ?" %>
|
||||||
|
|
|
@ -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 } %>
|
||||||
|
|
BIN
lib/NewBlog.zip
BIN
lib/NewBlog.zip
Binary file not shown.
|
@ -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">
|
||||||
|
|
|
@ -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;'>"
|
||||||
|
|
|
@ -40,5 +40,4 @@ module ParserLayout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -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?.....")
|
||||||
|
|
||||||
|
|
|
@ -6,127 +6,208 @@ 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
|
||||||
end
|
check_user_has_app user_ary
|
||||||
p_user_ary.should include("Staff")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "@app_auth should have one student listed at blocklist" do
|
it "Adding a undergraduate stud into app_auth by privilege list" do
|
||||||
@bad_stu = User.first(conditions:{email:"a_bad_stud@rulingcom.com"})
|
user_ary = [@teacher,@staff,@good_g_stu,@good_ug_stu_1]
|
||||||
@app_auth.blocked_users.should have(1).item
|
@bulletin_app_auth.add_user_to_privilege_list @good_ug_stu_1
|
||||||
@app_auth.blocked_users.should include(@bad_stu)
|
@bulletin_app_auth.auth_users.sort.should == user_ary.sort
|
||||||
|
check_user_has_app user_ary
|
||||||
end
|
end
|
||||||
|
|
||||||
it "[Development #1]-1.Authorizing roles: roles + blocklist" do
|
it "Adding all graudated-stud into app_auth" do
|
||||||
@good_stu = User.first(conditions:{email:"a_good_stud@rulingcom.com"})
|
user_ary = [@teacher,@staff,@good_g_stu,@bad_g_stu]
|
||||||
@teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"})
|
@bulletin_app_auth.add_sub_role @graduated_SRK
|
||||||
@staff = User.first(conditions:{email:"a_staff@rulingcom.com"})
|
@bulletin_app_auth.auth_users.sort.should == user_ary.sort
|
||||||
ary = [@good_stu,@teacher,@staff]
|
check_user_has_app user_ary
|
||||||
@app_auth.auth_users_after_block_list.should == ary
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "[Development #1]-2.Authorizing single users: list of users [new_user1~2]" do
|
it "Blocking bad-graduate student" do
|
||||||
user_emails = ["new_user1","new_user2","new_user3","new_user4"]
|
user_ary =[@teacher,@staff,@good_g_stu]
|
||||||
user_emails.each do |user_email|
|
@bulletin_app_auth.add_sub_role @graduated_SRK
|
||||||
email=user_email+"@rulingcom.com"
|
@bulletin_app_auth.add_user_to_black_list @bad_g_stu
|
||||||
new_user = User.new :email=> email
|
@bulletin_app_auth.auth_users_after_block_list.sort.should == user_ary.sort
|
||||||
new_user.save
|
check_user_has_app user_ary
|
||||||
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
|
end
|
||||||
|
|
||||||
it "[Development #1]-3.Authorizing roles and single users: roles + blocklist + list of users" do
|
it "Removing all graudated-stud from app_auth" do
|
||||||
@app_auth.auth_users.should have(4).item
|
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
|
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
|
# it "@bulletin_app_auth should have one Privialage user which is belongs to Staff" do
|
||||||
@new_app_auth.auth_users_after_block_list.should_not include(@bad_stu)
|
# p_user_ary = @bulletin_app_auth.privilege_users.collect do |p_user|
|
||||||
@new_app_auth.save!
|
# 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
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
|
@ -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,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,6 +0,0 @@
|
||||||
module NewBlog
|
|
||||||
class Engine < Rails::Engine
|
|
||||||
isolate_namespace NewBlog
|
|
||||||
PrototypeR4::Application::Orbit_Apps << "NewBlog"
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,2 +0,0 @@
|
||||||
module ApplicationHelper
|
|
||||||
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'
|
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
|
|
@ -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,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
|
|
@ -0,0 +1,6 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
|
||||||
|
def check_show_frontend
|
||||||
|
front_end_available(NewBlog::MOUDLEAPP_TITLE)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
module NewBlogHelper
|
||||||
|
def self.check_show_frontend
|
||||||
|
ApplicationController.front_end_available(NewBlog::MOUDLEAPP_TITLE)
|
||||||
|
end
|
||||||
|
end
|
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 %>
|
<% 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>
|
|
@ -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%>
|
|
@ -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 %>
|
||||||
|
|
|
@ -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 %>
|
|
@ -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>
|
|
@ -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 -%>
|
||||||
|
|
|
@ -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 />
|
|
@ -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 %>
|
|
@ -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>
|
|
@ -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"
|
|
@ -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
|
|
@ -0,0 +1,5 @@
|
||||||
|
require "new_blog/engine"
|
||||||
|
|
||||||
|
|
||||||
|
module NewBlog
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
module NewBlog
|
||||||
|
class Engine < Rails::Engine
|
||||||
|
isolate_namespace new_blog
|
||||||
|
end
|
||||||
|
end
|
|
@ -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
Reference in New Issue