diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 42911cc33..3a5cdb1a1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -370,7 +370,7 @@ module ApplicationHelper
def link_to_short_attachment(attachment, options={})
length = options[:length] ? options[:length]:23
text = h(truncate(options.delete(:text) || attachment.filename, length: length, omission: '...'))
- route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
+ route_method = options.delete(:download) ? :download_named_attachment_url_without_domain : :named_attachment_url_without_domain
html_options = options.slice!(:only_path)
url = send(route_method, attachment, attachment.filename, options)
link_to text, url, html_options
@@ -841,7 +841,7 @@ module ApplicationHelper
def project_member_check_box_tags_ex name, principals
s = ''
principals.each do |principal|
- s << "
#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id)}\n"
+ s << "#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_url_in_org( principal.id)}\n"
end
s.html_safe
end
@@ -2582,9 +2582,9 @@ module ApplicationHelper
elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
- link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
+ link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
when 2
- link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
+ link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end
@@ -2631,7 +2631,7 @@ module ApplicationHelper
def user_for_homework_common homework,is_teacher
if User.current.member_of_course?(homework.course)
if is_teacher #老师显示作品数量
- link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
+ link_to "作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
project = cur_user_projects_for_homework homework
@@ -2639,30 +2639,30 @@ module ApplicationHelper
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
else
- link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
+ link_to "提交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
end
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
else
- link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red'
+ link_to "补交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
- link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
+ link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
- link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
+ link_to "查看作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
- link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
+ link_to "修改作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
- link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
+ link_to "修改作品(#{homework.student_works.count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
else
- link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
+ link_to "查看作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
end
end
end
else
- link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
+ link_to "作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id),:class => "c_blue"
end
end
@@ -3021,6 +3021,24 @@ end
def register_url_without_domain
Setting.protocol + "://" + Setting.host_name + "/login?login=false"
end
+
+def new_student_work_url_without_domain(homework_id)
+ Setting.protocol + "://" + Setting.host_name + "/student_work/new?homework=" + homework_id.to_s
+end
+
+def edit_student_work_url_without_domain(homework_id)
+ Setting.protocol + "://" + Setting.host_name + "/student_work/" + homework_id.to_s + "/edit"
+end
+
+def download_named_attachment_url_without_domain(id, filename, option={})
+ attachment_id = (Attachment === id ? id.id : id)
+ Setting.protocol + "://" + Setting.host_name + "/attachments/download/" + attachment_id.to_s + "/" + filename
+end
+
+def named_attachment_url_without_domain(id, filename, option={})
+ attachment_id = (Attachment === id ? id.id : id)
+ Setting.protocol + "://" + Setting.host_name + "/attachments/" + attachment_id.to_s + "/" + filename
+end
#判断是否为默认的组织栏目
def is_default_field? field
(field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default'
diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb
index e6af795a9..025bb48af 100644
--- a/app/views/organizations/_org_course_homework.html.erb
+++ b/app/views/organizations/_org_course_homework.html.erb
@@ -73,7 +73,7 @@
<% if activity.homework_type == 2 && is_teacher%>
- <%= link_to "模拟答题", "https://www.trustie.net/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
+ <%= link_to "模拟答题", Setting.protocol + "://" + Setting.host_name + "/users/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
<% end %>
<% if activity.homework_type == 2%>
@@ -154,7 +154,7 @@
<% end %>
<% student_works.each_with_index do |sw, i| %>
-
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
+ <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id), :alt => "学生头像" %>
<%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id)%>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
@@ -245,7 +245,7 @@
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
- <%= link_to("禁用匿评", Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_forbidden_anonymous_comment?user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink",
+ <%= link_to("禁用匿评", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_forbidden_anonymous_comment?user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品",:remote => true)%>
<% end %>
diff --git a/app/views/organizations/_org_course_poll.html.erb b/app/views/organizations/_org_course_poll.html.erb
index cfd2fcb65..10d1919a2 100644
--- a/app/views/organizations/_org_course_poll.html.erb
+++ b/app/views/organizations/_org_course_poll.html.erb
@@ -22,9 +22,9 @@
<%#= link_to activity.polls_name.to_s/*+"(问卷名称)"*/, %>
<% if has_commit %>
- <%= link_to poll_name, poll_result_poll_path(activity.id), :class => "postGrey"%>
+ <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :class => "postGrey"%>
<% else %>
- <%= link_to poll_name, poll_path(activity.id), :class => "postGrey"%>
+ <%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s, :class => "postGrey"%>
<% end %>
diff --git a/app/views/organizations/_org_member_list.html.erb b/app/views/organizations/_org_member_list.html.erb
index f5a277634..fb22716ff 100644
--- a/app/views/organizations/_org_member_list.html.erb
+++ b/app/views/organizations/_org_member_list.html.erb
@@ -1,9 +1,9 @@
<% members.each do |member|%>
- - <%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %>
+ - <%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %>
-
<%= get_org_member_role_name member %>
- <%= form_for(member, {:as => :org_member, :remote => true, :url => org_member_path(member),
+ <%= form_for(member, {:as => :org_member, :remote => true, :url => Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,
:method => :put,
:html => {:id => "org-member-#{member.id}-roles-form", :style=>'display:none'}}
) do |f| %>
@@ -32,7 +32,7 @@
<% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%>
编辑
- <%= link_to '删除', org_member_path(member.id),:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
+ <%= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/praise_tread/_praise.html.erb b/app/views/praise_tread/_praise.html.erb
index 63b57f8a6..a1a34636f 100644
--- a/app/views/praise_tread/_praise.html.erb
+++ b/app/views/praise_tread/_praise.html.erb
@@ -1,11 +1,11 @@
<% if PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",activity.id,activity.class.to_s,User.current.id).empty? %>
-
+
赞
<% num = get_praise_num(activity) %>
<%= num > 0 ? "(#{num})" : "" %>
<% else %>
-
+
已赞
<% num = get_praise_num(activity) %>
<%= num > 0 ? "(#{num})" : "" %>
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb
index 3b035179b..7de1ce417 100644
--- a/app/views/users/_user_message_course.html.erb
+++ b/app/views/users/_user_message_course.html.erb
@@ -392,7 +392,7 @@
<% end %>
<% end %>
- <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
+ <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>