Add impressionist

This commit is contained in:
Christophe Vilayphiou committed 2012-05-15 21:26:09 +08:00
1 parent 53a0fbddf0
commit e54f4409fb
21 files changed
+212 -83

No files matched your search

@@ -29,6 +29,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
preview_content
else
@bulletin = Bulletin.can_display.where(_id: params[:id]).first
impressionist(@bulletin)
get_categorys
end
@@ -4,6 +4,9 @@ class Bulletin
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include Impressionist::Impressionable
is_impressionable :counter_cache => { :column_name => :view_count }
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
@@ -23,6 +26,7 @@ class Bulletin
field :is_pending, :type => Boolean, :default => true
field :is_rejected, :type => Boolean, :default => false
field :view_count, :type => Integer, :default => 0
field :not_checked_reason
@@ -5,6 +5,7 @@
<span class="date"><%= @bulletin.postdate %></span>
&nbsp;|&nbsp;
<a href="" class="unit"><%= User.find(@bulletin.create_user_id).sub_roles.collect{|t| t.key}.join(" ") rescue '' %></a>
<span><%= dislpay_view_count(@bulletin) %></span>
</div>
</div>
<div class="news_image">
@@ -30,6 +30,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
preview_content
else
@news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first
impressionist(@news_bulletin)
get_categorys
end
end
+5 -1
View File
@@ -3,7 +3,10 @@
class NewsBulletin
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include Mongoid::MultiParameterAttributes
include Impressionist::Impressionable
is_impressionable :counter_cache => { :column_name => :view_count }
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
@@ -23,6 +26,7 @@ class NewsBulletin
field :is_pending, :type => Boolean, :default => true
field :is_rejected, :type => Boolean, :default => false
field :view_count, :type => Integer, :default => 0
field :not_checked_reason
@@ -5,6 +5,7 @@
<span class="date"><%= @news_bulletin.postdate %></span>
&nbsp;|&nbsp;
<a href="" class="unit"><%= @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %></a>
<span><%= dislpay_view_count(@news_bulletin) %></span>
</div>
</div>
<div class="news_image">
@@ -6,10 +6,10 @@ class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetControll
end
def index
# @page_context = PageContext.where("page_id" => params[:page_id], :archived => false)
@page_context = PageContext.first(conditions: { page_id: params[:page_id], :archived => false })
# @page_context = PageContext.where("page_id" => params[:page_id], :archived => false)
@page_context = PageContext.first(conditions: { page_id: params[:page_id], :archived => false })
impressionist(@page_context)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @page_contexts }
@@ -4,15 +4,17 @@ class PageContext
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include Impressionist::Impressionable
include OrbitCoreLib::ObjectAuthable
is_impressionable :counter_cache => { :column_name => :view_count }
has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
field :create_user_id
field :update_user_id
field :version, :type => Integer , :default => 0
field :view_count, :type => Integer, :default => 0
field :archived, :type => Boolean, :default => false
# field :current, :type => Boolean, :default => false
@@ -6,3 +6,5 @@
<h1 class="h1"><%= @page_context.page.i18n_variable[I18n.locale] rescue nil %></h1>
<div class="page_content"><%= @page_context.context[I18n.locale].html_safe rescue nil %></div>
<div><%= dislpay_view_count(@page_context) %></div>