daily commit

This commit is contained in:
Fu Matthew 2013-01-23 18:51:18 +08:00
parent 0cc616f988
commit 979df9ac80
20 changed files with 179 additions and 132 deletions

View File

@ -25,14 +25,14 @@ class Admin::PagePartsController < ApplicationController
def edit def edit
@part = PagePart.find(params[:id]) @part = PagePart.find(params[:id])
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc) @module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@module_app = @part.module_app ? @part.module_app : @module_apps[0] @module_app = @part.module_app ? @part.module_app : nil
@user_choose = @part.widget_path @user_choose = @part.widget_path
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
@tag_objects = @r_tag.classify.constantize.all rescue nil @tag_objects = @r_tag.classify.constantize.all rescue nil
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0] @widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
if @module_app.widgets.any?{|b| b.class == Array} if @module_app && @module_app.widgets.any?{|b| b.class == Array}
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank? @widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
end end
@ -49,7 +49,7 @@ class Admin::PagePartsController < ApplicationController
when 'archive' when 'archive'
@categories = ArchiveFileCategory.all @categories = ArchiveFileCategory.all
@tags = ArchiveTag.all @tags = ArchiveTag.all
end end if @module_app
end end
def create def create
@ -62,6 +62,10 @@ class Admin::PagePartsController < ApplicationController
params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field] params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field]
params[:page_part][:widget_field_type] = nil params[:page_part][:widget_field_type] = nil
if params[:page_part][:module_app].blank?
params[:page_part][:module_app] = nil
params[:page_part][:kind] = nil
end
if @part.update_attributes(params[:page_part]) if @part.update_attributes(params[:page_part])
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu') set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
flash.now[:notice] = t('update.success.content') flash.now[:notice] = t('update.success.content')
@ -93,12 +97,11 @@ class Admin::PagePartsController < ApplicationController
def reload_widgets def reload_widgets
@part = PagePart.find params[:id] @part = PagePart.find params[:id]
@categories =[] @categories =[]
@module_app = ModuleApp.find(params[:module_app_id]) @module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? ) @widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? ) @widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
case @module_app.key case @module_app.key
when 'announcement' when 'announcement'
@categories = BulletinCategory.all @categories = BulletinCategory.all
@ -112,9 +115,9 @@ class Admin::PagePartsController < ApplicationController
when 'archive' when 'archive'
@categories = ArchiveFileCategory.all @categories = ArchiveFileCategory.all
@tags = ArchiveTag.all @tags = ArchiveTag.all
end end if @module_app
@part.widget_path = @module_app.widgets.first if @module_app.needs_to_widget_option? @part.widget_path = @module_app.widgets.first if( @module_app && @module_app.needs_to_widget_option?)
respond_to do |format| respond_to do |format|
format.js {} format.js {}
end end

View File

@ -137,15 +137,15 @@ helper Admin::PagePartsHelper
end end
def reload_frontend_pages def reload_frontend_pages
@page = Page.find params[:id] @page = Page.find params[:id] rescue nil
# @categories =[] # @categories =[]
@module_app = ModuleApp.find(params[:module_app_id]) @module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@app_frontend_urls = @module_app.app_pages @app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages
@app_frontend_urls << 'default_widget' if @module_app.has_default_widget? @app_frontend_urls << 'default_widget' if(@module_app && @module_app.has_default_widget?)
case @module_app.key case (@module_app.nil? ? nil : @module_app.key )
when 'announcement' when 'announcement'
@categories = BulletinCategory.all @categories = BulletinCategory.all
@tags = AnnouncementTag.all @tags = AnnouncementTag.all

View File

@ -36,20 +36,35 @@ module Admin::PagePartsHelper
end end
def tag_checked_value(part,radio_value) def tag_checked_value(part,radio_value)
if radio_value.blank?
part[:tag].blank?? true : false
else
part and (part[:tag] == radio_value.to_s) ? true : false part and (part[:tag] == radio_value.to_s) ? true : false
end end
end
def category_checked_value(part,radio_value) def category_checked_value(part,radio_value)
if radio_value.blank?
part[:category].blank?? true : false
else
part and (part[:category] == radio_value.to_s) ? true : false part and (part[:category] == radio_value.to_s) ? true : false
end end
end
def style_checked_value(part,radio_value) def style_checked_value(part,radio_value)
case part case part
when Page when Page
if part.frontend_style.nil? && radio_value == "typeA"
true
else
(part.frontend_style == radio_value) ? true : false (part.frontend_style == radio_value) ? true : false
end
when PagePart when PagePart
if part.widget_style.nil? && radio_value == "typeA"
true
else
(part.widget_style == radio_value) ? true : false (part.widget_style == radio_value) ? true : false
end
when nil when nil
false false
end end
@ -69,7 +84,7 @@ module Admin::PagePartsHelper
end end
def show_default_widget_setting_panel def show_default_widget_setting_panel
if @module_app.has_default_widget? && (!@user_choose.nil? && @user_choose== 'default_widget') #&& @part.widget_path == 'default_widget' if @module_app && @module_app.has_default_widget? && (!@user_choose.nil? && @user_choose== 'default_widget') #&& @part.widget_path == 'default_widget'
true true
else else
false false

View File

@ -49,7 +49,8 @@ module DefaultWidgetHelper
when nil when nil
eval method_entry eval method_entry
else else
eval("#{method_entry}('#{object}')" ) object = "'#{object.to_s}'" if object.class == BSON::ObjectId
eval("#{method_entry}(#{object})" )
end end
end end

View File

@ -23,6 +23,15 @@ class PagePart
before_save :delete_empty_widget_field before_save :delete_empty_widget_field
after_save :update_parent after_save :update_parent
# def module_app
# if self[:module_app]
# self[:module_app]
# elsif self[:kind] == 'module_widget'
# self.page.module_app
# else
# nil
# end
# end
protected protected
@ -37,5 +46,4 @@ class PagePart
self.page.save self.page.save
end end
end end

View File

@ -3,14 +3,14 @@
<%= t("default_widget.select_widget_style") %> <%= t("default_widget.select_widget_style") %>
</label> </label>
<div class="controls well"> <div class="controls well">
<% if @module_app.widgets.nil? || (@module_app.widgets[@widget_path].blank? rescue true) %> <% if @module_app.nil? || @module_app.widgets.nil? || (@module_app.widgets[@widget_path].blank? rescue true) %>
<%= t("default_widget.no_support_setting")%> <%= t("default_widget.no_support_setting")%>
<%else%> <%else%>
<%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]) %> <%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]) %>
<% end %> <% end %>
</div> </div>
</div> </div>
<% if(@module_app.widget_options && @module_app.widget_options.has_key?(@widget_path)) %> <% if(@module_app && @module_app.widget_options && @module_app.widget_options.has_key?(@widget_path)) %>
<div class="style_switch control-group"> <div class="style_switch control-group">
<label class="control-label"><%= t("default_widget.select_widget_ext_option") %></label> <label class="control-label"><%= t("default_widget.select_widget_ext_option") %></label>
<div class="controls well" > <div class="controls well" >

View File

@ -1,11 +1,12 @@
<%= stylesheet_link_tag "admin/default_widget_setting" %> <%= stylesheet_link_tag "admin/default_widget_setting" %>
<%= form_for @part, :url => admin_page_part_path(@part),:html=>{:class=>"clear form-horizontal edit_page_part"} do |f| %> <%= form_for @part, :url => admin_page_part_path(@part),:html=>{:class=>"clear form-horizontal edit_page_part"} do |f| %>
<% LIST[:page_part_kinds].each do |kind| %> <% LIST[:page_part_kinds].each do |kind| %>
<%= label_tag '',:class=>'checkbox inline' do %>
<%= f.radio_button :kind, kind, :class => 'part_kind' %> <%= f.radio_button :kind, kind, :class => 'part_kind' %>
<%= t(kind, :scope => 'page_part_kinds') %> <%= t(kind, :scope => 'page_part_kinds') %>
<% end %> <% end %>
<% end %>
<% LIST[:page_part_kinds].each do |kind| %> <% LIST[:page_part_kinds].each do |kind| %>
<div id='<%= "part_#{kind}" %>' class='part_kind_partial' style="display:<%= kind.eql?(@part.kind) ? 'block' : 'none' %>"> <div id='<%= "part_#{kind}" %>' class='part_kind_partial' style="display:<%= kind.eql?(@part.kind) ? 'block' : 'none' %>">
<%= render :partial => kind, :locals => {:f => f} %> <%= render :partial => kind, :locals => {:f => f} %>

View File

@ -17,7 +17,7 @@
<%= t "default_widget.select_module_app" %> <%= t "default_widget.select_module_app" %>
</label> </label>
<div class="controls"> <div class="controls">
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => @module_app.id), {}, {:rel => admin_page_parts_path,:id=>"page_module_app_id"} %> <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => (@module_app.id rescue nil)), {:include_blank => true }, {:rel => admin_page_parts_path,:id=>"page_module_app_id"} %>
</div> </div>
</div> </div>
@ -26,7 +26,7 @@
<%= t "default_widget.select_widget_path" %> <%= t "default_widget.select_widget_path" %>
</label> </label>
<div class="controls"> <div class="controls">
<%= f.select :widget_path, @module_app.widgets.collect{|k,v| [k.humanize, k]}, {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %> <%= f.select :widget_path, @module_app ? @module_app.widgets.collect{|k,v| [k.humanize, k]} : [], {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %>
</div> </div>
</div> </div>

View File

@ -0,0 +1,8 @@
<div class="style_switch control-group">
<label class="control-label">
<%= t(label_i18n) %>
</label>
<div class="controls well">
<%= t('default_widget.no_support_setting') %>
</div>
</div>

View File

@ -1,13 +1,20 @@
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k},@part.widget_path) %>"); <% if @module_app%>
$("#widget_data_source_category").html("<%= j render :partial => 'widget_data_source_category',:locals=>{:object=>@part} %>"); $('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k},@part.widget_path) %>");
$("#widget_data_source_tag").html("<%= j render :partial => 'widget_data_source_tag',:locals=>{:object=>@part} %>"); $("#widget_data_source_category").html("<%= j render :partial => 'widget_data_source_category',:locals=>{:object=>@part} %>");
$("#widget_data_source_tag").html("<%= j render :partial => 'widget_data_source_tag',:locals=>{:object=>@part} %>");
<% if !@part.widget_path.blank? %> <% if @part %>
<% if show_default_widget_setting_panel %> <% if show_default_widget_setting_panel %>
$('#widget_setting').html("<%= j render :partial => 'default_widget_style_panel' %>"); $('#widget_setting').html("<%= j render :partial => 'default_widget_style_panel' %>");
$('#widget_setting').append("<%= j render :partial => 'default_widget_setting',:locals=>{:object=>@part} %>"); $('#widget_setting').append("<%= j render :partial => 'default_widget_setting',:locals=>{:object=>@part} %>");
<% elsif show_custom_widget_setting_panel %> <% elsif show_custom_widget_setting_panel %>
$('#widget_setting').html("<%= j render :partial => 'custom_widget_setting' %>"); $('#widget_setting').html("<%= j render :partial => 'custom_widget_setting' %>");
<% end %> <% end %>
<% end %>
<% else %>
$('#widget_option').find("div.well.controls").html("<%= t('default_widget.no_support_setting')%>");
$('#widget_setting').html("<%=j render :partial=> 'reset',:locals=>{:label_i18n=>'default_widget.select_widget_style'}%>");
$('#widget_list select').html("<%= j options_for_select([]) %>");
<% end %> <% end %>

View File

@ -0,0 +1,8 @@
<div class="control-group">
<label class="control-label">
<%= t("default_widget.select_widget_style") %>
</label>
<div class="controls well">
<%= t("default_widget.no_support_setting")%>
</div>
</div>

View File

@ -2,9 +2,12 @@
<%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %> <%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %>
<div class="control-group"> <div class="control-group">
<%= f.label :name, t(:name), :class => 'control-label' %> <%= f.label :name, '*'+t(:name), :class => 'control-label' %>
<div class="controls"> <div class="controls">
<%= f.text_field :name, :class => 'text input-xlarge' %> <%= f.text_field :name, :class => 'text input-xlarge' %>
<span class="help-inline">請輸入數字或英文,不可使用空白</span>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> <!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div> </div>
</div> </div>
@ -44,19 +47,12 @@
</div> </div>
<div class="control-group" id="frontend_list"> <div class="control-group" id="frontend_list">
<%= f.label '', t("page.select_app_url"), :class => 'control-label' %> <%= f.label '', t("front_page.select_app_url"), :class => 'control-label' %>
<div class="controls" id="app_page_url"> <div class="controls" id="app_page_url">
<%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> <%= select('page','app_frontend_url', @app_frontend_urls || [], :selected => @item.app_frontend_url ) rescue ''%>
</div> </div>
</div> </div>
<!-- <div class="control-group">
<%= f.label '', "FRONT STYLE", :class => 'control-label' %>
<div class="controls" id="app_page_frontend_style">
<%= select('page','frontend_style', @frontend_style, :selected => @item[:frontend_style], :include_blank => true ) rescue ''%>
</div>
</div>
-->
<div id="app_page_category" class="control-group"> <div id="app_page_category" class="control-group">
<%= render :partial=>"admin/page_parts/widget_data_source_category",:locals=>{:object=>@item} %> <%= render :partial=>"admin/page_parts/widget_data_source_category",:locals=>{:object=>@item} %>
@ -72,7 +68,7 @@
<div class="control-group"> <div class="control-group">
<%= f.label :is_published, "#{t(:is_published)} ?", :class => 'control-label' %> <%= f.label :is_published, "#{t('front_page.is_published')} ?", :class => 'control-label' %>
<div class="controls"> <div class="controls">
<label class="radio"> <label class="radio">
<%= f.radio_button :is_published, true %> <%= f.radio_button :is_published, true %>
@ -86,7 +82,7 @@
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<%= f.label :menu_enabled_for, "#{t(:menu_enabled_for)}:", :class => 'control-label' %> <%= f.label :menu_enabled_for, "#{t('front_page.menu_enable_lang')}:", :class => 'control-label' %>
<div class="controls"> <div class="controls">
<% @site_valid_locales.each do |valid_locale| %> <% @site_valid_locales.each do |valid_locale| %>
<label class="checkbox"> <label class="checkbox">
@ -100,7 +96,7 @@
</div> </div>
<div class="control-group"> <div class="control-group">
<%= f.label :enabled_for, "#{t(:enabled_for)}:", :class => 'control-label' %> <%= f.label :enabled_for, "#{t('front_page.link_enable_lang')}:", :class => 'control-label' %>
<div class="controls"> <div class="controls">
<% @site_valid_locales.each do |valid_locale| %> <% @site_valid_locales.each do |valid_locale| %>
<label class="checkbox"> <label class="checkbox">

View File

@ -1,24 +1,33 @@
<% if @module_app %>
$('#app_page_category').html("<%= j render :partial => 'admin/page_parts/widget_data_source_category' ,:locals=>{:object=>@page}%>");
$('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@page} %>");
$('#app_page_category').html("<%= j render :partial => 'admin/page_parts/widget_data_source_category' ,:locals=>{:object=>@page}%>"); <% if !@module_app.app_pages.blank? %>
$('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@page} %>");
<% if !@module_app.app_pages.blank? %>
$('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', options_for_select(@app_frontend_urls, @app_frontend_urls.first)) %>"); $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', options_for_select(@app_frontend_urls, @app_frontend_urls.first)) %>");
<%else %> <%else %>
$('#app_page_url').html("<%= t('default_widget.no_support_setting')%>"); $('#app_page_url').html("<%= t('default_widget.no_support_setting')%>");
<% end %> <% end %>
<% if @app_frontend_urls.first =='default_widget' %> <% if @app_frontend_urls.first =='default_widget' %>
$('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>"); $('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>");
<% else %> <% else %>
$('#app_page_frontend_style').html("<%= t('default_widget.no_support_setting')%>"); $('#app_page_frontend_style').html("<%= t('default_widget.no_support_setting')%>");
<% end %> <% end %>
<% if show_default_widget_setting_panel %> <% if show_default_widget_setting_panel %>
$('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@page} %>"); $('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@page} %>");
$('#frontend_setting').html("<%= j render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:object=>@page} %>"); $('#frontend_setting').html("<%= j render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:object=>@page} %>");
$('#frontend_setting').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@page} %>"); $('#frontend_setting').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@page} %>");
<% else %> <% else %>
$('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>"); $('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>");
<% end %>
<% else %>
$('#app_page_url').html("<%= t('default_widget.no_support_setting')%>");
$('#app_page_category').find("div.well.controls").html("<%= t('default_widget.no_support_setting')%>");
$('#app_page_tag').find("div.well.controls").html("<%= t('default_widget.no_support_setting')%>");
$('#app_page_url').html("<%= t('default_widget.no_support_setting')%>");
$('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>");
<% end %> <% end %>

View File

@ -2,6 +2,11 @@ zh_tw:
_locale: 中文 _locale: 中文
front_page:
select_app_url: 模組前台樣式
is_published: 是否公開
menu_enable_lang: 選單啓用語系
link_enable_lang: 連結生效語系
access: access:
denied: denied:
app: app:
@ -156,10 +161,10 @@ zh_tw:
fields_: 前台輸出欄位 fields_: 前台輸出欄位
fields_order: 輸出欄位順序 fields_order: 輸出欄位順序
fields_style: 輸出欄位樣式 fields_style: 輸出欄位樣式
select_module_app: 外掛模組選擇 select_module_app: 套用模組
select_widget_path: 外掛樣版選擇 select_widget_path: 外掛樣版選擇
select_widget_style: 排版樣式 select_widget_style: 排版樣式
widget_data_count: 模組輸出則數 widget_data_count: 顯示則數
select_widget_ext_option: 模組延伸選項 select_widget_ext_option: 模組延伸選項
caption: caption:
typeA: 表格式排版,簡單明瞭呈現內容 typeA: 表格式排版,簡單明瞭呈現內容
@ -391,7 +396,7 @@ zh_tw:
template: 樣版 template: 樣版
template_name: 樣版名稱 template_name: 樣版名稱
text: 內文 text: 內文
theme: 主題 theme: 套用頁面樣式
themes: 主題 themes: 主題
title: 標題 title: 標題
top: 置頂 top: 置頂

View File

@ -1,4 +1,6 @@
Orbit::Application.routes.draw do Orbit::Application.routes.draw do
# get "robots.txt" => 'robots#index'
devise_for :users do devise_for :users do
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
end end
@ -79,6 +81,10 @@ Orbit::Application.routes.draw do
end end
resources :pages do resources :pages do
collection do
get 'reload_after_module_changed', :action=>'reload_frontend_pages'
get 'reload_after_list_changed',:action=> 'reload_front_end_setting'
end
member do member do
get 'delete' get 'delete'
get 'reload_themes' get 'reload_themes'

View File

@ -354,6 +354,7 @@ namespace :migrate do
task :make_default_widget_work_config => :environment do task :make_default_widget_work_config => :environment do
a = ModuleApp.where(:key=>'announcement').first a = ModuleApp.where(:key=>'announcement').first
a.widgets[:default_widget] = ['typeA','typeC','typeB_style2','typeB_style3','typeB_style4'] a.widgets[:default_widget] = ['typeA','typeC','typeB_style2','typeB_style3','typeB_style4']
a.widgets = {"index"=>["1", "2"], "default_widget"=>["typeA", "typeC", "typeB_style2", "typeB_style3", "typeB_style4"]}
a.widget_fields = [ a.widget_fields = [
["title","announcement.default_widget.title"], ["title","announcement.default_widget.title"],
["bulletin_category_with_title","announcement.default_widget.bulletin_category_with_title"], ["bulletin_category_with_title","announcement.default_widget.bulletin_category_with_title"],
@ -392,12 +393,15 @@ namespace :migrate do
task :correct_gallery_and_web_resoure_config => :environment do task :correct_gallery_and_web_resoure_config => :environment do
a = ModuleApp.where(:key=>'web_resource').first a = ModuleApp.where(:key=>'web_resource').first
if a
a.widgets = {} a.widgets = {}
a.widgets[:web_links] = [] a.widgets[:web_links] = []
a.widgets[:home_list] = [] a.widgets[:home_list] = []
a.save a.save
end
a = ModuleApp.where(:key=>'gallery').first a = ModuleApp.where(:key=>'gallery').first
if a
a.widgets = {} a.widgets = {}
a.widgets[:widget1] = [] a.widgets[:widget1] = []
a.widget_options_fields_i18n = {"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.widget_option.album"}} a.widget_options_fields_i18n = {"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.widget_option.album"}}
@ -405,4 +409,6 @@ namespace :migrate do
a.save a.save
end end
end
end end

View File

@ -1,17 +1,24 @@
{ {
"title": "announcement", "app_pages":["bulletins"],
"version": "0.1", "author":"RD dep",
"organization": "Rulingcom", "create_date":"11-11-2011",
"author": "RD dep", "enable_frontend":true,
"intro": "A simple blog……", "get_default_widget":{"query":"Bulletin.all","image":"image"},
"update_info": "Some info", "intro":"A simple blog",
"create_date": "11-11-2011", "key":"announcement",
"app_pages": ["bulletins"], "organization":"Rulingcom",
"widgets": { "title":"Announcement",
"index":["1","2","3","4","5"], "update_info":"Some info",
"bulletins_and_web_links":[] "version":"0.1",
}, "widget_fields":[["title","announcement.default_widget.title"],
"category": ["BulletinCategory"], ["bulletin_category_with_title","announcement.default_widget.bulletin_category_with_title"],
"widget_fields":["title","category","postdate"], ["postdate","announcement.default_widget.postdate"]],
"enable_frontend": true "widget_fields_link_method":{"title":{"method":"panel_announcement_front_end_bulletin_path","args":"self"},
} "bulletin_category_with_title":{"method":"panel_announcement_front_end_bulletins_path",
"args":{"category_id":["bulletin_category","id"]}
}},
"widget_options":null,
"widget_options_fields_i18n":null,
"widgets":{"index":["1","2"],
"default_widget":["typeA","typeC","typeB_style2","typeB_style3","typeB_style4"]
}}

View File

@ -70,13 +70,6 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
end end
def bulletins_and_web_links
@tags = AnnouncementTag.any_in(key: ['students', 'alumni', 'employee', 'guest']).asc(:order)
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
@bulletins = @selected_tag.get_visible_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).available_for_lang(I18n.locale).page(params[:page]).per(5) rescue nil
end
def reload_bulletins def reload_bulletins
@selected_tag = AnnouncementTag.find(params[:tag_id]) @selected_tag = AnnouncementTag.find(params[:tag_id])
@bulletins = @selected_tag.get_visible_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil @bulletins = @selected_tag.get_visible_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil

View File

@ -1,23 +0,0 @@
<div class="tag_block">
<ul id='bulletins_web_links_tags' class="tag_list">
<%= render :partial => 'tag', :collection => @tags %>
</ul>
</div>
<div class="news_block">
<h3 class="news_title2"><%= link_to t("announcement.bulletins"), panel_announcement_front_end_bulletins_path, :class => 'more' %></h3>
<ul id='bulletins_web_links_bulletins' class="news_list">
<%= render 'bulletins' if @bulletins %>
</ul>
</div>
<div class="links_block">
<h3 class="links_title"><%= t(:related_links) %></h3>
<ul id='bulletins_web_links_web_links' class="links_list">
<%= render 'web_links' if @web_links %>
</ul>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "news_link" %>
<% end %>

View File

@ -1,3 +0,0 @@
$('#bulletins_web_links_tags').html("<%= j render :partial => 'tag', :collection => @tags %>")
$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' if @bulletins %>")
$('#bulletins_web_links_web_links').html("<%= j render 'web_links' if @web_links %>")