Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-05-28 17:52:10 +08:00
commit 1e4afc24b9
29 changed files with 317 additions and 117 deletions

View File

@ -6,6 +6,10 @@ unless RUBY_PLATFORM =~ /w32/
gem 'iconv' gem 'iconv'
end end
source 'http://rubygems.oneapm.com' do
gem 'oneapm_rpm'
end
gem "mysql2", "= 0.3.18" gem "mysql2", "= 0.3.18"
gem 'redis-rails' gem 'redis-rails'
gem 'rubyzip' gem 'rubyzip'

View File

@ -336,6 +336,7 @@ class AccountController < ApplicationController
:expires => 1.month.from_now, :expires => 1.month.from_now,
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'), :path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
:domain => Redmine::Configuration['cookie_domain'],
:httponly => true :httponly => true
} }
cookies[autologin_cookie_name] = cookie_options cookies[autologin_cookie_name] = cookie_options

View File

@ -199,7 +199,7 @@ class ApplicationController < ActionController::Base
# Logs out current user # Logs out current user
def logout_user def logout_user
if User.current.logged? if User.current.logged?
cookies.delete(autologin_cookie_name) cookies.delete(autologin_cookie_name, domain: :all)
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) # Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
self.logged_user = nil self.logged_user = nil
end end

View File

@ -675,11 +675,12 @@ class BidsController < ApplicationController
#删除作业 #删除作业
#by xianbo #by xianbo
def homework_destroy def homework_destroy
@bid_to_destroy = Bid.find params[:course_id] @bid_to_destroy = Bid.find params[:id]
course_url = course_homework_path(@bid_to_destroy.courses.first)
(render_403; return false) unless User.current.admin?||User.current.id==@bid_to_destroy.author_id (render_403; return false) unless User.current.admin?||User.current.id==@bid_to_destroy.author_id
@bid_to_destroy.destroy @bid_to_destroy.destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to :back } format.html { redirect_to course_url }
format.js format.js
#format.api { render_api_ok } #format.api { render_api_ok }
end end

View File

@ -130,7 +130,7 @@ class IssuesController < ApplicationController
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq @available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
respond_to do |format| respond_to do |format|``
format.html { format.html {
retrieve_previous_and_next_issue_ids retrieve_previous_and_next_issue_ids
render :template => 'issues/show', :layout => @project_base_tag#by young render :template => 'issues/show', :layout => @project_base_tag#by young

View File

@ -21,6 +21,9 @@
<p class="fl "><%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )</p> <p class="fl "><%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )</p>
<% if @is_teacher%> <% if @is_teacher%>
<%= bid_anonymous_comment(bid)%> <%= bid_anonymous_comment(bid)%>
<% if bid.homeworks.empty? %>
<%= link_to(l(:button_delete),bids_homework_path(:id => bid.id), :method => :delete, :confirm => l(:label_delete_confirm), :class => "fr mr10 work_edit") %>
<% end %>
<%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %> <%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %>
<% elsif @is_student%> <% elsif @is_student%>
<%= student_anonymous_comment bid %> <%= student_anonymous_comment bid %>

View File

@ -1,6 +1,6 @@
<!--added by huang--> <!--added by huang-->
<%#= watcher_link_issue(@issue, User.current) %> <%#= watcher_link_issue(@issue, User.current) %>
<%#= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %> <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %>
<%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %> <%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %>
<%= link_to l(:button_edit), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %> <%= link_to l(:button_edit), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %> <%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %>

View File

@ -51,8 +51,8 @@
<% if @issue.safe_attribute? 'description' %> <% if @issue.safe_attribute? 'description' %>
<label class="label">&nbsp;描述&nbsp;&nbsp;:&nbsp;</label> <label class="label">&nbsp;描述&nbsp;&nbsp;:&nbsp;</label>
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %> <%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
<%= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %> <%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
<%= content_tag 'span', :id => "issue_description_and_toolbar" do %> <%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor", <%= f.kindeditor :description,:editor_id => "issue_desc_editor",
# :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), # :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
# :accesskey => accesskey(:edit), # :accesskey => accesskey(:edit),
@ -60,7 +60,7 @@
:width=>'87%', :width=>'87%',
:resizeType => 0, :resizeType => 0,
:no_label => true %> :no_label => true %>
<% end %> <%# end %>
<%#= wikitoolbar_for 'issue_description' %> <%#= wikitoolbar_for 'issue_description' %>
<% end %> <% end %>
</li> </li>

View File

@ -124,18 +124,12 @@
<%= render :partial => 'changesets', :locals => {:changesets => @changesets} %> <%= render :partial => 'changesets', :locals => {:changesets => @changesets} %>
</div> </div>
<% end %> <% end %>
<!--留言-- end>
<!--<div style="clear: both;"></div>-->
<!--<%#= render :partial => 'action_menu' %>-->
<div class="cl"></div> <div class="cl"></div>
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%= f.link_to 'PDF' %> <%= f.link_to 'PDF' %>
<% end %> <% end %>
<% content_for :sidebar do %> <% content_for :sidebar do %>
<%= render :partial => 'issues/sidebar' %> <%= render :partial => 'issues/sidebar' %>
<br> <br>

View File

@ -14,7 +14,7 @@
.close_btn span { display:none;} .close_btn span { display:none;}
.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} .side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;}
.msgserver { margin:2px 0px 0px 4px; padding-top: 0px} .msgserver { margin:2px 0px 0px 4px; padding-top: 0px}
.msgserver a { background:url(/images/sidebar_bg.png) no-repeat -119px -115px; padding-left:22px;} .msgserver a { padding-left:4px;}
.opnionText{ width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;} .opnionText{ width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;}
.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} .opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;}
.opnionButton:hover{background: #0fa9bb; } .opnionButton:hover{background: #0fa9bb; }
@ -180,7 +180,9 @@ function cookieget(n)
<% end %> <% end %>
</div> </div>
<div class="msgserver"> <div class="msgserver">
<a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白&nbsp;&nbsp;&nbsp;羽</a> <a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #15BCCF;">
<%= l(:label_technical_support) %>白&nbsp;&nbsp;&nbsp;羽</a>
<iframe name="hiddentab" style="display: none"></iframe>
</div> </div>
</div> </div>
<div class="side_bottom"></div> <div class="side_bottom"></div>

View File

@ -22,10 +22,9 @@
<% end %> <% end %>
</div> </div>
<div class="msgserver"> <div class="msgserver">
<a href="http://user.trustie.net/users/34/user_newfeedback" target="_blank"> <a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #15BCCF;">
<%= l(:label_technical_support) %> <%= l(:label_technical_support) %>白&nbsp;&nbsp;&nbsp;羽</a>
白&nbsp;&nbsp;&nbsp;羽 <iframe name="hiddentab" style="display: none"></iframe>
</a>
</div> </div>
</div> </div>
<div class="side_bottom"></div> <div class="side_bottom"></div>

View File

@ -18,54 +18,7 @@
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
<!--项目的三种类型-->
<script type="text/javascript">
function click_ok(url)
{
$('#light').css('display','none');
$('#fade').css('display','none');
//ajax处理请求
var project_type;
if($("#development_group").attr("checked") == "checked"){
project_type = 1;
}
else if($("#research_group").attr("checked") == "checked"){
project_type = 2;
}
else if($("#friend_organization").attr("checked") == "checked"){
project_type = 3;
}
$.get(
url,
{ project_type: project_type},
function (data) {
if(data == 1)
{
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group')) %>');
$("#close_light").attr("onClick","close_window('development_group');");
}
else if(data == 2)
{
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team')) %>');
$("#close_light").attr("onClick","close_window('research_group');");
}
else if(data == 3)
{
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group')) %>');
$("#close_light").attr("onClick","close_window('friend_organization');");
}
else
{
alert("服务器异常,请与管理员联系");
}
}
);
}
</script>
</head> </head>
<!--add by huang--> <!--add by huang-->
<body> <body>
@ -83,13 +36,7 @@
</h2> </h2>
<p class="hidden"> <p class="hidden">
<%= l(:label_user_location) %> : <%= l(:label_user_location) %> :
<%= link_to l(:field_homepage), home_path %> <%= link_to l(:field_homepage), home_path %> > <a href="http://<%= Setting.host_name %>"><%=l(:label_project_hosting_platform) %> </a>><%= link_to @project.name, project_path(@project.id) %>
>
<a href="http://<%= Setting.host_name %>">
<%=l(:label_project_hosting_platform) %>
</a>
>
<%= link_to @project.name, project_path(@project.id) %>
</p> </p>
</div> </div>
<div class="search fl"> <div class="search fl">
@ -144,10 +91,11 @@
<%= l(:label_member) %><%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %> <%= l(:label_member) %><%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>
<span>|&nbsp;</span> <span>|&nbsp;</span>
<%= l(:label_user_watcher) %><%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %> <%= l(:label_user_watcher) %><%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<% unless @project.enabled_modules.where("name = 'files'").empty? %> <% unless @project.enabled_modules.where("name = 'files'").empty? %>
<span>|&nbsp;</span> <span>|&nbsp;</span>
<%= l(:project_module_attachments) %> <%= l(:project_module_attachments) %>
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> <% attaments_num %>
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %></span> <%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %></span>
<% end %> <% end %>
</div> </div>
@ -166,14 +114,14 @@
</ul> </ul>
<% end %><!--end--> <% end %><!--end-->
<!--menu 左侧工具栏 --> <!--menu 左侧工具栏 -->
<!--project_new_type: 1为开发组2为科研组3为朋友圈子--> <%#--project_new_type: 1为开发组2为科研组3为朋友圈子--%>
<div id="project_memu_list"> <div id="project_memu_list">
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %> <% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
<%= render :partial => 'projects/development_group', :locals => {:project => @project}%> <%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
<% elsif @project.project_new_type == 2 %> <% elsif @project.project_new_type == 2 %>
<%= render :partial => 'projects/research_team', :locals => {:project => @project}%> <%= render :partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num} %>
<% else %> <% else %>
<%= render :partial => 'projects/friend_group', :locals => {:project => @project}%> <%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
<% end %> <% end %>
</div> </div>
<!-- end --> <!-- end -->
@ -232,8 +180,55 @@
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label class="f14">&nbsp;&nbsp;圈子模式:<span class="f12 ml5 c_grey">为朋友圈提供简洁的交流和分享工具。</span></label></li> <li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label class="f14">&nbsp;&nbsp;圈子模式:<span class="f12 ml5 c_grey">为朋友圈提供简洁的交流和分享工具。</span></label></li>
</ul> </ul>
<a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a> <a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a>
</div> </div>
<!--项目的三种类型-->
<script type="text/javascript">
function click_ok(url)
{
$('#light').css('display','none');
$('#fade').css('display','none');
//ajax处理请求
var project_type;
if($("#development_group").attr("checked") == "checked"){
project_type = 1;
}
else if($("#research_group").attr("checked") == "checked"){
project_type = 2;
}
else if($("#friend_organization").attr("checked") == "checked"){
project_type = 3;
}
$.get(
url,
{ project_type: project_type},
function (data) {
if(data == 1)
{
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
$("#close_light").attr("onClick","close_window('development_group');");
}
else if(data == 2)
{
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
$("#close_light").attr("onClick","close_window('research_group');");
}
else if(data == 3)
{
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
$("#close_light").attr("onClick","close_window('friend_organization');");
}
else
{
alert("服务器异常,请与管理员联系");
}
}
);
}
</script>
</div> </div>
<div id="fade" class="black_overlay">123</div> <div id="fade" class="black_overlay">123</div>
<%= render :partial => 'layouts/new_feedback' %> <%= render :partial => 'layouts/new_feedback' %>

View File

@ -1,26 +1,35 @@
<li class="ml45"> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label>
<input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>"> <input type="text" name="news[title]" class="hwork_input_news" id="news_title" width="576px" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<p id="title_notice_span" class="ml55"></p> <p id="title_notice_span" class="ml55"></p>
</li> </li>
<li class="ml45"> <li class="mb10">
<% if is_new %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label> <label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<textarea id="news_description" name="news[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl" onkeyup="regexDescription();" maxlength="6000"><%= is_new ? '' : @news.description %></textarea> <%= f.kindeditor :description,:width=>'91%',:editor_id=>'project_news_description_editor' %>
<p id="description_notice_span" class="ml55"></p> <p id="description_notice_span" class="ml55"></p>
<% else %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<%= f.kindeditor :description,:width=>'91%', :editor_id=>'project_news_description_editor', :owner_id => @news.id, :owner_type => OwnerTypeHelper::NEWS %>
<p id="description_notice_span" class="ml55"></p>
<% end %>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ml45"> <li>
<label class="fl">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label> <label class="fl mt5">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<%= render :partial => 'attachments/new_form', :locals => {:container => @news} %> <%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class=" ml90" > <li class="ml40" >
<% if is_new %> <% if is_new %>
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %> <%= link_to l(:button_create), "javascript:void(0)", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), project_news_index_path(@project), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %> <%= link_to l(:button_cancel), project_news_index_path(@project), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
<% else %> <% else %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %> <%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %> <%= link_to l(:button_cancel), news_path(@news), :class => 'blue_btn grey_btn fl c_white' %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>

View File

@ -29,7 +29,7 @@
<%= 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) %>
<span class="fl"> <%= l(:label_add_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br /> <span class="fl"> <%= l(:label_add_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
<div class="cl mb5"></div> <div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="mt5 break_word"><%= news.description %><br /> </p> <p id="news_description_<%= news.id %>" class="mt5 break_word"><%=textAreailizable news.description %><br /> </p>
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div> <div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
<span class="f1"><%= l(:label_create_time) %> <%= format_time(news.created_on) %></span> <span class="f1"><%= l(:label_create_time) %> <%= format_time(news.created_on) %></span>
</div> </div>

View File

@ -82,8 +82,9 @@
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %> :onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %>
<%= delete_link news_path(@news),:class => 'talk_edit fr' if User.current.allowed_to?(:manage_news, @project) %> <%= delete_link news_path(@news),:class => 'talk_edit fr' if User.current.allowed_to?(:manage_news, @project) %>
<div class="cl"></div> <div class="cl"></div>
<div class="mb5" style="word-break:break-all;"><%= textAreailizable(@news, :description) %><br /> <%= l(:label_create_time) %> <%= format_time(@news.created_on) %></div> <div class="mb5" style="word-break:break-all;"><%= textAreailizable(@news, :description) %> </div>
<%= link_to_attachments_course @news %> <%= link_to_attachments_course @news %><br />
<%= l(:label_create_time) %> <%= format_time(@news.created_on) %>
<!--<a href="#" class=" link_file">附件爱覅俄方if.zip(27.5kB)</a> --> <!--<a href="#" class=" link_file">附件爱覅俄方if.zip(27.5kB)</a> -->
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,4 +1,3 @@
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %> <%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %> <% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
@ -8,9 +7,10 @@
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
<% unless @project.issues.visible.all.count == 0 %> <% if (issue_count = @project.issues.count) > 0 %>
<a class="subnav_num">(<%= @project.issues.visible.all.count %>)</a> <a class="subnav_num">(<%= issue_count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %> <%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
<% end %> <% end %>

View File

@ -1,4 +1,3 @@
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %> <%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %> <% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>

View File

@ -1,4 +1,3 @@
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %> <%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %> <% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
@ -8,8 +7,8 @@
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
<% unless @project.issues.count == 0 %> <% if (issue_count = @project.issues.count) > 0 %>
<a class="subnav_num">(<%= @project.issues.visible.all.count %>)</a> <a class="subnav_num">(<%= issue_count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %> <%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>

View File

@ -1,4 +1,4 @@
<!-- added by fq --> <!-- added by fq -->u
<!--huang--> <!--huang-->
<% if @user.user_extensions.identity == 0 %> <% if @user.user_extensions.identity == 0 %>
<%= render :partial => 'my_create_homework' %> <%= render :partial => 'my_create_homework' %>

View File

@ -90,6 +90,7 @@ default:
user_name: "huang.jingquan@163.com" user_name: "huang.jingquan@163.com"
password: 'xinhu1ji2qu366' password: 'xinhu1ji2qu366'
cookie_domain: ".trustie.net"
# Absolute path to the directory where attachments are stored. # Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance. # The default is the 'files' directory in your Redmine instance.
# Your Redmine instance needs to have write permission on this # Your Redmine instance needs to have write permission on this

View File

@ -353,7 +353,7 @@ zh:
# #
label_feedback: 意见反馈 label_feedback: 意见反馈
label_feedback_tips: "欢迎反馈网站问题,课程中遇到的问题请反馈给相关老师!" label_feedback_tips: "欢迎反馈网站问题,课程中遇到的问题请反馈给相关老师!"
label_technical_support: "技术支持:" label_technical_support: "QQ 在线支持:"
label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!" label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!"
label_feedback_value: "该帖来自用户反馈:)" label_feedback_value: "该帖来自用户反馈:)"

View File

@ -759,6 +759,7 @@ en:
button_create_and_continue: Create and continue button_create_and_continue: Create and continue
button_test: Test button_test: Test
button_edit: Edit button_edit: Edit
button_delete: Delete
button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}" button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
button_add: Add button_add: Add
button_change: Change button_change: Change

View File

@ -849,6 +849,7 @@ zh:
button_create_and_continue: 创建并继续 button_create_and_continue: 创建并继续
button_test: 测试 button_test: 测试
button_edit: 编辑 button_edit: 编辑
button_delete: 删除
button_edit_associated_wikipage: "编辑相关wiki页面: %{page_title}" button_edit_associated_wikipage: "编辑相关wiki页面: %{page_title}"
button_add: 新增 button_add: 新增
button_change: 修改 button_change: 修改

135
config/oneapm.yml Normal file
View File

@ -0,0 +1,135 @@
#
# OneApm RubyAgent Configuration
#
# Here are the settings that are common to all environments
common: &default_settings
# ============================== LICENSE KEY ===============================
#
# Get your license key from oneapm.com
#
license_key: 'BAQMBw8FUwR2542UFFpDXFgVVk66e2dZWB4EBlQHSf846wgBGwICFQoD0498BAEfBgNIAlQ='
# Agent Enabled (Ruby/Rails Only)
# Valid values are true, false and auto.
#
# agent_enabled: auto
# This app_name will be the application name in oneapm.com in your account.
#
# Caution: If you change this name, a new application will appear in the OneApm
# user interface with the new name, and data will stop reporting to the
# app with the old name.
#
app_name: trusite
# When "true", the agent collects performance data about your
# application and reports this data to the OneApm service at
# oneapm.com. This global switch is normally overridden for each
# environment below. (formerly called 'enabled')
monitor_mode: true
# Specify its log level here.
log_level: info
# log_file_path: 'log'
# log_file_name: 'oneapm_agent.log'
# The oneapm agent communicates with the service via https by default.
# ssl: true
# ======================== Browser Monitoring =============================
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 OneApm server.
#
# proxy_host: hostname
# proxy_port: 8080
# proxy_user:
# proxy_pass:
# 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
capture_params: false
# Transaction tracer captures deep information about slow
# transactions and sends this to the OneApm 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.
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
# OneApm. 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 OneApm 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 OneApm for viewing
error_collector:
# Error collector is enabled by default.
enabled: true
# Ignore the following errors, add your own.
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
# ===================== Application Environments ========================
# Environment-specific settings are in this section.
# For Rails applications, RAILS_ENV is used to determine the environment.
# NOTE if your application has other named environments, you should
# provide oneapm configuration settings for these environments here.
development:
<<: *default_settings
# Turn on communication to OneApm service in development mode
monitor_mode: true
app_name: My Application (Development)
test:
<<: *default_settings
monitor_mode: false
# Turn on the agent in production for 24x7 monitoring.
production:
<<: *default_settings
monitor_mode: true
# Staging environment which behaves identically to production.
staging:
<<: *default_settings
monitor_mode: true
app_name: My Application (Staging)

View File

@ -251,7 +251,7 @@ RedmineApp::Application.routes.draw do
post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
# boards end # boards end
post 'bids/homework_destroy', :to => 'bids#homework_destroy' delete 'bids/homework', :to => 'bids#homework_destroy'
# Misc issue routes. TODO: move into resources # Misc issue routes. TODO: move into resources
match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'

View File

@ -212,6 +212,7 @@ function regexTitle() {
} }
function regexDescription() { function regexDescription() {
project_news_description_editor.sync();
var name = $("#news_description").val(); var name = $("#news_description").val();
if (name.length == 0) { if (name.length == 0) {
$("#description_notice_span").text("描述不能为空"); $("#description_notice_span").text("描述不能为空");
@ -419,7 +420,7 @@ $(function(){
cookiesave(personalized_expand_key,JSON.stringify(personalized_map)); cookiesave(personalized_expand_key,JSON.stringify(personalized_map));
target.toggle(timeout); target.toggle(timeout);
} }
$("*[nhtype='toggle4cookie']").click(function(){ $("*[nhtype='toggle4cookie']").live('click',function(){
personalized_click($(this),500); personalized_click($(this),500);
}); });

View File

@ -330,6 +330,7 @@ a:hover.st_add{ color:#ff8e15;}
.hwork_new{ color:#4c4c4c;} .hwork_new{ color:#4c4c4c;}
.c_red{ color:#F00;} .c_red{ color:#F00;}
.hwork_input{ border:1px solid #64bdd9; height:22px; width:555px; background:#fff; margin-bottom:10px; padding:5px;} .hwork_input{ border:1px solid #64bdd9; height:22px; width:555px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_input_news{ border:1px solid #64bdd9; height:22px; width:594px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_input02{ border:1px solid #64bdd9; height:15px; width:120px; background:#fff; margin-bottom:10px; padding:5px;} .hwork_input02{ border:1px solid #64bdd9; height:15px; width:120px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;} .hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.hwork_new ul li{ } .hwork_new ul li{ }

View File

@ -287,7 +287,8 @@ html{ overflow-x:hidden;}
.close_btn span { display:none;} .close_btn span { display:none;}
.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} .side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;}
.msgserver { margin-top:5px;} .msgserver { margin-top:5px;}
.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; } /*.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }*/
.msgserver a { padding-left:4px; height:21px; display:block; }
.opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;} .opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;}
a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;}
a:hover.opnionButton{background: #0fa9bb; } a:hover.opnionButton{background: #0fa9bb; }

View File

@ -0,0 +1,52 @@
require 'rails_helper'
require 'shared_account_spec'
RSpec.describe "homework", type: :request do
include_context "create user"
let(:course) {FactoryGirl.create(:course, teacher: current_user)}
let(:homework){FactoryGirl.attributes_for(:homework)}
before {
shared_register
}
describe "创建作业" do
before do
post calls_create_homework_path(course_id: course.id), {
bid: homework
}
@homework = assigns(:bid)
end
it "参数正确,可以成功创建作业" do
expect(response).to redirect_to(course_homework_url(course.id))
end
it {expect(course.homeworks).to_not be_empty}
it {expect(@homework.acts).to_not be_empty}
it {expect(@homework.watchers).to_not be_empty}
it {expect(@homework.attachments).to_not be_empty}
end
describe "删除作业" do
before do
shared_login
post calls_create_homework_path(course_id: course.id), {
bid: homework
}
@homework = assigns(:bid)
delete bids_homework_path(id: @homework.id)
end
it{expect(response).to redirect_to(course_homework_path(course.id))}
it "homework_for_courses应删除" do
expect(course.homeworks).to be_empty
end
it "相关活动也删除" do
expect(@homework.acts).to be_empty
end
it "watches 删除" do
expect(@homework.watchers).to be_empty
end
it "附件 删除" do
expect(@homework.attachments).to be_empty
end
end
end