From 9b86ec30445a0ad2682ee91361ecbbf2a0019543 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 14 Dec 2015 10:07:55 +0800 Subject: [PATCH 01/41] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_search_all_results.html.erb | 4 ++-- app/views/welcome/_search_memo_results.html.erb | 2 +- app/views/welcome/_search_project_results.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/welcome/_search_all_results.html.erb b/app/views/welcome/_search_all_results.html.erb index 34ef9a8eb..7256534e5 100644 --- a/app/views/welcome/_search_all_results.html.erb +++ b/app/views/welcome/_search_all_results.html.erb @@ -67,7 +67,7 @@
  • <%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description%>
  • -
  • 管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %>创建时间:<%= date_format_local( Project.find(item.id).created_on) %>
  • +
  • 管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %>更新时间:<%= date_format_local( Project.find(item.id).updated_on) %>
  • @@ -83,7 +83,7 @@
  • <%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe%>
  • -
  • 发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %>创建时间:<%= format_date( item.created_at) %>
  • +
  • 发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %>更新时间:<%= format_date( item.updated_at) %>
  • diff --git a/app/views/welcome/_search_memo_results.html.erb b/app/views/welcome/_search_memo_results.html.erb index c5fe9cc72..98f9ae7f0 100644 --- a/app/views/welcome/_search_memo_results.html.erb +++ b/app/views/welcome/_search_memo_results.html.erb @@ -12,7 +12,7 @@
  • <%= memo.try(:highlight).try(:content) ? memo.highlight.content[0].html_safe : memo.content.html_safe%>
  • -
  • 发帖人:<%= memo.author_id ? User.find(memo.author_id).login : '无' %>创建时间:<%= format_date( memo.created_at) %>
  • +
  • 发帖人:<%= memo.author_id ? User.find(memo.author_id).login : '无' %>更新时间:<%= format_date( memo.updated_at) %>
  • diff --git a/app/views/welcome/_search_project_results.html.erb b/app/views/welcome/_search_project_results.html.erb index b3ed44654..5775a939d 100644 --- a/app/views/welcome/_search_project_results.html.erb +++ b/app/views/welcome/_search_project_results.html.erb @@ -12,7 +12,7 @@
  • <%= project.try(:highlight).try(:description) ? project.highlight.description[0].html_safe : project.description%>
  • -
  • 管理人员:<%= project.user_id ? User.find(project.user_id).login : '无' %>创建时间:<%= date_format_local( Project.find(project.id).created_on) %>
  • +
  • 管理人员:<%= project.user_id ? User.find(project.user_id).login : '无' %>更新时间:<%= date_format_local( Project.find(project.id).updated_on) %>
  • From 0602a03e12000d2b4081b33215c0e7d97969f6e1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 14 Dec 2015 10:26:34 +0800 Subject: [PATCH 02/41] =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E6=A0=8F=E7=9B=AE=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 93 +++++++++++++++++++ app/helpers/files_helper.rb | 6 ++ app/views/files/_subfield_files.html.erb | 2 +- .../files/search_files_in_subfield.js.erb | 2 + .../_org_left_subfield_list.html.erb | 4 +- config/routes.rb | 2 +- db/schema.rb | 4 + 7 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 app/views/files/search_files_in_subfield.js.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 328446fbb..6ed42bd6e 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -131,6 +131,45 @@ class FilesController < ApplicationController end end + def search_files_in_subfield + sort = "" + @sort = "" + @order = "" + @is_remote = true + @q = params[:name].strip + if params[:sort] + order_by = params[:sort].split(":") + @sort = order_by[0] + if order_by.count > 1 + @order = order_by[1] + end + sort = "#{@sort} #{@order}" + end + # show_attachments [@course] + begin + q = "%#{params[:name].strip}%" + #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? + if params[:insite] + if q == "%%" + @result = [] + @searched_attach = paginateHelper @result,10 + else + @result = find_public_attache q,sort + @result = visable_attachemnts_insite @result,@org_subfield + @searched_attach = paginateHelper @result,10 + end + else + @result = find_org_subfield_attache q,@org_subfield,sort + @result = visable_attachemnts @result + @searched_attach = paginateHelper @result,10 + #@tag_list = get_course_tag_list @course + end + #rescue Exception => e + # #render 'stores' + # redirect_to search_course_files_url + end + end + def find_course_attache keywords,course,sort = "" if sort == "" sort = "created_on DESC" @@ -144,6 +183,19 @@ class FilesController < ApplicationController #resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC") end + def find_org_subfield_attache keywords,org_subfield,sort = "" + if sort == "" + sort = "created_on DESC" + end + if keywords != "%%" + resultSet = Attachment.where("attachments.container_type = 'OrgSubfield' And attachments.container_id = '#{org_subfield.id}' AND filename LIKE :like ", like: "%#{keywords}%"). + reorder(sort) + else + resultSet = Attachment.where("attachments.container_type = 'OrgSubfield' And attachments.container_id = '#{org_subfield.id}' "). reorder(sort) + end + #resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC") + end + def find_project_attache keywords,project,sort = "" if sort == "" sort = "created_on DESC" @@ -298,6 +350,47 @@ class FilesController < ApplicationController render :layout => 'base_courses' elsif params[:org_subfield_id] + if params[:sort] + params[:sort].split(",").each do |sort_type| + order_by = sort_type.split(":") + + case order_by[0] + when "filename" + attribute = "filename" + when "size" + attribute = "filesize" + when "attach_type" + attribute = "attachtype" + when "content_type" + attribute = "created_on" + when "field_file_dense" + attribute = "is_public" + when "downloads" + attribute = "downloads" + when "created_on" + attribute = "created_on" + when "quotes" + attribute = "quotes" + else + attribute = "created_on" + end + @sort = order_by[0] + @order = order_by[1] + if order_by.count == 1 && attribute + sort += "#{Attachment.table_name}.#{attribute} asc " + if sort_type != params[:sort].split(",").last + sort += "," + end + elsif order_by.count == 2 && order_by[1] + sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " + if sort_type != params[:sort].split(",").last + sort += "," + end + end + end + else + sort = "#{Attachment.table_name}.created_on desc" + end @container_type = 2 @organization = Organization.find(params[:organization_id]) @containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)] diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index cf9cbcc32..276786fb7 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -141,6 +141,12 @@ module FilesHelper result << attachment end end + elsif obj.is_a?(OrgSubfield) + attachments.each do |attachment| + if attachment.is_public? || (attachment.container_type == "OrgSubfield" && attachment.container_id == obj.id )|| attachment.author_id == User.current.id + result << attachment + end + end end end result diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index ea408c7a6..b0bc9ea09 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -68,7 +68,7 @@
    - <%= form_tag( search_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %> + <%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> <%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> diff --git a/app/views/files/search_files_in_subfield.js.erb b/app/views/files/search_files_in_subfield.js.erb new file mode 100644 index 000000000..deed2d5d3 --- /dev/null +++ b/app/views/files/search_files_in_subfield.js.erb @@ -0,0 +1,2 @@ +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', + :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 367c23843..152310bba 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -29,8 +29,8 @@ <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <% else %> - <%#= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> - <%= field.name %> + <%= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> + <% end %>
    - @@ -40,11 +39,10 @@

    <%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

    - - - - - +
    + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %> +
    <% end %> diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index b0bc9ea09..2a552dc43 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -70,7 +70,7 @@
    <%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> - <%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> + <%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> <% end %> <%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> @@ -88,7 +88,7 @@
    -
    +
    <%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
    From 14912078ee3067a922e7a61886f763a3ed14c195 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 14 Dec 2015 11:03:04 +0800 Subject: [PATCH 07/41] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cbc646eac..ad4da60a7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1934,6 +1934,8 @@ module ApplicationHelper candown = true elsif attachment.container.class.to_s=="StudentWork" candown = true + elsif attachment.container.class.to_s=="BlogComment" #博客资源允许下载 + candown = true elsif attachment.container.class.to_s == "User" candown = (attachment.is_public == 1 || attachment.is_public == true || attachment.author_id == User.current.id) elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses From 9aebafee09990cdd25fb4bafa0d9977e3b6c381b Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 14 Dec 2015 11:11:09 +0800 Subject: [PATCH 08/41] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_search_all_results.html.erb | 6 +++++- app/views/welcome/_search_course_results.html.erb | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/views/welcome/_search_all_results.html.erb b/app/views/welcome/_search_all_results.html.erb index 537da336a..4ed9fba33 100644 --- a/app/views/welcome/_search_all_results.html.erb +++ b/app/views/welcome/_search_all_results.html.erb @@ -37,7 +37,11 @@
  • <%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %>
  • -
  • 教师:<%= User.find(item.tea_id).realname %>授课时间:<%= item.time.to_s + item.term%><%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%>
  • +
  • + 教师:<%= User.find(item.tea_id).realname %> + 授课时间:<%= item.time.to_s + item.term%> + 更新时间:<%= format_date(item.updated_at)%> + <%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%>
  • diff --git a/app/views/welcome/_search_course_results.html.erb b/app/views/welcome/_search_course_results.html.erb index 89567063d..e51452ada 100644 --- a/app/views/welcome/_search_course_results.html.erb +++ b/app/views/welcome/_search_course_results.html.erb @@ -12,7 +12,11 @@
  • <%= course.try(:highlight).try(:description) ? course.highlight.description[0].html_safe : (course.description.present? ? course.description : '暂时没有该课程描述') %>
  • -
  • 教师:<%= User.find(course.tea_id).realname %>授课时间:<%= course.time.to_s + course.term%><%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%>
  • +
  • + 教师:<%= User.find(course.tea_id).realname %> + 授课时间:<%= course.time.to_s + course.term%> + 更新时间:<%= format_date(course.updated_at)%> + <%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%>
  • From f3013ca3e71dc61effbedb4a733ad41c2fbe7919 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 14 Dec 2015 11:22:36 +0800 Subject: [PATCH 09/41] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=9A=84=E6=8F=90=E7=A4=BA=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_logined_header.html.erb | 2 +- app/views/layouts/_unlogin_header.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index d100e79a5..a0cbe4eed 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -54,7 +54,7 @@ <% name = name%> <%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %> - " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户以及资源"/> + " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户、资源以及帖子"/> diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index 162f59ed4..7a2196d01 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -52,7 +52,7 @@ <% name = name%> <%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %> - " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户以及资源" onkeypress="search_in_header_I(event,$(this));"/> + " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户、资源以及帖子" onkeypress="search_in_header_I(event,$(this));"/> From a5fa68c9289c7220a25e7901accc11e029999052 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 14 Dec 2015 16:41:18 +0800 Subject: [PATCH 10/41] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 6 +++++- app/views/files/_upload_subfield_file.html.erb | 6 ++---- app/views/files/subfield_upload_file.js.erb | 6 ++++++ app/views/layouts/base_org.html.erb | 4 ++-- app/views/organizations/_org_left_subfield_list.html.erb | 6 +++++- config/routes.rb | 1 + public/stylesheets/org.css | 4 +++- 7 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 app/views/files/subfield_upload_file.js.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 6ed42bd6e..7b375377c 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -392,8 +392,8 @@ class FilesController < ApplicationController sort = "#{Attachment.table_name}.created_on desc" end @container_type = 2 - @organization = Organization.find(params[:organization_id]) @containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)] + @organization = Organization.find(@containers.first.organization_id) show_attachments @containers render :layout => 'base_org' # @subfield = params[:org_subfield_id] @@ -733,4 +733,8 @@ class FilesController < ApplicationController # format.html end end + + def subfield_upload_file + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + end end diff --git a/app/views/files/_upload_subfield_file.html.erb b/app/views/files/_upload_subfield_file.html.erb index c3ca72ecd..5d8723d03 100644 --- a/app/views/files/_upload_subfield_file.html.erb +++ b/app/views/files/_upload_subfield_file.html.erb @@ -10,7 +10,7 @@ - <%= render :partial => 'files/attachement_list',:locals => {:org_subfield => org_subfield} %> + <%= render :partial => 'files/attachement_list'%>
    <%= l(:button_cancel)%> <%= l(:button_confirm)%> @@ -18,9 +18,7 @@
    - <% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> - <% end %> + - <% replies_all_i=replies_all_i + 1 %> -
  • -
    - <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> -
    -
    -
    - <% if reply.try(:user).try(:realname) == ' ' %> - <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% end %> - <%= format_time(reply.created_on) %> -
    -
    - <% if reply.details.any? %> - <% details_to_strings(reply.details).each do |string| %> -

    <%= string %>

    - <% end %> - <% end %> -

    <%= reply.notes.html_safe %>

    -
    -
    -
    -
  • - <% end %> - - - <% end %> - -
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    -
    -
    - <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> - - -
    - -
    -

    - <% end%> -
    -
    -
    -
    -
    - - - +
    +
    +
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
    +
    +
    + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> +
    +
    + <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> + + <%= get_issue_priority(activity.priority_id)[1] %> + +
    +
    +
    指派给   + <% unless activity.assigned_to_id.nil? %> + <% if activity.try(:assigned_to).try(:realname) == ' ' %> + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% end %> + <% end %> +
    +
    + 时间: + <%=format_time(activity.created_on) %> +
    +
    +
    +
    + <% if activity.description? %> + <%= textAreailizable activity, :description, :attachments => activity.attachments %> + <% end %> +
    +
    +
    + + +
    +
    + <% if activity.attachments.any? %> + <% activity.attachments.each do |attachment| %> +
    + + + <%= link_to_short_attachment attachment,:length=> 58, :class => 'link_file_a fl newsBlue', :download => true -%> + + <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :class => 'fl', + :filename => attachment.filename %> + <% end %> + + ( + <%= number_to_human_size attachment.filesize %>) + + + <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, + <%= format_time(attachment.created_on) %> + +
    + <% end %> + <% end %> +
    +
    +
    +
    + <% count = activity.journals.count %> +
    +
    +
    +
    回复(<%= count %>)
    +
    <%#= format_date(activity.updated_on) %>
    + <% if count > 3 %> + + <% end %> +
    + + <% replies_all_i = 0 %> + <% if count > 0 %> +
    +
      + <% activity.journals.reorder("created_on desc").each do |reply| %> + + <% replies_all_i=replies_all_i + 1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> +
      +
      +
      + <% if reply.try(:user).try(:realname) == ' ' %> + <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(reply.created_on) %> +
      +
      + <% if reply.details.any? %> + <% details_to_strings(reply.details).each do |string| %> +

      <%= string %>

      + <% end %> + <% end %> +

      <%= reply.notes.html_safe %>

      +
      +
      +
      +
    • + <% end %> +
    +
    + <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    + +
    +
    From af157a9c63350ffd25865266f681bb9af778dfc4 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 15 Dec 2015 17:30:24 +0800 Subject: [PATCH 14/41] =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E5=A2=9E=E5=8A=A0=E6=A0=87=E7=AD=BE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 56 ++++++++++++++++--- app/controllers/tags_controller.rb | 6 ++ app/helpers/application_helper.rb | 9 +++ app/views/files/_org_subfield_list.html.erb | 6 +- app/views/files/_subfield_files.html.erb | 16 +++--- app/views/files/_subfield_tags.html.erb | 43 ++++++++++++++ .../files/_upload_subfield_file.html.erb | 24 ++++---- .../search_org_subfield_tag_attachment.js.erb | 2 + app/views/tags/remove_tag_new.js.erb | 6 +- config/routes.rb | 2 +- 10 files changed, 137 insertions(+), 33 deletions(-) create mode 100644 app/views/files/_subfield_tags.html.erb create mode 100644 app/views/files/search_org_subfield_tag_attachment.js.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 8597ad3b7..51dabebb4 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -395,6 +395,7 @@ class FilesController < ApplicationController @containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)] @organization = Organization.find(@containers.first.organization_id) show_attachments @containers + @tag_list = attachment_tag_list @all_attachments render :layout => 'base_org' # @subfield = params[:org_subfield_id] end @@ -523,14 +524,29 @@ class FilesController < ApplicationController end elsif @org_subfield @addTag=false - # if params[:in_org_subfield_toolbar] - # @in_org_subfield_toolbar = params[:in_org_subfield_toolbar] - # end attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type]) - # if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') - # Mailer.run.attachments_added(attachments[:files]) - # end + if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array) + params[:org_subfield_attachment_type].each do |type| + tag_name = get_tag_name_by_type_number type + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + else + if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5" + tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type] + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + end # TODO: 临时用 nyan sort_init 'created_on', 'desc' @@ -542,7 +558,7 @@ class FilesController < ApplicationController @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] show_attachments @containers - + @tag_list = attachment_tag_list @all_attachments @attachtype = 0 @contenttype = 0 @@ -733,6 +749,32 @@ class FilesController < ApplicationController end end + #搜索资源栏目的指定TAG的资源列表 + def search_org_subfield_tag_attachment + @q,@tag_name,@order = params[:q],params[:tag_name] + @is_remote = true + if params[:sort] + order_by = params[:sort].split(":") + @sort = order_by[0] + if order_by.count > 1 + @order = order_by[1] + end + sort = "#{@sort} #{@order}" + end + + q = "%#{@q.strip}%" + @result = find_org_subfield_attache q,@org_subfield,sort + @result = visable_attachemnts @result + @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? + @searched_attach = paginateHelper @result,10 + @tag_list = get_org_subfield_tag_list @org_subfield + + respond_to do |format| + format.js + # format.html + end + end + def subfield_upload_file @org_subfield = OrgSubfield.find(params[:org_subfield_id]) end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index cb61177f5..82adc1fff 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -227,6 +227,12 @@ class TagsController < ApplicationController @tag_list = get_course_tag_list @course @select_tag_name = params[:select_tag_name] end + + if @obj && @object_flag == '6' && @obj.container.kind_of?(OrgSubfield) + @org_subfield = @obj.container + @tag_list = get_org_subfield_tag_list @org_subfield + @select_tag_name = params[:select_tag_name] + end # end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8f4679c67..9a622316a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2376,6 +2376,15 @@ module ApplicationHelper tag_list end + def get_org_subfield_tag_list org_subfield + all_attachments = org_subfield.attachments.select{|attachment| attachment.is_public? || + (attachment.container_type == "OrgSubfield" && User.current.member_of_org?(org_subfield.organization))|| + attachment.author_id == User.current.id + } + tag_list = attachment_tag_list all_attachments + tag_list + end + #获取匿评相关连接代码 def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1) if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index e11e020c2..750aed9ae 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -14,9 +14,9 @@

    - - - +
    + <%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%> +
    diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index 2a552dc43..09f74d3cd 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -15,9 +15,9 @@ { switch(obj) { - case 1: - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); - break; +// case 1: +// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>'); +// break; case 2: $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 2}) %>'); break; @@ -27,9 +27,9 @@ case 4: $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 4}) %>'); break; - case 6: - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>'); - break; +// case 6: +// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>'); +// break; default: $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 5}) %>'); } @@ -77,11 +77,11 @@

    上传: - 课件 |  + 软件 |  媒体 |  代码 |  - 论文 |  + 其他

    <%# end %> diff --git a/app/views/files/_subfield_tags.html.erb b/app/views/files/_subfield_tags.html.erb new file mode 100644 index 000000000..1a2c896fc --- /dev/null +++ b/app/views/files/_subfield_tags.html.erb @@ -0,0 +1,43 @@ +<% if org_subfield && tag_list && tag_list.empty? == false%> + + 全部 +<% end %> +<% unless tag_list.nil?%> + <% tag_list.each do |k,v|%> + <% if tag_name && tag_name == k%> + + <%= k%>(<%= v%>) + <% else%> + + <%= k%>(<%= v%>) + <% end%> + <% end%> +<% end%> + + \ No newline at end of file diff --git a/app/views/files/_upload_subfield_file.html.erb b/app/views/files/_upload_subfield_file.html.erb index 567309f9c..7137e14e7 100644 --- a/app/views/files/_upload_subfield_file.html.erb +++ b/app/views/files/_upload_subfield_file.html.erb @@ -7,19 +7,17 @@ <%= form_tag(org_subfield_files_path(org_subfield, :in_org => params[:in_org]), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> - - - - - - - - - - - - - + <% if params[:in_org] %> +
    + 软件 |  + 媒体 |  + 代码 |  + 其他 +
    + <% else %> + + <% end %> + <%= render :partial => 'files/attachement_list'%>
    <%= l(:button_cancel)%> diff --git a/app/views/files/search_org_subfield_tag_attachment.js.erb b/app/views/files/search_org_subfield_tag_attachment.js.erb new file mode 100644 index 000000000..deed2d5d3 --- /dev/null +++ b/app/views/files/search_org_subfield_tag_attachment.js.erb @@ -0,0 +1,2 @@ +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', + :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); \ No newline at end of file diff --git a/app/views/tags/remove_tag_new.js.erb b/app/views/tags/remove_tag_new.js.erb index 9a43dd9b4..879155aa7 100644 --- a/app/views/tags/remove_tag_new.js.erb +++ b/app/views/tags/remove_tag_new.js.erb @@ -3,8 +3,12 @@ $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag,:select_tag_name => @select_tag_name}) %>'); +<% if @org_subfield %> + $("#files_tag").html("<%= escape_javascript(render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name})%>"); +<% else %> + $("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); +<% end %> -$("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>"); <% end %> <% if @object_flag == "10"%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); diff --git a/config/routes.rb b/config/routes.rb index 05507d024..28a3fec70 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,7 +77,7 @@ RedmineApp::Application.routes.draw do match "getattachtype", :via => [:get, :post] match "search_files_in_subfield",:via => [:post,:get] match "searchone4reload",:via => [:post,:get] - match "search_tag_attachment", :via => [:post,:get] + match "search_org_subfield_tag_attachment", :via => [:post,:get] match "subfield_upload_file", :via => :post end member do From ef2f142f626d7162116fee4d8fb2cdc7708b28cc Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 15 Dec 2015 18:12:32 +0800 Subject: [PATCH 15/41] =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index aed57010b..81d42c1e6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1936,6 +1936,8 @@ module ApplicationHelper candown = true elsif attachment.container.class.to_s=="BlogComment" #博客资源允许下载 candown = true + elsif attachment.container.class.to_s=="Memo" #论坛资源允许下载 + candown = true elsif attachment.container.class.to_s == "User" candown = (attachment.is_public == 1 || attachment.is_public == true || attachment.author_id == User.current.id) elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses From 68aceaa7dfbdbd68bfde084fca7fc6402b4ecaf4 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 15 Dec 2015 18:43:58 +0800 Subject: [PATCH 16/41] =?UTF-8?q?issue=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 4 + app/views/issues/_action_menu.html.erb | 4 +- app/views/issues/_attributes.html.erb | 5 +- app/views/issues/_attributes_show.html.erb | 2 +- app/views/issues/_detail.html.erb | 36 +++++ app/views/issues/_edit.html.erb | 38 ++--- app/views/issues/_form.html.erb | 2 +- app/views/issues/_issue_replies.html.erb | 34 +++++ app/views/issues/add_journal.js.erb | 11 +- app/views/issues/show.html.erb | 143 ++++++------------ app/views/issues/update.js.erb | 5 + .../lib/rails_kindeditor/helper.rb | 8 +- public/assets/kindeditor/kindeditor.js | 28 ++-- .../plugins/autoheight/autoheight.js | 4 +- public/javascripts/project.js | 10 ++ public/stylesheets/project.css | 15 +- public/stylesheets/public.css | 3 +- 17 files changed, 202 insertions(+), 150 deletions(-) create mode 100644 app/views/issues/_detail.html.erb create mode 100644 app/views/issues/_issue_replies.html.erb create mode 100644 app/views/issues/update.js.erb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 7cdc838e2..9bb602178 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -256,6 +256,7 @@ class IssuesController < ApplicationController end flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? respond_to do |format| + format.js format.html { redirect_to issue_url(@issue.id) } format.api { render_api_ok } end @@ -398,6 +399,9 @@ class IssuesController < ApplicationController user_activity.updated_at = jour.created_on user_activity.save @user_activity_id = params[:user_activity_id] + if params[:issue_id] + @issue_id = params[:issue_id] + end respond_to do |format| format.js end diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index ae2a848e0..97e95d4a9 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -2,5 +2,5 @@ <%#= watcher_link_issue(@issue, User.current) %> <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %> <%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %> -<%= link_to l(:button_edit), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %> -<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_journal_kind_reply"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %> +<%= link_to l(:button_edit), 'javascript:void(0);', :onclick => 'issueEditShow();', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %> +<%#= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_journal_kind_reply"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %> diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 54cb85212..1b6bebb01 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -1,7 +1,6 @@ <%= labelled_fields_for :issue, @issue do |f| %>
    -
    - <%= l(:label_change_properties) %> +
    • @@ -54,7 +53,7 @@
    -
      +
      • <% if @issue.safe_attribute? 'start_date' %> diff --git a/app/views/issues/_attributes_show.html.erb b/app/views/issues/_attributes_show.html.erb index 7b9e2bedf..15160facb 100644 --- a/app/views/issues/_attributes_show.html.erb +++ b/app/views/issues/_attributes_show.html.erb @@ -1,5 +1,5 @@ -
        +
        <%= issue_fields_rows do |rows| %>
        •  状态  : 

          <%= @issue.status.name %>

          diff --git a/app/views/issues/_detail.html.erb b/app/views/issues/_detail.html.erb new file mode 100644 index 000000000..b085ce32f --- /dev/null +++ b/app/views/issues/_detail.html.erb @@ -0,0 +1,36 @@ +
          + <%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %> +
          +
          +

          <%= @issue.subject %> + <%= get_issue_priority(@issue.priority_id)[1] %>

          +
          +
          + 由<%= @issue.author %>添加于 <%= format_time(@issue.created_on).html_safe %> +
          + + + +<%= render :partial => 'action_menu' %> +
          +<% if @issue.description? || @issue.attachments.any? -%> +
          + <% if @issue.description? %> + <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> + <%= textAreailizable @issue, :description, :attachments => @issue.attachments %> + <% end %> +
          +<% end -%> +<% if @issue.attachments.any? %> +
          + + + <%= link_to_attachment_project @issue, :thumbnails => true %>
          + <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> +
          +
          +<% end %> + + +<%= render :partial => 'issues/attributes_show' %> +
          \ No newline at end of file diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index b8f362429..87430e5d6 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -3,44 +3,26 @@ <% end %> -<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %> +<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true,:remote=>true} do |f| %> <%= error_messages_for 'issue', 'time_entry' %> <%= render :partial => 'conflict' if @conflict %> - <% if @edit_allowed || !@allowed_statuses.empty? %> -
        +
        + +
        + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %> +
        + +
        +
        + <%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f|%> + <%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%> + + +
        +
        + +
        + + +
        + <% end %> +
        + +
        + +
        \ No newline at end of file diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 5a3fa90ca..ec7401fd3 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -1,8 +1,9 @@ -<% if @issue_id%> +<% if @issue_id%> //issue详情中回复 $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') - issues_reply_editor.html('') + sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); <%else%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%"); + // sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); <%end %> \ No newline at end of file diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index a1450fc03..156e5cb67 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,6 +1,10 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: true) %> + <%= javascript_include_tag 'create_kindeditor'%> <% end %> +
        +
        123
        <%= render :partial => 'layouts/new_feedback' %>
      • -
        +
      • +
        <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
        @@ -27,6 +27,26 @@ <% end %>

        <%= reply.notes.html_safe %>

        +
        + +
    diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index ec7401fd3..d2052a887 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -4,6 +4,6 @@ sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); <%else%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); - init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%"); - // sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); + init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); <%end %> \ No newline at end of file diff --git a/app/views/issues/delete_journal.js.erb b/app/views/issues/delete_journal.js.erb new file mode 100644 index 000000000..63a1a5f96 --- /dev/null +++ b/app/views/issues/delete_journal.js.erb @@ -0,0 +1,3 @@ +$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); +$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)') +sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 52fa393ad..09b719b07 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -705,6 +705,8 @@ RedmineApp::Application.routes.draw do member do post 'add_journal' post 'add_journal_in_org' + get 'delete_journal' + post 'reply' end resources :time_entries, :controller => 'timelog' do collection do diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index fef444156..aaadcfde4 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -26,7 +26,7 @@ function sd_create_editor(params){ afterBlur:function(){ //params.toolbar_container.hide(); sd_check_editor_form_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); - if(this.edit.html()=="") { + if(this.isEmpty()) { this.edit.html("我要回复"); } //params.toolbar_container.hide(); From 8ce2dbc4b8abbb226b9563b9c79c905917f92a58 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 17 Dec 2015 18:12:38 +0800 Subject: [PATCH 41/41] =?UTF-8?q?issue=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 25 ++++++++++++++++- app/views/issues/_issue_replies.html.erb | 5 +++- .../issues/_issue_reply_ke_form.html.erb | 27 +++++++++++++++++++ app/views/issues/add_reply.js.erb | 3 +++ app/views/issues/reply.js.erb | 9 +++++++ config/routes.rb | 3 ++- public/javascripts/create_kindeditor.js | 5 +--- public/stylesheets/new_user.css | 2 +- public/stylesheets/project.css | 4 ++- 9 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 app/views/issues/_issue_reply_ke_form.html.erb create mode 100644 app/views/issues/add_reply.js.erb create mode 100644 app/views/issues/reply.js.erb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b05050887..2c1f78de8 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -430,9 +430,32 @@ class IssuesController < ApplicationController end end - #对某个journ回复 + #对某个journ回复,显示回复框 def reply + @issue = Issue.find(params[:id]) + @jour = Journal.find(params[:journal_id]) + @tempContent = "
    #{ll(Setting.default_language, :text_user_wrote, @jour.user.realname.blank? ? @jour.user.login: @jour.user.realname)}
    #{@jour.notes.html_safe}
    ".html_safe + respond_to do |format| + format.js + end + end + #给issue添加journ。回复内容包含 对某个被回复的journ的内容 + def add_reply + if User.current.logged? + jour = Journal.new + jour.user_id = User.current.id + jour.notes = params[:quote]+params[:notes] + @issue = Issue.find params[:id] + jour.journalized = @issue + jour.save + user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first + user_activity.updated_at = jour.created_on + user_activity.save + respond_to do |format| + format.js + end + end end # diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index a1b4a3415..5e6e624b6 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -28,6 +28,7 @@

    <%= reply.notes.html_safe %>

    + <%= format_time(reply.created_on) %>
    +

    @@ -76,4 +78,5 @@
    - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/issues/_issue_reply_ke_form.html.erb b/app/views/issues/_issue_reply_ke_form.html.erb new file mode 100644 index 000000000..e84d5905c --- /dev/null +++ b/app/views/issues/_issue_reply_ke_form.html.erb @@ -0,0 +1,27 @@ +
    + +
    + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %> +
    + +
    +
    + <%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%> + <%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%> + + + +
    +
    + +
    + + +
    + <% end %> +
    + +
    + +
    +
    \ No newline at end of file diff --git a/app/views/issues/add_reply.js.erb b/app/views/issues/add_reply.js.erb new file mode 100644 index 000000000..0ee9d30e7 --- /dev/null +++ b/app/views/issues/add_reply.js.erb @@ -0,0 +1,3 @@ +$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); +$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue).journals.count %>)') +sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); \ No newline at end of file diff --git a/app/views/issues/reply.js.erb b/app/views/issues/reply.js.erb new file mode 100644 index 000000000..316c078f2 --- /dev/null +++ b/app/views/issues/reply.js.erb @@ -0,0 +1,9 @@ +if($("#reply_message_<%= @jour.id%>").length > 0) { + $("#reply_message_<%= @jour.id%>").replaceWith("<%= escape_javascript(render :partial => 'issues/issue_reply_ke_form') %>"); + $(function(){ + $('input[name=quote]').val("<%= raw escape_javascript(@tempContent.html_safe) %>"); + sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); + }); +}else if($("#reply_to_message_<%= @issue.id%>").length >0) { + $("#reply_to_message_<%= @issue.id%>").replaceWith("

    "); +} \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 09b719b07..cf4262c2d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -706,7 +706,8 @@ RedmineApp::Application.routes.draw do post 'add_journal' post 'add_journal_in_org' get 'delete_journal' - post 'reply' + get 'reply' + post 'add_reply' end resources :time_entries, :controller => 'timelog' do collection do diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index aaadcfde4..3f555ac88 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -18,9 +18,6 @@ function sd_create_editor(params){ var edit = this.edit; var body = edit.doc.body; edit.iframe.height(paramsHeight); - console.log(" body.scrollHeight "+ body.scrollHeight) - console.log(" body.offsetHeight "+ body.offsetHeight) - console.log("(params.kindutil.IE ? body.scrollHeight : body.offsetHeight)"+(params.kindutil.IE ? body.scrollHeight : body.offsetHeight)) this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); }, afterBlur:function(){ @@ -34,7 +31,7 @@ function sd_create_editor(params){ if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){ params.submit_btn.hide(); params.toolbar_container.hide(); - this.resize("94%", null); + this.resize("100%", null); }else if(this.edit.html().trim() != ""){ params.submit_btn.show(); params.toolbar_container.show(); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 0ed4df627..40869aca7 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1328,7 +1328,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .ul_normal_color li {list-style-position:inside; padding-left:1px; list-style-image:url('../images/news_dot.png')} span.author { font-size: 0.9em; color: #888; } .ReplyToMessageInputContainer {width: 582px;float: left;} - +.ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} /*全站搜索*/ .blocks {padding:15px; background-color:#ffffff; border:1px solid #dddddd;} #searchBanner {border-bottom:1px solid #d0d0d0;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index c845b4440..1663df30f 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1082,4 +1082,6 @@ img.date-trigger { a.link_file_a{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; } a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;} -.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} \ No newline at end of file +.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} +.ReplyToMessageInputContainer {width: 582px;float: left;} +.ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} \ No newline at end of file