* 'ntu' of https://github.com/Rulingcom/orbit:
  Remove I18n.locale for announcement front-end Fix counter in back-end edit
  gallery options
  Fix urls in tinymce source editor
  Changes for announcement widget style 1 and categories
  Changes for announcement widget style 2
  Fix orbit_front parser
  Fix counter front-end
  Fix site map and menu order
  Remove extra double quote in sub_menu Fix web link widget pagination
  Put back old tags (don't use the class ProtoTag)
  Add page counter
This commit is contained in:
Rueshyna 2012-12-28 16:06:22 +08:00
commit 30f9295010
30 changed files with 397 additions and 81 deletions

View File

@ -1,3 +1,7 @@
function get_part_id(){
return $(".edit_page_part").attr("action").split('/').pop();
}
$("div.editable").live("mouseenter mouseleave", function (event) { $("div.editable").live("mouseenter mouseleave", function (event) {
$(this).children('.edit_link').toggle(); $(this).children('.edit_link').toggle();
}); });
@ -21,11 +25,11 @@ $("#page_module_app_id").live('change', function() {
}); });
$("#module_app_list select").live('change', function() { $("#module_app_list select").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets'); $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets?part_id=' + get_part_id());
}); });
$("#widget_list select").live('change', function() { $("#widget_list select").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widget_styles?module_app_id=' + $("#module_app_list select").val()); $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widget_styles?module_app_id=' + $("#module_app_list select").val() + '&part_id=' + get_part_id());
}); });
$("#tag_list select").live('change', function() { $("#tag_list select").live('change', function() {

View File

@ -14,7 +14,6 @@ function load_tinymce() {
theme_advanced_toolbar_align : "left", theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom", theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true, theme_advanced_resizing : true,
relative_urls : false,
// Skin options // Skin options
skin : "o2k7", skin : "o2k7",

View File

@ -0,0 +1,195 @@
body{
margin:10px;
padding:0;
}
a{
color:#333;
text-decoration: none;
}
a:hover{
color:#888;
text-decoration: none;
}
h2{
margin:0 0 10px;
}
ul{
margin:0;
padding:0;
}
li{
list-style:none;
}
.eletb{
border-collapse:collapse;
width:600px;
}
.eletb td{
border: 1px solid #EEEEEE;
padding: 5px;
vertical-align: middle;
text-align: center;
}
.news{
font-size:12px;
margin:0 0 20px;
position:relative;
width:600px;
}
.news ul{
margin:0 0 10px;
}
.news li{
padding:5px 0;
}
.more{
background:#eee;
border-radius: 5px;
clear:both;
display:inline;
padding:3px;
text-align: center;
}
.top{
color:#e21f1f;
}
.elements{
background: none repeat scroll 0 0 #f2f2f2;
border-radius: 5px 5px 5px 5px;
display: inline-block;
height: 50px;
padding: 10px;
text-align: center;
vertical-align: top;
width: 50px;
word-wrap: break-word;
}
.elementlist{
margin:0 0 20px;
}
/* 1 */
.newstb{
border-collapse:collapse;
width:600px;
}
.newstb th{
background: none repeat scroll 0 0 #eee;
padding: 5px;
text-align: left;
}
.newstb td{
border: 1px solid #EEEEEE;
padding: 5px;
}
/* 2 */
.news2{}
.news2 li{
border-bottom:1px solid #eee;
}
.news2 .newsimg{
display: inline-block;
margin: 0 10px 0 0;
vertical-align: top;
}
.news2 .app-pic{
height:50px;
width:50px;
display: inline-block;
}
.news2 ul{
display: inline-block;
width:570px;
}
/* 3 */
.news3{}
.news3 li{
border-bottom:1px solid #eee;
overflow: hidden;
}
.news3 .img{
float:left;
margin:0 10px 0 0;
}
.news3 .hot, .news3 .title, .news3 .date, .news3 .tags, .news3 .text{
display:block;
margin:0 0 5px;
text-align: left;
}
.news3 .wrap{
overflow: hidden;
}
/* 4 */
.news4{}
.news4 li{
border-bottom:1px solid #eee;
overflow: hidden;
}
.news4 .img{
float:right;
margin:0 0 0 10px;
}
.news4 .hot, .news4 .title, .news4 .date, .news4 .tags, .news4 .text{
display:block;
margin:0 0 5px;
text-align: left;
}
.news4 .wrap{
overflow: hidden;
}
/* 5 */
.news5{
overflow: hidden;
}
.news5 .img{
float:left;
margin:0 10px 0 0;
}
.news5 ul{
float: left;
text-align: left;
width: 540px;
}
.news5 li{
border-bottom:1px solid #eee;
}
.news5 .more{}
.news5 .hot, .news5 .title, .news5 .date, .news5 .tags, .news5 .text{
}
.news5 .wrap{
overflow: hidden;
}

View File

@ -90,6 +90,7 @@ class Admin::PagePartsController < ApplicationController
end end
def reload_widgets def reload_widgets
@part = PagePart.find params[:part_id]
@categories =[] @categories =[]
@module_app = ModuleApp.find(params[:id]) @module_app = ModuleApp.find(params[:id])
@ -112,6 +113,7 @@ class Admin::PagePartsController < ApplicationController
@tags = ArchiveTag.all @tags = ArchiveTag.all
end end
@part.widget_path = @module_app.widgets.first if @module_app.needs_to_widget_option?
respond_to do |format| respond_to do |format|
format.js {} format.js {}
end end

View File

@ -39,7 +39,7 @@ class FrontController < ApplicationController
res << "'>" res << "'>"
i = nil i = nil
i = 1 if menu.values["li_incremental_#{current}"] i = 1 if menu.values["li_incremental_#{current}"]
children = current == 1 ? page.visible_children.reverse : page.visible_children children = current == 1 ? page.visible_children : page.visible_children
children.each do |child| children.each do |child|
res << menu_li(child, current_page, current, menu, i) res << menu_li(child, current_page, current, menu, i)
i += 1 if i i += 1 if i

View File

@ -1,3 +1,10 @@
class OrbitWidgetController< OrbitFrontendComponentController class OrbitWidgetController< OrbitFrontendComponentController
before_filter :get_wiget_options
def get_wiget_options
@wiget_options = {}
if params[:widget_options]
@wiget_options = (eval('{'+ params[:widget_options] +'}') rescue {})
end
end
end end

View File

@ -56,7 +56,7 @@ class Item
end end
def show_in_sitemap_for(locale) def show_in_sitemap_for(locale)
if !sitemap_enabled[locale].blank? if sitemap_enabled && !sitemap_enabled[locale].blank?
sitemap_enabled[locale].eql?('true') ? true : false sitemap_enabled[locale].eql?('true') ? true : false
else else
true true

View File

@ -17,7 +17,8 @@ class ModuleApp
# field :widgets ,type: Array # field :widgets ,type: Array
field :widgets ,type: Hash field :widgets ,type: Hash
field :widget_fields ,type: Array field :widget_fields ,type: Array
field :widget_options,type:Hash
field :widget_options_fields_i18n,type:Hash
has_many :managers,as: :managing_app ,:class_name => "AppManager" ,:dependent => :destroy#,:foreign_key => "managing_app_id",:inverse_of => :managing_app has_many :managers,as: :managing_app ,:class_name => "AppManager" ,:dependent => :destroy#,:foreign_key => "managing_app_id",:inverse_of => :managing_app
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager", :dependent => :destroy#,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager", :dependent => :destroy#,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
@ -79,6 +80,14 @@ class ModuleApp
end end
end end
def needs_to_widget_option?
if self.widget_options
self.widget_options.has_key? widgets.first
else
false
end
end
protected protected
def set_key def set_key

View File

@ -14,6 +14,7 @@ class PagePart
field :widget_style field :widget_style
field :widget_field , :type => Array field :widget_field , :type => Array
field :widget_options ,:type=>Hash
field :widget_data_count field :widget_data_count
belongs_to :page belongs_to :page
@ -22,6 +23,11 @@ class PagePart
before_save :delete_empty_widget_field before_save :delete_empty_widget_field
after_save :update_parent after_save :update_parent
def widget_options_uri
self.widget_options.map{|t| "#{t[0]}: #{t[1]}"}.join(',') rescue ''
end
protected protected
def delete_empty_widget_field def delete_empty_widget_field
@ -35,4 +41,5 @@ class PagePart
self.page.save self.page.save
end end
end end

View File

@ -1,4 +1,45 @@
class Tag < ProtoTag # class Tag < ProtoTag
belongs_to :module_app # belongs_to :module_app
# end
class Tag
include Mongoid::Document
include Mongoid::Timestamps
include Impressionist::Impressionable
is_impressionable :counter_cache => { :column_name => :view_count }
field :key
field :view_count, :type => Integer, :default => 0
#field :cloud_amper,:type: Integer,:default=> 0
def self.sorted_for_cloud
tags = {}
self.all.each{ |tag|
tags.merge!({tag => self.get_impressionist(tag)})
}
if !tags.blank?
sorted_tags = tags.sort{|a,b| a[1]<=>b[1]}.reverse
sorted_tags[0][1] = :hot1
offset = (sorted_tags.size - 1) / 3
i = 1
class_i = 2
sorted_tags[1..-1].collect!{ |x|
x[1] = "hot#{class_i}"
i == offset ? i = 1 : i += 1 if class_i < 4
class_i += 1 if i == offset && class_i < 4
}
sorted_tags
else
[]
end
end
protected
def self.get_impressionist(item_tag = self)
item_tag.impressions.where(:created_at.gte=> 14.days.ago,:created_at.lte => Time.now).count
end
end end

View File

@ -12,6 +12,6 @@
<% end %> <% end %>
<p> <p>
<%= f.submit t(:update) %> <%= link_back %> <%= f.submit t(:update_) %> <%= link_back %>
</p> </p>
<% end %> <% end %>

View File

@ -46,7 +46,6 @@
<%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, @part.widget_field.collect{|widget_field| widget_field}), {:multiple => :multiple, :size => 6} %> <%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, @part.widget_field.collect{|widget_field| widget_field}), {:multiple => :multiple, :size => 6} %>
</span> </span>
<div id="widget_data_count"> <span id="widget_options">
<%= f.label :widget_data_count %> <%= render 'widget_options' %>
<%= f.text_field :widget_data_count %> </span>
</div>

View File

@ -1,4 +1,3 @@
<% if (@module_app && @module_app.widget_fields) %> <% if (@module_app && @module_app.widget_fields) %>
<%= label_tag('widget_field') %> <%= label_tag('widget_field') %>
@ -9,4 +8,6 @@
<%= select_tag "page_part[widget_field_type][]", options_for_select(LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}, (@part[:widget_field][i][1] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ), :include_blank => true %> <br /> <%= select_tag "page_part[widget_field_type][]", options_for_select(LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}, (@part[:widget_field][i][1] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ), :include_blank => true %> <br />
<% end %> <% end %>
<%= label_tag :widget_data_count %>
<%= text_field_tag :widget_data_count,@part.widget_data_count %>
<% end %> <% end %>

View File

@ -3,3 +3,5 @@ $('#widget_style_list').html("<%= escape_javascript(select 'page_part', 'widget_
$('#widget_field').html("<%= j render 'widget_fields' %>"); $('#widget_field').html("<%= j render 'widget_fields' %>");
$('#widget_category').html("<%= j render 'widget_categories' %>"); $('#widget_category').html("<%= j render 'widget_categories' %>");
$('#widget_tag').html("<%= j render 'widget_tags' %>"); $('#widget_tag').html("<%= j render 'widget_tags' %>");
$("#widget_options").html("<%= j render 'widget_options'%>");

View File

@ -1,7 +1,7 @@
<% if @menu_page && @menu_page.visible_children.size > 0 %> <% if @menu_page && @menu_page.visible_children.size > 0 %>
<div class='category_list'> <div class='category_list'>
<h3 class='h3'><%= @menu_page.title %></h3> <h3 class='h3'><%= @menu_page.title %></h3>
<ul class='list'>" <ul class='list'>
<% @menu_page.visible_children.each do |child| %> <% @menu_page.visible_children.each do |child| %>
<li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>"> <li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">
<a href="<%= (child.class.to_s.eql?('Page') ? '/' + child.path : child.url) %>"><%= child.title %></a> <a href="<%= (child.class.to_s.eql?('Page') ? '/' + child.path : child.url) %>"><%= child.title %></a>

View File

@ -389,6 +389,7 @@ zh_tw:
paper: Paper was successfully updated. paper: Paper was successfully updated.
user: User was successfully updated. user: User was successfully updated.
success_: S使用者已更新成功 success_: S使用者已更新成功
update_: 更新
update_at: 最後更新時間 update_at: 最後更新時間
url: 網址 url: 網址
use_status: '' use_status: ''

View File

@ -30,6 +30,7 @@ module ParserBackEnd
parse_images_edit(body, page) parse_images_edit(body, page)
parse_footer_edit(body, page) parse_footer_edit(body, page)
parse_sub_menu_edit(body, page) parse_sub_menu_edit(body, page)
parse_counter_edit(body)
public_r_tags.each do |tag| public_r_tags.each do |tag|
send("parse_#{tag}s_edit", body, page, true) send("parse_#{tag}s_edit", body, page, true)
end end

View File

@ -9,7 +9,7 @@ module ParserCommon
res << "'>" res << "'>"
i = nil i = nil
i = 1 if menu.values["li_incremental_#{current}"] i = 1 if menu.values["li_incremental_#{current}"]
children = current == 1 ? page.visible_children.reverse : page.visible_children children = current == 1 ? page.visible_children : page.visible_children
children.each do |child| children.each do |child|
res << menu_li(child, current_page, current, menu, i, edit) res << menu_li(child, current_page, current, menu, i, edit)
i += 1 if i i += 1 if i
@ -210,7 +210,7 @@ module ParserCommon
when 'default_widget' when 'default_widget'
"/panel/orbit_app/widget/#{part.widget_style}?inner=true" "/panel/orbit_app/widget/#{part.widget_style}?inner=true"
else else
"/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&widget_options=#{part.widget_options_uri}"
end end
options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}" options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}"
ret << "<div class='dymanic_load widget' path='#{url + options}'></div>" ret << "<div class='dymanic_load widget' path='#{url + options}'></div>"
@ -233,7 +233,7 @@ module ParserCommon
end end
# page_counter # page_counter
def parse_counter(body = nil, page = nil, edit=nil) def parse_counter_edit(body = nil)
body.css('.page_counter').each do |counter| body.css('.page_counter').each do |counter|
res = '' res = ''
case counter['option'] case counter['option']
@ -248,7 +248,7 @@ module ParserCommon
when 'this_year' when 'this_year'
res << display_visitors_this_year.to_s res << display_visitors_this_year.to_s
end end
fragment = Nokogiri::HTML::DocumentFragment.new(body, res) fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{counter['id']}' class='#{counter['class']}'>#{res}</div>")
counter.swap(fragment) counter.swap(fragment)
end end
end end

View File

@ -11,6 +11,7 @@ module ParserFrontEnd
parse_images(body, page) parse_images(body, page)
parse_menu(body, page) parse_menu(body, page)
parse_sub_menu(body, page, site) parse_sub_menu(body, page, site)
parse_counter(body)
i18n.merge!({locale => body.to_html}) i18n.merge!({locale => body.to_html})
end end
i18n i18n
@ -21,10 +22,14 @@ module ParserFrontEnd
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id] tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
body = Nokogiri::HTML(page.content) body = Nokogiri::HTML(page.content)
body.css('orbit_front').each do |front| body.css('orbit_front').each do |front|
ret = '' if front['value']
part = PagePart.find(front['part_id']) if front['part_id'] fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{front['id']}' class='#{front['class']}'>#{eval(front['value']).to_s}</div>")
ret << eval("\"#{front['path']}\"") rescue '' else
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>") ret = ''
part = PagePart.find(front['part_id']) if front['part_id']
ret << eval("\"#{front['path']}\"") rescue ''
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
end
front.swap(fragment) front.swap(fragment)
end end
body.to_html body.to_html
@ -109,9 +114,8 @@ module ParserFrontEnd
when 'default_widget' when 'default_widget'
"/panel/orbit_app/widget/\#{part.widget_style}?inner=true" "/panel/orbit_app/widget/\#{part.widget_style}?inner=true"
else else
"/panel/\#{part.module_app.key}/widget/\#{part.widget_path}?inner=true" "/panel/\#{part.module_app.key}/widget/\#{part.widget_path}?inner=true&widget_options=\#{part.widget_options_uri}"
end end
options = "&part_id=\#{part.id}&category_id=\#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=\#{!part[:tag].blank? ? part[:tag] : tag}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}" options = "&part_id=\#{part.id}&category_id=\#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=\#{!part[:tag].blank? ? part[:tag] : tag}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}"
ret << "<orbit_front path='#{url + options}' part_id=#{part.id} class='dymanic_load widget'></orbit_front>" ret << "<orbit_front path='#{url + options}' part_id=#{part.id} class='dymanic_load widget'></orbit_front>"
@ -131,6 +135,26 @@ module ParserFrontEnd
end end
end end
def parse_counter(body = nil)
body.css('.page_counter').each do |counter|
ret = ''
case counter['option']
when 'all'
ret << "display_visitors"
when 'today'
ret << "display_visitors_today"
when 'this_week'
ret << "display_visitors_this_week"
when 'this_month'
ret << "display_visitors_this_month"
when 'this_year'
ret << "display_visitors_this_year"
end
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<orbit_front id='#{counter['id']}' class='#{counter['class']}' value='#{ret}'></orbit_front>")
counter.swap(fragment)
end
end
# ad_banners # ad_banners
def generate_ad_banners(*args) def generate_ad_banners(*args)
"<div class='dymanic_load' path='#{front_show_banner_path(args[0])}'></div>" "<div class='dymanic_load' path='#{front_show_banner_path(args[0])}'></div>"

View File

@ -319,4 +319,13 @@ namespace :migrate do
end end
end end
task :add_widget_options_to_gallery => :environment do
a = ModuleApp.where(:key=>'gallery').first
a.widget_options = {"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6]}}
a.widget_options_fields_i18n = {"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal"}}
a.save
end
end end

View File

@ -23,16 +23,16 @@
<td> <td>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %> <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'img' %> <% elsif ff[1] == 'img' %>
<div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div> <div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -67,14 +67,14 @@
<% @item.frontend_field.each do |ff| %> <% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> <%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -109,14 +109,14 @@
<% @item.frontend_field.each do |ff| %> <% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %> <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -153,14 +153,14 @@
<% @item.frontend_field.each do |ff| %> <% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %> <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>
@ -195,14 +195,14 @@
<% @item.frontend_field.each do |ff| %> <% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>"> <span class="<%= ff[1] %>">
<% if ff[1] == 'title' %> <% if ff[1] == 'title' %>
<%= link_to post.send("#{ff[0]}")[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %> <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
<% elsif ff[1] == 'date' %> <% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %> <%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %> <% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% elsif ff[1] == 'text' %> <% elsif ff[1] == 'text' %>
<%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{ff[0]}")[I18n.locale].html_safe %> <%= post.send("#{ff[0]}").html_safe %>
<% elsif ff[1] == 'status' %> <% elsif ff[1] == 'status' %>
<% if post.is_top? %> <% if post.is_top? %>
<span class="top"><%= t(:top) %></span> <span class="top"><%= t(:top) %></span>

View File

@ -17,8 +17,8 @@
</tr> </tr>
</thead> </thead>
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<% @widget_fields.each do |wf| %>
<tr class="<%= cycle('odd', '')%>"> <tr class="<%= cycle('odd', '')%>">
<% @widget_fields.each do |wf| %>
<td> <td>
<span class="<%= wf[1] %>"> <span class="<%= wf[1] %>">
<% if wf[1] == 'title' %> <% if wf[1] == 'title' %>
@ -26,7 +26,7 @@
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'img' %> <% elsif wf[1] == 'img' %>
<div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div> <div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
@ -49,8 +49,8 @@
<% end %> <% end %>
</span> </span>
</td> </td>
</tr>
<% end %> <% end %>
</tr>
<% end %> <% end %>
</table> </table>
@ -67,7 +67,7 @@
<ul class="newslist"> <ul class="newslist">
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<li class="<%= cycle('odd', '')%>"> <li class="<%= cycle('odd', '')%>">
<div class="img app-pic"><%= image_tag(post.image.url) %></div> <div class="img app-pic" style="width:50px; height:50px;"><%= image_tag(post.image.url) %></div>
<% @widget_fields.each do |wf| %> <% @widget_fields.each do |wf| %>
<span class="<%= wf[1] %>"> <span class="<%= wf[1] %>">
@ -76,7 +76,7 @@
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %> <%= post.send("#{wf[0]}").html_safe %>
@ -124,7 +124,7 @@
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %> <%= post.send("#{wf[0]}").html_safe %>
@ -174,7 +174,7 @@
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %> <%= post.send("#{wf[0]}").html_safe %>
@ -222,7 +222,7 @@
<% elsif wf[1] == 'date' %> <% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %> <%= display_date(post.send(wf[0])) %>
<% elsif wf[1] == 'category' %> <% elsif wf[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").i18n_variable[I18n.locale] rescue nil %> <%= post.send("#{post.class.to_s.underscore}_#{wf[0]}").title rescue nil %>
<% elsif wf[1] == 'text' %> <% elsif wf[1] == 'text' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %> <%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %> <%= post.send("#{wf[0]}").html_safe %>

View File

@ -1,4 +1,4 @@
<%= stylesheet_link_tag "default_widget" %>
<script type='text/javascript' src='/assets/jquery.mu.image.resize.js'></script> <script type='text/javascript' src='/assets/jquery.mu.image.resize.js'></script>
<script type='text/javascript' src='/assets/jquery.mu.image.resize.degsin.js'></script> <script type='text/javascript' src='/assets/jquery.mu.image.resize.degsin.js'></script>

View File

@ -1,7 +1,13 @@
class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
def widget1 def widget1
@settings = {"vertical"=>2,"horizontal"=>6} #[note] horizontal has it's limitation from 2 to 6 vertical = 2
horizontal = 6
vertical = @wiget_options[:vertical] if (@wiget_options.has_key?(:vertical) && @wiget_options[:vertical] < vertical)
horizontal = @wiget_options[:horizontal] if (@wiget_options.has_key?(:horizontal) && @wiget_options[:horizontal] < horizontal)
@settings = {"vertical"=>vertical,"horizontal"=>horizontal} #[note] horizontal has it's limitation from 2 to 6
@class = "c" + @settings["horizontal"].to_s @class = "c" + @settings["horizontal"].to_s
@total = @settings["vertical"] * @settings["horizontal"] @total = @settings["vertical"] * @settings["horizontal"]
@rnd = Random.new @rnd = Random.new

View File

@ -3,8 +3,6 @@
<%#= javascript_include_tag "cycle" %> <%#= javascript_include_tag "cycle" %>
<%# end %> <%# end %>
<div class="four columns"> <div class="four columns">
<h4>Gallery Widget</h4>
<p>WIDGET 1</p>
<div class="widget_gallery w1 <%= @class %>"> <div class="widget_gallery w1 <%= @class %>">
<ul> <ul>
<% @images.each do |image| %> <% @images.each do |image| %>

View File

@ -33,3 +33,6 @@ en:
set_cover: Set as Album Cover set_cover: Set as Album Cover
sure?: "Are you sure?" sure?: "Are you sure?"
no_description: Description Unavailable no_description: Description Unavailable
widget_option:
horizontal: Horizontal Pictures
vertical: Vertical Pictures

View File

@ -33,3 +33,6 @@ zh_tw:
set_cover: 設為封面 set_cover: 設為封面
sure?: "你確定嗎?" sure?: "你確定嗎?"
no_description: 沒有描述 no_description: 沒有描述
widget_option:
horizontal: 水平圖片數量
vertical: 垂直圖片數量

View File

@ -0,0 +1,27 @@
<% if @current_category %>
<h1 class="h1"><%= @current_category.title + " " + t(:list_lower) %></h1>
<% elsif @tag %>
<h1 class="h1"><%= @tag[I18n.locale] + " " + t(:list_lower) %></h1>
<% else %>
<h1 class="h1"><%= t('list.link') %></h1>
<% end %>
<table class="table table-bordered">
<tbody>
<tr>
<th><%= t(:category) %></th>
<th><%= t(:name) %></th>
</tr>
<% @web_links.each do |post| %>
<tr>
<td><%= post.web_link_category.title rescue nil %></td>
<td>
<%= link_to post.title, post.url, {:target => '_blank', :title => post.title} %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%#= paginate @web_links, :params => {:inner => 'true'}, :remote => true %>
<%= paginate @web_links, :params => {:inner => 'false'}, :remote => true %>

View File

@ -1,26 +1,3 @@
<% if @current_category %> <div id="web_link_widget">
<h1 class="h1"><%= @current_category.title + " " + t(:list_lower) %></h1> <%= render 'index' %>
<% elsif @tag %> </div>
<h1 class="h1"><%= @tag[I18n.locale] + " " + t(:list_lower) %></h1>
<% else %>
<h1 class="h1"><%= t('list.link') %></h1>
<% end %>
<table class="table table-bordered">
<tbody>
<tr>
<th><%= t(:category) %></th>
<th><%= t(:name) %></th>
</tr>
<% @web_links.each do |post| %>
<tr>
<td><%= post.web_link_category.title rescue nil %></td>
<td>
<%= link_to post.title, post.url, {:target => '_blank', :title => post.title} %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @web_links, :params => {:inner => 'false'} %>

View File

@ -0,0 +1 @@
$('#web_link_widget').html("<%= j render 'index' %>")