Merge branch 'szzh' into guange_dev
This commit is contained in:
commit
3b433cb751
|
@ -67,9 +67,7 @@ class FilesController < ApplicationController
|
|||
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?
|
||||
|
@ -108,14 +106,18 @@ class FilesController < ApplicationController
|
|||
end
|
||||
sort = "#{@sort} #{@order}"
|
||||
end
|
||||
|
||||
begin
|
||||
q = "%#{params[:name].strip}%"
|
||||
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
||||
if params[:insite]
|
||||
@result = find_public_attache q,sort
|
||||
@result = visable_attachemnts_insite @result,@project
|
||||
@searched_attach = paginateHelper @result,10
|
||||
if q == "%%"
|
||||
@result = []
|
||||
@searched_attach = paginateHelper @result,10
|
||||
else
|
||||
@result = find_public_attache q,sort
|
||||
@result = visable_attachemnts_insite @result,@project
|
||||
@searched_attach = paginateHelper @result,10
|
||||
end
|
||||
else
|
||||
@result = find_project_attache q,@project,sort
|
||||
@result = visable_attachemnts @result
|
||||
|
|
|
@ -169,7 +169,7 @@ class IssuesController < ApplicationController
|
|||
attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
|
||||
redirect_to new_project_issue_url(@issue.project, :issue => attrs)
|
||||
else
|
||||
redirect_to issue_url(@issue)
|
||||
redirect_to issue_url(@issue.id)
|
||||
end
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
|
||||
|
@ -239,7 +239,8 @@ class IssuesController < ApplicationController
|
|||
flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default issue_path(@issue) }
|
||||
|
||||
format.html { redirect_to issue_url(@issue.id) }
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
|
|
|
@ -622,8 +622,8 @@ module ApplicationHelper
|
|||
# 公开项目资源可以引用,admin和管理员和资源上传者拥有设置公开私有权限
|
||||
def authority_pubilic_for_files(project, file)
|
||||
@result = false
|
||||
if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id || User.current.admin) &&
|
||||
project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
|
||||
if (is_project_manager?(User.current.id, @project.id) && User.current.allowed_to?(:manage_files, project)) || file.author_id == User.current.id || User.current.admin &&
|
||||
project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
|
||||
@result = true
|
||||
end
|
||||
return @result
|
||||
|
|
|
@ -65,6 +65,16 @@ module ProjectsHelper
|
|||
content_tag('div', content, :class => "tabs")
|
||||
end
|
||||
|
||||
# 判断我的项目中是否有重名项目
|
||||
def judge_same_projectname(user, project_name)
|
||||
result = false
|
||||
my_projects = user.projects
|
||||
my_projects.each do |mp|
|
||||
result = true if mp.name == project_name
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
# Added by young
|
||||
def course_settings_tabs
|
||||
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
|
||||
|
|
|
@ -277,6 +277,9 @@ module QueriesHelper
|
|||
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]]
|
||||
else
|
||||
params[:op][:created_on]='!'
|
||||
params[:v][:created_on]=''
|
||||
end
|
||||
end
|
||||
@query.build_from_params(params)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<% delete_allowed = User.current.allowed_to?(:manage_files, project) %>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
|
@ -22,13 +22,13 @@
|
|||
<% if User.current.logged? %>
|
||||
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
|
||||
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% end %>
|
||||
<% if authority_pubilic_for_files(project, file) %>
|
||||
<% if authority_pubilic_for_files(project, file) && delete_allowed %>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
<%#= watcher_link_issue(@issue, User.current) %>
|
||||
<%#= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' 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), :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), :onclick => 'showAndScrollTo("update", "issue_notes"); 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), 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_notes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %>
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
<script>
|
||||
$(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();
|
||||
})
|
||||
$("input[nhname='nhname']").change(function(){
|
||||
if($(this).val()=='创建日期起始' || $(this).val()=='创建日期结束')return;
|
||||
$("input[nhname='nhname']",$(this).parent('div')).val($(this).val());
|
||||
remote_function();
|
||||
});
|
||||
});
|
||||
function remote_function() {
|
||||
|
@ -55,10 +48,15 @@
|
|||
<div class="problem_search" >
|
||||
<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>-->
|
||||
<a href="javascript:void(0)" class="grey_btn fl ml10" onclick="nh_reset_form();" >清空</a>
|
||||
</div><!--problem_search end-->
|
||||
<%= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %>
|
||||
<p class="problem_p fr" ><%= 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>
|
||||
|
||||
<div id="filter_form" class="fr" >
|
||||
<div class="cl"></div>
|
||||
<div id="filter_form" class="fl">
|
||||
|
||||
<%= select( :issue, :user_id, principals_options_for_isuue_list(@project),
|
||||
{ :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0
|
||||
|
@ -85,24 +83,22 @@
|
|||
)
|
||||
%>
|
||||
</div><!--filter_form end-->
|
||||
<div>
|
||||
<div class="fl"> </div>
|
||||
<div>
|
||||
<input name="issue_create_date_start" nhname="date_val" type="hidden"/>
|
||||
<%= text_field_tag 'issue_create_date_start_show', '创建日期起始',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%>
|
||||
<%= calendar_for('issue_create_date_start_show') %>
|
||||
</div>
|
||||
<div style="float:left;"> - </div>
|
||||
<div>
|
||||
<input name="issue_create_date_end" nhname="date_val" type="hidden"/>
|
||||
<%= text_field_tag 'issue_create_date_end_show', '创建日期结束',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%>
|
||||
<%= calendar_for('issue_create_date_end_show') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--<div>-->
|
||||
<!--<div style="float:left;">创建时间 : </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;"> - </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>
|
||||
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
@ -79,20 +79,25 @@
|
|||
user_ischeck=true;
|
||||
}
|
||||
});
|
||||
if(user_ischeck==false){
|
||||
nh_show_err_message('请选择用户!');
|
||||
return false;
|
||||
}
|
||||
var role_ischeck=false;
|
||||
$("input[name='membership[role_ids][]']").each(function(){
|
||||
if($(this).prop('checked')){
|
||||
role_ischeck=true;
|
||||
}
|
||||
});
|
||||
if(user_ischeck==false && role_ischeck==false){
|
||||
nh_show_err_message('请选择用户和角色!');
|
||||
return false;
|
||||
}
|
||||
if(user_ischeck==false){
|
||||
nh_show_err_message('请选择用户!');
|
||||
return false;
|
||||
}
|
||||
if(role_ischeck==false){
|
||||
nh_show_err_message('请选择角色!');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -425,4 +425,35 @@ $(function(){
|
|||
|
||||
personalized_init();
|
||||
});
|
||||
//cookie记忆html区块 显示/隐藏 的代码 end
|
||||
//cookie记忆html区块 显示/隐藏 的代码 end
|
||||
|
||||
// 新建项目的时候判断是否与我已有的项目重复
|
||||
function judgeprojectname(){
|
||||
$('#new_project').validate({
|
||||
errorPlacement: function(error, element){
|
||||
alert('error')
|
||||
},
|
||||
success: function(label){
|
||||
alert('ok')
|
||||
},
|
||||
onkeyup: false,
|
||||
rules : {
|
||||
name:{required : true,
|
||||
remote : {
|
||||
url : 'projects/judge_same_projectname',
|
||||
type:'get',
|
||||
dataType:'text',
|
||||
data:{
|
||||
name : function(){ return $.trim( $("#name").val() ); }
|
||||
},
|
||||
dataFilter:function( data ){
|
||||
if( data=='true')return false; else return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
messages : {
|
||||
name:{required : "请填写项目名称!",remote:'您已新建过同名项目,请修改项目名称!'}
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue