GitlabVersion
sw 11 years ago
commit 6e954d314f

@ -22,12 +22,12 @@ group :development do
end
group :test do
#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'
gem 'factory_girl'
gem "shoulda", "~> 3.5.0"
gem "mocha", "~> 1.1.0"
gem 'capybara', '~> 2.4.1'
gem 'nokogiri', '~> 1.6.3'
gem 'factory_girl', '~> 4.4.0'
gem 'selenium-webdriver', '~> 2.42.0'
platforms :mri, :mingw do
group :rmagick do
@ -40,11 +40,11 @@ group :test do
end
group :development, :test do
gem "guard-rails"
gem 'spork-testunit'
gem 'guard-spork'
gem "guard-rails", '~> 0.5.3'
gem 'spork-testunit', '~> 0.0.8'
gem 'guard-spork', '~> 1.5.1'
gem 'guard-test', '~> 1.0.0'
gem 'ruby-prof' unless RUBY_PLATFORM =~ /w32/
gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
gem 'pry'
gem 'pry-nav'
end

@ -55,10 +55,10 @@ class AttachmentsController < ApplicationController
candown = false
if @attachment.container.has_attribute?(:project) && @attachment.container.project
project = @attachment.container.project
candown= User.current.member_of?(project) || (project.is_public==1 && @attachment.is_public == 1)
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif @attachment.container.is_a?(Project)
project = @attachment.container
candown= User.current.member_of?(project) || (project.is_public==1 && @attachment.is_public == 1)
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif @attachment.container.has_attribute?(:course) && @attachment.container.course
course = @attachment.container.course
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)

@ -140,7 +140,11 @@ private
end
def find_board_if_available
@board = @project.boards.find(params[:id]) if params[:id]
if @project
@board = @project.boards.find(params[:id]) if params[:id]
elsif @course
@board = @course.boards.find(params[:id]) if params[:id]
end
rescue ActiveRecord::RecordNotFound
render_404
end

@ -77,6 +77,10 @@ class ContestsController < ApplicationController
end
end
def search
redirect_to action: 'index',name:params[:name]
end
def homework
@offset, @limit = api_offset_and_limit({:limit => 10})
@bids = @course.homeworks.order('deadline DESC')

@ -155,7 +155,7 @@ class CoursesController < ApplicationController
respond_to do |format|
format.html {
render :layout => 'base'
render :layout => 'course_base'
scope = Course
unless params[:closed]
scope = scope.active

@ -77,6 +77,9 @@ class MessagesController < ApplicationController
# Reply to a topic
def reply
if params[:reply][:content] == ""
(redirect_to board_message_path(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@ -112,10 +115,19 @@ class MessagesController < ApplicationController
(render_403; return false) unless @message.destroyable_by?(User.current)
r = @message.to_param
@message.destroy
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
else
redirect_to project_board_path(@project, @board)
# modify by nwb
if @project
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
else
redirect_to project_board_path(@project, @board)
end
elsif @course
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
else
redirect_to course_board_path(@course, @board)
end
end
end

@ -1,5 +1,5 @@
class SchoolController < ApplicationController
layout 'course_base'
before_filter :require_admin, :only => :upload_logo
def upload

@ -151,6 +151,9 @@ class UsersController < ApplicationController
# added by fq
def user_activities
redirect_to user_path(@user, type: params[:type])
return
# useless abort.
@watcher = User.watched_by_id(@user)
events = []
for user in @watcher

@ -118,6 +118,11 @@ class WelcomeController < ApplicationController
search_condition = params[:q]
search_type = params[:search_type].to_sym unless search_condition.blank?
if search_type.nil? && params[:contests_search] && params[:name] != ""
search_type = :contests
search_condition = params[:name]
end
respond_to do |format|
format.html{
case search_type
@ -126,6 +131,8 @@ class WelcomeController < ApplicationController
:project_type => Project::ProjectType_project)
when :courses
redirect_to courses_search_path(:name => search_condition)
when :contests
redirect_to contests_path(:name => search_condition)
when :users
redirect_to users_search_path(:name => search_condition)
when :users_teacher

@ -26,11 +26,11 @@ module CoursesHelper
end
# 返回学生数量即roles表中定义的Reporter
def studentCount project
searchStudent(project).count
#def studentCount project
# searchStudent(project).count
# or
# searchStudent(project).count
end
# end
# 判断用户是否是课程的管理员
# add by nwb

@ -43,7 +43,8 @@
</p>
<p class="stats">
<%= content_tag('span', "#{garble @course.members.count}", :class => "info") %>
<%= content_tag('span', l(:label_x_member, :count => @course.members.count)) %>
<%#= content_tag('span', l(:label_x_member, :count => @course.members.count)) %>
<%= content_tag('span', l(:label_x_member, :count => studentCount(@course)+teacherCount(@course))) %>
</p>
<!--gcm-->

@ -2,8 +2,8 @@
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1 %>
<%= labelled_form_for @course do |f| %>
<h3><%=l(:label_course_new)%></h3>
<%= labelled_form_for @course do |f| %>
<div class="box tabular">
<%= render :partial => 'course_form', :locals => { :f => f } %>
<span style="padding-left: 60px"><%= submit_tag l(:button_create), :class => "enterprise"%></span>

@ -12,21 +12,6 @@
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %>
<p></p>
<div class="box" id="files-box">
<label for="files-box" style="font-weight:bold;">&nbsp;&nbsp;<%= l(:label_files_filter) %></label>
<% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
:onchange => "course_attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>
&nbsp;
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label>
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange => "course_attachment_contenttypes_searchex(this.value)" %>
<% end %>
</div>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'course_new', locals: {course: @course} %>
</div>
@ -59,6 +44,21 @@
<div class="line_under" style="margin:20px 0px;"></div>
</div>
</div>
<div class="box" id="files-box">
<label for="files-box" style="font-weight:bold;">&nbsp;&nbsp;<%= l(:label_files_filter) %></label>
<% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
:onchange => "course_attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>
&nbsp;
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label>
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange => "course_attachment_contenttypes_searchex(this.value)" %>
<% end %>
</div>
</div>
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:course_id => @course.id, :format => 'js') }')" %>

@ -12,21 +12,7 @@
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<p></p>
<div class="box" id="files-box">
<label for="files-box" style="font-weight:bold;">&nbsp;&nbsp;<%= l(:label_files_filter) %></label>
<% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
:onchange => "attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>
&nbsp;
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label>
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange => "attachment_contenttypes_searchex(this.value)" %>
<% end %>
</div>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'new', locals: {project: @project} %>
@ -61,6 +47,21 @@
</div>
</div>
<div class="box" id="files-box">
<label for="files-box" style="font-weight:bold;">&nbsp;&nbsp;<%= l(:label_files_filter) %></label>
<% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
:onchange => "attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>
&nbsp;
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label>
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange => "attachment_contenttypes_searchex(this.value)" %>
<% end %>
</div>
</div>
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %>

@ -1,3 +1,8 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<!DOCTYPE html>
<html lang="<%= current_language %>">
<head>

@ -0,0 +1,49 @@
<% @nav_dispaly_course_all_label = 1
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1 %>
<!DOCTYPE html>
<html lang="<%= current_language %>">
<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 %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<body class="<%=h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%=render :partial => 'layouts/base_header'%>
<div id="main" class="nosidebar">
<div id="content_">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%=render :partial => 'layouts/base_footer'%>
</div>
</div>
</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 %>
</body>
</html>

@ -10,7 +10,7 @@
<h3><strong><%=h @news.title %></strong></h3>
<% if authorize_for('news', 'edit') %>
<% if authorize_for_course('news', 'edit') %>
<div id="edit-news" style="display:none;">
<%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>

@ -1,3 +1,5 @@
<% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
<% end %>

@ -383,13 +383,13 @@
$(document).ready(function ($) {
$("#content .menu-div:first~ div").first().find("a").attr("target", "_blank");
$('[mode=all]').click(function (event) {
window.location.href = '<%=user_activities_url%>';
window.location.href = '<%=user_url(@user)%>';
});
$('[mode=myself]').click(function (event) {
window.location.href = '<%=user_activities_url(type: 1)%>';
window.location.href = '<%=user_url(@user, type: 1)%>';
});
$('[mode=respond]').click(function (event) {
window.location.href = '<%=user_activities_url(type: 2)%>';
window.location.href = '<%=user_url(@user, type: 2)%>';
});
});
</script>
</script>

@ -131,12 +131,12 @@
</div>
<!--搜索框-->
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<%= form_tag({controller: 'contests', action: 'index'}, method: :get) do %>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
<%= text_field_tag 'name', params[:name], :placeholder => l(:label_search_intimation), name: "name", :class => 'blueinputbar', :style => 'width:240px; padding-right:50px;'%>
&nbsp;
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise" , :name => nil%>
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
<% end %>
<!-- <div class='font_lighter' style="display: inline-block; margin-top:3px;">竞赛相关内容搜索,如竞赛题目,参赛题目,参赛人名等。</div> -->
</div>
@ -169,7 +169,7 @@
<% end %>
</div>
<div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;">
<div style="overfowhidden;height:200px;float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;">
<span class='font_lighter' title ='<%=contest.description%>'><%=contest.description.truncate(100, omission: '...')%></span>
</div><br />

@ -5,9 +5,15 @@
) %>').hide();
$('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append);
pre_append.fadeIn(600);
var textarea = $('#project_respond_form_<%=@jfm.m_reply_id.to_s%> textarea');
textarea.val('');
$('#project_respond_form_<%=@jfm.m_reply_id.to_s%>').hide();
var textarea = $('#project_respond_form_<%=@jfm.m_reply_id.to_s%> textarea');
textarea.val('');
$('#project_respond_form_<%=@jfm.m_reply_id.to_s%>').hide();
var textarea1 = $('#course_respond_form_<%=@jfm.m_reply_id.to_s%> textarea');
textarea1.val('');
$('#course_respond_form_<%=@jfm.m_reply_id.to_s%>').hide();
setMaxLengthItem(pre_append.find('textarea')[0]);
<% else %>
alert("<%= l(:label_feedback_fail) %>");

@ -1646,6 +1646,7 @@ en:
label_memo_locked: 'Topic is locked'
label_downloads_list: enter file list.
label_sumbit_empty: search bar need container.
label_reply_empty: Reply Cann't Empty.
label_setup_time: Start date
label_endup_time: Over date
label_class_period: Class hour

@ -1933,6 +1933,7 @@ zh:
label_contest_reason: 参赛宣言:
label_notification: 通知
label_sumbit_empty: 搜索内容不能为空
label_reply_empty: 回复内容不能为空
no_use: 没有帮助
cancel_no_use: 撤销没有帮助
cancel_apply: 取消申请

@ -215,7 +215,7 @@ RedmineApp::Application.routes.draw do
end
member do
match 'user_projects', :to => 'users#user_projects', :via => :get
match 'user_activities', :to => 'users#show', :via => :get, :as => "user_activities"
match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities"
match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback"
match 'watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info'
@ -578,6 +578,7 @@ RedmineApp::Application.routes.draw do
end
match 'courses/search', :to => 'courses#search'
match '/contests/search', :controller => 'contests', :action => 'search', :via => [:get, :post]
# add by nwb
# 课程路由设置
resources :courses do

@ -1,4 +1,30 @@
---
courses_invalid_001:
id: 1
tea_id:
name: ''
state:
code:
time:
extra:
created_at: 2013-09-30 15:36:00.000000000 Z
updated_at: 2014-04-19 01:50:41.000000000 Z
location:
term:
string:
password:
setup_time:
endup_time:
class_period:
school_id:
description:
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1
courses_008:
id: 8
tea_id: 5
@ -15,7 +41,7 @@ courses_008:
password: '1234'
setup_time:
endup_time: '2014-04-18 00:00:00'
class_period: ''
class_period: '32'
school_id: 117
description: 介绍分布计算模型,分布计算平台,分布式软件开发环境等分布计算方向的概念、技术和环境,并通过实验提高学生的实践能力。
status: 1

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

Loading…
Cancel
Save