working cache

This commit is contained in:
Matthew K. Fu JuYuan committed 2012-07-13 15:36:10 +08:00
1 parent 0e65e379b0
commit 4daf36908c
14 files changed
+41 -8

No files matched your search

@@ -6,7 +6,7 @@ class Admin::ModuleAppsNewInterfaceController < OrbitBackendController
layout "new_admin"
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])
@options_from_collection_for_select_bulletin_categorys = [@module_app].collect{|ma| [ma.title,ma.id] }
# if params.has_key? :category
@@ -48,6 +48,12 @@ class Admin::PagePartsController < ApplicationController
if @part.update_attributes(params[:page_part])
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')
if @part.page.name == 'home'
expire_page '/'
else
expire_page page_path(@part.page.name)
end
respond_to do |format|
format.html {
redirect_to admin_page_url( @part.page )
+2 -2
View File
@@ -3,11 +3,11 @@ class PagesController < ApplicationController
include ApplicationHelper
before_filter :get_item, :only => [:index_from_link, :show_from_link]
caches_page :index
def index
@item = Page.find_by_name('home')
if @item && (stale? etag: @item.updated_at)
if @item
impressionist(@item)
render_page
else
+5 -2
View File
@@ -3,10 +3,13 @@ class I18nVariable
include Mongoid::Document
include Mongoid::Timestamps
field :key
field :document_class, :type => String
field :key, :index => true
field :document_class, :type => String, :index => true
field :parent_id, :type => BSON::ObjectId, :index => true
belongs_to :language_value, polymorphic: true
def method_missing(*field)
@@ -1,3 +1,5 @@
<%= 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 -%>