This commit is contained in:
alan 2015-03-07 09:53:15 +08:00
commit fd97302947
15 changed files with 346 additions and 277 deletions

View File

@ -339,11 +339,8 @@ class ProjectsController < ApplicationController
end
# 邀请Trustie注册用户
def invite_members_had_loged
def invite_members
@member ||= @project.members.new
respond_to do |format|
format.js
end
end
def edit

View File

@ -31,7 +31,7 @@ module WatchersHelper
watched = objects.any? {|object| object.watched_by?(user)}
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or objects.first.instance_of?(Contest) or (objects.first.instance_of?(Bid)))
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
text = @watch_flag ?
@ -283,6 +283,6 @@ module WatchersHelper
def exit_project_link(project)
link_to(l(:label_exit_project),exit_cur_project_path(project.id),
:remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px;margin-right:10px;height:20px;text-aligh:center;" )
:remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px;margin-right:10px;height:22px;background:none repeat scroll 0% 0% #64BDD9;TES" )
end
end

View File

@ -1,250 +0,0 @@
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
<div id="resource_list">
<% if @isproject %>
<%= render :partial => 'project_file', locals: {project: @project} %>
<% else %>
<%= render :partial => 'course_file', locals: {course: @course} %>
<% end %>
</div>
<script type='text/javascript'>
var slideHeight = 29;
function readmore(aNode) {
// console.log(aNode)
// var $td_tags_area = $(aNode).parent().parent();
var $td_tags_area = $(aNode).parent().parent().parent().parent();
var $tags_area = $td_tags_area.find('.tags_area')
var $tags_gradint = $td_tags_area.find('.tags_gradint')
var $read_more = $td_tags_area.find('.read-more')
var $read_more_a = $td_tags_area.find('.read-more a')
var $tags = $td_tags_area.find('#tags')
var $icona = $td_tags_area.find('.tags_icona')
var slideHeight = 13; //px
var defHeight = $tags.height();
var curHeight = $tags_area.height();
if (curHeight == slideHeight) {
$tags_area.animate({
height: defHeight
}, 'normal');
$read_more_a.html('隐藏');
$icona.html('<%=image_tag "/images/sidebar/minus.png"%>')
$tags_gradint.fadeOut();
} else {
$tags_area.animate({
height: slideHeight
}, 'normal');
$read_more_a.html('更多');
$icona.html('<%=image_tag "/images/sidebar/add.png"%>')
$tags_gradint.fadeIn();
}
;
}
$(function () {
var slideHeight = 20; //px
var defHeight = $('.tags_area').height();
if (defHeight >= slideHeight) {
$('.tags_area').css('height', slideHeight + 'px');
}
;
});
function eval_ajax(xhr, textStatus) {
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
}
function attachment_contenttypes_searchex(value) {
<% if @project%>
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function attachtype_edit(value) {
<% if @project%>
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function attachmenttypes_searchex(value) {
<% if @project%>
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: encodeURIComponent(value),
contentType: $('#attach_sufix_browse').val()
}
}).complete(eval_ajax);
<%end%>
}
function course_attachmenttypes_searchex(value) {
<% if @course%>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: encodeURIComponent(value),
contentType: $('#attach_sufix_browse').val()
}
}).complete(eval_ajax);
<%end%>
}
function course_attachment_contenttypes_searchex(value) {
<% if @course%>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function course_attachtype_edit(value) {
<% if @course%>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function attachmenttypes_change(id, type) {
<% if @project%>
$.ajax({
url: '<%=updateType_attachments_path%>',
type: "POST",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) {
if (textStatus == 'success') {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: $('#attach_sufix_browse').val()
}
}).error(function () {
alert('error');
});
} else if (textStatus == 'error') {
alert('An error has occurred');
}
});
<%end%>
}
function course_attachmenttypes_change(id, type) {
<% if @course%>
$.ajax({
url: '<%=updateType_attachments_path%>',
type: "POST",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) {
if (textStatus == 'success') {
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: $('#attach_sufix_browse').val()
}
}).error(function () {
alert('error');
});
} else if (textStatus == 'error') {
alert('An error has occurred');
}
});
<%end%>
}
// 编辑文件密级
function file_dense_edit(id, type) {
$.ajax({
url: '<%=updateFileDense_attachments_path%>',
type: "POST",
remote:"true",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) {
});
}
</script>
<script type='text/javascript'>
function tagAddClick(divid, objId, objTag) {
alert("OK");
$.ajax({
type: "POST",
url: '/users/tag_saveEx',
data: {
tagname: $('tag_name').value,
obj_id: encodeURIComponent(objId),
obj_flag: encodeURIComponent(objTag)
},
success: function (data, textStatus) {
alert("OK");
$(divid).empty();
$(divid).html('123');
$("#" + divid + " #name").val("");
}
})
}
</script>

View File

@ -1 +1,249 @@
<%= render :partial => 'files/newfile_index' %>
<div id="resource_list">
<% if @isproject %>
<%= render :partial => 'project_file', locals: {project: @project} %>
<% else %>
<%= render :partial => 'course_file', locals: {course: @course} %>
<% end %>
</div>
<script type='text/javascript'>
var slideHeight = 29;
function readmore(aNode) {
// console.log(aNode)
// var $td_tags_area = $(aNode).parent().parent();
var $td_tags_area = $(aNode).parent().parent().parent().parent();
var $tags_area = $td_tags_area.find('.tags_area')
var $tags_gradint = $td_tags_area.find('.tags_gradint')
var $read_more = $td_tags_area.find('.read-more')
var $read_more_a = $td_tags_area.find('.read-more a')
var $tags = $td_tags_area.find('#tags')
var $icona = $td_tags_area.find('.tags_icona')
var slideHeight = 13; //px
var defHeight = $tags.height();
var curHeight = $tags_area.height();
if (curHeight == slideHeight) {
$tags_area.animate({
height: defHeight
}, 'normal');
$read_more_a.html('隐藏');
$icona.html('<%=image_tag "/images/sidebar/minus.png"%>')
$tags_gradint.fadeOut();
} else {
$tags_area.animate({
height: slideHeight
}, 'normal');
$read_more_a.html('更多');
$icona.html('<%=image_tag "/images/sidebar/add.png"%>')
$tags_gradint.fadeIn();
}
;
}
$(function () {
var slideHeight = 20; //px
var defHeight = $('.tags_area').height();
if (defHeight >= slideHeight) {
$('.tags_area').css('height', slideHeight + 'px');
}
;
});
function eval_ajax(xhr, textStatus) {
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
}
function attachment_contenttypes_searchex(value) {
<% if @project%>
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function attachtype_edit(value) {
<% if @project%>
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function attachmenttypes_searchex(value) {
<% if @project%>
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: encodeURIComponent(value),
contentType: $('#attach_sufix_browse').val()
}
}).complete(eval_ajax);
<%end%>
}
function course_attachmenttypes_searchex(value) {
<% if @course%>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: encodeURIComponent(value),
contentType: $('#attach_sufix_browse').val()
}
}).complete(eval_ajax);
<%end%>
}
function course_attachment_contenttypes_searchex(value) {
<% if @course%>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function course_attachtype_edit(value) {
<% if @course%>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function attachmenttypes_change(id, type) {
<% if @project%>
$.ajax({
url: '<%=updateType_attachments_path%>',
type: "POST",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) {
if (textStatus == 'success') {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: $('#attach_sufix_browse').val()
}
}).error(function () {
alert('error');
});
} else if (textStatus == 'error') {
alert('An error has occurred');
}
});
<%end%>
}
function course_attachmenttypes_change(id, type) {
<% if @course%>
$.ajax({
url: '<%=updateType_attachments_path%>',
type: "POST",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) {
if (textStatus == 'success') {
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: $('#attach_sufix_browse').val()
}
}).error(function () {
alert('error');
});
} else if (textStatus == 'error') {
alert('An error has occurred');
}
});
<%end%>
}
// 编辑文件密级
function file_dense_edit(id, type) {
$.ajax({
url: '<%=updateFileDense_attachments_path%>',
type: "POST",
remote:"true",
data: {
attachmentid: encodeURIComponent(id),
newtype: encodeURIComponent(type)
}
}).complete(function (xhr, textStatus) {
});
}
</script>
<script type='text/javascript'>
function tagAddClick(divid, objId, objTag) {
alert("OK");
$.ajax({
type: "POST",
url: '/users/tag_saveEx',
data: {
tagname: $('tag_name').value,
obj_id: encodeURIComponent(objId),
obj_flag: encodeURIComponent(objTag)
},
success: function (data, textStatus) {
alert("OK");
$(divid).empty();
$(divid).html('123');
$("#" + divid + " #name").val("");
}
})
}
</script>

View File

@ -1,2 +0,0 @@
alert("eeee");
$('#content').html('<%= escape_javascript(render :partial => 'issues/newissue_index') %>');

View File

@ -4,13 +4,15 @@
<div class="problem_top">
<% if @project.enabled_modules.where("name = 'issue_tracking'").count > 0 %>
<span>
<%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new,
<% 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? %>
</span>
<% end %>
<span class="problem_p fr">问题总数:<span>100</span> 未解决:<span>20</span></span>
<span class="problem_p fr">问题总数:<span><%= @project.issues.count %></span> 未解决:<span><%= @project.issues.where('status_id in (1,2,4,6)').count %></span></span>
</div>
<div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %>

View File

@ -1,5 +1,5 @@
<div class="project_r_h">
<h2 class="project_h2">问题跟踪</h2>
<h2 class="project_h2"><%= l(:label_issue_plural) %></h2>
</div>
<%# html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %>

View File

@ -103,7 +103,11 @@
</div>
<!-- 项目得分 -->
<div class="cl"></div>
<div class="pr_info_name><%= link_to @project.name, project_path(@project) %><span class="img_private ">私有</span></div>
<div class="pr_info_name><%= link_to @project.name, project_path(@project) %>
<% if !@project.is_public? %>
<span class="img_private ">私有</span>
<% end %>
</div>
<div class="cl"></div>
<div class="pr_info_score">
<% if @project.project_type == 0 %>
@ -125,13 +129,11 @@
<div class="subNavBox">
<div class="subNav currentDd currentDt subNav_jiantou">邀请</div>
<ul class="navContent " style="display:block; padding-left: 0px; margin-top:0px;">
<li><a href="#">发送邮件邀请新用户</a></li>
<li><a href="#">邀请Trustie注册用户</a></li>
<li><%= link_to "发送邮件邀请新用户" %></li>
<li><%= link_to "邀请Trustie注册用户", :controller=>"projects", :action=>"invite_members", :id => @project %></li>
</ul>
<div class="subNav">
<%= link_to "动态", {:controller => 'projects', :action => 'show', :id => @project.id},
:remote => "true",
:style => "color:#3CA5C6" %>
<%= link_to "动态", {:controller => 'projects', :action => 'show', :id => @project.id}, :style => "color:#3CA5C6" %>
</div>
<div class="subNav">
<%= link_to "问题跟踪", project_issues_path(@project), :style => "color:#3CA5C6" %><span class="subnav_num">(<%= @project.issues.count %>)</span>
@ -144,7 +146,7 @@
<%= link_to "讨论区", project_boards_path(@project), :style => "color:#3CA5C6" %>
<span class="subnav_num">(<%= @project.boards.first.topics.count %>)</span>
<% if User.current.logged? && User.current.member_of?(@project) %>
<%= link_to "+发贴", new_board_message_path(@project.boards.first, @project), :layout => 'base_projects',:style => "font-size:12px;color:#fff; padding:1px 3px 3px 3px;height:18px;margin-top:4px;background:#28be6c;float:right;line-height:20px;" %>
<%= link_to "+发贴", new_board_message_path(@project.boards.first), :layout => 'base_projects',:style => "font-size:12px;color:#fff; padding:1px 3px 3px 3px;height:18px;margin-top:4px;background:#28be6c;float:right;line-height:20px;" %>
<% end %>
</div>
<div class="subNav">

View File

@ -5,7 +5,7 @@
<% @nav_dispaly_forum_label = 1%>
<!-- <h1>New memo</h1> -->
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
<div class="top-content">
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf">软件项目托管社区</td>
@ -19,7 +19,7 @@
<td style="padding-left: 8px"><%= link_to request.host()+"/forums", forums_path %></td>
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to '公共贴吧', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name %></p></td>
</tr>
</table>
</table>
</div>
<h3><%=l(:label_memo_new)%></h3>
<div class="box tabular">

View File

@ -0,0 +1,67 @@
<div class="project_r_h">
<h2 class="project_h2">邀请加入</h2>
</div>
<%= error_messages_for 'member' %>
<%
roles = Role.givable.all
if @project.project_type == Project::ProjectType_course
roles = roles[3..5]
else
roles = roles[0..2]
end
members = @project.member_principals.includes(:roles, :principal).all.sort
%>
<div style="margin-left: 30px" >
<div class="floatbox" style="margin:100px;">
<div ><a href="#" class="box_close"></a></div>
<div class="cl"></div>
<div class="box_main">
<h3 class="box_h3">邀请Trustie注册用户</h3>
<% if roles.any? %>
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<div class="invi_search">
<%= label_tag "principal_search", l(:label_principal_search) %>
<%= text_field_tag 'principal_search', nil %>
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
<div id="principals_for_new_member">
<%= render_principals_for_new_members(@project) %>
</div>
<p style="padding-top: 5px">
<%= l(:label_role_plural) %>:
<% roles.each do |role| %>
<label>
<%= check_box_tag 'membership[role_ids][]', role.id %>
<%= h role %>
</label>
<% end %>
</p>
<p>
<%= submit_tag l(:button_add), :id => 'member-add-submit', :style => 'display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;' %>
</p>
<% end %>
<% end %>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
var collection=$("#principals_for_new_member").children("#principals").children("label");
collection.css("text-overflow","ellipsis");
collection.css("white-space","nowrap");
collection.css("width","200px");
collection.css("overflow","hidden");
for(i=0;i<collection.length;i++){ //增加悬浮显示
var label=collection[i];
var text=$(label).text();
$(label).attr("title",text);
}
});
</script>

View File

@ -1,3 +1,6 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_activity) %></h2>
</div>
<%= javascript_include_tag "jquery.infinitescroll.js" %>
<script>
/* $(document).ready(function (){ //别忘了加这句除非你没学Jquery
@ -20,7 +23,7 @@
<% @events_pages.each do |e| -%>
<% act = e.forge_act %>
<% if e.forge_act_type == "Issue" %>
<div class="activity-item underline-evreycontent" style="font-size: 14px;line-height:1.5em;width: 100%;word-wrap: break-word;word-break: break-all;">
<div class="activity-item underline-evreycontent" style="font-size: 14px;line-height:1.5em;width: 100%;word-wrap: break-word;word-break: break-all;margin-top: 10px;">
<div class="activity-avatar" style="float: left; margin:3px; height: 100%;">
<%= image_tag(url_to_avatar(act.author), :class => "avatar") %>
</div>
@ -106,7 +109,9 @@
<%= link_to(h(e.user), user_path(e.user_id)) %>
<%= l(:label_new_activity) %>
</span>
<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
<% unless act.nil? %>
<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
<% end %>
<div class="activity_description info-break" style="font-size: 13px;width: 100%;word-break: break-all;word-wrap: break-word;">
<%= textAreailizable act,:description %>
</div>

View File

@ -1 +0,0 @@
$('#content').html('<%= escape_javascript(render :partial => 'projects/newproject_show') %>');

View File

@ -4,7 +4,7 @@
<% if User.current.logged? %>
<span> <%= toggle_link ("+ 添加标签"), 'put-tag-form', {:focus => 'tags_name'} %> </span>
<% end %>
<div id="put-tag-form" style="display: none">
<div id="put-tag-form" style="display: none;text-align: center">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show",
:complete => '$("#put-tag-form").slideUp();' do |f| %>
@ -14,7 +14,7 @@
:minlength=>Setting.tags_min_length %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<a href="#" onclick='$("#tags_name").parent().submit();' type="button" class="submit f_l"></a>
<a href="#" onclick='$("#tags_name").parent().submit();' type="button" class="submit f_l" style="margin-top: 10px;"></a>
<% end %>
</div>

View File

@ -368,6 +368,7 @@ RedmineApp::Application.routes.draw do
get 'feedback', :action => 'feedback', :as => 'project_feedback'
get 'watcherlist', :action=> 'watcherlist'
get 'invite_members', :action=> 'invite_members'
match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #add by huang
get 'homework', :action => 'homework', :as => 'homework'
get 'new_homework', :action => 'new_homework', :as => 'new_homework'

View File

@ -102,7 +102,7 @@ a:hover.more{ color:#64bdd9;}
.btn_free{ background:#ff5722; display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;}
.btn_free:hover{ background:#d63502;}
/*成员邀请*/
.invi_search{ width:230px; margin:0 auto;}
.invi_search{ width:295px; margin:0 auto;}
.invi_search_input{ border:1px solid #15bccf; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:10px;}
.invi_search_btn{ background:#15bccf; color:#fff; text-align: center; width:40px; height:22px;border:1px solid #15bccf; padding-top:2px; cursor:pointer;}
.invi_search_btn:hover{ background:#0da1b2; border:1px solid #0da1b2;}