Compare commits
20 Commits
manson_cke
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
8b8357af87 | |
|
|
8d9892f73d | |
|
|
adfa7cab83 | |
|
|
0c03ba8439 | |
|
|
cc82387efb | |
|
|
51d8577774 | |
|
|
8aa5a4f7d6 | |
|
|
93337c1019 | |
|
|
13f63d4c2a | |
|
|
8d0c326bbc | |
|
|
fe2c1a9235 | |
|
|
e0b22e11bb | |
|
|
131f81ac9d | |
|
|
bb306364aa | |
|
|
f7f81c1bea | |
|
|
a3afad36a6 | |
|
|
479a47c584 | |
|
|
0382795467 | |
|
|
f9013218db | |
|
|
504f47ce2b |
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(){
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ $(document).ready(function() {
|
|||
function ajax_load_proc(wapper,url,isBanner){
|
||||
$.get(encodeURI(url), {}, function(respText,textSta,XML){
|
||||
if (textSta == 'success') {
|
||||
if (respText.indexOf("<title>") == -1) wapper.html(respText);
|
||||
if (respText.indexOf('<meta charset="utf-8">') == -1) wapper.html(respText);
|
||||
};
|
||||
if(textSta == 'error')
|
||||
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2,19 +2,29 @@ $(function() {
|
|||
$(".post_preview").click(function(){
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
|
||||
var preview_url = $(this).attr('url');
|
||||
var preview_url = $(this).attr('url');
|
||||
|
||||
$("form.previewable").ajaxSubmit({
|
||||
beforeSubmit: function(a,f,o){
|
||||
o.dataType = 'script';
|
||||
o.url = preview_url;
|
||||
o.type = 'post';
|
||||
},success: function(msg) {
|
||||
for ( instance in CKEDITOR.instances )
|
||||
CKEDITOR.instances[instance].updateElement();
|
||||
|
||||
var formData;
|
||||
if(typeof(FormData) == "function"){
|
||||
formData = new FormData( $('form.previewable')[0] );
|
||||
}else{
|
||||
formData = $('form.previewable').serialize()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: preview_url,
|
||||
data : formData,
|
||||
processData: false,
|
||||
contentType: false
|
||||
}).done(function(data){
|
||||
$('#show_preview').html(data);
|
||||
$('#show_preview .modal').modal()
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
}});
|
||||
$('#show_preview .modal').height(($(window).height() * 0.7));
|
||||
});
|
||||
});
|
||||
$(".preview_trigger").click(function(){
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -46,8 +46,7 @@ class Admin::DashboardsController < OrbitBackendController
|
|||
end
|
||||
|
||||
def get_disk_usage
|
||||
@usw = Usagewatch
|
||||
render :json => @usw.uw_diskused_perc.to_s
|
||||
render :json => `df -m /home`.scan(/\d+%/).first.gsub('%','') rescue '0'
|
||||
end
|
||||
|
||||
def get_month_traffic
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
def doorkeeper
|
||||
oauth_data = request.env["omniauth.auth"]
|
||||
@user = User.find_or_create_for_doorkeeper_oauth(oauth_data)
|
||||
@user.update_doorkeeper_credentials(oauth_data)
|
||||
@user.save
|
||||
|
||||
sign_in_and_redirect @user
|
||||
end
|
||||
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
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ class PagesController < ApplicationController
|
|||
|
||||
@item = Item.root.children.where(:module_app_id => module_app.id).first unless @item
|
||||
@item = Item.where(:module_app_id => module_app.id).first unless @item
|
||||
@item = Item.where(:module_app_id => module_app.id, :app_frontend_url=>"search_result").first if !params['search_query'].blank?
|
||||
end
|
||||
raise PageError,'Missing Frontend Page' if @item.nil?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -190,8 +190,10 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def page_stylesheets(page, edit=nil)
|
||||
orbit_bar_bootstrap = asset_path 'orbit_bar_bootstrap'
|
||||
orbit_bar_bootstrap = orbit_bar_bootstrap.include?('css') ? orbit_bar_bootstrap : orbit_bar_bootstrap+'.css'
|
||||
stylesheets = ''
|
||||
stylesheets << "<link href='#{asset_path 'orbit_bar_bootstrap'}' rel='stylesheet' type='text/css' />\n"
|
||||
stylesheets << "<link href='#{orbit_bar_bootstrap}' rel='stylesheet' type='text/css' />\n"
|
||||
stylesheets << "<link href='#{page.design.css_reset.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_reset
|
||||
# stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
|
||||
# stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
|
||||
|
|
@ -246,15 +248,24 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def get_month_traffic
|
||||
result = []
|
||||
(0..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 = 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
|
||||
site.month_traffic_cache['result'].push([ Time.now.beginning_of_day-i.days, visits])
|
||||
end
|
||||
|
||||
site.month_traffic_cache['updated_at'] = Time.now
|
||||
site.save
|
||||
end
|
||||
[:name=> t(:visitors_count),:data=>result]
|
||||
|
||||
[: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
|
||||
|
||||
@data.destroy
|
||||
@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?
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ class Site
|
|||
field :site_token
|
||||
field :mobile_on, :type => Boolean, :default => false
|
||||
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
|
||||
|
|
|
|||
|
|
@ -315,6 +315,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<input name="authenticity_token" type="hidden" value="<%= form_authenticity_token %>"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
<link rel="shortcut icon" href="<%= asset_path 'favicon.ico' %>">
|
||||
<% end %>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<% if @site.meta_viewport %>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<% end %>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
|
@ -1,9 +1 @@
|
|||
<% if !request.xhr? %>
|
||||
<textarea>
|
||||
<% end %>
|
||||
$('#show_preview').html('<%=escape_javascript(render :partial=>"/shared/preview/modal_preview") %>');
|
||||
<!-- var start_modal_with_id = "<%= @preview_obj.id %>"; -->
|
||||
<!-- $("#"+start_modal_with_id).modal(); -->
|
||||
<% if !request.xhr? %>
|
||||
</textarea>
|
||||
<% end %>
|
||||
<%= render :partial=>"/shared/preview/modal_preview" %>
|
||||
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
update_tag_cloud:
|
||||
cron: 0 0 [0,12] * * *
|
||||
cron: 0 0 0,12 * * *
|
||||
class: UpdateTagCloud
|
||||
args:
|
||||
description: UpdateTagCloud
|
||||
|
|
@ -11,7 +11,7 @@ generate_system_summary:
|
|||
description: Generate the system status such as disk free space,package version list for showing at site tab
|
||||
|
||||
email_cron:
|
||||
cron: 0 0 [10,14,17,20] * * *
|
||||
cron: 0 0 10,14,17,20 * * *
|
||||
class: EmailCron
|
||||
args:
|
||||
description: EmailCron
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
rails_env = ENV['RAILS_ENV'] || "production"
|
||||
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/..'
|
||||
user_home = ENV['HOME'] || File.dirname(__FILE__) + '/../..'
|
||||
development_uid = ''
|
||||
development_gid = ''
|
||||
|
||||
God.watch do |w|
|
||||
w.dir = rails_root
|
||||
w.name = "sunspot-solr"
|
||||
w.group = 'rulingcom'
|
||||
w.interval = 30.seconds
|
||||
w.env = {"RAILS_ENV"=>rails_env}
|
||||
w.start = "HOME=#{user_home} QUEUE=* RAILS_ENV=#{rails_env} rake -f #{rails_root}/Rakefile sunspot:solr:start"
|
||||
w.keepalive
|
||||
w.uid = (rails_env == 'production' )? "root" : development_uid
|
||||
w.gid = (rails_env == 'production' )? "root" : development_gid
|
||||
w.pid_file = "#{rails_root}/solr/pids/production/sunspot-solr-production.pid"
|
||||
w.log = (rails_env == 'production' )? "/var/log/#{w.group}/#{w.name}.log":"#{rails_root}/log/dev-#{w.name}.log"
|
||||
|
||||
# restart if memory gets too high
|
||||
w.transition(:up, :restart) do |on|
|
||||
on.condition(:memory_usage) do |c|
|
||||
c.above = 350.megabytes
|
||||
c.times = 2
|
||||
end
|
||||
end
|
||||
|
||||
# determine the state on startup
|
||||
w.transition(:init, { true => :up, false => :start }) do |on|
|
||||
on.condition(:process_running) do |c|
|
||||
c.running = true
|
||||
end
|
||||
end
|
||||
|
||||
# determine when process has finished starting
|
||||
w.transition([:start, :restart], :up) do |on|
|
||||
on.condition(:process_running) do |c|
|
||||
c.running = true
|
||||
c.interval = 5.seconds
|
||||
end
|
||||
|
||||
# failsafe
|
||||
on.condition(:tries) do |c|
|
||||
c.times = 5
|
||||
c.transition = :start
|
||||
c.interval = 5.seconds
|
||||
end
|
||||
end
|
||||
|
||||
# start if process is not running
|
||||
w.transition(:up, :start) do |on|
|
||||
on.condition(:process_running) do |c|
|
||||
c.running = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
module OmniAuth
|
||||
module Strategies
|
||||
class Doorkeeper < OmniAuth::Strategies::OAuth2
|
||||
option :name, :doorkeeper
|
||||
|
||||
option :client_options, {
|
||||
:site => "http://localhost:8000",
|
||||
:authorize_path => "/oauth/authorize"
|
||||
}
|
||||
|
||||
uid do
|
||||
raw_info["id"]
|
||||
end
|
||||
|
||||
info do
|
||||
{
|
||||
:email => raw_info["email"]
|
||||
}
|
||||
end
|
||||
|
||||
def raw_info
|
||||
@raw_info ||= access_token.get('/api/v1/me.json').parsed
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue