diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index ec0480c19..353108dc7 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -216,13 +216,13 @@ class AttachmentsController < ApplicationController
if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) }
elsif @attachment.container.is_a?(StudentWorksScore)
- @is_destroy = true #根据ID删除页面对应的数据,js刷新页面
+ @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面
format.js
elsif @attachment.container.is_a?(HomeworkCommon)
- @is_destroy = true #根据ID删除页面对应的数据,js刷新页面
+ @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面
format.js
elsif @attachment.container.is_a?(StudentWork)
- @is_destroy = true #根据ID删除页面对应的数据,js刷新页面
+ @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面
format.js
elsif @attachment.container.is_a?(Message)
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
@@ -246,7 +246,7 @@ class AttachmentsController < ApplicationController
end
format.js
- end
+ end
end
def delete_homework
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 0382e7be0..23053a48e 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -25,7 +25,7 @@ class UsersController < ApplicationController
menu_item :user_course, :only => :user_courses
menu_item :user_homework, :only => :user_homeworks
menu_item :user_project, :only => [:user_projects, :watch_projects]
- menu_item :requirement_focus, :only => :watch_bids
+ # menu_item :requirement_focus, :only => :watch_bids
menu_item :requirement_focus, :only => :watch_contests
menu_item :user_newfeedback, :only => :user_newfeedback
@@ -36,14 +36,14 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
- before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
+ before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_contests, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index]
#edit has been deleted by huang, 2013-9-23
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
- :watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
+ :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
before_filter :auth_user_extension, only: :show
@@ -141,25 +141,25 @@ class UsersController < ApplicationController
##added by fq
def watch_bids
- cond = 'bids.reward_type <> 1'
- @bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang
- @offset, @limit = api_offset_and_limit({:limit => 10})
- @bid_count = @bids.count
- @bid_pages = Paginator.new @bid_count, @limit, params['page']
- @offset ||= @bid_pages.reverse_offset
- unless @offset == 0
- @bid = @bids.offset(@offset).limit(@limit).all.reverse
- else
- limit = @bid_count % @limit
- @bid = @bids.offset(@offset).limit(limit).all.reverse
- end
-
- respond_to do |format|
- format.html {
- render :layout => 'base_users'
- }
- format.api
- end
+ # cond = 'bids.reward_type <> 1'
+ # @bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang
+ # @offset, @limit = api_offset_and_limit({:limit => 10})
+ # @bid_count = @bids.count
+ # @bid_pages = Paginator.new @bid_count, @limit, params['page']
+ # @offset ||= @bid_pages.reverse_offset
+ # unless @offset == 0
+ # @bid = @bids.offset(@offset).limit(@limit).all.reverse
+ # else
+ # limit = @bid_count % @limit
+ # @bid = @bids.offset(@offset).limit(limit).all.reverse
+ # end
+ #
+ # respond_to do |format|
+ # format.html {
+ # render :layout => 'base_users'
+ # }
+ # format.api
+ # end
end
#new add by linchun
@@ -215,24 +215,24 @@ class UsersController < ApplicationController
# added by huang
def user_homeworks
- @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
- @memberships = []
- @membership.each do |membership|
- if membership.project.project_type == 1
- @memberships << membership
- end
- end
- @bid = []
- @memberships.each do |membership|
- @bid += membership.project.homeworks
- end
- @bid = @bid.group_by {|bid| bid.courses.first.id}
- unless User.current.admin?
- if !@user.active?
- render_404
- return
- end
- end
+ # @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
+ # @memberships = []
+ # @membership.each do |membership|
+ # if membership.project.project_type == 1
+ # @memberships << membership
+ # end
+ # end
+ # @bid = []
+ # @memberships.each do |membership|
+ # @bid += membership.project.homeworks
+ # end
+ # @bid = @bid.group_by {|bid| bid.courses.first.id}
+ # unless User.current.admin?
+ # if !@user.active?
+ # render_404
+ # return
+ # end
+ # end
end
@@ -757,7 +757,7 @@ class UsersController < ApplicationController
when '3' then
@obj = Issue.find_by_id(@obj_id)
when '4' then
- @obj = Bid.find_by_id(@obj_id)
+ # @obj = Bid.find_by_id(@obj_id)
when '5' then
@obj = Forum.find_by_id(@obj_id)
when '6'
@@ -800,7 +800,7 @@ class UsersController < ApplicationController
when '3' then
@obj = Issue.find_by_id(@obj_id)
when '4' then
- @obj = Bid.find_by_id(@obj_id)
+ # @obj = Bid.find_by_id(@obj_id)
when '5' then
@obj = Forum.find_by_id(@obj_id)
when '6'
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index ebccfcaf4..8283e15b7 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -31,7 +31,7 @@
}
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
- $('#ajax-modal').before("");
+ $('#ajax-modal').before("
");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
diff --git a/app/views/files/_project_file_new.html.erb b/app/views/files/_project_file_new.html.erb
index 1e217f991..878e6a75e 100644
--- a/app/views/files/_project_file_new.html.erb
+++ b/app/views/files/_project_file_new.html.erb
@@ -5,7 +5,7 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
- $('#ajax-modal').before("
");
+ $('#ajax-modal').before("
");
$('#ajax-modal').parent().css("top","40%").css("left","36%");
$('#ajax-modal').parent().addClass("popbox_polls");
}
diff --git a/app/views/files/quote_resource_show.js.erb b/app/views/files/quote_resource_show.js.erb
index fa1f8f4ca..76025fbd2 100644
--- a/app/views/files/quote_resource_show.js.erb
+++ b/app/views/files/quote_resource_show.js.erb
@@ -6,6 +6,6 @@
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("
");
+$('#ajax-modal').before("
");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
\ No newline at end of file
diff --git a/app/views/files/quote_resource_show_project.js.erb b/app/views/files/quote_resource_show_project.js.erb
index d1a44e90f..41dc19fc5 100644
--- a/app/views/files/quote_resource_show_project.js.erb
+++ b/app/views/files/quote_resource_show_project.js.erb
@@ -6,6 +6,6 @@
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("
");
+$('#ajax-modal').before("
");
$('#ajax-modal').parent().css("top","30%").css("left","35%");
$('#ajax-modal').parent().addClass("popbox_polls");
\ No newline at end of file
diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb
index 269017eb8..5686c9a1b 100644
--- a/app/views/layouts/base_users.html.erb
+++ b/app/views/layouts/base_users.html.erb
@@ -218,9 +218,8 @@
<% end %>
- <% unless @user.user_extensions.nil?&&@user.user_extensions.location.empty?%>
+ <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%>