From 58b5dbdf9aa10eff7d281ff9d83377eda960c2e7 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 18:00:01 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=9C=80?= =?UTF-8?q?=E8=BF=91=E4=B8=80=E6=AC=A1=E6=8F=90=E4=BA=A4=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=AD=98=E5=85=A5=E6=95=B0=E6=8D=AE=E5=BA=93=20=E7=B2=BE?= =?UTF-8?q?=E5=93=81=E8=AF=BE=E7=A8=8B=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 8 ++++++++ app/helpers/application_helper.rb | 5 +++++ app/helpers/users_helper.rb | 5 ----- db/migrate/20160122094805_excellent_course.rb | 17 +++++++++++++++++ .../20160122094829_excellent_option_course.rb | 19 +++++++++++++++++++ db/schema.rb | 3 ++- 6 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20160122094805_excellent_course.rb create mode 100644 db/migrate/20160122094829_excellent_option_course.rb diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index cafec1c62..707e87fd1 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -360,6 +360,9 @@ update end # end @changesets_latest_coimmit = @changesets[0] + unless @changesets[0].blank? + update_commits_date(@project, @changesets_latest_coimmit) + end @properties = @repository.properties(@path, @rev) @repositories = @project.repositories @course_tag = params[:course] @@ -589,6 +592,11 @@ update project.project_score.update_attribute(:changeset_num, count) end + # 更新项目提交次数时间 + def update_commits_date project, date + project.project_score.update_attribute(:commit_time, date.created_at) + end + def find_repository @repository = Repository.find(params[:id]) @project = @repository.project diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 51138f2ef..3a0808bdd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,6 +49,11 @@ module ApplicationHelper end end + def link_to_user_version(version, options = {}) + return '' unless version && version.is_a?(Version) + link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " + end + # 判断课程是否为精品课程 def is_excellent_course course (course.is_excellent? or course.excellent_option?) ? true : false diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 43ef7cefc..bfc01a102 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -85,11 +85,6 @@ module UsersHelper end end - def link_to_user_version(version, options = {}) - return '' unless version && version.is_a?(Version) - link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " - end - # 统计未读消息数 def unviewed_message(user) course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count diff --git a/db/migrate/20160122094805_excellent_course.rb b/db/migrate/20160122094805_excellent_course.rb new file mode 100644 index 000000000..465b81464 --- /dev/null +++ b/db/migrate/20160122094805_excellent_course.rb @@ -0,0 +1,17 @@ +class ExcellentCourse < ActiveRecord::Migration + def up + arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:is_excellent, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/migrate/20160122094829_excellent_option_course.rb b/db/migrate/20160122094829_excellent_option_course.rb new file mode 100644 index 000000000..30ee53ba3 --- /dev/null +++ b/db/migrate/20160122094829_excellent_option_course.rb @@ -0,0 +1,19 @@ +class ExcellentOptionCourse < ActiveRecord::Migration + def up + arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50, + 419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175, + 124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262] + for i in 0..arr.length-1 + begin + puts arr[i] + course = Course.find(arr[i]) + course.update_attribute(:excellent_option, true) + rescue + logger.error("Course is not found!") + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 7e6291806..fb021e9ae 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160122083507) do +ActiveRecord::Schema.define(:version => 20160122094829) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1372,6 +1372,7 @@ ActiveRecord::Schema.define(:version => 20160122083507) do t.integer "board_message_num", :default => 0 t.integer "board_num", :default => 0 t.integer "attach_num", :default => 0 + t.datetime "commit_time" end create_table "project_statuses", :force => true do |t| From dbed8379d3ab44a4fee491c6e2bde1c0be644966 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 22 Jan 2016 18:10:32 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E6=B8=B8=E5=AE=A2=E4=B8=8B=E8=BD=BD=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 4e3286700..85fc42f66 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -55,7 +55,7 @@ class OrganizationsController < ApplicationController @organization.name = params[:organization][:name] @organization.description = params[:organization][:description] @organization.is_public = params[:organization][:is_public] - @organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0 + @organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0 @organization.creator_id = User.current.id member = OrgMember.new(:user_id => User.current.id) From 26f850067125f4302c0c2cdf5a1bd794129bc61e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 22 Jan 2016 18:42:50 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=AF=A5=E5=8D=9A=E5=AE=A2=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E9=97=B4=E4=B8=BA=E5=BD=93=E5=89=8D=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 1 + app/models/blog_comment.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index df6ba10d2..87bbcb2f3 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -127,6 +127,7 @@ class BlogCommentsController < ApplicationController @blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title] @article.children << @blogComment @article.save + # @article.update_attribute(:updated_on, @blogComment.updated_on) @user_activity_id = params[:user_activity_id] user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first if user_activity diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index db28e55d6..2b31af604 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -18,6 +18,7 @@ class BlogComment < ActiveRecord::Base after_save :add_user_activity after_update :update_activity + after_create :update_parent_time before_destroy :destroy_user_activity scope :like, lambda {|arg| @@ -64,6 +65,11 @@ class BlogComment < ActiveRecord::Base (user && user.logged? && (self.author == user) ) || user.admin? end + def update_parent_time + if !self.parent.nil? + self.root.update_attribute(:updated_on, self.updated_on) + end + end def project end end From 16cb4add09365267eb0eefebd59fd9b5ae287e4e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 18:48:40 +0800 Subject: [PATCH 4/9] =?UTF-8?q?issue=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 4 ++-- app/views/users/_project_issue.html.erb | 2 ++ app/views/users/_project_issue_detail.html.erb | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 72dd0a741..eb78c4c5b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -81,7 +81,7 @@ class IssuesController < ApplicationController @priority_id = params[:priority_id] @status_id = params[:status_id] @subject = params[:subject] - @done_ratio = parmas[:done_ratio] + @done_ratio = params[:done_ratio] @issue_count = @query.issue_count @issue_pages = Paginator.new @issue_count, @limit, params['page'] params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 @@ -222,7 +222,7 @@ class IssuesController < ApplicationController def update if params[:issue_detail] - issue = Issue.find(params[:issue_id]) + issue = Issue.find(params[:id]) issue = update_user_issue_detail(issue, params) @saved = update_user_issue_detail(issue, params) return diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 618dc3185..725a064cc 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -52,9 +52,11 @@ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%# 局部刷新:修改xissue属性 %> + <% unless params[:action] == "index" %>
<%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>
+ <% end %>
diff --git a/app/views/users/_project_issue_detail.html.erb b/app/views/users/_project_issue_detail.html.erb index e46761bd1..b682a74ea 100644 --- a/app/views/users/_project_issue_detail.html.erb +++ b/app/views/users/_project_issue_detail.html.erb @@ -42,7 +42,7 @@ {:include_blank => false, :selected => @status_id ? @status_id : 0 }, {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> <%# end %> - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %>
  •  状态  : 

    <%= activity.status.name %>

    @@ -54,7 +54,7 @@
  • <% end %>
    - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
  •  指派  : 

    @@ -68,7 +68,7 @@
      - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %>
    •  优先级  : 

      <%= activity.priority.name %> @@ -78,7 +78,7 @@
    • <% end %>
      - <%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %>
    •  完成度  : 

      <%= activity.done_ratio %>% From 007afa8c4f991471d7f6bd84f80bb78fc4c54f29 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Jan 2016 19:34:02 +0800 Subject: [PATCH 5/9] =?UTF-8?q?issue=E5=9C=A8=E5=8A=A8=E6=80=81=E4=B8=AD?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/add_journal.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 5708f6b3d..9099c31b6 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -20,7 +20,7 @@ $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); <%else%> - $("#div_user_issue_reply_<%=@user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); + $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); <%end %> From afad062b809ee80c7592973a0274e508b854a715 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 22 Jan 2016 19:49:05 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E3=80=81=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E3=80=81=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90=E7=9A=84title,?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BAFiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_file.html.erb | 2 +- app/views/files/_project_file.html.erb | 2 +- app/views/files/_subfield_files.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 85b230be3..cf91b7814 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -126,4 +126,4 @@ <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> -<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file +<%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index 88c30e1b7..e8f4f023b 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -95,4 +95,4 @@ <%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %> -<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file +<%# html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index eed9266d5..1de0e8dc2 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -74,7 +74,7 @@ -<% html_title(l(:label_attachment_plural)) -%> +<%# html_title(l(:label_attachment_plural)) -%>