帖子回复功能

This commit is contained in:
daiao 2017-09-30 21:34:57 +08:00
parent e00bb90c23
commit 112f350995
5 changed files with 18 additions and 6 deletions

View File

@ -165,10 +165,9 @@ class MemosController < ApplicationController
@flag = false
respond_to do |format|
if( #@memo.update_column(:subject, params[:memo][:subject]) &&
@memo.update_column(:content, params[:memo][:content]) &&
@memo.update_column(:sticky, params[:memo][:sticky]) &&
@memo.update_column(:lock, params[:memo][:lock]) &&
if( @memo.update_column(:content, params[:memo][:content]) &&
@memo.update_column(:sticky, params[:memo][:sticky].to_i) &&
@memo.update_column(:lock, params[:memo][:lock].to_i) &&
@memo.update_column(:subject,params[:memo][:subject]) &&
@memo.update_column(:updated_at,Time.now))
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))

View File

@ -41,7 +41,7 @@
<span class="btn-top btn-cir-red mt7 ml5 fl">顶</span>
<% end %>
</p>
<p style="width: 1091px;" class="overellipsis color-dark-grey mb10"><%= memo.content.html_safe %></p>
<div style="width: 1091px; height: 30px;" class="overellipsis color-dark-grey mb10"><%= memo.content.html_safe %></div>
<div class="clearfix">
<a href="<%= user_path(memo.author_id) %>" class="fl"><%= User.find(memo.author_id).try(:show_name) %></a>
<span class="fl ml30"><%= time_from_now memo.updated_at %></span>

View File

@ -1,7 +1,7 @@
<div class="orig_cont clearfix">
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<div>
<%= render :partial => 'student_work/homework_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %>
<%= render :partial => 'messages/message_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %>
</div>
<% end %>
<%= render :partial => 'student_work/homework_reply_detail', :locals => {:comment => comment, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %>

View File

@ -750,6 +750,8 @@ RedmineApp::Application.routes.draw do
end
member do
get "change_sticky"
post "reply"
match "message_replies", :via => [:get, :post]
end
end
end

View File

@ -0,0 +1,11 @@
class ModifyStickyForMemos < ActiveRecord::Migration
def up
memos = Memo.where(:sticky => nil)
if memos.present?
memos.update_all(:sticky => 0)
end
end
def down
end
end