You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/student_works/comment_list.json.jbuilder

46 lines
2.0 KiB

6 years ago
json.allow_score allow_score(@homework, @user_course_identity, @current_user.id, @work)
json.ultimate @work.ultimate_score
json.last_comment do
json.last_content @last_comment.try(:comment)
json.last_score @last_comment.try(:score)
end
json.is_author @current_user == @work.user
json.comment_count @comment_scores.size
json.comment_scores @comment_scores do |score|
json.user_id score.user_id
json.user_login score.show_name(@user_course_identity, @current_user) ? score.user.login : "--"
json.user_image_url score.show_name(@user_course_identity, @current_user) ? url_to_avatar(score.user) : "--"
json.user_name score.show_name(@user_course_identity, @current_user) ? score.user.real_name : "匿名"
json.comment_id score.id
json.comment_role score.reviewer_role == 1 ? "教师" : score.reviewer_role == 2 ? "助教" : "学生"
json.comment_time score.created_at
json.score score.score
json.score_id score.id
json.content score.comment
json.appeal_status score.appeal_status
json.is_invalid score.is_invalid
json.delete score.allow_delete(@current_user, @user_course_identity)
json.attachments score.attachments do |atta|
json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: false}
end
json.can_appeal @homework.appeal_duration && score.reviewer_role == 3 && score.appeal_status == 0 && @work.user == @current_user
if @homework.anonymous_appeal && score.reviewer_role == 3 && score.student_works_scores_appeal.present?
json.appeal_info appeal_info(score.student_works_scores_appeal, @user_course_identity, @current_user)
end
json.can_reply !score.is_invalid && @user_course_identity <= Course::STUDENT
json.journals score.journals_for_messages.each do |message|
json.user_info message_user_name(message.user, score, @work.user, @current_user, @user_course_identity)
json.id message.id
json.content message.notes
json.time message.created_at
json.can_delete @user_course_identity == Course::ADMIN
end
end