Fix link switch not showing for default front end

This commit is contained in:
chris 2013-03-19 17:49:46 +08:00
parent 5e4e3ac560
commit f3c809fd58
3 changed files with 12 additions and 12 deletions

View File

@ -19,7 +19,7 @@ helper Admin::PagePartsHelper
end
def edit
@item = @page =Page.find(params[:id])
@item =Page.find(params[:id])
@user_choose = @item.app_frontend_url
@apps = ModuleApp.excludes(app_pages: nil).entries
@ -138,13 +138,13 @@ helper Admin::PagePartsHelper
end
def reload_front_end_setting
@page = Page.find params[:id]
@item = Page.find params[:id]
@module_app = ModuleApp.find params[:module_app_id]
@chosen_frontend = @user_choose = params[:frontend]
end
def reload_frontend_pages
@page = Page.find params[:id] rescue nil
@item = Page.find params[:id] rescue nil
# @categories =[]
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
@ -182,7 +182,7 @@ helper Admin::PagePartsHelper
def reload_widget_field
@index = params[:field_seri].to_i
@page = Page.find params[:id]
@item = Page.find params[:id]
@choosen_field = params[:widget_field_value]
@module_app = @page.module_app
@module_app = ModuleApp.find params[:module_app_id] if @module_app.nil?

View File

@ -11,7 +11,7 @@ module Admin::PagePartsHelper
def get_widget_field_rel(local_item=nil)
local_item = @part if local_item.nil? && @part
local_item = @page if local_item.nil? && @page
local_item = @item if local_item.nil? && @item
case local_item
when Page
@ -23,9 +23,9 @@ module Admin::PagePartsHelper
def link_to_field_switch(i,object_name,field_name,local_item=nil,prefill_value=nil) #link_to_field is for showing
local_item = @part if local_item.nil? && @part
local_item = @page if local_item.nil? && @page
local_item = @item if local_item.nil? && @item
res = ''
choosen_value = prefill_value || (local_item[:widget_field][i][0] rescue nil)
choosen_value = prefill_value || (local_item[field_name][i][0] rescue nil)
if choosen_value
choosen_field_is_link = (@module_app.widget_fields.select{|t| t[0].to_s==choosen_value}.first)[2]==:link
@ -53,7 +53,7 @@ module Admin::PagePartsHelper
def widget_field_options(i,local_item=nil)
local_item = @part if local_item.nil? && @part
local_item = @page if local_item.nil? && @page
local_item = @item if local_item.nil? && @item
options = @module_app.widget_fields.collect do |widget_field|
label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}")
@ -71,7 +71,7 @@ module Admin::PagePartsHelper
def widget_fiield_type_options(i,local_item=nil)
options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}
local_item = @part if local_item.nil? && @part
local_item = @page if local_item.nil? && @page
local_item = @item if local_item.nil? && @item
case local_item
when Page

View File

@ -8,7 +8,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
# GET /bulletins
# GET /bulletins.xml
def index_bulletins_by_unit
@page = Page.find(params[:page_id]) rescue nil
@item = Page.find(params[:page_id]) rescue nil
@bulletins=Bulletin.all.available_for_lang(I18n.locale).can_display.where("cache_dept.#{I18n.locale.to_s.downcase}"=>params[:name]).page( params[:page_main]).per(15)
render :index
end
@ -24,7 +24,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
@frontend_style = @item.frontend_style
end
@page = Page.find(params[:page_id]) rescue nil
@item = Page.find(params[:page_id]) rescue nil
if !params[:search_query].blank?
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending => false}
# search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
@ -59,7 +59,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
end
def show
@page = Page.find(params[:page_id]) rescue nil
@item = Page.find(params[:page_id]) rescue nil
if params[:preview] == "true"
preview_content
else