留言修改
This commit is contained in:
parent
1af4e4f712
commit
f3ce918699
|
@ -39,6 +39,44 @@ class WordsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def create_reply
|
||||
if params[:new_form][:user_message].size>0
|
||||
unless params[:user_id].nil?
|
||||
if params[:reference_content]
|
||||
message = params[:new_form][:user_message] + "\n" + params[:reference_content]
|
||||
else
|
||||
message = params[:new_form][:user_message]
|
||||
end
|
||||
refer_user_id = params[:new_form][:reference_user_id].to_i
|
||||
|
||||
# @user.add_jour(User.current, message, params[:object_id])
|
||||
@user.add_reply(params[:object_id], @user.current, message)
|
||||
unless refer_user_id == 0 || refer_user_id == User.current.id
|
||||
User.find(refer_user_id).add_jour(User.current, message, refer_user_id)
|
||||
end
|
||||
@user.count_new_jour
|
||||
# if a_message.size > 5
|
||||
# @message = a_message[-5, 5]
|
||||
# else
|
||||
# @message = a_message
|
||||
# end
|
||||
# @message_count = a_message.count
|
||||
end
|
||||
end
|
||||
@jours = @user.journals_for_messages.reverse
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if User.current.admin? || User.current.id == @user.id
|
||||
JournalsForMessage.delete_message(params[:object_id])
|
||||
|
|
|
@ -6,6 +6,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
belongs_to :jour, :polymorphic => true
|
||||
belongs_to :user
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
has_many :reply_for_journals, :dependent => :destroy
|
||||
after_create :act_as_activity #huang
|
||||
|
||||
def self.delete_message(message_id)
|
||||
|
@ -24,7 +25,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
|
||||
def act_as_activity
|
||||
if self.jour_type == 'Principal'
|
||||
unless self.user_id == self.jour.id && self.user_id != self.reply_id && self.reply_id !=0
|
||||
unless self.user_id == self.jour.id && self.user_id != self.reply_id && self.reply_id != 0
|
||||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
class ReplyForJournal < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
belongs_to :journals_for_messages
|
||||
end
|
|
@ -205,6 +205,11 @@ class User < Principal
|
|||
count = self.new_jours.count
|
||||
end
|
||||
|
||||
#added by nie
|
||||
def count_new_journal_reply
|
||||
count = self.journal_reply.count
|
||||
end
|
||||
|
||||
def set_mail_notification
|
||||
##add byxianbo
|
||||
thread=Thread.new do
|
||||
|
|
|
@ -67,14 +67,10 @@
|
|||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
<strong class="font_small_watch"><%= link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%></strong>
|
||||
|
||||
<strong class="font_small_watch"><%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users(@user.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist" %></strong>
|
||||
|
||||
<strong class="font_small_watch"><%= link_to l(:label_requirement_focus)+"("+Bid.watched_by(@user).where('reward_type = ?', 1).count.to_s+")" ,:controller=>"users", :action=>"watch_bids"%></strong> <!-- added by huang -->
|
||||
|
||||
<!-- added by bai 个人签名-->
|
||||
<% if @user.id == User.current.id %>
|
||||
<p>
|
||||
|
@ -89,9 +85,7 @@
|
|||
<div id="introduction" style="display: none">
|
||||
<%= form_for('new_form', :method => :post,
|
||||
:url => {:controller => 'words', :action => 'add_brief_introdution'}) do |f|%>
|
||||
|
||||
<table border="0" width="100%" align="center" >
|
||||
|
||||
<tr>
|
||||
<td><%= f.text_area 'user_introduction', :rows => 3,
|
||||
:cols => 65,
|
||||
|
@ -109,9 +103,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
<!--info-->
|
||||
|
@ -126,9 +118,7 @@
|
|||
<tr>
|
||||
<td valign="top" style="padding-left: 8px;"><%= l(:label_user_mail) %></td><td class="font_lighter_sidebar" style="padding-left: 0px; word-wrap: break-word; word-break: break-all"><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
|
||||
</tr>
|
||||
|
||||
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
|
||||
|
||||
<% unless @user.user_extensions.nil? %>
|
||||
<% unless @user.user_extensions.identity == 2 %>
|
||||
<tr>
|
||||
|
|
|
@ -25,19 +25,22 @@
|
|||
<tr>
|
||||
<td align="left"><span class="font_lighter"> <%= l :label_comment_time %>: <%= format_time journal.created_on %></span></td>
|
||||
|
||||
<td width="200" align="right" class="a"> <% if @user == User.current %>
|
||||
<%= link_to(l(:label_newfeedback_quote), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true,
|
||||
:method => 'post', :title => l(:button_quote))%>
|
||||
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) if remove_allowed || journal.jour_id == User.current.id %></td>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_newfeedback_quote), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true,
|
||||
:method => 'post', :title => l(:button_quote))%>
|
||||
<td width="200" align="right" class="a">
|
||||
<% if @user == User.current %>
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
<%= toggle_link l(:label_projects_feedback_respond), ids, {:focus => 'project_respond'} %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id=<%= ids %> style="display: none;width: 80%; margin: auto;">
|
||||
<%= render :partial => 'words/new_respond', :locals => {:journal => journal} %>
|
||||
</div>
|
||||
<div>
|
||||
<%= render :partial => 'words/journal_reply', :locals => {:journal => journal} %>
|
||||
</div>
|
||||
<div class="line_under"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<%= form_tag({:controller => 'words',
|
||||
:action => 'create_reply'}) do %>
|
||||
<%= text_area_tag 'project_respond', "", :class => 'noline', :required => true, :style => "resize: none;", :rows => 4, :placeholder => l(:label_projects_feedback_respond_content) %>
|
||||
|
||||
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
|
||||
<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "bid_btn", :style => "margin-top: 1px;"%>
|
||||
|
||||
<% end %>
|
|
@ -1,3 +1,4 @@
|
|||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => @content})) %>');
|
||||
$('#new_form_reference_user_id').val("<%= @id %>");
|
||||
showAndScrollTo("pre_show", "new_form_user_message");
|
||||
|
||||
|
|
|
@ -452,6 +452,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'words/new', :to => 'words#new'
|
||||
post 'words/create', :to => 'words#create'
|
||||
post 'words/append', :to => 'words#append'
|
||||
post 'words/create_reply', :to => 'words#create_reply'
|
||||
delete 'words/destroy', :to => 'words#destroy'
|
||||
get 'words/more', :to => 'words#more'
|
||||
get 'words/back', :to=> 'words#back'
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class AddMissingAttributeToJournalsForMessages < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :journals_for_messages, :m_parent_id, :string
|
||||
add_column :journals_for_messages, :is_readed, :boolean
|
||||
add_column :journals_for_messages, :m_reply_count, :int
|
||||
add_column :journals_for_messages, :m_reply_id, :int
|
||||
end
|
||||
end
|
115
db/schema.rb
115
db/schema.rb
|
@ -11,7 +11,15 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20131215065910) do
|
||||
ActiveRecord::Schema.define(:version => 20131224021723) do
|
||||
|
||||
create_table "a_user_watchers", :force => true do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "member_id"
|
||||
end
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -296,7 +304,7 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
create_table "issue_relations", :force => true do |t|
|
||||
t.integer "issue_from_id", :null => false
|
||||
t.integer "issue_to_id", :null => false
|
||||
t.string "relation_type", :default => "", :null => false
|
||||
t.string "relation_type", :null => false
|
||||
t.integer "delay"
|
||||
end
|
||||
|
||||
|
@ -403,6 +411,10 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
t.integer "reply_id"
|
||||
t.datetime "created_on", :null => false
|
||||
t.datetime "updated_on", :null => false
|
||||
t.string "m_parent_id"
|
||||
t.boolean "is_readed"
|
||||
t.integer "m_reply_count"
|
||||
t.integer "m_reply_id"
|
||||
end
|
||||
|
||||
create_table "member_roles", :force => true do |t|
|
||||
|
@ -460,6 +472,22 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
|
||||
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
||||
|
||||
create_table "messages_for_bids", :force => true do |t|
|
||||
t.string "message"
|
||||
t.integer "user_id"
|
||||
t.integer "bid_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "messages_for_users", :force => true do |t|
|
||||
t.integer "messager_id"
|
||||
t.integer "user_id"
|
||||
t.string "message"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "news", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.string "title", :limit => 60, :default => "", :null => false
|
||||
|
@ -489,6 +517,23 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
t.string "salt", :null => false
|
||||
end
|
||||
|
||||
create_table "permissions", :force => true do |t|
|
||||
t.string "controller", :limit => 30, :default => "", :null => false
|
||||
t.string "action", :limit => 30, :default => "", :null => false
|
||||
t.string "description", :limit => 60, :default => "", :null => false
|
||||
t.boolean "is_public", :default => false, :null => false
|
||||
t.integer "sort", :default => 0, :null => false
|
||||
t.boolean "mail_option", :default => false, :null => false
|
||||
t.boolean "mail_enabled", :default => false, :null => false
|
||||
end
|
||||
|
||||
create_table "permissions_roles", :id => false, :force => true do |t|
|
||||
t.integer "permission_id", :default => 0, :null => false
|
||||
t.integer "role_id", :default => 0, :null => false
|
||||
end
|
||||
|
||||
add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
|
||||
|
||||
create_table "praise_tread_caches", :force => true do |t|
|
||||
t.integer "object_id", :null => false
|
||||
t.string "object_type"
|
||||
|
@ -519,11 +564,22 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
t.integer "watchers_count"
|
||||
t.integer "project_id"
|
||||
t.integer "project_type"
|
||||
t.integer "gitlab_group_id", :limit => 8
|
||||
t.float "grade", :default => 0.0
|
||||
t.integer "course_ac_para", :default => 0
|
||||
end
|
||||
|
||||
add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade"
|
||||
add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count"
|
||||
add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count"
|
||||
|
||||
create_table "project_tags", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "tag_id"
|
||||
t.string "description"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
|
@ -568,6 +624,15 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
add_index "queries", ["project_id"], :name => "index_queries_on_project_id"
|
||||
add_index "queries", ["user_id"], :name => "index_queries_on_user_id"
|
||||
|
||||
create_table "reply_for_journals", :force => true do |t|
|
||||
t.integer "jour_id"
|
||||
t.integer "user_id"
|
||||
t.text "notes"
|
||||
t.integer "status"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "repositories", :force => true do |t|
|
||||
t.integer "project_id", :default => 0, :null => false
|
||||
t.string "url", :default => "", :null => false
|
||||
|
@ -580,6 +645,7 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
t.text "extra_info"
|
||||
t.string "identifier"
|
||||
t.boolean "is_default", :default => false
|
||||
t.string "git_project_id"
|
||||
end
|
||||
|
||||
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
||||
|
@ -593,26 +659,6 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
t.string "issues_visibility", :limit => 30, :default => "default", :null => false
|
||||
end
|
||||
|
||||
create_table "seems_rateable_cached_ratings", :force => true do |t|
|
||||
t.integer "cacheable_id", :limit => 8
|
||||
t.string "cacheable_type"
|
||||
t.float "avg", :null => false
|
||||
t.integer "cnt", :null => false
|
||||
t.string "dimension"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "seems_rateable_rates", :force => true do |t|
|
||||
t.integer "rater_id", :limit => 8
|
||||
t.integer "rateable_id"
|
||||
t.string "rateable_type"
|
||||
t.float "stars", :null => false
|
||||
t.string "dimension"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "settings", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
t.text "value"
|
||||
|
@ -623,9 +669,9 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
|
||||
create_table "shares", :force => true do |t|
|
||||
t.date "created_on"
|
||||
t.string "url"
|
||||
t.string "title"
|
||||
t.integer "share_type"
|
||||
t.string "share_type"
|
||||
t.string "url"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "project_id"
|
||||
|
@ -633,6 +679,12 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
t.string "description"
|
||||
end
|
||||
|
||||
create_table "students", :force => true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "students_for_courses", :force => true do |t|
|
||||
t.integer "student_id"
|
||||
t.integer "course_id"
|
||||
|
@ -691,7 +743,7 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
create_table "tokens", :force => true do |t|
|
||||
t.integer "user_id", :default => 0, :null => false
|
||||
t.string "action", :limit => 30, :default => "", :null => false
|
||||
t.string "value", :limit => 40, :default => "", :null => false
|
||||
t.string "value", :limit => 40
|
||||
t.datetime "created_on", :null => false
|
||||
end
|
||||
|
||||
|
@ -717,12 +769,13 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
t.integer "zip_code"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "technical_title"
|
||||
t.integer "identity"
|
||||
t.string "technical_title"
|
||||
t.string "student_id"
|
||||
t.string "teacher_realname"
|
||||
t.string "student_realname"
|
||||
t.string "location_city"
|
||||
t.string "git_token"
|
||||
end
|
||||
|
||||
create_table "user_grades", :force => true do |t|
|
||||
|
@ -759,6 +812,14 @@ ActiveRecord::Schema.define(:version => 20131215065910) do
|
|||
add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
|
||||
add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
|
||||
|
||||
create_table "user_tags", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "tag_id"
|
||||
t.string "description"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "login", :default => "", :null => false
|
||||
t.string "hashed_password", :limit => 40, :default => "", :null => false
|
||||
|
|
Loading…
Reference in New Issue