Merge branch 'guange_dev' into develop
This commit is contained in:
commit
ec42497417
|
@ -336,7 +336,7 @@ class AccountController < ApplicationController
|
|||
:expires => 1.month.from_now,
|
||||
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
||||
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
||||
:domain => '.trustie.net',
|
||||
:domain => Redmine::Configuration['cookie_domain'],
|
||||
:httponly => true
|
||||
}
|
||||
cookies[autologin_cookie_name] = cookie_options
|
||||
|
|
|
@ -199,7 +199,7 @@ class ApplicationController < ActionController::Base
|
|||
# Logs out current user
|
||||
def logout_user
|
||||
if User.current.logged?
|
||||
cookies.delete(autologin_cookie_name)
|
||||
cookies.delete(autologin_cookie_name, domain: Redmine::Configuration['cookie_domain'])
|
||||
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
|
||||
self.logged_user = nil
|
||||
end
|
||||
|
|
|
@ -675,11 +675,12 @@ class BidsController < ApplicationController
|
|||
#删除作业
|
||||
#by xianbo
|
||||
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
|
||||
@bid_to_destroy.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.html { redirect_to course_url }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
|
|
|
@ -130,7 +130,7 @@ class IssuesController < ApplicationController
|
|||
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
|
||||
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
|
||||
|
||||
respond_to do |format|
|
||||
respond_to do |format|``
|
||||
format.html {
|
||||
retrieve_previous_and_next_issue_ids
|
||||
render :template => 'issues/show', :layout => @project_base_tag#by young
|
||||
|
|
|
@ -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>
|
||||
<% if @is_teacher%>
|
||||
<%= 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") %>
|
||||
<% elsif @is_student%>
|
||||
<%= student_anonymous_comment bid %>
|
||||
|
@ -59,4 +62,4 @@
|
|||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -51,8 +51,8 @@
|
|||
<% if @issue.safe_attribute? 'description' %>
|
||||
<label class="label"> 描述 : </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? %>
|
||||
<%= content_tag 'span', :id => "issue_description_and_toolbar" do %>
|
||||
<%#= 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 %>
|
||||
<%= f.kindeditor :description,:editor_id => "issue_desc_editor",
|
||||
# :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
|
||||
# :accesskey => accesskey(:edit),
|
||||
|
@ -60,7 +60,7 @@
|
|||
:width=>'87%',
|
||||
:resizeType => 0,
|
||||
:no_label => true %>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
<%#= wikitoolbar_for 'issue_description' %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
|
|
@ -124,18 +124,12 @@
|
|||
<%= render :partial => 'changesets', :locals => {:changesets => @changesets} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<!--留言-- end>
|
||||
<!--<div style="clear: both;"></div>-->
|
||||
<!--<%#= render :partial => 'action_menu' %>-->
|
||||
|
||||
|
||||
<div class="cl"></div>
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<%= f.link_to 'PDF' %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'issues/sidebar' %>
|
||||
<br>
|
||||
|
|
|
@ -18,54 +18,7 @@
|
|||
<!-- page specific 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>
|
||||
<!--add by huang-->
|
||||
<body>
|
||||
|
@ -83,13 +36,7 @@
|
|||
</h2>
|
||||
<p class="hidden">
|
||||
<%= l(:label_user_location) %> :
|
||||
<%= 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) %>
|
||||
<%= 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) %>
|
||||
</p>
|
||||
</div>
|
||||
<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' %>)
|
||||
<span>| </span>
|
||||
<%= 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? %>
|
||||
<span>| </span>
|
||||
<%= 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>)
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -166,14 +114,14 @@
|
|||
</ul>
|
||||
<% end %><!--end-->
|
||||
<!--menu 左侧工具栏 -->
|
||||
<!--project_new_type: 1为开发组;2为科研组;3为朋友圈子-->
|
||||
<%#--project_new_type: 1为开发组;2为科研组;3为朋友圈子--%>
|
||||
<div id="project_memu_list">
|
||||
<% 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 %>
|
||||
<%= render :partial => 'projects/research_team', :locals => {:project => @project}%>
|
||||
<%= render :partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||
<% else %>
|
||||
<%= render :partial => 'projects/friend_group', :locals => {:project => @project}%>
|
||||
<%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
@ -232,8 +180,55 @@
|
|||
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label class="f14"> 圈子模式:<span class="f12 ml5 c_grey">为朋友圈提供简洁的交流和分享工具。</span></label></li>
|
||||
</ul>
|
||||
<a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a>
|
||||
|
||||
</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 id="fade" class="black_overlay">123</div>
|
||||
<%= render :partial => 'layouts/new_feedback' %>
|
||||
|
|
|
@ -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">
|
||||
<%= 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 %>
|
||||
|
|
|
@ -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">
|
||||
<%= 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 %>
|
||||
|
|
|
@ -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">
|
||||
<%= 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 %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- added by fq -->
|
||||
<!-- added by fq -->u
|
||||
<!--huang-->
|
||||
<% if @user.user_extensions.identity == 0 %>
|
||||
<%= render :partial => 'my_create_homework' %>
|
||||
|
|
|
@ -90,6 +90,7 @@ default:
|
|||
user_name: "huang.jingquan@163.com"
|
||||
password: 'xinhu1ji2qu366'
|
||||
|
||||
cookie_domain: ".trustie.net"
|
||||
# Absolute path to the directory where attachments are stored.
|
||||
# The default is the 'files' directory in your Redmine instance.
|
||||
# Your Redmine instance needs to have write permission on this
|
||||
|
|
|
@ -759,6 +759,7 @@ en:
|
|||
button_create_and_continue: Create and continue
|
||||
button_test: Test
|
||||
button_edit: Edit
|
||||
button_delete: Delete
|
||||
button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
|
||||
button_add: Add
|
||||
button_change: Change
|
||||
|
|
|
@ -849,6 +849,7 @@ zh:
|
|||
button_create_and_continue: 创建并继续
|
||||
button_test: 测试
|
||||
button_edit: 编辑
|
||||
button_delete: 删除
|
||||
button_edit_associated_wikipage: "编辑相关wiki页面: %{page_title}"
|
||||
button_add: 新增
|
||||
button_change: 修改
|
||||
|
|
|
@ -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/destroy', :to => 'messages#destroy'
|
||||
# boards end
|
||||
post 'bids/homework_destroy', :to => 'bids#homework_destroy'
|
||||
delete 'bids/homework', :to => 'bids#homework_destroy'
|
||||
|
||||
# Misc issue routes. TODO: move into resources
|
||||
match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue