组织设置url
This commit is contained in:
parent
5d9ce929d9
commit
8ead573872
|
@ -1,5 +1,7 @@
|
|||
class OrgSubfieldsController < ApplicationController
|
||||
def create
|
||||
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
|
||||
@res = true
|
||||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
|
@ -7,10 +9,13 @@ class OrgSubfieldsController < ApplicationController
|
|||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
||||
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
||||
SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir])
|
||||
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir])
|
||||
end
|
||||
end
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
else
|
||||
@res = false
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<% if @res %>
|
||||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
|
||||
:locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
||||
|
@ -5,3 +6,6 @@ $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organiza
|
|||
$("#sub_field_left_lists").html("");
|
||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
||||
$("#subfield_name").val("");
|
||||
<% else %>
|
||||
$("#subfield_name").val("");
|
||||
<% end %>
|
|
@ -27,7 +27,7 @@
|
|||
</li>
|
||||
<li class="orgListStatus">新增</li>
|
||||
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
|
||||
<li class="orgListUser hidden">publications</li>
|
||||
<li class="orgListUser hidden"><%= field.subfield_subdomain_dir.nil? ? '未设置': field.subfield_subdomain_dir.name %></li>
|
||||
<%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
|
||||
<a href="javascript:void(0);" class="linkBlue fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"设为隐藏":"设为可见" %></a>
|
||||
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
|
||||
|
|
Loading…
Reference in New Issue