member plugin init edit

This commit is contained in:
chris committed 2013-02-21 17:53:08 +08:00
commit 680d7908b9
234 files changed
+2085 -3308

No files matched your search

@@ -35,7 +35,7 @@ div[data-role="page"] {
}
.main-menu ul {
background-color: #333;
width: 280px;
width: 210px;
list-style: none;
margin: 0 auto;
padding: 0;
@@ -128,8 +128,8 @@ div[data-role="page"] {
left: 0;
}
.header .language .ui-btn-text i {
font-size: .83em;
margin-top: .2em;
font-size: 1.1em;
margin-top: .33em;
}
.header .language .ui-icon {
background-image: none;
@@ -213,6 +213,9 @@ div[data-role="page"] {
padding: 0 10px 20px;
margin-bottom: 0;
}
#announcement_content .content {
padding: 10px;
}
#map div[data-role="content"] {
padding: 0;
}
@@ -323,7 +326,7 @@ div[id^="dialog"] .content {
}
@media(min-width:600px) {
.main-menu ul {
width: 560px;
width: 420px;
}
.main-menu ul li {
width: 128px;
@@ -331,7 +334,7 @@ div[id^="dialog"] .content {
}
@media(min-width:768px) {
.main-menu ul {
width: 640px;
width: 480px;
}
.main-menu ul li {
width: 148px;
@@ -342,7 +345,7 @@ div[id^="dialog"] .content {
}
@media(min-width:800px) {
.main-menu ul {
width: 640px;
width: 480px;
}
.main-menu ul li {
width: 148px;
@@ -350,7 +353,7 @@ div[id^="dialog"] .content {
}
@media(min-width:961px) {
.main-menu ul {
width: 640px;
width: 480px;
}
.main-menu ul li {
width: 148px;
@@ -358,7 +361,7 @@ div[id^="dialog"] .content {
}
@media(min-width: 1024px) {
.main-menu ul {
width: 800px;
width: 600px;
}
.main-menu ul li {
width: 188px;
+1 -1
View File
@@ -88,7 +88,7 @@ class Admin::AssetsController < OrbitBackendController
def delete
if params[:ids]
asset = Asset.any_in(:_id => params[:ids]).delete_all
asset = Asset.any_in(:_id => params[:ids]).destroy_all
end
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
+1 -1
View File
@@ -114,7 +114,7 @@ class Admin::DesignsController < OrbitBackendController
def delete
if params[:ids]
designs = Design.any_in(:_id => params[:ids]).delete_all
designs = Design.any_in(:_id => params[:ids]).destroy_all
end
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
+5 -6
View File
@@ -36,12 +36,11 @@ helper Admin::PagePartsHelper
if @item.module_app
@module_app = @item.module_app
@frontend_path = @item.app_frontend_url ? @item.app_frontend_url : @module_app.widgets.keys[0]
@frontend_path = @item.app_frontend_url
if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
end
if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
end
case @item.module_app.key
when 'announcement'
@@ -59,7 +58,7 @@ helper Admin::PagePartsHelper
end
else
@categories = nil
@module_app = @module_apps[0]
@module_app = @module_apps[0]
end
end
@@ -1,4 +1,4 @@
class Admin::SubRolesController < RolesController
class Admin::SubRolesController < Admin::RolesController
end
+33 -24
View File
@@ -11,31 +11,40 @@ class DefaultWidgetController< OrbitWidgetController
end
def default_widget
@tag_class = nil
if !params[:id].blank?
redirect_to eval("#{@page_part.module_app.widget_fields_link_method['title']['method']}('#{params[:id]}', {inner: #{params[:inner] || true}})")
else
@tag_class = nil
@default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget["image"] || @default_widget[:image]
data_limit = case @page_part
when Page
@fields = @page_part.frontend_field
@page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
when PagePart
@fields = @page_part.widget_field
@page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
@default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget["image"] || @default_widget[:image]
case @page_part
when Page
@fields = @page_part.frontend_field
@data_limit = @page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
@paginate = true
@page_id = @page_part.id
when PagePart
@fields = @page_part.widget_field
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
end
if @paginate
@data = eval(@default_widget["query"]).includes(@widget_image_field).page(params[:page_main]).per(@data_limit).desc(:created_at)
else
@data = eval(@default_widget["query"]).limit(@data_limit).includes(@widget_image_field).desc(:created_at)
end
case params[:type]
when "typeA"
@tag_class = 'default_widget_typeA'
@partial = "typeA"
when /typeB_/
@tag_class = "default_widget_#{params[:type]}"
@partial = "typeB"
when "typeC"
@tag_class = 'default_widget_typeC'
@partial = "typeC"
end
end
@data = eval(@default_widget["query"]).limit(data_limit).includes(@widget_image_field).desc(:created_at)
case params[:type]
when "typeA"
@tag_class = 'default_widget_typeA'
render "typeA"
when /typeB_/
@tag_class = "default_widget_#{params[:type]}"
render "typeB"
when "typeC"
@tag_class = 'default_widget_typeC'
render "typeC"
end
end
end
+5
View File
@@ -2,6 +2,11 @@ class FrontController < ApplicationController
layout false
def show_breadcrumb
@ancestors = Page.find(params[:id]).ancestors_and_self
@ancestors = nil if @ancestors.size == 1
end
def show_banner
@ad_banner = AdBanner.find(params[:id]) rescue nil
end
+16 -10
View File
@@ -64,17 +64,23 @@ class PagesController < ApplicationController
protected
def get_item
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
if !params[:category_id].blank? && !params[:tag_id].blank?
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]})
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item
elsif !params[:category_id].blank?
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action],category: params[:category_id]).any_in(tag: [nil,'']).first
elsif !params[:tag_id].blank?
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action],tag: params[:tag_id]).any_in(category: [nil,'']).first
if params[:same_page_id]
@item = Item.find(params[:same_page_id])
else
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
if !params[:category_id].blank? && !params[:tag_id].blank?
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]})
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item
elsif !params[:category_id].blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], category: params[:category_id]).any_in(tag: [nil,'']).first
elsif !params[:tag_id].blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], tag: params[:tag_id]).any_in(category: [nil,'']).first
end
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first unless @item
@item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
end
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action]).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first unless @item
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action]).first unless @item
raise PageError,'Missing Frontend Page' if @item.nil?
end
+15 -11
View File
@@ -3,24 +3,24 @@ module DefaultWidgetHelper
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
end
def link_to_field(row_data,field,switch)
def link_to_field(row_data,field, switch, options=nil)
method_ary = @page_part.module_app.widget_fields_link_method
field = field.to_sym
if(method_ary.has_key?(field) and (switch == "true"))
url = case method_ary[field][:args]
when nil # no args
get_data_link(method_ary[field][:method])
get_data_link(method_ary[field]["method"], options)
when :self # passing self
get_data_link(method_ary[field][:method],row_data.id)
get_data_link(method_ary[field]['method'], options,row_data.id)
else
ary = method_ary[field][:args].clone
object_hash = ary.each do |key,val|
ary[key]= type_trans_or_to_s(row_data.send(val[0]).send(val[1]))
end
get_data_link(method_ary[field][:method],object_hash)
get_data_link(method_ary[field]['method'], options,object_hash)
end
link_to row_data.send(field),url
link_to row_data.send(field), url
else
type_trans_or_to_s(row_data.send(field) )
end
@@ -45,13 +45,17 @@ module DefaultWidgetHelper
end
end
def get_data_link(method_entry,object = nil)
def get_data_link(method_entry, options=nil, object = nil)
case object
when nil
eval method_entry
when NilClass
eval eval("#{method_entry}(#{options})")
when BSON::ObjectId
object = "'#{object.to_s}'"
eval("#{method_entry}(#{object}, #{options})")
when Hash
eval("#{method_entry}(#{object.merge options})")
else
object = "'#{object.to_s}'" if object.class == BSON::ObjectId
eval("#{method_entry}(#{object})" )
''
end
end
+1 -1
View File
@@ -23,7 +23,7 @@ class AdImage
belongs_to :ad_banner
before_validation :add_http
validates :out_link, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :allow_blank => true
validates :out_link, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :allow_blank => true
def display?
if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false)
+3 -3
View File
@@ -12,7 +12,7 @@ class Item
field :enabled_for, :type => Array, :default => nil
field :menu_enabled_for, :type => Array, :default => nil
field :title, localize: true
field :sitemap_enabled, :type => Hash
field :sitemap_enabled, :type => Hash, :default => {}
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
@@ -23,6 +23,7 @@ class Item
before_destroy :destroy_children
after_rearrange :rebuild_path, :if => "parent_id_changed? || name_changed?"
after_save :rebuild_children_path, :if => "path_changed?"
def enabled_for_lang(lang)
enabled_for.include?(lang)
@@ -57,7 +58,7 @@ class Item
end
def show_in_sitemap_for(locale)
if sitemap_enabled && !sitemap_enabled[locale].blank?
if !sitemap_enabled.blank? && !sitemap_enabled[locale].blank?
sitemap_enabled[locale].eql?('true') ? true : false
else
true
@@ -68,7 +69,6 @@ class Item
def rebuild_path
self.path = (self.ancestors_and_self - [Item.root]).collect{|x| x.name unless x.root?}.join('/')
self.rebuild_children_path
end
def rebuild_children_path
+1 -1
View File
@@ -2,7 +2,7 @@ class Link < Item
field :url
validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
validates :url, :presence => true, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i
before_validation :add_http
+5
View File
@@ -27,6 +27,11 @@ class Page < Item
before_save :create_parts, if: Proc.new { |page| page.new_record? || page.design_id_changed? }
before_save :delete_empty_frontend_field, :generate_html
def generate_parts
create_parts
self.save
end
protected
def create_parts
@@ -7,7 +7,8 @@
<%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
<% elsif @r_tag.eql?('sitemap') %>
<% elsif @r_tag.eql?('breadcrumb') %>
<% else %>
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %>
<% end %>
</span>
</span>
@@ -1,23 +0,0 @@
<div class="site-map">
<% @items.each_with_index do |item, i| %>
<div class="map-block">
<h4><%= i+1 %> <a href='<%= item.path %>'><%= item.title %></a></h4>
<ul>
<% item.children.each_with_index do |child, ii| %>
<li class="clear"><%= "#{i+1}-#{ii+1}" %> <a href='<%= child.path %>'><%= child.title %></a></span></li>
<% end if item.children %>
</ul>
</div>
<% end %>
</div>
<%= javascript_include_tag "lib/jquery.masonry.min.js" %>
<script>
$(document).ready(function(){
$('.site-map').masonry({
itemSelector: '.map-block',
columnWidth: 220,
isAnimated: true
});
});
</script>
@@ -11,7 +11,7 @@
<% @data.each do |row_data| %>
<tr>
<% @fields.each do |field|%>
<td><%= content_tag(:span,link_to_field(row_data,field[0],field[2]),:class=>field[1])%></td>
<td><%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%></td>
<% end %>
</tr>
<% end %>
@@ -7,7 +7,7 @@
</div>
<div class="wrap">
<% @fields.each do |field|%>
<%= content_tag(:span,link_to_field(row_data,field[0]),:class=>field[1])%>
<%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%>
<% end %>
</div>
<% end %>
@@ -6,7 +6,7 @@
<% @data.each do |row_data| %>
<%= content_tag(:li) do %>
<% @fields.each do |field|%>
<%= content_tag(:span,link_to_field(row_data,field[0]),:class=>field[1])%>
<%= content_tag(:span, link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%>
<% end %>
<% end %>
<% end %>
@@ -0,0 +1,4 @@
<%= render @partial %>
<% if @paginate %>
<%= paginate @data, :param_name => :page_main, :params => {:same_page_id => @page_id} %>
<% end %>
+1 -1
View File
@@ -13,7 +13,7 @@
<li class="dock_item"><a callback-method='initializeJournalPapers' href="<%= panel_personal_journal_desktop_journal_p_path %>" class="widget_fn wh3 hh3" id='d_journal_p' custom-load="journal" onclick="return false;"><span class="widget_icon"><img src="" alt="Journal Papers" id="journal_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeConference' href="<%= panel_personal_conference_desktop_conference_p_path %>" class="widget_fn wh3 hh3" id='d_conference_p' custom-load="conference" onclick="return false;"><span class="widget_icon"><img src="" alt="Conference Papers" id="conference_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeConference' href="<%= panel_personal_conference_desktop_conference_window_path %>" class="widget_fn wh3 hh3" id='d_conference_p' custom-load="conference" onclick="return false;"><span class="widget_icon"><img src="" alt="Conference Papers" id="conference_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeBooks' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_books' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li>
+15
View File
@@ -0,0 +1,15 @@
<% unless @ancestors.blank? %>
<ul class="breadcrumb">
<% @ancestors.each_with_index do |node, i| %>
<% last = i == @ancestors.size-1 %>
<li class='<%= 'active' if last %>'>
<% if last %>
<%= node.title %>
<% else %>
<%= link_to node.title, "/#{node.path}" %>
<span class="divider">/</span>
<% end %>
</li>
<% end %>
</ul>
<% end %>
+1 -1
View File
@@ -1,6 +1,6 @@
<% if @menu_page && @menu_page.visible_children.size > 0 %>
<div class='category_list'>
<h3 class='h3'><%= @menu_page.title %></h3>
<!-- <h3 class='h3'><%#= @menu_page.title %></h3> -->
<ul class='list'>
<% @menu_page.visible_children.each do |child| %>
<li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">