diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 8f48d3857..0c0b71ffa 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -715,14 +715,14 @@ class BidsController < ApplicationController def update @bid = Bid.find(params[:id]) - @project = @bid.courses.first + @project = @bid.courses.first#Project.find(params[:course_id]) if @bid.update_attributes(params[:bid]) flash[:notice] = l(:label_update_homework_succeed) #@project = Project.find(params[:course_id]) redirect_to project_homework_path(@project) else @bid.safe_attributes = params[:bid] - render :action => 'edit', :layout =>'base_courses' ,:bid_id=>@bid.id,:project_id =>@project + render :action => 'edit', :layout =>'base_courses' end end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 1baf5d62c..150071b41 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -43,7 +43,7 @@ class MessagesController < ApplicationController @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page @replies = @topic.children. includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on ASC"). + reorder("#{Message.table_name}.created_on DESC"). limit(@reply_pages.per_page). offset(@reply_pages.offset). all diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a120394ef..01021cb57 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -295,8 +295,12 @@ class ProjectsController < ApplicationController project_type = params[:project_type].to_i projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities @projects = projects_all.visible - @projects_all = @projects.visible.like(params[:name]) if params[:name].present? - + #@projects_all = @projects.visible.like(params[:name]) if params[:name].present? + if params[:name].present? + @projects_all = @projects.visible.like(params[:name]) + else + @projects_all = @projects; + end @project_count = @projects_all.count @project_pages = Paginator.new @project_count, per_page_option, params['page'] diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 16a3d8b58..052aae468 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -55,9 +55,9 @@ module FilesHelper result = true end if result - if contentType != l(:attachment_all) && contentType != attachment.suffix_type + if contentType != '0' && contentType != attachment.suffix_type result = false - end + end end result end diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 7c8e1468c..9237b2aa8 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -13,9 +13,11 @@ <%= l(:label_user_create_project_homework) %> <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %> + <% if(User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %> <%# 提交作业按钮 %> <%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@project) %> - <% if (User.current.admin?||User.current.id==bid.author_id) %> + <% end %> + <% if (User.current.admin?||User.current.id==bid.author_id) %> <%= link_to( l(:button_edit), {:action => 'edit', :controller=>'bids', :project_id =>@project.id, :bid_id => bid.id}, @@ -33,10 +35,19 @@ - <% if bid.homework_type == 1%> - <%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<%= link_to bid.homeworks.count, project_for_bid_path(bid.id) %>) + <% @bidding_project = bid.biding_projects.all + @temp = [] + @bidding_project.each do |pro| + if pro.project && pro.project.project_status + @temp << pro + end + @temp + end + %> + <% if bid.homework_type == 1%> + <%= l(:label_x_homework_project, :count => @temp.count) %>(<%= link_to @temp.count, project_for_bid_path(bid.id) %>) <% else %> - <%= l(:label_x_homework_project, :count => bid.biding_projects.count) %>(<%= link_to bid.biding_projects.count, project_for_bid_path(bid.id) %>) + <%= l(:label_x_homework_project, :count => @temp.count) %>(<%= link_to @temp.count, project_for_bid_path(bid.id) %>) <% end %> <%= l(:label_x_responses, :count => bid.commit) %>(<%= link_to bid.commit, respond_path(bid) %>) diff --git a/app/views/bids/_list_projects.html.erb b/app/views/bids/_list_projects.html.erb index 41c5ab9d1..ecbf5dfc3 100644 --- a/app/views/bids/_list_projects.html.erb +++ b/app/views/bids/_list_projects.html.erb @@ -148,11 +148,12 @@ - + <% if Time.parse(@bid.deadline.to_s) < Time.parse(b_project.created_at.to_s) %> 迟交 <% end %> + <%= link_to image_tag('delete.png') %> diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index ad207adf2..07dc6a27f 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -3,72 +3,70 @@ <% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> - + + diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index 06aae4044..01c57c490 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -3,73 +3,69 @@ <% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> -
- -
+ + diff --git a/app/views/files/getattachtype.js.erb b/app/views/files/getattachtype.js.erb index fe8458e20..3bc9863b2 100644 --- a/app/views/files/getattachtype.js.erb +++ b/app/views/files/getattachtype.js.erb @@ -1,5 +1,5 @@ - <% if @attachtype==0 && @contenttype==l(:attachment_all)%> - $("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>'); - <%else%> - $("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>'); - <%end%> +<% if @attachtype==0 && @contenttype=='0' %> +$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>'); +<%else%> +$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>'); +<%end%> diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 08052f11e..02268746d 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,205 +1,34 @@ <% attachmenttypes = @project.attachmenttypes %> <% sufixtypes = @project.contenttypes %> - - -<%=(@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区 +<%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> - <%= link_to( l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %> + <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %> <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> <% if attachmenttypes.any? %>       - - <%= select_tag "attachment_browse", content_tag('option',l(:attachment_all)) +options_from_collection_for_select(attachmenttypes, "id", "typeName"), - :onchange=>"attachmenttypes_searchex(this.value)"%> - <% end %> - <% if sufixtypes.any? %> + + <%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"), + :onchange => "attachmenttypes_searchex(this.value)" %> + <% end %> + <% if sufixtypes.any? %>   - - <%= select_tag "attach_sufix_browse", content_tag('option', l(:attachment_all)) +options_for_select(sufixtypes), - :onchange=>"attachment_contenttypes_searchex(this.value)"%> + + <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes), + :onchange => "attachment_contenttypes_searchex(this.value)" %> <% end %> -