Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
a80da022cb
|
@ -1,3 +1,4 @@
|
|||
*.swp
|
||||
/.project
|
||||
/.idea
|
||||
/.bundle
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
|
@ -0,0 +1,114 @@
|
|||
class ApplyProjectMastersController < ApplicationController
|
||||
|
||||
before_filter :require_login, :find_apply, :only => [:create, :delete]
|
||||
|
||||
# GET /apply_project_masters
|
||||
# GET /apply_project_masters.json
|
||||
def index
|
||||
@apply_project_masters = ApplyProjectMaster.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @apply_project_masters }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /apply_project_masters/1
|
||||
# GET /apply_project_masters/1.json
|
||||
def show
|
||||
@apply_project_master = ApplyProjectMaster.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @apply_project_master }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /apply_project_masters/new
|
||||
# GET /apply_project_masters/new.json
|
||||
def new
|
||||
@apply_project_master = ApplyProjectMaster.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @apply_project_master }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /apply_project_masters/1/edit
|
||||
def edit
|
||||
@apply_project_master = ApplyProjectMaster.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /apply_project_masters
|
||||
# POST /apply_project_masters.json
|
||||
def create
|
||||
# @apply_project_master = ApplyProjectMaster.new(params[:apply_project_master])
|
||||
#
|
||||
# respond_to do |format|
|
||||
# if @apply_project_master.save
|
||||
# format.html { redirect_to @apply_project_master, notice: 'Apply project master was successfully created.' }
|
||||
# format.json { render json: @apply_project_master, status: :created, location: @apply_project_master }
|
||||
# else
|
||||
# format.html { render action: "new" }
|
||||
# format.json { render json: @apply_project_master.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
|
||||
set_apply(@apply, User.current, true)
|
||||
|
||||
end
|
||||
|
||||
# PUT /apply_project_masters/1
|
||||
# PUT /apply_project_masters/1.json
|
||||
def update
|
||||
@apply_project_master = ApplyProjectMaster.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @apply_project_master.update_attributes(params[:apply_project_master])
|
||||
format.html { redirect_to @apply_project_master, notice: 'Apply project master was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @apply_project_master.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /apply_project_masters/1
|
||||
# DELETE /apply_project_masters/1.json
|
||||
def destroy
|
||||
@apply_project_master = ApplyProjectMaster.find(params[:id])
|
||||
@apply_project_master.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to apply_project_masters_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
set_apply(@apply, User.current, false)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_apply
|
||||
klass = Object.const_get(params[:object_type].camelcase) rescue nil
|
||||
if klass && klass.respond_to?('applied_by')
|
||||
@apply = klass.find_all_by_id(Array.wrap(params[:object_id]))
|
||||
end
|
||||
render_404 unless @apply.present?
|
||||
end
|
||||
|
||||
#flag标注功能,为1时设置‘申请版主’,为0时设置取消
|
||||
def set_apply(objects, user, flag)
|
||||
objects.each do |object|
|
||||
object.set_apply(user, flag)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_apply', :locals => {:user => user, :objects => objects} }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -30,6 +30,7 @@ class AutoCompletesController < ApplicationController
|
|||
@issues.compact!
|
||||
end
|
||||
render :layout => false
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -53,7 +53,7 @@ class FilesController < ApplicationController
|
|||
|
||||
def create
|
||||
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
|
||||
attachments = Attachment.attach_files(container, params[:attachments])
|
||||
attachments = Attachment.attach_filesex(container, params[:attachments],params[:attachment_type])
|
||||
render_attachment_warning_if_needed(container)
|
||||
|
||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
|
@ -61,4 +61,8 @@ class FilesController < ApplicationController
|
|||
end
|
||||
redirect_to project_files_path(@project)
|
||||
end
|
||||
|
||||
def show_by_attachtype
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -148,7 +148,8 @@ class MemosController < ApplicationController
|
|||
|
||||
def find_memo
|
||||
return unless find_forum
|
||||
@memo = @forum.memos.find(params[:id])
|
||||
#@memo = @forum.memos.find(params[:id])
|
||||
@memo = Memo.find(params[:id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
nil
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
class NoUsesController < ApplicationController
|
||||
|
||||
before_filter :require_login, :find_no_use, :only => [:create, :delete]
|
||||
|
||||
# GET /no_uses
|
||||
# GET /no_uses.json
|
||||
def index
|
||||
@no_uses = NoUse.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @no_uses }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /no_uses/1
|
||||
# GET /no_uses/1.json
|
||||
def show
|
||||
@no_use = NoUse.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @no_use }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /no_uses/new
|
||||
# GET /no_uses/new.json
|
||||
def new
|
||||
@no_use = NoUse.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @no_use }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /no_uses/1/edit
|
||||
def edit
|
||||
@no_use = NoUse.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /no_uses
|
||||
# POST /no_uses.json
|
||||
def create
|
||||
set_no_use(@no_use, User.current, true)
|
||||
|
||||
# respond_to do |format|
|
||||
# if @no_use.save
|
||||
# format.html { redirect_to @no_use, notice: 'No use was successfully created.' }
|
||||
# format.json { render json: @no_use, status: :created, location: @no_use }
|
||||
# else
|
||||
# format.html { render action: "new" }
|
||||
# format.json { render json: @no_use.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
end
|
||||
def delete
|
||||
set_no_use(@no_use, User.current, false)
|
||||
end
|
||||
|
||||
# PUT /no_uses/1
|
||||
# PUT /no_uses/1.json
|
||||
def update
|
||||
@no_use = NoUse.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @no_use.update_attributes(params[:no_use])
|
||||
format.html { redirect_to @no_use, notice: 'No use was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @no_use.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /no_uses/1
|
||||
# DELETE /no_uses/1.json
|
||||
def destroy
|
||||
# @no_use = NoUse.find(params[:id])
|
||||
# @no_use.destroy
|
||||
|
||||
set_no_use(@no_use, User.current, false)
|
||||
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to no_uses_url }
|
||||
# format.json { head :no_content }
|
||||
# end
|
||||
end
|
||||
private
|
||||
|
||||
def find_no_use
|
||||
klass = Object.const_get(params[:object_type].camelcase) rescue nil
|
||||
if klass && klass.respond_to?('no_use_for')
|
||||
@no_use = klass.find_all_by_id(Array.wrap(params[:object_id]))
|
||||
end
|
||||
render_404 unless @no_use.present?
|
||||
end
|
||||
|
||||
#flag标注功能,为1时设置‘没有帮助’,为0时设置取消
|
||||
def set_no_use(objects, user, flag)
|
||||
objects.each do |object|
|
||||
object.set_no_use(user, flag)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_no_use', :locals => {:user => user, :objects => objects} }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,190 @@
|
|||
class OpenSourceProjectsController < ApplicationController
|
||||
|
||||
before_filter :find_osp, :only => [:master_apply, :accept_master_apply, :refuse_master_apply]
|
||||
before_filter :require_master, :only => [:master_apply, :accept_master_apply, :refuse_master_apply]
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :apply_project_masters
|
||||
include ApplyProjectMastersHelper
|
||||
helper :no_uses
|
||||
include NoUsesHelper
|
||||
# GET /open_source_projects
|
||||
# GET /open_source_projects.json
|
||||
def index
|
||||
@app_dir = params[:app_dir]
|
||||
@language = params[:language]
|
||||
@created_at = params[:created_at]
|
||||
per_page_option = 10
|
||||
|
||||
@open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
|
||||
@open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present?
|
||||
|
||||
@os_project_count = @open_source_projects.count
|
||||
@os_project_pages = Paginator.new @os_project_count, per_page_option, params['page']
|
||||
|
||||
@open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page)
|
||||
|
||||
# @open_source_projects = OpenSourceProject.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @open_source_projects }
|
||||
end
|
||||
end
|
||||
|
||||
def master_apply
|
||||
@apply = @open_source_project.apply_tips
|
||||
@applicants = @open_source_project.applicants
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => "base_opensource_p"
|
||||
}
|
||||
format.json { render json: @open_source_project }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /open_source_projects/1
|
||||
# GET /open_source_projects/1.json
|
||||
def show
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
|
||||
sort_init 'updated_at', 'desc'
|
||||
sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at",
|
||||
'replies' => "#{RelativeMemo.table_name}.replies_count",
|
||||
'updated_at' => "COALESCE (last_replies_relative_memos.created_at, #{RelativeMemo.table_name}.created_at)"
|
||||
|
||||
@memo = RelativeMemo.new(:open_source_project => @open_source_project)
|
||||
@topic_count = @open_source_project.topics.count
|
||||
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
|
||||
@memos = @open_source_project.topics.
|
||||
reorder("#{RelativeMemo.table_name}.sticky DESC").
|
||||
includes(:last_reply).
|
||||
limit(@topic_pages.per_page).
|
||||
offset(@topic_pages.offset).
|
||||
order(sort_clause).
|
||||
all
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => "base_opensource_p"
|
||||
}
|
||||
format.json { render json: @open_source_project }
|
||||
end
|
||||
end
|
||||
|
||||
def search
|
||||
|
||||
end
|
||||
|
||||
# GET /open_source_projects/new
|
||||
# GET /open_source_projects/new.json
|
||||
def new
|
||||
@open_source_project = OpenSourceProject.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @open_source_project }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /open_source_projects/1/edit
|
||||
def edit
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /open_source_projects
|
||||
# POST /open_source_projects.json
|
||||
def create
|
||||
@open_source_project = OpenSourceProject.new(params[:open_source_project])
|
||||
|
||||
respond_to do |format|
|
||||
if @open_source_project.save
|
||||
format.html { redirect_to @open_source_project, notice: 'Open source project was successfully created.' }
|
||||
format.json { render json: @open_source_project, status: :created, location: @open_source_project }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @open_source_project.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /open_source_projects/1
|
||||
# PUT /open_source_projects/1.json
|
||||
def update
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @open_source_project.update_attributes(params[:open_source_project])
|
||||
format.html { redirect_to @open_source_project, notice: 'Open source project was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @open_source_project.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /open_source_projects/1
|
||||
# DELETE /open_source_projects/1.json
|
||||
def destroy
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
@open_source_project.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to open_source_projects_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def remove_condition
|
||||
@app_dir = params[:app_dir]
|
||||
@language = params[:language]
|
||||
@created_at = params[:created_at]
|
||||
redirect_to open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => @created_at, :name => params[:name])
|
||||
end
|
||||
|
||||
def search
|
||||
# per_page_option = 10
|
||||
#
|
||||
# @open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
|
||||
# @open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present?
|
||||
#
|
||||
# @os_project_count = @open_source_projects.count
|
||||
# @os_project_pages = Paginator.new @os_project_count, per_page_option, params['page']
|
||||
#
|
||||
# @open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page)
|
||||
|
||||
redirect_to open_source_projects_path(:name => params[:name])
|
||||
|
||||
end
|
||||
|
||||
def refuse_master_apply
|
||||
@apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id)
|
||||
@apply.first.destory
|
||||
|
||||
redirect_to master_apply_open_source_project_path
|
||||
end
|
||||
|
||||
def accept_master_apply
|
||||
@apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id)
|
||||
if @apply.count == 1
|
||||
@apply.first.update_attributes(:status => 2)
|
||||
end
|
||||
|
||||
redirect_to master_apply_open_source_project_path
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def require_master
|
||||
render_403 unless @open_source_project.admin?(User.current)
|
||||
end
|
||||
|
||||
def find_osp
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
render_404 unless @open_source_project.present?
|
||||
end
|
||||
end
|
|
@ -138,6 +138,17 @@ class ProjectsController < ApplicationController
|
|||
@project_count = @projects_all.count
|
||||
@project_pages = Paginator.new @project_count, per_page_option, params['page']
|
||||
|
||||
#gcm activity count
|
||||
|
||||
@project_activity_count=Hash.new
|
||||
|
||||
@projects_all.each do |project|
|
||||
@project_activity_count[project.id]=0
|
||||
end
|
||||
|
||||
@project_activity_count=get_project_activity @projects_all,@project_activity_count
|
||||
|
||||
#gcm end
|
||||
|
||||
case params[:project_sort_type]
|
||||
when '0'
|
||||
|
@ -149,6 +160,14 @@ class ProjectsController < ApplicationController
|
|||
when '2'
|
||||
@projects = @projects_all.order("watchers_count desc")
|
||||
@s_type = 2
|
||||
|
||||
#gcm
|
||||
when '3'
|
||||
#@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array)
|
||||
@projects=handle_project @projects_all,@project_activity_count
|
||||
@s_type = 3
|
||||
@projects = @projects[@project_pages.offset, @project_pages.per_page]
|
||||
|
||||
else
|
||||
@projects = @projects = @projects_all.order("grade desc")
|
||||
@s_type = 1
|
||||
|
@ -196,118 +215,12 @@ class ProjectsController < ApplicationController
|
|||
#gcm activity count
|
||||
|
||||
@project_activity_count=Hash.new
|
||||
|
||||
#count initialize
|
||||
@projects_all.each do |project|
|
||||
@project_activity_count[project.id]=0
|
||||
end
|
||||
@project_ids=@project_activity_count.keys()
|
||||
|
||||
days = Setting.activity_days_default.to_i
|
||||
date_to ||= Date.today + 1
|
||||
date_from = date_to - days-1.years
|
||||
|
||||
#approach 1
|
||||
=begin
|
||||
|
||||
@projects_all.each do |project|
|
||||
#issue_count
|
||||
issues=Issue.where("project_id=?",project.id)
|
||||
issue_count=0
|
||||
issues.each do |issue|
|
||||
issue_count+=issue.journals.count
|
||||
end
|
||||
|
||||
#repository_count
|
||||
repositories=Repository.where("project_id=?",project.id)
|
||||
repository_count=0
|
||||
repositories.each do |repository|
|
||||
repository_count+=repository.changesets.count
|
||||
end
|
||||
|
||||
#news_count
|
||||
news_count=News.where("project_id=?",project.id).count
|
||||
#document_count
|
||||
document_count=Document.where("project_id=?",project.id).count
|
||||
#file_count
|
||||
file_count=Attachment.where("container_type='Project' AND container_id=?",project.id).count
|
||||
|
||||
#message_count
|
||||
boards=Board.where("project_id=?",project.id)
|
||||
message_count=0
|
||||
boards.each do |board|
|
||||
message_count+=board.messages.count
|
||||
end
|
||||
|
||||
#time_entry_count
|
||||
time_entry_count=TimeEntry.where("project_id=?",project.id).count
|
||||
|
||||
#sum
|
||||
@project_activity_count[project.id.to_s]=issue_count+repository_count+news_count+document_count+file_count+message_count+time_entry_count
|
||||
|
||||
end
|
||||
=end
|
||||
#gcm
|
||||
|
||||
#gcm approach 2
|
||||
|
||||
#issue_count
|
||||
Issue.where(project_id: @project_ids).where("updated_on>?",date_from).each do |issue|
|
||||
# @project_activity_count[issue.project_id.to_s]+=1
|
||||
@project_activity_count[issue.project_id]+=issue.journals.where("created_on>?",date_from).count
|
||||
end
|
||||
|
||||
#repository_count
|
||||
Repository.where(project_id: @project_ids).each do |repository|
|
||||
# @project_activity_count[repository.project_id.to_s]+=1
|
||||
@project_activity_count[repository.project_id]+=repository.changesets.where("committed_on>?",date_from).count
|
||||
end
|
||||
|
||||
|
||||
#news_count
|
||||
News.where(project_id: @project_ids).where("created_on>?",date_from).each do |news|
|
||||
@project_activity_count[news.project_id]+=1
|
||||
end
|
||||
|
||||
#document_count
|
||||
Document.where(project_id: @project_ids).where("created_on>?",date_from).each do |document|
|
||||
@project_activity_count[document.project_id]+=1
|
||||
end
|
||||
|
||||
#file_count
|
||||
Attachment.where(container_id: @project_ids).where("container_type='Project' AND created_on>?",date_from).each do |attachment|
|
||||
@project_activity_count[attachment.container_id]+=1
|
||||
end
|
||||
|
||||
#message_count
|
||||
Board.where(project_id: @project_ids).each do |board|
|
||||
# @project_activity_count[board.project_id]+=1
|
||||
@project_activity_count[board.project_id]+=board.messages.where("updated_on>?",date_from).count
|
||||
end
|
||||
|
||||
#time_entry_count
|
||||
TimeEntry.where(project_id: @project_ids).where("updated_on>?",date_from).each do |timeentry|
|
||||
@project_activity_count[timeentry.project_id]+=1
|
||||
end
|
||||
|
||||
#feedbackc_count
|
||||
JournalsForMessage.where(jour_id: @project_ids).each do |jourformess|
|
||||
@project_activity_count[jourformess.jour_id]+=1
|
||||
end
|
||||
|
||||
#@project_activity_count!=0
|
||||
@project_all_array=[]
|
||||
i=0;
|
||||
@projects_all.each do |project|
|
||||
id=project.id
|
||||
@project_all_array[i]=project
|
||||
if @project_activity_count[id]==0
|
||||
@project_activity_count[id]=1
|
||||
end
|
||||
i=i+1
|
||||
end
|
||||
|
||||
@project_activity_count_array=@project_activity_count.values()
|
||||
|
||||
#@project_activity_count=get_project_activity @projects_all,@project_activity_count
|
||||
#gcm end
|
||||
|
||||
|
||||
|
@ -316,26 +229,48 @@ class ProjectsController < ApplicationController
|
|||
@projects = @projects_all.order("created_on desc")
|
||||
@s_type = 0
|
||||
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
|
||||
|
||||
#gcm
|
||||
@project_activity_count=get_project_activity @projects,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
when '1'
|
||||
@projects = @projects_all.order("course_ac_para desc")
|
||||
@s_type = 1
|
||||
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
|
||||
|
||||
#gcm
|
||||
@project_activity_count=get_project_activity @projects,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
when '2'
|
||||
@projects = @projects_all.order("watchers_count desc")
|
||||
@s_type = 2
|
||||
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
|
||||
|
||||
#gcm
|
||||
when '3'
|
||||
@projects=desc_sort_course_by_avtivity(@project_ids,@project_activity_count_array,@project_all_array)
|
||||
@s_type = 3
|
||||
@projects = @projects[@project_pages.offset, @project_pages.per_page]
|
||||
@project_activity_count=get_project_activity @projects,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
#gcm
|
||||
when '3'
|
||||
|
||||
#gcm
|
||||
@project_activity_count=get_project_activity @projects_all,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
@projects=handle_project @projects_all,@project_activity_count
|
||||
@s_type = 3
|
||||
@projects = @projects[@project_pages.offset, @project_pages.per_page]
|
||||
else
|
||||
@s_type = 0
|
||||
@projects = @projects_all.order("created_on desc")
|
||||
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
|
||||
|
||||
#gcm
|
||||
@project_activity_count=get_project_activity @projects,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
@ -354,17 +289,76 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#gcm
|
||||
def search
|
||||
#modified by nie
|
||||
project_type = params[:project_type].to_i
|
||||
projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities
|
||||
@projects = projects_all.visible
|
||||
@projects = @projects.visible.like(params[:name]) if params[:name].present?
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@project_count = @projects.visible.count
|
||||
@project_pages = Paginator.new @project_count, @limit, params['page']
|
||||
@offset ||= @project_pages.offset
|
||||
@projects = @projects.visible.offset(@offset).limit(@limit).all
|
||||
@projects_all = @projects.visible.like(params[:name]) if params[:name].present?
|
||||
|
||||
@project_count = @projects_all.count
|
||||
@project_pages = Paginator.new @project_count, per_page_option, params['page']
|
||||
|
||||
#gcm activity count
|
||||
|
||||
@project_activity_count=Hash.new
|
||||
# count initialize
|
||||
@projects_all.each do |project|
|
||||
@project_activity_count[project.id]=0
|
||||
end
|
||||
|
||||
#@project_activity_count=get_project_activity @projects_all,@project_activity_count
|
||||
|
||||
#gcm end
|
||||
|
||||
|
||||
case params[:project_sort_type]
|
||||
when '0'
|
||||
@projects = @projects_all.order("created_on desc")
|
||||
@s_type = 0
|
||||
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
|
||||
|
||||
#gcm
|
||||
@project_activity_count=get_project_activity @projects,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
when '1'
|
||||
@projects = @projects_all.order("course_ac_para desc")
|
||||
@s_type = 1
|
||||
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
|
||||
|
||||
#gcm
|
||||
@project_activity_count=get_project_activity @projects,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
when '2'
|
||||
@projects = @projects_all.order("watchers_count desc")
|
||||
@s_type = 2
|
||||
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
|
||||
|
||||
#gcm
|
||||
@project_activity_count=get_project_activity @projects,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
when '3'
|
||||
#@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array)
|
||||
@project_activity_count=get_project_activity @projects_all,@project_activity_count_array #gcm
|
||||
@projects=handle_project @projects_all,@project_activity_count
|
||||
@s_type = 3
|
||||
@projects = @projects[@project_pages.offset, @project_pages.per_page]
|
||||
|
||||
else
|
||||
@s_type = 0
|
||||
@projects = @projects_all.order("created_on desc")
|
||||
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
|
||||
|
||||
#gcm
|
||||
@project_activity_count=get_project_activity @projects,@project_activity_count
|
||||
#gcmend
|
||||
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base'
|
||||
|
@ -384,6 +378,38 @@ class ProjectsController < ApplicationController
|
|||
}
|
||||
end
|
||||
end
|
||||
#gcmend
|
||||
|
||||
# def search
|
||||
# #modified by nie
|
||||
# project_type = params[:project_type].to_i
|
||||
# projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities
|
||||
# @projects = projects_all.visible
|
||||
# @projects = @projects.visible.like(params[:name]) if params[:name].present?
|
||||
# @offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
# @project_count = @projects.visible.count
|
||||
# @project_pages = Paginator.new @project_count, @limit, params['page']
|
||||
# @offset ||= @project_pages.offset
|
||||
# @projects = @projects.visible.offset(@offset).limit(@limit).all
|
||||
# respond_to do |format|
|
||||
# format.html {
|
||||
# render :layout => 'base'
|
||||
# scope = Project
|
||||
# unless params[:closed]
|
||||
# scope = scope.active
|
||||
# end
|
||||
# }
|
||||
# format.api {
|
||||
# # @offset, @limit = api_offset_and_limit
|
||||
# # @project_count = Project.visible.count
|
||||
# # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
|
||||
# }
|
||||
# format.atom {
|
||||
# projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
|
||||
# render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
|
||||
# }
|
||||
# end
|
||||
# end
|
||||
|
||||
# added by fq
|
||||
def new_join
|
||||
|
@ -1026,7 +1052,93 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def desc_sort_course_by_avtivity(ids,activity_count,projects)
|
||||
|
||||
|
||||
#gcm
|
||||
def get_project_activity projects,activities
|
||||
@project_ids=activities.keys()
|
||||
|
||||
days = Setting.activity_days_default.to_i
|
||||
date_to ||= Date.today + 1
|
||||
date_from = date_to - days-1.years
|
||||
|
||||
#issue_count
|
||||
Issue.where(project_id: @project_ids).where("updated_on>?",date_from).each do |issue|
|
||||
# activities[issue.project_id.to_s]+=1
|
||||
activities[issue.project_id]+=issue.journals.where("created_on>?",date_from).count
|
||||
end
|
||||
|
||||
#repository_count
|
||||
Repository.where(project_id: @project_ids).each do |repository|
|
||||
# activities[repository.project_id.to_s]+=1
|
||||
activities[repository.project_id]+=repository.changesets.where("committed_on>?",date_from).count
|
||||
end
|
||||
|
||||
|
||||
#news_count
|
||||
News.where(project_id: @project_ids).where("created_on>?",date_from).each do |news|
|
||||
activities[news.project_id]+=1
|
||||
end
|
||||
|
||||
#document_count
|
||||
Document.where(project_id: @project_ids).where("created_on>?",date_from).each do |document|
|
||||
activities[document.project_id]+=1
|
||||
end
|
||||
|
||||
#file_count
|
||||
Attachment.where(container_id: @project_ids, container_type: Project).where("created_on>?",date_from).each do |attachment|
|
||||
activities[attachment.container_id]+=1
|
||||
end
|
||||
|
||||
#message_count
|
||||
Board.where(project_id: @project_ids).each do |board|
|
||||
# activities[board.project_id]+=1
|
||||
activities[board.project_id]+=board.messages.where("updated_on>?",date_from).count
|
||||
end
|
||||
|
||||
#time_entry_count
|
||||
TimeEntry.where(project_id: @project_ids).where("updated_on>?",date_from).each do |timeentry|
|
||||
activities[timeentry.project_id]+=1
|
||||
end
|
||||
|
||||
#feedbackc_count
|
||||
JournalsForMessage.where(jour_id: @project_ids, jour_type: Project).each do |jourformess|
|
||||
activities[jourformess.jour_id]+=1
|
||||
end
|
||||
|
||||
#activities!=0
|
||||
i=0;
|
||||
projects.each do |project|
|
||||
id=project.id
|
||||
if activities[id]==0
|
||||
activities[id]=1
|
||||
end
|
||||
end
|
||||
|
||||
return activities
|
||||
end
|
||||
#gcmend
|
||||
|
||||
#gcm
|
||||
def handle_project projects,activities
|
||||
project_activity_count_array=activities.values()
|
||||
|
||||
project_array=[]
|
||||
i=0;
|
||||
projects.each do |project|
|
||||
project_array[i]=project
|
||||
i=i+1
|
||||
end
|
||||
|
||||
projects=desc_sort_course_by_avtivity(project_activity_count_array,project_array)
|
||||
|
||||
return projects
|
||||
end
|
||||
#gcmend
|
||||
|
||||
|
||||
#gcm
|
||||
def desc_sort_course_by_avtivity(activity_count,projects)
|
||||
return projects if activity_count.size<2
|
||||
(activity_count.size-2).downto(0) do |i|
|
||||
(0..i).each do |j|
|
||||
|
@ -1037,20 +1149,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
return projects
|
||||
|
||||
|
||||
|
||||
# len=activity_count.length
|
||||
# for i in 0...(len-1) do
|
||||
# for j in 0...(len-i-1) do
|
||||
# if activity_count[j]>activity_count[j+1] do
|
||||
# count_temp=activity_count[j]
|
||||
|
||||
# activity_count[j]=activity_count[j+1]
|
||||
# activity_count[j+1]=count_temp
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#desc_sort_course_by_avtivity(@project_ids,@project_activity_count_array,@projects_all)
|
||||
end
|
||||
#gcmend
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
class RelativeMemosController < ApplicationController
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :apply_project_masters
|
||||
include ApplyProjectMastersHelper
|
||||
helper :no_uses
|
||||
include NoUsesHelper
|
||||
|
||||
before_filter :find_memo, :except => [:new, :create]
|
||||
before_filter :find_osp, :only => [:create]
|
||||
before_filter :require_login, :only => [:new, :create]
|
||||
|
||||
layout 'base_opensource_p'
|
||||
|
||||
# GET /open_source_projects
|
||||
# GET /open_source_projects.json
|
||||
def index
|
||||
# per_page_option = 10
|
||||
#
|
||||
# @open_source_projects = OpenSourceProject.all
|
||||
#
|
||||
# @os_project_count = @open_source_projects.count
|
||||
# @os_project_pages = Paginator.new @os_project_count, per_page_option, params['page']
|
||||
#
|
||||
# @open_source_projects = OpenSourceProject.all
|
||||
#
|
||||
# respond_to do |format|
|
||||
# format.html # index.html.erb
|
||||
# format.json { render json: @open_source_projects }
|
||||
# end
|
||||
end
|
||||
|
||||
# GET /open_source_projects/1
|
||||
# GET /open_source_projects/1.json
|
||||
REPLIES_PER_PAGE = 10 unless const_defined?(:REPLIES_PER_PAGE)
|
||||
def show
|
||||
pre_count = REPLIES_PER_PAGE
|
||||
|
||||
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
||||
@memo.update_column(:viewed_count_local, (@memo.viewed_count_local.to_i + 1))
|
||||
|
||||
page = params[:page]
|
||||
if params[:r] && page.nil?
|
||||
offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count
|
||||
page = 1 + offset / pre_count
|
||||
else
|
||||
|
||||
end
|
||||
@reply_count = @memo.children.count
|
||||
@reply_pages = Paginator.new @reply_count, pre_count, page
|
||||
@replies = @memo.children.
|
||||
includes(:author, :attachments).
|
||||
reorder("#{RelativeMemo.table_name}.created_at ASC").
|
||||
limit(@reply_pages.per_page).
|
||||
offset(@reply_pages.offset).
|
||||
all
|
||||
|
||||
@mome_new = RelativeMemo.new
|
||||
|
||||
|
||||
# @memo = Memo.find_by_id(params[:id])
|
||||
# @forum = Forum.find(params[:forum_id])
|
||||
# @replies = @memo.replies
|
||||
# @mome_new = Memo.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @memo }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /open_source_projects/new
|
||||
# GET /open_source_projects/new.json
|
||||
def new
|
||||
@open_source_project = OpenSourceProject.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @open_source_project }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /open_source_projects/1/edit
|
||||
def edit
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /open_source_projects
|
||||
# POST /open_source_projects.json
|
||||
def create
|
||||
@memo = RelativeMemo.new(params[:relative_memo])
|
||||
# @memo.url = "http://forge.trustie.net/open_source_projects"
|
||||
@memo.osp_id = params[:open_source_project_id]
|
||||
@memo.author_id = User.current.id
|
||||
|
||||
@memo.save_attachments(params[:attachments] || (params[:relative_memo] && params[:relative_memo][:uploads]))
|
||||
|
||||
respond_to do |format|
|
||||
if @memo.save
|
||||
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
|
||||
format.json { render json: @memo, status: :created, location: @memo }
|
||||
else
|
||||
flash[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
|
||||
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
|
||||
format.html { redirect_to back_memo_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||
format.json { render json: @memo.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /open_source_projects/1
|
||||
# PUT /open_source_projects/1.json
|
||||
def update
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @open_source_project.update_attributes(params[:open_source_project])
|
||||
format.html { redirect_to @open_source_project, notice: 'Open source project was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @open_source_project.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /open_source_projects/1
|
||||
# DELETE /open_source_projects/1.json
|
||||
def destroy
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
@open_source_project.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to open_source_projects_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_memo
|
||||
return unless find_osp
|
||||
@memo = @open_source_project.relative_memos.find(params[:id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
nil
|
||||
end
|
||||
|
||||
def find_osp
|
||||
@open_source_project = OpenSourceProject.find(params[:open_source_project_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
nil
|
||||
end
|
||||
|
||||
def back_memo_url
|
||||
open_source_project_relative_memo_path(@open_source_project, (@memo.parent_id.nil? ? @memo : @memo.parent_id))
|
||||
end
|
||||
end
|
|
@ -33,6 +33,19 @@ class SchoolController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def get_province
|
||||
@provinces = School.find_by_sql("select distinct province from schools")
|
||||
|
||||
options = ""
|
||||
|
||||
@provinces.each do |p|
|
||||
options << "<option value = '#{p.province}' >#{p.province}</option>"
|
||||
end
|
||||
|
||||
render :text => options
|
||||
|
||||
end
|
||||
|
||||
def get_options
|
||||
@school = School.where("province = ?", params[:province])
|
||||
p = params[:province]
|
||||
|
|
|
@ -56,8 +56,10 @@ class SoftapplicationsController < ApplicationController
|
|||
|
||||
@stars_status_map = Hash.new(0.0)
|
||||
stars_status.each do |star_status|
|
||||
percent = percent_of(star_status.scount, stars_reates_count).to_f
|
||||
percent_m = format("%.2f", percent)
|
||||
@stars_status_map["star#{star_status.stars.to_i}".to_sym] =
|
||||
percent_of(star_status.scount, stars_reates_count).to_s + "%"
|
||||
percent_m.to_s + "%"
|
||||
end
|
||||
@jours = @softapplication.journals_for_messages.order('created_on DESC')
|
||||
@image_results = []
|
||||
|
|
|
@ -16,6 +16,7 @@ class TagsController < ApplicationController
|
|||
helper :projects
|
||||
include TagsHelper
|
||||
helper :tags
|
||||
include OpenSourceProjectsHelper
|
||||
|
||||
before_filter :require_admin,:only => [:delete,:show_all]
|
||||
|
||||
|
@ -58,7 +59,7 @@ class TagsController < ApplicationController
|
|||
end
|
||||
|
||||
@users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num,@contests_tags_num,
|
||||
@forum_tags_num, @attachments_tags_num = get_tags_size
|
||||
@forum_tags_num, @attachments_tags_num, @open_source_projects_num = get_tags_size
|
||||
|
||||
# 获取搜索结果
|
||||
@obj,@obj_pages,@results_count,@users_results,
|
||||
|
@ -67,7 +68,8 @@ class TagsController < ApplicationController
|
|||
@bids_results,
|
||||
@forums_results,
|
||||
@attachments_results,
|
||||
@contests_tags = refresh_results(@obj_id,@obj_flag,@selected_tags)
|
||||
@contests_tags,
|
||||
@open_source_projects_results = refresh_results(@obj_id,@obj_flag,@selected_tags)
|
||||
|
||||
# 这里是做tag推荐用的, 用来生产推荐的tags
|
||||
unless @obj.nil?
|
||||
|
@ -182,6 +184,7 @@ class TagsController < ApplicationController
|
|||
@contests_results = nil
|
||||
@forums_results = nil
|
||||
attachments_results = nil
|
||||
@open_source_projects_results = nil
|
||||
@obj_pages = nil
|
||||
@obj = nil
|
||||
@result = nil
|
||||
|
@ -213,6 +216,9 @@ class TagsController < ApplicationController
|
|||
when '7'
|
||||
@obj = Contest.find_by_id(obj_id)
|
||||
@obj_pages,@contests_results,@results_count = for_pagination(get_contests_by_tag(selected_tags))
|
||||
when '8'
|
||||
@obj = OpenSourceProject.find_by_id(obj_id)
|
||||
@obj_pages, @open_source_projects_results, @results_count = for_pagination(get_open_source_projects_by_tag(selected_tags))
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
|
@ -225,7 +231,8 @@ class TagsController < ApplicationController
|
|||
@bids_results,
|
||||
@forums_results,
|
||||
attachments_results,
|
||||
@contests_results]
|
||||
@contests_results,
|
||||
@open_source_projects_results]
|
||||
end
|
||||
|
||||
def for_pagination(results)
|
||||
|
@ -245,8 +252,9 @@ class TagsController < ApplicationController
|
|||
@bids_tags_num = Bid.tag_counts.size
|
||||
forum_tags_num = Forum.tag_counts.size
|
||||
attachment_tags_num = Attachment.tag_counts.size
|
||||
@open_source_projects_num = OpenSourceProject.tag_counts.size
|
||||
@contests_tags_num = Contest.tag_counts.size
|
||||
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num
|
||||
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num, @open_source_projects_num
|
||||
end
|
||||
|
||||
# 通过数字 来转换出对象的类型
|
||||
|
@ -269,6 +277,8 @@ class TagsController < ApplicationController
|
|||
return 'Attachment'
|
||||
when '7'
|
||||
return 'Contest'
|
||||
when '8'
|
||||
return 'OpenSourceProject'
|
||||
else
|
||||
render_error :message => e.message
|
||||
return
|
||||
|
|
|
@ -658,6 +658,8 @@ class UsersController < ApplicationController
|
|||
@obj = Attachment.find_by_id(@obj_id)
|
||||
when '7' then
|
||||
@obj = Contest.find_by_id(@obj_id)
|
||||
when '8'
|
||||
@obj = OpenSourceProject.find_by_id(@obj_id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
|
|
|
@ -443,6 +443,10 @@ module ApplicationHelper
|
|||
l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe
|
||||
end
|
||||
|
||||
def added_time(created)
|
||||
l(:label_added_time, :age => time_tag(created)).html_safe
|
||||
end
|
||||
|
||||
#huang
|
||||
def betweentime(enddate)
|
||||
ss=(DateTime.parse("#{enddate.to_date}")-DateTime.parse("#{DateTime.now.to_date}")).to_i
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
module ApplyProjectMastersHelper
|
||||
def apply_super_user(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
applied = objects.any? {|object| object.applied_by?(user)}
|
||||
allowed = objects.any? {|object| object.allowed?(user)}
|
||||
# @watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid)))
|
||||
# css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
# ([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
css = apply_css(objects) << options[0].to_s
|
||||
|
||||
text = applied ? (allowed ? l(:you_are_master) : l(:cancel_apply)) : l(:apply_master)
|
||||
|
||||
url = apply_project_masters_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = applied ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
def apply_css(objects)
|
||||
objects = Array.wrap(objects)
|
||||
id = (objects.size == 1 ? objects.first.id : 'bulk')
|
||||
"#{objects.first.class.to_s.underscore}-#{id}-watcher"
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,28 @@
|
|||
module NoUsesHelper
|
||||
def no_use_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
clicked = objects.any? {|object| object.no_use_for?(user)}
|
||||
# @watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid)))
|
||||
css = no_use_css(objects) << options[0].to_s
|
||||
# ([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = clicked ? l(:cancel_no_use) : l(:no_use)
|
||||
|
||||
url = no_uses_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = clicked ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
#, :class => css
|
||||
end
|
||||
|
||||
def no_use_css(objects)
|
||||
objects = Array.wrap(objects)
|
||||
id = (objects.size == 1 ? objects.first.id : 'bulk')
|
||||
"#{objects.first.class.to_s.underscore}-#{id}-watcher"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
module OpenSourceProjectsHelper
|
||||
def show_condition(app_dir, language, created_at, name)
|
||||
s=''.html_safe
|
||||
unless app_dir.nil?
|
||||
s_temp = content_tag('a', app_dir)
|
||||
temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :language => language, :created_at => created_at, :name => name}
|
||||
temp = content_tag('span', temp, :class => 'del')
|
||||
s_temp << temp
|
||||
s_temp = content_tag('span', s_temp, :class => 'tag_show')
|
||||
s << content_tag('div', s_temp, :id => 'tag')
|
||||
|
||||
end
|
||||
unless language.nil?
|
||||
s_temp = content_tag('a', language)
|
||||
temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :app_dir => app_dir, :created_at => created_at, :name => name}
|
||||
temp = content_tag('span', temp, :class => 'del')
|
||||
s_temp << temp
|
||||
s_temp = content_tag('span', s_temp, :class => 'tag_show')
|
||||
s << content_tag('div', s_temp, :id => 'tag')
|
||||
end
|
||||
unless created_at.nil?
|
||||
s_temp = content_tag('a', created_at)
|
||||
temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :app_dir => app_dir, :language => language, :name => name}
|
||||
temp = content_tag('span', temp, :class => 'del')
|
||||
s_temp << temp
|
||||
s_temp = content_tag('span', s_temp, :class => 'tag_show')
|
||||
s << content_tag('div', s_temp, :id => 'tag')
|
||||
end
|
||||
s = content_tag('div', s, :id => 'tags_show')
|
||||
s = content_tag('div', s, :id => 'tags')
|
||||
s = content_tag('div', s, :class => 'user_tags')
|
||||
end
|
||||
|
||||
def get_open_source_projects_by_tag(tag_name)
|
||||
OpenSourceProject.tagged_with(tag_name).order('created_at desc')
|
||||
end
|
||||
end
|
|
@ -298,6 +298,14 @@ module UserScoreHelper
|
|||
|
||||
end
|
||||
|
||||
|
||||
def calculate_attachments(user)
|
||||
attachments = Attachment.where("container_type IS NOT NULL AND container_type <> 'Issue' AND author_id = ?", user.id).count
|
||||
|
||||
return attachments
|
||||
|
||||
end
|
||||
|
||||
def calculate_user_score(user)
|
||||
collaboration = calculate_collaboration_count(user)
|
||||
influence = calculate_influence_count(user)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
class ApplyProjectMaster < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
# status 1是申请者,2是版主
|
||||
belongs_to :apply, :polymorphic => true
|
||||
belongs_to :user
|
||||
|
||||
validates_presence_of :user
|
||||
validates_uniqueness_of :user_id, :scope => [:apply_type, :apply_id]
|
||||
validate :validate_user
|
||||
|
||||
protected
|
||||
|
||||
def validate_user
|
||||
errors.add :user_id, :invalid unless user.nil? || user.active?
|
||||
end
|
||||
end
|
|
@ -261,6 +261,12 @@ class Attachment < ActiveRecord::Base
|
|||
result
|
||||
end
|
||||
|
||||
def self.attach_filesex(obj, attachments,attachment_type)
|
||||
result = obj.save_attachmentsex(attachments, User.current,attachment_type)
|
||||
obj.attach_saved_attachments
|
||||
result
|
||||
end
|
||||
|
||||
def self.latest_attach(attachments, filename)
|
||||
attachments.sort_by(&:created_on).reverse.detect {
|
||||
|att| att.filename.downcase == filename.downcase
|
||||
|
|
|
@ -7,6 +7,7 @@ class Course < ActiveRecord::Base
|
|||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
||||
has_many :bid
|
||||
validates_presence_of :password, :term
|
||||
validates_format_of :class_period, :message => "class period can only digital!", :with =>/^[1-9]\d*$/
|
||||
safe_attributes 'extra',
|
||||
'time',
|
||||
'name',
|
||||
|
@ -18,6 +19,13 @@ class Course < ActiveRecord::Base
|
|||
'term',
|
||||
'password'
|
||||
|
||||
#自定义验证
|
||||
def validate
|
||||
if !class_period.match([0-9])
|
||||
errors.add_to_base("class period can only digital")
|
||||
end
|
||||
end
|
||||
|
||||
def get_endup_time
|
||||
begin
|
||||
end_time = Time.parse(self.endup_time)
|
||||
|
|
|
@ -52,7 +52,12 @@ class IssueQuery < Query
|
|||
|
||||
def initialize(attributes=nil, *args)
|
||||
super attributes
|
||||
self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
|
||||
# self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
|
||||
|
||||
#gcm
|
||||
self.filters ||= { 'subject' => {:operator => "~" , :values => [""] } }
|
||||
#gcmend
|
||||
|
||||
end
|
||||
|
||||
# Returns true if the query is visible to +user+ or the current user.
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
class NoUse < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
belongs_to :no_use, :polymorphic => true
|
||||
belongs_to :user
|
||||
|
||||
validates_presence_of :user
|
||||
validates_uniqueness_of :user_id, :scope => [:no_use_type, :no_use_id]
|
||||
validate :validate_user
|
||||
|
||||
protected
|
||||
|
||||
def validate_user
|
||||
errors.add :user_id, :invalid unless user.nil? || user.active?
|
||||
end
|
||||
end
|
|
@ -0,0 +1,134 @@
|
|||
class OpenSourceProject < ActiveRecord::Base
|
||||
attr_accessible :name
|
||||
|
||||
include Redmine::SafeAttributes
|
||||
has_many :applies, :class_name => "ApplyProjectMaster", :as => :apply, :dependent => :delete_all
|
||||
has_many :topics, :class_name => 'RelativeMemo', :foreign_key => 'osp_id', :conditions => "#{RelativeMemo.table_name}.parent_id IS NULL", :order => "#{RelativeMemo.table_name}.created_at DESC", :dependent => :destroy
|
||||
has_many :relative_memos, :class_name => 'RelativeMemo', :foreign_key => 'osp_id', :dependent => :destroy
|
||||
has_many :tags, :through => :project_tags, :class_name => 'Tag'
|
||||
has_many :project_tags, :class_name => 'ProjectTags'
|
||||
has_many :masters, :class_name => 'ApplyProjectMaster', :as => :apply, :dependent => :delete_all, :conditions => "#{ApplyProjectMaster.table_name}.status = 2"
|
||||
has_many :admin, :through => :masters, :class_name => 'User'
|
||||
has_many :apply_tips, :class_name => 'ApplyProjectMaster', :as => :apply, :dependent => :delete_all, :conditions => "#{ApplyProjectMaster.table_name}.status = 1"
|
||||
has_many :applicants, :class_name => 'User', :through => :apply_tips, :source => :user
|
||||
|
||||
validates_uniqueness_of :name
|
||||
|
||||
acts_as_taggable
|
||||
|
||||
scope :applied_by, lambda { |user_id|
|
||||
{ :include => :apply_project_master,
|
||||
:conditions => ["#{ApplyProjectMaster.table_name}.user_id = ?", user_id]
|
||||
}
|
||||
}
|
||||
scope :like, lambda {|arg|
|
||||
if arg.blank?
|
||||
where(nil)
|
||||
else
|
||||
pattern = "%#{arg.to_s.strip.downcase}%"
|
||||
where("LOWER(name) LIKE :p OR LOWER(description) LIKE :p ", :p => pattern)
|
||||
end
|
||||
}
|
||||
def filter(app_dir, language, created_at)
|
||||
filter_app_dir(app_dir).filter_language(language).filter_time(created_at)
|
||||
end
|
||||
|
||||
def self.filter(app_dir, language, created_at)
|
||||
self.filter_app_dir(app_dir).filter_language(language).filter_time(created_at)
|
||||
end
|
||||
|
||||
scope :filter_app_dir, lambda {|args|
|
||||
nil
|
||||
}
|
||||
|
||||
scope :filter_language, lambda {|*arg|
|
||||
if arg[0].nil?
|
||||
where(nil)
|
||||
else
|
||||
tagged_with(arg).order('updated_at desc')
|
||||
end
|
||||
}
|
||||
|
||||
scope :filter_time, lambda {|args|
|
||||
where("YEAR(#{OpenSourceProject.table_name}.created_at) = ?", args) unless args.nil?
|
||||
}
|
||||
|
||||
# def filter_app_dir(app_dir)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def self.filter_app_dir(app_dir)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def filter_language(language)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def self.filter_language(language)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def filter_time(created_at)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def self.filter_time(created_at)
|
||||
# nil
|
||||
# end
|
||||
|
||||
def short_description(length = 255)
|
||||
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
end
|
||||
|
||||
def applied_by?(user)
|
||||
self.applies.each do |apply|
|
||||
if apply.user_id == user.id
|
||||
return true
|
||||
end
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
def allowed?(user)
|
||||
self.applies.each do |apply|
|
||||
if apply.user_id == user.id and apply.status == 2
|
||||
return true
|
||||
end
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
def set_apply(user, flag=true)
|
||||
flag ? set_filter(user) : remove_filter(user)
|
||||
end
|
||||
|
||||
def set_filter(user)
|
||||
self.applies << ApplyProjectMaster.new(:user => user, :status => 1)
|
||||
end
|
||||
|
||||
def remove_filter(user)
|
||||
return nil unless user && user.is_a?(User)
|
||||
ApplyProjectMaster.delete_all "apply_type = '#{self.class}' AND apply_id = #{self.id} AND user_id = #{user.id}"
|
||||
end
|
||||
|
||||
def admin?(user)
|
||||
if user.admin? or ApplyProjectMaster.find(:all, :conditions => ["user_id = ? and apply_type = 'OpenSourceProject' and apply_id = ? and status = ?", user.id, self.id, 2]).present?
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def reset_counters!
|
||||
self.class.reset_counters!(id)
|
||||
end
|
||||
|
||||
def self.reset_counters!(id)
|
||||
osp_id = id.to_i
|
||||
update_all("topic_count = (SELECT COUNT(*) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id} AND parent_id IS NULL)," +
|
||||
" memo_count = (SELECT COUNT(*) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id} AND parent_id IS NOT NULL)," +
|
||||
" last_memo_id = (SELECT MAX(id) FROM #{RelativeMemo.table_name} WHERE osp_id=#{osp_id})",
|
||||
["id = ?", osp_id])
|
||||
end
|
||||
end
|
|
@ -38,7 +38,6 @@ class Project < ActiveRecord::Base
|
|||
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
|
||||
has_many :users, :through => :members
|
||||
has_many :principals, :through => :member_principals, :source => :principal
|
||||
|
||||
has_many :enabled_modules, :dependent => :delete_all
|
||||
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
|
||||
has_many :issues, :dependent => :destroy, :include => [:status, :tracker]
|
||||
|
@ -160,6 +159,17 @@ class Project < ActiveRecord::Base
|
|||
self.where('project_type = ?', 1)
|
||||
end
|
||||
|
||||
# 获取项目的资源类型列表
|
||||
def attachmenttypes
|
||||
@attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
|
||||
end
|
||||
|
||||
#自定义验证
|
||||
def validation
|
||||
if !class_period.match([0-9])
|
||||
errors.add_to_base("class period can only digital")
|
||||
end
|
||||
end
|
||||
|
||||
# 项目留言 added by fq
|
||||
def self.add_jour(user, notes)
|
||||
|
@ -726,7 +736,8 @@ class Project < ActiveRecord::Base
|
|||
'custom_fields',
|
||||
'tracker_ids',
|
||||
'issue_custom_field_ids',
|
||||
'project_type'
|
||||
'project_type',
|
||||
'attachmenttype'
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -233,7 +233,13 @@ class Query < ActiveRecord::Base
|
|||
# filter requires one or more values
|
||||
(values_for(field) and !values_for(field).first.blank?) or
|
||||
# filter doesn't require any value
|
||||
["o", "c", "!*", "*", "t", "ld", "w", "lw", "l2w", "m", "lm", "y"].include? operator_for(field)
|
||||
["o", "c", "!*", "*", "t", "ld", "w", "lw", "l2w", "m", "lm", "y"].include? operator_for(field) or
|
||||
|
||||
#gcm
|
||||
#subject could be null
|
||||
(field.eql?"subject")
|
||||
#gcmend
|
||||
|
||||
end if filters
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
class RelativeMemo < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :open_source_project, :class_name => "OpenSourceProject", :foreign_key => 'osp_id'
|
||||
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
|
||||
|
||||
has_many :tags, :through => :project_tags, :class_name => 'Tag'
|
||||
has_many :project_tags, :class_name => 'ProjectTags'
|
||||
|
||||
has_many :no_uses, :as => :no_use, :dependent => :delete_all
|
||||
|
||||
acts_as_taggable
|
||||
acts_as_attachable
|
||||
|
||||
validates_presence_of :osp_id, :subject
|
||||
#validates :content, presence: true
|
||||
# validates_length_of :subject, maximum: 50
|
||||
#validates_length_of :content, maximum: 3072
|
||||
validate :cannot_reply_to_locked_topic, :on => :create
|
||||
validates_uniqueness_of :osp_id, :scope => [:subject, :content]
|
||||
|
||||
acts_as_tree :counter_cache => :replies_count, :order => "#{RelativeMemo.table_name}.created_at ASC"
|
||||
acts_as_attachable
|
||||
belongs_to :last_reply, :class_name => 'RelativeMemo', :foreign_key => 'last_reply_id'
|
||||
# acts_as_searchable :column => ['subject', 'content'],
|
||||
# #:include => { :forum => :p}
|
||||
# #:project_key => "#{Forum.table_name}.project_id"
|
||||
# :date_column => "#{table_name}.created_at"
|
||||
|
||||
# acts_as_event :title => Proc.new {|o| "#{o.forum.name}: #{o.subject}"},
|
||||
# :datetime => :updated_at,
|
||||
# # :datetime => :created_at,
|
||||
# :description => :content,
|
||||
# :author => :author,
|
||||
# :type => Proc.new {|o| o.parent_id.nil? ? 'Memo' : 'Reply'},
|
||||
# :url => Proc.new {|o| {:controller => 'memos', :action => 'show', :forum_id => o.forum_id}.merge(o.parent_id.nil? ? {:id => o.id} : {:id => o.parent_id, :r => o.id, :anchor => "reply-#{o.id}"})}
|
||||
# acts_as_activity_provider :author_key => :author_id,
|
||||
# :func => 'memos',
|
||||
# :timestamp => 'created_at'
|
||||
|
||||
# :find_options => {:type => 'memos'}
|
||||
# acts_as_watchable
|
||||
|
||||
safe_attributes "author_id",
|
||||
"subject",
|
||||
"content",
|
||||
"osp_id",
|
||||
"last_memo_id",
|
||||
"lock",
|
||||
"sticky",
|
||||
"parent_id",
|
||||
"replies_count",
|
||||
"is_quote"
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!
|
||||
# after_update :update_memos_forum
|
||||
after_destroy :reset_counters!
|
||||
# after_create :send_notification
|
||||
# after_save :plusParentAndForum
|
||||
# after_destroy :minusParentAndForum
|
||||
|
||||
# scope :visible, lambda { |*args|
|
||||
# includes(:forum => ).where()
|
||||
# }
|
||||
|
||||
def cannot_reply_to_locked_topic
|
||||
errors.add :base, l(:label_memo_locked) if root.locked? && self != root
|
||||
end
|
||||
|
||||
# def update_memos_forum
|
||||
# if forum_id_changed?
|
||||
# Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id ])
|
||||
# Forum.reset_counters!(forum_id_was)
|
||||
# Forum.reset_counters!(forum_id)
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
scope :no_use_for, lambda { |user_id|
|
||||
{ :include => :no_uses,
|
||||
:conditions => ["#{NoUse.table_name}.user_id = ?", user_id] }
|
||||
}
|
||||
|
||||
def no_use_for?(user)
|
||||
self.no_uses.each do |no_use|
|
||||
if no_use.user_id == user.id
|
||||
return true
|
||||
end
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
def set_no_use(user, flag=true)
|
||||
flag ? set_filter(user) : remove_filter(user)
|
||||
end
|
||||
|
||||
def set_filter(user)
|
||||
self.no_uses << NoUse.new(:user => user)
|
||||
end
|
||||
|
||||
def remove_filter(user)
|
||||
return nil unless user && user.is_a?(User)
|
||||
NoUse.delete_all "no_use_type = '#{self.class}' AND no_use_id = #{self.id} AND user_id = #{user.id}"
|
||||
end
|
||||
|
||||
def reset_counters!
|
||||
if parent && parent.id
|
||||
RelativeMemo.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
|
||||
parent.update_attribute(:updated_at, Time.now)
|
||||
end
|
||||
# forum.reset_counters!
|
||||
end
|
||||
|
||||
def sticky?
|
||||
sticky == 1
|
||||
end
|
||||
|
||||
def replies
|
||||
RelativeMemo.where("parent_id = ?", id)
|
||||
end
|
||||
|
||||
def locked?
|
||||
self.lock
|
||||
end
|
||||
|
||||
def editable_by? user
|
||||
# user && user.logged? || (self.author == usr && usr.allowed_to?(:edit_own_messages, project))
|
||||
user.admin?
|
||||
end
|
||||
|
||||
# def destroyable_by? user
|
||||
# (user && user.logged? && (Forum.find(self.forum_id).creator_id == user.id) ) || user.admin?
|
||||
# #self.author == user || user.admin?
|
||||
# end
|
||||
|
||||
def deleted_attach_able_by? user
|
||||
(user && user.logged? && (self.author == user) ) || user.admin?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
Watcher.create(:watchable => self.root, :user => author)
|
||||
end
|
||||
|
||||
def send_notification
|
||||
if Setting.notified_events.include?('message_posted')
|
||||
Mailer.message_posted(self).deliver
|
||||
end
|
||||
end
|
||||
|
||||
# def plusParentAndForum
|
||||
# @forum = Forum.find(self.forum_id)
|
||||
# @forum.memo_count = @forum.memo_count.to_int + 1
|
||||
# @forum.last_memo_id = self.id
|
||||
# if self.parent_id
|
||||
# @parent_memo = Memo.find_by_id(self.parent_id)
|
||||
# @parent_memo.last_reply_id = self
|
||||
# @parent_memo.replies_count = @parent_memo.replies_count.to_int + 1
|
||||
# @parent_memo.save
|
||||
# else
|
||||
# @forum.topic_count = @forum.topic_count.to_int + 1
|
||||
# end
|
||||
# @forum.save
|
||||
# end
|
||||
|
||||
# def minusParentAndForum
|
||||
# @forum = Forum.find(self.forum_id)
|
||||
# @forum.memo_count = @forum.memo_count.to_int - 1
|
||||
# @forum.memo_count = 0 if @forum.memo_count.to_int < 0
|
||||
# # @forum.last_memo_id = Memo.reorder('created_at ASC').find_all_by_forum_id(self.forum_id).last.id
|
||||
# if self.parent_id
|
||||
# @parent_memo = Memo.find_by_id(self.parent_id)
|
||||
# # @parent_memo.last_reply_id = Memo.reorder('created_at ASC').find_all_by_parent_id(self.parent_id).last.id
|
||||
# @parent_memo.replies_count = @parent_memo.replies_count.to_int - 1
|
||||
# @parent_memo.replies_count = 0 if @parent_memo.replies_count.to_int < 0
|
||||
# @parent_memo.save
|
||||
# else
|
||||
# @forum.topic_count = @forum.topic_count.to_int - 1
|
||||
# @forum.topic_count = 0 if @forum.topic_count.to_int < 0
|
||||
# end
|
||||
# @forum.save
|
||||
# end
|
||||
end
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<%= form_for(@apply_project_master) do |f| %>
|
||||
<% if @apply_project_master.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@apply_project_master.errors.count, "error") %> prohibited this apply_project_master from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @apply_project_master.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,2 @@
|
|||
<% selector = ".#{apply_css(objects)}" %>
|
||||
$("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript apply_super_user(objects, user) %>")});
|
|
@ -0,0 +1,6 @@
|
|||
<h1>Editing apply_project_master</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @apply_project_master %> |
|
||||
<%= link_to 'Back', apply_project_masters_path %>
|
|
@ -0,0 +1,21 @@
|
|||
<h1>Listing apply_project_masters</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @apply_project_masters.each do |apply_project_master| %>
|
||||
<tr>
|
||||
<td><%= link_to 'Show', apply_project_master %></td>
|
||||
<td><%= link_to 'Edit', edit_apply_project_master_path(apply_project_master) %></td>
|
||||
<td><%= link_to 'Destroy', apply_project_master, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New Apply project master', new_apply_project_master_path %>
|
|
@ -0,0 +1,5 @@
|
|||
<h1>New apply_project_master</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', apply_project_masters_path %>
|
|
@ -0,0 +1,5 @@
|
|||
<p id="notice"><%= notice %></p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_apply_project_master_path(@apply_project_master) %> |
|
||||
<%= link_to 'Back', apply_project_masters_path %>
|
|
@ -1,5 +1,6 @@
|
|||
<h3><%=l(:label_attachment_new)%></h3>
|
||||
<% versions = project.versions.sort %>
|
||||
<% attachmenttypes = project.attachmenttypes %>
|
||||
<%= error_messages_for 'attachment' %>
|
||||
<%= form_tag(project_files_path(project), :multipart => true, :class => "tabular") do %>
|
||||
<div class="box">
|
||||
|
@ -10,6 +11,14 @@
|
|||
options_from_collection_for_select(versions, "id", "name") %></p>
|
||||
<% end %>
|
||||
|
||||
<% if attachmenttypes.any? %>
|
||||
<p> <label for="attachment_type"><%=l(:attachment_type)%></label>
|
||||
<%= select_tag "attachment_type", content_tag('option', '') +
|
||||
options_from_collection_for_select(attachmenttypes, "id",
|
||||
"typeName") %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
|
|
|
@ -174,6 +174,8 @@ div.pagination{
|
|||
|
||||
|
||||
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||
|
||||
|
||||
<table class="list files" id="ver-zebra" >
|
||||
<colgroup>
|
||||
<col class="vzebra-odd" />
|
||||
|
@ -233,7 +235,7 @@ div.pagination{
|
|||
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
||||
|
||||
<script type='text/javascript';>
|
||||
<script type='text/javascript'>
|
||||
var slideHeight = 29;
|
||||
function readmore (aNode) {
|
||||
// console.log(aNode)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<h3><%=l(:label_attachment_new)%></h3>
|
||||
<% versions = project.versions.sort %>
|
||||
<% attachmenttypes = project.attachmenttypes %>
|
||||
<%= error_messages_for 'attachment' %>
|
||||
<%= form_tag(project_files_path(project), :multipart => true, :class => "tabular") do %>
|
||||
<div class="box">
|
||||
|
||||
<% if versions.any? %>
|
||||
<p><label for="version_id"><%=l(:field_version)%></label>
|
||||
<%= select_tag "version_id", content_tag('option', '') +
|
||||
options_from_collection_for_select(versions, "id", "name") %></p>
|
||||
<% end %>
|
||||
|
||||
<% if attachmenttypes.any? %>
|
||||
<p> <label for="attachment_type"><%=l(:attachment_type)%></label>
|
||||
<%= select_tag "attachment_type", content_tag('option', '') +
|
||||
options_from_collection_for_select(attachmenttypes, "id",
|
||||
"typeName") %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<% end %>
|
||||
<div class="line_under" style="margin:20px 0px;"></div>
|
|
@ -5,7 +5,7 @@
|
|||
<% if memos.any? %>
|
||||
<% memos.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<tr><td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
|
||||
<tr><td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%></td>
|
||||
<td>
|
||||
<table width="630px" border="0">
|
||||
<tr>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<% if @issue.safe_attribute? 'tracker_id' %>
|
||||
<p><%= f.select :tracker_id, @issue.project.trackers.collect {|t| [t.name, t.id]}, {:required => true},
|
||||
:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
<span class="footer_text_link"><%= link_to "计算机科学与技术系", "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %></span>
|
||||
<span id="copyright">版权@2007~2014</span>
|
||||
<span id="contact_us" class="footer_text_link"><%= link_to "联系我们","http://forge.trustie.net/projects/2/member", :target=>"_blank" %></span>
|
||||
<span id="record"class="footer_text_link"><%= link_to "湘ICP备09019772","http://www.miibeian.gov.cn/"%></span>
|
||||
<span id="record"class="footer_text_link"><%= link_to "湘ICP备09019772","http://www.miibeian.gov.cn/", :target => "_blank" %></span>
|
||||
|
||||
</p>
|
||||
<div id="logo_link">
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>"国防科学技术大学计算机学院"),"http://www.nudt.edu.cn/special.asp?classid=12"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>"北京大学信息科学技术学院软件研究所"), "http://eecs.pku.edu.cn"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>"北京航空航天大学计算机学院"), "http://scse.buaa.edu.cn/"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>"中国科学院软件研究所"), "http://www.iscas.ac.cn"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>"山东中创软件商用中间件股份有限公司"), "http://www.inforbus.com"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>"国防科学技术大学计算机学院"),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>"北京大学信息科学技术学院软件研究所"), "http://eecs.pku.edu.cn", :target => "_blank" %></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>"北京航空航天大学计算机学院"), "http://scse.buaa.edu.cn/", :target => "_blank" %></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>"中国科学院软件研究所"), "http://www.iscas.ac.cn", :target => "_blank" %></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>"山东中创软件商用中间件股份有限公司"), "http://www.inforbus.com", :target => "_blank" %></span>
|
||||
</div>
|
||||
<!--gcm-->
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf">创新竞赛社区</td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="300px">
|
||||
<td rowspan="2" width="305px">
|
||||
<div class="project-search" style="float: right">
|
||||
<%= text_field_tag 'name', params[:name], :size => 25 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
<% @nav_dispaly_project_label = 1 %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<!--add by huang-->
|
||||
<body class="<%= h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%= render :partial => 'layouts/base_header'%>
|
||||
<div id="main">
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf">开源项目社区</td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><%= link_to request.host()+"/open_source_projects", :controller => 'open_source_projects', :action => 'index' %></td>
|
||||
<td ><%= link_to l(:field_homepage), home_path %> > <%= link_to "开源项目社区", :controller => 'open_source_projects', :action => 'index' %> > <%=link_to @open_source_project.name, open_source_project_path(@open_source_project) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="sidebar">
|
||||
<div class="spaceleft">
|
||||
<div class="inf_user_image">
|
||||
<% @open_source_project = OpenSourceProject.find(params[:open_source_project_id] || params[:id])%>
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= image_tag('../images/avatars/Project/0', :class => 'avatar2') %></td>
|
||||
<td>
|
||||
<div class="info-course">
|
||||
<%= @open_source_project.name %>
|
||||
</div><div>
|
||||
|
||||
</div>
|
||||
<div style="margin-left: 20px;">
|
||||
<%= apply_super_user(@open_source_project, User.current) %>
|
||||
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="user_fans">
|
||||
<table width="240" border="0">
|
||||
<tr align="center" width="80px">
|
||||
<td class="font_index"><%= @open_source_project.users_count %></td>
|
||||
<td class="font_index"><%= @open_source_project.topics.count %></td>
|
||||
<td class="font_index"><%= @open_source_project.commit_count %></td>
|
||||
</tr>
|
||||
|
||||
<tr class="font_aram">
|
||||
<td align="center" width="70px"> 贡献者</td>
|
||||
<td align="center" width="100px">讨论</td>
|
||||
<td align="center" width="70px"> 代码提交</td>
|
||||
<!-- <td align="center" width="58px"><%= l(:label_attachment) %></td> -->
|
||||
</tr>
|
||||
</table>
|
||||
<div class="user_underline"></div>
|
||||
</div>
|
||||
|
||||
<div class="inf_user_context">
|
||||
<div class="font_title_left">
|
||||
<%= l(:label_project_overview) %>
|
||||
</div>
|
||||
|
||||
<div style="padding-bottom: 8px">
|
||||
<div class="font_lighter_sidebar">
|
||||
<%= textilizable @open_source_project.description %>
|
||||
</div>
|
||||
<div class="created_on_project">
|
||||
<strong style="color: #15bccf"><%= l(:label_create_time) %>:</strong><%= format_time(@open_source_project.created_at) %>
|
||||
</div>
|
||||
<div class="created_on_project">
|
||||
<strong style="color: #15bccf"> 项目来源:</strong><%= link_to @open_source_project.url, @open_source_project.url %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
</div>
|
||||
<!--tags-->
|
||||
|
||||
<div class="user_fans">
|
||||
<!-- added by william -for tag -->
|
||||
<div class="user_tags">
|
||||
<div id="tags">
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => @open_source_project, :object_flag => "8"}%>
|
||||
</div>
|
||||
</div>
|
||||
<!-- tag -->
|
||||
</div>
|
||||
|
||||
<!--tool-->
|
||||
<% if @open_source_project.admin?(User.current) %>
|
||||
<div class="user_underline"></div>
|
||||
<div class="font_title_left">
|
||||
管理
|
||||
</div>
|
||||
|
||||
<div class="tools ">
|
||||
<ul>
|
||||
<li>
|
||||
<%= link_to "版主申请" ,master_apply_open_source_project_path(@open_source_project) %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!--tool-->
|
||||
<div class="user_underline"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<%#= <div class="tabs_new">
|
||||
|
||||
</div>%>
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -108,22 +108,23 @@
|
|||
<!-- added by Wen -->
|
||||
|
||||
|
||||
<p style="width:357px;padding-left: 26px;">
|
||||
<p style="padding-left: 26px;">
|
||||
<% unless User.current.user_extensions.school.nil? %>
|
||||
<%= l(:field_occupation) %> <span class="required">*</span><%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province, User.current.user_extensions.school.province), :onclick => "get_options(this.value)" %>
|
||||
|
||||
<%= l(:field_occupation) %> <span class="required">*</span>
|
||||
|
||||
<input id="province" name="province" type="text" value="<%=User.current.user_extensions.school.province%>" readonly />
|
||||
<input id="occupation" name="occupation" type="hidden" value="<%=User.current.user_extensions.school.id%>" />
|
||||
<input id="occupation_name" type="text" value="<%=User.current.user_extensions.school.name%>" readonly />
|
||||
|
||||
|
||||
|
||||
|
||||
<!--<%= select_tag "occupation",
|
||||
options_for_select([[User.current.user_extensions.school.name, User.current.user_extensions.school.id]]) %>-->
|
||||
<% else %>
|
||||
<%= l(:field_occupation) %> <span class="required">*</span><%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), :onclick => "get_options(this.value)" %>
|
||||
|
||||
<%= l(:field_occupation) %> <span class="required">*</span>
|
||||
<input id="province" name="province" type="text" value="请单击选择省份及学校" readonly >
|
||||
<input id="occupation" name="occupation" type="hidden" />
|
||||
<input id="occupation_name" type="text" readonly />
|
||||
|
||||
<% end %>
|
||||
<!-- <input id="occupation" readonly />-->
|
||||
</p>
|
||||
|
@ -131,6 +132,18 @@
|
|||
<div id="WOpenWindow">
|
||||
<a class="modal_close" href="#"></a>
|
||||
<h2>学校列表</h2>
|
||||
<div class="pcontent">
|
||||
<ul id="provincelist" class="school_list">
|
||||
<% @ss = School.find_by_sql("select distinct province from schools") %>
|
||||
<% @ss.each do |s| %>
|
||||
<li style="width: 15%; float: left;">
|
||||
<a style="cursor: pointer;" onclick = "get_options('<%= s.province %>')"><%= s.province %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="content" style="font-size: 13px">
|
||||
<ul id="schoollist" class="school_list">
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<%= form_for(@no_use) do |f| %>
|
||||
<% if @no_use.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@no_use.errors.count, "error") %> prohibited this no_use from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @no_use.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,2 @@
|
|||
<% selector = ".#{no_use_css(objects)}" %>
|
||||
$("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript no_use_link(objects, user) %>")});
|
|
@ -0,0 +1,6 @@
|
|||
<h1>Editing no_use</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @no_use %> |
|
||||
<%= link_to 'Back', no_uses_path %>
|
|
@ -0,0 +1,21 @@
|
|||
<h1>Listing no_uses</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @no_uses.each do |no_use| %>
|
||||
<tr>
|
||||
<td><%= link_to 'Show', no_use %></td>
|
||||
<td><%= link_to 'Edit', edit_no_use_path(no_use) %></td>
|
||||
<td><%= link_to 'Destroy', no_use, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New No use', new_no_use_path %>
|
|
@ -0,0 +1,5 @@
|
|||
<h1>New no_use</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', no_uses_path %>
|
|
@ -0,0 +1,5 @@
|
|||
<p id="notice"><%= notice %></p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_no_use_path(@no_use) %> |
|
||||
<%= link_to 'Back', no_uses_path %>
|
|
@ -0,0 +1,21 @@
|
|||
<%= form_for(@open_source_project) do |f| %>
|
||||
<% if @open_source_project.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@open_source_project.errors.count, "error") %> prohibited this open_source_project from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @open_source_project.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :String %><br />
|
||||
<%= f.text_field :String %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,68 @@
|
|||
<style>
|
||||
.information .stats a{
|
||||
width: 80px;
|
||||
text-align: right;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
font-style: 1.2em;
|
||||
}
|
||||
.information .stats span{
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
<div class="project-block">
|
||||
<div class="img-tag">
|
||||
<%= image_tag('../images/avatars/Project/0', :class => 'avatar2') %>
|
||||
</div>
|
||||
<div class="wiki-description">
|
||||
<p>
|
||||
<%= textilizable(project.short_description, :project => project) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="information">
|
||||
<p class="stats">
|
||||
<%= link_to project.users_count %>
|
||||
<%= content_tag('span', l(:label_x_follow_people,:count =>0)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%=link_to 1%>
|
||||
<%= content_tag('span', l(:label_x_current_contributors, :count => 0)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%=link_to project.commit_count %>
|
||||
<%= content_tag('span', l(:label_since_last_commits)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%=link_to project.code_line %>
|
||||
<%= content_tag('span', "行代码") %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="add-info">
|
||||
<div class="main-language">
|
||||
|
||||
<%= content_tag('span', "#{l(:default_role_manager)}: ") %>
|
||||
|
||||
</div>
|
||||
<div class="licences">
|
||||
<%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(project.created_at)) %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="url">
|
||||
<div class="main-language">
|
||||
<%= content_tag('span', "项目来源:")%><%= link_to project.url, project.url %>
|
||||
</div>
|
||||
<div class="licences">
|
||||
<%= content_tag('span', "数据更新时间:") %><%= content_tag('span', project.date_collected) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tags">
|
||||
<div id="tags">
|
||||
<%= image_tag( "/images/sidebar/tags.png") %>
|
||||
<%= render :partial => 'tags/tag_name', :locals => {:obj => project,:object_flag => "8",:non_list_all => true }%>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,67 @@
|
|||
<!-- added by fq -->
|
||||
<!--display the board-->
|
||||
<div class="borad-topic-count">
|
||||
共有 <%= link_to memos.count %> 个贴子
|
||||
</div>
|
||||
<div style="padding-top: 10px">
|
||||
<% if memos.any? %>
|
||||
<% memos.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%>
|
||||
<%= image_tag('../images/avatars/User/0', :class => "avatar") unless topic.author%> </td>
|
||||
<td>
|
||||
<table width="630px" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="500px" class="<%= topic.sticky ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), open_source_project_relative_memo_path(topic.open_source_project, topic) %></td>
|
||||
<td align="right" rowspan="3">
|
||||
<table class="borad-count">
|
||||
<tr>
|
||||
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), open_source_project_relative_memo_path(topic.open_source_project, topic) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">回答</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
<td align="right" rowspan="3">
|
||||
<table class="borad-count">
|
||||
<tr>
|
||||
<td align="center" class="borad-count-digit"><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(topic.open_source_project, topic) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">浏览</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" ><span class="font_description"> </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2" ><span class="font_lighter"><%#= authoring topic.created_at, topic.author %>
|
||||
<br />
|
||||
</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2" ><span class="font_lighter">帖子来源:<%= link_to topic.url, topic.url%> </span></td>
|
||||
<td align="left"><%= no_use_link(topic, User.current) %> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2"> <%= image_tag( "/images/sidebar/tags.png") %>
|
||||
<%= render :partial => 'tags/tag_name', :locals => {:obj => topic,:object_flag => "9",:non_list_all => true }%> </td>
|
||||
</tr>
|
||||
|
||||
</table></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<% end %>
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @topic_pages, @topic_count %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,6 @@
|
|||
<h1>Editing open_source_project</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @open_source_project %> |
|
||||
<%= link_to 'Back', open_source_projects_path %>
|
|
@ -0,0 +1,241 @@
|
|||
<div class="top-content">
|
||||
<%= form_tag(:controller => 'open_source_projects', :action => "search", :method => :get) do %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf">开源项目社区</td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td rowspan="2"></td>
|
||||
<td rowspan="2" >
|
||||
<div class="project-search" style="float: right">
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/open_source_projects", :controller => 'open_source_projects', :action => 'index' %> </a></td>
|
||||
<td ><%= link_to l(:field_homepage), home_path %> > <%= link_to "开源项目社区", :controller => 'open_source_projects', :action => 'index' %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.tb-navigation {
|
||||
position: relative;
|
||||
z-index: 400;
|
||||
}
|
||||
blockquote, body, button, code, dd, div, dl, dt, fieldset, form, h1, h2, h3, h4, h5, h6, input, legend, li, ol, p, pre, td, textarea, th, ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.navigation {
|
||||
color: #666;
|
||||
border: 2px solid #d7d6d6;
|
||||
}
|
||||
|
||||
.nav-switch {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
border-width: 14px;
|
||||
border-color: #bdbdbd #bdbdbd transparent transparent;
|
||||
border-style: solid solid dashed dashed;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.navigation .nav-switch-icon {
|
||||
background-position: -266px 3px;
|
||||
}
|
||||
.navigation .icon-search, .navigation .nav-pill-cancle, .navigation .nav-switch-icon, .navigation .nav-topbar .topbar-search .topbar-submit, .navigation .nav-topbar-arror {
|
||||
background: url();
|
||||
}
|
||||
.nav-switch-icon {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
position: absolute;
|
||||
top: -13px;
|
||||
right: -13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.nav-topbar, .type-min {
|
||||
position: relative;
|
||||
}
|
||||
.nav-category-group {
|
||||
clear: both;
|
||||
}
|
||||
.nav-topbar {
|
||||
background-color: #f5f4f4;
|
||||
border-bottom: 1px solid #e4e4e4;
|
||||
z-index: 4;
|
||||
}
|
||||
.nav-topbar .nav-topbar-content {
|
||||
line-height: 36px;
|
||||
padding: 0 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.nav-topbar-content {
|
||||
margin: 0 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
ul, menu, dir {
|
||||
display: block;
|
||||
list-style-type: disc;
|
||||
-webkit-margin-before: 1em;
|
||||
-webkit-margin-after: 1em;
|
||||
-webkit-margin-start: 0px;
|
||||
-webkit-margin-end: 0px;
|
||||
-webkit-padding-start: 40px;
|
||||
}
|
||||
.nav-topbar .nav-topbar-content {
|
||||
line-height: 36px;
|
||||
}
|
||||
li {
|
||||
margin-right: 7px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.type-line{
|
||||
overflow: hidden;
|
||||
}
|
||||
.nav-category-group{
|
||||
clear: both;
|
||||
}
|
||||
.type-line .nav-category{
|
||||
clear: both;
|
||||
position: relative;
|
||||
padding: 0 100px 0 107px;
|
||||
height: 20px;
|
||||
overflow: hidden;
|
||||
margin-top: 11px;
|
||||
margin-bottom: 11px;
|
||||
}
|
||||
.nav-category h4{
|
||||
position: absolute;
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
left: 22px;
|
||||
top: 0;
|
||||
overflow: hidden;
|
||||
max-width: 68px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
padding-right: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
.nav-search-con{
|
||||
padding-top: 7px;
|
||||
}
|
||||
</style>
|
||||
<%#======================================================================box before%>
|
||||
<div class="tb-navigation" data-spm="a230r.1.3">
|
||||
<div class="navigation">
|
||||
<div class="nav-switch">
|
||||
<a href="javascript:(function (){$('.nav-content').toggle();})();">
|
||||
<div class="nav-switch-icon J_Switch" trace="navHideButton" title="收起导航">
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="nav-container">
|
||||
<div data-group="nav-topbar">
|
||||
<div class="nav-topbar-content">
|
||||
<ul>
|
||||
<li class="nav-search-con">查找条件><span class="nav-topbar-arror"></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="topbar-search J_TopbarSearch">
|
||||
<%= show_condition(@app_dir, @language, @created_at, params[:name]) %>
|
||||
</span>
|
||||
</li>
|
||||
<li class="nav-search-con">共 <span class="h"><%= @os_project_count %></span> 个开源项目</li>
|
||||
<!-- <li class="related-count"><a href="/search?q=iphone&app=vproduct&vlist=1&from_combo=true">8款相关产品</a></li> -->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="nav-category-panel"></div>
|
||||
</div>
|
||||
<div class="nav-content">
|
||||
<!-- 推荐属性-->
|
||||
<div class="nav-category-group type-line" data-group="type-line">
|
||||
<div class="nav-category ">
|
||||
<h4 title="网络类型">应用方向<span>:</span></h4>
|
||||
<%= link_to "操作系统相关", open_source_projects_path(:app_dir => "操作系统相关", :language => @language, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "管理和监控", open_source_projects_path(:app_dir => "管理和监控", :language => @language, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "游戏/娱乐", open_source_projects_path(:app_dir => "游戏/娱乐", :language => @language, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "应用工具", open_source_projects_path(:app_dir => "应用工具", :language => @language, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "数据库相关", open_source_projects_path(:app_dir => "数据库相关", :language => @language, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "服务器软件", open_source_projects_path(:app_dir => "服务器软件", :language => @language, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "网站系统", open_source_projects_path(:app_dir => "网站系统", :language => @language, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "插件和扩展", open_source_projects_path(:app_dir => "插件和扩展", :language => @language, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<span class="arrow arrow-bottom"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="nav-category ">
|
||||
<h4 title="网络类型">开发语言<span>:</span></h4>
|
||||
<%= link_to "JAVA", open_source_projects_path(:language => "JAVA", :app_dir => @app_dir, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "C++", open_source_projects_path(:language => "c++", :app_dir => @app_dir, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "C", open_source_projects_path(:language => "c", :app_dir => @app_dir, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "C#", open_source_projects_path(:language => "c#", :app_dir => @app_dir, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "ruby", open_source_projects_path(:language => "ruby", :app_dir => @app_dir, :created_at => @created_at, :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%#= link_to "其他", open_source_projects_path(:language => "其他", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
|
||||
<span class="arrow arrow-bottom"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="nav-category ">
|
||||
<h4 title="网络类型">创立时间<span>:</span></h4>
|
||||
<%= link_to "2014", open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => "2014", :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "2013", open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => "2013", :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "2012", open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => "2012", :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "2011", open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => "2011", :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "2010", open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => "2010", :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
<%= link_to "更早", open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => "更早", :name => params[:name]), :class => "nav-more J_More show" %>
|
||||
|
||||
<span class="arrow arrow-bottom"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav-category-group type-block" data-group="type-block">
|
||||
<div class="nav-flexbox ">
|
||||
</div>
|
||||
<div class="nav-flexbox ">
|
||||
</div>
|
||||
<div class="nav-flexbox last">
|
||||
<div class="nav-category">
|
||||
<h4 title="上市时间">
|
||||
<div class="nav-category-wrap ">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%#======================================================================box after%>
|
||||
|
||||
<div id="projects-index">
|
||||
|
||||
<ul class='projects'>
|
||||
<% @open_source_projects.each do |project| %>
|
||||
<li class='project-table'>
|
||||
<div class = 'root'>
|
||||
<%= link_to project.name, open_source_project_path(project), :class=>"project root leaf"%>
|
||||
<span style="float: right;"></span>
|
||||
<%= render :partial => 'open_source_projects/os_project', :locals => {:project => project}%>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @os_project_pages, @os_project_count %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<!-- added by bai -->
|
||||
<div class="autoscroll">
|
||||
<% for user in @applicants -%>
|
||||
<% unless user.id == 1%>
|
||||
<!-- added by bai -->
|
||||
<% messages_count = user.messages.count %>
|
||||
<% messages_score = messages_count * 0.05%>
|
||||
<% finall_messages_score = messages_score %>
|
||||
|
||||
<% journals_count = user.journals.count %>
|
||||
<% journals_score = journals_count * 0.1 %>
|
||||
<% user_changesets_count = user.changesets.count %>
|
||||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
<% journals_for_messages_count = user.journals_for_messages.count %>
|
||||
<% activities_count = user.activities.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
<% finall_activity_score = journals_for_messages_score + activities_score %>
|
||||
|
||||
<% news_count = user.news.count %>
|
||||
<% news_score = news_count * 0.1 %>
|
||||
<% wiki_contents_count = user.wiki_contents.count %>
|
||||
<% wiki_contents_score = wiki_contents_count * 0.1 %>
|
||||
<% comments_count = user.comments.count %>
|
||||
<% comments_score = comments_count * 0.1 %>
|
||||
<% finall_influence_score = news_score + wiki_contents_score + comments_score %>
|
||||
<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
|
||||
<!-- end -->
|
||||
<div class="well">
|
||||
|
||||
<%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %>
|
||||
<%= image_tag "/images/time_member.png", :class => "img_member_time"%>
|
||||
|
||||
<div>
|
||||
<%= image_tag(url_to_avatar(user), :class => 'avatar') %>
|
||||
<%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %>
|
||||
|
||||
<!-- modified by bai -->
|
||||
<div style="position:relative;float:left;margin-top:-2px;margin-left: 160px">
|
||||
<%= l(:label_user_grade) %>: <span style="color:#ec6300"> <%= link_to( format("%.2f" , finall_user_score).to_f, {:controller => 'users',
|
||||
:action => 'show_score',
|
||||
:remote => true,
|
||||
:id => user.id},
|
||||
:style=>"color: #EC6300;") %></span>
|
||||
</div>
|
||||
<!-- end -->
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 20px;margin-left:66px">
|
||||
<%= l(:label_x_has_fans,:count=>user.watcher_users.count)%>
|
||||
<%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %>
|
||||
|
||||
</div>
|
||||
<div class="user-bottom">
|
||||
<% unless user.memberships.empty? %>
|
||||
<% cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1" %>
|
||||
<% memberships = user.memberships.all(:conditions => cond) %>
|
||||
<%= l(:label_x_contribute_to, :count => memberships.count) %>
|
||||
<% for member in memberships %>
|
||||
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<% unless user.memberships.empty? %>
|
||||
<% cond = Project.visible_condition(User.current) + "AND projects.project_type = 1" %>
|
||||
<% memberships = user.memberships.all(:conditions => cond) %>
|
||||
<%= l(:label_x_course_contribute_to, :count => memberships.count) %>
|
||||
<% for member in memberships %>
|
||||
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<%= user.changesets.count == 0 ? '' : "#{l(:label_x_total_commit, :count => user.changesets.count)}" %>
|
||||
<%= link_to "同意申请", {:controller => 'open_source_projects', :action => 'accept_master_apply', :id => @open_source_project.id, :user_id => user.id}%>
|
||||
<%= link_to "拒绝申请", {:controller => 'open_source_projects', :action => 'refuse_master_apply', :id => @open_source_project.id, :user_id => user.id}%>
|
||||
</div>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<h1>New open_source_project</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', open_source_projects_path %>
|
|
@ -0,0 +1,54 @@
|
|||
<!-- added by fq -->
|
||||
<div id="add-memo" class='lz' style="display: none; padding: 20px;">
|
||||
<h3><%=l(:label_memo_new)%></h3>
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for(@memo, :url => open_source_project_relative_memos_path(@open_source_project), :html => {:multipart => true} ) do |f| %>
|
||||
<% if @memo.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @memo.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="actions" style="max-width:680px">
|
||||
<p><%= f.text_field :subject, :required => true%></p>
|
||||
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>
|
||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>
|
||||
<br/>
|
||||
<p>
|
||||
<%#= l(:label_attachment_plural) %><br />
|
||||
<%#= render :partial => 'attachments/form', :locals => {:container => @memo} %>
|
||||
</p>
|
||||
<%= f.submit :value => l(:label_memo_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--modified by huang-->
|
||||
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
|
||||
<span>
|
||||
<%= link_to l(:label_memo_new_from_forum), new_open_source_project_relative_memo_path(@open_source_project), :class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
|
||||
</span>
|
||||
|
||||
<div class="contextual-borad">
|
||||
<%#= link_to(
|
||||
image_tag('edit.png')+l(:label_forum_edit),
|
||||
{:action => 'edit', :id => @forum},
|
||||
:method => 'get',
|
||||
:title => l(:button_edit)
|
||||
) if @forum.editable_by?(User.current) %>
|
||||
<%#= link_to(
|
||||
image_tag('delete.png')+'删除讨论区',
|
||||
{:action => 'destroy', :id => @forum},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @forum.destroyable_by?(User.current) %>
|
||||
</div>
|
||||
<%= render :partial => 'open_source_projects/show_topics', :locals => {:memos => @memos} %>
|
|
@ -52,7 +52,7 @@
|
|||
<!--gcm-->
|
||||
<p class="stats">
|
||||
|
||||
<%= content_tag('span', link_to("#{@project_activity_count[@project.id]}", member_project_path(@project)), :class => "info") %>
|
||||
<%= content_tag('span', link_to("#{@project_activity_count[@project.id]}", project_path(@project)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_activity, :count => @project_activity_count[@project.id])) %>
|
||||
</p>
|
||||
<!--gcm-->
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<%= form_for(@mome_new, url: open_source_project_relative_memos_path, :html => {:multipart => true}) do |f| %>
|
||||
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
|
||||
<%= f.hidden_field :osp_id, :required => true, value: @memo.osp_id %>
|
||||
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
||||
<%= label_tag(l(:label_reply_plural)) %>:
|
||||
<!-- <p> < %= f.text_area :content, :required => true, :size => "75%", :resize => "none", id: 'editor01' %> </p> -->
|
||||
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %></p>
|
||||
|
||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
|
||||
<p><%#= l(:label_attachment_plural) %><br />
|
||||
<%#= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
<%= f.submit value: l(:label_reply_plural), class: "replies" %>
|
||||
<% end %>
|
|
@ -0,0 +1,164 @@
|
|||
<div class="lz">
|
||||
<div class="lz-left">
|
||||
<div class="">
|
||||
<% if @memo.author%>
|
||||
<%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %>
|
||||
<% else %>
|
||||
<%= image_tag('../images/avatars/User/0', :class => "avatar") %>
|
||||
<% end %></div>
|
||||
<p class=""><%=link_to @memo.author.name, user_path(@memo.author) if @memo.author%></p>
|
||||
</div>
|
||||
<div class="memo-section">
|
||||
<div class="contextual-borad">
|
||||
<!-- <%#= link_to(
|
||||
image_tag('comment.png'),
|
||||
{:action => 'quote', :id => @memo},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_quote)
|
||||
)if !@memo.locked? && User.current.logged? %> -->
|
||||
<%#= link_to(
|
||||
l(:button_quote),
|
||||
{:action => 'quote', :id => @memo},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_quote)
|
||||
)if !@memo.locked? && User.current.logged? %>
|
||||
|
||||
<%#= link_to(
|
||||
image_tag('edit.png'),
|
||||
{:action => 'edit', :id => @memo},
|
||||
:method => 'get',
|
||||
:title => l(:button_edit)
|
||||
) if @memo.editable_by?(User.current) %>
|
||||
<!-- <%#= link_to(
|
||||
image_tag('delete.png'),
|
||||
{:action => 'destroy', :id => @memo},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @memo.destroyable_by?(User.current) %> -->
|
||||
<%#= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => @memo},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @memo.destroyable_by?(User.current) %>
|
||||
</div>
|
||||
|
||||
<div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>"><%= label_tag l(:field_subject) %>: <%=h @memo.subject %></div>
|
||||
<div class="memo-content">
|
||||
<!-- < %= textilizable(@memo, :content) %> -->
|
||||
<%= raw @memo.content %>
|
||||
<p>
|
||||
<% if @memo.attachments.any?%>
|
||||
<% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %>
|
||||
<%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options} %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="memo-timestamp">
|
||||
<% if @memo.author %>
|
||||
<%= authoring @memo.created_at, @memo.author.name %>
|
||||
<% else %>
|
||||
<%= added_time @memo.created_at %>
|
||||
<% end %></div>
|
||||
<div class="tags">
|
||||
<div id="tags">
|
||||
<%= image_tag( "/images/sidebar/tags.png") %>
|
||||
<%= render :partial => 'tags/tag_name', :locals => {:obj => @memo,:object_flag => "9",:non_list_all => true }%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
<div class="replies">
|
||||
<h3 class="comments"><%= l(:label_reply_plural) %> (<%= @replies.nil? ? 0 : @replies.size %>)</h3>
|
||||
<% pages_count = @reply_pages.offset %>
|
||||
<% @replies.each do |reply| %>
|
||||
<div class="reply" id="<%= "reply-#{reply.id}" %>">
|
||||
<p class="font_lighter"><%= pages_count += 1 %>楼 :</p>
|
||||
<div class="contextual-borad">
|
||||
<!-- <%#= link_to(
|
||||
image_tag('comment.png'),
|
||||
{:action => 'quote', :id => reply},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_quote)
|
||||
)if !@memo.locked? && User.current.logged? %> -->
|
||||
<%#= link_to(
|
||||
l(:button_quote),
|
||||
{:action => 'quote', :id => reply},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_quote)
|
||||
)if !@memo.locked? && User.current.logged? %>
|
||||
|
||||
<%#= link_to(
|
||||
image_tag('edit.png'),
|
||||
{:action => 'edit', :id => reply},
|
||||
:title => l(:button_edit)
|
||||
) if reply.editable_by?(User.current) %>
|
||||
<!-- <%#= link_to(
|
||||
image_tag('delete.png'),
|
||||
{:action => 'destroy', :id => reply},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.destroyable_by?(User.current) %> -->
|
||||
<%#= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => reply},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.destroyable_by?(User.current) %>
|
||||
|
||||
</div>
|
||||
|
||||
<table class="borad-text-list">
|
||||
<tr>
|
||||
<td rowspan="3" valign="top" width="60px">
|
||||
<% if reply.author%>
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %>
|
||||
<% else %>
|
||||
<%= image_tag('../images/avatars/User/0', :class => "avatar") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="comments">
|
||||
<div class="reply_content" ><%=h reply.content.html_safe %></div>
|
||||
<!-- <div class="wiki">< %=h reply.content.html_safe %></div> -->
|
||||
<p>
|
||||
<% if reply.attachments.any?%>
|
||||
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
|
||||
<%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options} %>
|
||||
<% end %>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font_lighter" style="float:right">
|
||||
<% if reply.author %>
|
||||
<%= authoring reply.created_at, reply.author.name %>
|
||||
<% else %>
|
||||
<%= added_time reply.created_at %>
|
||||
<% end %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %></div>
|
||||
</div>
|
||||
|
||||
<% if User.current.login? %>
|
||||
<div class="reply-box" style="">
|
||||
<%= render :partial => 'relative_memos/reply_box' %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div style="font-size: 14px;margin:20px;">
|
||||
<%= l(:label_user_login_tips) %>
|
||||
<%= link_to l(:label_user_login_new), signin_path %>
|
||||
<hr/>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,4 +1,22 @@
|
|||
<% port = ":3000" if Rails.env.development? %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#province").html("<option value='0' selected = true style='display: none;'></option>");
|
||||
|
||||
$.ajax({
|
||||
type :"POST",
|
||||
url :'/school/get_province',
|
||||
data :'text',
|
||||
success: function(data){
|
||||
$("#province").append(data);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get_school(value){
|
||||
$.ajax({
|
||||
|
@ -50,14 +68,15 @@
|
|||
<a href="http://course.trustie.net<%=port%>">我的学校</a>
|
||||
</p>
|
||||
<ul>
|
||||
<li style="width: 40%; float: left">请选择省份:<%= select_tag "province",
|
||||
options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province),
|
||||
:onclick => "get_school(this.value)" %></li>
|
||||
<li style="width: 40%; float: left">请选择省份:
|
||||
<select id="province" name="province" onchange="get_school(this.value)"></select>
|
||||
</li>
|
||||
<li style="width: 50%; float: left"><input type="text" id="key_word" name="key_word" />
|
||||
<input type="button" class="enterprise" value="搜索" onclick="ssearch()"></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<div>
|
||||
<ul id="schoollist" style="line-height: 25px">
|
||||
|
||||
|
|
|
@ -1,37 +1,3 @@
|
|||
<!-- <h1>参赛应用</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>App type</th>
|
||||
<th>App type name</th>
|
||||
<th>Android min version available</th>
|
||||
<th>User</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @softapplications.each do |softapplication| %>
|
||||
<tr>
|
||||
<td><%= softapplication.name %></td>
|
||||
<td><%= softapplication.description %></td>
|
||||
<td><%= softapplication.app_type_id %></td>
|
||||
<td><%= softapplication.app_type_name %></td>
|
||||
<td><%= softapplication.android_min_version_available %></td>
|
||||
<td><%= softapplication.user_id %></td>
|
||||
<td><%= link_to 'Show', softapplication %></td>
|
||||
<td><%= link_to 'Edit', edit_softapplication_path(softapplication) %></td>
|
||||
<td><%= link_to 'Destroy', softapplication, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to '发布新应用', new_softapplication_path %> -->
|
||||
|
||||
|
||||
|
||||
<%=render :partial => 'layouts/base_softapplication_index_top_content'%>
|
||||
|
@ -48,10 +14,10 @@
|
|||
</div>
|
||||
<div class="avatar-4"; style="float: left; margin-top: 7px "><%= image_tag('/images/app1.png')%></div>
|
||||
<div style="float: left; width: 600px; padding-top: 6px; margin-left: 8px"><%= softapplication.description.truncate(95, omission: '...') %></div>
|
||||
<div style="float: left; width: 200px; margin-left: 70px; margin-top: -3px; line-height: 0.5em">
|
||||
<div style="float: left; width: 200px; margin-left: 70px; margin-top: -3px; ">
|
||||
<%contest = softapplication.contests.first%>
|
||||
<p>所属竞赛:<%= contest ? link_to(contest.name, show_softapplication_contest_path(contest) ) : '尚未加入竞赛'%></p>
|
||||
<p>所属类别:<%= softapplication.app_type_name %></p>
|
||||
<p>所属竞赛:<%= contest ? link_to(contest.name.truncate(10, omission: '...'), show_softapplication_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%></p>
|
||||
<p>所属类别:<%= softapplication.app_type_name.truncate(5, omission: '...') %></p>
|
||||
<p>系统支持:<%= softapplication.android_min_version_available %></p>
|
||||
</div>
|
||||
<div style="padding-left: 53px">
|
||||
|
|
|
@ -63,8 +63,9 @@
|
|||
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<div style="font-size: 15px;"><strong>应用得分:</strong></div>
|
||||
<!-- <div>打分总人数:<%= @softapplication.raters(:quality).count%></div> -->
|
||||
<div style="overflow: hidden">
|
||||
<div style="margin-left: 25%; float: left">
|
||||
<div style="margin-left: 15%; float: left">
|
||||
<div style="padding-left: 45px; padding-bottom: 5px">得分比例</div>
|
||||
<div>
|
||||
<% 100.step(20,-20) do |star| %>
|
||||
|
@ -83,11 +84,15 @@
|
|||
<div style="padding-left: 25px;">最终得分</div>
|
||||
<div style="padding-top: 3px"><%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></div>
|
||||
</div>
|
||||
<div style="float: left; padding-left: 100px; padding-top:35px ">
|
||||
<div>打分总人数</div>
|
||||
<div style="padding-left: 28px; padding-top: 1px; font-size: 25px; color: blue"><strong><%= @softapplication.raters(:quality).count%></strong></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<div style="height: 240px">
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<strong><div style="font-size: 15px">软件截图:</div></strong>
|
||||
<div class="softapplication-img" style="padding-top: 5px">
|
||||
<% @image_results.take(4).each do |attachment| %>
|
||||
|
@ -112,7 +117,8 @@
|
|||
</div> -->
|
||||
<div style="height: 50px">
|
||||
<div style="font-size: 15px"><strong>软件评论:</strong></div>
|
||||
<div style="padding-left: 210px">评分: <%= rating_for @softapplication, dimension: :quality, class: 'rateable div_inline' %></div>
|
||||
<div style="padding-left: 210px">评分: <%= rating_for @softapplication, dimension: :quality, class: 'rateable div_inline' %><span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span></div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--提示登录后对应用进行评价-->
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<div id="projects">
|
||||
<% if projects_results.size > 0 %>
|
||||
<hr />
|
||||
<% projects_results.each do |prj| %>
|
||||
<div>
|
||||
<p class="font_description2">
|
||||
<strong><%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "open_source_projects",:action => "show",:id => prj.id %></strong>
|
||||
<br />
|
||||
<strong><%= l(:label_tags_project_description) %></strong><%= prj.short_description %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="line_under"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -7,6 +7,8 @@
|
|||
5 代表是forum类型
|
||||
6 代表是Attachment类型
|
||||
7 代表是contest类型
|
||||
8 代表是OpenSourceProject类型
|
||||
9 代表是RelativeMemo类型
|
||||
#end%>
|
||||
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
|
||||
<% if object_flag == '3' %>
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
<% when show_flag == '7'%>
|
||||
<strong><%= l(:label_contest_innovate)%>(<%= @results_count %>)</strong>
|
||||
<%= render :partial => "show_contests",:locals => {:contests_results => contests_results}%>
|
||||
<% when show_flag == '8'%>
|
||||
<strong><%#= l(:label_attachment)%>
|
||||
开源项目:(<%= @results_count %>)</strong>
|
||||
<%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%>
|
||||
<% else %>
|
||||
<strong><%= l(:label_tags_all_objects)%></strong>
|
||||
<!-- 这里为显示搜有过滤结果预留了默认设置 -->
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
<%= l(:label_project_plural) %>(<%= @projects_tags_num %>) |
|
||||
<%= l(:label_user_plural) %>(<%= @users_tags_num %>) |
|
||||
<%= l(:label_tags_call)%>(<%= @bids_tags_num %>) |
|
||||
<%= l(:field_filename)%>(<%= @attachments_tags_num %>)
|
||||
<%= l(:field_filename)%>(<%= @attachments_tags_num %>) |
|
||||
开源项目(<%= @open_source_projects_num %>)
|
||||
<%= l(:label_tags_contest)%>(<%= @contests_tags_num %>) |
|
||||
</div>
|
||||
<div id="show_results">
|
||||
|
@ -35,6 +36,7 @@
|
|||
:forums_results => @forums_results,
|
||||
:attachments_results=> @attachments_results,
|
||||
:contests_results => @contests_results,
|
||||
:open_source_projects_results => @open_source_projects_results,
|
||||
:show_flag => @obj_flag}
|
||||
%>
|
||||
</div>
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
<% users = User.all%>
|
||||
<table>
|
||||
<tr>
|
||||
<th>name</th><th>C</th><th>I</th><th>S</th><th>filecount</th><th>issuecount</th><th>level</th>
|
||||
<th>id</th><th>name</th><th>C</th><th>I</th><th>S</th><th>filecount</th><th>issuecount</th><th>level</th><th>attachconut</th>
|
||||
</tr>
|
||||
<% users.each do |user| %>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td><%= user.id %></td>
|
||||
<td><%= user.lastname %><%= user.firstname %></td>
|
||||
<td><%= calculate_collaboration_count(user) %></td>
|
||||
<td><%= calculate_influence_count(user) %></td>
|
||||
|
@ -18,6 +19,7 @@
|
|||
<td><%= calculate_file(user) %></td>
|
||||
<td><%= calculate_issue(user) %></td>
|
||||
<td><%= calculate_level(user) %></td>
|
||||
<td><%= calculate_attachments(user) %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
<div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;">
|
||||
<!-- <%= link_to(contest.name, contest.event_url, :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> -->
|
||||
<%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
|
||||
<span class="font_lighter">(<span style="font-size: 17px"><%= link_to("含#{contest.contesting_softapplications.count}个app", show_softapplication_contest_path(contest), :target => "_blank") %></span>)</span>
|
||||
</div>
|
||||
|
||||
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;">
|
||||
|
|
|
@ -132,6 +132,7 @@ en:
|
|||
|
||||
actionview_instancetag_blank_option: Please select
|
||||
|
||||
attachment_type: 'Attachment Type'
|
||||
general_text_No: 'No'
|
||||
general_text_Yes: 'Yes'
|
||||
general_text_no: 'no'
|
||||
|
|
|
@ -140,6 +140,7 @@ zh:
|
|||
|
||||
actionview_instancetag_blank_option: 请选择
|
||||
|
||||
attachment_type: '资源分类'
|
||||
general_text_No: '否'
|
||||
general_text_Yes: '是'
|
||||
general_text_no: '否'
|
||||
|
@ -832,6 +833,7 @@ zh:
|
|||
label_feeds_access_key_created_on: "RSS存取键是在 %{value} 之前建立的"
|
||||
label_module_plural: 模块
|
||||
label_added_time_by: "由 %{author} 在 %{age} 之前添加"
|
||||
label_added_time: "在 %{age} 之前添加"
|
||||
label_updated_time: " 更新于 %{value} 之前"
|
||||
label_updated_time_by: "由 %{author} 更新于 %{age} 之前"
|
||||
label_jump_to_a_project: 选择一个项目...
|
||||
|
@ -1821,6 +1823,11 @@ zh:
|
|||
label_contest_reason: 参赛宣言:
|
||||
label_notification: 通知
|
||||
label_sumbit_empty: 搜索内容不能为空
|
||||
no_use: 没有帮助
|
||||
cancel_no_use: 撤销没有帮助
|
||||
cancel_apply: 取消申请
|
||||
apply_master: 申请成为版主
|
||||
you_are_master: 您是该项目的版主
|
||||
|
||||
#add by linchun (竞赛相关)
|
||||
label_upload_files: 上传文件
|
||||
|
@ -1877,5 +1884,4 @@ zh:
|
|||
label_relation_files: 关联已有资源
|
||||
label_contest_settings: 配置竞赛
|
||||
label_contest_delete: 删除竞赛
|
||||
label_school_all: 学校列表
|
||||
|
|
@ -16,6 +16,25 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
RedmineApp::Application.routes.draw do
|
||||
resources :no_uses
|
||||
delete 'no_uses', :to => 'no_uses#delete'
|
||||
|
||||
resources :apply_project_masters
|
||||
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
|
||||
|
||||
|
||||
resources :open_source_projects do
|
||||
collection do
|
||||
match 'search', via: [:get, :post]
|
||||
match 'remove_condition', via: [:get, :post]
|
||||
end
|
||||
resources :relative_memos
|
||||
member do
|
||||
match 'master_apply', via: [:get, :post]
|
||||
match 'accept_master_apply', via: [:get, :post]
|
||||
match 'refuse_master_apply', via: [:get, :post]
|
||||
end
|
||||
end
|
||||
mount SeemsRateable::Engine => '/rateable', :as => :rateable
|
||||
|
||||
namespace :zipdown do
|
||||
|
@ -81,7 +100,6 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
resources :shares
|
||||
|
||||
#added by william
|
||||
|
@ -140,7 +158,6 @@ RedmineApp::Application.routes.draw do
|
|||
match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post]
|
||||
match '/journals/destroy/:id', :to => 'journals#destroy', :id => /\d+/, :via => [:get, :post]
|
||||
|
||||
|
||||
get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt'
|
||||
get '/issues/gantt', :to => 'gantts#show'
|
||||
|
||||
|
@ -245,7 +262,6 @@ RedmineApp::Application.routes.draw do
|
|||
match 'copy', :via => [:get, :post]
|
||||
end
|
||||
|
||||
|
||||
#by young
|
||||
match '/member', :controller => 'projects', :action => 'member', :as => 'member', :via => :get
|
||||
match '/file', :controller => 'projects', :action => 'file', :as => 'file', :via => :get
|
||||
|
@ -253,7 +269,6 @@ RedmineApp::Application.routes.draw do
|
|||
# match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get
|
||||
match '/homework', :controller => 'projects', :action => 'homework', :as => 'homework', :via => :get
|
||||
|
||||
|
||||
# match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get
|
||||
# match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get
|
||||
# match '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get
|
||||
|
@ -489,8 +504,6 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
|
||||
match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
|
||||
match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post]
|
||||
|
@ -582,6 +595,9 @@ RedmineApp::Application.routes.draw do
|
|||
post 'school/get_options/:province', :to => 'school#get_options'
|
||||
get 'school/get_options/:province', :to => 'school#get_options'
|
||||
|
||||
post 'school/get_province', :to => 'school#get_province'
|
||||
get 'school/get_province', :to => 'school#get_province'
|
||||
|
||||
post 'school/get_schoollist/:province', :to => 'school#get_schoollist'
|
||||
get 'school/get_schoollist/:province', :to => 'school#get_schoollist'
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
class CreateOpenSourceProjects < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :open_source_projects do |t|
|
||||
t.column "name", :string, :default => nil, :null => true
|
||||
t.column "description", :string, :default => '', :null => true
|
||||
t.column "commit_count", :integer, :default => 0
|
||||
t.column "code_line", :integer, :default => 0
|
||||
t.column "users_count",:integer, :default => 0
|
||||
t.column "last_commit_time", :date, :null => true
|
||||
t.column "url", :string, :default => nil, :null => true
|
||||
t.column "date_collected", :date, :null => true
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
class CreateRelativeMemos < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :relative_memos do |t|
|
||||
t.integer :osp_id, :null => false
|
||||
t.integer :parent_id, null: true
|
||||
t.string :subject, null: false
|
||||
t.text :content, null: false
|
||||
t.integer :author_id
|
||||
t.integer :replies_count, default: 0
|
||||
t.integer :last_reply_id
|
||||
t.boolean :lock, default: false
|
||||
t.boolean :sticky, default: false
|
||||
t.boolean :is_quote, default: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
class CreateApplyProjectMasters < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :apply_project_masters do |t|
|
||||
t.integer :user_id
|
||||
t.string :apply_type
|
||||
t.integer :apply_id
|
||||
t.integer :status
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class CreateNoUses < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :no_uses do |t|
|
||||
t.integer :user_id, :null => false
|
||||
t.string :no_use_type
|
||||
t.integer :no_use_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class AddViewCountToRelativeMemos < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :relative_memos, :viewed_count_crawl, :int, default: 0
|
||||
add_column :relative_memos, :viewed_count_local, :int, default: 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class ChangeDescriptionTypeToOpenSourceProject < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :open_source_projects, :description, :text
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddUrlToRelativeMemos < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :relative_memos, :url, :string
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
class AddAttachtypeToAttachments < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :attachments, :attachtype, :int
|
||||
add_column :attachments, :attachtype, :int ,default: 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddAttachmenttypeToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :attachmenttype, :int ,default: 1
|
||||
end
|
||||
end
|
11
db/schema.rb
11
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20140508030358) do
|
||||
ActiveRecord::Schema.define(:version => 20140509020307) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -43,6 +43,14 @@ ActiveRecord::Schema.define(:version => 20140508030358) do
|
|||
add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
|
||||
add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
|
||||
|
||||
create_table "attachmentstypes", :id => false, :force => true do |t|
|
||||
t.integer "id", :null => false
|
||||
t.integer "typeId"
|
||||
t.string "typeName", :limit => 50
|
||||
end
|
||||
|
||||
add_index "attachmentstypes", ["id"], :name => "id"
|
||||
|
||||
create_table "auth_sources", :force => true do |t|
|
||||
t.string "type", :limit => 30, :default => "", :null => false
|
||||
t.string "name", :limit => 60, :default => "", :null => false
|
||||
|
@ -585,6 +593,7 @@ ActiveRecord::Schema.define(:version => 20140508030358) do
|
|||
t.boolean "inherit_members", :default => false, :null => false
|
||||
t.integer "project_type"
|
||||
t.boolean "hidden_repo", :default => false, :null => false
|
||||
t.integer "attachmenttype", :default => 1
|
||||
end
|
||||
|
||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||
|
|
|
@ -60,6 +60,11 @@ module Redmine
|
|||
@unsaved_attachments ||= []
|
||||
end
|
||||
|
||||
def save_attachmentsex(attachments, author=User.current,attachment_type)
|
||||
@curattachment_type = attachment_type
|
||||
result = save_attachments(attachments,author)
|
||||
result
|
||||
end
|
||||
def save_attachments(attachments, author=User.current)
|
||||
if attachments.is_a?(Hash)
|
||||
attachments = attachments.stringify_keys
|
||||
|
@ -91,6 +96,7 @@ module Redmine
|
|||
end
|
||||
next unless a
|
||||
a.description = attachment['description'].to_s.strip
|
||||
a.attachtype = @curattachment_type;
|
||||
if a.new_record?
|
||||
unsaved_attachments << a
|
||||
else
|
||||
|
|
|
@ -476,12 +476,16 @@ function observeAutocompleteField(fieldId, url, options) {
|
|||
$(document).ready(function() {
|
||||
$('#'+fieldId).autocomplete($.extend({
|
||||
source: url,
|
||||
select: function(e,ui){self.location="/issues/"+ui.item.value;},
|
||||
minLength: 2,
|
||||
search: function(){$('#'+fieldId).addClass('ajax-loading');},
|
||||
response: function(){$('#'+fieldId).removeClass('ajax-loading');}
|
||||
response: function(){$('#'+fieldId).removeClass('ajax-loading');
|
||||
}
|
||||
}, options));
|
||||
$('#'+fieldId).addClass('autocomplete');
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function observeSearchfield(fieldId, targetId, url) {
|
||||
|
|
|
@ -14,8 +14,8 @@ $(document).ready(function(){
|
|||
path : '/rateable/ratings',
|
||||
onSuccess : function(element, rate){
|
||||
//something like ->
|
||||
//alert('success');
|
||||
$('<span class="text-success"><small style="display:inline-block;">Thanks for rating!</small></span>').insertAfter(element)
|
||||
alert('本次打分成功!');
|
||||
//$('<span class="text-success"><small style="display:inline-block;">Thanks for rating!</small></span>').insertAfter(element)
|
||||
},
|
||||
onError : function(element, rate) {
|
||||
$('<span class="text-error"><small style="display:inline-block;">You have already rated!</small></span>').insertAfter(element)
|
||||
|
|
|
@ -227,17 +227,15 @@ body {
|
|||
display: none;
|
||||
padding-bottom: 2px;
|
||||
width: 1000px;
|
||||
height: 500px;
|
||||
z-index: 100;
|
||||
left: 50%;
|
||||
margin-left: -202px;
|
||||
opacity: 1;
|
||||
position: fixed;
|
||||
top: 200px;
|
||||
overflow: scroll;
|
||||
}
|
||||
#WOpenWindow .school_list{
|
||||
width:1000px;
|
||||
width: 900px;
|
||||
line-height: 20px;
|
||||
|
||||
}
|
||||
|
@ -259,6 +257,12 @@ body {
|
|||
}
|
||||
#WOpenWindow .content{
|
||||
width: 1000px;
|
||||
height: 220px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
#WOpenWindow .pcontent{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1467,7 +1467,7 @@ div.pagination span {
|
|||
|
||||
div.pagination span.current-page {
|
||||
/*color: rgb(153, 153, 153); add by huang*/
|
||||
color:#e2f4ff;
|
||||
/*color:#e2f4ff;*/
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
act_id:
|
||||
act_type: MyString
|
||||
user_id:
|
||||
|
||||
two:
|
||||
act_id:
|
||||
act_type: MyString
|
||||
user_id:
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
journal_id: 1
|
||||
user_id: 1
|
||||
reply_id: 1
|
||||
|
||||
two:
|
||||
journal_id: 1
|
||||
user_id: 1
|
||||
reply_id: 1
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -0,0 +1,7 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
String:
|
||||
|
||||
two:
|
||||
String:
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -0,0 +1,49 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ApplyProjectMastersControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@apply_project_master = apply_project_masters(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:apply_project_masters)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create apply_project_master" do
|
||||
assert_difference('ApplyProjectMaster.count') do
|
||||
post :create, apply_project_master: { }
|
||||
end
|
||||
|
||||
assert_redirected_to apply_project_master_path(assigns(:apply_project_master))
|
||||
end
|
||||
|
||||
test "should show apply_project_master" do
|
||||
get :show, id: @apply_project_master
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @apply_project_master
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update apply_project_master" do
|
||||
put :update, id: @apply_project_master, apply_project_master: { }
|
||||
assert_redirected_to apply_project_master_path(assigns(:apply_project_master))
|
||||
end
|
||||
|
||||
test "should destroy apply_project_master" do
|
||||
assert_difference('ApplyProjectMaster.count', -1) do
|
||||
delete :destroy, id: @apply_project_master
|
||||
end
|
||||
|
||||
assert_redirected_to apply_project_masters_path
|
||||
end
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue