diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 49760f734..000af2e8f 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -454,6 +454,7 @@ class BidsController < ApplicationController # 显示作业课程 # add by nwb def show_courseEx + if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?)) # flash[:notice] = "" @membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current)) @@ -510,7 +511,7 @@ class BidsController < ApplicationController #end @homework_list = paginateHelper all_homework_list,10 - + @jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count if params[:student_id].present? @temp = [] @homework_list.each do |pro| @@ -637,13 +638,8 @@ class BidsController < ApplicationController end @user = @bid.author @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @limit = 10 - @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @jour = @jours[@offset, @limit] + @jour = paginateHelper @jours,10 @bid.set_commit(@feedback_count) - respond_to do |format| format.js #format.api { render_api_ok } diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index e85f21517..db45f96e7 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -72,11 +72,7 @@ class HomeworkAttachController < ApplicationController def get_homework_jours #@user = @bid.author @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @limit = 10 - @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @jour = @jours[@offset, @limit] + @jour = paginateHelper @jours,10 @state = false respond_to do |format| format.js diff --git a/app/models/mailer.rb b/app/models/mailer.rb index f6c5e1a9e..a7f850766 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -42,7 +42,7 @@ class Mailer < ActionMailer::Base @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型 when :Bid - respond_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") when :Project return -1 if journals_for_message.jour.project_type == Project::ProjectType_project project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index d452b6d53..5b7a638eb 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -11,7 +11,7 @@ <%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author)) %> <%= l(:label_user_create_project_homework) %> - <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %> + <%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %> <% if(User.current.logged? && (!Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %> <%# 提交作业按钮 %> @@ -55,7 +55,7 @@ <% else %> <%= l(:label_x_homework_project, :count => temp.count) %>(<%= link_to temp.count, course_for_bid_path(bid.id) %>) <% end %> - <%= l(:label_x_responses, :count => bid.commit) %>(<%= link_to bid.commit, respond_path(bid) %>) + <%= l(:label_x_responses, :count => bid.commit) %>(<%= bid.commit %>) <% if betweentime(bid.deadline) < 0 %> <%= l(:label_commit_limit)%> diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index b34e1cd3c..7fdc47d1f 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -20,7 +20,7 @@
  • <%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%> - (23) + (<%= @jours_count %>)
  • <%= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "tb_all" unless @bid.homeworks.empty? %> @@ -39,7 +39,7 @@
  • <%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%> - (23) + (<%= @jours_count %>)
  • <% end %> diff --git a/app/views/bids/create.js.erb b/app/views/bids/create.js.erb index c140d70dc..c271b0aad 100644 --- a/app/views/bids/create.js.erb +++ b/app/views/bids/create.js.erb @@ -1,4 +1,6 @@ $('#history').html('<%= escape_javascript(render(:partial => 'homework_attach/history', :locals => {:bid => @bid, :journals => @jour, :state => true})) %>'); +//$('#tbc_01').html('<#%= escape_javascript(render(:partial => 'homework_attach/homework_jours',:locals => { :bid => @bid, :journals => @jour, :state => false} )) %>'); $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); +$('#jours_count').html("<%= @jours.count %>"); $('#bid_message_message').val(""); $('#bid_message_reference_user_id').val(""); diff --git a/app/views/homework_attach/_history.erb b/app/views/homework_attach/_history.erb index a837bbea9..f455d864d 100644 --- a/app/views/homework_attach/_history.erb +++ b/app/views/homework_attach/_history.erb @@ -62,4 +62,4 @@ <% end %> <% end %> - \ No newline at end of file + diff --git a/app/views/homework_attach/_homework_jours.html.erb b/app/views/homework_attach/_homework_jours.html.erb index 7e1544e96..526612c7d 100644 --- a/app/views/homework_attach/_homework_jours.html.erb +++ b/app/views/homework_attach/_homework_jours.html.erb @@ -7,7 +7,8 @@
    - <%= render :partial => 'history',:locals => { :bid => @bid, :journals => @jour, :state => false} %> + <%= render :partial => 'homework_attach/history',:locals => { :bid => @bid, :journals => @jour, :state => false} %>
    + diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 75d3a8949..cacb174d7 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -52,7 +52,7 @@ <%= link_to(course.name.to_s, homework_course_path(course)) if course %>
    > - <%= link_to(@bid.name, respond_path(@bid)) %> + <%= link_to(@bid.name, course_for_bid_path(@bid)) %>

    @@ -87,8 +87,7 @@ - - <%=link_to(@bid.name, respond_path(@bid)) %> + <%=link_to(@bid.name, course_for_bid_path(@bid)) %> @@ -197,26 +196,6 @@
    - -
    - -
    - <%= yield %> <%= call_hook :view_layouts_base_content %>
    diff --git a/config/routes.rb b/config/routes.rb index 8cc79cf9d..fcdca323c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -745,7 +745,7 @@ RedmineApp::Application.routes.draw do # added by young match 'calls', :to => 'bids#index' - match 'calls/:id', :to => 'bids#show', :as => 'respond' + #match 'calls/:id', :to => 'bids#show', :as => 'respond' # modified by longjun # bids#contests is not exist # match 'contest', :to => 'bids#contests', :as => 'contest' #modified @20140403