diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index f250b46de..d1a8b23dd 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -1,6 +1,6 @@ class OrgDocumentCommentsController < ApplicationController before_filter :find_organization, :only => [:new, :create, :show, :index] - helper :attachments + helper :attachments,:organizations layout 'base_org' def new diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2233aeb16..47b735ff4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2975,3 +2975,94 @@ def student_work_index_url_in_org(homework_id) return "https://www.trustie.net/student_work?homework=" + course_id.to_s end end + +def course_url_in_org(course_id) + if Rails.env.development? + return "http://localhost:3000/courses/" + course_id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/courses/" + course_id.to_s + else + return "https://www.trustie.net/courses/" + course_id.to_s + end +end + +def user_watchlist_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/users/" + id.to_s + "/user_watchlist" + elsif Rails.env.test? + return "https://test.forge.trustie.net/users/" + id.to_s + "/user_watchlist" + else + return "https://www.trustie.net/users/" + id.to_s + "/user_watchlist" + end +end + +def user_fanslist_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/users/" + id.to_s + "/user_fanslist" + elsif Rails.env.test? + return "https://test.forge.trustie.net/users/" + id.to_s + "/user_fanslist" + else + return "https://www.trustie.net/users/" + id.to_s + "/user_fanslist" + end +end + +def user_blogs_url_in_org(user_id) + if Rails.env.development? + return "http://localhost:3000/users/" + user_id.to_s + "/blogs" + elsif Rails.env.test? + return "https://test.forge.trustie.net/users/" + user_id.to_s + "/blogs" + else + return "https://www.trustie.net/users/" + user_id.to_s + "/blogs" + end +end + +def feedback_url_in_org(user_id) + if Rails.env.development? + return "http://localhost:3000/users/" + user_id.to_s + "/user_newfeedback" + elsif Rails.env.test? + return "https://test.forge.trustie.net/users/" + user_id.to_s + "/user_newfeedback" + else + return "https://www.trustie.net/users/" + user_id.to_s + "/user_newfeedback" + end +end + +def user_activities_url_in_org(user_id) + if Rails.env.development? + return "http://localhost:3000/users/" + user_id.to_s + "/user_activities" + elsif Rails.env.test? + return "http://test.forge.trustie.net/users/" + user_id.to_s + "/user_activities" + else + return "http://www.trustie.net/users/" + user_id.to_s + "/user_activities" + end +end + +def course_news_index_url_in_org(course_id) + if Rails.env.development? + return "http://localhost:3000/courses/" + course_id.to_s + "/news" + elsif Rails.env.test? + return "https://test.forge.trustie.net/courses/" + course_id.to_s + "/news" + else + return "https://www.trustie.net/courses/" + course_id.to_s + "/news" + end +end + +def news_url_in_org(news_id) + if Rails.env.development? + return "http://localhost:3000/news/" + news_id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/news/" + news_id.to_s + else + return "https://www.trustie.net/news/" + news_id.to_s + end +end + +def course_boards_url_in_org(course_id) + if Rails.env.development? + return "http://localhost:3000/courses/" + news_id.to_s + "/boards" + elsif Rails.env.test? + return "https://test.forge.trustie.net/courses/" + news_id.to_s + "/boards" + else + return "https://www.trustie.net/courses/" + news_id.to_s + "/boards" + end +end + diff --git a/app/views/layouts/_org_courses.html.erb b/app/views/layouts/_org_courses.html.erb index 648f62ecf..282447f0f 100644 --- a/app/views/layouts/_org_courses.html.erb +++ b/app/views/layouts/_org_courses.html.erb @@ -1,7 +1,7 @@ <% courses.each do |course|%> <%# pro = Project.find course.course_id %> <li class="homepageLeftMenuCoursesLine" style="position:relative;"> - <%= link_to course.name, course_path(course.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => course.name%> + <%= link_to course.name, course_url_in_org(course.id), :class => "coursesLineGrey hidden", :title => course.name%> <!--<div class="homepagePostSetting mt5 mr10">--> <!--<ul>--> <!--<li class="menuSetting">--> diff --git a/app/views/layouts/_org_projects.html.erb b/app/views/layouts/_org_projects.html.erb index 2e5041d20..b4ddccd9b 100644 --- a/app/views/layouts/_org_projects.html.erb +++ b/app/views/layouts/_org_projects.html.erb @@ -1,7 +1,7 @@ <% projects.each do |project|%> <%# pro = Project.find project.project_id %> <li class="homepageLeftMenuCoursesLine" style="position:relative;"> - <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => project.name%> + <%= link_to project.name, project_url_in_org(project.id), :class => "coursesLineGrey hidden", :title => project.name%> <!--<div class="homepagePostSetting mt5 mr10">--> <!--<ul>--> <!--<li class="menuSetting">--> diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index be504a674..f5b186197 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -8,11 +8,11 @@ <div class="resources" id="organization_document_<%= @document.id %>"> <div class="homepagePostBrief"> <div class="homepagePostPortrait"> - <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_path(@document.creator_id) %> + <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> </div> <div class="homepagePostDes"> <div class="homepagePostTo"> - <%= link_to User.find(@document.creator_id), user_path(@document.creator.id), :class => "newsBlue mr15" %> + <%= link_to User.find(@document.creator_id), user_url_in_org(@document.creator_id), :class => "newsBlue mr15" %> TO <%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %> | <% if @document.organization.home_id == @document.id %> @@ -89,10 +89,10 @@ <% user = User.find(reply.creator_id) %> <div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id %>').hide();"> <div class="homepagePostReplyPortrait"> - <%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_path(user) %> + <%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_url_in_org(user.id) %> </div> <div class="homepagePostReplyDes"> - <%= link_to User.find(reply.creator_id).realname, user_path(reply.creator_id), :class => "newsBlue mr10 f14" %> + <%= link_to User.find(reply.creator_id).realname, user_url_in_org(reply.creator_id), :class => "newsBlue mr10 f14" %> <div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>"> <%= reply.content.html_safe unless reply.content.nil? %> </div> diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 8b28c7a60..6900cbd34 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -47,7 +47,7 @@ <% end%> <div class="cl"></div> <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%> - <span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span> + <span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", "https://www.trustie.net/projects/new",:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span> <% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%> <span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span> <% end %> @@ -73,7 +73,7 @@ <% if activity.homework_type == 2 && is_teacher%> <div class="homepagePostSubmit"> - <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> + <%= 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: '教师可以通过模拟答题设置作业的标准答案' %> </div> <% end %> <% if activity.homework_type == 2%> @@ -129,7 +129,7 @@ <% if activity.student_works.count != 0 %> <% sw = activity.student_works.reorder("created_at desc").first %> <div class="mt10 homepagePostDeadline mb10"> - # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 + # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_url_in_org(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 </div> <% end %> <div class="cl"></div> @@ -141,7 +141,7 @@ <% last_score = student_work_scores.first %> <div> <p class="mb10 fontGrey2"># <%=time_from_now last_score.created_at %> - <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行: + <%= link_to last_score.user.show_name, user_activities_url_in_org(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行: </p> </div> <% end %> @@ -155,7 +155,7 @@ <% student_works.each_with_index do |sw, i| %> <div class="fl mr10 w100" style="text-align:center;"> <a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> - <p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p> + <p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id)%></p> </a> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> <p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p> @@ -165,7 +165,7 @@ <% end %> <% end %> <% if student_works.count > 5 %> - <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%> + <%= link_to "更多>>", student_work_index_url_in_org(activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%> <% end %> <div class="cl"></div> </div> @@ -177,7 +177,7 @@ <% sort_projects = project_sort_update projects %> <div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>"> <div class="mr5 fontGrey2"> - # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: + # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_url_in_org(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: </div> <div class="cl"></div> <% sort_projects.each_with_index do |pro, i| %> diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb index 99229634e..f4d42150b 100644 --- a/app/views/organizations/_org_course_message.html.erb +++ b/app/views/organizations/_org_course_message.html.erb @@ -12,13 +12,13 @@ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%> + <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_url_in_org(activity.course), :class => "newsBlue ml15 mr5"%> </div> <div class="homepagePostTitle hidden m_w530 fl"> <% if activity.parent_id.nil? %> <!--+"(帖子标题)"--> - <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %> + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :class=> "postGrey" %> <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :class=> "postGrey"%> <% end %> </div> <% if activity.sticky == 1%> diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index ecdf728f8..7f50b3725 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -11,10 +11,10 @@ <% else %> <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO <!--+"(课程名称)"--> - <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %> + <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_url_in_org(activity.course.id), :class => "newsBlue ml15" %> </div> <div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"--> - <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %> + <%= link_to activity.title.to_s, news_url_in_org(activity.id), :class => "postGrey" %> </div> <% if activity.sticky == 1%> <span class="sticky_btn_cir ml10">置顶</span> diff --git a/app/views/organizations/_org_members.html.erb b/app/views/organizations/_org_members.html.erb index 53618fc92..b846b940f 100644 --- a/app/views/organizations/_org_members.html.erb +++ b/app/views/organizations/_org_members.html.erb @@ -14,7 +14,7 @@ <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %> </a> <span class="fl ml10 c_grey"><%= l(:label_username)%></span> - <%= link_to(member.user.show_name, user_path(member.user),:class => "ml5 c_blue02") %><br /> + <%= link_to(member.user.show_name, user_url_in_org(member.user_id),:class => "ml5 c_blue02") %><br /> <span class="fl c_grey ml10">身份:<%= member.user.admin_of_org?(organization)?"组织管理员":"组织成员" %></span> <% if member.created_at %> <span class="fr c_grey"><%= format_time(member.created_at) %></span> diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index 3ebcab21e..7d4919149 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -21,18 +21,18 @@ <div class="cl"></div> <div> <div class="homepageImageBlock mb10"> - <div><%= link_to User.watched_by(user.id).count, {:controller=>"users", :action=>"user_watchlist",:id=>user.id}, :class => 'homepageImageNumber',:target => "_blank" %></div> - <div class="homepageImageText"><%= link_to '关注',{:controller=>"users", :action=>"user_watchlist",:id=>user.id},:target => "_blank" %></div> + <div><%= link_to User.watched_by(user.id).count, user_watchlist_url_in_org(user.id), :class => 'homepageImageNumber',:target => "_blank" %></div> + <div class="homepageImageText"><%= link_to '关注',user_watchlist_url_in_org(user.id),:target => "_blank" %></div> </div> <div class="homepageVerDiv"></div> <div class="homepageImageBlock"> - <div><%= link_to user.watcher_users.count,{:controller=>"users", :action=>"user_fanslist",:id=>user.id}, :class => "homepageImageNumber fans_count_#{user.id}",:target => "_blank" %></div> - <div class="homepageImageText"><%= link_to '粉丝', {:controller=>"users", :action=>"user_fanslist",:id=>user.id},:target => "_blank" %></div> + <div><%= link_to user.watcher_users.count,user_fanslist_url_in_org(user.id), :class => "homepageImageNumber fans_count_#{user.id}",:target => "_blank" %></div> + <div class="homepageImageText"><%= link_to '粉丝', user_fanslist_url_in_org(user.id),:target => "_blank" %></div> </div> <div class="homepageVerDiv"></div> <div class="homepageImageBlock"> - <div><%= link_to user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count, user_blogs_path(user), :class => 'homepageImageNumber',:target => "_blank" %></div> - <div class="homepageImageText"><%= link_to '博客', user_blogs_path(user),:target => "_blank" %></div> + <div><%= link_to user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count, user_blogs_url_in_org(user.id), :class => 'homepageImageNumber',:target => "_blank" %></div> + <div class="homepageImageText"><%= link_to '博客', user_blogs_url_in_org(user.id),:target => "_blank" %></div> </div> <div class="cl"></div> <% if User.current != user %> @@ -40,8 +40,8 @@ <%= render :partial => 'users/watch_btn_for_picture', :locals => {:user => user} %> </div> <!--<a href="javascript:void(0);" class="userFollow mr27 fl">添加关注</a> <a href="javascript:void(0);" class="userCancel mr27 fl" style="display:none;">取消关注</a>--> - <%= link_to "留言", feedback_path(user), :class => 'greyBtn fr', :target => "_blank" %> - <%= link_to "私信", feedback_path(user), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %> + <%= link_to "留言", feedback_url_in_org(user.id), :class => 'greyBtn fr', :target => "_blank" %> + <%= link_to "私信", feedback_url_in_org(user.id), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %> <!--<a href="javascript:void(0);" class="greyBtn fl">私信</a><a href="javascript:void(0);" class="greyBtn fr">留言</a> --> <% end %> </div>