Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
Harry Bomrah | 8b8357af87 | |
Harry Bomrah | 8d9892f73d | |
spen | adfa7cab83 | |
spen | 0c03ba8439 | |
spen | cc82387efb | |
manson | 51d8577774 | |
manson | 8aa5a4f7d6 | |
manson | 93337c1019 | |
manson | 13f63d4c2a | |
manson | 8d0c326bbc | |
manson | fe2c1a9235 |
2
Gemfile
2
Gemfile
|
@ -109,7 +109,7 @@ group :test, :development do
|
|||
gem "spork"
|
||||
gem "capybara"
|
||||
#gem 'rack-mini-profiler'
|
||||
gem "better_errors"
|
||||
gem "better_errors", "1.1.0"
|
||||
# gem 'yard'
|
||||
# gem "bluecloth"
|
||||
end
|
||||
|
|
|
@ -19,8 +19,8 @@ $(function () {
|
|||
'use strict';
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload({
|
||||
maxFileSize: 5000000,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf|doc|docx|ppt|pptx|xls|xlsx)$/i,
|
||||
maxFileSize: 50000000000,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf|doc|docx|ppt|pptx|xls|xlsx|csv|txt|zip|rar|tar|gz|odt|tiff|key|page)$/i,
|
||||
dropZone: $('#dropzone'),
|
||||
headers:{
|
||||
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
|
||||
|
|
|
@ -28,6 +28,8 @@ CKEDITOR.editorConfig = function( config ) {
|
|||
{ name: 'about' }
|
||||
];
|
||||
|
||||
config.allowedContent = true;
|
||||
|
||||
config.skin = 'moono';
|
||||
|
||||
config.filebrowserBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path(:module_app_id=>ModuleApp.where(:key=>'asset').first.id) %>";
|
||||
|
@ -35,6 +37,10 @@ CKEDITOR.editorConfig = function( config ) {
|
|||
|
||||
//Font Config
|
||||
config.font_names = 'Arial;Comic Sans MS;Courier New;Georgia;Helvetica;Lucida Sans Unicode;Tahoma;Times New Roman;Trebuchet MS;Verdana;微軟正黑體';
|
||||
|
||||
config.enterMode = CKEDITOR.ENTER_BR;
|
||||
config.shiftEnterMode = CKEDITOR.ENTER_BR;
|
||||
config.pasteFromWordPromptCleanup = true;
|
||||
};
|
||||
|
||||
CKEDITOR.on('instanceReady',function(){
|
||||
|
|
|
@ -32,7 +32,6 @@ function preview() {
|
|||
var resize = 500/bannerW
|
||||
bannerW = Math.floor(bannerW*resize);
|
||||
bannerH = Math.floor(bannerH*resize);
|
||||
console.log(bannerW)
|
||||
};
|
||||
if(bannerH > 300) {
|
||||
var resize = 300/bannerH
|
||||
|
|
|
@ -7,7 +7,12 @@ $(function() {
|
|||
for ( instance in CKEDITOR.instances )
|
||||
CKEDITOR.instances[instance].updateElement();
|
||||
|
||||
var formData = new FormData( $('form.previewable')[0] );
|
||||
var formData;
|
||||
if(typeof(FormData) == "function"){
|
||||
formData = new FormData( $('form.previewable')[0] );
|
||||
}else{
|
||||
formData = $('form.previewable').serialize()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
|
|
|
@ -4,7 +4,7 @@ class Admin::AdBannersController < OrbitBackendController
|
|||
open_for_sub_manager
|
||||
|
||||
def index
|
||||
@ad_banners = AdBanner.all.page(params[:page]).per(10)
|
||||
@ad_banners = get_sorted_and_filtered("ad_banner")
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -11,7 +11,7 @@ class Admin::AdImagesController < Admin::AdBannersController
|
|||
end
|
||||
|
||||
def index
|
||||
@ad_images = AdImage.all.page(params[:page]).per(10)
|
||||
@ad_images = get_sorted_and_filtered("ad_image")
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
@ -11,7 +11,7 @@ class Admin::DashboardsController < OrbitBackendController
|
|||
check_backend_openness
|
||||
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
|
||||
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
|
||||
@most_visited = get_most_visited('bulletin', 'page_context','page')
|
||||
@most_visited = get_most_visited('bulletin', 'page_context')
|
||||
end
|
||||
|
||||
def reload_all_content
|
||||
|
@ -22,7 +22,7 @@ class Admin::DashboardsController < OrbitBackendController
|
|||
end
|
||||
|
||||
def reload_most_visited
|
||||
@most_visited = get_most_visited('bulletin', 'page_context','page')
|
||||
@most_visited = get_most_visited('bulletin', 'page_context')
|
||||
respond_to do |format|
|
||||
format.js { render 'reload', locals: {div_id: 'most_visited'} }
|
||||
end
|
||||
|
|
|
@ -321,6 +321,8 @@ class ApplicationController < ActionController::Base
|
|||
sorted_objects.flatten!
|
||||
sorted_objects.uniq!
|
||||
objects = get_with_nil(objects, option, sorted_objects)
|
||||
elsif option.eql?('size')
|
||||
objects = objects.order_by([ [:width, params[:direction]], [:height, params[:direction]] ])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -361,7 +363,12 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
if pagination
|
||||
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
|
||||
filtered_objects = filter_authorized_objects(objects)
|
||||
if filtered_objects.is_a?(Array)
|
||||
Kaminari.paginate_array(filtered_objects).page(params[:page]).per(10)
|
||||
else
|
||||
filter_authorized_objects(objects).page(params[:page]).per(10)
|
||||
end
|
||||
else
|
||||
filter_authorized_objects(objects)
|
||||
end
|
||||
|
|
|
@ -248,15 +248,24 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def get_month_traffic
|
||||
result = []
|
||||
(0..30).each do |i|
|
||||
site = Site.first
|
||||
if site.month_traffic_cache.blank? or (site.month_traffic_cache['updated_at'] < (Time.now-1.day) rescue true)
|
||||
site.month_traffic_cache = {}
|
||||
|
||||
site.month_traffic_cache['result'] = []
|
||||
(1..30).each do |i|
|
||||
visits = Impression.where( created_at: {
|
||||
'$gte' => Time.now.beginning_of_day-i.days,
|
||||
'$lte' => Time.now.end_of_day-i.days}
|
||||
).count
|
||||
result.push([ Time.now.beginning_of_day-i.days, visits])
|
||||
site.month_traffic_cache['result'].push([ Time.now.beginning_of_day-i.days, visits])
|
||||
end
|
||||
[:name=> t(:visitors_count),:data=>result]
|
||||
|
||||
site.month_traffic_cache['updated_at'] = Time.now
|
||||
site.save
|
||||
end
|
||||
|
||||
[:name=> t(:visitors_count),:data=>site.month_traffic_cache['result']]
|
||||
end
|
||||
|
||||
# def get_today_traffic
|
||||
|
|
|
@ -63,7 +63,6 @@ class MailCronMailer < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
@mail_cron_log = {
|
||||
:mail_subject => @data.mail_subject,
|
||||
:mail_to => group_mail,
|
||||
|
@ -74,10 +73,16 @@ class MailCronMailer < ActionMailer::Base
|
|||
|
||||
@mail_cron_log = MailCronLog.new(@mail_cron_log)
|
||||
|
||||
|
||||
@mail_cron_log.save
|
||||
|
||||
@mail_to_count = @data.mail_to.split(',') - group_mail.split(',')
|
||||
|
||||
if @mail_to_count.count == 0
|
||||
@data.destroy
|
||||
else
|
||||
@data.mail_to = @mail_to_count.join(',')
|
||||
@data.save
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class MailCron
|
|||
|
||||
if !email_user_id.blank?
|
||||
|
||||
@user = User.find(email_user_id)
|
||||
@user = User.find(email_user_id) rescue nil
|
||||
|
||||
@group_mail << @user.email if !@user.blank?
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ class Site
|
|||
field :store_confirmation, :type => Boolean, :default => false
|
||||
field :meta_viewport, :type => Boolean, :default => false
|
||||
|
||||
field :month_traffic_cache
|
||||
|
||||
belongs_to :design
|
||||
has_many :site_metas, :autosave => true, :dependent => :destroy
|
||||
validate :in_use_locales, :minimum_enabled_locales
|
||||
|
|
|
@ -56,6 +56,7 @@ module Orbit
|
|||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
# config.i18n.default_locale = :de
|
||||
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'modules', '*.{rb,yml}').to_s]
|
||||
config.i18n.enforce_available_locales = false
|
||||
config.i18n.default_locale = :zh_tw
|
||||
|
||||
# JavaScript files you want as :defaults (application.js is always included).
|
||||
|
|
Loading…
Reference in New Issue