From 18d096f0d88353a51f1894add15a35b225322ca0 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 22 Jul 2014 17:40:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE=EF=BC=8C?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=A1=A8project=5Fid=E4=BC=9A=E7=BD=AE?= =?UTF-8?q?=E7=A9=BA=EF=BC=8Cprojecting=5Fsoftapplications=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=B8=8D=E7=9F=A5=E9=81=93=E5=B9=B2=E5=98=9B=E7=94=A8?= =?UTF-8?q?=EF=BC=8C=E6=AD=A4=E8=A1=A8=E4=B9=9F=E4=B8=8D=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../softapplications_controller.rb | 26 +++++++++---------- app/models/softapplication.rb | 1 - 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index d7b2477a8..1808a3eaa 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -19,20 +19,20 @@ class SoftapplicationsController < ApplicationController #new added sort if params[:softapplication_sort_type].present? - case params[:softapplication_sort_type] + case params[:softapplication_sort_type] when '0' - @softapplications = @softapplications[@offset, @limit] + @softapplications = @softapplications[@offset, @limit] @s_state = 0 when '1' - @softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit] + @softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit] @s_state = 1 end - else - @softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit] - @s_state = 1 + else + @softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit] + @s_state = 1 end #new added end - + respond_to do |format| format.html # index.html.erb format.json { render json: @softapplications } @@ -216,19 +216,19 @@ class SoftapplicationsController < ApplicationController def new_message @jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id] if @jour - user = @jour.user - text = @jour.notes + user = @jour.user + text = @jour.notes else - user = @softapplication.user - text = @softapplication.description + user = @softapplication.user + text = @softapplication.description end text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') @content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" @id = user.id - rescue ActiveRecord::RecordNotFound + rescue ActiveRecord::RecordNotFound render_404 - end + end #新建评价 def create_message diff --git a/app/models/softapplication.rb b/app/models/softapplication.rb index f7eed43fc..770d70d53 100644 --- a/app/models/softapplication.rb +++ b/app/models/softapplication.rb @@ -10,7 +10,6 @@ class Softapplication < ActiveRecord::Base belongs_to :user belongs_to :project has_many :contests, :through => :contesting_softapplications - belongs_to :project def add_jour(user, notes, reference_user_id = 0, options = {}) if options.count == 0