33 lines
1.0 KiB
Ruby
33 lines
1.0 KiB
Ruby
|
module Admin::VenueManagementsHelper
|
||
|
def page_for_venue_management(venue_management)
|
||
|
ann_page = nil
|
||
|
pages = Page.where(:module=>'venue_management')
|
||
|
|
||
|
pages.each do |page|
|
||
|
if page.categories.count ==1
|
||
|
if page.categories.include?(venue_management.category.id.to_s)
|
||
|
ann_page = page
|
||
|
end
|
||
|
end
|
||
|
break if !ann_page.nil?
|
||
|
end
|
||
|
|
||
|
if ann_page.nil?
|
||
|
pages.each do |page|
|
||
|
if page.categories.include?(venue_management.category.id.to_s)
|
||
|
ann_page = page
|
||
|
end
|
||
|
break if !ann_page.nil?
|
||
|
end
|
||
|
end
|
||
|
|
||
|
ann_page = pages.first if ann_page.nil?
|
||
|
request.protocol+(request.host_with_port+ann_page.url+'/'+venue_management.to_param).gsub('//','/') rescue "/"
|
||
|
end
|
||
|
|
||
|
def page_for_venue_management_url
|
||
|
page = Page.where(:module => 'venue_management').first
|
||
|
return request.protocol+(request.host_with_port+"/#{I18n.locale}#{page.url}").gsub('//','/') rescue "/"
|
||
|
# return "/#{I18n.locale}#{page.url}/#{venue_management.to_param}"
|
||
|
end
|
||
|
end
|