留言回复页面修改

This commit is contained in:
z9hang 2014-10-31 14:06:40 +08:00
parent f5e9528b12
commit 364ac06527
3 changed files with 76 additions and 1 deletions

View File

@ -1,6 +1,8 @@
class HomeworkAttachController < ApplicationController
layout "course_base"
include CoursesHelper
helper :words
###############################
before_filter :can_show_course,except: []
#判断当前角色权限时需先找到当前操作的project
@ -65,6 +67,14 @@ class HomeworkAttachController < ApplicationController
#获取作业的留言列表
def get_homework_jours
#@user = @bid.author
@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@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
respond_to do |format|
format.js
end

View File

@ -4,4 +4,69 @@
<a href="#">取&nbsp;&nbsp;消</a><a href="#">留&nbsp;&nbsp;言</a>
</div>
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% label = ''
case bid.reward_type
when 1
label = l(:label_respond_requirement)
when 2
label = l(:label_contest_requirement)
when 3
label = l(:label_question_requirement)
else
end
%>
<% if journals.size > 0 %>
<ul class="message-for-user">
<% for journal in journals%>
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
<span class="portrait">
<%= image_tag(url_to_avatar(journal.user), :class => "avatar") %>
</span>
<span class="body">
<span class="user">
<%= link_to journal.user, user_path(journal.user)%>
</span>
<span class="font_lighter">
<%= label %>
</span>
<div>
<%= textilizable journal.notes%>
</div>
<span class="font_lighter">
<%= l(:label_bids_published) %>&nbsp;
<%= time_tag(journal.created_on).html_safe %>&nbsp;
<%= l(:label_bids_published_ago) %>
</span>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span>
<% if reply_allow %>
<%= link_to(l(:button_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal},
:remote => true,:method => 'post', :title => l(:button_quote))%>
<%= 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 %>
<% if @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 %>
</span>
</span>
<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} %>
</div>
<% end %>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
</div>
</li>
<% end %>
</ul>
<% end %>
<div class="msg_list"></div>

View File

@ -1,3 +1,3 @@
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homework_jours' )) %>');
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homework_jours',:locals => { :bid => @bid, :journals => @jour, :state => false} )) %>');
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
$("#tb_5").removeClass().addClass("hovertab");