diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index c18cbfefd..6de270b5b 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -426,6 +426,10 @@ class AccountController < ApplicationController render :json => req end + def security_settings + + end + def bind_email_or_phone @user = User.current if params[:type] == 1 diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index 88d4c4d53..6605170f1 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -43,6 +43,7 @@ class BlogCommentsController < ApplicationController update_messsages_to_viewed("BlogMessage", params[:blog_id]) @article = BlogComment.find(params[:id]) + update_visiti_count @article @replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc") @reply_count = @replies.count @replies = get_no_children_comments_all @replies diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 79f4d83ee..7de524f11 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2097,147 +2097,161 @@ class UsersController < ApplicationController end def show - if User.current == @user - # 点击小铃铛,更新点击时间 - update_onclick_time if params[:click_user_message] == 'true' - # 全部设为已读 - # 自己的主页显示消息 - messages_all = MessageAll.where(:user_id => @user.id) - @message_count = messages_all.count - # REDO:已删除的内容应该在页面中显示不点击 - @message_all_pages = Paginator.new @message_count, per_page_option, params['page'] - @message_alls = messages_all.includes(:message). - limit(@message_all_pages.per_page). - offset(@message_all_pages.offset). - reorder("#{MessageAll.table_name}.created_at desc") - - @unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count - - my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course). - where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")" - # 用户待完成的作业 - homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'") - homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")" - student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0") - @unfinished_homework_count = homeworks.count - student_works.count - # 用户待完成的测验 - exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2") - exercise_users = ExerciseUser.where(:user_id => @user.id, :exercise_id => exercises.map{|ex| ex.id}) - @unfinished_test_count = exercises.count - exercise_users.count - # 用户待完成的问卷 - polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2") - poll_users = PollUser.where(:user_id => @user.id, :poll_id => polls.map{|poll| poll.id}) - @unfinished_poll_count = polls.count - poll_users.count - # 用户待匿评的作品 - homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status = 2") - student_work_scores = @user.student_works_scores.where("reviewer_role = 3") - anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")" - unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}") - @anonymous_evaluation_count = StudentWork.where(:id => unfinished_evaluations.map{|ev| ev.student_work_id}, :homework_common_id => homeworks.map{|hw| hw.id}).count - # 待评阅的作业 暂不做 - # @unreview_homework = 1 - - # 待审批的申请 - #applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count - #applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count - # applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count - # @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count - user_id = User.current.id - sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id - left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id - where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or - (ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or - (ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );" - message_alls = MessageAll.find_by_sql(sql) - @applied_message_alls_count = message_alls.count - else - # 看别人的主页显示动态 - #更新用户申请成为课程老师或教辅消息的状态 - if params[:course_id] != nil - join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?", - params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false) - join_course_messages.update_all(:viewed => true) - end - shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id) - shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id) - @page = params[:page] ? params[:page].to_i + 1 : 0 - user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" - user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" - project_types = "('Message','Issue','Project')" - principal_types = "JournalsForMessage" - container_type = '' - act_type = '' - # 他的动态 - sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))" - if params[:type].present? - case params[:type] - when "course_homework" - container_type = 'Course' - act_type = 'HomeworkCommon' - when "course_news" - container_type = 'Course' - act_type = 'News' - when "course_message" - container_type = 'Course' - act_type = 'Message' - when "course_poll" - container_type = 'Course' - act_type = 'Poll' - when "course_journals" - container_type = 'Course' - act_type = 'JournalsForMessage' - when "project_issue" - container_type = 'Project' - act_type = 'Issue' - when "project_message" - container_type = 'Project' - act_type = 'Message' - when "user_journals" - container_type = 'Principal' - act_type = 'JournalsForMessage' - when "current_user" - container_type = 'Principal' - act_type = 'Principal' - when "all" - container_type = 'all' - act_type = 'all' - end - end - if container_type != '' && container_type != 'all' - if container_type == 'Course' - sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'" - elsif container_type == 'Project' - sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'" - elsif container_type == 'Principal' && act_type == 'JournalsForMessage' - sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}" - elsif container_type == 'Principal' && act_type == 'Principal' - sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))" - end - if User.current != @user - sql += " and user_id = #{@user.id}" - end - else - if User.current != @user - blog_ids = "("+@user.blog.id.to_s+")" - else - blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" - end - sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + - "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ - "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + - "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})" - if container_type != 'all' && User.current != @user - sql = "user_id = #{@user.id} and(" + sql + ")" - end - end - @user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count - @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10) - @type = params[:type] - end + @blog_list = @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.created_at desc") + @blog_count = @blog_list.count + @blog_list = @blog_list.limit(3) + watch_query = User.watched_by(@user.id); + @user_watchlist_count = watch_query.count(); + @user_watchlist = watch_query.order("#{Watcher.table_name}.id desc").limit(12); + fan_query = @user.watcher_users; + @user_fanlist_count = fan_query.count(); + @user_fanlist = fan_query.order("#{Watcher.table_name}.id desc").limit(12); + @courses = @user.courses.visible.not_deleted + @courses_count = @courses.count + @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc").limit(8) + @shixuns = [] + @shixuns_count = 0 + # if User.current == @user + # # 点击小铃铛,更新点击时间 + # update_onclick_time if params[:click_user_message] == 'true' + # # 全部设为已读 + # # 自己的主页显示消息 + # messages_all = MessageAll.where(:user_id => @user.id) + # @message_count = messages_all.count + # # REDO:已删除的内容应该在页面中显示不点击 + # @message_all_pages = Paginator.new @message_count, per_page_option, params['page'] + # @message_alls = messages_all.includes(:message). + # limit(@message_all_pages.per_page). + # offset(@message_all_pages.offset). + # reorder("#{MessageAll.table_name}.created_at desc") + # + # @unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count + # + # my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course). + # where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")" + # # 用户待完成的作业 + # homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'") + # homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")" + # student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0") + # @unfinished_homework_count = homeworks.count - student_works.count + # # 用户待完成的测验 + # exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2") + # exercise_users = ExerciseUser.where(:user_id => @user.id, :exercise_id => exercises.map{|ex| ex.id}) + # @unfinished_test_count = exercises.count - exercise_users.count + # # 用户待完成的问卷 + # polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2") + # poll_users = PollUser.where(:user_id => @user.id, :poll_id => polls.map{|poll| poll.id}) + # @unfinished_poll_count = polls.count - poll_users.count + # # 用户待匿评的作品 + # homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status = 2") + # student_work_scores = @user.student_works_scores.where("reviewer_role = 3") + # anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")" + # unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}") + # @anonymous_evaluation_count = StudentWork.where(:id => unfinished_evaluations.map{|ev| ev.student_work_id}, :homework_common_id => homeworks.map{|hw| hw.id}).count + # # 待评阅的作业 暂不做 + # # @unreview_homework = 1 + # + # # 待审批的申请 + # #applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count + # #applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count + # # applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count + # # @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count + # user_id = User.current.id + # sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id + # left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id + # where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or + # (ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or + # (ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );" + # message_alls = MessageAll.find_by_sql(sql) + # @applied_message_alls_count = message_alls.count + # else + # # 看别人的主页显示动态 + # #更新用户申请成为课程老师或教辅消息的状态 + # if params[:course_id] != nil + # join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?", + # params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false) + # join_course_messages.update_all(:viewed => true) + # end + # shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id) + # shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id) + # @page = params[:page] ? params[:page].to_i + 1 : 0 + # user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" + # user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")" + # course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" + # project_types = "('Message','Issue','Project')" + # principal_types = "JournalsForMessage" + # container_type = '' + # act_type = '' + # # 他的动态 + # sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))" + # if params[:type].present? + # case params[:type] + # when "course_homework" + # container_type = 'Course' + # act_type = 'HomeworkCommon' + # when "course_news" + # container_type = 'Course' + # act_type = 'News' + # when "course_message" + # container_type = 'Course' + # act_type = 'Message' + # when "course_poll" + # container_type = 'Course' + # act_type = 'Poll' + # when "course_journals" + # container_type = 'Course' + # act_type = 'JournalsForMessage' + # when "project_issue" + # container_type = 'Project' + # act_type = 'Issue' + # when "project_message" + # container_type = 'Project' + # act_type = 'Message' + # when "user_journals" + # container_type = 'Principal' + # act_type = 'JournalsForMessage' + # when "current_user" + # container_type = 'Principal' + # act_type = 'Principal' + # when "all" + # container_type = 'all' + # act_type = 'all' + # end + # end + # if container_type != '' && container_type != 'all' + # if container_type == 'Course' + # sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'" + # elsif container_type == 'Project' + # sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'" + # elsif container_type == 'Principal' && act_type == 'JournalsForMessage' + # sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}" + # elsif container_type == 'Principal' && act_type == 'Principal' + # sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))" + # end + # if User.current != @user + # sql += " and user_id = #{@user.id}" + # end + # else + # if User.current != @user + # blog_ids = "("+@user.blog.id.to_s+")" + # else + # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + # end + # sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + # "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + # "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + # "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})" + # if container_type != 'all' && User.current != @user + # sql = "user_id = #{@user.id} and(" + sql + ")" + # end + # end + # @user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count + # @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10) + # @type = params[:type] + # end respond_to do |format| format.js - format.html {render :layout => 'new_base_user'} + format.html {render :layout => 'base_edu_user'} end end diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 6f0d96dfa..292a64f28 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -39,6 +39,12 @@ class WatchersController < ApplicationController else if params[:target_id] @user = User.find(params[:target_id]) + watch_query = User.watched_by(@user.id); + @user_watchlist_count = watch_query.count(); + @user_watchlist = watch_query.order("#{Watcher.table_name}.id desc").limit(12); + fan_query = @user.watcher_users; + @user_fanlist_count = fan_query.count(); + @user_fanlist = fan_query.order("#{Watcher.table_name}.id desc").limit(12); end end @@ -82,6 +88,12 @@ class WatchersController < ApplicationController else if params[:target_id] @user = User.find(params[:target_id]) + watch_query = User.watched_by(@user.id); + @user_watchlist_count = watch_query.count(); + @user_watchlist = watch_query.order("#{Watcher.table_name}.id desc").limit(12); + fan_query = @user.watcher_users; + @user_fanlist_count = fan_query.count(); + @user_fanlist = fan_query.order("#{Watcher.table_name}.id desc").limit(12); end end if params[:object_type] == 'project' diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 8f6d6a8e5..ff25f6bab 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -262,11 +262,25 @@ module WatchersHelper content.present? ? content_tag('ul', content, :class => 'watchers') : content end - - - - - +#用户关注、取消关注 + def watcher_link_for_user(target, user) + return '' unless user && user.logged? + watched = target.watched_by?(user) + text = watched ? '已关注' : '添加关注' + url = watch_path(:object_type => 'user', + :object_id => target.id, + :target_id => target.id) + method = watched ? 'delete' : 'post' + id = watched ? 'cancel_watch' : '' + title = watched ? '取消关注' : '添加关注' + if target != user + link_to text, url, :remote => true, :method => method, :remote => true, + :class => "fl font-14 user_watch",:id => id, :title => title + else + link_to "关注", "javascript:void(0)", :remote => true, :method => method, + :class => "fl font-14 user_watch", :id => id, :title => title + end + end # 缺陷跟踪者列表复选框生成 def watchers_checkboxes(object, users, checked=nil) diff --git a/app/models/blog.rb b/app/models/blog.rb index bd338cdad..7c54b2be7 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb @@ -2,8 +2,8 @@ class Blog < ActiveRecord::Base # attr_accessible :title, :body include Redmine::SafeAttributes belongs_to :user - has_many :articles, :class_name => 'BlogComment', :conditions => "#{BlogComment.table_name}.parent_id IS NULL ", :order => "#{BlogComment.table_name}.created_on DESC" - has_many :blog_comments, :dependent => :destroy, :order => "#{BlogComment.table_name}.created_on DESC" + has_many :articles, :class_name => 'BlogComment', :conditions => "#{BlogComment.table_name}.parent_id IS NULL ", :order => "#{BlogComment.table_name}.created_at DESC" + has_many :blog_comments, :dependent => :destroy, :order => "#{BlogComment.table_name}.created_at DESC" belongs_to :last_comment, :class_name => 'BlogComment', :foreign_key => :last_comment_id acts_as_tree :dependent => :nullify #acts_as_list :scope => '(user_id = #{user_id} AND parent_id #{user_id ? = "#{parent_id}" : "IS NULL"})' diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index cf241ce3b..a04c7d208 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -20,7 +20,7 @@ class BlogComment < ActiveRecord::Base validates_presence_of :title, :content validates_length_of :title, :maximum => 255 #validate :cannot_reply_to_locked_comment, :on => :create - safe_attributes 'title', 'content',"sticky", "locked", "root_id" + safe_attributes 'title', 'content',"sticky", "locked", "root_id", 'visits' after_save :add_user_activity after_update :update_activity diff --git a/app/models/user.rb b/app/models/user.rb index f023fde4b..496b2fd0c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1198,7 +1198,9 @@ class User < Principal 'language', 'custom_field_values', 'custom_fields', - 'identity_url' + 'identity_url', + 'phone', + 'authentication' safe_attributes 'status', 'auth_source_id', diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index 7558a24e3..bed68d90a 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -1,35 +1,33 @@ -
+ + <%= str %>的关注 + <%= @user_watchlist_count %> + + + <%= str %>的粉丝 + <%= @user_fanlist_count %> + +
+ ++ <% if current_user %> + 你还没有关注任何人, + 去找找感兴趣的用户 + <% else %> + TA还没有关注任何人 + <% end %> +
+ <% else %> ++ <% if current_user %> + 还没有人关注你, + 去让大家认识下你吧 + <% else %> + TA还没有粉丝 + <% end %> +
+ <% else %> ++ <%= @user.login %> + +
+ ++ + <%= @user.show_name %> + <% if @user.user_extensions && @user.user_extensions.identity %> + (<%= get_user_roll @user %>) + <% end %> + + + <% if !@user.user_extensions.school_id.blank? && @user.user_extensions.school %> + <%= @user.user_extensions.school.name %> + <% end %> + + <% if @user.authentication %> + + + 已认证 + + <% else %> + + + 未认证 + + <% end %> +
++ <%= link_to '编辑我的资料', my_account_path %> +
+ ++ + <% update_visiti_count @user %> + <%= @user.visits.to_i %> 次访问 +
+ + ++ + <%= @user.visits.to_i %> 次访问 +
+ ++ <% if(@user.watched_by?(User.current)) %> + <%= link_to "已关注", + watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id), + :class => "fl font-14 user_watch", + :id => "cancel_watch", + :method => "delete", + :remote => "true", + :title => "取消关注" %> + <% else %> + <%= link_to "添加关注", + watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id), + :class => "fl font-14 user_watch", + :method => "post", + :remote => "true", + :title => "添加关注" %> + <% end %> + 给ta留言 +
+ + + + +"> + <%= @user.user_extensions.brief_introduction.blank? ? "这家伙很懒,什么都没留下~" : @user.user_extensions.brief_introduction %> +
+ <% end %> +<%= str %>的博客 + <%= @blog_count %> +
+ <% if @blog_count == 0 %> ++ <% if current_user %> + 你一篇博客也没写过, + 现在写博客 + <% else %> + <%= @user.show_name %>很懒,一篇博客也没写过 + <% end %> +
+ <% else %> ++ <%= format_time blog.created_at %> 发布 + + <%= blog.visits %> +
++ 快速入口 +
+ +
+
+ 显示你常用的课堂社区、实训社区列表
+ +你还没有参与任何社区
++ <% if @courses_count == 0 %> + 实训<%= @shixuns_count %> + <% elsif @shixuns_count == 0 %> + 课堂<%= @courses_count %> + <% else %> + 课堂<%= @courses_count %> + 实训<%= @shixuns_count %> + <% end %> +
+ ++ <%= course.name %> + 课程:<%= course.syllabus.title %> + 更新时间:<%= format_time course.updatetime %> + 分享 +
+ <% end %> + <% if @courses_count > 8 %> + 点击查看全部 + <% end %> ++ 胡莎莎/Helloword:java实训入门 + 已解锁第2关/共8关 + 上次离开时间:2017-02-09 15:21 +
+ <% end %> + + <% if @shixuns_count > 8 %> + 点击查看全部 + <% end %>