Merge branch 'ntu' of github.com:Rulingcom/orbit into ntu

This commit is contained in:
Fu Matthew 2012-12-28 15:31:32 +08:00
commit 5587e83419
17 changed files with 317 additions and 50 deletions

View File

@ -14,7 +14,6 @@ function load_tinymce() {
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
relative_urls : false,
// Skin options
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

@ -39,7 +39,7 @@ class FrontController < ApplicationController
res << "'>"
i = nil
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|
res << menu_li(child, current_page, current, menu, i)
i += 1 if i

View File

@ -56,7 +56,7 @@ class Item
end
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
else
true

View File

@ -1,4 +1,45 @@
class Tag < ProtoTag
belongs_to :module_app
# class Tag < ProtoTag
# 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

View File

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

View File

@ -1,7 +1,7 @@
<% if @menu_page && @menu_page.visible_children.size > 0 %>
<div class='category_list'>
<h3 class='h3'><%= @menu_page.title %></h3>
<ul class='list'>"
<ul class='list'>
<% @menu_page.visible_children.each do |child| %>
<li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">
<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.
user: User was successfully updated.
success_: S使用者已更新成功
update_: 更新
update_at: 最後更新時間
url: 網址
use_status: ''

View File

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

View File

@ -9,7 +9,7 @@ module ParserCommon
res << "'>"
i = nil
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|
res << menu_li(child, current_page, current, menu, i, edit)
i += 1 if i
@ -233,7 +233,7 @@ module ParserCommon
end
# page_counter
def parse_counter(body = nil, page = nil, edit=nil)
def parse_counter_edit(body = nil)
body.css('.page_counter').each do |counter|
res = ''
case counter['option']

View File

@ -11,6 +11,7 @@ module ParserFrontEnd
parse_images(body, page)
parse_menu(body, page)
parse_sub_menu(body, page, site)
parse_counter(body)
i18n.merge!({locale => body.to_html})
end
i18n
@ -21,10 +22,14 @@ module ParserFrontEnd
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
body = Nokogiri::HTML(page.content)
body.css('orbit_front').each do |front|
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>")
if front['value']
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{front['id']}' class='#{front['class']}'>#{eval(front['value']).to_s}</div>")
else
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)
end
body.to_html
@ -130,6 +135,26 @@ module ParserFrontEnd
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
def generate_ad_banners(*args)
"<div class='dymanic_load' path='#{front_show_banner_path(args[0])}'></div>"

View File

@ -17,8 +17,8 @@
</tr>
</thead>
<% @bulletins.each do |post| %>
<% @widget_fields.each do |wf| %>
<tr class="<%= cycle('odd', '')%>">
<% @widget_fields.each do |wf| %>
<td>
<span class="<%= wf[1] %>">
<% if wf[1] == 'title' %>
@ -26,7 +26,7 @@
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% 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' %>
<div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div>
<% elsif wf[1] == 'text' %>
@ -49,8 +49,8 @@
<% end %>
</span>
</td>
</tr>
<% end %>
</tr>
<% end %>
</table>
@ -67,7 +67,7 @@
<ul class="newslist">
<% @bulletins.each do |post| %>
<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| %>
<span class="<%= wf[1] %>">
@ -76,7 +76,7 @@
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% 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' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %>
@ -124,7 +124,7 @@
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% 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' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %>
@ -174,7 +174,7 @@
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% 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' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").html_safe %>
<%= post.send("#{wf[0]}").html_safe %>
@ -222,7 +222,7 @@
<% elsif wf[1] == 'date' %>
<%= display_date(post.send(wf[0])) %>
<% 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' %>
<%#= post.send("#{wf[0]}[#{I18n.locale}]").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.degsin.js'></script>

View File

@ -6,11 +6,11 @@
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('archive_file_category.edit'), edit_panel_archive_back_end_archive_file_category_path(archive_file_category), :remote => true %></li>
<li><%= link_to t('archive_file_category.delete'), panel_archive_back_end_archive_file_category_path(archive_file_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<li><%= link_to t('archive_file_category.delete'), panel_archive_back_end_archive_file_category_path(archive_file_category), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td><%= archive_file_category.title_translations[locale] rescue nil %></td>
<% end %>
</tr>
</tr>

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 %>
<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 => 'false'} %>
<div id="web_link_widget">
<%= render 'index' %>
</div>

View File

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