From 5d1d56fbb3b7371e55465f8b691380959475ad82 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 8 Mar 2016 16:44:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=94=B9=E6=88=90https://www.=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 70 +++++++++++++++++++ .../_org_course_homework.html.erb | 4 +- .../organizations/_org_project_issue.html.erb | 4 +- .../organizations/_project_create.html.erb | 10 +-- .../organizations/_project_message.html.erb | 7 +- .../organizations/_show_org_document.html.erb | 2 +- app/views/users/_show_detail_info.html.erb | 2 +- 7 files changed, 84 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c19c44935..2233aeb16 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2905,3 +2905,73 @@ def user_url_in_org(user_id) return "https://www.trustie.net/users/" + user_id.to_s end end + +def project_issues_url_in_org(project_id) + if Rails.env.development? + return "http://localhost:3000/projects/" + project_id.to_s + "/issues" + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/projects/" + project_id.to_s + "/issues" + else + return "https://www.trustie.net/projects/" + project_id.to_s + "/issues" + end +end + +def issue_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/issues/" + id.to_s + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/issues/" + id.to_s + else + return "https://www.trustie.net/issues/" + id.to_s + end +end + +def project_boards_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/projects/" + id.to_s + "/boards" + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/projects/" + id.to_s + "/boards" + else + return "https://www.trustie.net/projects/" + id.to_s + "/boards" + end +end + +def board_message_url_in_org(board_id, message_id) + if Rails.env.development? + return "http://localhost:3000/boards/" + board_id.to_s + "/topics/" + message_id.to_s + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/boards/" + board_id.to_s + "/topics/" + message_id.to_s + else + return "https://www.trustie.net/boards/" + board_id.to_s + "/topics/" + message_id.to_s + end +end + +def project_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/projects/" + id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/projects/" + id.to_s + else + return "https://www.trustie.net/projects/" + id.to_s + end +end + +def homework_common_index_url_in_org(course_id) + if Rails.env.development? + return "http://localhost:3000/homework_common?course=" + course_id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/homework_common?course=" + course_id.to_s + else + return "https://www.trustie.net/homework_common?course=" + course_id.to_s + end +end + +def student_work_index_url_in_org(homework_id) + if Rails.env.development? + return "http://localhost:3000/student_work?homework=" + homework_id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/student_work?homework=" + course_id.to_s + else + return "https://www.trustie.net/student_work?homework=" + course_id.to_s + end +end diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 0dd9fb725..8b28c7a60 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -12,10 +12,10 @@ <% else %> <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%> + <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_url_in_org(activity.course.id), :class => "newsBlue ml15"%> <% if activity.homework_detail_manual%> <% if activity.homework_detail_manual.comment_status == 1%> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 855a8053c..9b7dbfa8f 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.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.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> + <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_url_in_org(activity.project.id), :class => "newsBlue ml15"%>
- <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> + <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :class => "postGrey" %> <%#= get_issue_priority(activity.priority_id)[1] %> diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb index e13f4128b..5003fd0e2 100644 --- a/app/views/organizations/_project_create.html.erb +++ b/app/views/organizations/_project_create.html.erb @@ -3,21 +3,21 @@
- <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %>
<% if user.try(:realname) == ' ' %> - <%= link_to user, user_url_in_org(user), :class => "newsBlue mr15" %> + <%= link_to user, user_url_in_org(user.id), :class => "newsBlue mr15" %> <% else %> - <%= link_to user.try(:realname), user_url_in_org(user), :class => "newsBlue mr15" %> + <%= link_to user.try(:realname), user_url_in_org(user.id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> + <%= link_to project.to_s+" | 项目", project_url_in_org(project.id), :class => "newsBlue ml15" %>
- <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> + <%= link_to project.name, project_url_in_org(project.id), :class => "postGrey" %>
创建时间:<%= format_time(project.created_on) %> diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index 3b459f366..a818939d6 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -12,16 +12,15 @@ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%> + <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_url_in_org(activity.project.id), :class => "newsBlue ml15 mr5"%>
<% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,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,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 %>
diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 2584e4209..e3ed492a0 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -111,7 +111,7 @@
- <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current) %> + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %>
diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index f2a2faeb3..3ebcab21e 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -1,6 +1,6 @@
- <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像", :target => '_blank' %> + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像", :target => '_blank' %> <%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>