diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8c5d4acea..e35d0cebe 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2897,183 +2897,75 @@ int main(int argc, char** argv){ end def user_url_in_org(user_id) - if Rails.env.development? - return "http://localhost:3000/users/" + user_id.to_s - elsif Rails.env.test? - return "https://www.test.forge.trustie.net/users/" + user_id.to_s - else - return "https://www.trustie.net/users/" + user_id.to_s - end + Setting.host_name + "/users/" + user_id.to_s 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 + Setting.host_name + "/projects/" + project_id.to_s + "/issues" 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 + Setting.host_name + "/issues/" + id.to_s 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 + Setting.host_name + "/projects/" + id.to_s + "/boards" 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 + Setting.host_name + "/boards/" + board_id.to_s + "/topics/" + message_id.to_s 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 + Setting.host_name + "/projects/" + id.to_s 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 + Setting.host_name + "/homework_common?course=" + course_id.to_s 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 + Setting.host_name + "/student_work?homework=" + homework_id.to_s 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 + Setting.host_name + "/courses/" + course_id.to_s 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 + Setting.host_name + "/users/" + id.to_s + "/user_watchlist" 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 + Setting.host_name + "/users/" + id.to_s + "/user_fanslist" 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 + Setting.host_name + "/users/" + user_id.to_s + "/blogs" 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 + Setting.host_name + "/users/" + user_id.to_s + "/user_newfeedback" 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 + Setting.host_name + "/users/" + user_id.to_s + "/user_activities" 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 + Setting.host_name + "/courses/" + course_id.to_s + "/news" 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 + Setting.host_name + "/news/" + news_id.to_s end def course_boards_url_in_org(course_id) - if Rails.env.development? - return "http://localhost:3000/courses/" + course_id.to_s + "/boards" - elsif Rails.env.test? - return "https://test.forge.trustie.net/courses/" + course_id.to_s + "/boards" - else - return "https://www.trustie.net/courses/" + course_id.to_s + "/boards" - end + Setting.host_name + "/courses/" + course_id.to_s + "/boards" end def logout_url_without_domain - if Rails.env.development? - return "http://localhost:3000/logout" - elsif Rails.env.test? - return "https://test.forge.trustie.net/logout" - else - return "https://www.trustie.net/logout" - end + Setting.host_name + "/logout" end #判断是否为默认的组织栏目 diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 6900cbd34..2bc00d6b1 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -194,7 +194,7 @@
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_url_in_org(project.id),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> <% else %> <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> <% end %> @@ -227,17 +227,17 @@
  • diff --git a/app/views/organizations/_org_course_poll.html.erb b/app/views/organizations/_org_course_poll.html.erb index c124e829f..fff50786e 100644 --- a/app/views/organizations/_org_course_poll.html.erb +++ b/app/views/organizations/_org_course_poll.html.erb @@ -16,7 +16,7 @@ <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", poll_index_path(:polls_type => "Course", :polls_group_id => activity.polls_group_id), :class => "newsBlue ml15" %> + <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", Setting.host_name + "/poll?polls_type=Course&polls_group_id=" + activity.polls_group_id.to_s, :class => "newsBlue ml15" %>
  • diff --git a/app/views/users/_watch_btn_for_picture.html.erb b/app/views/users/_watch_btn_for_picture.html.erb index e604be318..be8673468 100644 --- a/app/views/users/_watch_btn_for_picture.html.erb +++ b/app/views/users/_watch_btn_for_picture.html.erb @@ -2,8 +2,8 @@ <%= link_to("编辑资料", my_account_path, :class => "fl UsersEditBtn") %> <% else %> <%if(user.watched_by?(User.current))%> - <%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>user.id,:target_id=>user.id),:class => "userFollow mr27 fl", :method => "delete",:remote => "true", :title => "取消关注"%> + <%= link_to "取消关注",Setting.host_name + "/watch?object_type=user&object_id="+user.id.to_s + "&target_id="+user.id.to_s,:class => "userFollow mr27 fl", :method => "delete",:remote => "true", :title => "取消关注"%> <% else %> - <%= link_to "添加关注",watch_path(:object_type=> 'user',:object_id=>user.id,:target_id=>user.id),:class => "userFollow mr27 fl", :method => "post",:remote => "true", :title => "添加关注"%> + <%= link_to "添加关注",Setting.host_name + "/watch?object_type=user&object_id="+user.id.to_s + "&target_id="+user.id.to_s,:class => "userFollow mr27 fl", :method => "post",:remote => "true", :title => "添加关注"%> <% end %> <% end %> \ No newline at end of file