diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5933f2e9c..5b94dd75c 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) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index a348d15a7..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_register, Setting.app_title) + :subject => "#{Setting.mail_subject}" end def test_email(user) 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 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/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/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb index 2491e6498..5b5aac94d 100644 --- a/app/views/users/_news_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -1,33 +1,34 @@
+ +

+ <% end %> + +
+ + <% end %> <% end %> \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index e5fd7b93b..b728ab991 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/routes.rb b/config/routes.rb index 004a0b4e9..0877a7a03 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" 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