From 135cb410bce13db700e05861d3743fbcd86f89bf Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 27 Jan 2016 15:29:15 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=A7=A3=E5=86=B3=E8=B5=84=E6=BA=90=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E4=B8=AD=E8=B5=84=E6=BA=90=E6=80=BB=E6=95=B0=E4=B8=8E?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=BB=9F=E8=AE=A1=E6=95=B0=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B2.=E5=AF=B9?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E7=9A=84=E5=AD=90=E7=9B=AE=E5=BD=95=E5=90=8D?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E9=99=90=E5=88=B6=EF=BC=8C=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=98=AFmembers=20setting=20org=5Fdocument=5Fcomments=EF=BC=8C?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E8=BF=99=E4=BC=9A=E5=BC=95=E8=B5=B7=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 3 ++- app/controllers/users_controller.rb | 4 ++-- app/models/subfield_subdomain_dir.rb | 1 + app/views/org_subfields/update_sub_dir.js.erb | 7 +------ 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index d051a91f7..bae0232a5 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -109,7 +109,8 @@ class OrgSubfieldsController < ApplicationController if SubfieldSubdomainDir.find_by_sql(sql).count == 0 if @org_subfield.subfield_subdomain_dir @sub_dir = @org_subfield.subfield_subdomain_dir - @sub_dir.update_attribute(:name, params[:sub_dir_name]) + @sub_dir = SubfieldSubdomainDir.update(@sub_dir.id, :name => params[:sub_dir_name]) + #@sub_dir.update_attribute(:name, params[:sub_dir_name]) else @sub_dir = SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name]) end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f715cac81..8f4991039 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2109,9 +2109,9 @@ class UsersController < ApplicationController end elsif params[:type] == "4" #附件 if User.current.id.to_i == params[:id].to_i - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc") else - @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc") end elsif params[:type] == "5" #用户资源 if User.current.id.to_i == params[:id].to_i diff --git a/app/models/subfield_subdomain_dir.rb b/app/models/subfield_subdomain_dir.rb index 9897e19ac..2ec93fe05 100644 --- a/app/models/subfield_subdomain_dir.rb +++ b/app/models/subfield_subdomain_dir.rb @@ -1,4 +1,5 @@ class SubfieldSubdomainDir < ActiveRecord::Base # attr_accessible :title, :body belongs_to :org_subfield + validates_exclusion_of :name, :in => %w(setting members org_document_comments) end diff --git a/app/views/org_subfields/update_sub_dir.js.erb b/app/views/org_subfields/update_sub_dir.js.erb index 7960ca26c..3d42c260b 100644 --- a/app/views/org_subfields/update_sub_dir.js.erb +++ b/app/views/org_subfields/update_sub_dir.js.erb @@ -1,11 +1,6 @@ -<% if @exist == false %> +<% if @exist == false and @sub_dir.valid? %> $('#sub_dir_show_<%= @org_subfield.id %>').html('<%= @sub_dir.name %>'); $('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @sub_dir.name %>'); -// $('#sub_dir_show_<%= @org_subfield.id %>').show(); -// $('#sub_dir_edit_<%= @org_subfield.id %>').hide(); <% else %> $('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @org_subfield.subfield_subdomain_dir.nil? ? '': @org_subfield.subfield_subdomain_dir.name %>'); -// alert("该目录已存在,请重新输入"); -// $('#sub_dir_edit_<%#= @org_subfield.id %>').find('input').val('<%#= @org_subfield.subfield_subdomain_dir.nil? ? "未设置":@org_subfield.subfield_subdomain_dir.name %>'); -// $('#sub_dir_edit_<%#= @org_subfield.id %>').focus(); <% end %> \ No newline at end of file