Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
142d413544
|
@ -403,17 +403,29 @@ class ProjectsController < ApplicationController
|
|||
#Ended by young
|
||||
|
||||
def feedback
|
||||
page = params[:page]
|
||||
@page = params[:page]
|
||||
@page = @page.to_i
|
||||
# Find the page of the requested reply
|
||||
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
if params[:r] && page.nil?
|
||||
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
|
||||
page = 1 + offset / @limit
|
||||
@limit = 3
|
||||
|
||||
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
|
||||
page = 1 + offset / @limit
|
||||
if params[:r] && @page.nil?
|
||||
@page = page
|
||||
end
|
||||
|
||||
|
||||
puts @page
|
||||
if @page < 0
|
||||
@page = 1
|
||||
end
|
||||
if @page > page
|
||||
@page = page
|
||||
end
|
||||
|
||||
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, page
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, @page
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@state = false
|
||||
|
|
|
@ -90,8 +90,37 @@ class WordsController < ApplicationController
|
|||
end
|
||||
|
||||
def destroyJournal
|
||||
|
||||
@journalP=JournalsForMessage.find(params[:object_id])
|
||||
@journalP.destroy
|
||||
|
||||
@page = params[:page]
|
||||
@page = @page.to_i
|
||||
@project = Project.find params[:project_id]
|
||||
# Find the page of the requested reply
|
||||
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 3
|
||||
|
||||
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
|
||||
page = 1 + offset / @limit
|
||||
if params[:r] && @page.nil?
|
||||
@page = page
|
||||
end
|
||||
|
||||
if @page < 0
|
||||
@page = 1
|
||||
end
|
||||
if @page > page
|
||||
@page = page
|
||||
end
|
||||
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, @page
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@state = false
|
||||
@base_courses_tag = @project.project_type
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<span><%=l(:label_organizers)%></span>
|
||||
<span class="footer_text_link"><%= link_to l(:label_organizers_information),"http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%></span>
|
||||
<span class="footer_text_link"><%= link_to l(:label_organizers_information_institute), "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %></span>
|
||||
<span id="copyright"><%=l(:label_copyright)%>@2007~2014</span>
|
||||
<span id="copyright"><%=l(:label_copyright)%>©2007~2014</span>
|
||||
<span id="contact_us" class="footer_text_link"><%= link_to l(:label_contact_us),"http://" + Setting.host_name + "/projects/2/member", :target=>"_blank" %></span>
|
||||
<span id="record"class="footer_text_link"><%= link_to l(:label_record),"http://www.miibeian.gov.cn/", :target => "_blank" %></span>
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ function checkMaxLength() {
|
|||
|
||||
</script>
|
||||
<!-- fq -->
|
||||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
|
||||
|
||||
|
||||
<h3><%= l(:label_user_response) %></h3>
|
||||
|
||||
|
@ -59,6 +60,8 @@ function checkMaxLength() {
|
|||
</div>
|
||||
<% end %>
|
||||
<div style="clear: both;"></div>
|
||||
<div id="project_feedback">
|
||||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<% if @jour.size >0 %>
|
||||
<ul class="message-for-user">
|
||||
<% for journal in @jour%>
|
||||
|
@ -81,7 +84,7 @@ function checkMaxLength() {
|
|||
|
||||
<% if User.current.logged? %>
|
||||
<% if journal.user_id==User.current.id|| User.current.admin? %>
|
||||
<%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id},
|
||||
<%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page},
|
||||
:remote => true, :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -106,4 +109,5 @@ function checkMaxLength() {
|
|||
<ul>
|
||||
<%= pagination_links_full @feedback_pages %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,50 @@
|
|||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<% if @jour.size >0 %>
|
||||
<ul class="message-for-user">
|
||||
<% for journal in @jour%>
|
||||
<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>
|
||||
<%= textilizable journal.notes%>
|
||||
<span class="font_lighter"> <%= l :label_update_time %>: <%= format_time journal.created_on %></span>
|
||||
<% id = 'project_respond_form_'+journal.id.to_s%>
|
||||
<span>
|
||||
<% if reply_allow %>
|
||||
<%= link_to l(:label_projects_feedback_respond),'#',
|
||||
{:focus => 'project_respond',
|
||||
:onclick => "toggleAndSettingWordsVal($('##{id}'),
|
||||
$('##{id} textarea'),
|
||||
'#{l(:label_reply_plural)} #{journal.user.name}: ');
|
||||
return false;"} %>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<% if journal.user_id==User.current.id|| User.current.admin? %>
|
||||
<%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page},
|
||||
:remote => true, :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
<div style="clear: both;"></div>
|
||||
<% if reply_allow %>
|
||||
<div id='<%= id %>' 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="pagination" style="float:left;">
|
||||
<ul>
|
||||
<%= pagination_links_full(@feedback_pages,@feedback_count, :per_page_links => false){|text, parameters, options|
|
||||
link_to text, project_feedback_path(@project,parameters.merge(:q => params[:q])) }%>
|
||||
</ul>
|
||||
</div>
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
<% if @journalP!=nil %>
|
||||
$(".message-for-user").children("#word_li_<%=@journalP.id%>").remove();
|
||||
//$(".message-for-user").children("#word_li_<%#=@journalP.id%>").remove();
|
||||
$("#project_feedback").html("<%= escape_javascript(render :partial => 'words/feedback') %>");
|
||||
<% end %>
|
Loading…
Reference in New Issue