题目申请说明内容较长时,会导致被申请者收不到消息

This commit is contained in:
cxt 2016-05-06 18:47:38 +08:00
parent 620cc83d4b
commit c6c3625029
5 changed files with 26 additions and 28 deletions

View File

@ -15,7 +15,7 @@ class CourseMessage < ActiveRecord::Base
validates :course_id,presence: true
validates :course_message_id,presence: true
validates :course_message_type, presence: true
validates_length_of :content, :maximum => 100
#validates_length_of :content, :maximum => 100
after_create :add_user_message
def add_user_message

View File

@ -1,27 +1,16 @@
<div>
<div class="ni_con">
<h2>请求分享</h2>
<p>
请求说明(可选):
<textarea type="text" id="apply_content" class="apply_content mt10" style="outline:none;"></textarea>
</p>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="apply_to();" style="margin-bottom: 20px; margin-left: 60px; color: #fff">
确&nbsp;&nbsp;定
</a>
</div>
<%= form_tag(apply_for_homework_user_path(:id=>User.current.id,:homework_id=>homework.id), :multipart => true,:remote => true,:name=>"apply_for_homework_form",:id=>'apply_for_homework_form') do %>
<h2>请求分享</h2>
<p>
请求说明(可选):
<textarea type="text" name="content" id="apply_content" class="apply_content mt10" style="outline:none;"></textarea>
</p>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="$('#apply_for_homework_form').submit();" style="margin-bottom: 20px; margin-left: 60px; color: #fff">
确&nbsp;&nbsp;定
</a>
</div>
<% end %>
</div>
</div>
<script>
function apply_to() {
url = '/users/<%=User.current.id %>/apply_for_homework?homework_id=<%=homework.id %>&content='+$("#apply_content").val();
$.get(
url,
{
},
function (data) {
}
);
}
</script>
</div>

View File

@ -516,7 +516,7 @@ RedmineApp::Application.routes.draw do
match 'user_project_activities', :to => 'users#user_project_activities', :via => :get
match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :get
match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :post
match 'apply_homework', :to => 'users#apply_homework', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
match 'student_homeworks', :to => 'users#student_homeworks', :via => :get
@ -583,6 +583,7 @@ RedmineApp::Application.routes.draw do
get 'user_homework_type'
get 'user_ref_homework_search'
get 'show_homework_detail'
post 'apply_for_homework'
# end
end
#resources :blogs

View File

@ -0,0 +1,8 @@
class ChangeCourseMessagesCloumn < ActiveRecord::Migration
def up
change_column :course_messages, :content, :text
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160429030819) do
ActiveRecord::Schema.define(:version => 20160506104128) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -485,7 +485,7 @@ ActiveRecord::Schema.define(:version => 20160429030819) do
t.integer "viewed"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "content"
t.text "content"
t.integer "status"
t.integer "apply_user_id"
t.integer "apply_result"