mirror of
https://github.com/zhigang1992/tsemple.git
synced 2026-01-12 17:52:57 +08:00
Use client vidatation for topic/comments
This commit is contained in:
@@ -10,3 +10,12 @@
|
||||
= f.submit 'Save changes', class: 'btn btn-success'
|
||||
'
|
||||
a.btn.btn-default href=cancel_comment_path(comment) data-remote="true" Cancel
|
||||
|
||||
javascript:
|
||||
$('#edit_comment_#{comment.id}').validate({
|
||||
rules: {
|
||||
'comment[body]': {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= form_for @topic, remote: true, html: { class: 'form-topic' } do |f|
|
||||
= form_for @topic, remote: true, html: { class: 'topic-form' } do |f|
|
||||
.row
|
||||
.col-md-9
|
||||
.form-group
|
||||
@@ -14,3 +14,17 @@
|
||||
= f.submit 'Save changes', class: 'btn btn-success', tabIndex: 4
|
||||
'
|
||||
a.btn.btn-default href=topic_path(@topic) tabIndex="5" Cancel
|
||||
|
||||
- form_id = @topic.new_record? ? 'new_topic' : "edit_topic_#{@topic.id}"
|
||||
|
||||
javascript:
|
||||
$('##{form_id}').validate({
|
||||
rules: {
|
||||
'topic[title]': {
|
||||
required: true
|
||||
},
|
||||
'topic[body]': {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,3 +88,11 @@
|
||||
|
||||
javascript:
|
||||
campo.Likes.updateLikes('comment', #{current_user.likes.where(likeable_type: 'Comment', likeable_id: @comments.pluck(:id)).pluck(:likeable_id)});
|
||||
|
||||
$('#new_comment').validate({
|
||||
rules: {
|
||||
'comment[body]': {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -27,7 +27,6 @@ class Admin::UsersControllerTest < ActionController::TestCase
|
||||
assert_difference "User.count", -1 do
|
||||
delete :destroy, id: user
|
||||
end
|
||||
assert_redirected_to admin_users_path
|
||||
end
|
||||
|
||||
test "should lock user" do
|
||||
|
||||
Reference in New Issue
Block a user