preview by default widget

This commit is contained in:
Matthew K. Fu JuYuan 2013-07-15 17:09:48 +08:00
parent 07b3857465
commit d996b91b54
2 changed files with 6 additions and 2 deletions

View File

@ -40,9 +40,13 @@ class DefaultWidgetController< OrbitWidgetController
def default_widget def default_widget
@search = params["search_query"].blank? ? false : true @search = params["search_query"].blank? ? false : true
if !params[:id].blank? if !params[:id].blank? and !params["clicked_field_name"].blank?
clicked_field_name = params["clicked_field_name"].to_sym clicked_field_name = params["clicked_field_name"].to_sym
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})") redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
elsif !params[:id].blank? and params["preview"]
clicked_field_name = :title
@preview_pages = @page_part.module_app.widget_fields_link_method.find_all{|t| t[1].has_key?(:preview)}.collect{|t| t[0]}
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {preview: true,inner: #{params[:inner] || true},clicked_field_name: '#{@preview_pages.first.to_s}'})")
else else
@tag_class = nil @tag_class = nil
@default_widget = @page_part.module_app.get_default_widget @default_widget = @page_part.module_app.get_default_widget

View File

@ -33,7 +33,7 @@ module Announcement
enable ["typeA","typeC"] enable ["typeA","typeC"]
image :image image :image
field :postdate field :postdate
link_field :title,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self} link_field :title,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self,:preview=>true}
link_field :bulletin_category_with_title,{:method => 'panel_announcement_front_end_bulletins_path',:args=>{:category_id => [:bulletin_category,:id]}} link_field :bulletin_category_with_title,{:method => 'panel_announcement_front_end_bulletins_path',:args=>{:category_id => [:bulletin_category,:id]}}
link_to_more 'panel_announcement_front_end_bulletins_path',:title_i18n=> 'more_plus' link_to_more 'panel_announcement_front_end_bulletins_path',:title_i18n=> 'more_plus'
end end