forked from jacknudt/trustieforge
修改留言的引用功能
This commit is contained in:
parent
37e9e8395c
commit
84b5e61c55
|
@ -40,13 +40,18 @@ class BidsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@state = false
|
||||
@user = @bid.author
|
||||
@jour = @bid.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@jours = @bid.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]
|
||||
@state = false
|
||||
|
||||
#
|
||||
# @journals = @bid.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
|
||||
#@journals.each_with_index {|j,i| j.indice = i+1}
|
||||
# @journals.each_with_index {|j,i| j.indice = i+1}
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
|
@ -99,8 +104,12 @@ class BidsController < ApplicationController
|
|||
## 新建留言
|
||||
def create
|
||||
|
||||
if params[:bid_message].size>0
|
||||
message = params[:bid_message][:message]
|
||||
if params[:bid_message][:message].size>0
|
||||
if params[:reference_content]
|
||||
message = params[:reference_content] + params[:bid_message][:message]
|
||||
else
|
||||
message = params[:bid_message][:message]
|
||||
end
|
||||
refer_user_id = params[:bid_message][:reference_user_id].to_i
|
||||
@bid.add_jour(User.current, message, refer_user_id)
|
||||
# if a_message.size > 5
|
||||
|
@ -110,9 +119,14 @@ class BidsController < ApplicationController
|
|||
# end
|
||||
# @message_count = a_message.count
|
||||
end
|
||||
@jour = @bid.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@bid.set_commit(@jour.count)
|
||||
@user = @bid.author
|
||||
@jours = @bid.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]
|
||||
@bid.set_commit(@feedback_count)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -124,9 +138,15 @@ class BidsController < ApplicationController
|
|||
##删除留言
|
||||
def destroy
|
||||
JournalsForMessage.delete_message(params[:object_id])
|
||||
@jour = @bid.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@bid.set_commit(@jour.count)
|
||||
@user = @bid.author
|
||||
@jours = @bid.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]
|
||||
|
||||
@bid.set_commit(@feedback_count)
|
||||
# if a_message.size > 5
|
||||
# @message = a_message[-5, 5]
|
||||
# else
|
||||
|
@ -153,7 +173,7 @@ class BidsController < ApplicationController
|
|||
end
|
||||
# Replaces pre blocks with [...]
|
||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
@id = user.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
@ -67,7 +67,7 @@ class JournalsController < ApplicationController
|
|||
end
|
||||
# Replaces pre blocks with [...]
|
||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
@id = user.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
@ -112,7 +112,7 @@ class MessagesController < ApplicationController
|
|||
@subject = @message.subject
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
|
||||
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
end
|
||||
|
||||
|
|
|
@ -9,27 +9,27 @@ def index
|
|||
# @message.each do |m|
|
||||
# Activity.create(:act_id => m.id, :act_type => 'Message', :user_id => m.author_id)
|
||||
# end
|
||||
activity = Message.all
|
||||
activity += News.all
|
||||
activity += Journal.all
|
||||
activity += Issue.all
|
||||
activity += Bid.all
|
||||
@activity = activity.sort {|x,y| x.created_on <=> y.created_on}
|
||||
@activity.each do |act|
|
||||
if act.instance_of?(Bid)
|
||||
act.acts << Activity.new(:user_id => act.author_id)
|
||||
elsif act.instance_of?(News)
|
||||
act.acts << Activity.new(:user_id => act.author_id)
|
||||
elsif act.instance_of?(Message)
|
||||
act.acts << Activity.new(:user_id => act.author_id)
|
||||
elsif act.instance_of?(Journal)
|
||||
act.acts << Activity.new(:user_id => act.user_id)
|
||||
elsif act.instance_of?(Issue)
|
||||
act.acts << Activity.new(:user_id => act.author_id)
|
||||
elsif act.instance_of?(Changeset)
|
||||
act.acts << Activity.new(:user_id => act.user_id)
|
||||
end
|
||||
end
|
||||
# activity = Message.all
|
||||
# activity += News.all
|
||||
# activity += Journal.all
|
||||
# activity += Issue.all
|
||||
# activity += Bid.all
|
||||
# @activity = activity.sort {|x,y| x.created_on <=> y.created_on}
|
||||
# @activity.each do |act|
|
||||
# if act.instance_of?(Bid)
|
||||
# act.acts << Activity.new(:user_id => act.author_id)
|
||||
# elsif act.instance_of?(News)
|
||||
# act.acts << Activity.new(:user_id => act.author_id)
|
||||
# elsif act.instance_of?(Message)
|
||||
# act.acts << Activity.new(:user_id => act.author_id)
|
||||
# elsif act.instance_of?(Journal)
|
||||
# act.acts << Activity.new(:user_id => act.user_id)
|
||||
# elsif act.instance_of?(Issue)
|
||||
# act.acts << Activity.new(:user_id => act.author_id)
|
||||
# elsif act.instance_of?(Changeset)
|
||||
# act.acts << Activity.new(:user_id => act.user_id)
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
#@watchers_of_projects = WatchersOfProjects.new
|
||||
|
|
|
@ -5,7 +5,11 @@ class WordsController < ApplicationController
|
|||
def create
|
||||
if params[:new_form][:user_message].size>0
|
||||
unless params[:user_id].nil?
|
||||
message = params[:new_form][:user_message]
|
||||
if params[:reference_content]
|
||||
message = params[:reference_content] + params[:new_form][:user_message]
|
||||
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, refer_user_id)
|
||||
|
@ -64,7 +68,7 @@ class WordsController < ApplicationController
|
|||
end
|
||||
# Replaces pre blocks with [...]
|
||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
@id = user.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
@ -1,24 +1,7 @@
|
|||
<!-- added by fq -->
|
||||
<table width="660px" border="0" align="center">
|
||||
<tr>
|
||||
<td class="font_lighter" style="font-size: 18px;"><%=l(:label_user_response)%>(<%= journals.count%>)</td>
|
||||
<td><% if journals.size > 5 %>
|
||||
<% unless state%>
|
||||
<div class="contextual">
|
||||
<%= link_to l(:button_more),
|
||||
{:controller => 'bids', :action => 'more', :id => bid},
|
||||
:remote => true,
|
||||
:method => 'get' %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="contextual">
|
||||
<%= link_to l(:button_back),
|
||||
{:controller => 'bids', :action => 'back', :id => bid},
|
||||
:remote => true,
|
||||
:method => 'get' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %><td>
|
||||
<td class="font_lighter" style="font-size: 18px;"><%=l(:label_user_response)%></td>
|
||||
</tr></table>
|
||||
|
||||
|
||||
|
@ -26,11 +9,6 @@
|
|||
<%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %>
|
||||
</div>
|
||||
|
||||
<% unless state%>
|
||||
<% if journals.size > 5 %>
|
||||
<% journals = journals[0, 5] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if journals.size >0 %>
|
||||
<% remove_allowed = (User.current.id == journals.first.jour_id) %>
|
||||
|
|
|
@ -57,6 +57,11 @@
|
|||
:action => 'create',
|
||||
:id => bid,
|
||||
:sta => sta}) do |f|%>
|
||||
|
||||
<div id = 'pre_show'>
|
||||
<%= render :partial => 'pre_show', :locals => {:content => @content} %>
|
||||
</div>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<table border="0" width="525px" align="center" >
|
||||
<tr>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!-- fq -->
|
||||
<% unless content.nil?%>
|
||||
<table width="60%" style="margin-left: 60px;">
|
||||
<tr>
|
||||
<td> <%= textilizable content %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
|
@ -1,3 +1,4 @@
|
|||
$('#history').html('<%= escape_javascript(render(:partial => 'bids/history', :locals => {:bid => @bid, :journals => @jour, :state => true})) %>');
|
||||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||
$('#bid_message_message').val("");
|
||||
$('#bid_message_reference_user_id').val("");
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
$('#bid_message_message').val("<%= raw escape_javascript(@content) %>");
|
||||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => @content})) %>');
|
||||
$('#bid_message_reference_user_id').val("<%= @id%>");
|
||||
showAndScrollTo("bid_message", "bid_message");
|
||||
showAndScrollTo("pre_show", "bid_message_reference_user_id");
|
||||
|
|
|
@ -27,5 +27,10 @@
|
|||
<%= render :partial => 'history', :locals => { :bid => @bid, :journals => @jour, :state => false} %>
|
||||
</div>
|
||||
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul>
|
||||
<%= pagination_links_full @feedback_pages %>
|
||||
<ul>
|
||||
</div>
|
||||
|
||||
<!-- end -->
|
||||
|
|
|
@ -57,6 +57,11 @@
|
|||
:action => 'create',
|
||||
:user_id => user.id,
|
||||
:sta => sta}) do |f|%>
|
||||
|
||||
<div id = 'pre_show'>
|
||||
<%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
|
||||
</div>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<table border="0" width="525px" align="center" >
|
||||
<tr>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!-- fq -->
|
||||
<% unless content.nil?%>
|
||||
<table width="60%" style="margin-left: 60px;">
|
||||
<tr>
|
||||
<td> <%= textilizable content %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
|
@ -1,3 +1,4 @@
|
|||
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>');
|
||||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||
$('#new_form_user_message').val("");
|
||||
$('#new_form_reference_user_id').val("");
|
|
@ -1,3 +1,3 @@
|
|||
$('#new_form_user_message').val("<%= raw escape_javascript(@content)%>");
|
||||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => @content})) %>');
|
||||
$('#new_form_reference_user_id').val("<%= @id %>");
|
||||
showAndScrollTo("new_form_user_message", "new_form_user_message");
|
||||
showAndScrollTo("pre_show", "new_form_user_message");
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -974,7 +974,22 @@ input, select {vertical-align: middle; margin-top: 1px; margin-bottom: 1px;}
|
|||
fieldset {border: 1px solid #e4e4e4; margin:0;}
|
||||
legend {color: #484848;}
|
||||
hr { width: 100%; height: 1px; background: #ccc; border: 0; color:#000000;}
|
||||
blockquote { font-style: italic; border-left: 3px solid #e0e0e0; padding-left: 0.6em; margin-left: 2.4em;}
|
||||
blockquote {
|
||||
/*font-style: italic; */
|
||||
border-left: 1px solid #e0e0e0;
|
||||
border-right: 1px solid #e0e0e0;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
padding-left: 0.6em;
|
||||
padding-top: 0.6em;
|
||||
padding-right: 0.6em;
|
||||
padding-bottom: 0.6em;
|
||||
margin-left: 1.4em;
|
||||
margin-right: 0.4em;
|
||||
font-family: 微软雅黑;
|
||||
background: url(/images/requirements/reference.jpg)
|
||||
}
|
||||
|
||||
blockquote blockquote { margin-left: 0;}
|
||||
acronym { border-bottom: 1px dotted; cursor: help; }
|
||||
textarea.wiki-edit {width:99%; resize:vertical;}
|
||||
|
|
Loading…
Reference in New Issue