Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
sw 2014-08-21 09:56:14 +08:00
commit 8932633b23
13 changed files with 163 additions and 57 deletions

View File

@ -79,7 +79,7 @@ class AttachmentsController < ApplicationController
else else
candown = @attachment.is_public == 1 candown = @attachment.is_public == 1
end end
if candown || User.current.admin? if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download @attachment.increment_download
if stale?(:etag => @attachment.digest) if stale?(:etag => @attachment.digest)

View File

@ -403,17 +403,29 @@ class ProjectsController < ApplicationController
#Ended by young #Ended by young
def feedback def feedback
page = params[:page] @page = params[:page]
@page = @page.to_i
# Find the page of the requested reply # Find the page of the requested reply
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') @jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@limit = 10 @limit = 3
if params[:r] && page.nil?
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit page = 1 + offset / @limit
if params[:r] && @page.nil?
@page = page
end end
puts @page
if @page < 0
@page = 1
end
if @page > page
@page = page
end
@feedback_count = @jours.count @feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, page @feedback_pages = Paginator.new @feedback_count, @limit, @page
@offset ||= @feedback_pages.offset @offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit] @jour = @jours[@offset, @limit]
@state = false @state = false

View File

@ -90,8 +90,37 @@ class WordsController < ApplicationController
end end
def destroyJournal def destroyJournal
@journalP=JournalsForMessage.find(params[:object_id]) @journalP=JournalsForMessage.find(params[:object_id])
@journalP.destroy @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| respond_to do |format|
format.js format.js
end end

View File

@ -0,0 +1,32 @@
<% id = "course_resources_ul_" + obj.id.to_s%>
<ul class="messages-for-user-reply" id = '<%= id %>' >
<%= form_for "tag_for_save",:remote=>true,:header=>"Accept: application/javascript",:url=>tag_path,
:update => "tags_show",
:complete => "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();" do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:style=>"width: 100px;"%>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>
<div class='hidden'>
<% preTags = @preTags.nil? ? [] : @preTags %>
<% preTags.each do |tag|%>
<%= link_to tag, "
javascript:(function(){
var $tagInputVal = $('#put-tag-form-"+obj.class.to_s+"-"+obj.id.to_s+"').find('#name');
var tagArr = [];
tagArr = tagArr.concat( $tagInputVal[0].value.split(',') );
tagArr = tagArr.concat('"+tag.to_s+"');
tagArr = cleanArray(tagArr);
$tagInputVal.val(tagArr.join(','));
})();
"
%>
<% end%>
</div>
<%#= link_to_function l(:button_cancel), "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();"%>
<% end %>
<%# journal.children.each do |reply|%>
<%#= render :partial => "journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply} %>
<%# end %>
</ul>

View File

@ -10,7 +10,7 @@
<span><%=l(:label_organizers)%></span> <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),"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 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="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> <span id="record"class="footer_text_link"><%= link_to l(:label_record),"http://www.miibeian.gov.cn/", :target => "_blank" %></span>

View File

@ -156,10 +156,10 @@
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete) :title => l(:button_delete)
) if message.destroyable_by?(User.current) %> ) if message.destroyable_by?(User.current) %>
</div></td> </div>
</td>
</tr> </tr>
<tr> <tr>
<td class="comments"> <td class="comments">
<div class="wiki" style="width: 100%;word-break: break-all;"> <div class="wiki" style="width: 100%;word-break: break-all;">
<%= textAreailizable message,:content,:attachments => message.attachments %> <%= textAreailizable message,:content,:attachments => message.attachments %>

View File

@ -36,7 +36,8 @@ function checkMaxLength() {
</script> </script>
<!-- fq --> <!-- fq -->
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<h3><%= l(:label_user_response) %></h3> <h3><%= l(:label_user_response) %></h3>
@ -59,6 +60,8 @@ function checkMaxLength() {
</div> </div>
<% end %> <% end %>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div id="project_feedback">
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% if @jour.size >0 %> <% if @jour.size >0 %>
<ul class="message-for-user"> <ul class="message-for-user">
<% for journal in @jour%> <% for journal in @jour%>
@ -81,7 +84,7 @@ function checkMaxLength() {
<% if User.current.logged? %> <% if User.current.logged? %>
<% if journal.user_id==User.current.id|| User.current.admin? %> <% 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)) %> :remote => true, :title => l(:button_delete)) %>
<% end %> <% end %>
<% end %> <% end %>
@ -107,3 +110,4 @@ function checkMaxLength() {
<%= pagination_links_full @feedback_pages %> <%= pagination_links_full @feedback_pages %>
</ul> </ul>
</div> </div>
</div>

View File

@ -9,8 +9,8 @@
<td> <td>
<table width="100%" border="0"> <table width="100%" border="0">
<tr style="font-size: 18px"> <tr style="font-size: 18px">
<td colspan="2" valign="top"><strong><%= @softapplication.name %></strong></td> <td valign="top"><strong><%= @softapplication.name %></strong></td>
<td style="font-size: 15px; padding-left: 0px"> <td style="font-size: 15px; padding-right: 0px" align="right">
<%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>&nbsp; <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>&nbsp;
<%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %>
</td> </td>

View File

@ -34,42 +34,18 @@
</div> </div>
<% elsif object_flag == '6' %> <% elsif object_flag == '6' %>
<span><%#= image_tag("/images/sidebar/tags.png") %></span> <span><%#= image_tag("/images/sidebar/tags.png") %></span>
<span> <span>
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %> <%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %>
<%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %> <%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %>
</span> </span>
&nbsp;&nbsp; &nbsp;&nbsp;
<div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; "> <div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; ">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div> </div>
<div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none"> <div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none;height: 100px;">
<%= form_for "tag_for_save",:remote=>true,:header=>"Accept: application/javascript",:url=>tag_path, <%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %>
:update => "tags_show", </div>
:complete => "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();" do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:style=>"width: 100px;"%>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>
<div class='hidden'>
<% preTags = @preTags.nil? ? [] : @preTags %>
<% preTags.each do |tag|%>
<%= link_to tag, "
javascript:(function(){
var $tagInputVal = $('#put-tag-form-"+obj.class.to_s+"-"+obj.id.to_s+"').find('#name');
var tagArr = [];
tagArr = tagArr.concat( $tagInputVal[0].value.split(',') );
tagArr = tagArr.concat('"+tag.to_s+"');
tagArr = cleanArray(tagArr);
$tagInputVal.val(tagArr.join(','));
})();
"
%>
<% end%>
</div>
<%#= link_to_function l(:button_cancel), "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();"%>
<% end %>
</div>
<% else %> <% else %>
<span><%= image_tag("/images/sidebar/tags.png") %></span> <span><%= image_tag("/images/sidebar/tags.png") %></span>

View File

@ -32,8 +32,9 @@
<tr> <tr>
<td colspan="2" width="580" style="word-break:break-all"> <td colspan="2" width="580" style="word-break:break-all">
<p class="font_description"> <p class="font_description">
<%= membership.course.short_description %> <%= textilizable membership.course.short_description %>
</p></td> </p>
</td>
</tr> </tr>
<tr> <tr>
<td> <td>

View File

@ -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>

View File

@ -1,3 +1,5 @@
<% if @journalP!=nil %> <% 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 %> <% end %>

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140814062455) do ActiveRecord::Schema.define(:version => 20140812065417) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -448,14 +448,14 @@ ActiveRecord::Schema.define(:version => 20140814062455) do
end end
create_table "forums", :force => true do |t| create_table "forums", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
t.text "description" t.string "description", :default => ""
t.integer "topic_count", :default => 0 t.integer "topic_count", :default => 0
t.integer "memo_count", :default => 0 t.integer "memo_count", :default => 0
t.integer "last_memo_id", :default => 0 t.integer "last_memo_id", :default => 0
t.integer "creator_id", :null => false t.integer "creator_id", :null => false
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "groups_users", :id => false, :force => true do |t| create_table "groups_users", :id => false, :force => true do |t|