Merge branch 'master' of github.com:Rulingcom/NCCU
This commit is contained in:
commit
83569fac82
5 files changed
+15
-9
No files matched your search
@@ -49,6 +49,8 @@ class PagesController < ApplicationController
|
||||
def show_from_link
|
||||
url = "/#{@item.path}?id=#{params[:id]}"
|
||||
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?
|
||||
redirect_to(url + options) unless save_from_no_lang_for_page
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ class AdImage
|
||||
attr_reader :parse_post_date,:parse_unpost_date
|
||||
|
||||
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)
|
||||
self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
|
||||
@@ -59,7 +59,7 @@ class AdImage
|
||||
protected
|
||||
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user