Changeset 1215

Show
Ignore:
Timestamp:
07/23/08 10:41:41 (4 months ago)
Author:
kovit
Message:

fix 'special_page' at page_visit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/home_controller.rb

    r1148 r1215  
    4040    if obj.class == SpecialPage 
    4141      @special_page = obj 
     42      @special_page.increase_hit(session.session_id, request.remote_ip) 
    4243      render :template => "home/special_page" 
    4344    elsif obj.class == Blog 
  • trunk/app/models/special_page.rb

    r1148 r1215  
     1require 'hit_helper' 
     2 
    13class SpecialPage < CachedModel 
     4 
     5  include HitHelper 
     6 
     7  has_one :hit, :dependent => :destroy, :foreign_key => "hittable_id", :conditions => "hittable_type = 'SpecialPage'" 
     8 
    29  validates_presence_of :address, :message => _("Please provide the address for this special page.") 
    310  validates_presence_of :title, :message => _("Please provide the title for this special page.") 
     
    714 
    815  validates_format_of :address, :with => /^[a-zA-Z0-9_\-]+$/, :message => _("Use only a-z, A-Z, 0-9, and dash in the address. Do not start or end with a dash.") 
    9  
    1016end 
  • trunk/app/views/home/special_page.html.erb

    r1192 r1215  
    55    <div class="action-buttons">[ <%= link_to _("Edit"), edit_admin_special_page_url(:id => @special_page.address) %> ]</div> 
    66  <% end %> 
     7 
     8  <div class="stat"> 
     9   <%= "%s: %s " % [_("Page Visits"), @special_page.hit_counter] %> 
     10  </div> 
    711  <div class="title"><%= @special_page.title %></div> 
    812  <div>