working cache
This commit is contained in:
parent
0e65e379b0
commit
4daf36908c
3
Gemfile
3
Gemfile
|
@ -15,6 +15,9 @@ gem 'jquery-ui-rails'
|
||||||
|
|
||||||
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
|
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
|
||||||
|
|
||||||
|
gem "memcached", "~> 1.4.3"
|
||||||
|
gem "memcache-client"
|
||||||
|
|
||||||
gem 'mini_magick'
|
gem 'mini_magick'
|
||||||
gem 'mongoid'
|
gem 'mongoid'
|
||||||
gem 'mongoid-tree', :require => 'mongoid/tree'
|
gem 'mongoid-tree', :require => 'mongoid/tree'
|
||||||
|
|
|
@ -115,6 +115,8 @@ GEM
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
|
memcache-client (1.8.5)
|
||||||
|
memcached (1.4.3)
|
||||||
mime-types (1.17.2)
|
mime-types (1.17.2)
|
||||||
mini_magick (3.4)
|
mini_magick (3.4)
|
||||||
subexec (~> 0.2.1)
|
subexec (~> 0.2.1)
|
||||||
|
@ -308,6 +310,8 @@ DEPENDENCIES
|
||||||
jquery-rails
|
jquery-rails
|
||||||
jquery-ui-rails
|
jquery-ui-rails
|
||||||
kaminari!
|
kaminari!
|
||||||
|
memcache-client
|
||||||
|
memcached (~> 1.4.3)
|
||||||
mini_magick
|
mini_magick
|
||||||
mongo_session_store-rails3
|
mongo_session_store-rails3
|
||||||
mongoid
|
mongoid
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Admin::ModuleAppsNewInterfaceController < OrbitBackendController
|
||||||
layout "new_admin"
|
layout "new_admin"
|
||||||
|
|
||||||
def setting
|
def setting
|
||||||
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
|
@sys_users = Rails.cache.read('user_setting') #User.all(conditions: {admin: false}).includes(:avatar)
|
||||||
@module_app = ModuleApp.find(params[:module_app_id])
|
@module_app = ModuleApp.find(params[:module_app_id])
|
||||||
@options_from_collection_for_select_bulletin_categorys = [@module_app].collect{|ma| [ma.title,ma.id] }
|
@options_from_collection_for_select_bulletin_categorys = [@module_app].collect{|ma| [ma.title,ma.id] }
|
||||||
# if params.has_key? :category
|
# if params.has_key? :category
|
||||||
|
|
|
@ -48,6 +48,12 @@ class Admin::PagePartsController < ApplicationController
|
||||||
if @part.update_attributes(params[:page_part])
|
if @part.update_attributes(params[:page_part])
|
||||||
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
||||||
flash.now[:notice] = t('admin.update_success_content')
|
flash.now[:notice] = t('admin.update_success_content')
|
||||||
|
|
||||||
|
if @part.page.name == 'home'
|
||||||
|
expire_page '/'
|
||||||
|
else
|
||||||
|
expire_page page_path(@part.page.name)
|
||||||
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to admin_page_url( @part.page )
|
redirect_to admin_page_url( @part.page )
|
||||||
|
|
|
@ -3,11 +3,11 @@ class PagesController < ApplicationController
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
before_filter :get_item, :only => [:index_from_link, :show_from_link]
|
before_filter :get_item, :only => [:index_from_link, :show_from_link]
|
||||||
|
caches_page :index
|
||||||
def index
|
def index
|
||||||
@item = Page.find_by_name('home')
|
@item = Page.find_by_name('home')
|
||||||
|
|
||||||
if @item && (stale? etag: @item.updated_at)
|
if @item
|
||||||
impressionist(@item)
|
impressionist(@item)
|
||||||
render_page
|
render_page
|
||||||
else
|
else
|
||||||
|
|
|
@ -3,10 +3,13 @@ class I18nVariable
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
field :key
|
field :key, :index => true
|
||||||
field :document_class, :type => String
|
field :document_class, :type => String, :index => true
|
||||||
field :parent_id, :type => BSON::ObjectId, :index => true
|
field :parent_id, :type => BSON::ObjectId, :index => true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
belongs_to :language_value, polymorphic: true
|
belongs_to :language_value, polymorphic: true
|
||||||
|
|
||||||
def method_missing(*field)
|
def method_missing(*field)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do %>
|
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do %>
|
||||||
<%= render :partial => "shared/privilege_user",:collection =>@sys_users,:as=>:user ,:locals =>{ :chosen_users=> @users_array } %>
|
<% cache ["users_checkbox_ary"] do%>
|
||||||
|
<%= render :partial => "shared/privilege_user",:collection =>@sys_users,:as=>:user ,:locals =>{ :chosen_users=> @users_array } %>
|
||||||
|
<%end -%>
|
||||||
<%end -%>
|
<%end -%>
|
|
@ -23,6 +23,8 @@ Orbit::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.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
|
||||||
config.assets.debug = true
|
config.assets.debug = true
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,8 @@ namespace :mid_site do
|
||||||
|
|
||||||
local_user.save!
|
local_user.save!
|
||||||
end
|
end
|
||||||
|
sys_users = User.all(conditions: {admin: false}).includes(:avatar).to_a
|
||||||
|
Rails.cache.write('user_setting', sys_users)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin.save
|
if @bulletin.save
|
||||||
|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.create_bulletin_success')) }
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.create_bulletin_success')) }
|
||||||
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
||||||
format.js
|
format.js
|
||||||
|
@ -222,6 +223,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
@link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
|
@link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
||||||
if @bulletin_link.update_attributes(params[:bulletin_link])
|
if @bulletin_link.update_attributes(params[:bulletin_link])
|
||||||
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
format.js { render 'update_bulletin_link' }
|
format.js { render 'update_bulletin_link' }
|
||||||
|
@ -235,6 +237,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
@file_url = panel_announcement_back_end_bulletin_path(@bulletin_file)
|
@file_url = panel_announcement_back_end_bulletin_path(@bulletin_file)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
||||||
if @bulletin_file.update_attributes(params[:bulletin_file])
|
if @bulletin_file.update_attributes(params[:bulletin_file])
|
||||||
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
format.js { render 'update_bulletin_file' }
|
format.js { render 'update_bulletin_file' }
|
||||||
|
@ -255,6 +258,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
delete_out_invalid_date_from_params
|
delete_out_invalid_date_from_params
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
||||||
if @bulletin.update_attributes(params[:bulletin])
|
if @bulletin.update_attributes(params[:bulletin])
|
||||||
# if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
# if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
||||||
# @bulletin.deadline = nil
|
# @bulletin.deadline = nil
|
||||||
|
@ -284,6 +288,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
@bulletin.destroy
|
@bulletin.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
# format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@app_title = 'announcement'
|
@app_title = 'announcement'
|
||||||
|
|
|
@ -114,6 +114,7 @@ class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendContro
|
||||||
@news_bulletin_category.disable = @news_bulletin_category.disable ? false : true
|
@news_bulletin_category.disable = @news_bulletin_category.disable ? false : true
|
||||||
|
|
||||||
if @news_bulletin_category.save!
|
if @news_bulletin_category.save!
|
||||||
|
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
flash[:notice] = t("bulletin_category.update_success")
|
flash[:notice] = t("bulletin_category.update_success")
|
||||||
# flash[:error] += @bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false")
|
# flash[:error] += @bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false")
|
||||||
|
|
|
@ -134,6 +134,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @news_bulletin_file.save
|
if @news_bulletin_file.save
|
||||||
|
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||||
format.js { render 'create_news_bulletin_file' }
|
format.js { render 'create_news_bulletin_file' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -148,6 +149,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @news_bulletin.save
|
if @news_bulletin.save
|
||||||
|
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.create_news_bulletin_success')) }
|
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.create_news_bulletin_success')) }
|
||||||
format.xml { render :xml => @news_bulletin, :status => :created, :location => @news_bulletin }
|
format.xml { render :xml => @news_bulletin, :status => :created, :location => @news_bulletin }
|
||||||
format.js
|
format.js
|
||||||
|
@ -228,6 +230,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @news_bulletin_link.update_attributes(params[:news_bulletin_link])
|
if @news_bulletin_link.update_attributes(params[:news_bulletin_link])
|
||||||
|
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
||||||
format.js { render 'update_news_bulletin_link' }
|
format.js { render 'update_news_bulletin_link' }
|
||||||
end
|
end
|
||||||
|
@ -241,6 +244,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @news_bulletin_file.update_attributes(params[:news_bulletin_file])
|
if @news_bulletin_file.update_attributes(params[:news_bulletin_file])
|
||||||
|
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
||||||
format.js { render 'update_news_bulletin_file' }
|
format.js { render 'update_news_bulletin_file' }
|
||||||
end
|
end
|
||||||
|
@ -262,6 +266,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @news_bulletin.update_attributes(params[:news_bulletin])
|
if @news_bulletin.update_attributes(params[:news_bulletin])
|
||||||
|
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news_bulletin.update_news_bulletin_success')) }
|
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news_bulletin.update_news_bulletin_success')) }
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.update_success')) }
|
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.update_success')) }
|
||||||
format.js { render 'toggle_enable' }
|
format.js { render 'toggle_enable' }
|
||||||
|
@ -286,6 +291,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||||
@news_bulletin.destroy
|
@news_bulletin.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
||||||
# format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||||
|
caches_page :home_banner
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
|
|
Loading…
Reference in New Issue