Merge branch 'design_team' into ldap
Conflicts: Gemfile app/models/ad_banner.rb
This commit is contained in:
commit
f950f77f36
146 files changed
+14041
-116
No files matched your search
@@ -0,0 +1,36 @@
|
||||
// JavaScript Document
|
||||
|
||||
// can copy code to any of ur desired javascsript
|
||||
|
||||
//extended jquery to search fast.
|
||||
$.extend($.expr[':'], {
|
||||
'containsi': function (elem, i, match, array) {
|
||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||
}
|
||||
});
|
||||
var interval,sval;
|
||||
$(document).ready(function(){
|
||||
$("#user_filter").keyup(function(e){
|
||||
if((e.which>96 && e.which<123) || (e.which>64 && e.which<92) || (e.which == 32) || (e.which == 8)){
|
||||
sval = $(this).val();
|
||||
$(".checkbox").popover("hide");
|
||||
$("div.checkblock").hide();
|
||||
clearInterval(interval);
|
||||
interval = setInterval(waitForSearch,1000);
|
||||
}
|
||||
})
|
||||
})
|
||||
var waitForSearch = function(){
|
||||
if(sval){
|
||||
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length
|
||||
if(totalfoundbyname!=0){
|
||||
$("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show();
|
||||
}else if(totalfoundbyname==0){
|
||||
$("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show();
|
||||
}
|
||||
}else{
|
||||
$(".checkbox").popover('hide');
|
||||
$("div.checkblock").show();
|
||||
}
|
||||
clearInterval(interval);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ class Admin::DashboardsController < ApplicationController
|
||||
def index
|
||||
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'news_bulletin', 'page_context', 'web_link')
|
||||
@recent_updated = get_recently_updated('bulletin', 'news_bulletin', 'page_context', 'web_link')
|
||||
@most_visited = get_most_visited('bulletin', 'news_bulletin', 'page_context')
|
||||
end
|
||||
|
||||
protected
|
||||
@@ -35,5 +36,18 @@ class Admin::DashboardsController < ApplicationController
|
||||
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
||||
sorted_objects[0..9]
|
||||
end
|
||||
|
||||
def get_most_visited(*args)
|
||||
a = {}
|
||||
args.each do |module_app|
|
||||
module_app_class = module_app.classify.constantize
|
||||
objects = module_app_class.order_by(:view_count, :desc).limit(10)
|
||||
objects.each do |object|
|
||||
a.merge!(object => object.view_count) if object.view_count > 0
|
||||
end
|
||||
end
|
||||
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
||||
sorted_objects[0..9]
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,9 +1,7 @@
|
||||
class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||
include OrbitCoreLib::PermissionUnility
|
||||
layout "new_admin"
|
||||
before_filter :force_order
|
||||
|
||||
layout "new_admin"
|
||||
before_filter :force_order
|
||||
|
||||
|
||||
def setting
|
||||
|
||||
@@ -7,6 +7,7 @@ class PagesController < ApplicationController
|
||||
def index
|
||||
@item = Page.find_by_name('home')
|
||||
if @item
|
||||
impressionist(@item)
|
||||
render_page
|
||||
else
|
||||
render :text => 'You need a home page'
|
||||
@@ -14,18 +15,19 @@ class PagesController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
#begin
|
||||
@item = Item.first(:conditions => {:path => params[:page_name]})
|
||||
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
|
||||
case @item._type
|
||||
when 'Page'
|
||||
render_page
|
||||
when 'Link'
|
||||
redirect_to "http://#{@item[:url]}"
|
||||
end
|
||||
else
|
||||
render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
||||
end
|
||||
#begin
|
||||
@item = Item.first(:conditions => {:path => params[:page_name]})
|
||||
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
|
||||
impressionist(@item)
|
||||
case @item._type
|
||||
when 'Page'
|
||||
render_page
|
||||
when 'Link'
|
||||
redirect_to @item[:url]
|
||||
end
|
||||
else
|
||||
render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
||||
end
|
||||
#rescue
|
||||
# render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
||||
#end
|
||||
@@ -55,11 +57,7 @@ class PagesController < ApplicationController
|
||||
|
||||
def get_item
|
||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
# if params[:category_id]
|
||||
# @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]})
|
||||
# else
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
|
||||
# end
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
|
||||
end
|
||||
|
||||
end
|
||||
@@ -3,26 +3,26 @@ module Admin::DashboardHelper
|
||||
def get_link(title)
|
||||
case title
|
||||
when 'bulletin'
|
||||
panel_announcement_back_end_bulletins_path
|
||||
panel_announcement_front_end_bulletins_path
|
||||
when 'news_bulletin'
|
||||
panel_news_back_end_news_bulletins_path
|
||||
panel_news_front_end_news_bulletins_path
|
||||
when'page_context'
|
||||
panel_page_content_back_end_page_contexts_path
|
||||
panel_page_content_front_end_page_contexts_path
|
||||
when'web_link'
|
||||
panel_web_resource_back_end_web_links_path
|
||||
panel_web_resource_front_end_web_links_path
|
||||
end
|
||||
end
|
||||
|
||||
def get_link_to_object(object)
|
||||
case object._type.underscore
|
||||
when 'bulletin'
|
||||
panel_announcement_back_end_bulletin_path(object)
|
||||
panel_announcement_front_end_bulletin_path(object)
|
||||
when 'news_bulletin'
|
||||
panel_news_back_end_news_bulletin_path(object)
|
||||
panel_news_front_end_news_bulletin_path(object)
|
||||
when'page_context'
|
||||
panel_page_content_back_end_page_context_path(object)
|
||||
panel_page_content_front_end_page_context_path(object)
|
||||
when'web_link'
|
||||
panel_web_resource_back_end_web_link_path(object)
|
||||
panel_web_resource_front_end_web_link_path(object)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -96,7 +96,6 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def visible_for_controllers(*controller_names)
|
||||
puts controller_names
|
||||
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? '' : 'hide'
|
||||
end
|
||||
|
||||
@@ -173,4 +172,28 @@ module ApplicationHelper
|
||||
locale.to_sym == I18n.locale ? 'active in': ''
|
||||
end
|
||||
|
||||
def dislpay_view_count(object)
|
||||
"#{t(:view_count)}: #{object.view_count}"
|
||||
end
|
||||
|
||||
def display_visitors(options={})
|
||||
Impression.where(options).distinct(:session_hash).count
|
||||
end
|
||||
|
||||
def display_visitors_today
|
||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_day, '$lte' => Date.today.end_of_day})
|
||||
end
|
||||
|
||||
def display_visitors_this_week
|
||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_week, '$lte' => Date.today.end_of_week})
|
||||
end
|
||||
|
||||
def display_visitors_this_month
|
||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_month, '$lte' => Date.today.end_of_month})
|
||||
end
|
||||
|
||||
def display_visitors_this_year
|
||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
|
||||
end
|
||||
|
||||
end
|
||||
@@ -3,7 +3,6 @@ class AdBanner
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
|
||||
|
||||
field :title
|
||||
field :transition_msec,type: Integer
|
||||
|
||||
+11
-1
@@ -2,10 +2,20 @@ class Link < Item
|
||||
|
||||
field :url
|
||||
|
||||
validates_presence_of :url
|
||||
validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
|
||||
|
||||
before_validation :add_http
|
||||
|
||||
def link
|
||||
ApplicationController.helpers.link_to(self.name, self.url)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def add_http
|
||||
unless self.url[/^http?s:\/\//]
|
||||
self.url = 'http://' + self.url
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,10 +1,14 @@
|
||||
class Page < Item
|
||||
include Impressionist::Impressionable
|
||||
|
||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
|
||||
field :content
|
||||
field :app_frontend_url
|
||||
field :theme_id, :type => BSON::ObjectId, :default => nil
|
||||
field :category
|
||||
field :tag
|
||||
field :view_count, :type => Integer, :default => 0
|
||||
|
||||
belongs_to :design
|
||||
belongs_to :module_app
|
||||
|
||||
@@ -380,49 +380,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item element">
|
||||
<h3><i class="icons-"></i><a href=""><%= t(:traffic) %></a></h3>
|
||||
<div class="detail w-a h-a">
|
||||
<p class="totle"><span><%= t(:total_visitors) %></span>438,913</p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t(:item) %></th>
|
||||
<th class="span2"><%= t(:data) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="detal-list my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Visitors Today</td>
|
||||
<td>2,304</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Visitors This Month</td>
|
||||
<td>783</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Visitor This Tear</td>
|
||||
<td>45</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item element">
|
||||
<h3><i class="icons-"></i><a href=""><%= t(:site_info) %></a></h3>
|
||||
<div class="detail noStatistics w-b h-a">
|
||||
@@ -481,6 +439,56 @@
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<div class="item element">
|
||||
<h3><i class="icons-"></i><%= t(:traffic) %></h3>
|
||||
<div class="detail w-a h-a">
|
||||
<p class="totle"><span><%= t(:total_visitors) %></span><%= display_visitors %></p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t(:item) %></th>
|
||||
<th class="span2"><%= t(:data) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="detal-list my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= t(:visitors_today) %></td>
|
||||
<td><%= display_visitors_today %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t(:visitors_this_week) %></td>
|
||||
<td><%= display_visitors_this_week %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t(:visitors_this_month) %></td>
|
||||
<td><%= display_visitors_this_month %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t(:visitors_this_year) %></td>
|
||||
<td><%= display_visitors_this_year %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item element">
|
||||
<h3><i class="icons-"></i><%= t(:recent_update) %></h3>
|
||||
<div class="detail noStatistics w-b h-a">
|
||||
@@ -517,4 +525,43 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item element">
|
||||
<h3><i class="icons-"></i><%= t(:most_visited_page) %></h3>
|
||||
<div class="detail noStatistics w-b h-a">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t(:title) %></th>
|
||||
<th class="span2"><%= t(:module) %></th>
|
||||
<th class="span2"><%= t(:hits) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="detal-list my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<% @most_visited.each do |object| %>
|
||||
<tr>
|
||||
<td><%= link_to ((object[0].title[I18n.locale] rescue nil) || (object[0].page.i18n_variable[I18n.locale] rescue nil)), get_link_to_object(object[0]) %></td>
|
||||
<td class="span2"><%= link_to t("dashboard.#{object[0]._type.underscore}"), get_link(object[0]._type.underscore) %></td>
|
||||
<td class="span2"><%= object[1] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user