From fbf3d3f7473e205383bd6a805eb653d8f98b29c8 Mon Sep 17 00:00:00 2001 From: XuCheng642 <287102909@qq.com> Date: Fri, 29 Sep 2017 21:53:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=9B=9E=E5=A4=8D=E9=93=BE?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 34 +++--- .../managements/_leave_message_list.html.erb | 2 +- .../managements/add_departments_part.html.erb | 103 ++++++++---------- .../managements/departments_part.html.erb | 2 +- 4 files changed, 63 insertions(+), 78 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 29e087a28..ca8c7f1a3 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -554,28 +554,28 @@ end end def save_school - # uploaded_io = params[:logo] + uploaded_io = params[:logo] sl = School.create(:name => params[:schoolname],:province => params[:province],:city => params[:city],:address => params[:address]) - # unless uploaded_io.nil? - # File.new(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb').write(sl.id) - # File.new(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb') do |file| - # file.write(uploaded_io.read) - # end - # sl.logo_link = '/images/school/'+sl.id.to_s+'.png' - # end + unless uploaded_io.nil? + File.open(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb') do |file| + file.write(uploaded_io.read) + end + sl.logo_link = '/images/school/'+sl.id.to_s+'.png' + sl.save + end @user = User.current @se = @user.extensions - if @user.save && @se.save - diskfile1 = disk_filename('school', sl.id , 'id') - diskfileID = diskfile1 + 'temp' - begin - FileUtils.mv diskfileID, diskfile1, force: true if File.exist? diskfileID - ensure - File.delete(diskfileID) if File.exist?(diskfileID) - end - end + # if @user.save && @se.save + # diskfile1 = disk_filename('school', sl.id , 'id') + # diskfileID = diskfile1 + 'temp' + # begin + # FileUtils.mv diskfileID, diskfile1, force: true if File.exist? diskfileID + # ensure + # File.delete(diskfileID) if File.exist?(diskfileID) + # end + # end redirect_to departments_part_managements_path end diff --git a/app/views/managements/_leave_message_list.html.erb b/app/views/managements/_leave_message_list.html.erb index 5f0aa0fba..7bbbcc9b8 100644 --- a/app/views/managements/_leave_message_list.html.erb +++ b/app/views/managements/_leave_message_list.html.erb @@ -23,7 +23,7 @@ <%= format_time(jour.created_on) %> - <%= link_to jour.m_parent_id.nil? ? strip_html(jour.notes) : 'RE: ' + strip_html(jour.notes), student_work_index_path(:homework => jour.jour_id, :tab => 2) %> + <%= link_to jour.m_parent_id.nil? ? strip_html(jour.notes) : 'RE: ' + strip_html(jour.notes), student_work_index_path(:homework => jour.jour_id, :tab => 2),:target => '_blank' %> <% replys = JournalsForMessage.where(:m_parent_id => jour.id) %> diff --git a/app/views/managements/add_departments_part.html.erb b/app/views/managements/add_departments_part.html.erb index 8bfe79c6c..d94e166a9 100644 --- a/app/views/managements/add_departments_part.html.erb +++ b/app/views/managements/add_departments_part.html.erb @@ -1,66 +1,51 @@
<%= form_tag save_school_managements_path(),method: "post",:id => "save_school" do %> - - - - - - - - -
- <%= file_field_tag 'account/avatar[image]', - :id => "upload_img_id", - :style => 'display:none;', - :size => "1", - :multiple => false, - :onchange => 'addInputAvatar(this);', - :data => { - :max_file_size => Setting.authentication_img_max_size.to_i.kilobytes, - :max_file_size_message => l(:error_user_auth_too_big, :max_size => number_to_human_size(Setting.authentication_img_max_size.to_i.kilobytes)), - :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, - :file_type => Redmine::Configuration['pic_types'].to_s, - :type_support_message => l(:error_pic_type), - :upload_path => upload_avatar_path(:format => 'js'), - :description_placeholder => nil ,# l(:label_optional_description) - :source_type => 'school', - :source_id => @user.id.to_s, - :is_direct => 1 +
+ + <%= image_tag('/images/school/default.png', id: "avatar_image", :class=>"school_avatar ml25", width:60,height:60) %> + 上传图片 + <%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%> + 删除图片 +
+
+ + <%#= file_field_tag 'avatar[image]', +# :id => "upload_img_id", +# :style => 'display:none;', +# :size => "1", +# :multiple => false, +# :onchange => 'addInputAvatar(this);', +# :data => { +# :max_file_size => Setting.authentication_img_max_size.to_i.kilobytes, +# :max_file_size_message => l(:error_user_auth_too_big, :max_size => number_to_human_size(Setting.authentication_img_max_size.to_i.kilobytes)), +# :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, +# :file_type => Redmine::Configuration['pic_types'].to_s, +# :type_support_message => l(:error_pic_type), +# :upload_path => upload_avatar_path(:format => 'js'), +# :description_placeholder => nil ,# l(:label_optional_description) +# :source_type => 'school', +# :source_id => @user.id.to_s, +# :is_direct => 1 } %> - - +选择文件 -
-
- -
- <%= image_tag(url_to_auth_img(0, 'ID'), :width => 200, :height => 150, :id => 'nh_source_id') %> -
-
-
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
diff --git a/app/views/managements/departments_part.html.erb b/app/views/managements/departments_part.html.erb index dbc816c98..28ff8ef59 100644 --- a/app/views/managements/departments_part.html.erb +++ b/app/views/managements/departments_part.html.erb @@ -3,7 +3,7 @@ 搜索 清除 - <%#= link_to "新建单位",add_departments_part_managements_path(),:class => "task-btn task-btn-green fr mt6 mr30" %> + <%= link_to "新建单位",add_departments_part_managements_path(),:class => "task-btn task-btn-green fr mt6 mr30" %>
<% end %>