diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b5b6c5bd0..4352de732 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1360,7 +1360,7 @@ module ApplicationHelper :id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent) end end - link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new'))) + link_to(title.present? ? title.html_safe : h(page), User.current.logged? ? url : signin_url_without_domain, :class => ('wiki-page' + (wiki_page ? '' : ' new'))) else # project or wiki doesn't exist all @@ -2881,7 +2881,7 @@ module ApplicationHelper def file_preview_eye(file, html_options={}) if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)} - link_to '', download_named_attachment_path(file.id, file.filename, preview: true),html_options + link_to '', User.current.logged? ? download_named_attachment_path(file.id, file.filename, preview: true) : signin_url_without_domain, html_options end end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 8f0d10634..4308fd816 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -803,7 +803,11 @@ module CoursesHelper link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "sy_btn_grey fl") end else - link = "#{l(:label_course_join_student)}" + if User.current.logged? + link = "#{l(:label_course_join_student)}" + else + link = link_to(l(:label_course_join_student), signin_url_without_domain, :class => "sy_btn_grey fl ml10") + end end link.html_safe end diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index 4d261c5d1..82544544a 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -35,9 +35,17 @@ <% end%> <% if options[:length] %> - <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%> + <% if User.current.logged? %> + <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%> + <% else %> + <%= link_to(attachment.filename, signin_url_without_domain, :class => "link_file_board", :length => options[:length]) %> + <% end %> <% else %> - <%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> + <% if User.current.logged? %> + <%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> + <% else %> + <%= link_to(attachment.filename, signin_url_without_domain,:length=> 58, :class => "hidden link_file_a fl newsBlue mw400") %> + <% end %> <% end %> <%if is_float%> @@ -92,7 +100,7 @@ <% end %> <% if options[:author] %> - <%= link_to h(truncate(attachment.author.show_name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>, + <%= link_to h(truncate(attachment.author.show_name, length: 10, omission: '...')), User.current.logged? ? user_path(attachment.author) : signin_url_without_domain, :class => "link-blue" %>, <%= format_time(attachment.created_on) %> <% end %> diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb index faf254015..f03114d69 100644 --- a/app/views/files/_project_list.html.erb +++ b/app/views/files/_project_list.html.erb @@ -11,15 +11,15 @@ <%# 如果有历史版本则提供历史版本下载 %> <% if file.attachment_histories.count == 0 %> <%= link_to truncate(file.filename,length: 35, omission: '...'), - download_named_attachment_path(file.id, file.filename), + User.current.logged? ? download_named_attachment_path(file.id, file.filename) : signin_url_without_domain, :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> <% else %> - <%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id), + <%= link_to truncate(file.filename,length: 35, omission: '...'), User.current.logged? ? attachment_history_download_path(file.id) : signin_url_without_domain, :title => file.filename+"\n"+file.description.to_s, :class => "linkGrey3 f_14", :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %> <% end %> - <%= file_preview_eye(file, class: 'preview') %> + <%= file_preview_eye(file, class: 'preview') %> <% if file.is_public? == false%> 私有 diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 84aa054e0..49788bc9f 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -68,7 +68,7 @@
  • <% count = @course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0 %> 讨论区<%=count %> - <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %> + <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") if is_teacher %>
  • <% end %> <% unless show_nav?(@course.homework_commons.count) %> @@ -94,7 +94,7 @@ <% unless show_nav?(course_feedback_count) %>
  • 留言<%=course_feedback_count %> - <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%> + <%= link_to( "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}") if is_teacher %>
  • <% end %> <% unless show_nav?(course_poll_count) %> @@ -106,7 +106,7 @@ <% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %> <% unless show_nav?(count) %>
  • - 在线测验<%=count %> + 在线测验<%=count %> <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
  • <% end %> diff --git a/app/views/users/_course_boardlist.html.erb b/app/views/users/_course_boardlist.html.erb index 86b308778..b8a6be169 100644 --- a/app/views/users/_course_boardlist.html.erb +++ b/app/views/users/_course_boardlist.html.erb @@ -19,19 +19,19 @@ <% topics.each do |activity| %>
    - <% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title fl" %> - <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title f1" %> - <% end %> - <% if activity.sticky == 1 %> - - <% end%> - <% if activity.locked %> - - <% end %> - <% u = User.where("id=?",activity.author_id).first%> -
    + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title fl" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title f1" %> + <% end %> + <% if activity.sticky == 1 %> + + <% end%> + <% if activity.locked %> + + <% end %> + <% u = User.where("id=?",activity.author_id).first%> +
    <% if activity.parent_id.nil? %> diff --git a/app/views/users/_course_newslist.html.erb b/app/views/users/_course_newslist.html.erb index 87dbe6b95..4eb013075 100644 --- a/app/views/users/_course_newslist.html.erb +++ b/app/views/users/_course_newslist.html.erb @@ -19,11 +19,11 @@ <% topics.each do |activity| %>
    - <%= link_to activity.title.to_s, news_path(activity), :class => "list-title fl" %> + <%= link_to activity.title.to_s, User.current.logged? ? news_path(activity) : signin_url_without_domain, :class => "list-title fl" %> <% if activity.sticky == 1 %> <% end%> - <% u = User.where("id=?",activity.author_id).first%> + <% u = User.where("id=?", activity.author_id).first %>
    diff --git a/app/views/users/_project_boardlist.html.erb b/app/views/users/_project_boardlist.html.erb index 3ba0244d9..fdffc052d 100644 --- a/app/views/users/_project_boardlist.html.erb +++ b/app/views/users/_project_boardlist.html.erb @@ -20,9 +20,9 @@
    <% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title fl" %> + <%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class=> "list-title fl" %> <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title f1" %> + <%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class=> "list-title f1" %> <% end %> <% if activity.sticky == 1 %>