Compare commits

...

49 Commits

Author SHA1 Message Date
  alan eb9a22a81f Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 0d42ddef09 配置缓存是否启用 11 years ago
  alan b47f9a6e9f Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan de095ffccf 缓存设置规范化 11 years ago
  alan f94c993f93 课程通知缓存过期条件加入count 11 years ago
  alan ca12151419 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 26c528eaca Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 83516eb2c5 解决fast《项目首页没有新建,加入项目》《课程留言样式乱了》 11 years ago
  alan aa742e8d52 解决《课程通知缓存时附件增加,删除时删除缓存》问题 11 years ago
  alan 6065033fe1 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 5367f9029e 解决课程通知缓存过期问题,数据库中没有updated_on 的时间戳字段 11 years ago
  alan 44a9fbc3ef Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 1621599287 Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 7ac14ba733 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 2994f627bf Merge branch 'redis_cache' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alanlong9278 84fbc2be98 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alanlong9278 96f907480e Merge branch 'redis_cache' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alanlong9278 8dbba8f3a3 Signed-off-by: alanlong9278 <547533434@qq.com> 11 years ago
  alan b324cdeea1 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan f3d680c75c Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 9d172efcaa Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 59efe5b7e0 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 85c37091b3 Merge branch 'guange_dev' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 85b9134f0f Merge branch 'guange_dev' into redis_cache 11 years ago
  alan 7ad71f6648 Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 9f2f246c0c Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan c581a54132 Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 3de873b210 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 91f688e88e Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 890893f553 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 8235203af7 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 1a87237b20 研究缓存删除功能,暂定方案:使用tag 11 years ago
  alan 73e31e2d79 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 94673059cd Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 5788dc6d59 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 55483daa14 课程留言列表缓存设置 11 years ago
  alan cb12eb603c 留言模块列表优化方案的敲定 11 years ago
  alan 31e9e2f3e4 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alanlong9278 5cfc24e5dd 课程模块缓存的设置,, 11 years ago
  alanlong9278 a7a8061104 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan a23b828d60 Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 3daea97b01 课程作业缓存 11 years ago
  alan f335b71b4a Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 3ae6358f8c 具体课程左侧页面缓存设置 11 years ago
  alan 657615adec Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 2de9df5c53 Signed-off-by: alan <547533434@qq.com> 11 years ago
  alan 0648c27f5b Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into redis_cache 11 years ago
  alan 0173150000 首页公共贴吧缓存修改 11 years ago
  alan 7e6aa768e6 多级cache的套用[首页贴吧缓存] 11 years ago
24 changed files with 2044 additions and 2130 deletions
Unified View
  1. +2
    -2
      Gemfile
  2. +1
    -0
      app/controllers/courses_controller.rb
  3. +2
    -2
      app/controllers/news_controller.rb
  4. +18
    -0
      app/helpers/application_helper.rb
  5. +2
    -1
      app/models/attachment.rb
  6. +3
    -2
      app/models/journals_for_message.rb
  7. +1
    -1
      app/models/memo.rb
  8. +1
    -1
      app/models/news.rb
  9. +160
    -156
      app/views/courses/_courses_jours.html.erb
  10. +129
    -129
      app/views/courses/show.html.erb
  11. +9
    -6
      app/views/files/_course_file.html.erb
  12. +26
    -6
      app/views/layouts/base_courses.html.erb
  13. +7
    -2
      app/views/news/_course_news.html.erb
  14. +1
    -1
      app/views/settings/_general.html.erb
  15. +6
    -2
      app/views/tags/_new_tag_name.html.erb
  16. +52
    -42
      app/views/welcome/course.html.erb
  17. +15
    -3
      app/views/welcome/index.html.erb
  18. +1
    -1
      config/environments/development.rb
  19. +1
    -1
      config/initializers/redis.rb
  20. +1
    -0
      config/locales/zh.yml
  21. +18
    -193
      config/newrelic.yml
  22. +4
    -0
      config/settings.yml
  23. +5
    -0
      db/migrate/20150624013257_add_updated_on_to_news.rb
  24. +1579
    -1579
      db/schema.rb

+ 2
- 2
Gemfile View File

@@ -25,7 +25,7 @@ gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet' gem 'spreadsheet'
gem 'ruby-ole' gem 'ruby-ole'
gem 'rails_kindeditor',path:'lib/rails_kindeditor' gem 'rails_kindeditor',path:'lib/rails_kindeditor'
#gem "rmagick", ">= 2.0.0"
gem "rmagick", ">= 2.0.0"
group :development do group :development do
gem 'grape-swagger' gem 'grape-swagger'
@@ -53,7 +53,7 @@ group :assets do
gem 'coffee-rails', '~> 3.2.1' gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes # See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3' gem 'uglifier', '>= 1.0.3'
end end


+ 1
- 0
app/controllers/courses_controller.rb View File

@@ -778,6 +778,7 @@ class CoursesController < ApplicationController
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit page = 1 + offset / @limit
end end
@page = page.nil? ? "1" :page.to_s
@jour = paginateHelper @jours,10 @jour = paginateHelper @jours,10
@state = false @state = false
respond_to do |format| respond_to do |format|


+ 2
- 2
app/controllers/news_controller.rb View File

@@ -52,7 +52,7 @@ class NewsController < ApplicationController
@news_pages = Paginator.new @news_count, @limit, params['page'] @news_pages = Paginator.new @news_count, @limit, params['page']
@offset ||= @news_pages.offset @offset ||= @news_pages.offset
@newss = scope.all(:include => [:author, :project], @newss = scope.all(:include => [:author, :project],
:order => "#{News.table_name}.created_on DESC",
:order => "#{News.table_name}.updated_on DESC",
:offset => @offset, :offset => @offset,
:limit => @limit) :limit => @limit)
@@ -74,7 +74,7 @@ class NewsController < ApplicationController
#@news_pages = Paginator.new @news_count, @limit, params['page'] #@news_pages = Paginator.new @news_count, @limit, params['page']
#@offset ||= scope_page.offset #@offset ||= scope_page.offset
scope_order = scope.all(:include => [:author, :course], scope_order = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC")
:order => "#{News.table_name}.updated_on DESC")
# :offset => @offset, # :offset => @offset,
# :limit => @limit) # :limit => @limit)
@newss = paginateHelper scope_order,10 @newss = paginateHelper scope_order,10


+ 18
- 0
app/helpers/application_helper.rb View File

@@ -1871,6 +1871,24 @@ module ApplicationHelper
end end
# cache_if 判断是否启用cache, rails3+没有这个
def cache_if (condition, name = {}, cache_options = {}, &block)
if condition
cache(name, cache_options, &block)
else
yield
end
end
# cache_unless 判断是否启用cache, rails3+没有这个
def cache_unless (condition, name = {}, cache_options = {}, &block)
if !condition
cache(name, cache_options, &block)
else
yield
end
end
private private
def wiki_helper def wiki_helper


+ 2
- 1
app/models/attachment.rb View File

@@ -19,7 +19,8 @@ require "digest/md5"
require "fileutils" require "fileutils"
class Attachment < ActiveRecord::Base class Attachment < ActiveRecord::Base
belongs_to :container, :polymorphic => true
#attr_accessible :container
belongs_to :container, :polymorphic => true, :touch => true
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'" belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'" belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'" belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"


+ 3
- 2
app/models/journals_for_message.rb View File

@@ -21,12 +21,13 @@ class JournalsForMessage < ActiveRecord::Base
after_destroy :delete_kindeditor_assets after_destroy :delete_kindeditor_assets
belongs_to :project, belongs_to :project,
:foreign_key => 'jour_id', :foreign_key => 'jour_id',
:conditions => "#{self.table_name}.jour_type = 'Project' "
:conditions => "#{self.table_name}.jour_type = 'Project' ", :touch => true
belongs_to :course, belongs_to :course,
:foreign_key => 'jour_id'
:foreign_key => 'jour_id', :touch => true
belongs_to :jour, :polymorphic => true belongs_to :jour, :polymorphic => true
belongs_to :m_parent,:class_name => 'JournalsForMessage',:foreign_key => 'm_parent_id', :touch => true
belongs_to :user belongs_to :user
belongs_to :homework_attach belongs_to :homework_attach
belongs_to :student_works_score belongs_to :student_works_score


+ 1
- 1
app/models/memo.rb View File

@@ -16,7 +16,7 @@ class Memo < ActiveRecord::Base
acts_as_attachable acts_as_attachable
has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id'
belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id', :touch => true
# acts_as_searchable :column => ['subject', 'content'], # acts_as_searchable :column => ['subject', 'content'],
# #:include => { :forum => :p} # #:include => { :forum => :p}
# #:project_key => "#{Forum.table_name}.project_id" # #:project_key => "#{Forum.table_name}.project_id"


+ 1
- 1
app/models/news.rb View File

@@ -21,7 +21,7 @@ class News < ActiveRecord::Base
include ApplicationHelper include ApplicationHelper
has_many_kindeditor_assets :assets, :dependent => :destroy has_many_kindeditor_assets :assets, :dependent => :destroy
#added by nwb #added by nwb
belongs_to :course
belongs_to :course, :touch => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on" has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
# fq # fq


+ 160
- 156
app/views/courses/_courses_jours.html.erb View File

@@ -1,99 +1,103 @@
<style type="text/css"> <style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
</style> </style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<div class="msg_box fl" id='leave-message' nhname="new_message">
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<% cache_if Setting.redis_cache_enabled? , [:courses_jours, @course, User.current.logged? ] do%>
<div class="msg_box" id='leave-message' nhname="new_message">
<%# reply_allow = JournalsForMessage.create_by_user? User.current %> <%# reply_allow = JournalsForMessage.create_by_user? User.current %>
<h4><%= l(:label_leave_message) %></h4> <h4><%= l(:label_leave_message) %></h4>
<% if !User.current.logged?%> <% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %>
<hr/>
</div>
<div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %>
<hr/>
</div>
<% else %> <% else %>
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%#= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;",
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%#= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;",
:placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%> :placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%>
<textarea cols="40" nhname="new_message_textarea" maxlength="250" name="new_form[course_message]" placeholder="请在此留下你的意见和建议!" rows="20" style="display: none;"></textarea>
<p nhname="contentmsg"></p>
<% end %>
<div class="cl"></div>
<div>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<a href="javascript:void(0)" class="grey_btn fr ml10 mt10" nhname="cancel_btn">取&nbsp;&nbsp;消</a>
<a href="javascript:void(0)" onclick='$("#leave_message_form").submit();' class="blue_btn fr mt10">
<%= l(:button_leave_meassge)%>
</a>
</div>
<textarea cols="40" nhname="new_message_textarea" maxlength="250" name="new_form[course_message]" placeholder="请在此留下你的意见和建议!" rows="20" style="display: none;"></textarea>
<p nhname="contentmsg"></p>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<a href="javascript:void(0)" class="grey_btn fr ml10 mt10" nhname="cancel_btn">取&nbsp;&nbsp;消</a>
<a href="javascript:void(0)" onclick='$("#leave_message_form").submit();' class="blue_btn fr mt10">
<%= l(:button_leave_meassge)%>
</a>
<% end %>
<% end %> <% end %>
</div> </div>
<% end %>
<div class="cl"></div> <div class="cl"></div>
<div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
</div>
<% if @page == "1" %>
<% cache_if Setting.redis_cache_enabled? , [:courses_jours_list, @course, @jour.maximum(:updated_on), User.current.logged? ] do %>
<div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :page => @page, :state => false} %>
</div>
<% end %>
<% else %>
<div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
</div>
<% end %>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul> </ul>
<div style="display:none;"><a href="#" id="nhjump"></a></div> <div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){
$(function(){
function init_editor(params){
params.textarea.removeAttr('placeholder');
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
function init_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
return editor;
} }
}).loadPlugin('paste');
return editor;
}
function nh_check_field(params){
var result=true;
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
function nh_check_field(params){
var result=true;
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
} }
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function init_form(params){
function init_form(params){
// var flag = false; // var flag = false;
// if(params.form.attr('data-remote') != undefined ){ // if(params.form.attr('data-remote') != undefined ){
// flag = true // flag = true
@@ -119,93 +123,93 @@
// return false; // return false;
// } // }
params.form.submit(function(){
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
params.form.submit(function(){
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
// return true; //这个涛哥的firefox不能提交 // return true; //这个涛哥的firefox不能提交
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
}
return false;
});
} }
return false;
});
}
function nh_reset_form(params){
params.form[0].reset();
params.textarea.empty();
if(params.editor != undefined){
params.editor.html(params.textarea.html());
}
params.contentmsg.hide();
}
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
function nh_reset_form(params){
params.form[0].reset();
params.textarea.empty();
if(params.editor != undefined){
params.editor.html(params.textarea.html());
}
params.contentmsg.hide();
} }
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// $("#nhjump").attr('href','#'+params.div_form.attr('id')); // $("#nhjump").attr('href','#'+params.div_form.attr('id'));
// $("#nhjump")[0].click(); // $("#nhjump")[0].click();
}
},300);
params.textarea.data('init',1);
});
}
},300);
params.textarea.data('init',1);
});
$("div[nhname='new_message']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
$("a[nhname='cancel_btn']",params.div_form).click(function(){
nh_reset_form(params);
});
params.textarea.data('init',1);
}
});
$("div[nhname='new_message']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
$("a[nhname='cancel_btn']",params.div_form).click(function(){
nh_reset_form(params);
});
params.textarea.data('init',1);
}
});
});
}); });
});
</script> </script>

+ 129
- 129
app/views/courses/show.html.erb View File

@@ -1,129 +1,129 @@
<div class="project_r_h">
<% if @controller_name=='ActivityNotifys' %>
<a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2" style="width:100px;">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</h2>
<div class="fr mt10 mr5 c_grey02">
<a class="c_dblue">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
</a>
</div>
<% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
<% if User.current.logged? %>
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</a>
<% end %>
<% end %>
</div>
<% if @events_by_day != nil && @events_by_day.size >0 %>
<% @events_by_day.keys.sort.reverse.each do |day| %>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="problem_main" nhname="container">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5 upload_img">
<%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %>
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
<span class="fl"> &nbsp;</span>
<span class="fl"> <%= l(:label_new_activity) %>:</span>
<%
link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
(e.event_type.eql?("bid") ? homework_course_path(@course) :
(e.event_type.eql?("message") || e.event_type.eql?("reply") ?
course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url))
%>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
<%end%>
<br />
<p class="mt5 break_word"><%= e.event_description.html_safe %>
<br />
<div class="cl"></div>
<%= l :label_activity_time %> : <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p>
<%= link_to_attachments_course(e) if e.class.to_s == "News" %>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<% end%>
<% elsif @controller_name=='ActivityNotifys' %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end%>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5">
<%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %>
<%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %>
<span class="fl"> <%= l(:label_user_create_project) %>:</span>
<%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%>
<br />
<p class="mt5">
<br />
<%= l :label_create_time %> : <%= format_time(@course.created_at) %>
</p>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<script type="text/javascript">
$(function(){
function nh_new_notify_count_show(){
var new_notify_count = $("#new_notify_count").html();
if(new_notify_count>0){
$("#new_notify_count").parent('span').show();
}else{
$("#new_notify_count").parent('span').hide();
}
}
$("div[nhname='container']").each(function(){
var container = $(this);
var btn = $("a[nhname='nh_act_link']",container);
if(btn.data('notify-id')>0){
btn.attr('target','_blank');
btn.click(function(){
var flag = $("span[nhname='nh_act_flag']",container);
if(flag!=undefined){
var url = $(this).data('href');
$.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){
flag.remove();
$("#new_notify_count").html($("#new_notify_count").html()-1);
nh_new_notify_count_show();
}
}});
}
return true;
});
}
});
$("label[nhname='nh_act_link_all']").click(function(){
var url = $(this).data('href');
$.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){
$("span[nhname='nh_act_flag']").remove();
$("#new_notify_count").html('0');
nh_new_notify_count_show();
}
}});
});
nh_new_notify_count_show();
});
</script>
<div class="project_r_h">
<% if @controller_name=='ActivityNotifys' %>
<a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2" style="width:100px;">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</h2>
<div class="fr mt10 mr5 c_grey02">
<a class="c_dblue">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
</a>
</div>
<% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
<% if User.current.logged? %>
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</a>
<% end %>
<% end %>
</div>
<% if @events_by_day != nil && @events_by_day.size >0 %>
<% @events_by_day.keys.sort.reverse.each do |day| %>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="problem_main" nhname="container">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5 upload_img">
<%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %>
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
<span class="fl"> &nbsp;</span>
<span class="fl"> <%= l(:label_new_activity) %>:</span>
<%
link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
(e.event_type.eql?("bid") ? homework_course_path(@course) :
(e.event_type.eql?("message") || e.event_type.eql?("reply") ?
course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url))
%>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
<%end%>
<br />
<p class="mt5 break_word"><%= e.event_description.html_safe %>
<br />
<div class="cl"></div>
<%= l :label_activity_time %> : <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p>
<%= link_to_attachments_course(e) if e.class.to_s == "News" %>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<% end%>
<% elsif @controller_name=='ActivityNotifys' %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end%>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5">
<%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %>
<%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %>
<span class="fl"> <%= l(:label_user_create_project) %>:</span>
<%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%>
<br />
<p class="mt5">
<br />
<%= l :label_create_time %> : <%= format_time(@course.created_at) %>
</p>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<script type="text/javascript">
$(function(){
function nh_new_notify_count_show(){
var new_notify_count = $("#new_notify_count").html();
if(new_notify_count>0){
$("#new_notify_count").parent('span').show();
}else{
$("#new_notify_count").parent('span').hide();
}
}
$("div[nhname='container']").each(function(){
var container = $(this);
var btn = $("a[nhname='nh_act_link']",container);
if(btn.data('notify-id')>0){
btn.attr('target','_blank');
btn.click(function(){
var flag = $("span[nhname='nh_act_flag']",container);
if(flag!=undefined){
var url = $(this).data('href');
$.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){
flag.remove();
$("#new_notify_count").html($("#new_notify_count").html()-1);
nh_new_notify_count_show();
}
}});
}
return true;
});
}
});
$("label[nhname='nh_act_link_all']").click(function(){
var url = $(this).data('href');
$.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){
$("span[nhname='nh_act_flag']").remove();
$("#new_notify_count").html('0');
nh_new_notify_count_show();
}
}});
});
nh_new_notify_count_show();
});
</script>

+ 9
- 6
app/views/files/_course_file.html.erb View File

@@ -63,11 +63,14 @@
<div class="container"> <div class="container">
<div class="resource"><!--资源库内容开始---> <div class="resource"><!--资源库内容开始--->
<div class="re_top"> <div class="re_top">
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% cache_if Setting.redis_cache_enabled? , [:course_file_search, @course] do %>
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<% end %> <% end %>
<% if is_course_teacher(User.current,@course) %> <!-- show_window('light','fade','20%','35%')--> <% if is_course_teacher(User.current,@course) %> <!-- show_window('light','fade','20%','35%')-->
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>--> <!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
@@ -82,11 +85,11 @@
<% end %> <% end %>
</div><!---re_top end--> </div><!---re_top end-->
<div class="cl"></div> <div class="cl"></div>
<% cache_if Setting.redis_cache_enabled? , [:course_file_list, @obj_attachments.max().updated_at] do %>
<div class="re_con" id="course_list"> <div class="re_con" id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div><!---re_con end--> </div><!---re_con end-->
<% end %>
</div> </div>
</div> </div>
<% html_title(l(:label_attachment_plural)) -%> <% html_title(l(:label_attachment_plural)) -%>

+ 26
- 6
app/views/layouts/base_courses.html.erb View File

@@ -24,11 +24,14 @@
</head> </head>
<!--add by huang--> <!--add by huang-->
<body> <body>
<div id="Container"> <div id="Container">
<%= render :partial => 'layouts/new_header' %> <%= render :partial => 'layouts/new_header' %>
<div class="cl"></div> <div class="cl"></div>
<!-- add by alan 对课程当前位置以及搜索框做缓存 -->
<% cache_if Setting.redis_cache_enabled? , [:course_head,@course.id] do%>
<div id="TopBar">
<div id="TopBar">
<div class="topbar_info02 fl"> <div class="topbar_info02 fl">
<h2> <h2>
<a href="http://<%= Setting.host_course%>" target="_blank" class="c_blue"> <a href="http://<%= Setting.host_course%>" target="_blank" class="c_blue">
@@ -56,11 +59,16 @@
<span id="project_name_span" style="float: left"></span> <span id="project_name_span" style="float: left"></span>
<% end %> <% end %>
</div> </div>
</div><!--TopBar end--> </div><!--TopBar end-->
<% end %>
<div class="cl"></div> <div class="cl"></div>
<div id="content"> <div id="content">
<div id="LSide" class="fl"> <div id="LSide" class="fl">
<div class="project_info"> <div class="project_info">
<!-- 对课程的图片及id 片段做缓存 -->
<% cache_if Setting.redis_cache_enabled? , [:course_pic, @course.id] do%>
<div class="pr_info_logo fl mr10 mb5"> <div class="pr_info_logo fl mr10 mb5">
<!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>--> <!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>-->
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %> <%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
@@ -68,6 +76,8 @@
<div class="pr_info_id fl mb5 f14"> <div class="pr_info_id fl mb5 f14">
ID:<%= @course.id%> ID:<%= @course.id%>
</div> </div>
<% end %>
<div class="pr_info_join fl"> <div class="pr_info_join fl">
<% if is_teacher%> <% if is_teacher%>
<%= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %> <%= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
@@ -98,6 +108,7 @@
<%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %>)</div> <%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %>)</div>
<div class="cl"></div> <div class="cl"></div>
</div><!--课程信息 end--> </div><!--课程信息 end-->
<% cache_if Setting.redis_cache_enabled? , [:course_info_left, @course ] do%>
<div class="info_box"> <div class="info_box">
<ul> <ul>
<li><%= l(:label_main_teacher)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li> <li><%= l(:label_main_teacher)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
@@ -108,13 +119,14 @@
<% end%> <% end%>
</ul> </ul>
</div> </div>
<% end %>
<div class="subNavBox"> <div class="subNavBox">
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
<!--暂时不显示课程动态数,优化后在显示--> <!--暂时不显示课程动态数,优化后在显示-->
<%= link_to "(#{course_activity_count @course})", course_path(@course), :class => "subnav_num c_orange"%> <%= link_to "(#{course_activity_count @course})", course_path(@course), :class => "subnav_num c_orange"%>
</div> </div>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%> <%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
<%= link_to "(#{@course.homework_commons.count})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%> <%= link_to "(#{@course.homework_commons.count})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
@@ -144,8 +156,11 @@
<%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %> <%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %>
<%= link_to( "+#{l(:label_new_poll)}", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'subnav_green c_white') if is_teacher %> <%= link_to( "+#{l(:label_new_poll)}", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'subnav_green c_white') if is_teacher %>
</div> </div>
</div><!--项目侧导航 end--> </div><!--项目侧导航 end-->
<div class="cl"></div> <div class="cl"></div>
<% cache_if Setting.redis_cache_enabled? , [:course_description, expire_in: 2.hours] do%>
<div class="project_intro"> <div class="project_intro">
<div id="course_description" class="course_description"> <div id="course_description" class="course_description">
<h4 ><%= l(:label_course_brief_introduction)%>:</h4> <h4 ><%= l(:label_course_brief_introduction)%>:</h4>
@@ -160,6 +175,7 @@
</span> </span>
</div> </div>
</div><!--项目简介 end--> </div><!--项目简介 end-->
<% end %>
<div class="project_Label"> <div class="project_Label">
<h4 class="mb5" ><%= l(:label_tag)%>:</h4> <h4 class="mb5" ><%= l(:label_tag)%>:</h4>
<div class="tag_h" > <div class="tag_h" >
@@ -168,7 +184,7 @@
<div class="cl"></div> <div class="cl"></div>
</div><!--项目标签 end--> </div><!--项目标签 end-->
</div><!--LSide end--> </div><!--LSide end-->
<div id="RSide" class="fl"> <div id="RSide" class="fl">
<%= render_flash_messages %> <%= render_flash_messages %>
<%= yield %> <%= yield %>
@@ -179,16 +195,20 @@
</div><!--Content end--> </div><!--Content end-->
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/new_footer' %>
<% cache_if Setting.redis_cache_enabled? , 'footer', expire_in: 2.hours do%>
<%= render :partial => 'layouts/new_footer' %>
<% end %>
<div class="cl"></div> <div class="cl"></div>
</div><!--Container end--> </div><!--Container end-->
<%= render :partial => 'layouts/new_feedback' %>
<% cache_if Setting.redis_cache_enabled? , 'feedback', expire_in: 2.hours do%>
<%= render :partial => 'layouts/new_feedback' %>
<% end %>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
<%# end %>
</body> </body>
</html> </html>

+ 7
- 2
app/views/news/_course_news.html.erb View File

@@ -20,13 +20,17 @@
</div> </div>
<div> <div>
<% if @newss.empty? %> <% if @newss.empty? %>
<p class="nodata"> <p class="nodata">
<%= l(:label_no_data) %> <%= l(:label_no_data) %>
</p> </p>
<% else %> <% else %>
<% cache_if Setting.redis_cache_enabled? , [:course_news_list, @course, @newss.first().updated_on] do%>
<% @newss.each do |news| %> <% @newss.each do |news| %>
<div class="problem_main upload_img">
<% cache_if Setting.redis_cache_enabled? , [:course_news_each, news.id, news.updated_on] do%>
<div class="problem_main upload_img">
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5"> <div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
@@ -54,7 +58,8 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!--problem_main end--> </div><!--problem_main end-->
<% end %>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>


+ 1
- 1
app/views/settings/_general.html.erb View File

@@ -27,7 +27,7 @@
<p style="padding-left: 180px;"><%= setting_select :text_formatting, Redmine::WikiFormatting.format_names.collect{|name| [name, name.to_s]}, :blank => :label_none %></p> <p style="padding-left: 180px;"><%= setting_select :text_formatting, Redmine::WikiFormatting.format_names.collect{|name| [name, name.to_s]}, :blank => :label_none %></p>


<p style="padding-left: 180px;"><%= setting_check_box :cache_formatted_text %></p> <p style="padding-left: 180px;"><%= setting_check_box :cache_formatted_text %></p>
<p style="padding-left: 180px;"><%= setting_check_box :redis_cache_enabled %></p>
<p style="padding-left: 180px;"><%= setting_select :wiki_compression, [['Gzip', 'gzip']], :blank => :label_none %></p> <p style="padding-left: 180px;"><%= setting_select :wiki_compression, [['Gzip', 'gzip']], :blank => :label_none %></p>


<p style="padding-left: 180px;"><%= setting_text_field :feeds_limit, :size => 6 %></p> <p style="padding-left: 180px;"><%= setting_text_field :feeds_limit, :size => 6 %></p>


+ 6
- 2
app/views/tags/_new_tag_name.html.erb View File

@@ -1,10 +1,11 @@
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求 7代表竞赛 9代表课程--> <!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表需求 7代表竞赛 9代表课程-->
<% @tags = obj.reload.tag_list %> <% @tags = obj.reload.tag_list %>
<% if non_list_all && @tags.size > 0 %>
<% unless non_list_all && @tags.size > 0 %>



<% else %>
<!-- 用来显示三大对象的主页中的tag 故是全部显示 --> <!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
<% if @tags.size > 0 %> <% if @tags.size > 0 %>
<% cache_if Setting.redis_cache_enabled? , [:course_tags, @tags.size] do%>
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<span class="re_tag f_l " id="tag"> <span class="re_tag f_l " id="tag">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %>
@@ -13,10 +14,12 @@
</span> </span>
</span> </span>
<% end %> <% end %>
<% end %>
<% end %> <% end %>
<% end %> <% end %>


<% if User.current.logged?%> <% if User.current.logged?%>

<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();"><%= l(:label_add_tag)%></a> <a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();"><%= l(:label_add_tag)%></a>
<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l"> <span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_for "tag_for_save",:remote=>true,:url=>save_tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %> <%= form_for "tag_for_save",:remote=>true,:url=>save_tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
@@ -26,4 +29,5 @@
<input type="button" class="submit f_l" onclick="$('#tags_name').parent().submit();" /> <input type="button" class="submit f_l" onclick="$('#tags_name').parent().submit();" />
<% end %> <% end %>
</span> </span>

<% end%> <% end%>

+ 52
- 42
app/views/welcome/course.html.erb View File

@@ -42,15 +42,15 @@
<% if User.current.login? %> <% if User.current.login? %>
<span class="font_welcome_school"> <span class="font_welcome_school">
<% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
<% else %>
<% else %>
<% if @school_id == "0" %> <% if @school_id == "0" %>
<% else %> <% else %>
<% if @school_id.nil? %> <% if @school_id.nil? %>
<%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
<br/>
<br/>
<% else %> <% else %>
<%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> <%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
<br/>
<br/>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
@@ -61,10 +61,10 @@
原本代码 原本代码
<%= @course_page.title %> <%= @course_page.title %>
!--> !-->
<%= l(:label_welcome_trustie_course) %>
<%= l(:label_welcome_trustie_course) %>
</span> </span>
<% else %> <% else %>
<% unless @course_page.nil? %>
<% unless @course_page.nil? %>
<span class="font_welcome_trustie"> <span class="font_welcome_trustie">
<!-- <!--
@course_page.title存储在first_page表中的title字段 @course_page.title存储在first_page表中的title字段
@@ -81,7 +81,7 @@
!--> !-->
<%= l(:label_welcome_trustie_course_description) %> <%= l(:label_welcome_trustie_course_description) %>
</span> </span>
<% end %>
<% end %>
<% end %> <% end %>
</div> </div>
@@ -122,9 +122,9 @@
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<%# if User.current.logged? %> <%# if User.current.logged? %>
<li>
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_no_course)} %>
</li>
<li>
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_no_course)} %>
</li>
<%# end %> <%# end %>
<%# User.current.logged? ? course_count = 9 : course_count = 10 %> <%# User.current.logged? ? course_count = 9 : course_count = 10 %>
<% course_count = 9 %> <% course_count = 9 %>
@@ -132,15 +132,17 @@
<% while all_new_hot_course.count < course_count%> <% while all_new_hot_course.count < course_count%>
<% if course_term == "春季学期" <% if course_term == "春季学期"
year_now -= 1
course_term = "秋季学期"
else
course_term = "春季学期"
end%>
year_now -= 1
course_term = "秋季学期"
else
course_term = "春季学期"
end%>
<%break if Time.new.strftime("%Y").to_i - year_now >= 2%> <%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
<% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%> <% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%>
<% end%> <% end%>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
<% cache [:course_list, all_new_hot_course.max().updated_at] do %>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
<% end %>
</ul> </ul>
</div> </div>
<% else %> <% else %>
@@ -165,15 +167,17 @@
<% while (all_new_hot_course.count + cur_school_course.count) < 9%> <% while (all_new_hot_course.count + cur_school_course.count) < 9%>
<% if course_term == "春季学期" <% if course_term == "春季学期"
year_now -= 1
course_term = "秋季学期"
else
course_term = "春季学期"
end%>
year_now -= 1
course_term = "秋季学期"
else
course_term = "春季学期"
end%>
<%break if Time.new.strftime("%Y").to_i - year_now >= 2%> <%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
<% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%> <% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%>
<% end%> <% end%>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
<% cache_if Setting.redis_cache_enabled? , [:course_list, all_new_hot_course.max().updated_at] do %>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
<% end %>
<% end %> <% end %>
</ul> </ul>
</div> </div>
@@ -182,21 +186,24 @@
</div> </div>
<div id="J_Slide" class="d-p-index-box d-p-index-hot" style="float: right;"> <div id="J_Slide" class="d-p-index-box d-p-index-hot" style="float: right;">
<h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;">
<strong><%= l(:label_issue_feedback_activities)%></strong>
<%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
<%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
<!-- 加入课程按钮 -->
</h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
<% topics = find_new_forum_topics(10) %> <% topics = find_new_forum_topics(10) %>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% cache_if Setting.redis_cache_enabled? , [:course_topics, topics.maximum(:updated_at)] do%>
<h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;">
<strong><%= l(:label_issue_feedback_activities)%></strong>
<%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
<%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
<!-- 加入课程按钮 -->
</h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
<% topics.each do |topic| %>
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; border-bottom: 1px dashed; padding-bottom: 3px">
<div style="display: inline-block; width: 100%;">
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% topics.each do |topic| %>
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; border-bottom: 1px dashed; padding-bottom: 3px">
<div style="display: inline-block; width: 100%;">
<span class="memo_activity text_nowrap" title="<%= topic.subject%>" <span class="memo_activity text_nowrap" title="<%= topic.subject%>"
style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;"> style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@@ -204,7 +211,7 @@
<%= link_to topic.subject, topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %> <%= link_to topic.subject, topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %>
</span> </span>
<div class='memo_activity memo_attr'>
<div class='memo_activity memo_attr'>
<span class='memo_timestamp'> <span class='memo_timestamp'>
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
</span> </span>
@@ -214,20 +221,23 @@
</span> </span>
<span class="memo_last_person" title="<%= topic.last_reply.author.login unless (topic.last_reply.nil? || topic.last_reply.author.nil?)%>"> <span class="memo_last_person" title="<%= topic.last_reply.author.login unless (topic.last_reply.nil? || topic.last_reply.author.nil?)%>">
<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %>
<% cache_if Setting.redis_cache_enabled? , [:topic,topic, topic.last_reply.updated_at] do%>
<%= l(:label_final_reply)%> <%= l(:label_final_reply)%>
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
<% end %>
<% end %> <% end %>
</span> </span>
<span class="memo_reply"> <span class="memo_reply">
<%= l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>) <%= l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>)
</span> </span>
</div>
</div>
</li>
<% end %>
</div>
</div>
</li>
</ul>
</div>
<% end %>
</ul>
</div>
<% end %>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>


+ 15
- 3
app/views/welcome/index.html.erb View File

@@ -68,6 +68,7 @@
</div> </div>
<div style="clear:both"></div> <div style="clear:both"></div>
<div id="J_Slide" class="d-p-index-box d-p-index-hot"> <div id="J_Slide" class="d-p-index-box d-p-index-hot">
<h3 style="margin-left: 5px; color: #e8770d;"><strong> <%= l(:lable_hot_projects)%> </strong></h3> <h3 style="margin-left: 5px; color: #e8770d;"><strong> <%= l(:lable_hot_projects)%> </strong></h3>
<span style="margin-top: -20px;float: right; display: block;"> <% if User.current.logged? %> <span style="margin-top: -20px;float: right; display: block;"> <% if User.current.logged? %>
@@ -80,7 +81,9 @@
<%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %> <%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
<% end %> </span> <% end %> </span>
<% cache_if Setting.redis_cache_enabled? , :project_list, :expire_in => 2.hours do%>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<!-- 如果企业版参数正确,这进入企业版页面 --> <!-- 如果企业版参数正确,这进入企业版页面 -->
<% if @organization.nil? %> <% if @organization.nil? %>
@@ -110,8 +113,11 @@
<% end %> <% end %>
<% end %> <% end %>
</ul> </ul>
</div> </div>
<% end %>
</div> </div>
<div class="right" style="float: right; width: 48%; padding-top: 8px;"> <div class="right" style="float: right; width: 48%; padding-top: 8px;">
<ul class="welcome-message-list"> <ul class="welcome-message-list">
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;"> <div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;">
@@ -121,7 +127,9 @@
</div> </div>
<div class="welcome-box-list-new memo_activity"> <div class="welcome-box-list-new memo_activity">
<% topics = find_new_forum_topics(12) %> <% topics = find_new_forum_topics(12) %>
<% cache_if Setting.redis_cache_enabled? , [:topics, topics.maximum(:updated_at)] do%>
<% topics.includes(:forum, :last_reply, :author).each do |topic|%> <% topics.includes(:forum, :last_reply, :author).each do |topic|%>
<li class="message-brief-intro" style="line-height:1.4em;"> <li class="message-brief-intro" style="line-height:1.4em;">
<div class='memo_title text_nowrap'> <div class='memo_title text_nowrap'>
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %> <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %>
@@ -139,9 +147,11 @@
</span> </span>
<span class="memo_last_person"> <span class="memo_last_person">
<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %>
<%= l(:label_final_reply)%>
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
<% end %>
<% cache_if Setting.redis_cache_enabled? , [:topic,topic, topic.last_reply.updated_at] do%>
<%= l(:label_final_reply)%>
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
<% end %>
<% end %>
</span> </span>
<span class="memo_reply"> <span class="memo_reply">
<%= l(:label_reply)%> <%= l(:label_reply)%>
@@ -150,6 +160,8 @@
</div> </div>
</li> </li>
<% end %> <% end %>
<% end %>
</div> </div>
</ul> </ul>
</div> </div>


+ 1
- 1
config/environments/development.rb View File

@@ -11,7 +11,7 @@ RedmineApp::Application.configure do
# Show full error reports and disable caching # Show full error reports and disable caching
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
# config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
#config.cache_store = :dalli_store #config.cache_store = :dalli_store
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true


+ 1
- 1
config/initializers/redis.rb View File

@@ -1 +1 @@
$redis = Redis.new(:host => "127.0.0.1", :port => 6379)
$redis = Redis.new()

+ 1
- 0
config/locales/zh.yml View File

@@ -237,6 +237,7 @@ zh:
setting_start_of_week: 日历开始于 setting_start_of_week: 日历开始于
setting_rest_api_enabled: 启用REST web service setting_rest_api_enabled: 启用REST web service
setting_cache_formatted_text: 缓存格式化文字 setting_cache_formatted_text: 缓存格式化文字
setting_redis_cache_enabled: 是否启用缓存
setting_default_notification_option: 默认提醒选项 setting_default_notification_option: 默认提醒选项
setting_commit_logtime_enabled: 激活时间日志 setting_commit_logtime_enabled: 激活时间日志
setting_commit_logtime_activity_id: 记录的活动 setting_commit_logtime_activity_id: 记录的活动


+ 18
- 193
config/newrelic.yml View File

@@ -3,222 +3,47 @@
# .NET, PHP, Python and Node applications with deep visibility and low # .NET, PHP, Python and Node applications with deep visibility and low
# overhead. For more information, visit www.newrelic.com. # overhead. For more information, visit www.newrelic.com.
# #
# Generated January 23, 2015
# Generated June 18, 2015
#
# This configuration file is custom generated for trustie_1
# #
# This configuration file is custom generated for Trustie
# For full documentation of agent configuration options, please refer to
# https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration



# Here are the settings that are common to all environments
common: &default_settings common: &default_settings
# ============================== LICENSE KEY ===============================

# You must specify the license key associated with your New Relic
# account. This key binds your Agent's data to your account in the
# New Relic service.
license_key: '9b481f5c9ec07de722dcaaa17b38d0d1efff32c0'
# Required license key associated with your New Relic account.
license_key: aa9cb58786c64fb48ab2527dff012a9d024cbf2e


# Agent Enabled (Ruby/Rails Only)
# Use this setting to force the agent to run or not run.
# Default is 'auto' which means the agent will install and run only
# if a valid dispatcher such as Mongrel is running. This prevents
# it from running with Rake or the console. Set to false to
# completely turn the agent off regardless of the other settings.
# Valid values are true, false and auto.
#
# agent_enabled: auto

# Application Name Set this to be the name of your application as
# you'd like it show up in New Relic. The service will then auto-map
# instances of your application into an "application" on your
# dashboard page. If you want to map this instance into multiple
# apps, like "AJAX Requests" and "All UI" then specify a semicolon
# separated list of up to three distinct names, or a yaml list.
# Defaults to the capitalized RAILS_ENV or RACK_ENV (i.e.,
# Production, Staging, etc)
#
# Example:
#
# app_name:
# - Ajax Service
# - All Services
#
# Caution: If you change this name, a new application will appear in the New
# Relic user interface with the new name, and data will stop reporting to the
# app with the old name.
#
# See https://newrelic.com/docs/site/renaming-applications for more details
# on renaming your New Relic applications.
#
# Your application name. Renaming here affects where data displays in New
# Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications
app_name: My Application app_name: My Application


# When "true", the agent collects performance data about your
# application and reports this data to the New Relic service at
# newrelic.com. This global switch is normally overridden for each
# environment below. (formerly called 'enabled')
monitor_mode: true

# Developer mode should be off in every environment but
# development as it has very high overhead in memory.
developer_mode: false
# To disable the agent regardless of other settings, uncomment the following:
# agent_enabled: false


# The newrelic agent generates its own log file to keep its logging
# information separate from that of your application. Specify its
# log level here.
# Logging level for log/newrelic_agent.log
log_level: info log_level: info


# Optionally set the path to the log file This is expanded from the
# root directory (may be relative or absolute, e.g. 'log/' or
# '/var/log/') The agent will attempt to create this directory if it
# does not exist.
# log_file_path: 'log'

# Optionally set the name of the log file, defaults to 'newrelic_agent.log'
# log_file_name: 'newrelic_agent.log'

# The newrelic agent communicates with the service via https by default. This
# prevents eavesdropping on the performance metrics transmitted by the agent.
# The encryption required by SSL introduces a nominal amount of CPU overhead,
# which is performed asynchronously in a background thread. If you'd prefer
# to send your metrics over http uncomment the following line.
# ssl: false

#============================== Browser Monitoring ===============================
# New Relic Real User Monitoring gives you insight into the performance real users are
# experiencing with your website. This is accomplished by measuring the time it takes for
# your users' browsers to download and render your web pages by injecting a small amount
# of JavaScript code into the header and footer of each page.
browser_monitoring:
# By default the agent automatically injects the monitoring JavaScript
# into web pages. Set this attribute to false to turn off this behavior.
auto_instrument: true

# Proxy settings for connecting to the New Relic server.
#
# If a proxy is used, the host setting is required. Other settings
# are optional. Default port is 8080.
#
# proxy_host: hostname
# proxy_port: 8080
# proxy_user:
# proxy_pass:

# The agent can optionally log all data it sends to New Relic servers to a
# separate log file for human inspection and auditing purposes. To enable this
# feature, change 'enabled' below to true.
# See: https://newrelic.com/docs/ruby/audit-log
audit_log:
enabled: false

# Tells transaction tracer and error collector (when enabled)
# whether or not to capture HTTP params. When true, frameworks can
# exclude HTTP parameters from being captured.
# Rails: the RoR filter_parameter_logging excludes parameters
# Java: create a config setting called "ignored_params" and set it to
# a comma separated list of HTTP parameter names.
# ex: ignored_params: credit_card, ssn, password
capture_params: false

# Transaction tracer captures deep information about slow
# transactions and sends this to the New Relic service once a
# minute. Included in the transaction is the exact call sequence of
# the transactions including any SQL statements issued.
transaction_tracer:

# Transaction tracer is enabled by default. Set this to false to
# turn it off. This feature is only available at the Professional
# and above product levels.
enabled: true

# Threshold in seconds for when to collect a transaction
# trace. When the response time of a controller action exceeds
# this threshold, a transaction trace will be recorded and sent to
# New Relic. Valid values are any float value, or (default) "apdex_f",
# which will use the threshold for an dissatisfying Apdex
# controller action - four times the Apdex T value.
transaction_threshold: apdex_f

# When transaction tracer is on, SQL statements can optionally be
# recorded. The recorder has three modes, "off" which sends no
# SQL, "raw" which sends the SQL statement in its original form,
# and "obfuscated", which strips out numeric and string literals.
record_sql: obfuscated

# Threshold in seconds for when to collect stack trace for a SQL
# call. In other words, when SQL statements exceed this threshold,
# then capture and send to New Relic the current stack trace. This is
# helpful for pinpointing where long SQL calls originate from.
stack_trace_threshold: 0.500


# Determines whether the agent will capture query plans for slow
# SQL queries. Only supported in mysql and postgres. Should be
# set to false when using other adapters.
# explain_enabled: true

# Threshold for query execution time below which query plans will
# not be captured. Relevant only when `explain_enabled` is true.
# explain_threshold: 0.5

# Error collector captures information about uncaught exceptions and
# sends them to New Relic for viewing
error_collector:

# Error collector is enabled by default. Set this to false to turn
# it off. This feature is only available at the Professional and above
# product levels.
enabled: true

# To stop specific errors from reporting to New Relic, set this property
# to comma-separated values. Default is to ignore routing errors,
# which are how 404's get triggered.
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"

# If you're interested in capturing memcache keys as though they
# were SQL uncomment this flag. Note that this does increase
# overhead slightly on every memcached call, and can have security
# implications if your memcached keys are sensitive
# capture_memcache_keys: true

# Application Environments
# ------------------------------------------
# Environment-specific settings are in this section. # Environment-specific settings are in this section.
# For Rails applications, RAILS_ENV is used to determine the environment.
# For Java applications, pass -Dnewrelic.environment <environment> to set
# the environment.

# NOTE if your application has other named environments, you should
# provide newrelic configuration settings for these environments here.

# RAILS_ENV or RACK_ENV (as appropriate) is used to determine the environment.
# If your application has other named environments, configure them here.
development: development:
<<: *default_settings <<: *default_settings
# Turn on communication to New Relic service in development mode
monitor_mode: true
app_name: My Application (Development) app_name: My Application (Development)


# Rails Only - when running in Developer Mode, the New Relic Agent will
# present performance information on the last 100 transactions you have
# executed since starting the mongrel.
# NOTE: There is substantial overhead when running in developer mode. # NOTE: There is substantial overhead when running in developer mode.
# Do not use for production or load testing. # Do not use for production or load testing.
developer_mode: true developer_mode: true


test: test:
<<: *default_settings <<: *default_settings
# It almost never makes sense to turn on the agent when running
# unit, functional or integration tests or the like.
# It doesn't make sense to report to New Relic from automated test runs.
monitor_mode: false monitor_mode: false


# Turn on the agent in production for 24x7 monitoring. NewRelic
# testing shows an average performance impact of < 5 ms per
# transaction, you can leave this on all the time without
# incurring any user-visible performance degradation.
production:
<<: *default_settings
monitor_mode: true

# Many applications have a staging environment which behaves
# identically to production. Support for that environment is provided
# here. By default, the staging environment has the agent turned on.
staging: staging:
<<: *default_settings <<: *default_settings
monitor_mode: true
app_name: My Application (Staging) app_name: My Application (Staging)

production:
<<: *default_settings

+ 4
- 0
config/settings.yml View File

@@ -68,6 +68,10 @@ delayjob_enabled:
default: 1 default: 1
course_cahce_enabled: course_cahce_enabled:
default: 1 default: 1
### redis cache
redis_cache_enabled:
default: 1
bcc_recipients: bcc_recipients:
default: 1 default: 1
plain_text_mail: plain_text_mail:


+ 5
- 0
db/migrate/20150624013257_add_updated_on_to_news.rb View File

@@ -0,0 +1,5 @@
class AddUpdatedOnToNews < ActiveRecord::Migration
def change
add_column :news, :updated_on, :timestamp
end
end

+ 1579
- 1579
db/schema.rb
File diff suppressed because it is too large
View File


Loading…
Cancel
Save