This commit is contained in:
sw 2014-07-16 10:15:43 +08:00
commit 4825c5287e
42 changed files with 1666 additions and 123 deletions

35
Gemfile
View File

@ -1,4 +1,4 @@
source 'https://rubygems.org'
source 'https://ruby.taobao.org'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
@ -19,19 +19,33 @@ gem 'acts-as-taggable-on', '2.4.1'
group :development do
gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
if ENV['PRY']
gem 'pry'
gem 'pry-nav'
end
end
group :test do
# shoulda的版本做了改动
#gem "shoulda", "~> 3.3.2"
gem "shoulda", "> 3.3.2"
gem "mocha", "~> 0.13.3"
gem 'capybara', '~> 2.0.0'
gem 'nokogiri', '< 1.6.0'
platforms :mri, :mingw do
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end
end
end
group :development, :test do
gem "guard-rails"
gem 'spork-testunit'
gem 'guard-spork'
gem 'guard-test', '~> 1.0.0'
gem 'ruby-prof'
gem 'pry'
gem 'pry-nav'
end
@ -53,15 +67,6 @@ group :ldap do
end
platforms :mri, :mingw do
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end
end
# Optional gem for OpenID authentication
group :openid do
gem "ruby-openid", "~> 2.1.4", :require => "openid"

View File

@ -19,7 +19,7 @@ PATH
rails
GEM
remote: https://rubygems.org/
remote: https://ruby.taobao.org/
remote: https://rubygems.org/
specs:
actionmailer (3.2.13)
@ -51,7 +51,7 @@ GEM
multi_json (~> 1.0)
acts-as-taggable-on (2.4.1)
rails (>= 3, < 5)
arel (3.0.2)
arel (3.0.3)
builder (3.0.0)
capybara (2.0.3)
mime-types (>= 1.16)
@ -60,6 +60,8 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 1.0.0)
celluloid (0.15.2)
timers (~> 1.1.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
climate_control (0.0.3)
@ -70,14 +72,31 @@ GEM
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
coffee-script-source (1.7.1)
erubis (2.7.0)
execjs (2.0.2)
fastercsv (1.5.0)
execjs (2.2.1)
fastercsv (1.5.5)
ffi (1.9.3)
ffi (1.9.3-x86-mingw32)
formatador (0.2.5)
guard (2.6.1)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-rails (0.5.2)
guard (~> 2.0)
guard-spork (1.5.1)
childprocess (>= 0.2.3)
guard (>= 1.1)
spork (>= 0.8.4)
guard-test (1.0.0)
guard (>= 1.8)
test-unit (~> 2.2)
hike (1.2.3)
htmlentities (4.3.2)
i18n (0.6.1)
@ -85,36 +104,56 @@ GEM
jquery-rails (2.0.3)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.8.0)
json (1.8.1)
kaminari (0.16.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
libv8 (3.16.14.3)
listen (2.7.9)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.9)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.4)
mime-types (1.23)
method_source (0.8.2)
mime-types (1.25.1)
mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.7.6)
multi_json (1.10.1)
mysql2 (0.3.11)
mysql2 (0.3.11-x86-mingw32)
net-ldap (0.3.1)
nokogiri (1.5.11)
nokogiri (1.5.11-x86-mingw32)
paperclip (3.5.4)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.3)
polyglot (0.3.5)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
pry (0.9.12.6-x86-mingw32)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
win32console (~> 1.3)
pry-nav (0.2.3)
pry (~> 0.9.10)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-openid (1.3.1)
rack-openid (1.4.2)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-raw-upload (1.1.1)
multi_json
rack-ssl (1.3.3)
rack-ssl (1.3.4)
rack
rack-test (0.6.2)
rack (>= 1.0)
@ -134,8 +173,12 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
ref (1.0.5)
rich (1.4.6)
jquery-rails
kaminari
@ -146,8 +189,9 @@ GEM
sass-rails
rmagick (2.13.2)
ruby-openid (2.1.8)
rubyzip (1.1.4)
sass (3.2.14)
ruby-prof (0.15.1)
rubyzip (1.1.6)
sass (3.3.10)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
@ -163,25 +207,36 @@ GEM
shoulda-context (1.2.1)
shoulda-matchers (2.6.1)
activesupport (>= 3.0.0)
slop (3.5.0)
spork (0.9.2)
spork-testunit (0.0.8)
spork (>= 0.6.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.18.1)
test-unit (2.5.5)
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
tilt (1.4.1)
treetop (1.4.14)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
uglifier (2.4.0)
tzinfo (0.3.40)
uglifier (2.5.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
websocket (1.0.7)
win32console (1.3.2-x86-mingw32)
xpath (1.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
@ -194,6 +249,9 @@ DEPENDENCIES
coderay (~> 1.0.6)
coffee-rails (~> 3.2.1)
fastercsv (~> 1.5.0)
guard-rails
guard-spork
guard-test (~> 1.0.0)
htmlentities
i18n (~> 0.6.0)
jquery-rails (~> 2.0.2)
@ -203,14 +261,18 @@ DEPENDENCIES
net-ldap (~> 0.3.1)
nokogiri (< 1.6.0)
paperclip (~> 3.5.4)
pry
pry-nav
rack-mini-profiler!
rack-openid
rails (= 3.2.13)
rich (= 1.4.6)
rmagick (>= 2.0.0)
ruby-openid (~> 2.1.4)
ruby-prof
sass-rails (~> 3.2.3)
seems_rateable!
shoulda (> 3.3.2)
spork-testunit
therubyracer
uglifier (>= 1.0.3)

39
Guardfile Normal file
View File

@ -0,0 +1,39 @@
# More info at https://github.com/guard/guard#readme
# guard 'rails' do
# watch('Gemfile.lock')
# watch(%r{^(config|lib)/.*})
# end
#
guard 'spork', :test_unit => true, :test_unit_env => {'RAILS_ENV' => 'test'}, :wait => 60 do
watch('config/application.rb')
watch('config/environment.rb')
watch('config/environments/test.rb')
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch('test/test_helper.rb') { :test_unit }
watch(%r{features/support/}) { :cucumber }
end
guard :test, :drb => true, :all_after_pass => false, :all_on_start => false do
watch(%r{^test/.+_test\.rb$})
watch('test/test_helper.rb') { 'test' }
# Non-rails
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
# Rails 4
# watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
# watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
# watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
# watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
# Rails < 4
watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
watch(%r{^app/controllers/(.+)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
watch(%r{^app/views/(.+)/.+\.erb$}) { |m| "test/functional/#{m[1]}_controller_test.rb" }
watch(%r{^app/views/.+$}) { 'test/integration' }
watch('app/controllers/application_controller.rb') { ['test/functional', 'test/integration'] }
end

View File

@ -246,19 +246,21 @@ class AdminController < ApplicationController
@first_page.title = params[:title]
if @first_page.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
format.html {
redirect_to admin_first_page_made_path
}
format.api { render_api_ok }
#format.json { render json: @first_page, status: :created, location: @first_page }
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}"
format.html {
first_page_made
render :action => 'first_page_made'
}
format.api { render_validation_errors(@first_page) }
#format.json { render json: @first_page.errors, status: :unprocessable_entity }
end
end
end
@ -272,6 +274,7 @@ class AdminController < ApplicationController
@first_page = FirstPage.where("page_type = 'project'").first
@course_page = FirstPage.where("page_type = 'course'").first
@first_page.web_title = params[:web_title]
@course_page.web_title = params[:web_title]
@course_page.title = params[:course_title]
@course_page.description = params[:course_description]
if @first_page.save && @course_page.save
@ -284,8 +287,10 @@ class AdminController < ApplicationController
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@course_page.errors.full_messages[0]}"
#flash.now[:error] = "#{l :label_first_page_create_fail}: #{@course_page.errors.full_messages[0]}"
format.html {
course_page_made
render :action => 'course_page_made'
}
format.api { render_validation_errors(@first_page) }
@ -303,6 +308,7 @@ class AdminController < ApplicationController
@first_page = FirstPage.where("page_type = 'project'").first
@contest_page = FirstPage.where("page_type = 'contest'").first
@first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title]
@contest_page.description = params[:contest_description]
if @first_page.save && @contest_page.save
@ -315,8 +321,8 @@ class AdminController < ApplicationController
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@contest_page.errors.full_messages[0]}"
format.html {
contest_page_made
render :action => 'contest_page_made'
}
format.api { render_validation_errors(@first_page) }

View File

@ -78,6 +78,40 @@ class AvatarController < ApplicationController
end
end
#add by zjc
#删除图片
def delete_image
@source_type = params[:source_type]
@source_id = params[:source_id]
@source = nil #eval(@source_type).find(@source_id)
c = Object.const_get(@source_type)
if c.respond_to?(:find)
@source = c.find(@source_id)
end
diskfile=disk_filename(@source_type,@source_id)
unless diskfile.nil? || diskfile == ""
path = File.dirname(diskfile)
if File.directory?(path) && File.exist?(diskfile)
File.delete(diskfile)
end
end
rescue e do
logger.info e.message
end
respond_to do |format|
format.js
format.api {
if saved
render :action => 'upload', :status => :created
else
render_validation_errors(@avatar)
end
}
end
end
private
def set_cache_buster

View File

@ -92,6 +92,22 @@ class RepositoriesController < ApplicationController
end
def create
if params[:repository_scm].to_s == 'Gitlab'
# add by nwb
# 增加对gitlab版本库的支持
attrs = pickup_extra_info
@repository = Repository.factory('Git')
@repository.safe_attributes = params[:repository]
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
@repository.project = @project
if request.post? && @repository.save
redirect_to settings_project_path(@project, :tab => 'repositories')
else
render :action => 'new'
end
else # 原逻辑
##xianbo
@root_path=RepositoriesHelper::ROOT_PATH
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@ -144,6 +160,7 @@ class RepositoriesController < ApplicationController
end
end
end
end
def edit
end

View File

@ -108,6 +108,11 @@ class Course < ActiveRecord::Base
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
# 课程的短名称信息
def short_name(length = 8)
name.gsub(/<\/?.*?>/,"").html_safe if name
end
def strip_html(html)
return html if html.empty? || !html.include?('<')
output = ""

View File

@ -1,3 +1,6 @@
class FirstPage < ActiveRecord::Base
attr_accessible :description, :title, :web_title,:page_type
validates_presence_of :web_title, :title, :description,:page_type
validates_length_of :web_title,:title, maximum: 30
validates_length_of :description, maximum: 100
end

View File

@ -41,7 +41,7 @@ class Project < ActiveRecord::Base
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] , :order => "id ASC"
has_many :issues, :dependent => :destroy, :include => [:status, :tracker]
has_many :issue_changes, :through => :issues, :source => :journals
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
has_many :time_entries, :dependent => :delete_all

View File

@ -163,7 +163,7 @@ class Setting < ActiveRecord::Base
end
# fixed domain url in development. tantantan's bug
if Rails.env.development?
if Rails.env.development? || Rails.env.test?
methods.map do |m|
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
end

View File

@ -17,7 +17,7 @@
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>
</p>
<div style="margin-left: 82px;">
<div style="margin-left: 82px;" id="avatar">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@contest_page} %>
</div>
<p style="margin-left:60px;padding-right: 20px;">

View File

@ -16,7 +16,7 @@
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>
</p>
<div style="margin-left: 82px;">
<div style="margin-left: 82px;" id="avatar">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@course_page} %>
</div>
<p style="margin-left:60px;padding-right: 20px;">

View File

@ -16,7 +16,7 @@
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>
</p>
<div style="margin-left: 82px;">
<div style="margin-left: 82px;" id="avatar">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
</div>

View File

@ -1,3 +1,4 @@
<div id="avatardiv">
<style type="text/css">
a, a:hover {text-decoration:none;}
.btn_addPic
@ -42,6 +43,7 @@
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
</div>
</span>
<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
<span><%= l(:button_upload_photo) %></span>
</a>
@ -70,3 +72,4 @@
<% content_for :header_tags do %>
<%= javascript_include_tag 'avatars' %>
<% end %>
</div>

View File

@ -0,0 +1,5 @@
var avatardiv = $('#avatardiv');
avatardiv.replaceWith("<%= escape_javascript(render :partial=>'avatar/avatar_form',:style => 'display:inline',:locals=> {source:@source}) %>");
//var imgSpan = $('#avatar_image');
//imgSpan.attr({"src":'<#%= @urlfile.to_s << "?" << Time.now.to_s%>'});

View File

@ -35,7 +35,7 @@
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
<%if file.is_public == 0 && !User.current.member_of_course?(@course)%>
<%next%>
<%end%>
<tr class="file <%= cycle("odd", "odd") %>">

View File

@ -28,7 +28,7 @@
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% container.attachments.each do |file| %>
<% if file.is_public == 0 && !User.current.member_of?(@project) %>
<% if file.is_public == 0 && !User.current.member_of_course?(@course) %>
<% next %>
<% end %>
<% if isTypeOk(file, selAttachType, selContentType) %>

View File

@ -45,7 +45,7 @@
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li><%= link_to course.name, course_path(course) %></li>
<li><%= link_to course.name.truncate(10, omission: '...'), course_path(course) %></li>
<% end %>
<% end %>
</ul>
@ -54,7 +54,7 @@
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<ul class="project_sub_menu">
<% User.current.projects.each do |project| %>
<li><%= link_to project.name, project_path(project) %></li>
<li><%= link_to project.name.truncate(10, omission: '...'), project_path(project) %></li>
<% end %>
</ul>
</li>

View File

@ -36,20 +36,21 @@
<%= error_messages_for 'user' %>
<fieldset class="box" style="margin:10px;">
<%= labelled_form_for :user, @user,
:url => {:action => "account"},
:html => {:id => 'my_account_form',
:method => :post} do |f| %>
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);">
<%= l(:label_my_photo) %>
</legend>
<div>
<!--upload profiles-->
<%= render :partial => "avatar/avatar_form", :locals => {source: @user} %>
<%= render :partial => "avatar/avatar_form",:style => "display:inline", :locals => {source: @user} %>
<!--upload-->
</div>
</fieldset>
<%= labelled_form_for :user, @user,
:url => {:action => "account"},
:html => {:id => 'my_account_form',
:method => :post} do |f| %>
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);">
<%= l(:label_information_plural) %>

View File

@ -266,6 +266,7 @@ zh:
field_value:
field_category: 类别
field_title: 标题
field_web_title: 浏览器标题
field_project: 项目
field_issue: 问题
field_status: 状态
@ -1484,6 +1485,7 @@ zh:
label_contest_description: 内容:对你的竞赛进行描述
label_requirement_bargain_money: 输入具体奖励方式(如金钱、奖项、学分)
button_upload_photo: 上传图片
button_delete_file: 删除
label_leave_me_message: 给我留言了
label_leave_others_message: 给他留言了
label_leave_a_message: 给他(她)留言
@ -1911,6 +1913,7 @@ zh:
label_memo_create_fail: 发布失败
label_forum_create_succ: 贴吧新建成功
label_forum_create_fail: 贴吧新建失败
label_first_page_create_fail: 首页定制失败
label_forum_edit: 编辑讨论区
label_memo_create: 发布
label_memo_new: 新建主题

View File

@ -577,7 +577,6 @@ RedmineApp::Application.routes.draw do
end
end
match 'projects/course', :to => 'courses#course', :as => 'courses_course'
match 'courses/search', :to => 'courses#search'
# add by nwb
# 课程路由设置
@ -629,6 +628,7 @@ RedmineApp::Application.routes.draw do
match 'uploads', :to => 'attachments#upload', :via => :post
# Added by Tao
match 'upload_avatar', :to => 'avatar#upload', :via => :post
match 'delete_avatar', :to => 'avatar#delete_image',:via => :post
# Endof Tao's code
get 'robots.txt', :to => 'welcome#robots'

View File

@ -5,6 +5,7 @@ class CreateFirstPages < ActiveRecord::Migration
t.string :web_title
t.string :title
t.string :description
t.string :page_type
t.timestamps
end
@ -12,6 +13,8 @@ class CreateFirstPages < ActiveRecord::Migration
fp.web_title = "Trustie - 为大学生技术创新筑巢"
fp.title = "Trustie在线项目托管平台"
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
fp.page_type = "project"
fp.save
end
end

View File

@ -1,9 +1,9 @@
class AddCloumnToFirstPage < ActiveRecord::Migration
def change
add_column :first_pages,:type,:string
#add_column :first_pages,:type,:string
fr = FirstPage.all.first
fr.type = "project"
fr.save
#fr = FirstPage.all.first
#fr.type = "project"
#fr.save
end
end

View File

@ -1,5 +1,5 @@
class AltColumnName < ActiveRecord::Migration
def change
rename_column :first_pages,:type,:page_type
#rename_column :first_pages,:type,:page_type
end
end

View File

@ -0,0 +1,9 @@
# -*coding:utf-8 -*-
class SetWebTitle < ActiveRecord::Migration
def change
FirstPage.all.each do |fp|
fp.web_title = "Trustie - 为大学生技术创新筑巢"
fp.save
end
end
end

1199
db/schema.rb Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -8,7 +8,7 @@ gem 'actionpack'
require 'action_controller'
gem 'mocha'
require 'mocha'
require 'mocha/setup'
gem 'ruby-openid'
require 'openid'

Binary file not shown.

View File

@ -51,6 +51,7 @@ function ajaxUpload(file, fileSpan, inputEl) {
ajaxUpload.uploading--;
fileSpan.removeClass('ajax-loading');
var form = fileSpan.parents('form');
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
$('input:submit', form).removeAttr('disabled');
}

View File

@ -2170,7 +2170,7 @@ ul.messages-for-user-reply li {
left: 115px;
padding-bottom: 5px;
position: absolute;
top: 40px;
top: 0px;
font-size: 1.1em;
margin: 0px auto;
padding: 0px 0px;

View File

@ -18,7 +18,7 @@
require File.expand_path('../../test_helper', __FILE__)
begin
require 'mocha'
require 'mocha/setup'
rescue
# Won't run some tests
end

View File

@ -0,0 +1,96 @@
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.expand_path('../../../test_helper', __FILE__)
class RoutingProjectsTest < ActionController::IntegrationTest
def test_courses
assert_routing(
{ :method => 'get', :path => "/courses" },
{ :controller => 'courses', :action => 'index' }
)
end
def test_courses_search
assert_routing(
"/courses/search",
{controller: 'courses', action: 'search'}
)
end
def test_courses_item
assert_routing(
'courses/233',
{controller: 'courses', action: 'show', id: '233'}
)
# id eq str
assert_routing(
'courses/timestypo',
{controller: 'courses', action: 'show', id: 'timestypo'}
)
end
def test_course_setting
assert_routing(
'courses/233/settings',
{controller: 'courses', action: 'settings', id: '233'}
)
end
def test_course_homework
assert_routing(
'courses/233/homework',
{controller: 'courses', action: 'homework', id: '233'}
)
assert_routing(
'courses/233/new_homework',
{controller: 'courses', action: 'new_homework', id: '233'}
)
end
def test_course_file
assert_routing(
'courses/233/file',
{controller: 'courses', action: 'file', id: '233'}
)
end
def test_course_feedback
assert_routing(
'courses/233/feedback',
{controller: 'courses', action: 'feedback', id: '233'}
)
end
def test_course_member
assert_routing(
'courses/233/member',
{controller: 'courses', action: 'member', id: '233'}
)
end
def test_course_finish_restart_course
assert_routing(
{path: 'courses/233/finishcourse', method: :post},
{controller: 'courses', action: 'finishcourse', id: '233'}
)
assert_routing(
{path: 'courses/233/restartcourse', method: :post},
{controller: 'courses', action: 'restartcourse', id: '233'}
)
end
end

View File

@ -1,3 +1,55 @@
require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
end
Spork.each_run do
# This code will be run each time you run your specs.
end
# --- Instructions ---
# Sort the contents of this file into a Spork.prefork and a Spork.each_run
# block.
#
# The Spork.prefork block is run only once when the spork server is started.
# You typically want to place most of your (slow) initializer code in here, in
# particular, require'ing any 3rd-party gems that you don't normally modify
# during development.
#
# The Spork.each_run block is run each time you run your specs. In case you
# need to load files that tend to change during development, require them here.
# With Rails, your application modules are loaded automatically, so sometimes
# this block can remain empty.
#
# Note: You can modify files loaded *from* the Spork.each_run block without
# restarting the spork server. However, this file itself will not be reloaded,
# so if you change any of the code inside the each_run block, you still need to
# restart the server. In general, if you have non-trivial code in this file,
# it's advisable to move it into a separate file so you can easily edit it
# without restarting spork. (For example, with RSpec, you could move
# non-trivial code into a file spec/support/my_helper.rb, making sure that the
# spec/support/* files are require'd from inside the each_run block.)
#
# Any code that is left outside the two blocks will be run during preforking
# *and* during each_run -- that's probably not what you want.
#
# These instructions should self-destruct in 10 seconds. If they don't, feel
# free to delete them.
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#

View File

@ -17,7 +17,7 @@
require File.expand_path('../../../../../../test_helper', __FILE__)
begin
require 'mocha'
require 'mocha/setup'
class BazaarAdapterTest < ActiveSupport::TestCase
REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository').to_s

View File

@ -17,7 +17,7 @@
require File.expand_path('../../../../../../test_helper', __FILE__)
begin
require 'mocha'
require 'mocha/setup'
class CvsAdapterTest < ActiveSupport::TestCase
REPOSITORY_PATH = Rails.root.join('tmp/test/cvs_repository').to_s

View File

@ -17,7 +17,7 @@
require File.expand_path('../../../../../../test_helper', __FILE__)
begin
require 'mocha'
require 'mocha/setup'
class DarcsAdapterTest < ActiveSupport::TestCase
REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s

View File

@ -17,7 +17,7 @@
require File.expand_path('../../../../../../test_helper', __FILE__)
begin
require 'mocha'
require 'mocha/setup'
class GitAdapterTest < ActiveSupport::TestCase
REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s

View File

@ -17,7 +17,7 @@
require File.expand_path('../../../../../../test_helper', __FILE__)
begin
require 'mocha'
require 'mocha/setup'
class MercurialAdapterTest < ActiveSupport::TestCase
HELPERS_DIR = Redmine::Scm::Adapters::MercurialAdapter::HELPERS_DIR

View File

@ -18,7 +18,7 @@
require File.expand_path('../../../../../../test_helper', __FILE__)
begin
require 'mocha'
require 'mocha/setup'
class SubversionAdapterTest < ActiveSupport::TestCase