From da37a12158ec0e3744883bbbdf0b5c3ff2643f50 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 14 May 2014 09:35:44 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 91d2b58cf4d73df16576ec3b51b5db8526b93a2a Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 14 May 2014 11:28:32 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=97=B6=E5=B1=8F=E8=94=BD=E8=AF=A5=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 7c8e1468c..5abd56a17 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}, From 8dab599fd2ecf39112dc5b27fde2eb6b09e36d51 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 14 May 2014 11:58:05 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=9B=9E?= =?UTF-8?q?=E5=B8=96=E9=A1=BA=E5=BA=8F=E6=94=B9=E4=B8=BA=E4=B8=8E=E7=95=99?= =?UTF-8?q?=E8=A8=80=E4=B8=80=E8=87=B4=EF=BC=88=E6=96=B0=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=9C=A8=E5=89=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 2 +- app/views/messages/show.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/views/messages/show.html.erb b/app/views/messages/show.html.erb index 6f7e5d5ef..aecfc332a 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -124,7 +124,7 @@ - + +
<%= reply_count += 1 %>楼 <%= reply_count += 1 %>楼
<%= link_to( From 5649cc545ea1821e43ff2f2f8e776c3ac417656f Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 14 May 2014 15:22:08 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=95=8C=E9=9D=A2=E6=90=9C=E7=B4=A2=E7=A9=BA?= =?UTF-8?q?=E5=80=BC=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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'] From a19a1b74a71bfdb4fbaea8ad1eaa70197e78560f Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 14 May 2014 17:05:51 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=95=B0=E6=98=BE=E7=A4=BA=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 5abd56a17..9237b2aa8 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -35,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) %>) From 829c77879a360aa2a06a6dcea1a37c9ef481b3bc Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 14 May 2014 17:12:04 +0800 Subject: [PATCH 6/8] typo --- app/helpers/files_helper.rb | 4 +- app/views/files/_show_all_attachment.html.erb | 134 +- app/views/files/_sort_by_attachtypel.html.erb | 132 +- app/views/files/getattachtype.js.erb | 10 +- app/views/files/index.html.erb | 307 +--- public/stylesheets/nyan.css | 1473 ++++++++++------- 6 files changed, 1084 insertions(+), 976 deletions(-) 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/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index ad207adf2..6a2d6e545 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -3,72 +3,72 @@ <% attachmenttypes = @project.attachmenttypes %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% edit_allowed = User.current.allowed_to?(:manage_files, @project) %> -
    - - - - - - - - - - <%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%> - <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope =>"col" , :id => "vzebra-comedy")%> - <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope =>"col", :id=> "vzebra-children")%> - <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%> - <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> - <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %> - <%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %> - - - - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - - - - <% end -%> - <% container.attachments.each do |file| %> - "> - - - - - - - - - - - - - <% end -%> - <% reset_cycle %> +
    - <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> -
    <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %><%= format_time(file.created_on) %><%= number_to_human_size(file.filesize) %> -
    <%= file.attachmentstype.typeName %>
    -   -
    - <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, - :attachment => file,:contentype=>selContentType} %> -
    -
    <%= file.show_suffix_type %><%= file.downloads %> - <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> -
    -
    - <% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"}%> -
    -
    - -
    + + + + + + + + + + <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %> + <%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> + <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %> + <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %> + <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %> + <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> + <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> + + + + + <% @containers.each do |container| %> + <% next if container.attachments.empty? -%> + <% if container.is_a?(Version) -%> + + + <% end -%> - - + <% container.attachments.each do |file| %> + "> + + + + + + + + + + + + + <% end -%> + <% reset_cycle %> + <% end -%> + + - -
    + <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> +
    <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %><%= number_to_human_size(file.filesize) %> + <%= file.attachmentstype.typeName %> +   + + <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, + :attachment => file, :contentype => selContentType} %> + + <%= file.show_suffix_type %><%= file.downloads %> + <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> +
    +
    + <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
    +
    + +
    -
+
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) %> -
-
    - - - - - - - - - - - <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %> - <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> - <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %> - <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %> - <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> - <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> - <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> - - - - - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% container.attachments.each do |file| %> - <% if isTypeOk(file,selAttachType,selContentType) %> - "> - - - - - - - - - - - - - <% end -%> - <% end -%> - <% reset_cycle %> - <% end -%> - - +
    <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %><%= format_time(file.created_on) %><%= number_to_human_size(file.filesize) %> -
    <%= file.attachmentstype.typeName %>
    -   -
    - <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, - :attachment => file,:contentype=>selContentType} %> -
    -
    <%= file.show_suffix_type %><%= file.downloads %> - <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> -
    -
    - <% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> -
    -
    - -
    + + + + + + + + + + <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %> + <%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> + <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %> + <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %> + <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> + <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> + <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> + + + + + <% @containers.each do |container| %> + <% next if container.attachments.empty? -%> + <% container.attachments.each do |file| %> + <% if isTypeOk(file,selAttachType,selContentType) %> + "> + + + + + + + + + + + + + <% end -%> + <% end -%> + <% reset_cycle %> + <% end -%> + + - -
    <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %><%= number_to_human_size(file.filesize) %> + <%= file.attachmentstype.typeName %> +   + + <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, + :attachment => file,:contentype=>selContentType} %> + + <%= file.show_suffix_type %><%= file.downloads %> + <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> +
    +
    + <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
    +
    + +
    -
-
+ + 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 0d9a3a21f..978b4420a 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 %> -