This commit is contained in:
huang 2015-05-22 10:35:52 +08:00
commit eb539073ec
6 changed files with 91 additions and 33 deletions

View File

@ -111,11 +111,13 @@ module Mobile
requires :token, type: String
requires :user_id, type: Integer,desc: '被留言的用户id'
requires :content,type:String,desc:'留言内容'
optional :refer_user_id,type:Integer,desc:'被回复的用户id'
requires :ref_user_id,type:Integer,desc:'被回复的用户id'
requires :parent_id,type:Integer,desc:'留言父id'
requires :ref_message_id,type:Integer,desc:'引用消息id'
end
post ':user_id/leave_message' do
us = UsersService.new
jours = us.leave_messages params,current_user
jours = us.reply_user_messages params,current_user
present :status,0
end

View File

@ -255,7 +255,7 @@ 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[:f] = %w(subject status_id priority_id author_id assigned_to_id created_on) unless params[:status_id].nil?
params[:op] = {'subject' => "~" ,
'status_id' => ( params[:status_id] == '0' ? "!":"=" ),
'priority_id' => ( params[:priority_id] == '0' ? "!":"=" ),
@ -266,6 +266,19 @@ module QueriesHelper
'priority_id' => [params[:priority_id]],
'author_id' => [params[:author_id]],
'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil?
if(params[:status_id] != nil)
if( params[:issue_create_date_start]!=nil && params[:issue_create_date_start]!='' &&
params[:issue_create_date_end]!=nil && params[:issue_create_date_end]!='' )
params[:op][:created_on]='><'
params[:v][:created_on]=[params[:issue_create_date_start],params[:issue_create_date_end]]
elsif(params[:issue_create_date_start]!=nil && params[:issue_create_date_start]!='')
params[:op][:created_on]='>='
params[:v][:created_on]=[params[:issue_create_date_start]]
elsif(params[:issue_create_date_end]!=nil && params[:issue_create_date_end]!='')
params[:op][:created_on]='<='
params[:v][:created_on]=[params[:issue_create_date_end]]
end
end
@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}
# else

View File

@ -166,13 +166,22 @@ class UsersService
jours
end
# 给某个用户留言
def leave_messages params,current_user
# 回复用户
def reply_user_messages params,current_user
user = User.find(params[:user_id])
user.add_jour(current_user, params[:content], params[:refer_user_id] ||= 0)
unless params[:refer_user_id].nil? || params[:refer_user_id] == 0 || params[:refer_user_id] == User.current.id
User.find(params[:refer_user_id]).add_jour(current_user, params[:content], params[:refer_user_id])
end
parent_id = params[:parent_id]
author_id = current_user.id
reply_user_id = params[:ref_user_id]
reply_id = params[:ref_message_id]
content = params[:content]
options = {:user_id => author_id,
:status => true,
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:is_readed => false}
user.add_jour(nil, nil,nil,options)
end

View File

@ -15,10 +15,10 @@
<label class="fl" >&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;&nbsp;</label>
<!--<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"></textarea>-->
<% if edit_mode %>
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID %>
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0 %>
<% else %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor' %>
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0 %>
<% end %>
</li>
<div class="cl"></div>

View File

@ -39,8 +39,8 @@
</p>
<p>
<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
<%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
</p>
<%= content_tag "div", course.short_description, :class => "brief_introduction",:style=>'float:left;', :title => course.short_description %>
</div>

View File

@ -1,19 +1,38 @@
<script>
function remote_function() {
$.ajax({
url:'<%= project_issues_path(@project)%>',
data:{
subject:$("#v_subject").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
status_id: $("#status_id").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
assigned_to_id: $("#assigned_to_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
},
success: function(data){
},
error: function(data){
}
$(function(){
$("input[nhtype='dateinput']").each(function(){
$(this).attr('readonly',true);
$(this).datepicker({
dateFormat: 'yy-mm-dd',
showButtonPanel: true,showClearButton: true,showTodayButton: true,
changeMonth: true,
changeYear: true
});
$(this).change(function(){
$("#issue_query_form").submit();
})
});
});
function remote_function() {
$("#issue_query_form").submit();
// $.ajax({
// url:'<%#= project_issues_path(@project)%>',
// data:{
// subject:$("#v_subject").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
// status_id: $("#status_id").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
// assigned_to_id: $("#assigned_to_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
// priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
// author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
// },
// success: function(data){
// },
// error: function(data){
// }
// });
}
function nh_reset_form() {
$("#issue_query_form")[0].reset();
remote_function();
}
function EnterPress(e){
@ -31,41 +50,56 @@
</div>
<div class="problem_top">
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<%#= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
<%= hidden_field_tag 'set_filter', '1' %>
<div class="problem_search" >
<input class="problem_search_input fl" id="v_subject" type="text" name="v[subject]" value="<%= @subject ? @subject : ""%>" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<input class="problem_search_input fl" id="v_subject" type="text" name="subject" value="<%= @subject ? @subject : ""%>" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a>
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="nh_reset_form();" >清空</a>
</div><!--problem_search end-->
<div id="filter_form" class="fr" >
<%= select( :issue, :user_id, principals_options_for_isuue_list(@project),
{ :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0
},
{:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"v[assigned_to_id]",:class=>"w90"}
{:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"w90"}
)
%>
<%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]),
{ :include_blank => false,:selected=>@priority_id ? @priority_id : 0
},
{:onchange=>"remote_function();",:id=>"priority_id",:name=>"v[priority_id]",:class=>"w90"}
{:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"w90"}
)
%>
<%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
{ :include_blank => false,:selected=>@status_id ? @status_id : 0
},
{:onchange=>"remote_function();",:id=>"status_id",:name=>"v[status_id]",:class=>"w90"}
{:onchange=>"remote_function();",:id=>"status_id",:name=>"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=>@author_id ? @author_id : 0
},
{:onchange=>"remote_function();",:id=>"author_id",:name=>"v[author_id]",:class=>"w90"}
{:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:class=>"w90"}
)
%>
</div><!--filter_form end-->
<div class="cl"></div>
<%# end %>
<div>
<div style="float:left;">创建时间&nbsp;:&nbsp;</div>
<div>
<%= text_field_tag 'issue_create_date_start', '',:readonly=>true, :size=>15, :onchange => "remote_function()",:style=>'float:left;'%>
<%= calendar_for('issue_create_date_start') %>
</div>
<div style="float:left;">&nbsp;-&nbsp;</div>
<div>
<%= text_field_tag 'issue_create_date_end', '',:readonly=>true, :size=>15, :onchange => "remote_function()",:style=>'float:left;'%>
<%= calendar_for('issue_create_date_end') %>
</div>
</div>
<div class="cl"></div>
<% end %>
<p class="problem_p fl" ><%= l(:label_issues_sum) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.visible.all.count %></a>
<%= l(:lable_issues_undo) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> </a>
</p>