This commit is contained in:
sw 2014-07-04 11:31:09 +08:00
commit a1920ca54c
4 changed files with 11 additions and 9 deletions

View File

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

View File

@ -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
# 创建课程讨论区

View File

@ -4,7 +4,7 @@
<div class="box ph10_5">
<!--[form:message]-->
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br />
<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject" %><!--by young-->
<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject",:readonly=>true %><!--by young-->
</p>
<p>
<% unless replying %>
@ -30,9 +30,12 @@
<p>
<%= 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' %></p>
<%= wikitoolbar_for 'message_content' %>
<!--[eoform:message]-->
<p><%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @message} %></p>
</div>
<%#= wikitoolbar_for 'message_content' %>

View File

@ -50,7 +50,7 @@
<table width="580" border="0" class="info-break">
<% 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 %>
<tr><td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_have_feedback) %><%=
link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>