From da694439137c908d5d1e015ca355599eac6ff627 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 18 Mar 2015 08:52:49 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=8A=E4=BC=A0=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E6=95=B0=E6=8D=AE=E5=BA=93=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/discuss_demo.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/discuss_demo.rb b/app/models/discuss_demo.rb index 74b21f9d4..6ed8d15b6 100644 --- a/app/models/discuss_demo.rb +++ b/app/models/discuss_demo.rb @@ -1,4 +1,4 @@ class DiscussDemo < ActiveRecord::Base attr_accessible :title, :body - has_many_kindeditor_assets :attachments, :dependent => :destroy + has_many_kindeditor_assets :assets, :dependent => :destroy end From 41f302c467fcb0343a3b128bae611f3fcd84671e Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 18 Mar 2015 08:53:36 +0800 Subject: [PATCH 2/7] =?UTF-8?q?cotroller=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/discuss_demos_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/discuss_demos_controller.rb b/app/controllers/discuss_demos_controller.rb index 31b0f1dcc..1b140714f 100644 --- a/app/controllers/discuss_demos_controller.rb +++ b/app/controllers/discuss_demos_controller.rb @@ -1,5 +1,6 @@ class DiscussDemosController < ApplicationController def index + @discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10) end @@ -24,7 +25,7 @@ class DiscussDemosController < ApplicationController end def destroy - DiscussDemo.delete_all(["id = ?",params[:id]]) + DiscussDemo.destroy(params[:id]) redirect_to :controller=> 'discuss_demos',:action => 'index' end From 930486d21ebb8e1db3fb651795c1ba3d8a3b6804 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 18 Mar 2015 09:25:26 +0800 Subject: [PATCH 3/7] =?UTF-8?q?#2024=20course=E4=B8=BB=E9=A1=B5=EF=BC=9A?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=BF=9B=E5=85=A5=E9=9D=9E=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E6=89=80=E5=9C=A8=E5=AD=A6=E6=A0=A1?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E5=9B=BE=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E8=AF=BE=E7=A8=8B=E2=80=9D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 949ddd643..f35210f01 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -20,7 +20,7 @@ class WelcomeController < ApplicationController include WelcomeHelper helper :project_score caches_action :robots - before_filter :find_first_page, :only => [:index] + #before_filter :find_first_page, :only => [:index] # before_filter :fake, :only => [:index, :course] before_filter :entry_select, :only => [:index] From e49bb18b620115631d9fbe6936a2bce19949dc9d Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 18 Mar 2015 10:17:22 +0800 Subject: [PATCH 4/7] =?UTF-8?q?cotroller=E4=BF=AE=E6=94=B9=EF=BC=9A?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=AE=B0=E5=BD=95=E7=9A=84=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AF=B9=E5=BA=94=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/discuss_demos_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/discuss_demos_controller.rb b/app/controllers/discuss_demos_controller.rb index 1b140714f..a0955efe2 100644 --- a/app/controllers/discuss_demos_controller.rb +++ b/app/controllers/discuss_demos_controller.rb @@ -25,6 +25,11 @@ class DiscussDemosController < ApplicationController end def destroy + asset = Kindeditor::Asset.find_by_owner_id(params[:id]) + filepath = File.join(Rails.root,"public","files","uploads", + asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s, + asset[:asset].to_s) + File.delete(filepath) if File.exist?filepath DiscussDemo.destroy(params[:id]) redirect_to :controller=> 'discuss_demos',:action => 'index' end From 6498002c714e6f121de3e034903796a6f95cf1fd Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 18 Mar 2015 15:50:00 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E4=B8=AD=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98=E3=80=81=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=9A=84=E6=97=B6=E5=80=99=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84bug=20=E5=8E=9F=E5=9B=A0=EF=BC=9A?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/documents_controller.rb | 1 + app/views/documents/_form.html.erb | 4 +- app/views/documents/edit.html.erb | 4 +- app/views/issues/_newissue_index.html.erb | 139 --------------------- app/views/issues/index.html.erb | 140 +++++++++++++++++++++- app/views/issues/index.js.erb | 1 - public/stylesheets/application.css | 2 +- 7 files changed, 146 insertions(+), 145 deletions(-) delete mode 100644 app/views/issues/_newissue_index.html.erb delete mode 100644 app/views/issues/index.js.erb diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 545d61155..9bf2ee846 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -91,6 +91,7 @@ class DocumentsController < ApplicationController def update @document.safe_attributes = params[:document] + @document.save_attachments(params[:attachments]) if request.put? and @document.save flash[:notice] = l(:notice_successful_update) redirect_to document_url(@document) diff --git a/app/views/documents/_form.html.erb b/app/views/documents/_form.html.erb index 72361b9ab..50f47e5f7 100644 --- a/app/views/documents/_form.html.erb +++ b/app/views/documents/_form.html.erb @@ -11,8 +11,8 @@ <%= wikitoolbar_for 'document_description' %> -<% if @document.new_record? %> +

<%= render :partial => 'attachments/form', :locals => {:container => @document} %>

-<% end %> + diff --git a/app/views/documents/edit.html.erb b/app/views/documents/edit.html.erb index 8a6122f8c..5c6ed2383 100644 --- a/app/views/documents/edit.html.erb +++ b/app/views/documents/edit.html.erb @@ -1,4 +1,6 @@ -

<%=l(:label_document)%>

+
+

<%=l(:label_document_plural)%>

+
<%= labelled_form_for @document do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> diff --git a/app/views/issues/_newissue_index.html.erb b/app/views/issues/_newissue_index.html.erb deleted file mode 100644 index 4b282aa8f..000000000 --- a/app/views/issues/_newissue_index.html.erb +++ /dev/null @@ -1,139 +0,0 @@ -
-

问题跟踪

-
-
- <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> - - <% if User.current.member_of?(@project) %> - <%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new, - :html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %> - <% end %> - <%= link_to l(:label_query), '#', :class => 'icon icon-help', - :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> - - <% end %> - 问题总数:<%= @project.issues.count %> 未解决:<%= @project.issues.where('status_id in (1,2,4,6)').count %> -
-
- <% if !@query.new_record? && @query.editable_by?(User.current) %> - <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> - <%= delete_link query_path(@query) %> - <% end %> -
- -<% 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' %> - -<% if @query.valid? %> - <% if @issues.empty? %> -

- <%= l(:label_no_data) %> -

- <% else %> - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> - - <% end %> -
- <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> - <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> - <%= f.link_to 'PDF', :url => params %> - <% end %> -
- - - - -<% end %> - -<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> - -<% content_for :sidebar do %> - <%= render :partial => 'issues/sidebar' %> -<% end %> - -<% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, - {:query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_issue_plural)) %> - <%= auto_discovery_link_tag(:atom, - {:controller => 'journals', :action => 'index', - :query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_changes_details)) %> -<% end %> - -<%= context_menu issues_context_menu_path %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index b3750a770..4b282aa8f 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -1 +1,139 @@ -<%= render :partial => 'issues/newissue_index' %> \ No newline at end of file +
+

问题跟踪

+
+
+ <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + + <% if User.current.member_of?(@project) %> + <%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new, + :html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %> + <% end %> + <%= link_to l(:label_query), '#', :class => 'icon icon-help', + :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> + + <% end %> + 问题总数:<%= @project.issues.count %> 未解决:<%= @project.issues.where('status_id in (1,2,4,6)').count %> +
+
+ <% if !@query.new_record? && @query.editable_by?(User.current) %> + <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> + <%= delete_link query_path(@query) %> + <% end %> +
+ +<% 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' %> + +<% if @query.valid? %> + <% if @issues.empty? %> +

+ <%= l(:label_no_data) %> +

+ <% else %> + <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> + + <% end %> +
+ <% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> + <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> + <%= f.link_to 'PDF', :url => params %> + <% end %> +
+ + + + +<% end %> + +<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> + +<% content_for :sidebar do %> + <%= render :partial => 'issues/sidebar' %> +<% end %> + +<% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, + {:query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_issue_plural)) %> + <%= auto_discovery_link_tag(:atom, + {:controller => 'journals', :action => 'index', + :query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_changes_details)) %> +<% end %> + +<%= context_menu issues_context_menu_path %> diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb deleted file mode 100644 index 866882053..000000000 --- a/app/views/issues/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('#content').html('<%= escape_javascript(render :partial => 'issues/newissue_index') %>'); diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 6d50d8bd2..3c487db5a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -77,7 +77,7 @@ a:hover.subnav_green{ background:#14ad5a;} /*右侧内容--动态*/ /*右侧内容--动态*/ .project_r_h{height:40px; background:#eaeaea; margin-bottom:10px;} -.project_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;} +.project_h2{ background:#64bdd9; color:#fff; height:29px; width:90px; text-align:center; font-weight:normal; padding-top:10px; font-size:16px;padding-left:10px;} .project_r_box{ border:1px solid #e2e1e1; width:670px; margin-top:10px;} .project_h3 { color:#646464; font-size:14px; padding:0 10px; border-bottom:1px solid #e2e1e1;} a.more{ float:right; font-size:12px; font-weight:normal; color:#a9a9a9; margin-top:3px;} From fd2c3e82014726991d5768dbfdd56159a1cf03e8 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 18 Mar 2015 17:21:19 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/course_dynamic.rb | 2 ++ app/services/courses_service.rb | 2 +- app/views/issues/show.html.erb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb index aa8aadbb6..b6e4630e4 100644 --- a/app/api/mobile/entities/course_dynamic.rb +++ b/app/api/mobile/entities/course_dynamic.rb @@ -15,6 +15,8 @@ module Mobile course_dynamic_expose :type course_dynamic_expose :count course_dynamic_expose :course_name + course_dynamic_expose :course_term + course_dynamic_expose :course_time course_dynamic_expose :course_id course_dynamic_expose :course_img_url course_dynamic_expose :message diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 1ec8a0ef0..dc6cf8119 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -402,7 +402,7 @@ class CoursesService latest_course_dynamics.sort!{|order,newer| newer[:time] <=> order[:time]} latest_course_dynamic = latest_course_dynamics.first unless latest_course_dynamic.nil? - result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:type => latest_course_dynamic[:type],:update_time => latest_course_dynamic[:time],:message => latest_course_dynamic[:message],:count => nil} + result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:course_time => course.time,:course_term => course.term,:type => latest_course_dynamic[:type],:update_time => latest_course_dynamic[:time],:message => latest_course_dynamic[:message],:count => nil} end end result.sort!{|order,newer| newer[:update_time] <=> order[:update_time]} diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 69abf79a6..42171d595 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -89,7 +89,7 @@ end %> <%= render_custom_fields_rows(@issue) %> <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> -woca + <% if @issue.description? || @issue.attachments.any? -%>
<% if @issue.description? %> From 9d686349da40a0de155e8cc29c95d60ab8400369 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 18 Mar 2015 17:31:35 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E6=8C=89=E6=98=B5=E7=A7=B0?= =?UTF-8?q?=E6=88=96=E5=A7=93=E5=90=8D=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/users.rb | 2 +- app/models/user.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 9a5307be6..b6d1db25c 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -82,7 +82,7 @@ module Mobile desc "用户搜索" params do requires :name, type: String, desc: '用户名关键字' - requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱' + requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名' end get 'search/search_user' do us = UsersService.new diff --git a/app/models/user.rb b/app/models/user.rb index 83e08254c..860eb56a5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -214,6 +214,8 @@ class User < Principal where(" LOWER(login) LIKE '#{pattern}' ") elsif type == "1" where(" LOWER(concat(lastname, firstname)) LIKE '#{pattern}' ") + elsif type == "3" + where(" LOWER(concat(lastname, firstname,login)) LIKE '#{pattern}' ") else where(" LOWER(mail) LIKE '#{pattern}' ") end