Merge branch 'master' of github.com:Rulingcom/NCCU

This commit is contained in:
Matthew K. Fu JuYuan 2012-08-13 18:36:04 +08:00
commit 83569fac82
5 changed files with 15 additions and 9 deletions

View File

@ -49,6 +49,8 @@ class PagesController < ApplicationController
def show_from_link def show_from_link
url = "/#{@item.path}?id=#{params[:id]}" url = "/#{@item.path}?id=#{params[:id]}"
options = '' options = ''
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
options << "&preview=#{params[:preview]}" unless params[:preview].blank? options << "&preview=#{params[:preview]}" unless params[:preview].blank?
redirect_to(url + options) unless save_from_no_lang_for_page redirect_to(url + options) unless save_from_no_lang_for_page
end end

View File

@ -27,7 +27,7 @@ class AdImage
attr_reader :parse_post_date,:parse_unpost_date attr_reader :parse_post_date,:parse_unpost_date
before_validation :add_http before_validation :add_http
validates :out_link, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix validates :out_link, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :allow_blank => true
def parse_post_date=(att) def parse_post_date=(att)
self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil) self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
@ -59,7 +59,7 @@ class AdImage
protected protected
def add_http def add_http
unless self.out_link[/^http:\/\//] || self.out_link[/^https:\/\//] unless self.out_link[/^http:\/\//] || self.out_link[/^https:\/\//] || self.out_link.blank?
self.out_link = 'http://' + self.out_link self.out_link = 'http://' + self.out_link
end end
end end

View File

@ -73,7 +73,8 @@ module ParserCommon
res << "time_to_next='#{ad_banner.transition_msec}' " res << "time_to_next='#{ad_banner.transition_msec}' "
res << "link_open='#{ad_image.link_open}' " res << "link_open='#{ad_image.link_open}' "
# res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' " # res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
res << "link_url='#{(ad_image.out_link || ad_banner.context || ' ')}' " res << "link_url='#{(ad_image.out_link)}' "
res << "style='cursor:pointer'" if !ad_image.out_link.blank?
res << "/>" res << "/>"
end end
res << "</div>" res << "</div>"

View File

@ -26,14 +26,17 @@ function getTimeout() {
$(document).ready(function() { $(document).ready(function() {
$('.slideshow').children('img').click(function() $('.slideshow').children('img').click(function()
{ {
if($(this).attr('link_open')=='new_window') if($(this).attr('link_url')!='')
{ {
window.open($(this).attr('link_url')); if($(this).attr('link_open')=='new_window')
{
window.open($(this).attr('link_url'));
} }
else else
{ {
document.location.href=$(this).attr('link_url') document.location.href=$(this).attr('link_url')
} }
}
}) })
}); });
// Ad Banner FX code [end] // Ad Banner FX code [end]

View File

@ -1,6 +1,6 @@
<% @bulletins.each do |bulletin| %> <% @bulletins.each do |bulletin| %>
<li> <li>
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id ,:tag_id=>bulletin.tags.first.id ) %> <%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id , :tag_id => @selected_tag.id ) %>
</li> </li>
<% end %> <% end %>