Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-10-17 14:00:19 +08:00
commit 664fb966e3
37 changed files with 71 additions and 59 deletions

View File

@ -144,9 +144,9 @@ class AdminController < ApplicationController
#首页定制
def first_page_made
if request.get?
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
@first_page.web_title = params[:web_title]
@first_page.description = params[:first_page][:description]
#@first_page.title = params[:title]
@ -179,11 +179,11 @@ class AdminController < ApplicationController
def course_page_made
if request.get?
@course_page = FirstPage.where("page_type = 'course'").first
@first_page = FirstPage.where("page_type = 'project'").first
@course_page = FirstPage.find_by_page_type('course')
@first_page = FirstPage.find_by_page_type('project')
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@course_page = FirstPage.where("page_type = 'course'").first
@first_page = FirstPage.find_by_page_type('project')
@course_page = FirstPage.find_by_page_type('course')
@first_page.web_title = params[:web_title]
@course_page.web_title = params[:web_title]
@course_page.title = params[:course_title]
@ -215,12 +215,12 @@ class AdminController < ApplicationController
def contest_page_made
if request.get?
@contest_page = FirstPage.where("page_type = 'contest'").first
@first_page = FirstPage.where("page_type = 'project'").first
@contest_page = FirstPage.find_by_page_type('contest')
@first_page = FirstPage.find_by_page_type('project')
@notification = ContestNotification.first;
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@contest_page = FirstPage.where("page_type = 'contest'").first
@first_page = FirstPage.find_by_page_type('project')
@contest_page = FirstPage.find_by_page_type('contest')
@notification = ContestNotification.first;
@first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title]
@ -255,10 +255,10 @@ class AdminController < ApplicationController
def web_footer_made
if request.get?
@organizer = WebFooterOranizer.first
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
#@notification = ContestNotification.all.first;
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
@first_page.web_title = params[:web_title]
@organizer = WebFooterOranizer.first
if @organizer.nil?

View File

@ -754,7 +754,7 @@ class ApplicationController < ActionController::Base
#查找首页相关信息
def find_first_page
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
if @first_page.nil?
@first_page = FirstPage.new
@first_page.page_type = 'project'

View File

@ -225,7 +225,8 @@ class BidsController < ApplicationController
respond_to do |format|
layout_file = ''
case @bid.reward_type
when 3
when 3
html_title(l(:label_question_student))
layout_file = 'base_homework'
when 1
layout_file = 'base_bids'
@ -523,6 +524,7 @@ class BidsController < ApplicationController
respond_to do |format|
if @bid.reward_type == 3
format.html {
html_title(l(:label_homework_info))
render :layout => 'base_homework'
}
elsif @bid.reward_type == 1
@ -1011,7 +1013,7 @@ class BidsController < ApplicationController
#验证是否显示课程
def can_show_course
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
if @first_page.show_course == 2
render_404
end
@ -1019,7 +1021,7 @@ class BidsController < ApplicationController
#验证是否显示竞赛
def can_show_contest
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
if @first_page.show_contest == 2
render_404
end

View File

@ -707,7 +707,7 @@ class ContestsController < ApplicationController
#验证是否显示竞赛
def can_show_contest
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
if @first_page.show_contest == 2
render_404
end

View File

@ -39,6 +39,8 @@ class CoursesController < ApplicationController
else
@state = 3
end
else
@state = 4
end
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
@ -101,6 +103,7 @@ class CoursesController < ApplicationController
else
respond_to do |format|
format.html {
settings
render :action => 'settings'
}
format.api { render_validation_errors(@course) }
@ -711,7 +714,7 @@ class CoursesController < ApplicationController
#验证是否显示课程
def can_show_course
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
if @first_page.show_course == 2
render_404
end

View File

@ -356,7 +356,7 @@ class HomeworkAttachController < ApplicationController
#验证是否显示课程
def can_show_course
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
if @first_page.show_course == 2
render_404
end

View File

@ -141,7 +141,7 @@ class MessagesController < ApplicationController
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to board_message_url(@project, @board)
redirect_to project_boards_url(@project)
end
elsif @course
if @message.parent

View File

@ -24,6 +24,7 @@ class SettingsController < ApplicationController
before_filter :require_admin
def index
edit
render :action => 'edit'
end

View File

@ -57,6 +57,7 @@ class TrackersController < ApplicationController
redirect_to trackers_url
return
end
new
render :action => 'new'
end

View File

@ -821,7 +821,7 @@ class UsersController < ApplicationController
#验证是否显示课程
def can_show_course
@first_page = FirstPage.where("page_type = 'project'").first
@first_page = FirstPage.find_by_page_type('project')
if @first_page.show_course == 2
render_404
end

View File

@ -20,6 +20,7 @@ class WebFooterCompaniesController < ApplicationController
redirect_to web_footer_companies_url
else
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
new
render :action => 'new'
end
end
@ -41,6 +42,7 @@ class WebFooterCompaniesController < ApplicationController
redirect_to web_footer_companies_url
else
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
edit
render :action => 'edit'
end
end

View File

@ -25,8 +25,6 @@ class WelcomeController < ApplicationController
before_filter :entry_select, :only => [:index]
def index
#@first_page = FirstPage.where("page_type = 'project'").first
#@show_course = @first_page.show_course
if @first_page.nil? || @first_page.sort_type.nil?
@projects = find_miracle_project(10, 3,"score desc")
else
@ -61,12 +59,7 @@ class WelcomeController < ApplicationController
end
def course
@course_page = FirstPage.where("page_type = 'course'").first
#if params[:school_id]
# @school_id = params[:school_id]
#elsif User.current.logged? && User.current.user_extensions.try(:school)
# @school_id = User.current.user_extensions.school.try(:id)
#end
@course_page = FirstPage.find_by_page_type('course')
@school_id = params[:school_id] || User.current.user_extensions.school.try(:id)
@logoLink ||= logolink()
end
@ -74,7 +67,7 @@ class WelcomeController < ApplicationController
def logolink()
@course_page = FirstPage.where("page_type = 'course'").first
@course_page = FirstPage.find_by_page_type('course')
logo = get_avatar?(@course_page)
id = params[:school_id]
logo_link = ""
@ -110,7 +103,7 @@ class WelcomeController < ApplicationController
def contest
@contest_page = FirstPage.where("page_type = 'contest'").first
@contest_page = FirstPage.find_by_page_type('contest')
@contest_notifications = Contestnotification.order("created_at desc").limit(5)
end
@ -150,7 +143,6 @@ class WelcomeController < ApplicationController
private
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
def entry_select
#@first_page = FirstPage.where("page_type = 'project'").first
url = request.original_url.gsub('/','')
if url.include?(Setting.host_course.gsub('/',''))
if @first_page.show_course == 1

View File

@ -68,6 +68,7 @@ class WikiController < ApplicationController
def show
if @page.new_record?
if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? && !api_request?
edit
render :action => 'edit'
else
render_404

View File

@ -652,7 +652,7 @@ module ApplicationHelper
if(args == ["/"])
args = []
end
first_page = FirstPage.where("page_type = 'project'").first
first_page = FirstPage.find_by_page_type('project')
if args.empty?
title = @html_title || []
title << @project.name if @project

View File

@ -31,7 +31,7 @@ a:hover{ }
没有访问权限!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="#" target="_blank">后退一步</a>
<a href="javascript:history.back()" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
</div>
</div>

View File

@ -31,7 +31,7 @@ a:hover{ }
页面不见了!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="#" target="_blank">后退一步</a>
<a href="javascript:history.back()" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
</div>
</div>

View File

@ -9,4 +9,5 @@
<%= submit_tag l(:button_create) %>
<%= javascript_tag "$('#bid_name').focus();" %>
<% end %>
</div>
</div>
<% html_title(l(:label_newtype_contest)) -%>

View File

@ -312,4 +312,4 @@
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_contest_joincontest)) -%>

View File

@ -44,4 +44,4 @@
<%= pagination_links_full @feedback_pages %>
</ul>
</div>
<% html_title(l(:label_user_response)) -%>

View File

@ -3,16 +3,18 @@
<% end %>
<% if @state %>
<% if @state == 0 %>
alert("加入成功")
alert("加入成功");
<% elsif @state == 1 %>
alert("密码错误")
alert("密码错误");
<% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)")
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
<% elsif @state == 3 %>
alert("您已经加入了课程");
<% elsif @state == 3 %>
alert("您已经的课程不存在")
<% elsif @state == 4 %>
alert("您已经的课程不存在");
<% elsif @state == 4 %>
alert("您还未登录");
<% else %>
alert("未知错误,请稍后再试")
alert("未知错误,请稍后再试");
<% end %>
<% end %>

View File

@ -102,4 +102,5 @@ function checkMaxLength() {
<ul>
<%= pagination_links_full @feedback_pages %>
</ul>
</div>
</div>
<% html_title(l(:label_course_feedback)) -%>

View File

@ -57,3 +57,4 @@ function showSubH(/* ... */){
}
</script>
<% html_title(l(:label_homework)) -%>

View File

@ -119,6 +119,6 @@
<%= pagination_links_full @events_pages %>
</ul>
</div>
<% html_title(l(:label_course_overview)) -%>

View File

@ -69,5 +69,4 @@
<div id="all_browse_div" class="all_browse_div">
<%= render :partial => 'course_show_all_attachment' %>
</div>
<% html_title(l(:label_attachment_plural)) -%>
<% html_title(l(:label_course_file)) -%>

View File

@ -189,7 +189,7 @@
</div>
<div style="padding-bottom: 8px">
<% if @course.description && @course.description.lstrip.rstrip.size>0 %>
<% if @course.description && !@course.description.blank? %>
<div class="font_lighter_sidebar" style="word-break:break-all; word-wrap:break-word;">
<%= textilizable @course.description %>

View File

@ -8,7 +8,7 @@
<meta charset="utf-8" />
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<title><%=h l(:label_active_homework) << " - Trustie" %></title>
<title><%=h html_title %></title>
<%= csrf_meta_tag %>
<%= favicon %>

View File

@ -3,7 +3,7 @@
<div class="box tabular settings">
<p><%= setting_select :ui_theme, Redmine::Themes.themes.collect {|t| [t.name, t.id]}, :blank => :label_default, :label => :label_theme %></p>
<p><%= setting_select :default_language, :Chinese简体中文 => :zh, :English => :en %></p>
<p><%= setting_select :default_language, lang_options_for_select(false) %></p>
<p><%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], :blank => :label_language_based %></p>
<% locale = User.current.language.blank? ? ::I18n.locale : User.current.language %>

View File

@ -7,7 +7,7 @@
<table border=0 cellSpacing=0 cellPadding=0 style="width: 100%;table-layout: fixed;">
<tbody>
<tr>
<td class="r1">
<td class="r1" style="word-break: break-all;word-wrap: break-word;">
<div class="cb">
<strong><%= l(:label_attachment) %>:&nbsp;&nbsp;<%= file.filename %></strong>
<span style="margin-left: 4px;">

View File

@ -480,3 +480,4 @@
});
});
</script>
<% html_title(l(:label_activity)) -%>

View File

@ -30,4 +30,5 @@ $(document).ready(function() {
})
});
});
</script>
</script>
<% html_title(l(:label_user_course)) -%>

View File

@ -15,4 +15,4 @@
</ul>
</div>
</div>
<% html_title(l(:label_responses)) -%>

View File

@ -63,3 +63,4 @@
$('[mode=watched]').click(function(event) {window.location.href='<%=watch_projects_user_url(type: 1)%>'; });
});
</script>
<% html_title(l(:label_user_project)) -%>

View File

@ -4,7 +4,8 @@
:class => 'icon icon-add') if User.current.allowed_to?(:add_course,nil, :global => true) %>
<% end %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to l(:label_course_join_student), join_private_courses_courses_path ,:remote => true, :class => 'icon icon-add' %>
&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
<%= link_to l(:label_course_join_student), join_private_courses_courses_path ,:remote => true, :class => 'icon icon-add' %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to l(:label_more), {:controller => 'courses', :action => 'index', :school_id => school_id} %>

View File

@ -579,7 +579,7 @@ RedmineApp::Application.routes.draw do
match 'permissions', :via => [:get, :post]
end
end
resources :web_footer_companies, :only => [:index, :new, :edit, :create,:update,:destroy]
resources :web_footer_companies, :except => :show
resources :enumerations, :except => :show
match 'enumerations/:type', :to => 'enumerations#index', :via => :get

View File

@ -415,7 +415,7 @@ Redmine::MenuManager.map :course_menu do |menu|
end
Redmine::MenuManager.map :user_menu do |menu|
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
menu.push :user_course, {:controller => 'users', :action => 'user_courses'},:if => Proc.new {|c| FirstPage.where("page_type = 'project'").first.show_course != 2}
menu.push :user_course, {:controller => 'users', :action => 'user_courses'},:if => Proc.new {|c| FirstPage.find_by_page_type('project').show_course != 2}
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang

View File

@ -1390,7 +1390,7 @@ a.toggle-all:hover {text-decoration:none;}
table.list tbody tr:hover { background-color:#ffffdd; }
table.list tbody tr.group:hover { background-color:inherit; }
table td {padding:2px;word-break: break-all;word-wrap: break-word;}
table td {padding:2px;}
table p {margin:0;}
.odd {background-color:#f6f7f8;}
.even {background-color: #fff;}

View File

@ -718,6 +718,8 @@ div.actions input[type="text"] {
margin-bottom: 40px;
background-color: #F8F8F8;
border-radius: 3px;
word-break: break-all;
word-wrap: break-word;
}
.memo-timestamp {