用户留言修复

This commit is contained in:
z9hang 2014-11-05 10:41:34 +08:00
parent 3b073eec74
commit b141db6624
8 changed files with 86 additions and 30 deletions

View File

@ -280,11 +280,11 @@ class UsersController < ApplicationController
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
end end
@limit = 10 #@limit = 10
@feedback_count = @jours.count #@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] #@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset #@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit] @jour = paginateHelper @jours,10
@state = false @state = false
end end
# end # end

View File

@ -27,11 +27,7 @@ class WordsController < ApplicationController
end end
end end
@jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse
@limit = 10 @jour = paginateHelper @jours,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| respond_to do |format|
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}

View File

@ -25,7 +25,7 @@
</div> </div>
<div id="history"> <div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %> <%= render :partial => 'history',:locals => { :journals => @jour, :state => false} %>
</div> </div>
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul> <ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
</div> </div>

View File

@ -0,0 +1,55 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<div class="ping_ctt">
<div id="tbc_01" class="ping_dis">
<% if journals.size > 0 %>
<% for journal in journals %>
<div class="ping_C" id='word_li_<%= journal.id.to_s %>'>
<div class="ping_dispic"><a target="_blank" href="#"><%= image_tag(url_to_avatar(journal.user)) %></a></div>
<div class="ping_discon" style="width: 85%;">
<div class="ping_distop">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span><%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span>
<div class="cl"></div>
<p><%= textilizable journal.notes%></p>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span style="float: right">
<% if journal.user == User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_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)) %>
<% end %>
<% if reply_allow %>
<%= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"} %>
<% end %>
</span>
<span class="font_lighter" style="float: right">
<%= l(:label_bids_published) %>&nbsp;
<%= time_tag(journal.created_on).html_safe %>&nbsp;
<%= l(:label_bids_published_ago) %>
</span>
</div>
<div style="clear: both;"></div>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
</div>
<% end %>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true} %>
</div>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
</div>
</div>

View File

@ -0,0 +1,14 @@
<div class="dis">
<div class="msg_box" id='leave-message'>
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<h3><%= l(:label_user_response) %><span id="jour_count"><%= @obj_count%></span></h3>
<%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %>
</div>
<div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
</div>
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
</div>

View File

@ -1,18 +1,7 @@
<div style="margin-top: 30px"> <% reply_allow = JournalsForMessage.create_by_user? User.current %>
<div id='leave-message'> <%= stylesheet_link_tag 'css', :media => 'all' %>
<%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %>
</div>
<div style="border-bottom: 1px dashed rgb(204, 204, 204);font-size: 14px; font-family: '微软雅黑'; padding-bottom: 10px; font-weight: bold; color:#807a76">
<%= l(:label_newfeedback_message) %><%= @feedback_count%>
</div>
<div id="message" style="font-size: 14px;"> <%= render :partial => 'user_jours',
<%= render :partial => 'words/message', :locals => {:jour => @jour, :state => @state, :user => @user, :feedback_pages => @feedback_pages} %> :locals => { :journals => @jour, :state => false}
</div> %>
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full @feedback_pages %>
</ul>
</div>
</div>
<% html_title(l(:label_responses)) -%> <% html_title(l(:label_responses)) -%>

View File

@ -64,12 +64,12 @@ function checkMaxLength() {
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div id='<%= ids %>' class="respond-form"> <div id='<%= ids %>' class="respond-form">
<% if reply_allow %> <% if reply_allow %>
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %> <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => show_name} %>
<% end %> <% end %>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div> <div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> <%= render :partial => "words/journal_reply", :locals => {:journal => journal,:show_name => show_name } %>
</div> </div>
</li> </li>
<% end %> <% end %>

View File

@ -1,4 +1,6 @@
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); //$('#message').html('<#%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages,:show_name => true})) %>');
$('#history').html('<%= escape_javascript(render(:partial => 'users/history',:locals => { :journals => @jour, :state => false})) %>')
$('#jour_count').html('<%= @obj_count%>')
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val(""); $('#new_form_user_message').val("");
$('#new_form_reference_user_id').val(""); $('#new_form_reference_user_id').val("");