CourseModify
nwb 11 years ago
commit 4404222437

@ -19,6 +19,22 @@ gem 'acts-as-taggable-on'
group :development do group :development do
gem 'better_errors', path: 'lib/better_errors' gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler' gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
if ENV['PRY']
gem 'pry'
gem 'pry-nav'
end
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end end
# Optional gem for LDAP authentication # Optional gem for LDAP authentication

@ -53,7 +53,16 @@ GEM
arel (3.0.2) arel (3.0.2)
builder (3.0.0) builder (3.0.0)
coderay (1.0.9) coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.1)
erubis (2.7.0) erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
fastercsv (1.5.0) fastercsv (1.5.0)
hike (1.2.3) hike (1.2.3)
i18n (0.6.1) i18n (0.6.1)
@ -99,6 +108,11 @@ GEM
rdoc (3.12.2) rdoc (3.12.2)
json (~> 1.4) json (~> 1.4)
ruby-openid (2.1.8) ruby-openid (2.1.8)
sass (3.2.7)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.2.2) sprockets (2.2.2)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0) multi_json (~> 1.0)
@ -110,6 +124,9 @@ GEM
polyglot polyglot
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
tzinfo (0.3.37) tzinfo (0.3.37)
uglifier (1.0.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
PLATFORMS PLATFORMS
x86-mingw32 x86-mingw32
@ -121,6 +138,7 @@ DEPENDENCIES
better_errors! better_errors!
builder (= 3.0.0) builder (= 3.0.0)
coderay (~> 1.0.6) coderay (~> 1.0.6)
coffee-rails (~> 3.2.1)
fastercsv (~> 1.5.0) fastercsv (~> 1.5.0)
i18n (~> 0.6.0) i18n (~> 0.6.0)
jquery-rails (~> 2.0.2) jquery-rails (~> 2.0.2)
@ -130,4 +148,6 @@ DEPENDENCIES
rack-openid rack-openid
rails (= 3.2.13) rails (= 3.2.13)
ruby-openid (~> 2.1.4) ruby-openid (~> 2.1.4)
sass-rails (~> 3.2.3)
seems_rateable! seems_rateable!
uglifier (>= 1.0.3)

@ -1,11 +1,18 @@
patch: patch:
用户姓名的部分根据issues#655。 用户姓名的部分根据issues#655。
为了修改方便 为了修改方便
alias alias
方法 之前显示 调整之后 方法 之前显示 调整之后
name firstname+lastname login name firstname+lastname login
nickname xxx login nickname xxx login
realname xxx firstname+lastname realname xxx firstname+lastname
User model经过修改已经完全集成了user_extensions的功能
例如
user.gender=1
user.save
user_extensions字段会自动保存
不必要每次user.user_extensions.xxx以及判断是否为空
================================================================================ ================================================================================
app/models/setting.rb :165 app/models/setting.rb :165
# fixed domain url in development. tantantan's bug # fixed domain url in development. tantantan's bug
@ -14,22 +21,22 @@ app/models/setting.rb :165
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/ define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
end end
end end
程序部分链接中制定了subdomain参数使链接在二级域名中来回跳转。 程序部分链接中制定了subdomain参数使链接在二级域名中来回跳转。
为了开发方便使之功能在development模式下失效。 为了开发方便使之功能在development模式下失效。
# => nyan # => nyan
================================================================================ ================================================================================
app/controller/projects_controller.rb ===> projects#fake app/controller/projects_controller.rb ===> projects#fake
fake filter: 修改了传到页面中的Count后缀的数量 fake filter: 修改了传到页面中的Count后缀的数量
改为正确的数量删掉fake过滤器即可 改为正确的数量删掉fake过滤器即可
================================================================================ ================================================================================
#导航栏匹配域名显示和改变 #导航栏匹配域名显示和改变
app\helper\application_helper.rb app\helper\application_helper.rb
# rewrite navigation # rewrite navigation
app\views\layouts\_base_header.html.erb app\views\layouts\_base_header.html.erb
# reset navigation by domain name and url through regular match # reset navigation by domain name and url through regular match
================================================================================ ================================================================================
#首页根据域名匹配进入不同的页面 #首页根据域名匹配进入不同的页面
app\controller\welcome_controller.rb app\controller\welcome_controller.rb
def entry_select_user def entry_select_user
if request.original_url.match(/user\.trustie\.net/) if request.original_url.match(/user\.trustie\.net/)

@ -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.
*/

@ -139,9 +139,9 @@ class AttachmentsController < ApplicationController
# Make sure association callbacks are called # Make sure association callbacks are called
container = @attachment.container container = @attachment.container
@attachment.container.attachments.delete(@attachment) @attachment.container.attachments.delete(@attachment)
if container.attachments.empty? #if container.attachments.empty?
container.delete #container.delete
end #end
respond_to do |format| respond_to do |format|
format.html { redirect_to_referer_or respond_path(@bid) } format.html { redirect_to_referer_or respond_path(@bid) }

@ -695,7 +695,7 @@ class BidsController < ApplicationController
@bid.budget = 0 @bid.budget = 0
@bid.author_id = User.current.id @bid.author_id = User.current.id
@bid.commit = 0 @bid.commit = 0
@bid.homework_type = params[:bid][:homework_type] @bid.homework_type = 1
@bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
# @bid. # @bid.
if @bid.save if @bid.save
@ -881,6 +881,7 @@ class BidsController < ApplicationController
def memberAccess def memberAccess
# 是课程,则判断当前用户是否参加了课程 # 是课程,则判断当前用户是否参加了课程
return true if current_user.admin?
return 0 if @bid.courses.first.project_type == Project::ProjectType_project return 0 if @bid.courses.first.project_type == Project::ProjectType_project
currentUser = User.current currentUser = User.current
render_403 unless currentUser.member_of?(@bid.courses.first) render_403 unless currentUser.member_of?(@bid.courses.first)

@ -5,7 +5,8 @@ class ContestsController < ApplicationController
menu_item :project, :only => :show_project menu_item :project, :only => :show_project
menu_item :application, :only => :show_softapplication menu_item :application, :only => :show_softapplication
menu_item :attendingcontest, :only => :show_attendingcontest menu_item :attendingcontest, :only => :show_attendingcontest
before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, menu_item :contestnotification, :only => :show_notification
before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :show_notification, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward,
:show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] :show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
# added by fq # added by fq
@ -356,6 +357,17 @@ class ContestsController < ApplicationController
###end ###end
def show_notification
@contest = Contest.find_by_id(params[:id])
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
}
format.api
end
end
def set_reward_project def set_reward_project
@c_p = nil @c_p = nil
@contesting_project_id = nil @contesting_project_id = nil

@ -70,7 +70,7 @@ class FilesController < ApplicationController
Mailer.attachments_added(attachments[:files]).deliver Mailer.attachments_added(attachments[:files]).deliver
end end
# 临时用 # TODO: 临时用 nyan
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on", sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename", 'filename' => "#{Attachment.table_name}.filename",

@ -18,7 +18,7 @@ class HomeworkAttachController < ApplicationController
end end
def create def create
if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) #if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)
user_id = params[:user_id] user_id = params[:user_id]
bid_id = params[:bid_id] bid_id = params[:bid_id]
sta = 0 sta = 0
@ -32,21 +32,22 @@ class HomeworkAttachController < ApplicationController
:bid_id => bid_id :bid_id => bid_id
} }
#@bid = Bid.find bid_id
#@homework_list = @bid.homeworks
@homework = HomeworkAttach.new(options) @homework = HomeworkAttach.new(options)
@homework.save_attachments(params[:attachments]) @homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework) render_attachment_warning_if_needed(@homework)
@homework.save
respond_to do |format|
if @homework.save if @homework.save
format.html { redirect_to @homework, notice: 'Post was successfully created.' } respond_to do |format|
format.json { render json: @homework, status: :created, location: @homework } format.html { redirect_to project_for_bid_path @homework.bid }
else format.json { head :no_content }
format.html { render action: "new" }
format.json { render json: @homework.errors, status: :unprocessable_entity }
end
end end
else
end end
#end
end end
def new def new
@ -65,23 +66,30 @@ class HomeworkAttachController < ApplicationController
def update def update
@homework = HomeworkAttach.find(params[:id]) @homework = HomeworkAttach.find(params[:id])
name = params[:homework_name]
description = params[:homework_description]
@homework.name = name
@homework.description = description
if params[:attachments]
@homework.save_attachments(params[:attachments])
end
if @homework.save
respond_to do |format| respond_to do |format|
if @post.update_attributes(params[:homework]) format.html { redirect_to project_for_bid_path @homework.bid }
format.html { redirect_to @homework, notice: 'Homework was successfully updated.' }
format.json { head :no_content } format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @homework.errors, status: :unprocessable_entity }
end end
else
end end
end end
def destroy def destroy
@homework = HomeworkAttach.find(params([:id])) @homework = HomeworkAttach.find(params[:id])
@homework.destroy if @homework.destroy
respond_to do |format| respond_to do |format|
format.html {render @homework} format.html { redirect_to project_for_bid_path @homework.bid }
format.json {render json: @homework} format.json { head :no_content }
end
else
end end
end end

@ -29,6 +29,11 @@ class MailHandlerController < ActionController::Base
end end
end end
#取消邮件通知
def cancel_mail_notify
end
private private
def check_credential def check_credential

@ -12,6 +12,7 @@ class OpenSourceProjectsController < ApplicationController
# GET /open_source_projects # GET /open_source_projects
# GET /open_source_projects.json # GET /open_source_projects.json
def index def index
@app_dir = params[:app_dir] @app_dir = params[:app_dir]
@language = params[:language] @language = params[:language]
@created_at = params[:created_at] @created_at = params[:created_at]
@ -25,6 +26,8 @@ class OpenSourceProjectsController < ApplicationController
@open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page) @open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page)
@bugs = BugToOsp.order('created_at desc').limit(8)
# @open_source_projects = OpenSourceProject.all # @open_source_projects = OpenSourceProject.all
respond_to do |format| respond_to do |format|
@ -76,14 +79,52 @@ class OpenSourceProjectsController < ApplicationController
end end
end end
def allbug
@bugs = BugToOsp.visible
@bug_count = @bugs.count
@bug_pages = Paginator.new @bug_count, per_page_option, params['page']
@bugs = @bugs.includes(:bug).reorder("#{RelativeMemo.table_name}.created_at DESC").limit(@bug_pages.per_page).offset(@bug_pages.offset).all
def search respond_to do |format|
format.html
format.json { render json: @open_source_project }
end
end
def search
end end
def showbug
@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.bugs.count
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@memos = @open_source_project.bugs.
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
# added by yiang 暴力添加,请绕道 # added by yiang 暴力添加,请绕道
def showmemo def showmemo
@open_source_project = OpenSourceProject.find(params[:id]) @open_source_project = OpenSourceProject.find(params[:id])
sort_init 'updated_at', 'desc' sort_init 'updated_at', 'desc'
@ -108,7 +149,8 @@ def showmemo
} }
format.json { render json: @open_source_project } format.json { render json: @open_source_project }
end end
end end
# GET /open_source_projects/new # GET /open_source_projects/new
# GET /open_source_projects/new.json # GET /open_source_projects/new.json
def new def new
@ -178,13 +220,13 @@ end
def search def search
# per_page_option = 10 # per_page_option = 10
# #
# @open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at) # @open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
# @open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present? # @open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present?
# #
# @os_project_count = @open_source_projects.count # @os_project_count = @open_source_projects.count
# @os_project_pages = Paginator.new @os_project_count, per_page_option, params['page'] # @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 = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page)
redirect_to open_source_projects_path(:name => params[:name]) redirect_to open_source_projects_path(:name => params[:name])
@ -207,7 +249,6 @@ end
redirect_to master_apply_open_source_project_path redirect_to master_apply_open_source_project_path
end end
private private
def require_master def require_master

@ -47,7 +47,7 @@ class SoftapplicationsController < ApplicationController
def show def show
@softapplication = Softapplication.find(params[:id]) @softapplication = Softapplication.find(params[:id])
@project = Project.find_by_identifier(@softapplication.deposit_project) @project = @softapplication.project
# 打分统计 # 打分统计
stars_reates = @softapplication. stars_reates = @softapplication.
rates(:quality) rates(:quality)
@ -142,13 +142,16 @@ class SoftapplicationsController < ApplicationController
def create def create
@softapplication = Softapplication.new(params[:softapplication]) @softapplication = Softapplication.new(params[:softapplication])
@softapplication.user = User.current @softapplication.user = User.current
@softapplication.deposit_project = params[:project] #@softapplication.deposit_project = params[:project]
@softapplication.project = Project.find_by_id(params[:project])
@softapplication.save_attachments(params[:attachments]) @softapplication.save_attachments(params[:attachments])
respond_to do |format| respond_to do |format|
if @softapplication.save if @softapplication.save
ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id) ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id)
#ProjectingSoftapplication.create_softapplication_projecting(:project_id => params[:project_id], :softapplication_id => @softapplication.id)
#ProjectingSoftapplication.create_softapplication_projecting(@project.id, softapplication.id)
format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]), notice: l(:notice_attendingcontest_work_successfully_created) } format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]), notice: l(:notice_attendingcontest_work_successfully_created) }
# format.json { render json: @softapplication, status: :created, location: @softapplication } # format.json { render json: @softapplication, status: :created, location: @softapplication }
else else
@ -170,7 +173,8 @@ class SoftapplicationsController < ApplicationController
# @softapplication = Softapplication.find(params[:id]) # @softapplication = Softapplication.find(params[:id])
@softapplication.attachments.map{|attach| attach.destroy } @softapplication.attachments.map{|attach| attach.destroy }
@softapplication.save_attachments(params[:attachments]) @softapplication.save_attachments(params[:attachments])
@softapplication.deposit_project = params[:project] #@softapplication.deposit_project = params[:project]
@softapplication.project = Project.find_by_id(params[:project])
respond_to do |format| respond_to do |format|
if @softapplication.update_attributes(params[:softapplication]) if @softapplication.update_attributes(params[:softapplication])
format.html { redirect_to @softapplication, notice: l(:notice_softapplication_was_successfully_updated) } format.html { redirect_to @softapplication, notice: l(:notice_softapplication_was_successfully_updated) }

@ -21,13 +21,7 @@ class WelcomeController < ApplicationController
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index] before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index]
def index def index
projectActive = Project.project_entities.active
@projectCount = projectActive.count
@projectPublicCount = projectActive.all_public.count
@projectHidenCount = @projectCount - @projectPublicCount
@developerCount = User.developer.count
@allUsercount = User.count
end end
def robots def robots
@ -36,10 +30,7 @@ class WelcomeController < ApplicationController
end end
def course def course
@courseCount = Project.course_entities.count @logoLink ||= logolink()
@teacherCount = User.teacher.count
@studentCount = User.student.count
@logoLink = logolink()
end end
@ -121,25 +112,25 @@ class WelcomeController < ApplicationController
end end
end end
def render(*args) # def render(*args)
_fake if @fake_filter # _fake if @fake_filter
super # super
end # end
private # private
def fake # def fake
@fake_filter = true # @fake_filter = true
end # end
# 骗子方法 # # 骗子方法
def _fake # def _fake
instance_variables.map { |variable| # instance_variables.map { |variable|
if variable.to_s =~ /Count$/ # if variable.to_s =~ /Count$/
self.instance_variable_set(variable.to_sym, # self.instance_variable_set(variable.to_sym,
("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i) # ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
end # end
} # }
end # end
end end

@ -20,8 +20,36 @@ class ZipdownController < ApplicationController
#@error = e #@error = e
end end
#下载某一学生的作业的所有文件
def download_user_homework
obj_class = params[:obj_class]
obj_id = params[:obj_id]
user_id = params[:user_id]
obj = obj_class.constantize.find(obj_id)
zipfile = nil
case obj.class.to_s.to_sym
when :Bid
zipfile = zip_user_bid obj,user_id
else
logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!"
end
send_file zipfile, :filename => obj.name, :type => detect_content_type(zipfile) if zipfile
end
private private
def zip_user_bid(bid,user_id)
# Todo: User Access Controll
homeattaches = bid.homeworks.where("user_id = ?",user_id)
# 得到每一个人所有文件打包的zip文件
# 并将每一个人的zip打包为一个并返回路径
user_zip_paths = homeattaches.map do |homeattach|
zip_homework_by_user homeattach
end
zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
end
def zip_bid(bid) def zip_bid(bid)
# Todo: User Access Controll # Todo: User Access Controll

@ -796,7 +796,7 @@ module ApplicationHelper
tmp = Hash.new tmp = Hash.new
tmp={"" => ""} tmp={"" => ""}
option.each do |project| option.each do |project|
tmp[project.name] = project.identifier tmp[project.name] = project.id
end end
tmp tmp
end end

@ -216,4 +216,9 @@ module CoursesHelper
end end
people.include?(User.current) people.include?(User.current)
end end
#获取当前用户在指定作业下提交的作业的集合
def cur_user_homework_for_bid bid
cur_user_homework = HomeworkAttach.where("user_id = ? and bid_id = ?",User.current,params[:id])
cur_user_homework
end
end end

@ -0,0 +1,10 @@
module HomeworkAttachHelper
def attach_delete(project)
if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id)
true
else
false
end
end
end

@ -59,12 +59,11 @@ module IssuesHelper
def issue_heading(issue) def issue_heading(issue)
#h("#{issue.tracker} ##{issue.id}") #h("#{issue.tracker} ##{issue.id}")
#h("#{issue.tracker} #{issue.source_from}") # h("#{issue.tracker} #{issue.source_from}")
s = '' s = ''
s << ">>" s << link_to(@issue.project.name, project_issues_path(@issue.project))
s << link_to(@issue.project.name+l(:issue_list), project_issues_path(@issue.project)) s << " > #"
s << " >" s << @issue.project_index
s << @issue.source_from
s.html_safe s.html_safe
end end

@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module JournalsHelper module JournalsHelper
def render_notes(issue, journal, options={}) def render_links(issue, journal, options={})
content = '' content = ''
editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project)))
destroyable = User.current.logged? && ((journal.user == User.current) || (issue.author_id == User.current.id) || (User.current.admin == 1)) destroyable = User.current.logged? && ((journal.user == User.current) || (issue.author_id == User.current.id) || (User.current.admin == 1))
@ -38,7 +38,35 @@ module JournalsHelper
:title => l(:button_delete)) :title => l(:button_delete))
end end
end end
content << content_tag('div', links.join(' ').html_safe, :class => 'contextual', :style => 'margin-top:-25px;') unless links.empty? content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty?
#content << textilizable(journal, :notes)
#css_classes = "wiki"
#css_classes << " editable" if editable
#content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
content.html_safe
end
def render_notes (issue, journal, options={})
content = ''
editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project)))
destroyable = User.current.logged? && ((journal.user == User.current) || (issue.author_id == User.current.id) || (User.current.admin == 1))
links = []
if !journal.notes.blank?
links << link_to(l(:button_quote),
{:controller => 'journals', :action => 'new', :id => issue.id, :journal_id => journal},
:remote => true,
:method => 'post',
:title => l(:button_quote)) if options[:reply_links]
links << link_to_in_place_notes_editor(l(:button_edit), "journal-#{journal.id}-notes",
{ :controller => 'journals', :action => 'edit', :id => journal, :format => 'js' },
:title => l(:button_edit)) if editable
#Added by young
if destroyable
links << link_to(l(:button_delete), { :controller => 'journals', :action => 'destroy', :id => journal, :format => 'js' },
:title => l(:button_delete))
end
end
#content << content_tag('div', links.join(' ').html_safe, :class => 'contextual', :style => 'margin-top:-25px;') unless links.empty?
content << textilizable(journal, :notes) content << textilizable(journal, :notes)
css_classes = "wiki" css_classes = "wiki"
css_classes << " editable" if editable css_classes << " editable" if editable

@ -46,4 +46,12 @@ module OpenSourceProjectsHelper
end end
description description
end end
def show_description_of_bug(bug)
description = bug.description
if description.nil? || description == ''
description = bug.open_source_project.name + l(:label_bug)
end
description
end
end end

@ -69,28 +69,30 @@ module UsersHelper
# <li><%= link_to("所有反馈", {:controller => 'users', :action => 'show', :type => 2}) %></li> # <li><%= link_to("所有反馈", {:controller => 'users', :action => 'show', :type => 2}) %></li>
# </ul></div> # </ul></div>
def show_activity(state) # TODO: 待删
content = ''.html_safe # def show_activity(state)
case state # content = ''.html_safe
when 0 # case state
s = content_tag('span', l(:label_user_all_activity), :class => "current-page") # when 0
content << content_tag('li', s) # s = content_tag('span', l(:label_user_all_activity), :class => "current-page")
content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) # content << content_tag('li', s)
content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1}))
when 1 # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2}))
s = content_tag('span', l(:label_user_activity_myself), :class => "current-page") # when 1
content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) # s = content_tag('span', l(:label_user_activity_myself), :class => "current-page")
content << content_tag('li', s, :class => "current-page") # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'}))
content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) # content << content_tag('li', s, :class => "current-page")
when 2 # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2}))
s = content_tag('span', l(:label_user_all_respond), :class => "current-page") # when 2
content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) # s = content_tag('span', l(:label_user_all_respond), :class => "current-page")
content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'}))
content << content_tag('li', s, :class => "current-page") # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1}))
end # content << content_tag('li', s, :class => "current-page")
content_tag('div', content, :class => "pagination") # end
end # content_tag('div', content, :class => "pagination")
# end
#TODO: 待删
def watch_projects(state) def watch_projects(state)
content = ''.html_safe content = ''.html_safe
case state case state

@ -237,7 +237,7 @@ module WelcomeHelper
content_tag('span', find_all_event_type(event)) << content_tag('span', find_all_event_type(event)) <<
':&nbsp;'.html_safe << ':&nbsp;'.html_safe <<
link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) <<
link_to(('&nbsp;['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container), :class => "attachments_list_color") link_to(('&nbsp;['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container.project), :class => "attachments_list_color")
else else
str << content_tag("span", "更新了") << str << content_tag("span", "更新了") <<
content_tag("span", find_all_event_type(event)) << content_tag("span", find_all_event_type(event)) <<

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save