diff --git a/Gemfile b/Gemfile
index 1d8276799..3784e60d8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -19,6 +19,10 @@ gem 'acts-as-taggable-on'
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
# Gems used only for assets and not required
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index c662c44f7..c92f39d34 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -21,13 +21,7 @@ class WelcomeController < ApplicationController
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [: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
def robots
@@ -36,10 +30,7 @@ class WelcomeController < ApplicationController
end
def course
- @courseCount = Project.course_entities.count
- @teacherCount = User.teacher.count
- @studentCount = User.student.count
- @logoLink = logolink()
+ @logoLink ||= logolink()
end
@@ -121,25 +112,25 @@ class WelcomeController < ApplicationController
end
end
- def render(*args)
- _fake if @fake_filter
- super
- end
+ # def render(*args)
+ # _fake if @fake_filter
+ # super
+ # end
- private
+ # private
- def fake
- @fake_filter = true
- end
+ # def fake
+ # @fake_filter = true
+ # end
- # 骗子方法
- def _fake
- instance_variables.map { |variable|
- if variable.to_s =~ /Count$/
- self.instance_variable_set(variable.to_sym,
- ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
- end
- }
- end
+ # # 骗子方法
+ # def _fake
+ # instance_variables.map { |variable|
+ # if variable.to_s =~ /Count$/
+ # self.instance_variable_set(variable.to_sym,
+ # ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
+ # end
+ # }
+ # end
end
diff --git a/app/views/tags/_tag_name.html.erb b/app/views/tags/_tag_name.html.erb
index 4891cc233..dad5d53f7 100644
--- a/app/views/tags/_tag_name.html.erb
+++ b/app/views/tags/_tag_name.html.erb
@@ -51,14 +51,14 @@
<% when '2' %>
- <% if (ProjectInfo.find_by_project_id(obj.id)).user_id == User.current.id %>
+ <% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
<% when '3' %>
- <% if (ProjectInfo.find_by_project_id(obj.project_id)).user_id == User.current.id %>
+ <% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_id) == User.current.id %>
<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %>
<% end %>
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index 88fd3bf4d..884962629 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -259,17 +259,4 @@
-
-
-
-
- 当前网站状态 |
- 活跃课程: <%=@courseCount%> |
- 高校: 2个 |
- 教师: <%=@teacherCount%> 名 |
- 学生: <%=@studentCount%> 名 |
- |
-
-
-
<%= render partial: 'link_to_another' %>
\ No newline at end of file
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 6702f520c..ca99f33dc 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -137,16 +137,4 @@
-
-
-
-
- 当前网站状态 |
- 活跃项目:<%=@projectCount%>个 |
- 私有项目: <%=@projectHidenCount%>个 |
- 开发者:<%=@allUsercount%>个 |
-
-
-
-
<%= render partial: 'link_to_another' %>
\ No newline at end of file