daily commit
This commit is contained in:
parent
0cc616f988
commit
979df9ac80
|
@ -25,14 +25,14 @@ class Admin::PagePartsController < ApplicationController
|
|||
def edit
|
||||
@part = PagePart.find(params[:id])
|
||||
@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
|
||||
@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
|
||||
|
||||
@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?
|
||||
end
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Admin::PagePartsController < ApplicationController
|
|||
when 'archive'
|
||||
@categories = ArchiveFileCategory.all
|
||||
@tags = ArchiveTag.all
|
||||
end
|
||||
end if @module_app
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -61,7 +61,11 @@ 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_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])
|
||||
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
||||
flash.now[:notice] = t('update.success.content')
|
||||
|
@ -93,12 +97,11 @@ class Admin::PagePartsController < ApplicationController
|
|||
def reload_widgets
|
||||
@part = PagePart.find params[:id]
|
||||
@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? )
|
||||
|
||||
case @module_app.key
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
|
@ -112,9 +115,9 @@ class Admin::PagePartsController < ApplicationController
|
|||
when 'archive'
|
||||
@categories = ArchiveFileCategory.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|
|
||||
format.js {}
|
||||
end
|
||||
|
|
|
@ -137,15 +137,15 @@ helper Admin::PagePartsHelper
|
|||
end
|
||||
|
||||
def reload_frontend_pages
|
||||
@page = Page.find params[:id]
|
||||
@page = Page.find params[:id] rescue nil
|
||||
# @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 << 'default_widget' if @module_app.has_default_widget?
|
||||
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages
|
||||
@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'
|
||||
@categories = BulletinCategory.all
|
||||
@tags = AnnouncementTag.all
|
||||
|
|
|
@ -36,20 +36,35 @@ module Admin::PagePartsHelper
|
|||
end
|
||||
|
||||
def tag_checked_value(part,radio_value)
|
||||
part and (part[:tag] == radio_value.to_s) ? true : false
|
||||
if radio_value.blank?
|
||||
part[:tag].blank?? true : false
|
||||
else
|
||||
part and (part[:tag] == radio_value.to_s) ? true : false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def category_checked_value(part,radio_value)
|
||||
part and (part[:category] == radio_value.to_s) ? true : false
|
||||
if radio_value.blank?
|
||||
part[:category].blank?? true : false
|
||||
else
|
||||
part and (part[:category] == radio_value.to_s) ? true : false
|
||||
end
|
||||
end
|
||||
|
||||
def style_checked_value(part,radio_value)
|
||||
case part
|
||||
when Page
|
||||
(part.frontend_style == radio_value) ? true : false
|
||||
if part.frontend_style.nil? && radio_value == "typeA"
|
||||
true
|
||||
else
|
||||
(part.frontend_style == radio_value) ? true : false
|
||||
end
|
||||
when PagePart
|
||||
(part.widget_style == radio_value) ? true : false
|
||||
if part.widget_style.nil? && radio_value == "typeA"
|
||||
true
|
||||
else
|
||||
(part.widget_style == radio_value) ? true : false
|
||||
end
|
||||
when nil
|
||||
false
|
||||
end
|
||||
|
@ -69,7 +84,7 @@ module Admin::PagePartsHelper
|
|||
end
|
||||
|
||||
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
|
||||
else
|
||||
false
|
||||
|
|
|
@ -49,7 +49,8 @@ module DefaultWidgetHelper
|
|||
when nil
|
||||
eval method_entry
|
||||
else
|
||||
eval("#{method_entry}('#{object}')" )
|
||||
object = "'#{object.to_s}'" if object.class == BSON::ObjectId
|
||||
eval("#{method_entry}(#{object})" )
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -23,6 +23,15 @@ class PagePart
|
|||
before_save :delete_empty_widget_field
|
||||
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
|
||||
|
||||
|
@ -37,5 +46,4 @@ class PagePart
|
|||
self.page.save
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -3,14 +3,14 @@
|
|||
<%= t("default_widget.select_widget_style") %>
|
||||
</label>
|
||||
<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")%>
|
||||
<%else%>
|
||||
<%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]) %>
|
||||
<% end %>
|
||||
</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">
|
||||
<label class="control-label"><%= t("default_widget.select_widget_ext_option") %></label>
|
||||
<div class="controls well" >
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<%= 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| %>
|
||||
|
||||
<% LIST[:page_part_kinds].each do |kind| %>
|
||||
<%= label_tag '',:class=>'checkbox inline' do %>
|
||||
<%= f.radio_button :kind, kind, :class => 'part_kind' %>
|
||||
<%= t(kind, :scope => 'page_part_kinds') %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% LIST[:page_part_kinds].each do |kind| %>
|
||||
<div id='<%= "part_#{kind}" %>' class='part_kind_partial' style="display:<%= kind.eql?(@part.kind) ? 'block' : 'none' %>">
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<%= t "default_widget.select_module_app" %>
|
||||
</label>
|
||||
<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>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
<%= t "default_widget.select_widget_path" %>
|
||||
</label>
|
||||
<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>
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -1,13 +1,20 @@
|
|||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k},@part.widget_path) %>");
|
||||
$("#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 @module_app%>
|
||||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k},@part.widget_path) %>");
|
||||
$("#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 show_default_widget_setting_panel %>
|
||||
$('#widget_setting').html("<%= j render :partial => 'default_widget_style_panel' %>");
|
||||
$('#widget_setting').append("<%= j render :partial => 'default_widget_setting',:locals=>{:object=>@part} %>");
|
||||
<% elsif show_custom_widget_setting_panel %>
|
||||
$('#widget_setting').html("<%= j render :partial => 'custom_widget_setting' %>");
|
||||
<% if @part %>
|
||||
<% if show_default_widget_setting_panel %>
|
||||
$('#widget_setting').html("<%= j render :partial => 'default_widget_style_panel' %>");
|
||||
$('#widget_setting').append("<%= j render :partial => 'default_widget_setting',:locals=>{:object=>@part} %>");
|
||||
<% elsif show_custom_widget_setting_panel %>
|
||||
$('#widget_setting').html("<%= j render :partial => 'custom_widget_setting' %>");
|
||||
<% 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 %>
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -2,9 +2,12 @@
|
|||
<%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :name, t(:name), :class => 'control-label' %>
|
||||
<%= f.label :name, '*'+t(:name), :class => 'control-label' %>
|
||||
|
||||
|
||||
<div class="controls">
|
||||
<%= 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> -->
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,19 +47,12 @@
|
|||
</div>
|
||||
|
||||
<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">
|
||||
<%= 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 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">
|
||||
<%= render :partial=>"admin/page_parts/widget_data_source_category",:locals=>{:object=>@item} %>
|
||||
|
@ -72,7 +68,7 @@
|
|||
|
||||
|
||||
<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">
|
||||
<label class="radio">
|
||||
<%= f.radio_button :is_published, true %>
|
||||
|
@ -86,7 +82,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<% @site_valid_locales.each do |valid_locale| %>
|
||||
<label class="checkbox">
|
||||
|
@ -100,7 +96,7 @@
|
|||
</div>
|
||||
|
||||
<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">
|
||||
<% @site_valid_locales.each do |valid_locale| %>
|
||||
<label class="checkbox">
|
||||
|
|
|
@ -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}%>");
|
||||
$('#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)) %>");
|
||||
<%else %>
|
||||
$('#app_page_url').html("<%= t('default_widget.no_support_setting')%>");
|
||||
<% end %>
|
||||
|
||||
<% 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? %>");
|
||||
<% else %>
|
||||
$('#app_page_frontend_style').html("<%= t('default_widget.no_support_setting')%>");
|
||||
<% end %>
|
||||
|
||||
<% if show_default_widget_setting_panel %>
|
||||
$('#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').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@page} %>");
|
||||
<% else %>
|
||||
$('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>");
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
||||
<% 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)) %>");
|
||||
<%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 %>
|
||||
|
||||
<% 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? %>");
|
||||
<% else %>
|
||||
$('#app_page_frontend_style').html("<%= t('default_widget.no_support_setting')%>");
|
||||
<% end %>
|
||||
|
||||
<% if show_default_widget_setting_panel %>
|
||||
$('#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').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@page} %>");
|
||||
<% else %>
|
||||
$('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>");
|
||||
<% end %>
|
|
@ -2,6 +2,11 @@ zh_tw:
|
|||
|
||||
_locale: 中文
|
||||
|
||||
front_page:
|
||||
select_app_url: 模組前台樣式
|
||||
is_published: 是否公開
|
||||
menu_enable_lang: 選單啓用語系
|
||||
link_enable_lang: 連結生效語系
|
||||
access:
|
||||
denied:
|
||||
app:
|
||||
|
@ -156,10 +161,10 @@ zh_tw:
|
|||
fields_: 前台輸出欄位
|
||||
fields_order: 輸出欄位順序
|
||||
fields_style: 輸出欄位樣式
|
||||
select_module_app: 外掛模組選擇
|
||||
select_module_app: 套用模組
|
||||
select_widget_path: 外掛樣版選擇
|
||||
select_widget_style: 排版樣式
|
||||
widget_data_count: 模組輸出則數
|
||||
widget_data_count: 顯示則數
|
||||
select_widget_ext_option: 模組延伸選項
|
||||
caption:
|
||||
typeA: 表格式排版,簡單明瞭呈現內容
|
||||
|
@ -391,7 +396,7 @@ zh_tw:
|
|||
template: 樣版
|
||||
template_name: 樣版名稱
|
||||
text: 內文
|
||||
theme: 主題
|
||||
theme: 套用頁面樣式
|
||||
themes: 主題
|
||||
title: 標題
|
||||
top: 置頂
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
Orbit::Application.routes.draw do
|
||||
# get "robots.txt" => 'robots#index'
|
||||
|
||||
devise_for :users do
|
||||
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
||||
end
|
||||
|
@ -79,6 +81,10 @@ Orbit::Application.routes.draw do
|
|||
end
|
||||
|
||||
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
|
||||
get 'delete'
|
||||
get 'reload_themes'
|
||||
|
|
|
@ -354,6 +354,7 @@ namespace :migrate do
|
|||
task :make_default_widget_work_config => :environment do
|
||||
a = ModuleApp.where(:key=>'announcement').first
|
||||
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 = [
|
||||
["title","announcement.default_widget.title"],
|
||||
["bulletin_category_with_title","announcement.default_widget.bulletin_category_with_title"],
|
||||
|
@ -392,17 +393,22 @@ namespace :migrate do
|
|||
|
||||
task :correct_gallery_and_web_resoure_config => :environment do
|
||||
a = ModuleApp.where(:key=>'web_resource').first
|
||||
a.widgets = {}
|
||||
a.widgets[:web_links] = []
|
||||
a.widgets[:home_list] = []
|
||||
a.save
|
||||
if a
|
||||
a.widgets = {}
|
||||
a.widgets[:web_links] = []
|
||||
a.widgets[:home_list] = []
|
||||
a.save
|
||||
end
|
||||
|
||||
a = ModuleApp.where(:key=>'gallery').first
|
||||
a.widgets = {}
|
||||
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 = {"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6], "album_id"=>{"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}}}
|
||||
a.save
|
||||
if a
|
||||
a.widgets = {}
|
||||
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 = {"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6], "album_id"=>{"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}}}
|
||||
a.save
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
{
|
||||
"title": "announcement",
|
||||
"version": "0.1",
|
||||
"organization": "Rulingcom",
|
||||
"author": "RD dep",
|
||||
"intro": "A simple blog……",
|
||||
"update_info": "Some info",
|
||||
"create_date": "11-11-2011",
|
||||
"app_pages": ["bulletins"],
|
||||
"widgets": {
|
||||
"index":["1","2","3","4","5"],
|
||||
"bulletins_and_web_links":[]
|
||||
},
|
||||
"category": ["BulletinCategory"],
|
||||
"widget_fields":["title","category","postdate"],
|
||||
"enable_frontend": true
|
||||
}
|
||||
{
|
||||
"app_pages":["bulletins"],
|
||||
"author":"RD dep",
|
||||
"create_date":"11-11-2011",
|
||||
"enable_frontend":true,
|
||||
"get_default_widget":{"query":"Bulletin.all","image":"image"},
|
||||
"intro":"A simple blog",
|
||||
"key":"announcement",
|
||||
"organization":"Rulingcom",
|
||||
"title":"Announcement",
|
||||
"update_info":"Some info",
|
||||
"version":"0.1",
|
||||
"widget_fields":[["title","announcement.default_widget.title"],
|
||||
["bulletin_category_with_title","announcement.default_widget.bulletin_category_with_title"],
|
||||
["postdate","announcement.default_widget.postdate"]],
|
||||
"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"]
|
||||
}}
|
|
@ -70,13 +70,6 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
|||
|
||||
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
|
||||
@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
|
||||
|
|
|
@ -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 %>
|
|
@ -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 %>")
|
Loading…
Reference in New Issue