From 49d836d3314ac2c3a445818e124b2f66d5908c64 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 May 2015 23:47:22 +0800 Subject: [PATCH 01/44] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=92=8C=E5=9B=BE=E7=89=87=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=9C=A8=E5=90=8E=E5=8F=B0=E5=8A=A0=E5=85=A5=E9=99=90=E5=88=B6?= =?UTF-8?q?,=E4=B8=94=E9=80=9A=E8=BF=87=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/avatar_controller.rb | 64 +++++++++++++++----------- config/locales/en.yml | 1 + config/locales/zh.yml | 1 + lib/trustie/utils/image.rb | 28 ++++++++++- public/javascripts/jq-upload/upload.js | 15 ++++-- spec/requests/course_request_spec.rb | 42 ++++++++++++++++- 6 files changed, 118 insertions(+), 33 deletions(-) diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index ef7cdf2f7..afd206c92 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -1,9 +1,9 @@ class AvatarController < ApplicationController - - + + include ActionView::Helpers::NumberHelper #before_filter :set_cache_buster include AvatarHelper - + def upload # Make sure that API users get used to set this content type # as it won't trigger Rails' automatic parsing of the request body for parameters @@ -29,43 +29,51 @@ class AvatarController < ApplicationController end if @temp_file && (@temp_file.size > 0) - diskfile=disk_filename(@source_type,@source_id) - @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) + if @temp_file.size > Setting.upload_avatar_max_size.to_i + @status = 1 + @msg = l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)) + elsif Trustie::Utils::Image.new(@temp_file.tempfile.path).image? + diskfile=disk_filename(@source_type,@source_id) + @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) - # 用户头像上传时进行特别处理 - if @source_type == 'User' + # 用户头像上传时进行特别处理 + if @source_type == 'User' diskfile += "temp" @urlfile += "temp" - end + end - logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)") - path = File.dirname(diskfile) - unless File.directory?(path) - FileUtils.mkdir_p(path) - end - md5 = Digest::MD5.new - File.open(diskfile, "wb") do |f| - if @temp_file.respond_to?(:read) - buffer = "" - while (buffer = @temp_file.read(8192)) - f.write(buffer) - md5.update(buffer) + logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)") + path = File.dirname(diskfile) + unless File.directory?(path) + FileUtils.mkdir_p(path) + end + md5 = Digest::MD5.new + File.open(diskfile, "wb") do |f| + if @temp_file.respond_to?(:read) + buffer = "" + while (buffer = @temp_file.read(8192)) + f.write(buffer) + md5.update(buffer) + end + else + f.write(@temp_file) + md5.update(@temp_file) end - else - f.write(@temp_file) - md5.update(@temp_file) end + + Trustie::Utils::Image.new(diskfile,true).compress(300) + @status = 0 + @msg = '' + else + @status = 2 + @msg = l(:not_valid_image_file) end -# self.digest = md5.hexdigest end @temp_file = nil - image = Trustie::Utils::Image.new(diskfile,true) - image.compress(300) - respond_to do |format| format.json{ - render :inline => "#{@urlfile.to_s}?#{Time.now.to_i}",:content_type => 'text/html' + render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html' return } format.js diff --git a/config/locales/en.yml b/config/locales/en.yml index 8989ae36a..844818ae4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1521,4 +1521,5 @@ en: label_commit_failed: commit failed #api end error_upload_avatar_to_large: "too big (%{max_size})" + not_valid_image_file: not a valid image file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 5fcb1fb5c..a91faac0f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1984,3 +1984,4 @@ zh: label_code: 代码 error_upload_avatar_to_large: "超过大小限制 (%{max_size})" + not_valid_image_file: 不是有效的图片文件 diff --git a/lib/trustie/utils/image.rb b/lib/trustie/utils/image.rb index 9178b291a..f4ec328b3 100644 --- a/lib/trustie/utils/image.rb +++ b/lib/trustie/utils/image.rb @@ -3,11 +3,37 @@ module Trustie module Utils class Image - def initialize(file, bak) + def initialize(file, bak=false) @file = file @bak = bak end + def bitmap?(data) + data[0,2]==77.chr + 66.chr + end + + def gif?(data) + data[0,4]==71.chr + 73.chr + 70.chr + 56.chr + end + + def jpeg?(data) + data[0,4]== 0xff.chr + 0xd8.chr + 0xff.chr + 0xe0.chr + end + def png?(data) + data[0,2]==0x89.chr + 80.chr + end + + def image? + begin + f = File.open(@file,'rb') # rb means to read using binary + return false if f.size < 9 + data = f.read(9) # magic numbers are up to 9 bytes + return bitmap?(data) || gif?(data) || jpeg?(data) || png?(data) + ensure + f.close + end + end + def compress(size=300) backup if @bak begin diff --git a/public/javascripts/jq-upload/upload.js b/public/javascripts/jq-upload/upload.js index 985450648..71dbefc32 100644 --- a/public/javascripts/jq-upload/upload.js +++ b/public/javascripts/jq-upload/upload.js @@ -44,9 +44,18 @@ $(function() { }, done: function(e, data) { var imgSpan = jQuery('#avatar_image'); - imgSpan.attr({ - "src": data.result.text ? data.result.text() : data.result - }); + var result = data.result.text ? data.result.text() : data.result; + if(result){ + var o = JSON.parse(result); + if(o.status == 0){ + imgSpan.attr({ + "src": o.url + }); + } else { + alert(o.message); + } + } + } }); }); diff --git a/spec/requests/course_request_spec.rb b/spec/requests/course_request_spec.rb index d58df398e..99e4486b0 100644 --- a/spec/requests/course_request_spec.rb +++ b/spec/requests/course_request_spec.rb @@ -35,13 +35,53 @@ RSpec.describe "课程", :type => :request do context "修改课程图片" do include Rack::Test::Methods let(:avatar) {Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/test.jpg",'image/jpg')} + context "正常图片上传成功" do subject(:resp) {post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: avatar}} it{ expect(subject).to be_ok } it{ expect(subject.body).not_to be_empty } + it "状态要为0" do + o = ActiveSupport::JSON.decode(subject.body) + expect(o["status"]).to eq(0) + end + it "要回传图片地址" do + o = ActiveSupport::JSON.decode(subject.body) + expect(o["url"]).not_to be_empty + end + end + + context "不是图片,上传失败" do + let(:invalid_avatar) {Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/hah.txt",'text/plain')} + before do + resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: invalid_avatar} + @o = ActiveSupport::JSON.decode(resp.body) + end + it "状态要为0" do + expect(@o["status"]).not_to eq(0) + end + it "要回传错误信息" do + expect(@o["message"]).to be_include("图片") + end + end + + context "文件过大,上传失败" do + before do + big_file = Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/test.jpg",'image/jpg') + allow(ActionDispatch::Http::UploadedFile).to receive(:new).and_return(double('BigFile',size: 10*1024*1024, original_filename: 'rais.jpg', tempfile: nil)) + # trace = TracePoint.new(:call) do |tp| + # p [tp.lineno, tp.defined_class, tp.method_id, tp.event] if tp.method_id == :post + # end + resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),'avatar[image]'=> big_file + @o = ActiveSupport::JSON.decode(resp.body) + end + it "状态要为0" do + expect(@o["status"]).not_to eq(0) + end + it "要回传错误信息" do + expect(@o["message"]).to be_include("大") + end end - it "不是图片,上传失败" end end From d546069051efe627fa2eb234255dadbb04d3c05e Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 16 May 2015 09:59:14 +0800 Subject: [PATCH 02/44] =?UTF-8?q?spec=20=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/models/forum_observer_spec.rb | 5 ----- spec/models/memo_observer_spec.rb | 5 ----- spec/requests/course_request_spec.rb | 4 ++-- 3 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 spec/models/forum_observer_spec.rb delete mode 100644 spec/models/memo_observer_spec.rb diff --git a/spec/models/forum_observer_spec.rb b/spec/models/forum_observer_spec.rb deleted file mode 100644 index 76d68fafa..000000000 --- a/spec/models/forum_observer_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe ForumObserver do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/memo_observer_spec.rb b/spec/models/memo_observer_spec.rb deleted file mode 100644 index 82603ba7a..000000000 --- a/spec/models/memo_observer_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe MemoObserver do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/requests/course_request_spec.rb b/spec/requests/course_request_spec.rb index 99e4486b0..feca37259 100644 --- a/spec/requests/course_request_spec.rb +++ b/spec/requests/course_request_spec.rb @@ -56,7 +56,7 @@ RSpec.describe "课程", :type => :request do resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: invalid_avatar} @o = ActiveSupport::JSON.decode(resp.body) end - it "状态要为0" do + it "状态不为0" do expect(@o["status"]).not_to eq(0) end it "要回传错误信息" do @@ -74,7 +74,7 @@ RSpec.describe "课程", :type => :request do resp = post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),'avatar[image]'=> big_file @o = ActiveSupport::JSON.decode(resp.body) end - it "状态要为0" do + it "状态不为0" do expect(@o["status"]).not_to eq(0) end it "要回传错误信息" do From df24007dbb72e42f7928bb1b10a0cf34aec53ba4 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Mon, 18 May 2015 11:16:41 +0800 Subject: [PATCH 03/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug(#2525)=20:=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE--=E9=82=80=E8=AF=B7=EF=BC=9A=E6=94=B6=E8=B5=B7?= =?UTF-8?q?=E2=80=9C=E9=82=80=E8=AF=B7=E2=80=9D=E4=B8=8B=E6=8B=89=E6=A1=86?= =?UTF-8?q?=EF=BC=8C=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=E5=90=8E=E5=8F=88?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layouts/_base_development_group.html.erb | 2 +- app/views/layouts/base_projects.html.erb | 2 +- public/javascripts/project.js | 43 ++++++++++++++++++- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_base_development_group.html.erb b/app/views/layouts/_base_development_group.html.erb index 6d6e0eed1..4b0692f9e 100644 --- a/app/views/layouts/_base_development_group.html.erb +++ b/app/views/layouts/_base_development_group.html.erb @@ -55,7 +55,7 @@ <% end %> <% end %> - + \ No newline at end of file diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 51f8b9a80..71975c5c3 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -157,7 +157,7 @@ diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 71975c5c3..beade0a7a 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -1,247 +1,245 @@ <% @nav_dispaly_project_label = 1 -@nav_dispaly_forum_label = 1 %> + @nav_dispaly_forum_label = 1 %> <%#@nav_dispaly_project_label = 1 %> - - - <%= h html_title %> - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= javascript_heads %> - <%= heads_for_theme %> - <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %> - <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %> - <%= call_hook :view_layouts_base_html_head %> - - <%= yield :header_tags -%> + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %> + <%= javascript_include_tag 'cookie','project', 'header','select_list_move' %> + <%= call_hook :view_layouts_base_html_head %> + + <%= yield :header_tags -%> - - - - - -
- <%= render :partial => 'layouts/new_header'%> + else if($("#friend_organization").attr("checked") == "checked"){ + project_type = 3; + } + $.get( + url, + { project_type: project_type}, + function (data) { + if(data == 1) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group')) %>'); + $("#close_light").attr("onClick","close_window('development_group');"); + } + else if(data == 2) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team')) %>'); + $("#close_light").attr("onClick","close_window('research_group');"); + } + else if(data == 3) + { + $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>"); + $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group')) %>'); + $("#close_light").attr("onClick","close_window('friend_organization');"); + } + else + { + alert("服务器异常,请与管理员联系"); + } + } + ); + } + + + + +
+ <%= render :partial => 'layouts/new_header'%> +
+ + +
+
+

+ + <%= l(:label_projects_community) %> + +

+ +
+ +
+
+
+
+ +
+ <%= l(:label_project_id)%><%= @project.id %> +
+ +
+ <% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%> + <% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%> + <%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %> +
+ +
+
+ <%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %> + <% if @project.is_public? %> + <%= l(:label_public)%> + <% else %> + <%= l(:label_private)%> + <% end %> +
+
+ <% if @project.project_type == 0 %> + <%= l(:label_project_score)%> : + <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', + :action => 'show_projects_score', + :remote => true, + :id => @project.id}, :class => "c_orange f14" ) %> + <% end %> +
- -
-
-

- - <%= l(:label_projects_community) %> - -

- -
- - <%= form_tag(projects_search_path, :method => :get, :id => "project_search_form", :class => "search_form") do %> - <%= text_field_tag 'name', params[:name], :placeholder => "项目名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %> - - <%= l(:label_search)%> - -
- + + -
-
-
-
- -
- <%= l(:label_project_id)%><%= @project.id %> -
- -
- <% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%> - <% typeclass = @project.project_new_type == 1 ? "pr_kafa" : (@project.project_new_type == 2 ? "pr_keyan" : "pr_friend")%> - <%= render 'layouts/join_exit_project',{:text => text, :typeclass => typeclass} %> -
- -
-
- <%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %> - <% if @project.is_public? %> - <%= l(:label_public)%> - <% else %> - <%= l(:label_private)%> - <% end %> -
-
-
- <% if @project.project_type == 0 %> - <%= l(:label_project_score)%> : - <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', - :action => 'show_projects_score', - :remote => true, - :id => @project.id - }, :class => "c_orange f14" ) %> - <% end %> -
- - -
- <%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>) - - <%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>) - - <%= l(:project_module_attachments) %>( - <% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> - <%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %>) -
-
-
- - - -
- - -
-
-

<%= l(:label_project_overview)%>:

-
- <%= textilizable(@project.description) if @project.description && !@project.description.blank? %> -
-
-
- - - - -
-
+ + <% end %> + + +
+ <% if @project.project_new_type == 1 || @project.project_new_type.nil? %> + <%= render :partial => 'projects/development_group', :locals => {:project => @project}%> + <% elsif @project.project_new_type == 2 %> + <%= render :partial => 'projects/research_team', :locals => {:project => @project}%> + <% else %> + <%= render :partial => 'projects/friend_group', :locals => {:project => @project}%> + <% end %> +
+ +
+
- -
-

<%= l(:label_tag)%>:

-
-
- <%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%> -
-
-
-
-
-
+ +
+
+

<%= l(:label_project_overview)%>:

+
+ <%= textilizable(@project.description) if @project.description && !@project.description.blank? %> +
+
+
+ + + + +
+
-
- <%= render_flash_messages %> - <%= yield %> - <%= call_hook :view_layouts_base_content %> -
-
-
-
- <%= render :partial => 'layouts/new_footer'%> + +
+

<%= l(:label_tag)%>:

+
+
+ <%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%> +
+
-
-
- - <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> -
-
-

请选择项目类型:

-
    -
  • id="development_group"/>
  • -
  • id="research_group"/>
  • -
  • id="friend_organization"/>
  • -
- 确定 - -
+
-
123
- <%= render :partial => 'layouts/new_feedback' %> - - - <%= call_hook :view_layouts_base_body_bottom %> - +
+ +
+ <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+
+
+
+ <%= render :partial => 'layouts/new_footer'%> +
+
+
+ + <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> +
+
+

请选择项目类型:

+
    +
  • id="development_group"/>
  • +
  • id="research_group"/>
  • +
  • id="friend_organization"/>
  • +
+ 确定 + +
+
+
123
+<%= render :partial => 'layouts/new_feedback' %> + + +<%= call_hook :view_layouts_base_body_bottom %> + diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb new file mode 100644 index 000000000..7f79fc5f1 --- /dev/null +++ b/app/views/projects/_development_group.html.erb @@ -0,0 +1,52 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + +<% end %> +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end %> +<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> +<% if visible_repository?(@project) %> + +<% end %> + + + \ No newline at end of file diff --git a/app/views/projects/_friend_group.html.erb b/app/views/projects/_friend_group.html.erb new file mode 100644 index 000000000..dca5473f7 --- /dev/null +++ b/app/views/projects/_friend_group.html.erb @@ -0,0 +1,29 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end %> \ No newline at end of file diff --git a/app/views/projects/_research_team.html.erb b/app/views/projects/_research_team.html.erb new file mode 100644 index 000000000..2a0ad1ef3 --- /dev/null +++ b/app/views/projects/_research_team.html.erb @@ -0,0 +1,40 @@ +<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + +<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + +<% end %> +<% unless @project.enabled_modules.where("name = 'boards'").empty? %> + +<% end%> +<% unless @project.enabled_modules.where("name = 'files'").empty? %> + +<% end%> \ No newline at end of file From 6c6ae38f7a18b149746dfc0ed05dc99267edc7ca Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 19 May 2015 10:19:49 +0800 Subject: [PATCH 13/44] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/application.css | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index edde12527..85ef3240a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1904,6 +1904,18 @@ input.autocomplete.ajax-loading { background-image: url(../images/loading.gif); } +.private_project { + position: relative; + bottom: 2px; + text-transform: uppercase; + background: #d22; + color: #fff; + font-weight: bold; + padding: 0px 2px 0px 2px; + font-size: 60%; + margin-right: 2px; + border-radius: 2px; +} /***** Flash & error messages ****/ #errorExplanation, div.flash, .nodata, .warning, .conflict { padding: 4px 4px 4px 30px; From 5cb9cc0903b737ad2cee8a34573f18e746d0c368 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 19 May 2015 10:35:17 +0800 Subject: [PATCH 14/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug#2211:course?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5--=E8=BF=98=E6=9C=89=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=AF=BE=E7=A8=8B=E8=80=81=E5=B8=88=E7=9A=84?= =?UTF-8?q?=E5=A7=93=E5=90=8D=E5=B0=B1=E4=B8=8D=E8=A6=81=E4=BB=A5=E7=9C=81?= =?UTF-8?q?=E7=95=A5=E5=8F=B7=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_course_list.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index 0d979c769..111c0abb1 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -5,13 +5,13 @@
- +
<% unless course.is_public == 1 %> <%= l(:label_private) %> <% end %> - <%= link_to(course.name.truncate(25, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <%= link_to(course.name+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> - +
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> <%#=course.try(:teacher).try(:name)%> From 895058f38ecb81c2a0eca44b12fba663516264a0 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 19 May 2015 11:30:31 +0800 Subject: [PATCH 15/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug#2154:=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E4=B8=8A=E4=BC=A0=E8=AF=BE=E4=BB=B6=EF=BC=8C=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E8=B5=84=E6=BA=90=E6=95=B0=E7=BB=9F=E8=AE=A1=E6=9C=AA?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/create.js.erb | 2 ++ app/views/layouts/base_courses.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb index b00ae3612..87bf5b864 100644 --- a/app/views/files/create.js.erb +++ b/app/views/files/create.js.erb @@ -27,6 +27,8 @@ $('#upload_file_div').slideToggle('slow'); <%elsif @course%> closeModal(); $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); + $("#courses_files_count_info").html("<%= @all_attachments.count%>"); + $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") <% end %> <% end %> $(document).ready(img_thumbnails); diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 6820ccaf3..070a99d08 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -95,7 +95,7 @@ <%= l(:label_account_identity_student)%>(<%= course_student_link student_num %>) - <%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue' %>)
+ <%= l(:project_module_attachments)%>(<%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %>)
@@ -127,7 +127,7 @@