fix index page
This commit is contained in:
parent
7b31f97198
commit
e774fccd55
|
@ -29,11 +29,12 @@ class VideoProsController < ApplicationController
|
|||
end
|
||||
def index
|
||||
params = OrbitHelper.params
|
||||
module_app = ModuleApp.where(:key=>'video_pro').first
|
||||
page = OrbitHelper.page rescue Page.where(:url=>params[:url]).first
|
||||
page_categories = OrbitHelper.page_categories
|
||||
categories = [{:name=>I18n.t("video_pro.all_category"), :value=>"all"}]
|
||||
if page_categories.blank? || page_categories.include?('all')
|
||||
categories_for_page = Category.where(:module_app_id=>ModuleApp.where(:key=>'video_pro').pluck(:id).first)
|
||||
categories_for_page = module_app.categories
|
||||
else
|
||||
categories_for_page = Category.where(:id=>page_categories)
|
||||
end
|
||||
|
@ -44,12 +45,12 @@ class VideoProsController < ApplicationController
|
|||
page_tags = OrbitHelper.page_tags
|
||||
tags = [{:name=>I18n.t("video_pro.all_tag"), :value=>"all"}]
|
||||
if page_tags.blank? || page_tags.include?('all')
|
||||
tags_for_page = Tag.where(:module_app_id=>ModuleApp.where(:key=>'video_pro').pluck(:id).first)
|
||||
tags_for_page = module_app.tags
|
||||
else
|
||||
tags_for_page = Tag.where(:id=>page_tags)
|
||||
end
|
||||
tags += tags_for_page.map do |c|
|
||||
{:name=>c.title, :value=>c.id.to_s}
|
||||
{:name=>c.name, :value=>c.id.to_s}
|
||||
end
|
||||
selected_category = params["category"]
|
||||
if selected_category.present? && selected_category != 'all'
|
||||
|
@ -95,9 +96,6 @@ class VideoProsController < ApplicationController
|
|||
post_agencies = post_agencies.map do |post_agency|
|
||||
{"option"=>"<option value=\"#{post_agency[:value]}\" #{post_agency[:is_selected]}>#{post_agency[:name]}</option>"}
|
||||
end
|
||||
categories = categories.map do |category|
|
||||
{"option"=>"<option value=\"#{category[:value]}\" #{category[:is_selected]}>#{category[:name]}</option>"}
|
||||
end
|
||||
video_images = VideoImage.where(:title.nin => ["",nil])
|
||||
page_url = "/#{I18n.locale}#{(page.get_url rescue page.url)}"
|
||||
page_tabs = [
|
||||
|
@ -111,12 +109,8 @@ class VideoProsController < ApplicationController
|
|||
page_tabs[0]["klass"] = "now_view"
|
||||
end
|
||||
selected_tag = params['tags']
|
||||
page_title = page.title
|
||||
page_title = page.name
|
||||
|
||||
|
||||
tags = tags.map do |tag|
|
||||
{"option"=>"<option value=\"#{tag[:value]}\" #{tag[:is_selected]}>#{tag[:name]}</option>"}
|
||||
end
|
||||
if selected_tag.present?
|
||||
tags.each do |h|
|
||||
if h[:value] == selected_tag
|
||||
|
@ -125,9 +119,9 @@ class VideoProsController < ApplicationController
|
|||
end
|
||||
end
|
||||
filter_tags = [selected_tag]
|
||||
tag = Tag.where(selected_tag).first
|
||||
tag = Tag.where(id: selected_tag).first
|
||||
if tag
|
||||
page_title = tag.title
|
||||
page_title = tag.name
|
||||
end
|
||||
else
|
||||
filter_tags = OrbitHelper.page_tags
|
||||
|
@ -154,6 +148,14 @@ class VideoProsController < ApplicationController
|
|||
search_placeholder = I18n.t("video_pro.search_placeholder")
|
||||
search_text1 = I18n.t("video_pro.search_text1")
|
||||
search_text2 = I18n.t("video_pro.search_text2")
|
||||
|
||||
|
||||
categories = categories.map do |category|
|
||||
{"option"=>"<option value=\"#{category[:value]}\" #{category[:is_selected]}>#{category[:name]}</option>"}
|
||||
end
|
||||
tags = tags.map do |tag|
|
||||
{"option"=>"<option value=\"#{tag[:value]}\" #{tag[:is_selected]}>#{tag[:name]}</option>"}
|
||||
end
|
||||
{
|
||||
"extras" => {
|
||||
"search_placeholder" => search_placeholder,
|
||||
|
|
Loading…
Reference in New Issue