diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 8b1c8ba32..69e7105aa 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -145,10 +145,14 @@ class FilesController < ApplicationController ids += version.id.to_s end end - resultSet = Attachment.where("((attachments.container_type = 'Project' And attachments.container_id = '#{project.id}') OR (container_type = 'Version' AND container_id IN (#{ids}))) AND filename LIKE :like ", like: "%#{keywords}%"). - reorder(sort) - #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 + if ids.blank? + resultSet = Attachment.where("attachments.container_type = 'Project' And attachments.container_id = '#{project.id}' AND filename LIKE :like ", like: "%#{keywords}%"). + reorder(sort) + else + resultSet = Attachment.where("((attachments.container_type = 'Project' And attachments.container_id = '#{project.id}') OR (container_type = 'Version' AND container_id IN (#{ids}))) AND filename LIKE :like ", like: "%#{keywords}%"). + reorder(sort) + end + end def find_public_attache keywords,sort = "" # StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 790718e5d..80be8c5d5 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -95,6 +95,7 @@ class IssuesController < ApplicationController format.api { Issue.load_visible_relations(@issues) if include_in_api_response?('relations') } + # format.json { render :json => @issues.map { |issue| issue.to_json}} #:json => @issues.map { |issue| issue.to_json} format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') } format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') } diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 9c4fab9de..b72a191db 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -340,17 +340,18 @@ module IssuesHelper if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key) # Link to the attachment if it has not been removed if options[:token].nil? - value = link_to_attachment(atta, :download => true, :only_path => options[:only_path], :class=> "info_foot_num c_blue") + value = atta.filename else - value = link_to_attachment(atta, :download => true, :only_path => options[:only_path], :token => options[:token], :class=> "info_foot_num c_blue") - end - if options[:only_path] != false && atta.is_text? - value += link_to( - image_tag('magnifier.png'), - :controller => 'attachments', :action => 'show', - :id => atta, :filename => atta.filename - ) + value = atta.filename end + # 放大镜搜索功能 + # if options[:only_path] != false && atta.is_text? + # value += link_to( + # image_tag('magnifier.png'), + # :controller => 'attachments', :action => 'show', + # :id => atta, :filename => atta.filename + # ) + # end else value = content_tag("i", h(value)) if value end diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index f36d2ea94..e1d8c3e12 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -255,8 +255,19 @@ module QueriesHelper # Give it a name, required to be valid @query = IssueQuery.new(:name => "_") @query.project = @project + params[:f] = %w(subject status_id priority_id author_id assigned_to_id) unless params[:status_id].nil? + params[:op] = {'subject' => "~" , + 'status_id' => ( params[:status_id] == '0' ? "!":"=" ), + 'priority_id' => ( params[:priority_id] == '0' ? "!":"=" ), + 'author_id' => ( params[:author_id] == '0' ? "!":"=" ), + 'assigned_to_id' => ( params[:assigned_to_id] == '0' ? "!":"=" )} unless params[:status_id].nil? + params[:v] = {'subject' => [params[:subject]], + 'status_id' => [params[:status_id]], + 'priority_id' => [params[:priority_id]], + 'author_id' => [params[:author_id]], + 'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil? @query.build_from_params(params) - session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names} + #session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names} else # retrieve from session @query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id] diff --git a/app/views/files/_project_file_new.html.erb b/app/views/files/_project_file_new.html.erb index ad489742e..f71783ba2 100644 --- a/app/views/files/_project_file_new.html.erb +++ b/app/views/files/_project_file_new.html.erb @@ -1,8 +1,3 @@ - -
-

<%= l(:lable_file_sharingarea) %>

-
-

<%= l(:label_issue_tracking) %>

-
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> - - <%= link_to l(:label_query), '#', - :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> - + <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> + <%= hidden_field_tag 'set_filter', '1' %> + + +
+ <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给",0]), + { :include_blank => false,:selected=>0 + }, + {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"v[assigned_to_id]",:class=>"w90"} + ) + %> + <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), + { :include_blank => false,:selected=>0 + }, + {:onchange=>"remote_function();",:id=>"priority_id",:name=>"v[priority_id]",:class=>"w90"} + ) + %> + <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), + { :include_blank => false,:selected=>0 + }, + {:onchange=>"remote_function();",:id=>"status_id",:name=>"v[status_id]",:class=>"w90"} + ) + %> + <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), + { :include_blank => false,:selected=>0 + }, + {:onchange=>"remote_function();",:id=>"author_id",:name=>"v[author_id]",:class=>"w90"} + ) + %> +
+
+ <% end %> +

<%= l(:label_issues_sum) %>:<%= @project.issues.count %> + <%= l(:lable_issues_undo) %>:<%= @project.issues.where('status_id in (1,2,4,6)').count %> +

+ +
<% end %> - <%= l(:label_issues_sum) %>:<%= @project.issues.count %> <%= l(:lable_issues_undo) %>:<%= @project.issues.where('status_id in (1,2,4,6)').count %>
<% if !@query.new_record? && @query.editable_by?(User.current) %> @@ -20,49 +75,6 @@ <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
- <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %> - <%= hidden_field_tag 'set_filter', '1' %> -
- ---<%= l :label_query_new %>--- -
-
"> - - <%= l(:label_issue_query_condition) %> - -
"> - <%= render :partial => 'queries/filters', :locals => {:query => @query} %> -
-
- -
- <%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %> - <%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %> -
-
-
- <% end %>
<%= error_messages_for 'query' %> @@ -73,10 +85,10 @@ <%= l(:label_no_data) %>

<% else %> - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> - +
+ <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count} %> +
+ <% end %> diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb new file mode 100644 index 000000000..34d2eb760 --- /dev/null +++ b/app/views/issues/index.js.erb @@ -0,0 +1 @@ +$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>"); \ No newline at end of file diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index d68e1fc7d..bed1e3d77 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -113,12 +113,13 @@
<%= render :partial => 'edit' %>
+ +

+ + <%= l(:button_submit) %> + <% end %> - -

- - <%= l(:button_submit) %> - + <%#= submit_tag l(:button_submit) %> <%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%>
diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index ca9f43d53..b825800e1 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -225,9 +225,9 @@

请选择项目类型:

确定 diff --git a/app/views/projects/settings/_new_edit.html.erb b/app/views/projects/settings/_new_edit.html.erb index 58c328e87..a8998ece5 100644 --- a/app/views/projects/settings/_new_edit.html.erb +++ b/app/views/projects/settings/_new_edit.html.erb @@ -1,3 +1,4 @@ +<%= error_messages_for 'project' %> <%= labelled_form_for @project do |f| %> - 保存 + 保存 <% end %>
diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index f2b48d341..faccfbeeb 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -24,7 +24,7 @@ :html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}} ) do |f| %> <% roles.each do |role| %> -