From 5c011fd3429b6df35f1ee4178bf1e9291e7247ba Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 9 Jul 2015 15:27:49 +0800 Subject: [PATCH 001/345] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/my_controller.rb | 24 + app/controllers/users_controller.rb | 287 +++- app/controllers/watchers_controller.rb | 7 +- app/helpers/users_helper.rb | 155 +++ app/views/avatar/upload.js.erb | 6 +- app/views/courses/finishcourse.js.erb | 10 +- app/views/layouts/_base_footer_new.html.erb | 13 + app/views/layouts/_base_header_new.html.erb | 76 + app/views/layouts/_user_fans_list.html.erb | 12 + app/views/layouts/_user_watch_btn.html.erb | 8 + app/views/layouts/_user_watch_list.html.erb | 11 + app/views/layouts/base_users_new.html.erb | 337 +++++ app/views/my/account.html.erb | 1233 +++++++---------- app/views/my/clear_user_avatar_temp.js.erb | 7 + app/views/my/save_user_avatar.js.erb | 2 + app/views/users/_course_form.html.erb | 118 +- app/views/users/_user_fans_item.html.erb | 50 + app/views/users/show.html.erb | 950 ++++--------- .../users/user_course_activities.html.erb | 12 + app/views/users/user_courses.html.erb | 62 +- app/views/users/user_courses4show.html.erb | 14 + app/views/users/user_fanslist.html.erb | 74 +- app/views/users/user_feedback4show.html.erb | 22 + app/views/users/user_projects.html.erb | 118 +- app/views/users/user_projects4show.html.erb | 14 + app/views/watchers/_set_watcher.js.erb | 63 +- app/views/words/destroy.js.erb | 6 + config/routes.rb | 7 + public/images/pic_uersall.png | Bin 0 -> 9946 bytes public/stylesheets/leftside_new.css | 66 + public/stylesheets/public_new.css | 430 ++++++ public/stylesheets/users.css | 127 ++ 32 files changed, 2669 insertions(+), 1652 deletions(-) create mode 100644 app/views/layouts/_base_footer_new.html.erb create mode 100644 app/views/layouts/_base_header_new.html.erb create mode 100644 app/views/layouts/_user_fans_list.html.erb create mode 100644 app/views/layouts/_user_watch_btn.html.erb create mode 100644 app/views/layouts/_user_watch_list.html.erb create mode 100644 app/views/layouts/base_users_new.html.erb create mode 100644 app/views/my/clear_user_avatar_temp.js.erb create mode 100644 app/views/my/save_user_avatar.js.erb create mode 100644 app/views/users/_user_fans_item.html.erb create mode 100644 app/views/users/user_course_activities.html.erb create mode 100644 app/views/users/user_courses4show.html.erb create mode 100644 app/views/users/user_feedback4show.html.erb create mode 100644 app/views/users/user_projects4show.html.erb create mode 100644 public/images/pic_uersall.png create mode 100644 public/stylesheets/leftside_new.css create mode 100644 public/stylesheets/public_new.css create mode 100644 public/stylesheets/users.css diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 69d8bc3a6..84e2e7d35 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -25,6 +25,7 @@ class MyController < ApplicationController helper :issues helper :users helper :custom_fields + helper :user_score BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, 'issuesreportedbyme' => :label_reported_issues, @@ -88,6 +89,23 @@ class MyController < ApplicationController end end + def clear_user_avatar_temp + @user = User.current + diskfile = disk_filename('User', @user.id) + diskfile1 = diskfile + 'temp' + File.delete(diskfile1) if File.exist?(diskfile1) + end + def save_user_avatar + @user = User.current + diskfile = disk_filename('User', @user.id) + diskfile1 = diskfile + 'temp' + begin + FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1 + ensure + File.delete(diskfile1) if File.exist?(diskfile1) + end + end + # Edit user's account def account @user = User.current @@ -119,6 +137,8 @@ class MyController < ApplicationController @se.identity = params[:identity].to_i if params[:identity] @se.technical_title = params[:technical_title] if params[:technical_title] @se.student_id = params[:no] if params[:no] + @se.brief_introduction = params[:brief_introduction] + @se.description = params[:description] if @user.save && @se.save # 头像保存 @@ -137,6 +157,7 @@ class MyController < ApplicationController File.delete(diskfile1) if File.exist?(diskfile1) end + render :layout=>'base_users_new' end # Destroys user's account @@ -159,6 +180,7 @@ class MyController < ApplicationController # Manage user's password def password + @act='password' @user = User.current unless @user.change_password_allowed? flash.now[:error] = l(:notice_can_t_change_password) @@ -178,12 +200,14 @@ class MyController < ApplicationController flash.now[:error] = l(:notice_account_wrong_password) end end + render :template => 'my/account',:layout=>'base_users_new' rescue Exception => e if e.message == 'wrong password' flash.now[:error] = l(:notice_account_wrong_password) else flash.now[:error] = e.message end + render :template => 'my/account',:layout=>'base_users_new' end # Create a new feeds key diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 23053a48e..b02ebd7e5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -39,13 +39,15 @@ class UsersController < ApplicationController before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_contests, :info, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index] + :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index, + :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show] #edit has been deleted by huang, 2013-9-23 before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index] + :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index, + :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -76,6 +78,8 @@ class UsersController < ApplicationController # fq helper :words + helper :project_score + include UsersHelper def refresh_changests if !(@user.nil?) && !(@user.memberships.nil?) @@ -104,27 +108,41 @@ class UsersController < ApplicationController #added by young def user_projects - - if User.current.admin? - @memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}") - else - cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" - @memberships = @user.memberships.all(:conditions => cond) - end - #events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) - #@events_by_day = events.group_by(&:event_date) - @state = 0 - #add by huang + + #add by huang unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) render_404 - return + return end end - #end - + #end + # if User.current.admin? + # @memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}") + # else + # cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" + # @memberships = @user.memberships.all(:conditions => cond) + # end + #events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) + #@events_by_day = events.group_by(&:event_date) + # @state = 0 + + limit = 10; + query = Project.joins("join members m on #{Project.table_name}.id=m.project_id") + query = query.where("m.user_id = ?",@user.id) + if(params[:status] == '1') + query = query.where("#{Project.table_name}.user_id = ?",@user.id); + elsif(params[:status] == '2') + query = query.where("#{Project.table_name}.user_id <> ?",@user.id); + end + @obj_count = query.count(); + + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Project.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @params = params + respond_to do |format| - format.html + format.html{render :layout=>'base_users_new'} format.api end end @@ -237,44 +255,59 @@ class UsersController < ApplicationController include CoursesHelper - def user_courses + def user_courses unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) render_404 - return + return end end - + #@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) - if User.current == @user || User.current.admin? - membership = @user.coursememberships.all - else - membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) - end - - membership.sort! {|older, newer| newer.created_on <=> older.created_on } - @memberships = [] - membership.collect { |e| - @memberships.push(e) - } - ## 判断课程是否过期 [需封装] - @memberships_doing = [] - @memberships_done = [] - #now_time = Time.now.year - @memberships.map { |e| - #end_time = e.course.get_time.year - isDone = course_endTime_timeout?(e.course) - if isDone - @memberships_done.push e - else - @memberships_doing.push e - end - } + limit = 10; + query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") + query = query.where("m.user_id = ?",@user.id) + if(params[:status] == '1') + query = query.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now); + elsif(params[:status] == '2') + query = query.where("endup_time < ?",Time.now); + end + @obj_count = query.count(); + + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Course.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @params = params + render :layout=>'base_users_new' + + # if User.current == @user || User.current.admin? + # membership = @user.coursememberships.all + # else + # membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + # end + # + # membership.sort! {|older, newer| newer.created_on <=> older.created_on } + # @memberships = [] + # membership.collect { |e| + # @memberships.push(e) + # } + # ## 判断课程是否过期 [需封装] + # @memberships_doing = [] + # @memberships_done = [] + # #now_time = Time.now.year + # @memberships.map { |e| + # #end_time = e.course.get_time.year + # isDone = course_endTime_timeout?(e.course) + # if isDone + # @memberships_done.push e + # else + # @memberships_doing.push e + # end + # } # respond_to do |format| - # format.html - # format.api + # format.html + # format.api # end end @@ -408,8 +441,149 @@ class UsersController < ApplicationController format.api end end - + + def user_courses4show + query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") + query = query.where("m.user_id = ?",@user.id) + if User.current == @user #看自己 + else + if @user.user_extensions!=nil && @user.user_extensions.identity == 0 #看老师 + query = query.joins("join member_roles r on m.id = r.member_id") + query = query.where("r.role_id in(7,9)") + end + query = query.where(Course.table_name+".is_public = 1") + # TODO or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) + end + + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("#{Course.table_name}.id < ?",params[:lastid]) + end + @list = query.order("#{Course.table_name}.id desc").limit(8).all + + render :layout=>nil + end + def user_projects4show + + query = Project.joins("join members m on #{Project.table_name}.id=m.project_id") + query = query.where("m.user_id = ?",@user.id) + if User.current == @user #看自己 + else + query = query.where(Project.table_name+".is_public = 1") + # TODO or exists (select 1 from project c2,members m2 where c2.id=m2.course_id and c2.id=#{Project.table_name}.id and m2.user_id= User.current.id) + end + + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("#{Project.table_name}.id < ?",params[:lastid]) + end + @list = query.order("#{Project.table_name}.id desc").limit(8).all + + render :layout=>nil + end + + def user_course_activities + @list = [] + lastid = nil + if params[:lastid]!=nil && !params[:lastid].empty? + lastid = params[:lastid]; + end + + user_ids = [] + if @user == User.current + watcher = User.watched_by(@user) + watcher.push(User.current) + user_ids = watcher.map{|x| x.id} + else + user_ids << @user.id + end + + query_rec_count = 8 + query_times = 10 #query_times次没查到query_rec_count条记录就不查了 + query_i = 0; + while( true ) + query_i = query_i+1 + if(query_i>query_times) + break + end + query = Activity.where(user_id: user_ids) + if(lastid != nil) + query = query.where("id < ?",lastid) + end + lastid,item_list = query_activities(query,'course'); + for item in item_list + @list << item + if @list.count() >= query_rec_count + break + end + end + if @list.count() >= query_rec_count + break + end + if lastid == nil + break + end + end + render :layout=>nil + end + + def user_project_activities + @list = [] + lastid = nil + if params[:lastid]!=nil && !params[:lastid].empty? + lastid = params[:lastid]; + end + + user_ids = [] + if @user == User.current + watcher = User.watched_by(@user) + watcher.push(User.current) + user_ids = watcher.map{|x| x.id} + else + user_ids << @user.id + end + + query_rec_count = 8 + query_times = 10 #query_times次没查到query_rec_count条记录就不查了 + query_i = 0; + while( true ) + query_i = query_i+1 + if(query_i>query_times) + break + end + query = Activity.where(user_id: user_ids) + if(lastid != nil) + query = query.where("id < ?",lastid) + end + lastid,item_list = query_activities(query,'project'); + for item in item_list + @list << item + if @list.count() >= query_rec_count + break + end + end + if @list.count() >= query_rec_count + break + end + if lastid == nil + break + end + end + render :action=>'user_course_activities',:layout=>nil + end + + def user_feedback4show + query = @user.journals_for_messages + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("#{JournalsForMessage.table_name}.id < ?",params[:lastid]) + end + @list = query.order("#{JournalsForMessage.table_name}.id desc").limit(3).all + render :layout=>nil + end + def show + render :layout=>'base_users_new' + end + + def show_old pre_count = 10 #limit # Time 2015-02-04 11:46:34 # Author lizanle @@ -830,11 +1004,24 @@ class UsersController < ApplicationController end end ###add by huang - def user_watchlist + def user_watchlist + limit = 10; + query = User.watched_by(@user.id); + @obj_count = query.count(); + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + + render :template=>'users/user_fanslist',:layout=>'base_users_new' end ###add by huang - def user_fanslist - + def user_fanslist + limit = 10; + query = @user.watcher_users; + @obj_count = query.count(); + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @action = 'fans' + render :layout=>'base_users_new' end #william diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index f6d01a03d..3727a974e 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -16,12 +16,15 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WatchersController < ApplicationController before_filter :require_login#, :find_watchables, :only => [:watch, :unwatch] + + helper :users + def watch s = WatchesService.new watchables = s.watch params.merge(:current_user_id => User.current.id) respond_to do |format| format.html { redirect_to_referer_or {render :text => (true ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables} } + format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add'} } end rescue Exception => e if e.message == "404" @@ -37,7 +40,7 @@ class WatchersController < ApplicationController watchables = s.unwatch params.merge(:current_user_id => User.current.id) respond_to do |format| format.html { redirect_to_referer_or {render :text => (false ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables} } + format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add'} } end rescue Exception => e if e.message == "404" diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index af2d5abc4..8a373edab 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -303,4 +303,159 @@ module UsersHelper end end end + + def get_watcher_users(obj) + count = User.watched_by(obj.id).count + if count == 0 + return [0,[]] + end + list = User.watched_by(obj.id).order("#{Watcher.table_name}.id desc").limit(10).all + return [count,list]; + end + + def get_fans_users(obj) + count = obj.watcher_users.count + if count == 0 + return [0,[]] + end + list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all + return [count,list]; + end + + def query_activities(query,type) + query_rec_count = 50 + #query = query.where("act_type not in ('Contest','Contestnotifications','Principal')") + query = query.where("act_type='JournalsForMessage'") + #query = query.where("act_type not in (?)", ['JournalsForMessage','Message','HomeworkCommon','News','Issue','Journal','Poll']) + list = query.order("id desc").limit(query_rec_count).all + if( list == nil || list.count() < query_rec_count ) + lastid = nil + else + lastid = list.last.id + end + + result = []; + for item in list + container = get_activity_container(item,type) + if( activity_is_show(item,container) ) + result << { :item=>item,:e=>container } + end + end + return [lastid,result] + end + def get_activity_container activity,type + e = nil; + if type == 'project' + if activity.act_type == 'Poll' + # 项目没有问卷 + # e = Project.find_by_id(activity.act.polls_group_id) + else + e = activity.act.project if activity.act.respond_to?('project') + end + end + if type == 'course' + if activity.act_type == 'Poll' + e = Course.find_by_id(activity.act.polls_group_id) + else + e = activity.act.course if activity.act.respond_to?('course') + end + end + + return e; + end + def activity_is_show(activity,e) + if(!e) + return false + end + + if activity.user_id == User.current.id + return true + end + if( e.visible? ) + return true + end + return false + end + def get_activity_act_showname(activity) + case activity.act_type + when "HomeworkCommon" + return activity.act.name + when "Issue" + return activity.act.subject + when "Journal" + return activity.act.notes + when "JournalsForMessage" + return activity.act.notes + when "Message" + return activity.act.subject + when "News" + return activity.act.title + when "Poll" + return activity.act.polls_name + when "Contest" + return '' + when "Contestnotification" + return '' + when "Principal" + return '' + else + return activity.act_type + end + end + def get_activity_act_createtime(activity) + case activity.act_type + when "HomeworkCommon" + return activity.act.created_at + when "Poll" + return activity.act.created_at + else + return activity.act.created_on + end + end + def get_activity_url(activity,e) + case activity.act_type + # when "Contest" + # when "Contestnotification" + # when "Principal" + when "HomeworkCommon" + return homework_common_index_path( :course=>e.id ) + when "Issue" + return issue_path(activity.act.id) + when "Journal" + return issue_path( activity.act.journalized_id ) + when "JournalsForMessage" + return e.class.to_s == 'Course' ? course_feedback_path(e) : project_feedback_path(e) + when "Message" + return e.class.to_s == 'Course' ? course_boards_path(e) : project_boards_path(e) + when "News" + return news_path(activity.act) + #return e.class.to_s == 'Course' ? course_news_index_path(e) : project_news_index_path(e) + when "Poll" + return poll_index_path( :polls_group_id=>activity.act.polls_group_id, :polls_type=>e.class.to_s ) + else + return 'javascript:;' + end + end + def get_activity_opt(activity,e) + case activity.act_type + when "HomeworkCommon" + return '创建了作业' + when "News" + return e.class.to_s == 'Course' ? '发布了通知' : '添加了新闻' + when "Issue" + return '发表了问题' + when "Journal" + return '回复了问题' + when "JournalsForMessage" + return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈' + #return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : '' + when "Message" + return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子' + when "Poll" + return '发布了问卷' + else + return '有了新动态' + end + end + end diff --git a/app/views/avatar/upload.js.erb b/app/views/avatar/upload.js.erb index 1fa90c5a3..41cf3ab77 100644 --- a/app/views/avatar/upload.js.erb +++ b/app/views/avatar/upload.js.erb @@ -1,4 +1,8 @@ +<% if @source_type=='User' %> +var imgSpan = $("img[nhname='avatar_image']"); +imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); +<% else %> var imgSpan = jQuery('#avatar_image'); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); - +<% end %> \ No newline at end of file diff --git a/app/views/courses/finishcourse.js.erb b/app/views/courses/finishcourse.js.erb index 2399062fd..0ca89aa19 100644 --- a/app/views/courses/finishcourse.js.erb +++ b/app/views/courses/finishcourse.js.erb @@ -1,8 +1,8 @@ <% if @save_flag %> - $('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>"); +$('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>"); +var html = "<%= escape_javascript( render( :partial => 'users/course_form', :locals => {:item => @course_prefs} ) )%>"; +$('#nh_course_<%=@course.id%>').replaceWith(html); // alert("关闭成功"); <% else %> - alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); -<% end %> - - +alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); +<% end %> \ No newline at end of file diff --git a/app/views/layouts/_base_footer_new.html.erb b/app/views/layouts/_base_footer_new.html.erb new file mode 100644 index 000000000..b4856d2af --- /dev/null +++ b/app/views/layouts/_base_footer_new.html.erb @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/views/layouts/_base_header_new.html.erb b/app/views/layouts/_base_header_new.html.erb new file mode 100644 index 000000000..63e221cca --- /dev/null +++ b/app/views/layouts/_base_header_new.html.erb @@ -0,0 +1,76 @@ + +
\ No newline at end of file diff --git a/app/views/layouts/_user_fans_list.html.erb b/app/views/layouts/_user_fans_list.html.erb new file mode 100644 index 000000000..8c39c528c --- /dev/null +++ b/app/views/layouts/_user_fans_list.html.erb @@ -0,0 +1,12 @@ + <% fans_count,fans_list = get_fans_users(user) %> +
+

粉丝

更多 +
+
+ <% for fans in fans_list %> + <%= link_to image_tag(url_to_avatar(fans), :style => "width:38px;height:38px;"), user_path(fans), :class => "pic_members", :title => "#{fans.name}" %> + <% end %> +
+
+
+ \ No newline at end of file diff --git a/app/views/layouts/_user_watch_btn.html.erb b/app/views/layouts/_user_watch_btn.html.erb new file mode 100644 index 000000000..71eea7166 --- /dev/null +++ b/app/views/layouts/_user_watch_btn.html.erb @@ -0,0 +1,8 @@ +<% if(User.current.logged? && User.current!=target)%> + <%if(target.watched_by?(User.current))%> + 取消 + <% else %> + 关注 + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/layouts/_user_watch_list.html.erb b/app/views/layouts/_user_watch_list.html.erb new file mode 100644 index 000000000..00c0cdc40 --- /dev/null +++ b/app/views/layouts/_user_watch_list.html.erb @@ -0,0 +1,11 @@ + <% watcher_count,watcher_list = get_watcher_users(user) %> +
+

关注

更多 +
+
+ <% for watcher in watcher_list %> + <%= link_to image_tag(url_to_avatar(watcher), :style => "width:38px;height:38px;"), user_path(watcher), :class => "pic_members", :title => "#{watcher.name}" %> + <% end %> +
+
+
\ No newline at end of file diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb new file mode 100644 index 000000000..8911df5ce --- /dev/null +++ b/app/views/layouts/base_users_new.html.erb @@ -0,0 +1,337 @@ +<% @nav_dispaly_home_path_label = 1 + @nav_dispaly_main_course_label = 1 + @nav_dispaly_main_project_label = 1 + @nav_dispaly_main_contest_label = 1 %> +<% @nav_dispaly_forum_label = 1%> +<% @nav_dispaly_user_label = show_item_on_navbar(params) %> +<% @center_flag = (User.current == @user) %> + + + + +<%= h html_title %> + + +<%= csrf_meta_tag %> +<%= favicon %> +<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','users', :media => 'all' %> +<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> +<%= javascript_heads %> +<%= heads_for_theme %> +<%= call_hook :view_layouts_base_html_head %> + +<%= yield :header_tags -%> + + + + + + + +
+ <%= render :partial => 'layouts/base_header_new'%> +
+ + + + + + + +
+
+ +
+
+
+ +
+ <%=link_to @user.name, user_path(@user),:class=>"fl c_dark fb f14" %> + <% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %> + + <% end %> + + <%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %> +
+
+ +
+ <%=l(:label_user_watcher)%>(<%= link_to User.watched_by(@user.id).count.to_s, {:controller=>"users", :action=>"user_watchlist",:id=>@user.id},:class=>"c_blue",:nh_name=>"watcher_count" %>) + + <%=l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)%>(<%= link_to @user.watcher_users.count.to_s, {:controller=>"users", :action=>"user_fanslist",:id=>@user.id},:class=>"c_blue",:nh_name=>"fans_count"%>) + 积分(<%= link_to(format("%.2f" ,get_option_number(@user,1).total_score ).to_i, + {:controller => 'users', :action => 'show_new_score', :remote => true, :id => @user.id }, :class => 'c_blue',:id => 'user_score') %>) +
+
+ <% if (@user.user_extensions) %> +
<%= @user.user_extensions.brief_introduction %>
+ <% end %> +
+ +
+
    +
  • 加入时间 :
  • + <% if @user.user_extensions!=nil && @user.user_extensions.identity == 2 %> +
  • <%= l(:label_company_name) %> :
  • + <% elsif !@user.firstname.empty? || !@user.lastname.empty? %> +
  • 真实姓名 :
  • + <% end %> + <% unless @user.user_extensions.nil? %> + <% if @user.user_extensions.identity == 0 %> +
  • 职称 :
  • + <% end %> + <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%> +
  • 地区 :
  • + <% end %> + <% if (@user.user_extensions.identity == 0 || @user.user_extensions.identity == 1) && !@user.user_extensions.school.nil? %> +
  • 工作单位 :
  • + <% elsif @user.user_extensions.identity == 3 && !@user.user_extensions.occupation.nil? && !@user.user_extensions.occupation.empty? %> +
  • 工作单位 :
  • + <% elsif @user.user_extensions.identity == 2 %> +
  • 工作单位 :
  • + <% end %> + <% if (!@user.user_extensions.description.nil? && !@user.user_extensions.description.empty?) %> +
  • 个人简介 :
  • + <% end %> + <% end %> +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% if @center_flag %> + + <% end %> +
+ + <%= render :partial => 'layouts/user_watch_list', :locals => {:user => @user} %> + <%= render :partial => 'layouts/user_fans_list', :locals => {:user => @user} %> + + + + + + + + + + + + + + + + + +
+ + <%= yield %> + +
+
+ + <%= render :partial => 'layouts/base_footer_new'%> +
+
+ +<%= render :partial => 'layouts/new_feedback' %> + + +<%= javascript_include_tag '/javascripts/avatars.js' %> + + + + diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 6c0c3a78a..377844a33 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,743 +1,524 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> - - - - -
- <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> - <%= call_hook(:view_my_account_contextual, :user => @user) %> -
- -

- <%= l(:label_my_account) %> -

-<%= error_messages_for 'user' %> -
-<%= labelled_form_for :user, @user, - :url => {:action => "account"}, - :html => {:id => 'my_account_form', - - :method => :post} do |f| %> - - + - +
+ +

<%= l(:lable_school_list)%>

+    +
+
    + <% @ss = School.find_by_sql("select distinct province from schools") %> + <% @ss.each do |s| %> +
  • + <%= s.province %> + +
  • + <% end %> +
+
+ +
+
    + +
+
+
- - - - -
+<%= stylesheet_link_tag 'nyan' %> +<%= javascript_include_tag '/javascripts/jquery.leanModal.min.js' %> +<% if !User.current.user_extensions.nil? %> + <% province = User.current.user_extensions.location %> + <% city = User.current.user_extensions.location_city %> + <% identity = User.current.user_extensions.identity %> + <% occupation1 = User.current.user_extensions.occupation %> + <% occupation = User.current.user_extensions.occupation %> + <% title = User.current.user_extensions.technical_title %> + <% language = User.current.language %> +<% else %> + <% province = "湖南省" %> + <% city = "长沙"%> + <% identity = ""%> + <% occupation1 = ""%> + <% title = "" %> + <% language = ""%> <% end %> -<% html_title(l(:label_my_account)) -%> - + \ No newline at end of file diff --git a/app/views/my/clear_user_avatar_temp.js.erb b/app/views/my/clear_user_avatar_temp.js.erb new file mode 100644 index 000000000..39ff71f6c --- /dev/null +++ b/app/views/my/clear_user_avatar_temp.js.erb @@ -0,0 +1,7 @@ + $("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); + $('#ajax-modal').html($("#nh_tx_dialog_html").html()); + showModal('ajax-modal','460px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').parent().removeClass("alert_praise"); + //$('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file diff --git a/app/views/my/save_user_avatar.js.erb b/app/views/my/save_user_avatar.js.erb new file mode 100644 index 000000000..ce4bae501 --- /dev/null +++ b/app/views/my/save_user_avatar.js.erb @@ -0,0 +1,2 @@ +$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:216px;height:216px;",:alt=>"头像") %>'); +hideModal(); \ No newline at end of file diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index 82b69ab63..a417c463f 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -1,74 +1,46 @@ -
- -
-<%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file +
+
+ + + + + + + + + + + + + +
主讲老师: + <%= item.teacher.show_name %> + 课程作业:<%= item.homework_commons.count %>
成员人数:<%= item.members.count %>开课学期:<%= item.time %><%= get_course_term_locales item %>
+
+ + <% if(course_end_flag) %> + 课程结束 + <% elsif(can_edit_flag) %> + 发布作业 + <% else %> + 提交作品 + <% end %> +
+ \ No newline at end of file diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb new file mode 100644 index 000000000..66181d23b --- /dev/null +++ b/app/views/users/_user_fans_item.html.erb @@ -0,0 +1,50 @@ +
+
+ + <%= image_tag(url_to_avatar(item), :style=>"width:64px;height:64px;",:alt=>"头像") %> + +
+
+ <%= item.show_name %> +
+
+ <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> +

个性签名:<%= item.user_extensions.brief_introduction %>

+ <% end %> + + + + <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> + + + <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> + + + <% elsif item.user_extensions.identity == 2 %> + + + <% end %> +
加入时间:<%= format_date(item.created_on) %>工作单位: +
  • + <%= item.user_extensions.school.name %> +
  • +
    工作单位: +
  • + <%= item.user_extensions.occupation %> +
  • +
    工作单位: +
  • + <%= item.show_name %> +
  • +
    +
    +
    + <% if(User.current.logged? && User.current != item )%> + <%if(item.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> + <% end %> +
    +
    diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 496211e82..bb0ce28d7 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,661 +1,321 @@ -<% if User.current.id == @user.id %> - -
    - <%= form_tag(:controller => 'users', :action => "show") do %> - + +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<% @center_flag = (User.current == @user) %> +<% if @center_flag %> +
    + + <% if @user.allowed_to?(:add_project, nil, :global => true) %> + 新建项目 + <% else %> + 加入项目 <% end %> -<% end %> -<%= render_flash_messages %> -<% unless @state == 2 %> - <% unless @activity.empty? %> -
    - <% @activity.each do |e| %> - <%# 以下一行代码解决有未知的活动无法转换成Model报错%> - <% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %> - <% act = e.act %> - <% unless act.nil? %> - <% if e.act_type == 'JournalsForMessage' || e.act_type == 'HomeworkCommon' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %> - - - - - - -
    - <%= image_tag(url_to_avatar(e.user), :class => "avatar") %> - - - <% case e.act_type %> - <% when 'JournalsForMessage' %> - - - - - - - - - - <% when 'HomeworkCommon' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Journal' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - <% if act.notes.nil? %> - <% desStr = '' %> - <% else %> - <% desStr= textAreailizable(act, :notes) %> - <% end %> - - - - - - <% when 'Changeset' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Message' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Principal' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'News' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Issue' %> - <% if e.user == User.current %> - + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + + 加入课程 + <% end %> +
    + +<% end %> - - - - - - - - - <% else %> - - - - - - - - +
    +
    +
    + +

    +
    + 取消 + 发布 + +
    - <% end %> + +
    - <% when 'Contest' %> -
    - <% if e.user == User.current && @show_contest == 1 %> - - <% else %> - - <% end %> - - - - - - - <% else %> - <% end %> -
    - <% if User.current.login == e.user.try(:login) %> - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - <% if User.current.language == "zh" %> - - <%= l(:label_i_have_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - <%= l(:label_of_feedback) + l(:label_layouts_feedback) %> - - <% else %> - - <%= l(:label_i_have_feedback) %> - <%= l(:label_layouts_feedback) + l(:label_of_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - - <% end %> - <% else %> - - <%= link_to("#{e.user.name}", user_path(e.user_id)) %> - - <% if User.current.language == "zh" %> - - <%= l(:label_have_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - <%= l(:label_of_feedback) + l(:label_layouts_feedback) %> - - <% else %> - - <%= l(:label_have_feedback) %> - <%= l(:label_layouts_feedback) + l(:label_of_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - - <% end %> - <% end %> -
    -

    - <%= textAreailizable act.notes %> -

    - -
    - - <%= user_jour_feed_back_url e %> - -
    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - - - <%= l(:label_i_new_activity) %> - - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> -   - - <%= l(:label_new_activity) %> -   - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_at)).to_s %> - -
    - - - - - - - - -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to(l(:label_activity_project)+":"+act.issue.project.name, project_path(act.issue.project.id)) %> - <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), - {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to(l(:label_activity_project)+":"+act.issue.project.name, project_path(act.issue.project.id)) %> - <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), - {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> -
    -

    - <%= desStr %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title(act.title), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title(act.title), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} %> -
    -

    - <%= textAreailizable act, :long_comments %> -

    -
    -
    - - <%= format_time(e.act.committed_on) %> - -
    -
    - <%= link_to l(:label_find_all_comments), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} if e.act.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - act.board.project ? project_boards_path(act.board.project,:topic_id => act.id) : course_boards_path(act.board.course,:topic_id => act.id), - :class => "problem_tit fl fb " %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - {:controller => 'messages', - :action => 'show', - :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> -
    -

    - <%= textAreailizable(act, :content) %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_new_user) %> - - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_user) %> - -
    -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title(" #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} if e.act.comments_count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.comments_count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> -   - <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), - {:controller => 'issues', - :action => 'show', - :id => act.id} %> -
    - <%= textAreailizable act, :description %> -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} if e.act.journals.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.journals.count) %> - -
    -
    - - <%= link_to(h(e.user), user_path(e.user_id)) %> -   - - <%= l(:label_new_activity) %> -   - <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), - {:controller => 'issues', - :action => 'show', - :id => act.id} %> -
    - <%= textAreailizable act, :description %> -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} if e.act.journals.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.journals.count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    +
    +
    + <%= @center_flag ? '我的课程' : 'TA的课程' %> + <% if @center_flag %> + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + 加入课程 + <% end %> + <% end %> +
    +
    +
    +
    + +
    +
    +
    +

    课程动态

    +
    + +
    - <% end %> - <% end %> - <% end %> -
    - - <% else %> - <% if @user == User.current %> - <%= l(:label_user_activities_no) %> +
    +
    + <%= @center_flag ? '我的项目' : 'TA的项目' %> + <% if @center_flag %> + <% if @user.allowed_to?(:add_project, nil, :global => true) %> + 新建项目 <% else %> -

    - <%= l(:label_user_activities_other) %> -

    + 加入项目 <% end %> - <% end %> - -<% else %> - <% unless @message.empty? %> -
    - <% @message.each do |e| -%> - - - - - -
    <%= image_tag(url_to_avatar(e.user), :class => "avatar") %> - - - - - - - - - - - -
    - <%= link_to(h(e.user), user_path(e.user)) %> - <% if e.instance_of?(JournalsForMessage) %> - <% if e.reply_id == User.current.id %> - <% if e.jour_type == 'Bid' %> - <%= l(:label_in_bids) %><%= link_to(e.jour.name, respond_path(e.jour)) %> <%= l(:label_quote_my_words) %> - <% elsif e.jour_type == 'User' %> - <%= l(:label_in_users) %><%= link_to(e.jour.firstname, feedback_path(e.jour)) %> <%= l(:label_quote_my_words) %> - <% elsif e.jour_type == 'Project' %> - <%= l(:label_in_projects) %><%= link_to(e.jour.name, feedback_path(e.jour)) %> <%= l(:label_reply_plural) %> - <% end %> - <% else %> - <%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id)) %> <%= l(:label_have_respond) %> - <% end %> - <% else %> - <% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %> - <%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id)) %><%= l(:label_have_respond) %> + <% end %> + +
    +
    +
    + +
    + - <% else %> - <%= l(:label_in_issues) %><%= link_to(e.issue.subject, issue_path(e.issue)) %><%= l(:label_quote_my_words) %> - <% end %> - <% end %>
    -
    -

    - <%= textAreailizable e.notes %> -

    -
    - - <%= format_time e.created_on %> - -
    -
    - <% end %> -
    +
    +

    项目动态

    +
    + +
    - +
    - <% else %> -

    - <%= l(:label_no_user_respond_you) %> -

    - <% end %> + + -<% html_title(l(:label_activity)) -%> + }); + \ No newline at end of file diff --git a/app/views/users/user_course_activities.html.erb b/app/views/users/user_course_activities.html.erb new file mode 100644 index 000000000..8a9996c41 --- /dev/null +++ b/app/views/users/user_course_activities.html.erb @@ -0,0 +1,12 @@ +<% for rec in @list %> +
    + <%= rec[:e].name %> + <%= rec[:item].user.show_name %> + <%= get_activity_opt(rec[:item],rec[:e]) %> + + <%= get_activity_act_showname(rec[:item]).html_safe %> + + <%= time_tag(get_activity_act_createtime(rec[:item])).html_safe %>前 +
    +<% end %> \ No newline at end of file diff --git a/app/views/users/user_courses.html.erb b/app/views/users/user_courses.html.erb index 6e0a1ca17..228d2af90 100644 --- a/app/views/users/user_courses.html.erb +++ b/app/views/users/user_courses.html.erb @@ -1,33 +1,31 @@ -<% if @user.user_extensions.identity == UserExtensions::TEACHER %> - <%= render :partial => 'my_course' %> -<% else %> - <%= render :partial => 'my_joinedcourse' %> -<% end %> - +
    + + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + 加入课程 + <% end %> +
    +
    - -<% html_title(l(:label_user_course)) -%> \ No newline at end of file +
    +
    +
    +

    所有课程

    + +
    +
    + <% for item in @list %> + <%= render :partial => 'course_form', :locals => {:item => item} %> + <% end %> +

    <%= l(:label_no_data) %>

    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
    +
    +
    \ No newline at end of file diff --git a/app/views/users/user_courses4show.html.erb b/app/views/users/user_courses4show.html.erb new file mode 100644 index 000000000..a95c90f18 --- /dev/null +++ b/app/views/users/user_courses4show.html.erb @@ -0,0 +1,14 @@ +<% for item in @list %> + + +<% end %> diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 92cc1cfb7..a952bc89d 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -1,52 +1,22 @@ - -

    <%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count) %>

    -
    - <% for user in @user.watcher_users %> -
      -
    • - - - - - -
      - <%= link_to image_tag(url_to_avatar(user), :class => "avatar"),user_path(user),:title => "#{user.name}" %> - - - - - - - - - - - - - - -
      - <%= content_tag "div", link_to(user.name, user_path(user)), :class => "project_avatar_name" %> -

      - <% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %> - <% memberships = user.memberships.all(:conditions => cond) %> - <%= l(:label_x_contribute_to, :count => memberships.count) %> - <% for member in memberships %> - <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> - <% end %> - -

      - <% user_courses = user_courses_list(user) %> - <%= l(:label_x_course_contribute_to, :count => user_courses.count) %> - <%= ":" unless user_courses.empty? %> - <% for course in user_courses %> - <%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : ',' %> - <% end %> -

      -
      <%= l(:label_user_joinin) %><%= format_date(user.created_on) %> -
      -
      -
    • -
    - <% end %> -
    \ No newline at end of file +
    +
    +
    + <% if @action == 'fans'%> +

    粉丝

    +
    共有<%=@obj_count%>名粉丝
    + <% else %> +

    关注

    +
    一共关注<%=@obj_count%>
    + <% end %> +
    +
    + <% for item in @list %> + <%= render :partial => 'users/user_fans_item', :locals => {:item => item,:target=>@user} %> + <% end %> +

    <%= l(:label_no_data) %>

    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
    +
    +
    diff --git a/app/views/users/user_feedback4show.html.erb b/app/views/users/user_feedback4show.html.erb new file mode 100644 index 000000000..d57d4ca5a --- /dev/null +++ b/app/views/users/user_feedback4show.html.erb @@ -0,0 +1,22 @@ +<% for item in @list %> +
    + + <%= image_tag url_to_avatar(item.user),:width => '27',:height => '27' %> + + <%= item.user.show_name %> + <% if item.at_user %> +  回复 + <%= item.at_user.show_name %> + <% end %> +  :  +

    <%=item.notes.html_safe%>

    + <% if JournalsForMessage.create_by_user? User.current %> + 回复 + <% end %> + <% if User.current.admin? || item.user.id == User.current.id %> + item.id,:user_id=>item.user.id) %>" data-confirm="您确定要删除吗?" data-remote="true" data-method="delete" class="fl mt5 c_purple ml5">删除 + <% end %> + <%= time_tag(item.created_on).html_safe %>前 +
    +
    +<% end %> diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 69dda693e..9fe948838 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -1,66 +1,56 @@ - - - -