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/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/controllers/discuss_demos_controller.rb b/app/controllers/discuss_demos_controller.rb
index 31b0f1dcc..a0955efe2 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,12 @@ class DiscussDemosController < ApplicationController
end
def destroy
- DiscussDemo.delete_all(["id = ?",params[:id]])
+ 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
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/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]
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
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
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/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 %>---
-
-
-
-
-
- <%= 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 %>
-
-
-
-
-
<%= l(:label_export_options, :export_format => 'CSV') %>
- <%= form_tag(params.merge({:format => 'csv', :page => nil}), :method => :get, :id => 'csv-export-form') do %>
-
-
-
-
-
-
-
-
-
- <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
- <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
-
- <% 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 %>---
+
+
+
+
+
+ <%= 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 %>
+
+
+
+
+
<%= l(:label_export_options, :export_format => 'CSV') %>
+ <%= form_tag(params.merge({:format => 'csv', :page => nil}), :method => :get, :id => 'csv-export-form') do %>
+
+
+
+
+
+
+
+
+
+ <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
+ <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
+
+ <% 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/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? %>
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;}