This commit is contained in:
sw 2014-10-17 13:56:00 +08:00
commit 98c2313a66
24 changed files with 44 additions and 45 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

@ -226,6 +226,7 @@ class BidsController < ApplicationController
layout_file = ''
case @bid.reward_type
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

@ -714,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

@ -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

@ -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

@ -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

@ -10,3 +10,4 @@
<%= javascript_tag "$('#bid_name').focus();" %>
<% end %>
</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

@ -103,3 +103,4 @@ function checkMaxLength() {
<%= pagination_links_full @feedback_pages %>
</ul>
</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

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

View File

@ -31,3 +31,4 @@ $(document).ready(function() {
});
});
</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

@ -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