Merge branch 'szzh' of https://git.trustie.net/jacknudt/trustieforge into szzh
Conflicts: db/schema.rb public/stylesheets/new_user.css
This commit is contained in:
commit
13e289dfb5
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the subfield_subdomain_dirs controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -53,6 +53,7 @@ class AtController < ApplicationController
|
|||
end
|
||||
|
||||
def find_project(id)
|
||||
return [] if id<0
|
||||
at_persons = Project.find(id).users
|
||||
at_persons.delete_if { |u| u.id == User.current.id }
|
||||
end
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class FilesController < ApplicationController
|
||||
|
||||
layout 'base_projects' #by young
|
||||
layout 'base_projects' #by young
|
||||
|
||||
menu_item :files
|
||||
before_filter :auth_login1, :only => [:index]
|
||||
|
@ -173,6 +172,7 @@ class FilesController < ApplicationController
|
|||
# #render 'stores'
|
||||
# redirect_to search_course_files_url
|
||||
end
|
||||
@page = params[:page] || 1
|
||||
end
|
||||
|
||||
def find_course_attache keywords,course,sort = ""
|
||||
|
@ -381,6 +381,7 @@ class FilesController < ApplicationController
|
|||
@organization = Organization.find(@containers.first.organization_id)
|
||||
show_attachments @containers
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
@page = params[:page] || 1
|
||||
render :layout => 'base_org'
|
||||
# @subfield = params[:org_subfield_id]
|
||||
end
|
||||
|
@ -454,6 +455,11 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
# 更新资源总数, 根据上传的附件数累加
|
||||
unless @project.project_score.nil?
|
||||
@project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count)
|
||||
end
|
||||
# end
|
||||
# TODO: 临时用 nyan
|
||||
sort_init 'created_on', 'desc'
|
||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
|
@ -482,9 +488,6 @@ class FilesController < ApplicationController
|
|||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
# 更新课程英雄榜得分
|
||||
update_contributor_score(@course, attachments[:files].first)
|
||||
# end
|
||||
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
|
||||
params[:course_attachment_type].each do |type|
|
||||
tag_name = get_tag_name_by_type_number type
|
||||
|
@ -506,8 +509,9 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# 更新课程英雄榜得分
|
||||
update_contributor_score(@course, attachments[:files].first)
|
||||
# end
|
||||
# TODO: 临时用 nyan
|
||||
sort_init 'created_on', 'desc'
|
||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
|
@ -828,5 +832,5 @@ class FilesController < ApplicationController
|
|||
|
||||
def upload_files_menu
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,12 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
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)
|
||||
if params[:field_id]
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
@org_subfield = OrgSubfield.find(params[:field_id])
|
||||
if @org_subfield.subfield_subdomain_dir.nil?
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
else
|
||||
redirect_to show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => @org_subfield.subfield_subdomain_dir.name)
|
||||
end
|
||||
else
|
||||
redirect_to organization_org_document_comments_path(@organization)
|
||||
end
|
||||
|
|
|
@ -1,22 +1,90 @@
|
|||
class OrgSubfieldsController < ApplicationController
|
||||
helper :attachments
|
||||
layout 'base_org'
|
||||
def create
|
||||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
|
||||
@res = true
|
||||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
if !params[:sub_dir].blank?
|
||||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
||||
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
||||
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir])
|
||||
end
|
||||
end
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
else
|
||||
@res = false
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@org_subfield = OrgSubfield.find(params[:id])
|
||||
@organization = @org_subfield.organization.id
|
||||
@messages = []
|
||||
@messages << @org_subfield.org_document_comments
|
||||
@messages << @org_subfield.messages
|
||||
@messages.sort{|a, b| b.updated_at <=> a.updated_at}
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_org'}
|
||||
@flag = params[:flag] || false
|
||||
sort = ""
|
||||
@sort = ""
|
||||
@order = ""
|
||||
@is_remote = false
|
||||
@organization = Organization.find(params[:id])
|
||||
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
|
||||
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
|
||||
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first
|
||||
if @org_subfield.field_type == 'Post'
|
||||
@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(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
#redirect_to organization_path(@organization, :org_subfield_id => @org_subfield.id)
|
||||
else
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
order_by = sort_type.split(":")
|
||||
case order_by[0]
|
||||
when "filename"
|
||||
attribute = "filename"
|
||||
when "size"
|
||||
attribute = "filesize"
|
||||
when "attach_type"
|
||||
attribute = "attachtype"
|
||||
when "content_type"
|
||||
attribute = "created_on"
|
||||
when "field_file_dense"
|
||||
attribute = "is_public"
|
||||
when "downloads"
|
||||
attribute = "downloads"
|
||||
when "created_on"
|
||||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
if order_by.count == 1 && attribute
|
||||
sort += "#{Attachment.table_name}.#{attribute} asc "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
elsif order_by.count == 2 && order_by[1]
|
||||
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
@container_type = 2
|
||||
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
|
||||
@organization = Organization.find(@containers.first.organization_id)
|
||||
show_attachments @containers
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
end
|
||||
@page = params[:page] || 1
|
||||
#render :layout => 'base_org'
|
||||
end
|
||||
|
||||
def destroy
|
||||
@subfield = OrgSubfield.find(params[:id])
|
||||
@organization = Organization.find(@subfield.organization_id)
|
||||
|
@ -29,4 +97,43 @@ class OrgSubfieldsController < ApplicationController
|
|||
@subfield.update_attributes(:name => params[:name])
|
||||
end
|
||||
|
||||
def update_sub_dir
|
||||
@org_subfield = OrgSubfield.find(params[:id])
|
||||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
"and org_subfields.organization_id=#{@org_subfield.organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'"
|
||||
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
||||
if @org_subfield.subfield_subdomain_dir
|
||||
@sub_dir = @org_subfield.subfield_subdomain_dir
|
||||
@sub_dir.update_attribute(:name, params[:sub_dir_name])
|
||||
else
|
||||
@sub_dir = SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name])
|
||||
end
|
||||
@exist = false
|
||||
else
|
||||
@exist = true
|
||||
end
|
||||
end
|
||||
|
||||
def show_attachments obj
|
||||
@attachments = []
|
||||
obj.each do |container|
|
||||
@attachments += container.attachments
|
||||
end
|
||||
@all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments)
|
||||
@limit = 10
|
||||
@feedback_count = @all_attachments.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@obj_attachments = paginateHelper @all_attachments,10
|
||||
end
|
||||
|
||||
#获取指定资源列表的TAG的集合以及每个TAG的数量,降序排序
|
||||
def attachment_tag_list attachments
|
||||
tag_list = Hash.new
|
||||
attachments.each do |attachment|
|
||||
attachment.tag_list.map{|tag| tag_list.has_key?(tag) ? tag_list[tag] = tag_list[tag] + 1 : tag_list[tag] = 1}
|
||||
end
|
||||
tag_list.sort {|a,b| b[1]<=>a[1]}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -114,7 +114,7 @@ class OrganizationsController < ApplicationController
|
|||
@organization = Organization.find(params[:id])
|
||||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.domain = params[:organization][:domain]
|
||||
# @organization.domain = params[:organization][:domain]
|
||||
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
||||
#@organization.name = params[:organization][:name]
|
||||
@organization.save
|
||||
|
|
|
@ -203,6 +203,8 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 注意:修改该方法的时候注意同步修改forked方法
|
||||
# forked方法也会创建项目
|
||||
def create
|
||||
unless User.current.login?
|
||||
redirect_to signin_url
|
||||
|
@ -222,6 +224,11 @@ class ProjectsController < ApplicationController
|
|||
#unless User.current.admin?
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
# project's score
|
||||
if ProjectScore.where("project_id=?", @project.id).first.nil?
|
||||
ProjectScore.create(:project_id => @project.id, :score => false)
|
||||
end
|
||||
# end
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
|
@ -512,6 +519,14 @@ class ProjectsController < ApplicationController
|
|||
def edit
|
||||
end
|
||||
|
||||
def set_public_or_private
|
||||
@project = Project.find(params[:id])
|
||||
if @project.is_public?
|
||||
@project.update_attribute(:is_public, 0)
|
||||
else
|
||||
@project.update_attribute(:is_public, 1)
|
||||
end
|
||||
end
|
||||
# by young
|
||||
# include CoursesHelper
|
||||
def member
|
||||
|
|
|
@ -122,6 +122,9 @@ class RepositoriesController < ApplicationController
|
|||
if project.save
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
if ProjectScore.where("project_id=?", @project.id).first.nil?
|
||||
ProjectScore.create(:project_id => @project.id, :score => false)
|
||||
end
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
|
@ -344,20 +347,18 @@ update
|
|||
#Modified by young
|
||||
# (show_error_not_found; return) unless @entries
|
||||
g = Gitlab.client
|
||||
|
||||
# count = 0
|
||||
# (0..100).each do |page|
|
||||
# if g.commits(@project.gpid,:page => page).count == 0
|
||||
# break
|
||||
# else
|
||||
# count = count + g.commits(@project.gpid,:page => page).count
|
||||
# end
|
||||
# end
|
||||
|
||||
@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 = @project.gpid.nil? ? 0 : g.commits_total_count(@project.gpid).count
|
||||
@changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count
|
||||
# 访问该页面的是会后则刷新
|
||||
if @project.project_score.nil?
|
||||
ProjectScore.create(:project_id => @project.id, :score => false)
|
||||
end
|
||||
if @changesets_all_count != @project.project_score.changeset_num && @changesets_all_count != 0
|
||||
update_commits_count(@project, @changesets_all_count)
|
||||
end
|
||||
# end
|
||||
@changesets_latest_coimmit = @changesets[0]
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@repositories = @project.repositories
|
||||
|
@ -583,6 +584,10 @@ update
|
|||
end
|
||||
|
||||
private
|
||||
# 更新项目统计数
|
||||
def update_commits_count project, count
|
||||
project.project_score.update_attribute(:changeset_num, count)
|
||||
end
|
||||
|
||||
def find_repository
|
||||
@repository = Repository.find(params[:id])
|
||||
|
|
|
@ -683,7 +683,7 @@ class StudentWorkController < ApplicationController
|
|||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
@project_ids = Project.where("user_id = #{User.current.id} and name like '#{condition}'")
|
||||
@project_ids = Project.visible.where("user_id = #{User.current.id} and name like '#{condition}'")
|
||||
@first = params[:first].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class SubfieldSubdomainDirsController < ApplicationController
|
||||
def update
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
if @org_subfield.subfield_subdomain_dir
|
||||
@org_subfield.subfield_subdomain_dir.update_attribute(:name, :params[:sub_dir_name])
|
||||
else
|
||||
SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name])
|
||||
end
|
||||
end
|
||||
end
|
|
@ -49,6 +49,12 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
# 获取项目/课程总分
|
||||
# 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分
|
||||
def static_project_score obj
|
||||
score = obj.issue_num * 4 + obj.issue_journal_num + obj.changeset_num * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5
|
||||
end
|
||||
|
||||
# 获取组织成员中文名字
|
||||
def get_org_member_role_name member
|
||||
case member.roles[0].name
|
||||
|
@ -2784,8 +2790,7 @@ int main(int argc, char** argv){
|
|||
#代码提交数量
|
||||
def changesets_num project
|
||||
g = Gitlab.client
|
||||
project.gpid.nil? ? 0 : g.commits_total_count(project.gpid).count
|
||||
# # commits_total_count(project.gpid)
|
||||
project.gpid.nil? ? 0 : g.project(project.gpid).commit_count
|
||||
# project.changesets.count
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
module SubfieldSubdomainDirsHelper
|
||||
end
|
|
@ -90,7 +90,7 @@ class Attachment < ActiveRecord::Base
|
|||
before_save :files_to_final_location,:act_as_course_activity
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
|
||||
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index#, :decrease_attchments_count
|
||||
|
||||
# add by nwb
|
||||
# 获取所有可公开的资源文件列表
|
||||
|
@ -617,6 +617,7 @@ class Attachment < ActiveRecord::Base
|
|||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
|
||||
def update_attachment_ealasticsearch_index
|
||||
if self.is_public == 1 && ( ((self.container_type == 'Project' or self.container_type == 'Version') && Project.find(self.container_id).is_public == 1) ||
|
||||
( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
|
||||
|
@ -632,12 +633,20 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_attachment_ealasticsearch_index
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
end
|
||||
end
|
||||
|
||||
# def decrease_attchments_count
|
||||
# if self.container_type == "Project"
|
||||
# count = self.container.attachments_count
|
||||
# #self.container.update_attribute(:attachments_count, self.container.attachments_count - 1)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
# Delete the previous articles index in Elasticsearch
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require 'elasticsearch/model'
|
||||
class Course < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include ApplicationHelper
|
||||
|
||||
STATUS_ACTIVE = 1
|
||||
STATUS_CLOSED = 5
|
||||
|
|
|
@ -19,6 +19,7 @@ class Issue < ActiveRecord::Base
|
|||
include Redmine::SafeAttributes
|
||||
include Redmine::Utils::DateCalculation
|
||||
include UserScoreHelper
|
||||
include ApplicationHelper
|
||||
belongs_to :project,:touch=> true
|
||||
belongs_to :tracker
|
||||
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
|
||||
|
@ -83,9 +84,9 @@ class Issue < ActiveRecord::Base
|
|||
attr_reader :current_journal
|
||||
|
||||
# fq
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message, :add_issues_count
|
||||
after_update :be_user_score,:update_activity
|
||||
after_destroy :down_user_score
|
||||
after_destroy :down_user_score, :decrease_issues_count
|
||||
# after_create :be_user_score
|
||||
# end
|
||||
|
||||
|
@ -132,7 +133,7 @@ class Issue < ActiveRecord::Base
|
|||
update_forge_activity(self.class, self.id)
|
||||
update_org_activity(self.class, self.id)
|
||||
end
|
||||
|
||||
|
||||
# fq
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
|
@ -171,6 +172,22 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 创建issue的时候,issues_count加1
|
||||
def add_issues_count
|
||||
unless self.project.project_score.nil?
|
||||
issue_count = self.project.project_score.issue_num + 1
|
||||
self.project.project_score.update_attribute(:issue_num, issue_count)
|
||||
end
|
||||
end
|
||||
|
||||
# 删除issue的时候,issues_count减1
|
||||
def decrease_issues_count
|
||||
unless self.project.project_score.nil?
|
||||
issue_count = self.project.project_score.issue_num - 1
|
||||
self.project.project_score.update_attribute(:issue_num, issue_count)
|
||||
end
|
||||
end
|
||||
|
||||
# 更新缺陷
|
||||
#def act_as_forge_message_update
|
||||
# unless self.author_id == self.assigned_to_id
|
||||
|
|
|
@ -48,14 +48,14 @@ class Journal < ActiveRecord::Base
|
|||
:conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
|
||||
"(#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
|
||||
|
||||
before_create :split_private_notes
|
||||
before_create :split_private_notes, :add_journals_count
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
|
||||
# end
|
||||
#after_destroy :down_user_score
|
||||
#before_save :be_user_score
|
||||
after_destroy :down_user_score
|
||||
after_destroy :down_user_score, :decrease_issues_journal_count
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
user = args.shift || User.current
|
||||
|
@ -214,4 +214,20 @@ class Journal < ActiveRecord::Base
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
# 减少留言数量统计
|
||||
def decrease_issues_journal_count
|
||||
unless self.issue.project.nil?
|
||||
project = self.issue.project
|
||||
project.update_attribute(:journals_count, project.journals_count - 1)
|
||||
end
|
||||
end
|
||||
|
||||
# issue留言总数更新
|
||||
def add_journals_count
|
||||
if !self.issue.project.nil? && self.journalized_type == "Issue" && self.issue.project.project_score.nil?
|
||||
project = self.issue.project
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.journals_count + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,6 @@ class Message < ActiveRecord::Base
|
|||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
has_many :user_acts, :class_name => 'UserActivity',:as =>:user_act ,:dependent => :destroy
|
||||
|
||||
# end
|
||||
# 课程/项目 消息
|
||||
|
@ -76,9 +75,9 @@ class Message < ActiveRecord::Base
|
|||
validates_length_of :subject, :maximum => 255
|
||||
validate :cannot_reply_to_locked_topic, :on => :create
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!
|
||||
after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
|
||||
after_update :update_messages_board, :update_activity
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count
|
||||
|
||||
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message
|
||||
#before_save :be_user_score
|
||||
|
@ -127,6 +126,38 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 发帖精辟更新发帖总数
|
||||
def add_boards_count
|
||||
unless self.project.project_score.nil?
|
||||
if self.project
|
||||
# 讨论区
|
||||
if self.parent_id.nil?
|
||||
count = self.project.project_score.board_num + 1
|
||||
self.project.project_score.update_attribute(:board_num, count)
|
||||
else # 回复
|
||||
count = self.project.project_score.board_message_num + 1
|
||||
self.project.project_score.update_attribute(:board_message_num, count)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
|
||||
def decrease_boards_count
|
||||
unless self.project.project_score.nil?
|
||||
if self.project && self.parent_id.nil?
|
||||
# 讨论区
|
||||
if self.parent_id.nil?
|
||||
count = self.project.project_score.board_num - 1
|
||||
self.project.project_score.update_attribute(:board_num, count)
|
||||
else # 回复
|
||||
count = self.project.project_score.board_message_num - 1
|
||||
self.project.project_score.update_attribute(:board_message_num, count)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def reset_counters!
|
||||
if parent && parent.id
|
||||
Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
|
||||
|
|
|
@ -55,9 +55,9 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail
|
||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count
|
||||
after_update :update_activity
|
||||
after_destroy :delete_kindeditor_assets
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
|
||||
|
@ -115,10 +115,24 @@ class News < ActiveRecord::Base
|
|||
end
|
||||
|
||||
private
|
||||
def add_news_count
|
||||
if self.project && !self.project.project_score.nil?
|
||||
count = self.project.project_score.news_num + 1
|
||||
self.project.project_score.update_attribute(:news_num, count)
|
||||
end
|
||||
end
|
||||
|
||||
def decrease_news_count
|
||||
if self.project && !self.project.project_score.nil?
|
||||
count = self.project.project_score.news_num - 1
|
||||
self.project.project_score.update_attribute(:news_num, count)
|
||||
end
|
||||
end
|
||||
|
||||
def add_author_as_watcher
|
||||
Watcher.create(:watchable => self, :user => author)
|
||||
end
|
||||
|
||||
## fq
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class OrgDocumentComment < ActiveRecord::Base
|
||||
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title,:sticky,:locked
|
||||
include Redmine::SafeAttributes
|
||||
include ApplicationHelper
|
||||
belongs_to :organization
|
||||
belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
|
||||
has_many :editor_of_documents, :dependent => :destroy
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class OrgSubfield < ActiveRecord::Base
|
||||
belongs_to :organization, :foreign_key => :organization_id
|
||||
has_one :subfield_subdomain_dir,:dependent => :destroy
|
||||
has_many :org_document_comments, :dependent => :destroy
|
||||
has_many :files
|
||||
has_many :org_subfield_messages, :dependent => :destroy
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
class Poll < ActiveRecord::Base
|
||||
#attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
include ApplicationHelper
|
||||
|
||||
belongs_to :user
|
||||
has_many :poll_questions, :dependent => :destroy,:order => "#{PollQuestion.table_name}.question_number"
|
||||
has_many :poll_users, :dependent => :destroy
|
||||
|
|
|
@ -1223,6 +1223,7 @@ class Project < ActiveRecord::Base
|
|||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
|
||||
def update_project_ealasticsearch_index
|
||||
if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
|
||||
begin
|
||||
|
@ -1238,11 +1239,11 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_project_ealasticsearch_index
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
class SubfieldSubdomainDir < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
belongs_to :org_subfield
|
||||
end
|
|
@ -409,7 +409,7 @@ class User < Principal
|
|||
|
||||
def get_at_show_name
|
||||
name = show_name
|
||||
name = "#{name} #{self.login}" if name != self.login
|
||||
(name != self.login) ? "#{name} #{self.login}" : name
|
||||
end
|
||||
|
||||
#added by nie
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
<div class="loginContent">
|
||||
<div class="loginLeft">
|
||||
<div class="loginLogo"><img src="images/trustie_big_log.png" width="100" height="88" alt="Trustie Logo" /></div>
|
||||
<div class="loginInro"> 欢迎加入Trustie高校创新实践社区!老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。<br/><br/> Trustie是在中国推行大规模开放在线研究模式(MOORE)的支撑平台。</div>
|
||||
<div class="loginInro"> 欢迎加入Trustie创新实践社区!在这里,您的创新意识和创新潜力将得到充分发挥!目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。<br/><br/> Trustie社区的理想是:让创新过程变的更美好!</div>
|
||||
</div>
|
||||
<div class="loginRight">
|
||||
<div id="loginInBox">
|
||||
|
|
|
@ -26,12 +26,21 @@
|
|||
) if User.current && User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_set_homepage),
|
||||
{:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% if activity.id == activity.blog.homepage_id %>
|
||||
<%= link_to(
|
||||
l(:button_cancel_homepage),
|
||||
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
l(:button_set_homepage),
|
||||
{:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -43,11 +43,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<% if blog.homepage_id and BlogComment.where("id=?", blog.homepage_id).count > 0 %>
|
||||
<% homepage = BlogComment.find(blog.homepage_id) %>
|
||||
<%= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.logged? && User.current.id == @user.id %>
|
||||
<%= labelled_form_for @article, :url =>{:controller=>'blog_comments',:action => 'create',:user_id=>user.id , :blog_id => blog.id},
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</div>
|
||||
<%end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostTitle hidden m_w530 fl">
|
||||
<div class="homepagePostTitle hidden m_w530">
|
||||
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id,
|
||||
:blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey", :style => 'text-align:center;' %>
|
||||
</div>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
|
||||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
$("#project_info_<%=@course.id %>").html('<%=escape_javascript(render :partial=>'layouts/project_info') %>');
|
||||
if(document.getElementById("course_is_public")) {
|
||||
<% if @course.is_public == 0%>
|
||||
$("#course_is_public").attr("checked",false);
|
||||
<% elsif @course.is_public == 1 %>
|
||||
$("#course_is_public").attr("checked",true);
|
||||
<% if params[:user_page].nil? %>
|
||||
$("#project_info_<%=@course.id %>").html('<%=escape_javascript(render :partial=>'layouts/project_info') %>');
|
||||
if(document.getElementById("course_is_public")) {
|
||||
<% if @course.is_public == 0%>
|
||||
$("#course_is_public").attr("checked",false);
|
||||
<% elsif @course.is_public == 1 %>
|
||||
$("#course_is_public").attr("checked",true);
|
||||
<% end %>
|
||||
}
|
||||
<% else %>
|
||||
<% if @course.is_public? %>
|
||||
$("#set_course_public_<%= @course.id %>").text("设为私有");
|
||||
<% else %>
|
||||
$("#set_course_public_<%= @course.id %>").text("设为公开");
|
||||
<% end %>
|
||||
}
|
||||
<% end %>
|
|
@ -1,59 +1,77 @@
|
|||
<% delete_allowed = User.current.admin? %>
|
||||
<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">
|
||||
<% if order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="files_tag" id="files_tag">
|
||||
<%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="for_img_thumbnails">
|
||||
<% org_subfield_attachments.each do |file| %>
|
||||
<% if 1 %>
|
||||
<div class="re_con_box" id="container_files_<%= file.id %>">
|
||||
<div class="">
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(file.id, file.filename),
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||
<% org_subfield_attachments.each do |file| %>
|
||||
<div class="resources mt10" id="container_files_<%= file.id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTitle break_word mt-4">
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(file.id, file.filename),
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||
<%= file_preview_eye(file, class: 'preview') %>
|
||||
<span id="image_private_<%= file.id%>">
|
||||
<% if file.is_public? == false%>
|
||||
<span class="img_private ml5">私有</span>
|
||||
<%end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_date(file.created_on)%></span>
|
||||
<% if file.tag_list.length > 0%>
|
||||
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
|
||||
<% end %>
|
||||
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<% if !@org_subfield.attachments.all.include?file %>
|
||||
<%= link_to("选入栏目",quote_resource_show_org_subfield_org_subfield_file_path(:org_subfield_id => @org_subfield.id, :id => file.id),:class => "f_l re_select c_lorange",:remote => true) %>
|
||||
<% elsif @org_subfield.organization.org_subfields.where("field_type='Resource'").count > 1 %>
|
||||
<%= link_to("选入组织其他栏目",quote_resource_show_org_subfield_org_subfield_file_path(:org_subfield_id => @org_subfield.id, :id => file.id),:class => "f_l re_select c_lorange",:remote => true) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<li>
|
||||
<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=>"postOptionLink",:method => :post %>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
|
||||
</li>
|
||||
</ul>
|
||||
<%else%>
|
||||
<ul class="resourceSendO">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div><!---re_con_box end-->
|
||||
<% end %>
|
||||
|
||||
<% if org_subfield_attachments.count == 10 %>
|
||||
<% if params[:action] == 'search_files_in_subfield' %>
|
||||
<%=link_to "点击展开更多", search_files_in_subfield_org_subfield_files_path(:org_subfield_id => org_subfield.id,:page => @page.to_i + 1, :name => params[:name],:insite => params[:insite]),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<% else %>
|
||||
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
|
||||
<%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%end%>
|
||||
<% end%>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= stylesheet_link_tag 'courses' %>
|
||||
<%= stylesheet_link_tag 'courses'%>
|
||||
<script>
|
||||
function searchone4reload(fileid){
|
||||
var url = "<%= searchone4reload_org_subfield_files_path(@org_subfield)%>";
|
||||
|
@ -11,87 +11,75 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
function show_upload(obj)
|
||||
{
|
||||
switch(obj)
|
||||
{
|
||||
// case 1:
|
||||
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>');
|
||||
// break;
|
||||
case 2:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 2}) %>');
|
||||
break;
|
||||
case 3:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 3}) %>');
|
||||
break;
|
||||
case 4:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 4}) %>');
|
||||
break;
|
||||
// case 6:
|
||||
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>');
|
||||
// break;
|
||||
default:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 5}) %>');
|
||||
}
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function closeModal()
|
||||
{
|
||||
hideModal($("#popbox_upload"));
|
||||
}
|
||||
|
||||
function presscss(id)
|
||||
{
|
||||
if(id == "inorg_subfield")
|
||||
{
|
||||
$('#inorg_subfield').attr("class", "re_schbtn b_dblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_dblue");
|
||||
}
|
||||
}
|
||||
function buttoncss()
|
||||
{
|
||||
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="resources"><!--资源库内容开始--->
|
||||
<div class="re_top" style="width:710px;">
|
||||
<%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<div class="homepageRight mt0 ml0">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName"><%= org_subfield.name %></div>
|
||||
<ul class="resourcesSelect">
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','','<%= @q%>','<%= org_subfield.id%>');" class="resourcesTypeAll resourcesGrey">全部</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','软件','<%= @q%>','<%= org_subfield.id%>');" class="softwareIcon postTypeGrey">软件</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','媒体','<%= @q%>','<%= org_subfield.id%>');" class="mediaIcon resourcesGrey">媒体</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','代码','<%= @q%>','<%= org_subfield.id%>');" class="codeIcon resourcesGrey">代码</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield,:other=>true)%>','其他','<%= @q%>','<%= org_subfield.id%>');" class="othersIcon resourcesGrey">其它</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="resources mt10" style="padding-bottom:5px;">
|
||||
<div class="reTop mb5">
|
||||
<%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "栏目内搜索", :class => "blueBtn mr5 fl",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="org_upload_files(<%= org_subfield.id %>);">
|
||||
<%#= link_to "上传资源",subfield_upload_file_org_subfield_files_path(@org_subfield.id, :in_org => 1),:method => "post",:class=>"blueBtn fr mr5",:remote => true %>
|
||||
<% end %>
|
||||
<%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> <!-- show_window('light','fade','20%','35%')-->
|
||||
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||
<p class="c_grey fr mt10 mr5">
|
||||
上传:
|
||||
<!--<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a> | -->
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a> |
|
||||
<!--<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a> | -->
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
|
||||
</p>
|
||||
<%# end %>
|
||||
</div><!---re_top end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="reCon" id="org_subfield_list">
|
||||
<%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
|
||||
</div><!---re_con end-->
|
||||
|
||||
<div>
|
||||
<div class="re_con_top">
|
||||
<div class="files_tag" id="files_tag">
|
||||
<%#= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count %></span> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if @order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="org_subfield_list">
|
||||
<%= render :partial => 'files/org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
|
||||
</div><!---re_con end-->
|
||||
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
||||
<script>
|
||||
function org_upload_files(org_subfield_id){
|
||||
$.ajax({
|
||||
url :"/org_subfields/" + org_subfield_id + "/files/subfield_upload_file",
|
||||
type :'post'
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -7,16 +7,12 @@
|
|||
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
|
||||
|
||||
<%= form_tag(org_subfield_files_path(org_subfield, :in_org => params[:in_org]), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
|
||||
<% if params[:in_org] %>
|
||||
<div class="c_dark">
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="2" checked class="c_dblue">软件</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="3" class="c_dblue">媒体</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="4" class="c_dblue">代码</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="5" class="c_dblue">其他</input></a>
|
||||
</div>
|
||||
<% else %>
|
||||
<input type="hidden" name="org_subfield_attachment_type" value="<%= org_subfield_attachment_type %>">
|
||||
<% end %>
|
||||
<div class="c_dark">
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="2" checked class="c_dblue">软件</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="3" class="c_dblue">媒体</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="4" class="c_dblue">代码</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="5" class="c_dblue">其他</input></a>
|
||||
</div>
|
||||
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
|
||||
<%= render :partial => 'files/org_subfield_upload_attachment_list', :locals => {:container => org_subfield}%>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -2,4 +2,6 @@
|
|||
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
|
||||
<% elsif @project %>
|
||||
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/project_list', :locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments})%>");
|
||||
<% elsif @org_subfield %>
|
||||
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/org_subfield_list', :locals => {org_subfield:@org_subfield, all_attachments:@all_attachments, sort:@sort, order:@order, org_subfield_attachments:@obj_attachments})%>");
|
||||
<%end %>
|
|
@ -1,2 +1,8 @@
|
|||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list',
|
||||
:locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
|
||||
<% if (@obj_pages &&( @obj_pages.page > 1)) || (@feedback_pages && (@feedback_pages.page > 1)) %>
|
||||
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/org_subfield_list',
|
||||
:locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach} )%>");
|
||||
<% else %>
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list',
|
||||
:locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>");
|
||||
$("#attachment_count").html("<%= @result.count %>");
|
||||
<% end %>
|
|
@ -2,25 +2,25 @@
|
|||
<%# pro = Project.find course.course_id %>
|
||||
<li class="homepageLeftMenuCoursesLine" style="position:relative;">
|
||||
<%= link_to course.name, course_path(course.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => course.name%>
|
||||
<div class="homepagePostSetting mt5 mr10">
|
||||
<ul>
|
||||
<li class="menuSetting">
|
||||
<ul class="homepagePostSettiongText boxShadow">
|
||||
<li><%= link_to "发布作业", homework_common_index_path(:course => course.id,:is_new => 1), :class => 'postOptionLink' %></li>
|
||||
<li><%= link_to "发布通知", new_course_news_path(course), :class => 'postOptionLink' %></li>
|
||||
<li><%= link_to "上传资源",upload_files_menu_path(:course_id => course.id), :remote => true, :class => 'postOptionLink' %></li>
|
||||
<li><%= link_to "发布新帖",course_boards_path( course, :flag => true, :is_new => 1), :class => 'postOptionLink' %></li>
|
||||
<li>
|
||||
<% if ShieldActivity.where("container_type='Organization' and container_id=#{org_id} and shield_type='Course' and shield_id=#{course.id}").count == 0 %>
|
||||
<%= link_to "屏蔽动态", shield_activities_path(:org_id => org_id, :course_id => course.id), :method => 'post',:class => 'postOptionLink',:remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "显示动态", show_acts_shield_activities_path(:org_id => org_id, :course_id => course.id), :method => 'delete',:class => 'postOptionLink',:remote => true %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<div class="homepagePostSetting mt5 mr10">-->
|
||||
<!--<ul>-->
|
||||
<!--<li class="menuSetting">-->
|
||||
<!--<ul class="homepagePostSettiongText boxShadow">-->
|
||||
<!--<li><%#= link_to "发布作业", homework_common_index_path(:course => course.id,:is_new => 1), :class => 'postOptionLink' %></li>-->
|
||||
<!--<li><%#= link_to "发布通知", new_course_news_path(course), :class => 'postOptionLink' %></li>-->
|
||||
<!--<li><%#= link_to "上传资源",upload_files_menu_path(:course_id => course.id), :remote => true, :class => 'postOptionLink' %></li>-->
|
||||
<!--<li><%#= link_to "发布新帖",course_boards_path( course, :flag => true, :is_new => 1), :class => 'postOptionLink' %></li>-->
|
||||
<!--<li>-->
|
||||
<!--<%# if ShieldActivity.where("container_type='Organization' and container_id=#{org_id} and shield_type='Course' and shield_id=#{course.id}").count == 0 %>-->
|
||||
<!--<%#= link_to "屏蔽动态", shield_activities_path(:org_id => org_id, :course_id => course.id), :method => 'post',:class => 'postOptionLink',:remote => true %>-->
|
||||
<!--<%# else %>-->
|
||||
<!--<#%= link_to "显示动态", show_acts_shield_activities_path(:org_id => org_id, :course_id => course.id), :method => 'delete',:class => 'postOptionLink',:remote => true %>-->
|
||||
<!--<%# end %>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
</li>
|
||||
<% end %>
|
||||
<% if courses.size == 5%>
|
||||
|
|
|
@ -2,24 +2,24 @@
|
|||
<%# pro = Project.find project.project_id %>
|
||||
<li class="homepageLeftMenuCoursesLine" style="position:relative;">
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => project.name%>
|
||||
<div class="homepagePostSetting mt5 mr10">
|
||||
<ul>
|
||||
<li class="menuSetting">
|
||||
<ul class="homepagePostSettiongText boxShadow">
|
||||
<li><%=link_to "发布问题", new_project_issue_path(project), :class => 'postOptionLink', :target => '_blank' %></li>
|
||||
<li><%=link_to "发布新帖",project_boards_path(project, :flag => true), :class => 'postOptionLink',:target => '_blank' %></li>
|
||||
<li><%= link_to "上传资源",upload_files_menu_path(:project_id => project.id), :remote => true, :class => 'postOptionLink' %></li>
|
||||
<li>
|
||||
<% if ShieldActivity.where("container_type='Organization' and container_id=#{org_id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
|
||||
<%= link_to "屏蔽动态", shield_activities_path(:org_id => org_id, :project_id => project.id), :method => 'post',:class => 'postOptionLink',:remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "显示动态", show_acts_shield_activities_path(:org_id => org_id, :project_id => project.id),:method => 'delete',:class => 'postOptionLink',:remote => true %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<div class="homepagePostSetting mt5 mr10">-->
|
||||
<!--<ul>-->
|
||||
<!--<li class="menuSetting">-->
|
||||
<!--<ul class="homepagePostSettiongText boxShadow">-->
|
||||
<!--<li><%#=link_to "发布问题", new_project_issue_path(project), :class => 'postOptionLink', :target => '_blank' %></li>-->
|
||||
<!--<li><%#=link_to "发布新帖",project_boards_path(project, :flag => true), :class => 'postOptionLink',:target => '_blank' %></li>-->
|
||||
<!--<li><%#= link_to "上传资源",upload_files_menu_path(:project_id => project.id), :remote => true, :class => 'postOptionLink' %></li>-->
|
||||
<!--<li>-->
|
||||
<!--<%# if ShieldActivity.where("container_type='Organization' and container_id=#{org_id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>-->
|
||||
<!--<#%= link_to "屏蔽动态", shield_activities_path(:org_id => org_id, :project_id => project.id), :method => 'post',:class => 'postOptionLink',:remote => true %>-->
|
||||
<!--<%# else %>-->
|
||||
<!--<%#= link_to "显示动态", show_acts_shield_activities_path(:org_id => org_id, :project_id => project.id),:method => 'delete',:class => 'postOptionLink',:remote => true %>-->
|
||||
<!--<%# end %>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
</li>
|
||||
<% end %>
|
||||
<% if projects.size == 5%>
|
||||
|
|
|
@ -1,92 +1,99 @@
|
|||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
|
||||
<% teacher_num = searchTeacherAndAssistant(@course).count %>
|
||||
<% student_num = studentCount(@course) %>
|
||||
<% course_file_num = visable_attachemnts_incourse(@course).count%>
|
||||
<div class="pr_info_logo fl mr10 mb5">
|
||||
<!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>-->
|
||||
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
|
||||
</div>
|
||||
<div class="pr_info_id fl mb5 f14"><%= @course.is_public == 0 ? "私有课程" : "公开课程" %></div>
|
||||
<div class="pr_info_id fl f14">
|
||||
ID:<%= @course.id%>
|
||||
</div>
|
||||
<!--<div class="pr_info_id fl mb5 f14">
|
||||
ID:<%#= @course.id%>
|
||||
</div>
|
||||
<div class="pr_info_join fl">
|
||||
<%# if is_teacher%>
|
||||
<%#= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
|
||||
<%#= set_course_time @course%>
|
||||
<%#= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
|
||||
<%# else%>
|
||||
<div id="join_in_course_header"><%#= join_in_course_header(@course, User.current) %></div>
|
||||
<%# end%>
|
||||
</div>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<div >-->
|
||||
<!--<a class="pr_info_name fl c_dark fb break_word" href="http://<%#= Setting.host_course%>/courses/<%#= @course.id%>" target="_blank">-->
|
||||
<!--<%#= @course.name %>-->
|
||||
<!--</a>-->
|
||||
<!--<%# if @course.is_public == 0%>-->
|
||||
<!--<span class="img_private ">-->
|
||||
<!--<%#= l(:field_is_private)%>-->
|
||||
<!--</span>-->
|
||||
<!--<%# end %>-->
|
||||
<!--<%#if @course.tea_id == User.current.id && @course.outline == 0 %>-->
|
||||
<!--<span>-->
|
||||
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
|
||||
<!--</span>-->
|
||||
<!--<%# else%>-->
|
||||
<!--<span>-->
|
||||
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
|
||||
<!--</span>-->
|
||||
<!--<%# end %>-->
|
||||
<!--</div>-->
|
||||
<div >
|
||||
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
|
||||
<div>
|
||||
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
|
||||
<%= @course.name %>
|
||||
</a>
|
||||
<%# if @course.is_public == 0%>
|
||||
<!--<span class="img_private "></span>-->
|
||||
<!--<span class="img_private mr5 fl">
|
||||
<%#= l(:field_is_private)%>
|
||||
</span>-->
|
||||
<%# end %>
|
||||
<span id="course_outline_bar">
|
||||
<%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
|
||||
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
|
||||
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
|
||||
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%>
|
||||
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%>
|
||||
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||
<%else%>
|
||||
<%end %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="pr_info_foot ">
|
||||
<%= l(:label_account_identity_teacher)%>(<%= course_teacher_link teacher_num %>)
|
||||
<span>| </span>
|
||||
<%= l(:label_account_identity_student)%>(<%= course_student_link student_num %>)
|
||||
<span>| </span>
|
||||
<%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %>)</div>
|
||||
<div class="cl"></div>
|
||||
<% if is_teacher %>
|
||||
<div class="homepagePostSetting mt5 mr5">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText boxShadow">
|
||||
<li><%= link_to "课程配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
|
||||
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
|
||||
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
|
||||
<% teacher_num = searchTeacherAndAssistant(@course).count %>
|
||||
<% student_num = studentCount(@course) %>
|
||||
<% course_file_num = visable_attachemnts_incourse(@course).count%>
|
||||
<div class="pr_info_logo fl mr10 mb5">
|
||||
<% if @course.id == 370 %>
|
||||
<img src="/images/course/boutique.png" width="50" height="auto" alt="精品" class="boutiqueP" />
|
||||
<% end %>
|
||||
<!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>-->
|
||||
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
|
||||
</div>
|
||||
<div class="pr_info_id fl mb5 f14"><%= @course.is_public == 0 ? "私有课程" : "公开课程" %>
|
||||
<% if @course.id == 370 %>
|
||||
<img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" class="ml5" />
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="pr_info_id fl f14">
|
||||
ID:<%= @course.id%>
|
||||
</div>
|
||||
<!--<div class="pr_info_id fl mb5 f14">
|
||||
ID:<%#= @course.id%>
|
||||
</div>
|
||||
<div class="pr_info_join fl">
|
||||
<%# if is_teacher%>
|
||||
<%#= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
|
||||
<%#= set_course_time @course%>
|
||||
<%#= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
|
||||
<%# else%>
|
||||
<div id="join_in_course_header"><%#= join_in_course_header(@course, User.current) %></div>
|
||||
<%# end%>
|
||||
</div>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<div >-->
|
||||
<!--<a class="pr_info_name fl c_dark fb break_word" href="http://<%#= Setting.host_course%>/courses/<%#= @course.id%>" target="_blank">-->
|
||||
<!--<%#= @course.name %>-->
|
||||
<!--</a>-->
|
||||
<!--<%# if @course.is_public == 0%>-->
|
||||
<!--<span class="img_private ">-->
|
||||
<!--<%#= l(:field_is_private)%>-->
|
||||
<!--</span>-->
|
||||
<!--<%# end %>-->
|
||||
<!--<%#if @course.tea_id == User.current.id && @course.outline == 0 %>-->
|
||||
<!--<span>-->
|
||||
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
|
||||
<!--</span>-->
|
||||
<!--<%# else%>-->
|
||||
<!--<span>-->
|
||||
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
|
||||
<!--</span>-->
|
||||
<!--<%# end %>-->
|
||||
<!--</div>-->
|
||||
<div >
|
||||
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
|
||||
<div>
|
||||
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
|
||||
<%= @course.name %>
|
||||
</a>
|
||||
<%# if @course.is_public == 0%>
|
||||
<!--<span class="img_private "></span>-->
|
||||
<!--<span class="img_private mr5 fl">
|
||||
<%#= l(:field_is_private)%>
|
||||
</span>-->
|
||||
<%# end %>
|
||||
<span id="course_outline_bar">
|
||||
<%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
|
||||
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
|
||||
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
|
||||
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%>
|
||||
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%>
|
||||
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
|
||||
<%else%>
|
||||
<%end %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="pr_info_foot ">
|
||||
<%= l(:label_account_identity_teacher)%>(<%= course_teacher_link teacher_num %>)
|
||||
<span>| </span>
|
||||
<%= l(:label_account_identity_student)%>(<%= course_student_link student_num %>)
|
||||
<span>| </span>
|
||||
<%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %>)</div>
|
||||
<div class="cl"></div>
|
||||
<% if is_teacher %>
|
||||
<div class="homepagePostSetting mt5 mr5">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText boxShadow">
|
||||
<li><%= link_to "课程配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
|
||||
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
|
||||
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,25 +1,69 @@
|
|||
<% courses.each do |course|%>
|
||||
<li class="homepageLeftMenuCoursesLine pr">
|
||||
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}", :title => course.name+"("+course.time.to_s+course.term+")"%>
|
||||
<div class="homepagePostSetting mt8 mr10">
|
||||
<ul>
|
||||
<li class="menuSetting">
|
||||
<ul class="homepagePostSettiongText boxShadow">
|
||||
<li><%= link_to "发布作业", homework_common_index_path(:course => course.id,:is_new => 1), :class => 'postOptionLink' %></li>
|
||||
<li><%= link_to "发布通知", new_course_news_path(course), :class => 'postOptionLink' %></li>
|
||||
<li><%= link_to "上传资源",upload_files_menu_path(:course_id => course.id), :remote => true, :class => 'postOptionLink' %></li>
|
||||
<li><%= link_to "发布新帖",course_boards_path( course, :flag => true, :is_new => 1), :class => 'postOptionLink' %></li>
|
||||
<li>
|
||||
<% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count == 0 %>
|
||||
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post',:class => 'postOptionLink',:remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :course_id => course.id),:method => 'delete',:class => 'postOptionLink',:remote => true %>
|
||||
<% end %>
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||||
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
|
||||
:title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+course.time.to_s+course.term+")"%>
|
||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
||||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||||
<li>
|
||||
<ul class="subNavMenu boxShadow">
|
||||
<% if is_teacher %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to "作业",homework_common_index_path(:course => course.id), :class => 'fl fontGrey2 w48', :target => '_blank' %>
|
||||
<%= link_to '+',homework_common_index_path(:course => course.id,:is_new => 1), :class => 'fr fb', :title => '发布作业',:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="subNavRow">
|
||||
<%= link_to "通知", course_news_index_path(course), :class => 'fl w48',:target => '_blank' %>
|
||||
<%= link_to "+", new_course_news_path(course,:is_new=>1), :class => 'fr fb', :title => '发布通知',:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to "作业",homework_common_index_path(:course => course.id), :target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="subNavRow">
|
||||
<%= link_to "通知", course_news_index_path(course),:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if is_teacher || (course.publish_resource == 1 && User.current.member_of_course?(course)) %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to "资源",course_files_path(course), :class => 'fl w48',:target => '_blank' %>
|
||||
<%= link_to "+",upload_files_menu_path(:course_id => course.id), :class => 'fr fb',:remote => true, :title => '上传资源' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to "资源",course_files_path(course),:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to "论坛",course_boards_path(course), :class => 'fl w48',:target => '_blank' %>
|
||||
<%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'fr fb', :title => '发布帖子',:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% if User.current == @user %>
|
||||
<li class="subNavRow">
|
||||
<% if count == 0 %>
|
||||
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post',:remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :course_id => course.id),:remote => true,:method => 'delete' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => course,:user_page => true},
|
||||
:id => "set_course_public_#{course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(course.is_public == 0 ? "公开" : "私有")+"吗"%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -1,24 +1,51 @@
|
|||
<% projects.each do |project|%>
|
||||
<li class="homepageLeftMenuCoursesLine pr">
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => project.name%>
|
||||
<div class="homepagePostSetting mt8 mr10">
|
||||
<ul>
|
||||
<li class="menuSetting">
|
||||
<ul class="homepagePostSettiongText boxShadow">
|
||||
<li><%=link_to "发布问题", new_project_issue_path(project), :class => 'postOptionLink', :target => '_blank' %></li>
|
||||
<li><%=link_to "发布新帖",project_boards_path(project, :flag => true), :class => 'postOptionLink',:target => '_blank' %></li>
|
||||
<li><%= link_to "上传资源",upload_files_menu_path(:project_id => project.id), :remote => true, :class => 'postOptionLink' %></li>
|
||||
<li>
|
||||
<% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
|
||||
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:class => 'postOptionLink',:remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:class => 'postOptionLink',:remote => true %>
|
||||
<% end %>
|
||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %>
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||||
<li>
|
||||
<ul class="subNavMenu boxShadow">
|
||||
<li class="subNavRow">
|
||||
<%=link_to "问题跟踪", project_issues_path(project), :class => 'fl fontGrey2', :target => '_blank',:style => "width:48px;" %>
|
||||
<%=link_to "+", new_project_issue_path(project), :class => 'fr fb', :target => '_blank',:style => "width:48px;", :title => '发布问题',:style =>'width:10px;' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="subNavRow">
|
||||
<%=link_to "资源", project_files_path(project),:class => 'fl fontGrey2 w48' %>
|
||||
<%=link_to "+", upload_files_menu_path(:project_id => project.id),:remote => true,:class => 'fr fb',:title => '上传资源'%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="subNavRow">
|
||||
<%=link_to "论坛", project_boards_path(project),:class => 'fl fontGrey2 w48', :target => '_blank'%>
|
||||
<%=link_to "+", project_boards_path(project, :flag => true),:class => 'fr fb', :target => '_blank',:title => '发布帖子'%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, project)) && rep_is_gitlab?(project) %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to '版本库', url_for(:controller => 'projects', :action => 'settings', :id => project.id, :tab=>'repositories') , :target => '_blank',:class => "fl w48",:title => '版本库' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if User.current == @user %>
|
||||
<li class="subNavRow">
|
||||
<% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
|
||||
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:remote => true %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if User.current.logged? && (User.current.admin? || is_project_manager?(User.current,project)) %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to project.is_public? ? "设为私有" : "设为公开", {:controller => 'projects', :action => 'set_public_or_private', :id => project.id,:user_page => true},
|
||||
:id => 'set_project_public_'+ project.id.to_s,:method => 'post',:remote=>true,:confirm=>"您确定要设置为"+(project.is_public? ? "私有" : "公开")+"吗"%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if projects.size == 5%>
|
||||
|
|
|
@ -76,12 +76,13 @@
|
|||
<div class="cl"></div>
|
||||
<div>
|
||||
<% if @project.project_type == 0 %>
|
||||
<% unless project_scores(@project) == 0 %>
|
||||
<% unless static_project_score(@project.project_score) == 0 %>
|
||||
<span class="fb f14 "><%= l(:label_project_score)%> :</span>
|
||||
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
|
||||
:action => 'show_projects_score',
|
||||
:remote => true,
|
||||
:id => @project.id}, :class => "c_orange f14" ) %>
|
||||
<%= link_to(format("%.2f" ,static_project_score(@project.project_score)).to_i,
|
||||
{:controller => 'projects',
|
||||
:action => 'show_projects_score',
|
||||
:remote => true,
|
||||
:id => @project.id}, :class => "c_orange f14" ) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -91,12 +92,11 @@
|
|||
<%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue', :id => 'project_members_number' %>)
|
||||
<span>| </span>
|
||||
<%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>)
|
||||
<% attaments_num = @project.attachments.count %>
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<span>| </span>
|
||||
<%= l(:project_module_attachments) %>(
|
||||
<% attaments_num %>
|
||||
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue', :id=>'project_files_count_info' %></span>)
|
||||
<% @project.project_score.attach_num %>
|
||||
<%= link_to "#{@project.project_score.attach_num }", project_files_path(@project), :class => 'info_foot_num c_blue', :id=>'project_files_count_info' %></span>)
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -120,11 +120,11 @@
|
|||
|
||||
<div id="project_memu_list">
|
||||
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
|
||||
<%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||
<%= render :partial => 'projects/development_group', :locals => {:project => @project} %>
|
||||
<% elsif @project.project_new_type == 2 %>
|
||||
<%= render :partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||
<%= render :partial => 'projects/research_team', :locals => {:project => @project} %>
|
||||
<% else %>
|
||||
<%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||
<%= render :partial => 'projects/friend_group', :locals => {:project => @project} %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
@ -213,19 +213,19 @@
|
|||
if(data == 1)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group', :locals => {:project => @project})) %>');
|
||||
$("#close_light").attr("onClick","close_window('development_group');");
|
||||
}
|
||||
else if(data == 2)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team', :locals => {:project => @project})) %>');
|
||||
$("#close_light").attr("onClick","close_window('research_group');");
|
||||
}
|
||||
else if(data == 3)
|
||||
{
|
||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>");
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group', :locals => {:project => @project})) %>');
|
||||
$("#close_light").attr("onClick","close_window('friend_organization');");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -52,15 +52,25 @@
|
|||
})
|
||||
$(".coursesLineGrey").mouseout(function(){
|
||||
$(this).css("color","#808080");
|
||||
})
|
||||
$(".homepagePostSetting,.coursesLineGrey").mouseover(function(){
|
||||
$(this).prev().css("color","#ffffff");
|
||||
$(this).css("z-index", "9999");
|
||||
})
|
||||
$(".homepagePostSetting").mouseout(function(){
|
||||
$(this).prev().css("color","#808080");
|
||||
$(this).css("z-index", "1");
|
||||
})
|
||||
});
|
||||
|
||||
//侧导航栏配置设置
|
||||
$(".homepageLeftMenuCoursesLine").mouseover(function(){
|
||||
$(this).children(".shild").css("background","url(/images/hwork_icon.png) -82px -399px no-repeat");
|
||||
$(this).children().css("color","#ffffff");
|
||||
});
|
||||
$(".homepageLeftMenuCoursesLine").mouseout(function(){
|
||||
$(this).children(".shild").css("background","url(/images/hwork_icon.png) -6px -354px no-repeat");
|
||||
$(this).children().css("color","#808080");
|
||||
});
|
||||
$(".subNavRow").mouseover(function(){
|
||||
$(this).css("background-color","#269ac9");
|
||||
$(this).children().css("color","#ffffff");
|
||||
});
|
||||
$(".subNavRow").mouseout(function(){
|
||||
$(this).css("background-color","#ffffff");
|
||||
$(this).children().css("color","#888888");
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
|
@ -94,7 +104,7 @@
|
|||
<% end%>
|
||||
</div>
|
||||
<div class="fl ml10">
|
||||
<p class="homepageImageName hidden db mb5">
|
||||
<p class="homepageImageName hidden db mb5" style="margin-left:0px;margin-right:0px;">
|
||||
<%= @user.realname.blank? ? @user.login : @user.realname %>
|
||||
</p>
|
||||
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
|
||||
|
@ -165,7 +175,7 @@
|
|||
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<div class="courseMenu" id="courseMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon" id="courseMenuIcon">
|
||||
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
|
||||
<ul class="topnav_course_menu" id="topnav_course_menu">
|
||||
<li>
|
||||
<%= link_to "新建课程", new_course_path(:host=> Setting.host_course), :class => "menuGrey"%>
|
||||
|
@ -179,7 +189,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
<% else%>
|
||||
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:remote => true, :title => "加入课程"%>
|
||||
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入课程"%>
|
||||
<% end%>
|
||||
<% end%>
|
||||
</div>
|
||||
|
@ -193,7 +203,7 @@
|
|||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuForge').slideToggle();">项目</a>
|
||||
|
||||
<% if is_current_user%>
|
||||
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :title => "新建项目"%>
|
||||
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%>
|
||||
<% end%>
|
||||
</div>
|
||||
<% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#relateProject,.relatePInfo").mouseover(function(){
|
||||
$(".relatePInfo").css("display","block");
|
||||
})
|
||||
$("#relateProject,.relatePInfo").mouseout(function(){
|
||||
$(".relatePInfo").css("display","none");
|
||||
})
|
||||
$(".homepagePostPortrait").mouseover(function(){
|
||||
$(this).children(".userCard").css("display","block");
|
||||
})
|
||||
$(".homepagePostPortrait").mouseout(function(){
|
||||
$(this).children(".userCard").css("display","none");
|
||||
})
|
||||
$(".userCard").mouseover(function(){
|
||||
$(this).css("display","block");
|
||||
})
|
||||
$(".userCard").mouseout(function(){
|
||||
$(this).css("display","none");
|
||||
})
|
||||
$(".coursesLineGrey").mouseover(function(){
|
||||
$(this).css("color","#ffffff");
|
||||
})
|
||||
$(".coursesLineGrey").mouseout(function(){
|
||||
$(this).css("color","#808080");
|
||||
})
|
||||
$(".homepagePostSetting,.coursesLineGrey").mouseover(function(){
|
||||
$(this).prev().css("color","#ffffff");
|
||||
$(this).css("z-index", "9999");
|
||||
})
|
||||
$(".homepagePostSetting").mouseout(function(){
|
||||
$(this).prev().css("color","#808080");
|
||||
$(this).css("z-index", "1");
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<% unless org_activities.nil? %>
|
||||
<% org_activities.each do |act| %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= act.id%>, null, "87%", "<%=act.class.to_s%>");
|
||||
});
|
||||
</script>
|
||||
<% if act.container_type == 'Organization' %>
|
||||
<% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %>
|
||||
<%= render :partial => 'organizations/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' %>
|
||||
<% case act.org_act_type.to_s %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'organizations/project_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'Course' %>
|
||||
<% case act.org_act_type.to_s %>
|
||||
<% when 'Message'%>
|
||||
<%= render :partial => 'organizations/org_course_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'OrgSubfield' %>
|
||||
<% if act.org_act_type == 'Message' and act.org_act_id and Message.where("id=#{act.org_act_id}").count > 0 %>
|
||||
<% message = Message.find(act.org_act_id) %>
|
||||
<% if !message.board.course_id.nil? %>
|
||||
<%= render :partial => 'organizations/org_course_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
|
||||
<% elsif message.board.project_id != -1 %>
|
||||
<%= render :partial => 'organizations/project_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
|
||||
<% elsif message.board.org_subfield_id %>
|
||||
<%= render :partial => 'organizations/org_subfield_message', :locals => {:activity => message, :user_activity_id => act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if org_act_count == 10 %>
|
||||
<%= link_to "点击展开更多",show_org_subfield_organization_path(:id => @organization.id,:page => @page.to_i + 1,:sub_dir_name => params[:sub_dir_name]),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
||||
<% end%>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<%= javascript_include_tag "jquery.infinitescroll.js" %>
|
||||
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
|
||||
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-outline {border: none;}
|
||||
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||
</style>
|
||||
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName"><%= @org_subfield.name %></div>
|
||||
</div>
|
||||
|
||||
<% if @org_activities %>
|
||||
<%= render :partial => 'org_subfields/show_details',
|
||||
:locals => {:org_activities => @org_activities,
|
||||
:page=> @page,
|
||||
:org => @organization,
|
||||
:org_act_count=> @org_activities.count} %>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
|
||||
:locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
||||
:subfields => @organization.org_subfields.where("field_type != 'default'") }) %>");
|
||||
$("#sub_field_left_lists").html("");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#subfield_name").val("");
|
||||
<% if @res %>
|
||||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
|
||||
:locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
||||
:subfields => @organization.org_subfields.where("field_type != 'default'") }) %>");
|
||||
$("#sub_field_left_lists").html("");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#subfield_name").val("");
|
||||
<% else %>
|
||||
$("#subfield_name").val("");
|
||||
<% end %>
|
|
@ -0,0 +1,525 @@
|
|||
<% if @org_subfield.field_type == 'Resource' %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => 'org_subfields/show_post_type'%>
|
||||
<% end %>
|
||||
|
||||
<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_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 org_id_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
$(".orgDirection").text(orgDirection + sendText);
|
||||
}
|
||||
function subfield_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
var sendColumn = $("input[name='subfield']:checked").next().text();
|
||||
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
});
|
||||
|
||||
}
|
||||
function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) {
|
||||
$('#'+fieldId).each(function() {
|
||||
var $this = $(this);
|
||||
$this.addClass('autocomplete');
|
||||
$this.attr('data-value-was', $this.val());
|
||||
var check = function() {
|
||||
var val = $this.val();
|
||||
if ($this.attr('data-value-was') != val){
|
||||
$this.attr('data-value-was', val);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
data: {search: $this.val(),send_id:send_id,send_ids:send_ids},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $this.addClass('ajax-loading'); },
|
||||
complete: function(){ $this.removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
};
|
||||
var reset = function() {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
timer = setInterval(check, 300);
|
||||
}
|
||||
};
|
||||
var timer = setInterval(check, 300);
|
||||
$this.bind('keyup click mousemove', reset);
|
||||
});
|
||||
}
|
||||
function check_des(event){
|
||||
if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址组织不能为空')
|
||||
return false;
|
||||
}else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址栏目不能为空')
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
<% if User.current.logged? %>
|
||||
var sendType = '1';
|
||||
var lastSendType ;//初始为发送到我的课程
|
||||
function show_send(id){
|
||||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if(lastSendType == '1'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if( lastSendType == '3'){//组织
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//id 发送的id
|
||||
//发送的id数组
|
||||
function chooseSendType(res_id,res_ids){
|
||||
|
||||
sendType = $(".resourcesSendType").val();
|
||||
if (sendType === lastSendType) {
|
||||
return;
|
||||
} else if(lastSendType != null) { //不是第一次点击的时候
|
||||
if (sendType == '1') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
} else if(sendType == '2') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}else if(sendType == '3'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
lastSendType = sendType;
|
||||
}
|
||||
<% end %>
|
||||
<% if @course %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
var parentCssBorder; //当前双击的链接的父节点
|
||||
var ele; //当前双击的链接
|
||||
var tagId; //标签的id
|
||||
var taggableType; //被标签的类型
|
||||
//这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
|
||||
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
|
||||
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况
|
||||
function rename_tag(domEle,name,id,type){
|
||||
if(String(id) != '' || '<%=User.current.allowed_to?(:as_teacher,@course)%>' == 'true' ) { //如果有id ,或者是老师就都能编辑,否则,没有id,不是老师就不能编辑
|
||||
isdb = true; //这是双击
|
||||
//clearTimeout(clickFunction);
|
||||
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
tagNameHtml = domEle.parent().html()
|
||||
tagName = name;
|
||||
parentCssBorder = domEle.parent().css("border");
|
||||
ele = domEle;
|
||||
tagId = id;
|
||||
taggableType = type;
|
||||
width = parseInt(domEle.css('width').replace('px', '')) >= 100 ? parseInt(domEle.css('width').replace('px', '')) : 100
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="120" minlength="1" style="width:' + width + 'px;" value="' + name + '"/>');
|
||||
domEle.parent().css("border", "1px solid #ffffff");
|
||||
$("#renameTagName").focus();
|
||||
}
|
||||
}
|
||||
//监听所有的单击事件
|
||||
$(function(){
|
||||
$("#renameTagName").live("blur",function(){
|
||||
updateTagName();
|
||||
}).live("keypress",function(e){
|
||||
if (e.keyCode == '13') {
|
||||
updateTagName();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//执行修改TAGName方法
|
||||
function updateTagName(){
|
||||
if(isdb){
|
||||
isdb = false;
|
||||
if($("#renameTagName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= update_tag_name_path %>',
|
||||
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// $(document.body).click(function(e){
|
||||
// isdb = false; //这是单击
|
||||
// node = document.elementFromPoint(e.clientX, e.clientY);
|
||||
// if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了
|
||||
// isdb = true; //为了防止在编辑的时候又去单击其他tag去过滤。导致tag过滤不可用
|
||||
// return;
|
||||
// }
|
||||
// if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
|
||||
// if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
|
||||
// ele.parent().css("border","");
|
||||
// ele.parent().html(tagNameHtml);
|
||||
//
|
||||
// }else{ //否则就要更新tag名称了
|
||||
//// if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ 去掉询问
|
||||
// $.post(
|
||||
// '<%#= update_tag_name_path %>',
|
||||
// {"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%#= @course.id%>}
|
||||
// )
|
||||
//// }else{
|
||||
//// ele.parent().css("border","");
|
||||
//// ele.parent().html(tagNameHtml);
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
<%end %>
|
||||
|
||||
<% if @project %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
var parentCssBorder; //当前双击的链接的父节点
|
||||
var ele; //当前双击的链接
|
||||
var tagId; //标签的id
|
||||
var taggableType; //被标签的类型
|
||||
//这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
|
||||
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
|
||||
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况
|
||||
function rename_tag(domEle,name,id,type){
|
||||
if(String(id) != '' || '<%=is_project_manager?(User.current.id, @project.id)%>' == 'true' ) { //如果有id ,或者是老师就都能编辑,否则,没有id,不是老师就不能编辑
|
||||
isdb = true; //这是双击
|
||||
//clearTimeout(clickFunction);
|
||||
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
tagNameHtml = domEle.parent().html()
|
||||
tagName = name;
|
||||
parentCssBorder = domEle.parent().css("border");
|
||||
ele = domEle;
|
||||
tagId = id;
|
||||
taggableType = type;
|
||||
width = parseInt(domEle.css('width').replace('px', '')) >= 100 ? parseInt(domEle.css('width').replace('px', '')) : 100
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="120" minlength="1" style="width:' + width + 'px;" value="' + name + '"/>');
|
||||
domEle.parent().css("border", "1px solid #ffffff");
|
||||
$("#renameTagName").focus();
|
||||
}
|
||||
}
|
||||
//监听所有的单击事件
|
||||
$(function(){
|
||||
$("#renameTagName").live("blur",function(){
|
||||
updateTagName();
|
||||
}).live("keypress",function(e){
|
||||
if (e.keyCode == '13') {
|
||||
updateTagName();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//执行修改TAGName方法
|
||||
function updateTagName(){
|
||||
if(isdb){
|
||||
isdb = false;
|
||||
if($("#renameTagName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= update_project_tag_name_path %>',
|
||||
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"projectId":<%= @project.id %>}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
<%end %>
|
||||
|
||||
<% if @org_subfield %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
var parentCssBorder; //当前双击的链接的父节点
|
||||
var ele; //当前双击的链接
|
||||
var tagId; //标签的id
|
||||
var taggableType; //被标签的类型
|
||||
//这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
|
||||
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
|
||||
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况
|
||||
function rename_tag(domEle,name,id,type){
|
||||
if(1) {
|
||||
isdb = true; //这是双击
|
||||
//clearTimeout(clickFunction);
|
||||
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
tagNameHtml = domEle.parent().html()
|
||||
tagName = name;
|
||||
parentCssBorder = domEle.parent().css("border");
|
||||
ele = domEle;
|
||||
tagId = id;
|
||||
taggableType = type;
|
||||
width = parseInt(domEle.css('width').replace('px', '')) >= 100 ? parseInt(domEle.css('width').replace('px', '')) : 100
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="120" minlength="1" style="width:' + width + 'px;" value="' + name + '"/>');
|
||||
domEle.parent().css("border", "1px solid #ffffff");
|
||||
$("#renameTagName").focus();
|
||||
}
|
||||
}
|
||||
//监听所有的单击事件
|
||||
$(function(){
|
||||
$("#renameTagName").live("blur",function(){
|
||||
updateTagName();
|
||||
}).live("keypress",function(e){
|
||||
if (e.keyCode == '13') {
|
||||
updateTagName();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//执行修改TAGName方法
|
||||
function updateTagName(){
|
||||
if(isdb){
|
||||
isdb = false;
|
||||
if($("#renameTagName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= tags_update_org_subfield_tag_name_path %>',
|
||||
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"org_subfield_id":<%= @org_subfield.id %>}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
<%end %>
|
||||
|
||||
function show_attachments_history(){
|
||||
|
||||
}
|
||||
|
||||
//更新文件版本 表单提交确认,原则是只能有一个更新文件
|
||||
function upload_attachment_version(event){
|
||||
if($("#upload_form").find('.upload_filename').length > 1){
|
||||
$("#upload_file_count").html('(只能上传一个更新文件)')
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}else if($("#upload_form").find('.upload_filename').length == 0){
|
||||
$("#upload_file_count").html('(请上传一个更新文件)')
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}else{
|
||||
$("#upload_form").submit();
|
||||
}
|
||||
}
|
||||
|
||||
</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>
|
|
@ -0,0 +1,5 @@
|
|||
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'org_subfields/show_details',
|
||||
:locals => {:org_activities =>@org_activities,
|
||||
:page=>@page,
|
||||
:org => @organization,
|
||||
:org_act_count=>@org_activities.count} )%>");
|
|
@ -0,0 +1,11 @@
|
|||
<% if @exist == false %>
|
||||
$('#sub_dir_show_<%= @org_subfield.id %>').html('<%= @sub_dir.name %>');
|
||||
$('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @sub_dir.name %>');
|
||||
// $('#sub_dir_show_<%= @org_subfield.id %>').show();
|
||||
// $('#sub_dir_edit_<%= @org_subfield.id %>').hide();
|
||||
<% else %>
|
||||
$('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @org_subfield.subfield_subdomain_dir.nil? ? '': @org_subfield.subfield_subdomain_dir.name %>');
|
||||
// alert("该目录已存在,请重新输入");
|
||||
// $('#sub_dir_edit_<%#= @org_subfield.id %>').find('input').val('<%#= @org_subfield.subfield_subdomain_dir.nil? ? "未设置":@org_subfield.subfield_subdomain_dir.name %>');
|
||||
// $('#sub_dir_edit_<%#= @org_subfield.id %>').focus();
|
||||
<% end %>
|
|
@ -173,7 +173,7 @@
|
|||
<% time=project.updated_on %>
|
||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||
<p><%=time_from_now time %></p>
|
||||
<p><%=time_from_now time %> <%= project.commits_count %>提交</p>
|
||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
|
||||
项目名称:<%=project.name %><br />
|
||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||
|
|
|
@ -70,12 +70,20 @@
|
|||
<% organization.org_subfields.where("field_type != 'default'").each do |field| %>
|
||||
<div class="homepageLeftMenuBlock" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
|
||||
<% if field.field_type == "Post" %>
|
||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||
<% if !field.subfield_subdomain_dir.nil? %>
|
||||
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
|
||||
<% else %>
|
||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||
<% end %>
|
||||
<% if User.current.member_of_org?organization %>
|
||||
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
|
||||
<% if !field.subfield_subdomain_dir.nil? %>
|
||||
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
|
||||
<% else %>
|
||||
<%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
|
||||
<% end %>
|
||||
<% if User.current.member_of_org?organization %>
|
||||
<%= link_to "", subfield_upload_file_org_subfield_files_path(field.id, :in_org => 1),:method => "post", :remote => true, :class => "homepageMenuSetting fr", :title => "上传资源" %>
|
||||
<!--<a class="homepageMenuSetting fr" title="上传资源" href="javascript:void(0);" onclick="org_subfield_files_upload(<%#= field.id %>);"> </a>-->
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
创建时间:<%= format_time(project.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
|
||||
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<li class="orgListUser fb">已有栏目</li>
|
||||
<li class="orgListStatus fb">状态</li>
|
||||
<li class="orgListStatus fb">类型</li>
|
||||
<li class="orgListUser fb">域名目录</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
|
||||
|
@ -26,6 +27,12 @@
|
|||
</li>
|
||||
<li class="orgListStatus">新增</li>
|
||||
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
|
||||
<li class="orgListUser hidden">
|
||||
<div id="sub_dir_show_<%= field.id %>" ondblclick="edit_dir('#sub_dir_show_<%= field.id %>','#sub_dir_edit_<%= field.id %>');"><%= field.subfield_subdomain_dir.nil? ? '未设置': field.subfield_subdomain_dir.name %></div>
|
||||
<div id="sub_dir_edit_<%= field.id %>" style="display:none;">
|
||||
<input type="text" name="name" onblur="update_sub_dir('#sub_dir_show_<%= field.id %>','#sub_dir_edit_<%= field.id %>','<%= field.id %>',$(this).val());" value="<%= field.subfield_subdomain_dir.nil? ? '': field.subfield_subdomain_dir.name %>" style="width:70px;"/>
|
||||
</div>
|
||||
</li>
|
||||
<%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
|
||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
|
||||
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
|
||||
|
@ -59,6 +66,28 @@
|
|||
// $(edit_id).focus();
|
||||
}
|
||||
|
||||
function edit_dir(show_id, edit_id){
|
||||
$(show_id).toggle();
|
||||
$(edit_id).toggle();
|
||||
$(edit_id).find('input').focus();
|
||||
$(edit_id).find('input').on('keypress', function(e){
|
||||
if (e.keyCode == 13){
|
||||
this.blur();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function update_sub_dir(show_id, edit_id, field_id, input_value) {
|
||||
if ($(show_id).html().trim() != input_value.trim() && input_value.trim() != '') {
|
||||
if (confirm('确定修改为' + input_value + "?"))
|
||||
$.ajax({
|
||||
url: "/org_subfields/" + field_id + "/update_sub_dir?sub_dir_name=" + input_value,
|
||||
type: 'put'
|
||||
});
|
||||
}
|
||||
$(show_id).show();
|
||||
$(edit_id).hide();
|
||||
}
|
||||
function hide(content, id){
|
||||
if (content.text() == '设为隐藏')
|
||||
$.ajax({
|
||||
|
@ -71,4 +100,4 @@
|
|||
type: "post"
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -111,23 +111,33 @@
|
|||
:subfields => @organization.org_subfields.where("field_type != 'default'") } %>
|
||||
</div>
|
||||
<div class="fr orgMemContainer">
|
||||
<div class="orgMemberAdd">
|
||||
<div class="fr">
|
||||
<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" />
|
||||
<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>
|
||||
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb10" />
|
||||
<div class="mb5">
|
||||
<p class="fontGrey3"><span class="fb">域名目录</span>(用户自定义url,可选)</p>
|
||||
<% if @organization.domain %>
|
||||
<span class="fl"><%= @organization.domain %>.trustie.net/</span><input class="fl personalUrl ml3" type="text" name="sub_dir">
|
||||
<% else %>
|
||||
<span class="fl">您还没有子域名,请先在左侧信息栏申请子域名</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<ul class="orgAddRole">
|
||||
<li class="fontGrey3 fb mb10">栏目类型</li>
|
||||
<li class="fl mr15">
|
||||
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
|
||||
<label for="orgMng">帖子</label>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
|
||||
<label for="orgMeb">资源</label>
|
||||
</li>
|
||||
<li class="cl"></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="saveBtn db fl mt10" onclick="add_org_subfield();">确定</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
</div>
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
|
||||
<% if (issue_count = @project.issues.count) > 0 %>
|
||||
<a class="subnav_num">(<%= issue_count %>)</a>
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project, :remote => true), :class => "f14 c_blue02" %>
|
||||
<% if @project.project_score.issue_num > 0 %>
|
||||
<a class="subnav_num">(<%= @project.project_score.issue_num %>)</a>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.member_of?(@project) %>
|
||||
|
@ -19,8 +19,8 @@
|
|||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% unless @project.project_score.board_num == 0 %>
|
||||
<a class="subnav_num">(<%= @project.project_score.board_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
|
@ -30,8 +30,8 @@
|
|||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
|
||||
<% unless @project.project_score.attach_num == 0 %>
|
||||
<%= link_to "(#{@project.project_score.attach_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%#= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% unless @project.project_score.board_num == 0 %>
|
||||
<a class="subnav_num">(<%= @project.project_score.board_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
|
@ -18,8 +18,8 @@
|
|||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
|
||||
<% unless @project.project_score.attach_num == 0 %>
|
||||
<%= link_to "(#{@project.project_score.attach_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
|
|
|
@ -18,9 +18,13 @@
|
|||
<div class="homepagePostTitle break_word" >
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
|
||||
</div>
|
||||
<div class="homepagePostDate">
|
||||
<div class="homepagePostDate fl">
|
||||
创建时间:<%= format_time(project.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<!-- added by bai -->
|
||||
|
||||
<div style="color: #64BDD9;font-size: 14px;font-weight: bold"><%= l(:label_projects_score) %></div>
|
||||
<div> = <%= l(:label_issue_score) %> + <%= l(:label_news_score) %> + <%= l(:label_file_score) %> +
|
||||
<%= l(:label_code_submit_score) %> + <%= l(:label_topic_score) %></div>
|
||||
<div> = <%= format("%.2f" , issue_score(project)).to_i %> + <%= format("%.2f" , news_score(project)).to_i %> +
|
||||
<%= format("%.2f" , documents_score(project)).to_i %> + <%= format("%.2f" , changesets_score(project)).to_i %> +
|
||||
<%= format("%.2f" , board_message_score(project)).to_i %></div>
|
||||
<div> = <%= format("%.2f" , project_scores(project)).to_i %></div>
|
||||
<!-- end -->
|
||||
<div> = <%= l(:label_code_submit_score) %> + <%= l(:label_issue_score) %> + <%= l(:label_file_attachment_score) %> + <%= l(:label_topic_score) %> + <%= l(:label_news_score) %></div>
|
||||
<div> = <%= @project.project_score.changeset_num * 4 %> +
|
||||
<%= @project.project_score.issue_num * 4 + @project.project_score.issue_journal_num %> +
|
||||
<%= @project.project_score.attach_num * 5 %> +
|
||||
<%= @project.project_score.board_num * 2 + @project.project_score.board_message_num %> +
|
||||
<%= @project.project_score.news_num %>
|
||||
</div>
|
||||
<div> = <%= static_project_score(@project.project_score) %></div>
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
|
||||
<% if (issue_count = @project.issues.count) > 0 %>
|
||||
<a class="subnav_num">(<%= issue_count %>)</a>
|
||||
<% if @project.project_score.issue_num > 0 %>
|
||||
<a class="subnav_num">(<%= @project.project_score.issue_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
|
||||
|
@ -18,8 +18,8 @@
|
|||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless @project.boards.first.topics.count == 0 %>
|
||||
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
|
||||
<% unless @project.project_score.board_num == 0 %>
|
||||
<a class="subnav_num">(<%= @project.project_score.board_num %>)</a>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
|
||||
|
@ -29,8 +29,8 @@
|
|||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
|
||||
<% unless attaments_num == 0 %>
|
||||
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
|
||||
<% unless @project.project_score.attach_num == 0 %>
|
||||
<%= link_to "(#{@project.project_score.attach_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
|
||||
<% end %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<!-- added by bai -->
|
||||
|
||||
<h3 class="title"><%= l(:label_projects_score) %></h3>
|
||||
<div class="inf_user_image">
|
||||
<table style="border-bottom: solid 1px #80a6d2;" width="100%">
|
||||
|
@ -14,72 +12,35 @@
|
|||
<td width="35%">
|
||||
<table>
|
||||
<tr class="info_font" style="color: #64BDD9;font-size: 14px;font-weight: bold"><td><%= l(:label_projects_score) %></td></tr>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , project_scores(@project) ).to_i %></span></td></tr>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= static_project_score(@project.project_score) %></span></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function show_div(url)
|
||||
{
|
||||
if(url == 'project_score_index')
|
||||
{
|
||||
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/project_score_index', :locals => {:project => @project}) %>');
|
||||
}
|
||||
else if(url == 'issue_score_index')
|
||||
{
|
||||
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/issue_score_index', :locals => {:project => @project}) %>');
|
||||
}
|
||||
else if(url == 'news_score_index')
|
||||
{
|
||||
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/news_score_index', :locals => {:project => @project}) %>');
|
||||
}
|
||||
else if(url == 'file_score_index')
|
||||
{
|
||||
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/file_score_index', :locals => {:project => @project}) %>');
|
||||
}
|
||||
else if(url == 'code_submit_score_index')
|
||||
{
|
||||
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/code_submit_score_index', :locals => {:project => @project}) %>');
|
||||
}
|
||||
else if(url == 'projects_topic_score_index')
|
||||
{
|
||||
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/projects_topic_score_index', :locals => {:project => @project}) %>');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="tabs_new">
|
||||
<ul>
|
||||
<li>
|
||||
<%= link_to l(:label_projects_score),"javascript:void(0)", :onclick => "show_div('project_score_index')"%> :
|
||||
<%= format("%.2f" , project_scores(@project) ).to_i %>
|
||||
<%= link_to l(:label_projects_score),"javascript:void(0)", :onclick => "show_div('project_score_index')"%> : <%= static_project_score(@project.project_score) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_code_submit_score), "javascript:void(0)", :onclick => "show_div('code_submit_score_index')" %> : <%= @project.project_score.changeset_num * 4 %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> :
|
||||
<%= format("%.2f" , issue_score(@project)).to_i %>
|
||||
<%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.project_score.issue_num * 4 + @project.project_score.issue_journal_num %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_news_score), "javascript:void(0)", :onclick => "show_div('news_score_index')"%> :
|
||||
<%= format("%.2f" , news_score(@project)).to_i %>
|
||||
<li>
|
||||
<%= link_to l(:label_file_attachment_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.project_score.attach_num * 5 %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> : <%= @project.project_score.board_num * 2 + @project.project_score.board_message_num %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_file_score), "javascript:void(0)", :onclick => "show_div('file_score_index')"%> :
|
||||
<%= format("%.2f" , documents_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_code_submit_score), "javascript:void(0)", :onclick => "show_div('code_submit_score_index')" %> :
|
||||
<%= format("%.2f" , changesets_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> :
|
||||
<%= format("%.2f" , board_message_score(@project)).to_i %>
|
||||
<%= link_to l(:label_news_score), "javascript:void(0)", :onclick => "show_div('news_score_index')"%> : <%= @project.project_score.news_num %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="show_score_detail">
|
||||
<%= render :partial => 'projects/project_score_index', :locals => {:project => @project } %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<% if @project.is_public? %>
|
||||
$("#set_project_public_<%= @project.id %>").text("设为私有");
|
||||
<% else %>
|
||||
$("#set_project_public_<%= @project.id %>").text("设为公开");
|
||||
<% end %>
|
|
@ -0,0 +1 @@
|
|||
$("#sub_dir_show_<%= @org_subfield.id %>").html("<%= @org_subfield.subfield_subdomain_dir.name %>");
|
|
@ -173,7 +173,7 @@
|
|||
<% time=project.updated_on %>
|
||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||
<p><%=time_from_now time %></p>
|
||||
<p><%=time_from_now time %> <%= project.commits_count %>提交</p>
|
||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
|
||||
项目名称:<%=project.name %><br />
|
||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
创建时间:<%= format_time(project.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
|
||||
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<div class="sectionWrap fl mr15">
|
||||
<ul class="fontGrey3 sectionContent">
|
||||
<ul class="fontGrey3">
|
||||
<% unless @orgs.empty? %>
|
||||
<% @orgs.each do |org|%>
|
||||
<li>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
|
||||
<div class="boxContainer">
|
||||
<div>
|
||||
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
||||
<div class="resourcesSendTo">
|
||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>');">
|
||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id %>','<%= send_ids %>');">
|
||||
<option value="1">课程</option>
|
||||
<option value="2" selected>项目</option>
|
||||
<option value="3">组织</option>
|
||||
|
@ -20,13 +18,13 @@
|
|||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<input type="text" id="search_project_input" value="<%= @search %>" name="search" placeholder="输入项目ID或者名称搜索" class="searchResourcePopup" />
|
||||
<script>
|
||||
observeSearchfieldOnInput('search_project_input','<%= search_user_project_user_path(user)%>','<%= send_id %>','<%= send_ids%>')
|
||||
observeSearchfieldOnInput('search_project_input','<%= search_user_project_user_path(user)%>','<%= send_id %>','<%= send_ids %>')
|
||||
</script>
|
||||
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
|
||||
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= form_tag add_exist_file_to_project_user_path(user),:remote=>true,:id=>'projects_list_form' %>
|
||||
<%= form_tag add_exist_file_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %>
|
||||
<div>
|
||||
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
<% time=project.updated_on %>
|
||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||
<p><%=time_from_now time %></p>
|
||||
<p><%=time_from_now time %> <%= project.commits_count %>提交</p>
|
||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
|
||||
项目名称:<%=project.name %><br />
|
||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
|
||||
//var popupHeight = $(".resourceSharePopup").outerHeight(true);
|
||||
//$(".resourceSharePopup").css("marginTop",-popupHeight/2);
|
||||
//
|
||||
//$("#upload_box").css('left','').css('top','');
|
||||
//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_for_project_popup" ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
//$("#upload_box").css('display','block');
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
|
|
|
@ -40,4 +40,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<!--显示个人主页-->
|
||||
<% if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %>
|
||||
<% homepage = BlogComment.find(@user.blog.homepage_id) %>
|
||||
<%= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %>
|
||||
|
|
|
@ -432,6 +432,8 @@ zh:
|
|||
|
||||
label_file_score: 文档得分
|
||||
label_file_number: 文档的数量
|
||||
|
||||
label_file_attachment_score: 资源得分
|
||||
|
||||
label_code_submit_score: 代码提交得分
|
||||
label_code_submit_number: 代码提交频率
|
||||
|
|
|
@ -54,6 +54,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'logout'
|
||||
post 'apply_subdomain'
|
||||
get 'org_resources_subfield'
|
||||
get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_org_subfield'
|
||||
end
|
||||
collection do
|
||||
get 'check_uniq'
|
||||
|
@ -73,7 +74,10 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
|
||||
Organization.where("domain is not null").each do |org|
|
||||
get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: {subdomain: org.domain}
|
||||
org_domains = []
|
||||
org_domains << org.domain
|
||||
#get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: {subdomain: org.domain}
|
||||
get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: lambda{ |request| org_domains.include?(request.remote_ip) }
|
||||
end
|
||||
get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'}
|
||||
get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'}
|
||||
|
@ -101,6 +105,9 @@ RedmineApp::Application.routes.draw do
|
|||
match "quote_resource_show_org_subfield", :via => [:get]
|
||||
end
|
||||
end
|
||||
member do
|
||||
match 'update_sub_dir', :via => [:put]
|
||||
end
|
||||
resource :boards
|
||||
end
|
||||
|
||||
|
@ -630,6 +637,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'reopen'
|
||||
get 'search_public_orgs_not_in_project'
|
||||
match 'copy', :via => [:get, :post]
|
||||
match 'set_public_or_private', :via => [:post]
|
||||
end
|
||||
|
||||
collection do
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddStatusToOrgMessages < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :org_messages, :status, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddIssuesCountToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :issues_count, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddAttachmentsCountToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :attachments_count, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddBoardsCountToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :boards_count, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddNewsCountToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :news_count, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class StaticProjectBoards < ActiveRecord::Migration
|
||||
def up
|
||||
Project.all.each do |project|
|
||||
puts project.id
|
||||
unless project.boards.first.nil?
|
||||
boards_count = project.boards.first.topics.count
|
||||
project.update_attribute(:boards_count, boards_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class StaticProjectIssues < ActiveRecord::Migration
|
||||
def up
|
||||
Project.all.each do |project|
|
||||
unless project.issues.nil?
|
||||
issues_count = project.issues.count
|
||||
project.update_attribute(:issues_count, issues_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class StaticProjectNews < ActiveRecord::Migration
|
||||
def up
|
||||
Project.all.each do |project|
|
||||
unless project.news.nil?
|
||||
news_count = project.news.count
|
||||
project.update_attribute(:news_count, news_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class StaticProjectAttachments < ActiveRecord::Migration
|
||||
def up
|
||||
Project.all.each do |project|
|
||||
unless project.attachments.nil?
|
||||
attachments_count = project.attachments.count
|
||||
project.update_attribute(:attachments_count, attachments_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddActsCountToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :acts_count, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
class StaticProjectActs < ActiveRecord::Migration
|
||||
def up
|
||||
Project.all.each do |project|
|
||||
acts = ForgeActivity.where("project_id = ?", project.id)
|
||||
unless acts.blank?
|
||||
count = acts.count
|
||||
puts project.id
|
||||
puts "acts_count is #{count}"
|
||||
project.update_attribute(:acts_count, count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class CreateSubfieldSubdomainDirs < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :subfield_subdomain_dirs do |t|
|
||||
t.integer :org_subfield_id
|
||||
t.string :name
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddJournalsCountToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :journals_count, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
class StaticsIssueJournal < ActiveRecord::Migration
|
||||
def up
|
||||
Project.all.each do |project|
|
||||
if !project.project_score.nil? && !project.project_score.issue_journal_num.nil?
|
||||
project.update_attribute(:journals_count, project.project_score.issue_journal_num)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
class StaticsRepositoryCommits < ActiveRecord::Migration
|
||||
def up
|
||||
g = Gitlab.client
|
||||
Project.all.each do |project|
|
||||
unless project.gpid.nil?
|
||||
begin
|
||||
puts project.id
|
||||
count = g.project(project.gpid).commit_count
|
||||
rescue
|
||||
logger.error("The project's rep is not exit!")
|
||||
end
|
||||
project.update_attribute(:commits_count, count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddMessagesCountToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :boards_reply_count, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class StaticsBoardsReply < ActiveRecord::Migration
|
||||
def up
|
||||
Project.all.each do |project|
|
||||
puts project.id
|
||||
unless project.boards.first.nil?
|
||||
messages_count = Message.where("board_id =? and parent_id is not ?", project.boards.first.id, nil).count
|
||||
project.update_attribute(:boards_reply_count, messages_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,42 @@
|
|||
class UpdateForgeAndUserActivity < ActiveRecord::Migration
|
||||
def up
|
||||
user_count = UserActivity.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... user_count do i
|
||||
UserActivity.page(i).per(30).each do |user_act|
|
||||
if user_act.act_type == 'Issue'
|
||||
if user_act.act
|
||||
if user_act.act.journals.count > 0
|
||||
user_act.updated_at = user_act.act.journals.maximum("created_on")
|
||||
user_act.save
|
||||
end
|
||||
else
|
||||
user_act.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for_count = ForgeActivity.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... for_count do i
|
||||
ForgeActivity.page(i).per(30).each do |for_act|
|
||||
if for_act.forge_act_type == 'Issue'
|
||||
if for_act.forge_act
|
||||
if for_act.forge_act.journals.count > 0
|
||||
for_act.updated_at = for_act.forge_act.journals.maximum("created_on")
|
||||
for_act.save
|
||||
end
|
||||
else
|
||||
for_act.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class AddBoardNumToProjectScore < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :project_scores, :board_num, :integer, :default => false
|
||||
add_column :project_scores, :attach_num, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,61 @@
|
|||
class UpdateProjectScore < ActiveRecord::Migration
|
||||
def up
|
||||
project_count = Project.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... project_count do i
|
||||
Project.page(i).per(30).each do |project|
|
||||
puts project.id
|
||||
if ProjectScore.where("project_id=?", project.id).first.nil?
|
||||
puts "create project ==>#{project.id}"
|
||||
ProjectScore.create(:project_id => project.id, :score => false)
|
||||
end
|
||||
unless project.project_score.nil?
|
||||
# update boards
|
||||
unless project.boards.first.nil?
|
||||
boards_count = project.boards.first.topics.count
|
||||
project.project_score.update_attribute(:board_num, boards_count)
|
||||
end
|
||||
# update boards reply
|
||||
unless project.boards.first.nil?
|
||||
messages_count = Message.where("board_id =? and parent_id is not ?", project.boards.first.id, nil).count
|
||||
project.project_score.update_attribute(:board_message_num, messages_count)
|
||||
end
|
||||
# update issues
|
||||
unless project.issues.nil?
|
||||
issues_count = project.issues.count
|
||||
project.project_score.update_attribute(:issue_num, issues_count)
|
||||
end
|
||||
# update issue's journal
|
||||
# if !project.project_score.nil? && !project.project_score.issue_journal_num.nil?
|
||||
# project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num)
|
||||
# end
|
||||
# update news
|
||||
unless project.news.nil?
|
||||
news_count = project.news.count
|
||||
project.project_score.update_attribute(:news_num, news_count)
|
||||
end
|
||||
# update attach
|
||||
unless project.attachments.nil?
|
||||
attachments_count = project.attachments.count
|
||||
project.project_score.update_attribute(:attach_num, attachments_count)
|
||||
end
|
||||
# update commits
|
||||
unless project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
begin
|
||||
puts project.id
|
||||
count = g.project(project.gpid).commit_count
|
||||
rescue
|
||||
logger.error("The project's rep is not exit!")
|
||||
end
|
||||
project.project_score.update_attribute(:changeset_num, count)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
20
db/schema.rb
20
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160108024752) do
|
||||
ActiveRecord::Schema.define(:version => 20160112085834) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1226,8 +1226,9 @@ ActiveRecord::Schema.define(:version => 20160108024752) do
|
|||
t.integer "message_id"
|
||||
t.integer "viewed"
|
||||
t.string "content"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "status", :default => 0
|
||||
end
|
||||
|
||||
create_table "org_projects", :force => true do |t|
|
||||
|
@ -1365,6 +1366,8 @@ ActiveRecord::Schema.define(:version => 20160108024752) do
|
|||
t.integer "documents_num", :default => 0
|
||||
t.integer "changeset_num", :default => 0
|
||||
t.integer "board_message_num", :default => 0
|
||||
t.integer "board_num", :default => 0
|
||||
t.integer "attach_num", :default => 0
|
||||
end
|
||||
|
||||
create_table "project_statuses", :force => true do |t|
|
||||
|
@ -1656,6 +1659,13 @@ ActiveRecord::Schema.define(:version => 20160108024752) do
|
|||
add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
|
||||
add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
|
||||
|
||||
create_table "subfield_subdomain_dirs", :force => true do |t|
|
||||
t.integer "org_subfield_id"
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "system_messages", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "content"
|
||||
|
@ -1693,6 +1703,10 @@ ActiveRecord::Schema.define(:version => 20160108024752) do
|
|||
t.string "extra"
|
||||
end
|
||||
|
||||
create_table "temp", :id => false, :force => true do |t|
|
||||
t.integer "id", :default => 0, :null => false
|
||||
end
|
||||
|
||||
create_table "time_entries", :force => true do |t|
|
||||
t.integer "project_id", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
|
|
|
@ -5,6 +5,8 @@ module Trustie
|
|||
module Gitlab
|
||||
|
||||
module ManageMember
|
||||
attr :g
|
||||
include Helper
|
||||
def self.included(base)
|
||||
base.class_eval {
|
||||
before_create :add_gitlab_member
|
||||
|
|
|
@ -23,7 +23,7 @@ var enableAt = function(_editor) {
|
|||
}
|
||||
|
||||
if('undefined' != (typeof id)){
|
||||
names = '/at/' + id + '?type='+type;
|
||||
names = '/at/' + id + '.json?type='+type;
|
||||
}
|
||||
|
||||
//var names = ["Jacob","Isabella","Ethan","Emma","Michael","Olivia","Alexander","Sophia","William","Ava","Joshua","Emily","Daniel","Madison","Jayden","Abigail","Noah","Chloe","你好","你你你", "가"];
|
||||
|
|
|
@ -50,4 +50,28 @@ function show_more_org_course(url){
|
|||
{page: $("#org_course_page_num").val()},
|
||||
function (data){}
|
||||
);
|
||||
}
|
||||
|
||||
function search_tag_attachment(url,tag_name,q,course_id,sort)
|
||||
{
|
||||
//alert("111");
|
||||
//clearTimeout(clickFunction);
|
||||
clickFunction = setTimeout(function() {
|
||||
search_func()
|
||||
}, 500);
|
||||
function search_func(){
|
||||
if(isdb!= false ) return;
|
||||
$.get(
|
||||
url,
|
||||
{
|
||||
tag_name: tag_name,
|
||||
q: q,
|
||||
org_subfield_id:course_id
|
||||
},
|
||||
function (data) {
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -581,7 +581,7 @@ a.homepageImageNumber:hover {color:#269ac9;}
|
|||
.homepageLeftMenuCourses {font-size:13px; border-bottom:1px solid #dddddd;}
|
||||
.homepageLeftMenuCoursesLine {height:38px; line-height:38px; vertical-align:middle;}
|
||||
.homepageLeftMenuCoursesLine:hover {background-color:#269ac9;}
|
||||
a.coursesLineGrey {padding-left:25px; color:#808080; display:block;}
|
||||
a.coursesLineGrey {padding-left:25px; padding-right:25px; color:#808080; display:block;}
|
||||
a.coursesLineGrey:hover {color:#ffffff;}
|
||||
.homepageLeftMenuMore {height:18px;}
|
||||
.homepageLeftMenuMore:hover {background-color:#269ac9;}
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
.orgUrlInput {width:200px; outline:none; border:1px solid #eaeaea; height:22px;}
|
||||
a.saveBtn {padding:3px 5px; background-color:#269ac9; color:#ffffff;}
|
||||
a.saveBtn:hover {background-color:#297fb8;}
|
||||
.orgMemberList {width:410px; float:left;}
|
||||
.orgMemberList {width:460px; float:left;}
|
||||
.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px;}
|
||||
.orgListUser {width:119px; float:left;}
|
||||
.orgListUser {width:85px; float:left;}
|
||||
.orgListRole {width:180px; float:left;}
|
||||
.orgMemContainer {width:278px;}
|
||||
.orgMemContainer {width:228px;}
|
||||
.orgMemberAdd {float:right; width:240px;}
|
||||
.orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;}
|
||||
.undis {display:none;}
|
||||
|
@ -73,6 +73,7 @@ a.linkGrey8:hover {color:#585858;}
|
|||
.org_login_list a {color:#269ac9;}
|
||||
|
||||
.orgListStatus {width:55px; float:left;}
|
||||
.personalUrl {border:1px solid #dddddd; width:75px; outline:none; white-space:nowrap; padding-left:2px;}
|
||||
.reCon{ margin:5px; width:710px;}
|
||||
.retop{width:710px; height:40px; background:#eaeaea; padding:5px;}
|
||||
.resources {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd;float: right}
|
||||
|
@ -107,4 +108,10 @@ div.flash {margin-top :0px !important}
|
|||
|
||||
.w80{ width:80px;}
|
||||
.relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;}
|
||||
.captainName {max-width:40px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
|
||||
.captainName {max-width:40px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}
|
||||
.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666; outline:none;}
|
||||
.blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;}
|
||||
.blueBtn:hover {background-color:#298fbd;}
|
||||
/*文本描述展开高度*/
|
||||
.maxh360 {max-height: 810px;}
|
||||
.lh18 { line-height: 18px;}
|
|
@ -519,7 +519,7 @@ a.homepageImageNumber:hover {color:#15bccf;}
|
|||
.homepageLeftMenuCourses {font-size:14px; border-bottom:1px solid #dddddd;}
|
||||
.homepageLeftMenuCoursesLine {height:38px; line-height:38px; vertical-align:middle;}
|
||||
.homepageLeftMenuCoursesLine:hover {background-color:#b3e0ee;}
|
||||
a.coursesLineGrey {padding-left:25px; color:#15bccf; display:block;}
|
||||
a.coursesLineGrey {padding-left:25px; padding-right:25px; color:#808080; display:block;}
|
||||
a.coursesLineGrey:hover {color:#ffffff;}
|
||||
.homepageLeftMenuMore {height:18px;}
|
||||
.homepageLeftMenuMore:hover {background-color:#b3e0ee;}
|
||||
|
@ -1003,4 +1003,4 @@ a:hover.userCancel{border:1px solid #888888; }
|
|||
.userCard font {display:block; border-width:8px; position:absolute; bottom:-16px; left:110px; border-style:solid dashed dashed dashed; border-color:#FFF transparent transparent transparent; font-size:0; line-height:0;}
|
||||
.userCard em {display:block; border-width:8px; position:absolute; bottom:-17px; left:110px; border-style:solid dashed dashed dashed; border-color:#eaeaea transparent transparent transparent; font-size:0; line-height:0;}
|
||||
.userCardM {width:201px; height:20px; border:1px solid #dddddd; resize:none;}
|
||||
.resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;}
|
||||
.resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;}
|
||||
|
|
|
@ -52,6 +52,7 @@ table.filecontent th.line-num {
|
|||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
font-weight:normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
table.filecontent th.line-num a {
|
||||
text-decoration: none;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue