Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
daiao 2016-12-27 16:56:54 +08:00
commit 7c44a14fb5
9 changed files with 63 additions and 48 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -25,8 +25,8 @@
</div>
</div>
<% 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 %>

View File

@ -4,6 +4,8 @@
<div class="box tabular settings">
<p><%= setting_text_field :mail_from, :size => 50 %></p>
<p><%= setting_text_field :mail_subject, :size => 50 %></p>
<p><%= setting_check_box :bcc_recipients %></p>
<p><%= setting_check_box :plain_text_mail %></p>

View File

@ -1,33 +1,34 @@
<ul>
<% comments.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=activity_id %>_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=activity_id %>_<%=comment.id %>').hide();">
<%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id}%>
<% unless comment.nil? %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=activity_id %>_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=activity_id %>_<%=comment.id %>').hide();">
<%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id}%>
<% if !comment.content_detail.blank? || comment.class == Journal %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>
<p><%= string %></p>
<% if !comment.content_detail.blank? || comment.class == Journal %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>
<p><%= string %></p>
<% end %>
<% end %>
<P><%= comment.notes.html_safe %></P>
<% else %>
<%= comment.content_detail.html_safe %>
<% end %>
<P><%= comment.notes.html_safe %></P>
<% else %>
<%= comment.content_detail.html_safe %>
<% end %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span class="reply_praise_count_<%= comment.id %>">
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
@ -42,22 +43,22 @@
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% 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' %>
<span style="position: relative" class="fr mr20">
<%= 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)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
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)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% news = News.find(activity_id) %>
<%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id => activity_id, :comment_id => comment, :user_activity_id => user_activity_id},
<% 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) || User.current == comment.author || User.current.admin_of_contest?(news.contest)) %>
<% elsif type == 'Issue' %>
<span style="position: relative" class="fr mr20">
@ -67,9 +68,9 @@
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<%= 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 %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li>
<% end %>
<% end %>
</ul>

View File

@ -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: 主机名称

View File

@ -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"

View File

@ -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