From cc2f359e8c44f7bd6f39800357837bd6e5eb9df9 Mon Sep 17 00:00:00 2001 From: yanxd Date: Thu, 8 May 2014 15:27:16 +0800 Subject: [PATCH] =?UTF-8?q?1.=20Three=20expressions=20syntax=202.=20?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=98=BE=E7=A4=BA=E9=87=8D=E5=A4=8D=203.=20?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6=E5=86=85=E5=AE=B9=204.=20s?= =?UTF-8?q?how=5Fcontest.html=20typo=205.=20welcome.css=20typo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/activities_controller.rb | 2 +- app/controllers/contests_controller.rb | 2 +- app/models/mailer.rb | 38 ++++++++++++++++-------- app/views/contests/show_contest.html.erb | 2 +- public/stylesheets/welcome.css | 3 +- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index 83b97f7d..e1ec7a79 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -49,7 +49,7 @@ class ActivitiesController < ApplicationController @activity_pages = Paginator.new @activity_count, @limit, params['page'] @offset ||= @activity_pages.offset - @project_base_tag = params[:id]?'base_projects':'base' + @project_base_tag = params[:id] ? 'base_projects' : 'base' if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, events.size, User.current, current_language]) respond_to do |format| format.html { diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 14395ac0..7ceb575f 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -74,7 +74,7 @@ class ContestsController < ApplicationController def show_contest @user = @contest.author - @jours = @contest.journals_for_messages.order('created_on DESC') + @jours = @contest.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') @limit = 10 @feedback_count = @jours.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 3db78752..d8e3d29b 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -28,20 +28,32 @@ class Mailer < ActionMailer::Base end # Builds a Mail::Message object used to email recipients of the added journals for message. - # + + # 留言分为直接留言,和对留言人留言的回复 + # 字段说明在JournalsForMessage.rb + # 直接留言后 reply_id,m_parent_id 为空,相对应的at_user取值为nil + def journals_for_message_add(user, journals_for_message) - @user = journals_for_message.user - if journals_for_message.jour_type!="Project"&&journals_for_message.jour_type!="Bid" - if(journals_for_message.reply_id==0) - @mail = journals_for_message.jour - else - @mail = journals_for_message.at_user - end - @message = journals_for_message.notes - @url = url_for(:controller => 'users', :action => 'user_newfeedback', :id => journals_for_message.jour) - str = "#{@user} #{t(:label_leave_your_message, :locale => 'zh')}" - mail :to => @mail.mail, :subject => str - end + @user = journals_for_message.user # 留言人 + @mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言 + @mail = journals_for_message.at_user if journals_for_message.at_user + @message = journals_for_message.notes + @title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}" + + @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型 + when :Bid + respond_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + when :Project + project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + when :Contest + show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + when :User + user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + else + logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}" + return -1 + end + mail :to => @mail.mail, :subject => @title end # Builds a Mail::Message object used to email recipients of the added issue. diff --git a/app/views/contests/show_contest.html.erb b/app/views/contests/show_contest.html.erb index 9ce40bfc..67414b0c 100644 --- a/app/views/contests/show_contest.html.erb +++ b/app/views/contests/show_contest.html.erb @@ -29,6 +29,6 @@ diff --git a/public/stylesheets/welcome.css b/public/stylesheets/welcome.css index 9be87623..cdfacf9e 100644 --- a/public/stylesheets/welcome.css +++ b/public/stylesheets/welcome.css @@ -402,8 +402,7 @@ a.attachments_list_color { display: inline-block; margin-bottom: 3px; padding-left: 20px; - background: url('/images/list-icon.png') no-repeat scroll; - background-position: left center; + background: url('../images/list-icon.png') no-repeat scroll left center; font-size: 10pt; } /*帖子的各种属性*/