From 789a8d139208ce9a30185620684893e622df0e34 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 3 Jun 2014 11:19:20 +0800 Subject: [PATCH] =?UTF-8?q?tag=5Fname=E4=BB=8EProjectInfo=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8A=9B=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=E4=B8=8D=E6=9F=A5=E8=AF=A2=E7=BD=91=E7=AB=99=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=EF=BC=88=E5=88=A0=E4=B8=9C=E8=A5=BF=20gemfile?= =?UTF-8?q?=E5=8A=A0pry=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 4 +++ app/controllers/welcome_controller.rb | 45 +++++++++++---------------- app/views/tags/_tag_name.html.erb | 4 +-- app/views/welcome/course.html.erb | 13 -------- app/views/welcome/index.html.erb | 12 ------- 5 files changed, 24 insertions(+), 54 deletions(-) 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 @@
- <%= 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 @@
- <%= render partial: 'link_to_another' %> \ No newline at end of file