From 40c3d34a58c5f4c94cb95336cf10fda4c86141e8 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 26 Dec 2016 15:40:43 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=90=8E=E5=8F=B0=E5=8F=AF=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 2 +- app/views/settings/_notifications.html.erb | 2 ++ config/locales/zh.yml | 1 + config/settings.yml | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index a348d15a7..036ee3673 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -850,7 +850,7 @@ class Mailer < ActionMailer::Base @token = token @url = url_for(:controller => 'account', :action => 'activate', :token => token.value) mail :to => token.user.mail, - :subject => l(:mail_subject_register, Setting.app_title) + :subject => l(:mail_subject) end def test_email(user) diff --git a/app/views/settings/_notifications.html.erb b/app/views/settings/_notifications.html.erb index 588880fe2..6d444fe96 100644 --- a/app/views/settings/_notifications.html.erb +++ b/app/views/settings/_notifications.html.erb @@ -4,6 +4,8 @@

<%= setting_text_field :mail_from, :size => 50 %>

+

<%= setting_text_field :mail_subject, :size => 50 %>

+

<%= setting_check_box :bcc_recipients %>

<%= setting_check_box :plain_text_mail %>

diff --git a/config/locales/zh.yml b/config/locales/zh.yml index ac18cda3e..b09ee99a5 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -218,6 +218,7 @@ zh: setting_pack_attachment_max_size: 附件打包最大限制 setting_issues_export_limit: 问题导出条目的限制 setting_mail_from: 邮件发件人地址 + setting_mail_subject: 注册邮件标题 setting_bcc_recipients: 使用密件抄送 (bcc) setting_plain_text_mail: 纯文本(无HTML) setting_host_name: 主机名称 diff --git a/config/settings.yml b/config/settings.yml index c97fd74ca..f5001947e 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -1,3 +1,4 @@ +#encoding=utf-8 # Redmine - project management software # Copyright (C) 2006-2013 Jean-Philippe Lang # @@ -60,6 +61,8 @@ per_page_options: default: '25,50,100' mail_from: default: trustieforge@gmail.com +mail_subject: + default: 'Trustie - 用户注册帐号激活通知' upload_avatar_max_size: format: int default: 5242880 From d10a51df1b432cdd8b5c69e9cbfbf731b05954bf Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 26 Dec 2016 16:45:56 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E9=83=A8=E5=88=86=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=20=E7=82=B9=E5=87=BB=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=90=8E500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_news_replies.html.erb | 94 +++++++++++++------------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb index f14a7557f..3c05c229a 100644 --- a/app/views/users/_news_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -1,38 +1,39 @@
    <% comments.each do |comment| %> - -
  • -
    - <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user) %> -
    -
    - <%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id}%> + <% unless comment.nil? %> + +
  • +
    + <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user) %> +
    +
    + <%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id}%> - <% if !comment.content_detail.blank? || comment.class == Journal %> -
    - <% if comment.class == Journal %> - <% if comment.details.any? %> - <% details_to_strings(comment.details).each do |string| %> -

    <%= string %>

    + <% if !comment.content_detail.blank? || comment.class == Journal %> +
    + <% if comment.class == Journal %> + <% if comment.details.any? %> + <% details_to_strings(comment.details).each do |string| %> +

    <%= string %>

    + <% end %> <% end %> +

    <%= comment.notes.html_safe %>

    + <% else %> + <%= comment.content_detail.html_safe %> <% end %> -

    <%= comment.notes.html_safe %>

    - <% else %> - <%= comment.content_detail.html_safe %> - <% end %> -
    -
    -
    +
    +
    +
    <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> - <% if type == 'HomeworkCommon' %> + <% if type == 'HomeworkCommon' %> <%= link_to( l(:button_reply), @@ -42,23 +43,23 @@ :title => l(:button_reply)) %> - <% if User.current.admin? ||is_teacher || comment.user == User.current%> + <% if User.current.admin? ||is_teacher || comment.user == User.current%> <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user, :user_activity_id => user_activity_id}, :id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) %> <% end %> <% elsif type == 'News' %> <%= link_to( - l(:button_reply), - {:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id}, - :remote => true, - :method => 'get', - :title => l(:button_reply)) %> - + l(:button_reply), + {:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + - <% news = News.find(activity_id) %> - <%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id => activity_id, :comment_id => comment, :user_activity_id => user_activity_id}, - :id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) if (User.current.allowed_to?(:manage_news, news.course) || User.current.allowed_to?(:manage_news, news.project)) %> + <% news = News.find(activity_id) %> + <%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id => activity_id, :comment_id => comment, :user_activity_id => user_activity_id}, + :id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) if (User.current.allowed_to?(:manage_news, news.course) || User.current.allowed_to?(:manage_news, news.project)) %> <% elsif type == 'Issue' %> <%= link_to( @@ -67,9 +68,9 @@ :remote => true, :method => 'get', :title => l(:button_reply)) %> - + - <%= link_to( + <%= link_to( l(:button_delete), {:controller => 'issues',:action => 'delete_journal', :id => activity_id,:journal_id=>comment.id, :user_activity_id => user_activity_id}, :method => 'get', @@ -95,13 +96,14 @@ <% end %> <% end %> -
    -
    -
    -

    - <% end %> -
    -
    -
  • +
    +
+ +

+ <% end %> + +
+ + <% end %> <% end %> \ No newline at end of file From e614a2d111c6710b562ed425f2480bb458016172 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 27 Dec 2016 12:33:08 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index a564916e9..d6722274c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -917,6 +917,9 @@ class User < Principal # 判断是否是竞赛的主办人 def admin_of_contest?(contest) + if contest.nil? + return false + end if ContestMember.where("user_id =? and contest_id =?", self.id, contest.id).count == 0 return false end From a354699b424d3fa8e5cd4419adf63f570dbbfebc Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 27 Dec 2016 13:02:22 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E4=B8=A2=E5=A4=B1=E7=AD=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 036ee3673..905cac944 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -850,7 +850,7 @@ class Mailer < ActionMailer::Base @token = token @url = url_for(:controller => 'account', :action => 'activate', :token => token.value) mail :to => token.user.mail, - :subject => l(:mail_subject) + :subject => "#{Setting.mail_subject}" end def test_email(user) From 4f6e9b2c3ba525c0a09592ebf1d7b11ae3cca40b Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 27 Dec 2016 14:13:51 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=B7=AF=E7=94=B1=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_contest_news.html.erb | 4 ++-- config/routes.rb | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/news/_contest_news.html.erb b/app/views/news/_contest_news.html.erb index 2af1457ce..df71b70a7 100644 --- a/app/views/news/_contest_news.html.erb +++ b/app/views/news/_contest_news.html.erb @@ -25,8 +25,8 @@ <% if contest && User.current.admin_of_contest?(@contest) %> - <%= labelled_form_for @news, :url => new_contest_news_path(:contest_id => @contest), - :html => {:id => 'news-form', :nhname => 'form', :multipart => true, :method => "get"} do |f| %> + <%= labelled_form_for @news, :url => {:controller => 'news', :action => 'new', :contest_id => @contest.id}, + :html => {:id => 'news-form', :nhname => 'form', :multipart => true} do |f| %> <%= render :partial => 'contest_news_new', :locals => {:f => f, :news => @news, :edit_mode => false, :contest => @contest} %> <% end %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 91a627424..3f22dde68 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -563,6 +563,8 @@ RedmineApp::Application.routes.draw do get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic' match 'courses/:course_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' match 'courses/:course_id/news/new', :to => 'news#new', :via => [:get, :post] + match 'contests/:contest_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_contest_news' + match 'contests/:contest_id/news/new', :to => 'news#new', :via => [:get, :post] match 'users/:user_id/homepage/articles/:id', :to => 'article_homepages#show', :as => "user_homepage_show" match 'users/:id/courses', :to => 'users#course_community', :as => "user_course_community" From 2b2498d66abe46f4a5eb088ea84897a01bf6914d Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 27 Dec 2016 16:36:35 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E7=8F=AD=E7=BA=A7=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ad25b22a9..28e0dbfbd 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4067,8 +4067,10 @@ class UsersController < ApplicationController @contest = Contest.find params[:contest] member = ContestMember.where("user_id = #{@user.id} and contest_id = #{@contest.id}") end - unless member.empty? + if !member.empty? && params[:contest] member.first.update_attribute(:is_collect, member.first.is_collect == false ? 1 : 0) + elsif !member.empty? + member.first.update_attribute(:is_collect, member.first.is_collect == 0 ? 1 : 0) end if @project @projects = @user.favorite_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)