Merge branch 'dev_hjq' of http://git.trustie.net/jacknudt/trustieforge into dev_hjq
This commit is contained in:
commit
ec42e71c70
|
@ -186,7 +186,7 @@ class FilesController < ApplicationController
|
|||
@order = ""
|
||||
@is_remote = false
|
||||
if params[:project_id]
|
||||
@isproject = true
|
||||
@container_type = 0
|
||||
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
|
@ -246,7 +246,7 @@ class FilesController < ApplicationController
|
|||
format.js
|
||||
end
|
||||
elsif params[:course_id]
|
||||
@isproject = false
|
||||
@container_type = 1
|
||||
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
|
@ -297,6 +297,9 @@ class FilesController < ApplicationController
|
|||
@tag_list = attachment_tag_list @all_attachments
|
||||
|
||||
render :layout => 'base_courses'
|
||||
elsif params[:org_subfield_id]
|
||||
@container_type = 2
|
||||
# @subfield = params[:org_subfield_id]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -11,10 +11,17 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
@org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id)
|
||||
@org_document_comment.title = params[:org_document_comment][:title]
|
||||
@org_document_comment.content = params[:org_document_comment][:content]
|
||||
if params[:field_id]
|
||||
@org_document_comment.org_subfield_id = params[:field_id].to_i
|
||||
end
|
||||
if @org_document_comment.save
|
||||
flash.keep[:notice] = l(:notice_successful_create)
|
||||
EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at)
|
||||
redirect_to organization_org_document_comments_path(@organization)
|
||||
if params[:field_id]
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
else
|
||||
redirect_to organization_org_document_comments_path(@organization)
|
||||
end
|
||||
else
|
||||
redirect_to new_org_document_comment_path(:organization_id => @organization.id)
|
||||
end
|
||||
|
@ -46,7 +53,7 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
if params[:flag].to_i == 1
|
||||
redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id)
|
||||
else
|
||||
redirect_to organization_path(@org_document.organization.id)
|
||||
redirect_to organization_path(@org_document.organization.id, :org_subfield_id => params[:org_subfield_id])
|
||||
end
|
||||
end
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class OrgSubfieldsController < ApplicationController
|
|||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
@subfield.update_attributes(:priority => @subfield.id)
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -68,29 +68,35 @@ class OrganizationsController < ApplicationController
|
|||
def show
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@organization = Organization.find(params[:id])
|
||||
project_ids = @organization.projects.map(&:id) << 0
|
||||
course_ids = @organization.courses.map(&:id) << 0
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
case params[:type]
|
||||
when nil
|
||||
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
|
||||
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
|
||||
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
|
||||
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_issue'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'org'
|
||||
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_homework'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_news'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_poll'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
if params[:org_subfield_id]
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
else
|
||||
project_ids = @organization.projects.map(&:id) << 0
|
||||
course_ids = @organization.courses.map(&:id) << 0
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
case params[:type]
|
||||
when nil
|
||||
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
|
||||
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
|
||||
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
|
||||
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_issue'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'org'
|
||||
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_homework'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_news'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_poll'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
end
|
||||
end
|
||||
@page = params[:page]
|
||||
respond_to do |format|
|
||||
|
|
|
@ -346,27 +346,13 @@ update
|
|||
# end
|
||||
|
||||
|
||||
#add by hx
|
||||
if g.commits(@project.gpid , :page=>25).count==0
|
||||
count = count_commits(@project.gpid , 0 , 25)
|
||||
elsif g.commits(@project.gpid , :page=>50).count ==0
|
||||
count = count_commits(@project.gpid , 25 , 50)+ 25 * 20
|
||||
elsif g.commits(@project.gpid , :page=>75).count ==0
|
||||
count = count_commits(@project.gpid , 50 , 75)+ 50 * 20
|
||||
elsif g.commits(@project.gpid , :page=>100).count== 0
|
||||
count = count_commits(@project.gpid , 75 , 100) + 75 * 20
|
||||
elsif g.commits(@project.gpid , :page=>125).count==0
|
||||
count = count_commits(@project.gpid , 100 , 125) + 100 * 20
|
||||
elsif g.commits(@project.gpid , :page=>150).count==0
|
||||
count = count_commits(@project.gpid , 125 , 150) + 125 * 20
|
||||
else
|
||||
count = count_commits(@project.gpid , 150 ,200) + 150 * 20
|
||||
end
|
||||
|
||||
@changesets = g.commits(@project.gpid)
|
||||
|
||||
|
||||
@changesets = g.commits(@project.gpid, :ref_name => @rev)
|
||||
# @changesets = @repository.latest_changesets(@path, @rev)
|
||||
# @changesets_count = @repository.latest_changesets(@path, @rev).count
|
||||
@changesets_all_count = count
|
||||
@changesets_all_count = 0
|
||||
@changesets_latest_coimmit = @changesets[0]
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@repositories = @project.repositories
|
||||
|
@ -409,8 +395,28 @@ update
|
|||
limit = 20
|
||||
#每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
|
||||
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
|
||||
|
||||
#add by hx
|
||||
if g.commits(@project.gpid , :page=>200).count > 0
|
||||
count = 4020
|
||||
elsif g.commits(@project.gpid , :page=>25).count==0
|
||||
count = count_commits(@project.gpid , 0 , 25)
|
||||
elsif g.commits(@project.gpid , :page=>50).count ==0
|
||||
count = count_commits(@project.gpid , 25 , 50)+ 25 * 20
|
||||
elsif g.commits(@project.gpid , :page=>75).count ==0
|
||||
count = count_commits(@project.gpid , 50 , 75)+ 50 * 20
|
||||
elsif g.commits(@project.gpid , :page=>100).count== 0
|
||||
count = count_commits(@project.gpid , 75 , 100) + 75 * 20
|
||||
elsif g.commits(@project.gpid , :page=>125).count==0
|
||||
count = count_commits(@project.gpid , 100 , 125) + 100 * 20
|
||||
elsif g.commits(@project.gpid , :page=>150).count==0
|
||||
count = count_commits(@project.gpid , 125 , 150) + 125 * 20
|
||||
else
|
||||
count = count_commits(@project.gpid , 150 ,200) + 150 * 20
|
||||
end
|
||||
|
||||
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
|
||||
@commits_count = params[:commit_count].to_i
|
||||
@commits_count = count
|
||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
|
||||
|
||||
@commit = g.commit(@project.gpid,@rev)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
class OrgSubfield < ActiveRecord::Base
|
||||
belongs_to :organization, :foreign_key => :organization_id
|
||||
has_many :org_document_comments, :dependent => :destroy
|
||||
end
|
|
@ -226,7 +226,7 @@ class User < Principal
|
|||
validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false
|
||||
validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false
|
||||
# Login must contain letters, numbers, underscores only
|
||||
validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
|
||||
validates_format_of :login, :with => /\A[a-z0-9_\-\.]*\z/i
|
||||
validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
|
||||
validates_length_of :firstname, :maximum => 30
|
||||
validates_length_of :lastname, :maximum => 30
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
//location.reload();
|
||||
window.location.href = '<%= organization_org_document_comments_path(:organization_id => @org_document_comment.root.organization_id)%>'
|
||||
<% if params[:detail_page] %>
|
||||
window.location.href = '<%= organization_org_document_comments_path(:organization_id => @org_document_comment.root.organization_id)%>';
|
||||
<% else %>
|
||||
window.location.reload();
|
||||
<% end %>
|
|
@ -17,7 +17,7 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag),:method => 'put', :id => 'new_org_document_form' do |f| %>
|
||||
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %>
|
||||
<div class="resources">
|
||||
<div>
|
||||
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @org_document.title %>" />
|
||||
|
|
|
@ -1,24 +1,37 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
|
||||
<script>
|
||||
function check_org_title(title)
|
||||
{
|
||||
if($("#document_title").val().trim() == "")
|
||||
{
|
||||
$("#doc_title_hint").html("<span class='c_red'>标题不能为空</span>").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#doc_title_hint").hide();
|
||||
}
|
||||
}
|
||||
function check_org_title()
|
||||
{
|
||||
if($("#document_title").val().trim() == "")
|
||||
{
|
||||
$("#doc_title_hint").html("<span class='c_red'>标题不能为空</span>").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#doc_title_hint").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function create_org_document()
|
||||
{
|
||||
if(check_org_title() == true)
|
||||
{
|
||||
org_document_description_editor.sync();
|
||||
$('#new_org_document_form').submit();
|
||||
}
|
||||
}
|
||||
function cancel_create_org_document(){
|
||||
location.href = document.referrer;
|
||||
}
|
||||
</script>
|
||||
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
|
||||
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %>
|
||||
<div class="resources">
|
||||
<div>
|
||||
<textarea class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" placeholder="请输入文章标题"></textarea>
|
||||
<textarea class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" placeholder="请输入文章标题"></textarea>
|
||||
</div>
|
||||
<div id="doc_title_hint"></div>
|
||||
<div id="org_document_editor" class="mt15" style="display: none">
|
||||
<div id="org_document_editor" class="mt15" >
|
||||
<div class="mt10">
|
||||
<%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
|
||||
</div>
|
||||
|
@ -29,9 +42,9 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="org_document_description_editor.sync();$('#new_org_document_form').submit();">确定</a>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="create_org_document();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" onclick="$('#org_document_editor').hide(); $('#doc_title_hint').hide();" class="fr mr10 mt3">取消</a>
|
||||
<a href="javascript:void(0);" onclick="cancel_create_org_document();" class="fr mr10 mt3">取消</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :method => 'delete',
|
||||
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :detail_page => 1), :method => 'delete',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:remote => true, :class => 'postOptionLink' %>
|
||||
</li>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>");
|
||||
$("#sub_field_left_lists").html("");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#subfield_name").val("");
|
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %>
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2} %>
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2, :org_subfield_id => params[:org_subfield_id]} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'Project' %>
|
||||
|
|
|
@ -25,8 +25,12 @@
|
|||
</div>
|
||||
<% organization.org_subfields.each do |field| %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses_#{field.id}').slideToggle();"><%= field.name %></a>
|
||||
<%=link_to "", :title => "关联#{field.name}"%>
|
||||
<% if field.field_type == "Post" %>
|
||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
||||
<% else %>
|
||||
<%#= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;">
|
||||
</div>
|
||||
|
|
|
@ -11,14 +11,10 @@
|
|||
<ul style="text-align: left;" >
|
||||
<%= radio_button_tag 'org_member[role_ids][]', role.id, member.roles.include?(role) %>
|
||||
<!--编辑时候显示成员,中英文切换后面需从数据库的角度优化-->
|
||||
<% if User.current.language == "zh" %>
|
||||
<% if role.id == 11 %>
|
||||
<label >管理人员</label>
|
||||
<% elsif role.id == 12 %>
|
||||
<label >组织成员</label>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<label ><%= h role %></label>
|
||||
<% if role.id == 11 %>
|
||||
<label >管理人员</label>
|
||||
<% elsif role.id == 12 %>
|
||||
<label >组织成员</label>
|
||||
<% end %>
|
||||
</ul>
|
||||
<!--<br/>-->
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %>
|
||||
TO <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %>
|
||||
|
|
||||
<span style="color:#269ac9;">组织文章</span>
|
||||
<span style="color:#269ac9;"><%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %></span>
|
||||
</div>
|
||||
<div class="homepagePostTitle postGrey"><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></div>
|
||||
<div class="homepagePostDate">
|
||||
|
@ -27,12 +27,12 @@
|
|||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id}, :method => "put", :remote => true) do |f| %>
|
||||
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id, :show_homepage => 1}, :method => "put", :remote => true) do |f| %>
|
||||
<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag), :class => "postOptionLink" %>
|
||||
<%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag, :org_subfield_id => params[:org_subfield_id] ), :class => "postOptionLink" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser fb">已有栏目</li>
|
||||
<li class="orgListRole fb">状态</li>
|
||||
<li class="orgListUser fb">状态</li>
|
||||
<li class="orgListStatus fb">类型</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser">动态</li>
|
||||
<li class="orgListUser">默认</li>
|
||||
<li class="orgListStatus">默认</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser">项目</li>
|
||||
<li class="orgListUser">默认</li>
|
||||
<li class="orgListStatus">默认</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="orgListRow">
|
||||
<li class="orgListUser">课程</li>
|
||||
<li class="orgListUser">默认</li>
|
||||
<li class="orgListStatus">默认</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% subfields.each do |field| %>
|
||||
|
@ -24,6 +28,7 @@
|
|||
<li class="orgListUser"><div id="subfield_show_<%= field.id %>"><%= field.name %></div><div id="subfield_edit_<%= field.id %>" style="display:none;">
|
||||
<input type="text" name="name" onblur="update_subfield('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>','<%= field.id %>',$(this).val());" value="<%= field.name %>" style="width:70px;" /></div></li>
|
||||
<li class="orgListUser">新增</li>
|
||||
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子":"资源" %></li>
|
||||
<%= link_to "删除",org_subfield_path(field), :method => 'delete',:remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr5" %>
|
||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
//location.reload();
|
||||
window.location.href ='<%= organization_path(@org)%>'
|
||||
window.location.href ='<%= organization_path(@org, :show_homepage => params[:show_homepage])%>';
|
|
@ -114,7 +114,18 @@
|
|||
<p class="fontBlue fb mb5">新增栏目</p>
|
||||
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
|
||||
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb20" />
|
||||
<div class="cl"></div>
|
||||
<ul class="orgAddRole">
|
||||
<li class="fontGrey3 fb mb10">栏目类型</li>
|
||||
<li>
|
||||
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
|
||||
<label for="orgMng">帖子</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
|
||||
<label for="orgMeb">资源</label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="saveBtn db fl mt10" onclick="add_org_subfield();">确定</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -14,45 +14,47 @@
|
|||
</style>
|
||||
<% if params[:show_homepage].nil? %>
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">最新动态</div>
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="homepagePostType">
|
||||
<li>
|
||||
<ul class="homepagePostTypeHomework fl">
|
||||
<li class="f14">课程动态</li>
|
||||
<li><%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
|
||||
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
|
||||
<li><%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
|
||||
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
|
||||
<li><%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="homepagePostTypeProject fl">
|
||||
<li class="f14">项目动态</li>
|
||||
<li><%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
|
||||
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
|
||||
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="homepagePostTypeProject fl">
|
||||
<li class="f14">更多</li>
|
||||
<li class="mt-4"><%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
|
||||
<li class="mt-4"><%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
|
||||
<div class="NewsBannerName"><%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %></div>
|
||||
<% if params[:org_subfield_id].nil? %>
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="homepagePostType">
|
||||
<li>
|
||||
<ul class="homepagePostTypeHomework fl">
|
||||
<li class="f14">课程动态</li>
|
||||
<li><%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
|
||||
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
|
||||
<li><%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
|
||||
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
|
||||
<li><%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="homepagePostTypeProject fl">
|
||||
<li class="f14">项目动态</li>
|
||||
<li><%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
|
||||
<li><%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
|
||||
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="homepagePostTypeProject fl">
|
||||
<li class="f14">更多</li>
|
||||
<li class="mt-4"><%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
|
||||
<li class="mt-4"><%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
|
||||
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?",@organization.home_id).first.id %>, null, "87%");
|
||||
|
|
|
@ -52,10 +52,9 @@
|
|||
</span>
|
||||
|
||||
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
|
||||
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project,
|
||||
:repository_id => @repository.identifier_param,
|
||||
:rev => @rev,:page=>1 ,
|
||||
:commit_count =>"#{@changesets_all_count}"} %></font> 提交
|
||||
|
||||
<%=link_to"全部提交次数", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
<li >
|
||||
<span class="tit_fb ">编程代码:</span>
|
||||
<div class="showHworkP break_word">
|
||||
<%= text_format(work.description) if work.description%>
|
||||
<div class="showHworkP break_word"><pre class="fontGrey2 font_cus"><%= text_format(work.description) if work.description%>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddSubfieldToDocument < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :org_document_comments, :org_subfield_id, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddTypeToOrgSubfields < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :org_subfields, :field_type, :string
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class SetTypeForOrgSubfields < ActiveRecord::Migration
|
||||
def up
|
||||
OrgSubfield.all.each do |field|
|
||||
field.update_attribute(:field_type, "Post")
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -969,7 +969,6 @@ ActiveRecord::Schema.define(:version => 20151204062220) do
|
|||
t.integer "course_group_id", :default => 0
|
||||
end
|
||||
|
||||
add_index "members", ["course_id"], :name => "index_members_on_course_id"
|
||||
add_index "members", ["project_id"], :name => "index_members_on_project_id"
|
||||
add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
|
||||
add_index "members", ["user_id"], :name => "index_members_on_user_id"
|
||||
|
@ -1526,6 +1525,7 @@ ActiveRecord::Schema.define(:version => 20151204062220) do
|
|||
end
|
||||
|
||||
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
|
||||
add_index "student_works", ["homework_common_id"], :name => "index"
|
||||
|
||||
create_table "student_works_evaluation_distributions", :force => true do |t|
|
||||
t.integer "student_work_id"
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
require 'trustie/gitlab/sync'
|
||||
|
||||
namespace :gitlab do
|
||||
namespace :check_members do
|
||||
desc "check up projects' members "
|
||||
task :projects => :environment do
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
g = Gitlab.client
|
||||
Project.all.each do |project|
|
||||
unless project.gpid.nil?
|
||||
begin
|
||||
gmembers = g.team_members(project.gpid)
|
||||
if gmembers.count != project.members.count
|
||||
puts "gitlab' projects count #{gmembers.count}"
|
||||
puts "project ID is #{project.id}"
|
||||
s.only_members(project)
|
||||
end
|
||||
rescue
|
||||
p "This project is wrong #{project.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,32 +6,55 @@ namespace :gitlab do
|
|||
users = User.find_by_sql("select * from users where gid is null")
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
g = Gitlab.client
|
||||
logger = Logger.new('./log/add_gid.log', 'daily') #按天生成
|
||||
logger_i = Logger.new('./log/task_add_gid.log', 'daily')
|
||||
logger_e = Logger.new('./log/task_add_gid_error.log', 'daily')
|
||||
NAMESPACE_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'.freeze
|
||||
MAIL_REGEX_STR ='^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$'.freeze
|
||||
error_cnt=0
|
||||
success_cnt=0
|
||||
p "同步Gitlab用户开始..."
|
||||
users.each do |user|
|
||||
info="userid=#{user.id},mail=#{user.mail},login(username)=#{user.login},name=#{user.show_name}"
|
||||
# username不能有特殊字符,不能有保留字符,邮箱特殊字符(比如‘>’)导致search失败的,name不能为空串
|
||||
if !(user.login =~ /\A#{NAMESPACE_REGEX_STR}\Z/.freeze)
|
||||
logger_e.error("#{info},error=校验失败:username特殊字符")
|
||||
error_cnt+=1
|
||||
next
|
||||
elsif !(user.mail.downcase =~ /#{MAIL_REGEX_STR}/)
|
||||
logger_e.error("#{info},error=校验失败:邮箱特殊字符")
|
||||
error_cnt+=1
|
||||
next
|
||||
elsif user.show_name.lstrip.rstrip.blank?
|
||||
logger_e.error("#{info},error=校验失败:name不正常")
|
||||
error_cnt+=1
|
||||
next
|
||||
end
|
||||
begin
|
||||
us = g.get("/users?search=#{user.mail}")
|
||||
puts user.mail
|
||||
if us.blank?
|
||||
puts "55555555555555555"
|
||||
s.sync_user(user)
|
||||
logger_i.info("sync_remote_user:id=#{user.id},mail=#{user.mail}")
|
||||
success_cnt+=1
|
||||
else
|
||||
# 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com
|
||||
puts "66666666666666666666"
|
||||
puts user.id
|
||||
if Array === us
|
||||
us.each do |u|
|
||||
if u.email == user.mail
|
||||
user.gid = u.id
|
||||
user.save
|
||||
# !爆炸方法抛出异常
|
||||
user.save!
|
||||
logger_i.info("sync_local_user:#{info}")
|
||||
success_cnt+=1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue => e
|
||||
logger.error("userid=#{user.id},mail=#{user.mail},login=#{user.login},error=#{e}")
|
||||
logger_e.error("#{info},error=#{e}")
|
||||
puts e
|
||||
end
|
||||
end
|
||||
p "同步Gitlab用户结束..."
|
||||
p "同步成功#{success_cnt},未完成#{error_cnt}"
|
||||
end
|
||||
|
||||
task :sync_members => :environment do
|
||||
|
|
|
@ -4186,6 +4186,7 @@ _extend(KUploadButton, {
|
|||
(options.form ? '</div>' : '</form>'),
|
||||
'</div>'].join('');
|
||||
var div = K(html, button.doc);
|
||||
$(div).hide()// 如果 以后要用根据 http://kindeditor.net/docs/uploadbutton.html#k-uploadbutton-options来使用uploadButton,那么这里的button会 是隐藏的
|
||||
button.hide();
|
||||
button.before(div);
|
||||
self.div = div;
|
||||
|
|
|
@ -68,4 +68,6 @@ a.linkGrey8:hover {color:#585858;}
|
|||
.orgMenuArrow {background:url(../images/nav_icon.png) -10px -165px no-repeat; position:relative; display:inline-block; width:20px; height:30px;}
|
||||
.orgMenuArrow2 {background:url(../images/nav_icon.png) -10px -132px no-repeat; position:relative; display:inline-block; width:20px; height:30px;}
|
||||
.org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;}
|
||||
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
|
||||
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
|
||||
|
||||
.orgListStatus {width:55px; float:left;}
|
|
@ -1063,4 +1063,6 @@ a.homepagePostTypeMessage {
|
|||
a.homepagePostTypeQuiz {
|
||||
background: transparent url("../images/homepage_icon.png") no-repeat scroll -90px -124px;
|
||||
padding-left: 23px;
|
||||
}
|
||||
}
|
||||
|
||||
.loadMore {font-size:14px;width:748px; text-align:center; display:block; border:1px solid #dddddd; background-color:#ffffff; float:right;padding:5px 0; letter-spacing: 1px;}
|
Loading…
Reference in New Issue