From 08a6dec39d4cc6f2adfdd7e2b6d047bf77060921 Mon Sep 17 00:00:00 2001 From: nwb Date: Fri, 4 Jul 2014 11:11:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=9B=9E=E5=A4=8D=E6=97=B6=E4=B8=BB=E9=A2=98=E5=8F=AA?= =?UTF-8?q?=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 9 ++++----- app/views/messages/_form.html.erb | 7 +++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index ff5e4fbd..bf6190c8 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -38,6 +38,7 @@ class Course < ActiveRecord::Base validates_format_of :class_period, :with =>/^[1-9]\d*$/ validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/ + before_save :self_validate after_save :create_board_sync before_destroy :delete_all_members @@ -77,7 +78,7 @@ class Course < ActiveRecord::Base where(nil) else pattern = "%#{arg.to_s.strip.downcase}%" - where("LOWER(extra) LIKE :p OR LOWER(name) LIKE :p ", :p => pattern) + where(" LOWER(name) LIKE :p ", :p => pattern) end } @@ -166,10 +167,8 @@ class Course < ActiveRecord::Base end #自定义验证 - def validate - if !class_period.match([0-9]) - errors.add_to_base("class period can only digital") - end + def self_validate + end # 创建课程讨论区 diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index 6324cec3..b3ffbe3e 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -4,7 +4,7 @@


-<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject" %> +<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject",:readonly=>true %>

<% unless replying %> @@ -30,9 +30,12 @@

<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %> <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %>

-<%= wikitoolbar_for 'message_content' %> +

<%= l(:label_attachment_plural) %>
<%= render :partial => 'attachments/form', :locals => {:container => @message} %>

+ + +<%#= wikitoolbar_for 'message_content' %> \ No newline at end of file From d54f37e6306bc3966bacf71e9503a542410411ac Mon Sep 17 00:00:00 2001 From: yanxd Date: Fri, 4 Jul 2014 11:15:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=8A=A8=E6=80=81?= =?UTF-8?q?=EF=BC=8C=E5=88=A4=E6=96=AD=E7=95=99=E8=A8=80=E4=BA=BA=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 58974aad..ec469a5b 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -50,7 +50,7 @@ <% case e.act_type %> <% when 'JournalsForMessage' %> - <% if User.current.login == @user.login %> + <% if User.current.login == e.user.try(:login) %> <%# if e.user_id == act.jour.id %> From 36c90f1dfd2123cf7dfbea7a9699bfcacb4e0aeb Mon Sep 17 00:00:00 2001 From: yanxd Date: Fri, 4 Jul 2014 11:30:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=E5=AD=A6?= =?UTF-8?q?=E6=A0=A1=EF=BC=8C=E5=86=8D=E6=8B=BFid=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 7c60e2dc..9c72d301 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -33,7 +33,7 @@ class WelcomeController < ApplicationController if params[:school_id] @school_id = params[:school_id] elsif User.current.logged? && User.current.user_extensions.school - @school_id = User.current.user_extensions.school.id + @school_id = User.current.user_extensions.school.try(:id) end @logoLink ||= logolink() end
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %>