From 4a9967674a5ffd761195d7fafb948cc2a69d7495 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 13 Aug 2016 14:29:33 +0800 Subject: [PATCH 01/13] =?UTF-8?q?1.=20=E5=BC=BA=E5=88=B6=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E8=B5=84=E6=96=99=EF=BC=8C=E5=9C=A8=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8D=95=E4=BD=8D=E6=97=B6=E7=BB=99=E5=87=BA=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5=202.=20=E5=8D=95=E4=BD=8D=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E7=94=B3=E8=AF=B7=E6=8F=90=E7=A4=BA=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=203.=20=E7=94=B3=E8=AF=B7=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E7=9A=84=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=BA=BA=E5=A4=B4=E5=83=8F=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=88=B0=E7=94=B3=E8=AF=B7=E4=BA=BA=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 20 +- app/controllers/admin_controller.rb | 2 +- app/controllers/my_controller.rb | 15 +- app/views/layouts/_footer_show.html.erb | 43 +++ .../layouts/_logined_header_show.html.erb | 111 ++++++ app/views/layouts/new_base_user.html.erb | 2 +- app/views/layouts/new_base_user_show.html.erb | 335 ++++++++++++++++++ app/views/my/account.html.erb | 37 +- .../users/_user_message_applied.html.erb | 6 +- 9 files changed, 549 insertions(+), 22 deletions(-) create mode 100644 app/views/layouts/_footer_show.html.erb create mode 100644 app/views/layouts/_logined_header_show.html.erb create mode 100644 app/views/layouts/new_base_user_show.html.erb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 8187055be..731a251f2 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -26,7 +26,13 @@ class AccountController < ApplicationController if request.get? @login = params[:login] || true if User.current.logged? - redirect_to user_path(User.current) + # 判断用户基本资料是否完善,不完善讲强制完善基本资料,完善进入主页 + user = UserExtensions.where(:user_id => User.current.id).first + if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil? + redirect_to my_account_path(:tip => 1) + else + redirect_to user_path(User.current) + end else render :layout => 'login' end @@ -127,7 +133,7 @@ class AccountController < ApplicationController session[:auth_source_registration] = nil self.logged_user = @user flash[:notice] = l(:notice_account_activated) - redirect_to my_account_path + redirect_to my_account_path(:tip=>1) end else us = UsersService.new @@ -144,7 +150,7 @@ class AccountController < ApplicationController if !@user.new_record? self.logged_user = @user flash[:notice] = l(:notice_account_activated) - redirect_to my_account_url + redirect_to my_account_url(:tip=>1) else redirect_to signin_path end @@ -347,9 +353,15 @@ class AccountController < ApplicationController else #by young #redirect_back_or_default my_page_path - redirect_back_or_default User.current + # 基本资料不完善的用户,将强制用户完善基本资料。 + user = UserExtensions.where(:user_id => User.current.id).first + if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil? + redirect_to my_account_path(:tip => 1) + else + redirect_back_or_default User.current #redirect_to my_account_url #redirect_to User.current + end end end end diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 82c827b48..62d55b01d 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -698,7 +698,7 @@ class AdminController < ApplicationController apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")" if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" - @schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p",:p=>search) + @schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search) #@schools = School.all else #@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)} diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 05b93d302..3aefdfd1d 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -114,9 +114,15 @@ class MyController < ApplicationController applied_message.update_attribute(:viewed, true) end + # 基本资料不完善 @force为false, 完善 @force为true + @force = false + if params[:tip] + @force = true + end + @user = User.current - lg=@user.login + lg = @user.login @pref = @user.pref diskfile = disk_filename('User', @user.id) diskfile1 = diskfile + 'temp' @@ -178,7 +184,12 @@ class MyController < ApplicationController File.delete(diskfile1) if File.exist?(diskfile1) end - render :layout=>'new_base_user' + # 基本资料不完善,无法使用其他功能,完善着可继续使用 + if @force + render :layout => 'new_base_user_show' + else + render :layout => 'new_base_user' + end end # Destroys user's account diff --git a/app/views/layouts/_footer_show.html.erb b/app/views/layouts/_footer_show.html.erb new file mode 100644 index 000000000..bb29956d3 --- /dev/null +++ b/app/views/layouts/_footer_show.html.erb @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/app/views/layouts/_logined_header_show.html.erb b/app/views/layouts/_logined_header_show.html.erb new file mode 100644 index 000000000..a6721501e --- /dev/null +++ b/app/views/layouts/_logined_header_show.html.erb @@ -0,0 +1,111 @@ + + diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 50e788e2f..b9d4652ad 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -103,7 +103,7 @@
<% if User.current.logged?%> - <%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%> + <%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_user_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%> <% else %> <% end %> diff --git a/app/views/layouts/new_base_user_show.html.erb b/app/views/layouts/new_base_user_show.html.erb new file mode 100644 index 000000000..37354d8d8 --- /dev/null +++ b/app/views/layouts/new_base_user_show.html.erb @@ -0,0 +1,335 @@ + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus',:media => 'all' %> + <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= javascript_heads %> + <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%> + <%= heads_for_theme %> + <%= call_hook :view_layouts_base_html_head %> + <%= yield :header_tags -%> + + + + + + + + + +
+
+ +
+
+
+
+ <% if User.current.logged?%> + <%= image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx')%> + <% else %> + + <% end %> + <% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %> + + <% end %> + + +
+ +
+ <% hidden_courses = Setting.find_by_name("hidden_courses") %> + <% unvisiable = hidden_courses && hidden_courses.value == "1"%> + <% if !unvisiable %> +
    +
  • + 课程 + <% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %> + <% all_count = @user.courses.visible.where("is_delete =?", 0).count%> +
    +
    +
      +
    +
    + <% if !courses.empty? %> + + + + <% end %> +
    +
  • + <% if is_current_user %> +
  • + 新建课程 +
  • +
  • + 新建班级 +
  • +
  • + 加入班级 +
  • + <% if @user == User.current %> +
  • + 我的作业 +
  • + <% end %> + <% end %> +
+ <% end %> + +
    +
  • + 项目 + <% all_count = @user.projects.visible.count%> + <% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%> +
    +
    +
      +
    +
    + <% if !projects.empty? %> + + + + <% end %> +
    +
  • + <% if is_current_user %> +
  • + 新建项目 +
  • +
  • + 加入项目 +
  • + + + + <% end %> +
+ +
+ +
访问计数 <%= @user.visits.to_i %> (自2016年5月)
+
+
+ <%= yield %> +
+
+ <%= render :partial => 'layouts/new_feedback' %> +
+
+<%= render :partial => 'layouts/footer_show' %> +
+ + + + + + + diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 5c8e13e3f..71694da60 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,4 +1,15 @@ - + <% if @force %> + <% message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0).first %> + <% unless message.nil? %> +
+
  消息:  您添加新的单位“<%= message.name %>”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!
+ <% message.update_attribute(:viewed, true)%> +
+ <% end %> +
+
  提示:  您尚未完善您的基本资料,完善后可使用更多功能
+
+ <% end %>
    @@ -29,9 +40,12 @@
  •   
    -
  • <%= f.text_field :login,:no_label=>true, :required => true,:style=>"color:grey", :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%>
  • -
  • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%>
  • - +
  • <%= f.text_field :login,:no_label=>true, :required => true,:style => "color:grey", :nh_required => "1",:disabled => 'disabled', :name => "login",:class => "w210"%>
  • + <% if @force %> +
  • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required => "1",:class=>"w210",:disabled=>'disabled'%>
  • + <% else %> +
  • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%>
  • + <% end %>
  • - +

    <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> @@ -89,7 +103,7 @@

    - +

    <% elsif User.current.user_extensions.school.nil? %> @@ -97,7 +111,7 @@

    - +

    <% else %> @@ -105,7 +119,7 @@

    - +

    <% end %> @@ -155,7 +169,7 @@
  • <%= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %> - +
  • @@ -466,7 +480,7 @@ }else{ $("#search_school_result_list").html(''); str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; - $("#hint").html('如果找不到自己的单位,您可以添加单位'); + $("#hint").html('如果找不到自己的单位,您可以 添加单位'); $("#hint").show(); $("#errortip").show(); } @@ -477,7 +491,6 @@ if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province') { $("#search_school_result_list").hide(); - $("#hint").hide(); $("#errortip").hide(); } }); @@ -516,7 +529,7 @@ }else{ $("#search_school_result_list").html(''); str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; - $("#hint").html('您输入的名称尚不存在,申请添加'); + $("#hint").html('如果找不到自己的单位,您可以 添加单位'); $("#hint").show(); $("#errortip").show(); } diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index 414b13cf7..89084d30b 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -1,11 +1,12 @@ <% if ma.class == AppliedMessage %> - + <% if ma.applied_type == "ApplyAddSchools" %> + <% elsif ma && ma.applied_type == "AppliedProject" %>
      <%= render :partial => "users/applied_project_content", :locals =>{:ma => ma} %> From 5e9888480112db69a5de35a3441d543942f8525f Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 22 Aug 2016 16:32:32 +0800 Subject: [PATCH 02/13] tip for sonar --- app/controllers/quality_analysis_controller.rb | 5 +++++ app/views/quality_analysis/_result_list.html.erb | 2 +- app/views/quality_analysis/_show.html.erb | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index a0b275dc7..11aa57c9f 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -237,6 +237,11 @@ class QualityAnalysisController < ApplicationController arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] @quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)} else + languate_arr = ['ruby', 'c#', 'c++', 'c'] + qa_language = QualityAnalysis.where(:sonar_name => @resource_id).first.try(language) + if !qa_language.blank? && languate_arr.include?(qa_language) + @language_flag = true + end filter = "sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,files,functions,classes,directories,blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations" complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read @complexity =JSON.parse(complexity_date).first diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb index 5b4e4f5a0..0c2bc9497 100644 --- a/app/views/quality_analysis/_result_list.html.erb +++ b/app/views/quality_analysis/_result_list.html.erb @@ -14,7 +14,7 @@
    -<% if @quality_analyses.count >0 %> +<% if @quality_analyses && @quality_analyses.count >0 %> <% @quality_analyses.each do |qa| %>
    • <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %>
    • diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index f9dbfc510..81447f81b 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -2,6 +2,14 @@

      质量分析

      + +<% if @language_flag %> +
      + 本平台使用的代码质量分析工具是sonar开源质量数据报告工具,目前ruby、c++、c#语言的分析结果可能存在一定的偏差, + 建议结合其他数据质量分析工具进行综合判断。 +
      +<% end %> +
      当前分支:<%= params[:branch] %>
      项目代码质量分析报告
      From e473a18487ba4bf9265fbe0508cba636968b2aa1 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 23 Aug 2016 10:26:39 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=94=99=E5=88=86?= =?UTF-8?q?=E6=94=AF=20=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 24 ---- public/assets/wechat/class.html | 134 +----------------- .../javascripts/wechat/controllers/class.js | 66 ++------- .../javascripts/wechat/controllers/project.js | 1 - 4 files changed, 10 insertions(+), 215 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index b28d3eca0..369185ca2 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -287,30 +287,6 @@ module Mobile end end - desc "获取课程动态" - params do - requires :id, type: Integer - requires :token, type: String - end - post 'activities' do - authenticate! - - user = current_user - - course_types = "('Message','News','HomeworkCommon','Poll','Course')" - activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc') - - page = params[:page] ? params[:page] : 0 - all_count = activities.count - activities = activities.limit(10).offset(page * 10) - count = activities.count - present :data, activities, with: Mobile::Entities::Activity,user: user - present :all_count, all_count - present :count, count - present :page, page - present :status, 0 - end - desc "课程作业列表" params do requires :token, type: String diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index a1eb45a52..e720c90c9 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -16,139 +16,7 @@ - -
      -
      -
      - - -
      -
      -
      -
      -
      -
      - -
      {{act.latest_update}}
      -
      - -
      -
      -
      -
      -
      - -
      -
      -
      {{act.praise_count}}
      -
      {{act.praise_count}}
      -
      - -
      -
      -
      -
      -
      - -
      -
      -
      -
      -
      -
      - -
      {{act.latest_update}}
      -
      - -
      -
      -
      - -
      -
      - -
      -
      -
      {{act.praise_count}}
      -
      {{act.praise_count}}
      -
      - -
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      - - -
      -
      -
      -
      -
      -
      -
      -
      -
      更多
      -
      -
      - -
      +
      diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index a0c575d92..cd6d57d34 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -5,29 +5,23 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location var courseid = $routeParams.id; var tag = $routeParams.tag; - vm.course_activities_page = rms.get('course_activities_page') || 0; - vm.course_activities = rms.get("course_activities") || []; - vm.course_has_more = rms.get("course_has_more"); - - vm.course = rms.get("course") || null; - var getClassActivities = function(page){ $http({ method: 'POST', - url: apiUrl + "courses/activities?id=" + courseid, + url: apiUrl + "projects/activities?id=" + projectid, data:{token:auth.token(),page:page} }).then(function successCallback(response) { console.log(response.data); if(response.data.status == 0){ - vm.class_activities_page = response.data.page; + vm.project_activities_page = response.data.page; if(response.data.page > 0) { - vm.course_activities = vm.class_activities.concat(response.data.data); + vm.project_activities = vm.project_activities.concat(response.data.data); } else{ - vm.course_activities = response.data.data; - vm.course_activities_page = 0; - vm.course_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; + vm.project_activities = response.data.data; + vm.project_activities_page = 0; + vm.project_has_more = (response.data.count + response.data.page * 10) < response.data.all_count; } } else{ @@ -108,7 +102,6 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.currentTab = index; vm.searchText = ''; - vm.showActivities = false; vm.showClassMate = false; vm.showResources = false; vm.showHomework = false; @@ -119,8 +112,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location if(vm.isTeacher){ if(index == 1){ - getClassActivities(0); - vm.showActivities = true; + getClassActivities(); } else if(index == 2){ //课件 getResources(); @@ -137,8 +129,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location } else { if(index == 1){ - getClassActivities(0); - vm.showActivities = true; + getClassActivities(); } else if(index == 3){ getUsers(); @@ -154,7 +145,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.tabRecord = rms.get('tab_num') || 1; -// vm.course = {}; + vm.course = {}; vm.students = []; vm.teachers = []; vm.reviewers = []; //待审批 @@ -168,11 +159,6 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.alertService = alertService.create(); vm.invite = function(){ - rms.save('course_activities_page',vm.course_activities_page); - rms.save("course_activities",vm.course_activities); - rms.save("course_has_more",vm.course_has_more); - rms.save("course",vm.course); - $location.path("/invite_code").search({id: courseid}); }; @@ -227,39 +213,5 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $location.path("/review_class_member").search({id: courseid,user_id: user.id}); }; - //跳到详情页 - vm.goDetail = function(type, act_id,id){ - rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); - rms.save('course_activities_page',vm.course_activities_page); - rms.save("course_activities",vm.course_activities); - rms.save('course_has_more', vm.course_has_more); - rms.save("course",vm.course); -// $location.path('/'+type+'/'+act_id); - $location.path("/"+type).search({id: act_id}); - }; - - vm.addPraise = function(act){ - for(var i in vm.course_activities){ - if(vm.course_activities[i].act_id == act.act_id){ - vm.course_activities[i].praise_count += 1; - vm.course_activities[i].has_praise = true; - break; - } - } - - common.addCommonPraise(act); - }; - - vm.decreasePraise = function(act){ - for(var i in vm.course_activities){ - if(vm.course_activities[i].act_id == act.act_id){ - vm.course_activities[i].praise_count -= 1; - vm.course_activities[i].has_praise = false; - break; - } - } - - common.decreaseCommonPraise(act); - }; }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js index 826a16424..08987e491 100644 --- a/public/javascripts/wechat/controllers/project.js +++ b/public/javascripts/wechat/controllers/project.js @@ -114,7 +114,6 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut //跳到详情页 vm.goDetail = function(type, act_id,id){ rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop); - rms.save('project_activities_page',vm.project_activities_page); rms.save("project_activities",vm.project_activities); rms.save('project_has_more', vm.project_has_more); rms.save("project",vm.project); From 5088770214e5b9abe43a4fc68905efc88d182151 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 23 Aug 2016 16:34:11 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E9=99=84=E4=BB=B6=E5=92=8C=E8=B5=84=E6=BA=90=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E4=B8=8B=E8=BD=BD=E6=9D=83=E9=99=90=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- .../attachments/_activity_attach.html.erb | 2 +- app/views/files/_org_subfield_list.html.erb | 6 +- app/views/organizations/setting.html.erb | 90 +++++++++---------- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b225c3099..942016976 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2169,7 +2169,7 @@ module ApplicationHelper candown= User.current.member_of_course?(course) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2 elsif attachment.container.is_a?(OrgSubfield) org = attachment.container.organization - candown = User.current.member_of_org?(org) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2 + candown = User.current.member_of_org?(org) || ((attachment.is_public == 1 || attachment.get_status_by_attach(User.current.id) == 2) && org.allow_guest_download == true) elsif attachment.container.is_a?(OrgDocumentComment) org = attachment.container.organization candown = User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1) diff --git a/app/views/attachments/_activity_attach.html.erb b/app/views/attachments/_activity_attach.html.erb index 3cc429185..b37c80dad 100644 --- a/app/views/attachments/_activity_attach.html.erb +++ b/app/views/attachments/_activity_attach.html.erb @@ -3,7 +3,7 @@
      - <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw380', :download => true -%> + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw380', :download => true %> ( diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index 1bbdc0e93..e567435a5 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -11,9 +11,9 @@
      <%# 如果有历史版本则提供历史版本下载 %> <% if file.attachment_histories.count == 0 %> - <%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'), - download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> + <%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :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), :title => file.filename+"\n"+file.description.to_s, diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index a2f8a8f29..f1a8da8e4 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -47,52 +47,52 @@ <%#= form_for( @organization,{:controller => 'organizations',:action => 'update',:id=>@organization,:html=>{:id=>'update_org_form',:method=>'put'}}) do %> <%= labelled_form_for @organization do |f|%> - <%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %> - - -
      组织名称: -
      -
      + <%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %> + + +
      组织名称: +
      +
      -
      组织描述: -
      -
      -
      -
      组织URL: -
      http:// - - .trustie.net申请 - <% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %> - <% if domain.present? and record.present? and record.content == domain.subname %> - (已批准) - <% elsif record %> - (您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准) - <% end %> -

      - -
      -
      -
      - 显示模式 : - /> - - /> - -
      -
      公开 : - class="ml3" /> -
      -
      下载支持 : - name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" /> -  允许游客下载 - <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %> -
      - - - - - - 保存 +
      组织描述: +
      +
      +
      +
      组织URL: +
      http:// + + .trustie.net申请 + <% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %> + <% if domain.present? and record.present? and record.content == domain.subname %> + (已批准) + <% elsif record %> + (您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准) + <% end %> +

      + +
      +
      +
      + 显示模式 : + /> + + /> + +
      +
      公开 : + class="ml3" /> +
      +
      下载支持 : + name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" /> +  允许游客下载 + <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %> +
      + + + + + + 保存 <% end %>
      From 5d5bd88c88667d85ce6a77ddfd6198dde5b3494b Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 24 Aug 2016 09:30:57 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=EF=BC=9A=E7=94=A8=E6=88=B7=E4=B8=8D=E5=BA=94=E6=9C=89=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BB=96=E4=BA=BA=E5=A4=B4=E5=83=8F=E7=9A=84=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/new_base_user.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index f98585b77..66ee71f8a 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -102,8 +102,10 @@
      - <% if User.current.logged?%> + <% if User.current.logged? && User.current == @user%> <%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%> + <% elsif User.current.logged? %> + <%=image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx') %> <% else %> <% end %> From 078900088add679a86e4be15fe133befe839a91e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Aug 2016 14:41:26 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E7=BB=84=E7=BB=87=E5=85=B3=E8=81=94trustie-forge?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=EF=BC=8C=E7=82=B9=E5=87=BB=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E7=9A=84=E8=AE=BA=E5=9D=9B=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 6 ++++++ app/views/users/_project_message.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 48b5f068b..048d92458 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -18,6 +18,12 @@ module OrganizationsHelper s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end + # 获取项目动态更新时间 + def get_forge_act_message(act, type) + forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first + format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at)) + end + def get_default_name field case field.name when 'activity' then diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 0a5c18a9b..9727b685c 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -29,7 +29,7 @@ 发帖时间:<%= format_time(activity.created_on) %>
      - 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %> + 更新时间:<%= get_forge_act_message(activity, activity.class) %>
      <% if activity.parent_id.nil? %> From bafb3e98a710b819599da5981765f5ff823aad75 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 24 Aug 2016 15:05:10 +0800 Subject: [PATCH 07/13] tip for sonar results --- app/controllers/quality_analysis_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 11aa57c9f..163b32f03 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -238,7 +238,7 @@ class QualityAnalysisController < ApplicationController @quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)} else languate_arr = ['ruby', 'c#', 'c++', 'c'] - qa_language = QualityAnalysis.where(:sonar_name => @resource_id).first.try(language) + qa_language = QualityAnalysis.where(:sonar_name => @resource_id).first.try(:language) if !qa_language.blank? && languate_arr.include?(qa_language) @language_flag = true end From a3ec35c008c9a37e2618134c29e918dd85cf4318 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Aug 2016 15:56:03 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 6 ++++++ app/helpers/organizations_helper.rb | 6 ------ app/views/users/_project_message.html.erb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4a1033a31..0c0e0919e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3436,3 +3436,9 @@ def course_syllabus_option user = User.current end type end + +# 获取项目动态更新时间 +def get_forge_act_message(act, type) + forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first + format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at)) +end diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 048d92458..48b5f068b 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -18,12 +18,6 @@ module OrganizationsHelper s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end - # 获取项目动态更新时间 - def get_forge_act_message(act, type) - forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first - format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at)) - end - def get_default_name field case field.name when 'activity' then diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 9727b685c..afc45efde 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -29,7 +29,7 @@ 发帖时间:<%= format_time(activity.created_on) %>
      - 更新时间:<%= get_forge_act_message(activity, activity.class) %> + 更新时间:<%= get_forge_act_message(activity, activity.class.to_s) %>
      <% if activity.parent_id.nil? %> From ea7f65308ee8de8cbc744a7c8d74e1e7883bd05f Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 24 Aug 2016 16:02:02 +0800 Subject: [PATCH 09/13] =?UTF-8?q?at=E6=89=80=E6=9C=89=E4=BA=BA=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E5=BA=94=E5=B8=A6=E6=9C=89=E7=94=A8=E6=88=B7=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/at/show.json.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/at/show.json.erb b/app/views/at/show.json.erb index 6e2a244e4..767c23835 100644 --- a/app/views/at/show.json.erb +++ b/app/views/at/show.json.erb @@ -1,10 +1,10 @@ [ <% @users && @users.each_with_index do |person,index| %> <% if index == 0 %> - {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"} + {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "", "searchKey": ""} <%= index != @users.size-1 ? ',' : '' %> <% else %> - {"id":<%=index%>, "userid": <%=person.id%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} + {"id":<%=index%>, "userid": "<%=person.id%>", "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} <%= index != @users.size-1 ? ',' : '' %> <% end %> <% end %> From a13ec60173f56166a33dfd6276c7b192d02b8202 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 24 Aug 2016 17:02:59 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=95=88?= =?UTF-8?q?=E7=9A=84css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/common.css | 2 +- public/stylesheets/css/project.css | 2 +- public/stylesheets/css/structure.css | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index f704a3f0d..fbce13354 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -4,7 +4,7 @@ body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.5; background:#eaebec;} div,img,tr,td,table{ border:0;} -table,tr,td{border:0;cellspacing:0; cellpadding:0;} +table,tr,td{border:0;} ol,ul,li{ list-style-type:none} blockquote { border:1px solid #d4d4d4; diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 95891d365..1c7563a58 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -372,7 +372,7 @@ tr.entry td.filename_no_report { width: 40%; } tr.entry td.size { text-align: right; font-size: 90%; } tr.entry td.revision, tr.entry td.author { text-align: center; } tr.entry td.age { text-align: right; } -tr.entry.file td.filename a { margin-center: 16px; } +tr.entry.file td.filename a { } tr.entry.file td.filename_no_report a { margin-left: 16px; } tr span.expander {background-image: url(/images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;} diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index c9a4059e0..1d2c106e2 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -1,5 +1,3 @@ -/*将header.css文件和public.css,new_user.css中的内容统一*/ - @charset "utf-8"; /* CSS Document */ @@ -34,7 +32,7 @@ a:hover.search_btn{ background: #0fa9bb;} a.parent {background: url(/images/arrowList.png) -30px 3px no-repeat; width:95px; padding-right:50px;} a.parent:hover {background: url(/images/arrowList.png) -30px -14px no-repeat; width:95px; padding-right:50px; color:#fe7d68;} a.linkToOrange:hover {color:#fe7d68;} -#userInfo ul li {positon: relative;} +#userInfo ul li {position: relative;} #userInfo ul li ul {display:none;} #userInfo ul li:hover ul {display:block; position:absolute;} #userInfo ul li:hover ul li ul {display:none;} @@ -383,7 +381,7 @@ ul.subNavArrow:hover li ul {display:block;} .currentDd{color:#0781b4;} .currentDt{background-color:#fff;} .navContent{display: none;border-bottom:solid 1px #e5e3da; } -.navContent li a{display:block;width:240px;heigh:28px;text-align:center;font-size:12px;line-height:28px;color:#333} +.navContent li a{display:block;width:240px;height:28px;text-align:center;font-size:12px;line-height:28px;color:#333} .navContent li a:hover{color:#fff;background-color:#b3e0ee} a.subnav_num{ font-weight:normal; color:#ff7143; font-size:12px;} a.subnav_green{ background:#28be6c; color:#fff; font-size:12px; font-weight:normal;height:18px; padding:0px 5px; padding-top:2px; display:block; margin-top:2px; margin-bottom:5px; float:right; margin-right:5px;line-height:1.4 !important;} From 8cc60ef1e86388dca7ea8334c3b0b350f2edd4f6 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 24 Aug 2016 17:28:55 +0800 Subject: [PATCH 11/13] delete some language of quality_analysis --- app/controllers/quality_analysis_controller.rb | 5 ----- app/views/quality_analysis/_show.html.erb | 7 ------- app/views/repositories/_quality_analysis.html.erb | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 163b32f03..a0b275dc7 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -237,11 +237,6 @@ class QualityAnalysisController < ApplicationController arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] @quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)} else - languate_arr = ['ruby', 'c#', 'c++', 'c'] - qa_language = QualityAnalysis.where(:sonar_name => @resource_id).first.try(:language) - if !qa_language.blank? && languate_arr.include?(qa_language) - @language_flag = true - end filter = "sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,files,functions,classes,directories,blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations" complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read @complexity =JSON.parse(complexity_date).first diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 81447f81b..f07225cc7 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -3,13 +3,6 @@

      质量分析

      -<% if @language_flag %> -
      - 本平台使用的代码质量分析工具是sonar开源质量数据报告工具,目前ruby、c++、c#语言的分析结果可能存在一定的偏差, - 建议结合其他数据质量分析工具进行综合判断。 -
      -<% end %> -
      当前分支:<%= params[:branch] %>
      项目代码质量分析报告
      diff --git a/app/views/repositories/_quality_analysis.html.erb b/app/views/repositories/_quality_analysis.html.erb index 936e513f5..d1c78abb5 100644 --- a/app/views/repositories/_quality_analysis.html.erb +++ b/app/views/repositories/_quality_analysis.html.erb @@ -12,7 +12,7 @@
      - <%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"]), :id => 'branch', :class => "analysis-option-box" %> + <%= select_tag :language, options_for_select(["java","python","c#"]), :id => 'branch', :class => "analysis-option-box" %>
      From 0cc59260cda75ac5f110c46931dab22b828cede1 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 24 Aug 2016 17:35:04 +0800 Subject: [PATCH 12/13] modified sonar list form of language --- app/views/quality_analysis/_edit.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/quality_analysis/_edit.html.erb b/app/views/quality_analysis/_edit.html.erb index f508ee5de..b9a2c6efa 100644 --- a/app/views/quality_analysis/_edit.html.erb +++ b/app/views/quality_analysis/_edit.html.erb @@ -12,7 +12,7 @@
      - <%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"], "#{@quality_analysis.language}"), :id => 'branch', :class => "analysis-option-box" %> + <%= select_tag :language, options_for_select(["java","python","c#"], "#{@quality_analysis.language}"), :id => 'branch', :class => "analysis-option-box" %>
      From 21c48ea3831713f8af49afebc499cc75a0a5d19a Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 24 Aug 2016 17:46:18 +0800 Subject: [PATCH 13/13] =?UTF-8?q?at=E6=89=80=E6=9C=89=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/at_controller.rb | 2 +- app/views/at/show.json.erb | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 0e48cd962..66cbf27b8 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -10,7 +10,7 @@ class AtController < ApplicationController @users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users #加上all - if @user && @users.size > 0 + if User.current.logged? && @users.size > 0 allUser = Struct.new(:id, :name).new allUser.id = @users.map{|u| u.id}.join(",") allUser.name = "all" diff --git a/app/views/at/show.json.erb b/app/views/at/show.json.erb index 767c23835..3e49496f9 100644 --- a/app/views/at/show.json.erb +++ b/app/views/at/show.json.erb @@ -1,11 +1,11 @@ [ - <% @users && @users.each_with_index do |person,index| %> - <% if index == 0 %> - {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "", "searchKey": ""} - <%= index != @users.size-1 ? ',' : '' %> - <% else %> - {"id":<%=index%>, "userid": "<%=person.id%>", "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} - <%= index != @users.size-1 ? ',' : '' %> - <% end %> - <% end %> + <% @users && @users.each_with_index do |person,index| %> + <% if index == 0 %> + {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"} + <%= index != @users.size-1 ? ',' : '' %> + <% else %> + {"id":<%=index%>, "userid": "<%=person.id%>", "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} + <%= index != @users.size-1 ? ',' : '' %> + <% end %> + <% end %> ]