新版项目配置及JS

This commit is contained in:
huang 2016-10-12 14:13:52 +08:00
parent 7800ba9701
commit 2126364a19
4 changed files with 122 additions and 48 deletions

View File

@ -1,8 +1,8 @@
<a href="javascript:void(0)" class="upimg fl">
<%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
<a href="javascript:void(0)">
<%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片", :class => "fl ml5 pro_new_upimg")%>
</a>
<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %>
<a href="javascript:void(0)" class="upbtn fl" onclick="$('#upload_course_logo').click();"><%= l(:button_upload_photo) %></a>
<a href="javascript:void(0)" class="sub_btn fl mt35 ml5" style="line-height: 1.5" onclick="$('#upload_course_logo').click();"><%= l(:button_upload_photo) %></a>
<%= file_field_tag 'avatar[image]',
:id => 'upload_course_logo',
:class => 'undis upload_file',

View File

@ -1,3 +1,84 @@
<div class="pro_new_setting clear">
<div class="pro_new_setting_leftnav fl">
<ul>
<% show_memu = show_project_memu User.current%>
<% if User.current.allowed_to?(:edit_project, @project) %>
<li><a id="pro_st_tb_1" class="<%= show_memu == 'edit_project' ? 'active' : ''%>" onclick="project_setting(1);">信息</a></li>
<% end %>
<% if User.current.allowed_to?(:select_project_modules, @project) %>
<li><a id="pro_st_tb_2" class="<%= show_memu == 'select_project_modules' ? 'active' : ''%>" onclick="project_setting(2);">模块</a></li>
<% end %>
<% if User.current.allowed_to?(:manage_members, @project) %>
<li><a id="pro_st_tb_3" class="<%= show_memu == 'manage_members' ? 'active' : ''%>" onclick="project_setting(3);">成员</a></li>
<% end %>
<li><a id="pro_st_tb_5" class="<%= show_memu == 'join_org' ? 'active' : ''%>" onclick="project_setting(5);">组织</a></li>
<% if User.current.allowed_to?(:manage_versions, @project) %>
<li><a id="pro_st_tb_4" class="<%= show_memu == 'manage_versions' ? 'active' : ''%>" onclick="project_setting(4);"><%= l(:milestone) %></a></li>
<% end %>
<!--<li id="pro_st_tb_5" class="pro_st_normaltab" onclick="project_setting(5);">问题类别</li>-->
<% if User.current.allowed_to?(:manage_repository, @project) %>
<li><a id="pro_st_tb_6" class="<%= show_memu == 'manage_repository' ? 'active' : ''%>" onclick="project_setting(6);">版本库</a></li>
<% end %>
<!--<li id="pro_st_tb_7" class="pro_st_normaltab" onclick="project_setting(7);">活动(时间跟踪)</li>-->
<!--<li id="pro_st_tb_8" class="pro_st_normaltab" onclick="project_setting(8);">代码评审</li>-->
</ul>
<ul>
<li><a href="project-setting01.html" class="active "> 信息 </a></li>
<li><a href="project-setting02.html" class=" "> 模块 </a></li>
<li><a href="project-setting03.html" class=" "> 成员 </a></li>
<li><a href="project-setting04.html" class=" "> 组织 </a></li>
<li><a href="project-setting05.html" class=" "> 里程碑 </a></li>
<li><a href="project-setting06.html" class=" "> 版本库 </a></li>
</ul>
</div>
<div class="pro_new_setting_conbox fl ml10">
<div class="">
<div class="<%= show_memu == 'edit_project' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_01">
<%= render :partial=>"projects/settings/new_edit" if User.current.allowed_to?(:edit_project, @project)%>
</div><!--tbc_01 end-->
<div class="<%= show_memu == 'select_project_modules' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_02">
<%= render :partial=>"projects/settings/new_modules" if User.current.allowed_to?(:select_project_modules, @project)%>
</div><!--tbc_02 end-->
<div class="<%= show_memu == 'manage_members' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_03">
<%= render :partial=>"projects/settings/new_members" if User.current.allowed_to?(:manage_members, @project)%>
</div><!--tbc_03 end-->
<div class="<%= show_memu == 'manage_versions' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_04">
<%= render :partial=>"projects/settings/new_versions" if User.current.allowed_to?(:manage_versions, @project)%>
</div><!--tbc_04 end-->
<!--<div class="pro_st_undis" id="pro_st_tbc_05">-->
<!--<%#= render :partial=>"projects/settings/new_issue_categories" %>-->
<!--</div>&lt;!&ndash;tbc_05 end&ndash;&gt;-->
<div class="<%= show_memu == 'join_org' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_05">
<%= render :partial=>"projects/settings/join_org" %>
</div>
<div class="<%= show_memu == 'manage_repository' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_06">
<%= render :partial=>"projects/settings/new_repositories" if User.current.allowed_to?(:manage_repository, @project)%>
</div><!--tbc_06 end-->
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
<%if @select_tab %>
@ -16,7 +97,7 @@
<% end%>
<% end%>
$("div[nhname='pro_setting']").show();
$(".project_r_h").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
// $(".project_r_h").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
});
</script>

View File

@ -1,49 +1,42 @@
<%= error_messages_for 'project' %>
<%= labelled_form_for @project do |f| %>
<ul class="newpro_box ">
<li class="ml45 mb10" id="project_avatar_form">
<%= render :partial=>"avatar/new_avatar_form",:locals=> {source:@project} %>
</li>
<li >
<label class="label02"><span class="c_red">*</span>&nbsp;项目名称&nbsp;&nbsp;</label>
<!--<input id="project_name" name="project[name]" class=" w543" type="text" value="<%#= @project.name%>">-->
<input type="text" name="project[name]" id="project_name" class="w543" maxlength="100" onkeyup="regex_project_name();" value="<%= @project.name %>">
<span class="c_red ml110" id="project_name_notice" style="display: none;">项目名称不能为空!</span>
</li>
<div class="cl"></div>
<li >
<label class="label02" >&nbsp;&nbsp;项目描述&nbsp;&nbsp;</label>
<textarea class="w543" id="project_description" name="project[description]" rows="8" placeholder="最多3000个汉字(或6000个英文字符)"><%= @project.description%></textarea>
<div class="cl"></div>
</li>
<% if !@project.gpid.nil? && !@gitlab_branches.blank? %>
<li>
<label class="label02">&nbsp;默认分支&nbsp;&nbsp;</label>
<%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @rev), :id => 'branch' %>
<ul class="pro_newsetting_con mb15">
<li class="clear mb10" id="project_avatar_form">
<label class="label fl">&nbsp;&nbsp;</label>
<%= render :partial=>"avatar/new_avatar_form",:locals=> {source:@project} %>
</li>
<li class="mb10">
<label class="label"><span class="c_red f12">*</span>&nbsp;项目名称&nbsp;&nbsp;:&nbsp;</label>
<input type="text" name="project[name]" id="project_name" class="ml5 w690" maxlength="100" onkeyup="regex_project_name();" value="<%= @project.name %>">
<span class="c_red ml5 fl" id="project_name_notice" style="display: none;">项目名称不能为空!</span>
</li>
<li class="clear mb10">
<label class="label fl">&nbsp;项目描述&nbsp;&nbsp;:&nbsp;</label>
<textarea class="fl ml5 w690" style="height:192px; padding-top:5px;" id="project_description" name="project[description]" rows="8" placeholder="项目描述作为项目的简介,将始终显示在动态页的顶部
最多3000个汉字或6000个英文字符"><%= @project.description%></textarea>
</li>
<% if !@project.gpid.nil? && !@gitlab_branches.blank? %>
<li class="clear">
<label class="fl">&nbsp;默认分支&nbsp;&nbsp;</label>
<%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @rev), :id => 'branch', :class => "ml5" %>
</li>
<% end %>
<li class="clear">
<label class="fl">公开&nbsp;&nbsp;</label>
<input class="fl ml5" id="project_is_public" name="project[is_public]" type="checkbox" <%= @project.is_public ? "checked" : ""%>>
<span class="fl c_grey ">(打钩为公开项目,不打钩为私有项目;私有项目仅项目成员可见。)</span>
</li>
<li class="clear mb10">
<label class="fl ">隐藏代码库&nbsp;&nbsp;</label>
<input class="fl ml5" id="project_hidden_repo" name="project[hidden_repo]" type="checkbox" <%= @project.hidden_repo ? "checked" : ""%>>
</li>
<li class="clear">
<% if Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %>
<%= link_to(l(:button_delete_project), { :controller => 'projects', :action => 'archive', :id => @project, :status => params[:status], :type =>"project" },
:data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => "sy_btn_grey mr5 fl ml15") unless @project.archived? %>
<p class="fl c_grey">(友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!)</p>
<% end %>
<div class="cl"></div>
<li >
<label class="label02">公开&nbsp;&nbsp;</label>
<input id="project_is_public" name="project[is_public]" type="checkbox" <%= @project.is_public ? "checked" : ""%>>
<div class="cl"></div>
</li>
<li >
<label class="label02">隐藏代码库&nbsp;&nbsp;</label>
<input id="project_hidden_repo" name="project[hidden_repo]" type="checkbox" <%= @project.hidden_repo ? "checked" : ""%>>
<div class="cl"></div>
</li>
<a href="javascript:void(0)" class="sy_btn_blue mr15 fr" onclick="submit_edit_project(<%= @project.id %>);" >保存</a>
</li>
</ul>
<a href="javascript:void(0)" class="blue_btn ml110" onclick="submit_edit_project(<%= @project.id %>);" >保存</a>
<% end %>
<% if User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %>
<div class="mt30">
<img src="/images/pic_del.gif" class="mr5">
<%= link_to(l(:button_delete_project), { :controller => 'projects', :action => 'archive', :id => @project, :status => params[:status], :type =>"project" },
:data => {:confirm => l(:text_are_you_sure)}, :method => :post) unless @project.archived? %>
<%#=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %>
<span>(友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!)</span>
</div>
<% end %>
<div class="cl"></div>

View File

@ -333,7 +333,7 @@ function close_window(type) {
function project_setting(n) {
for (var i = 1; i < 9; i++) {
if (i == n) {
$("#pro_st_tb_" + i).removeClass().addClass("pro_st_hovertab");
$("#pro_st_tb_" + i).removeClass().addClass("active");
$("#pro_st_tbc_0" + i).removeClass().addClass("pro_st_dis");
}
else {