组织设置url
This commit is contained in:
parent
5d9ce929d9
commit
8ead573872
|
@ -1,16 +1,21 @@
|
||||||
class OrgSubfieldsController < ApplicationController
|
class OrgSubfieldsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
@subfield = OrgSubfield.create(:name => params[:name])
|
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
|
||||||
@organization = Organization.find(params[:organization_id])
|
@res = true
|
||||||
@organization.org_subfields << @subfield
|
@subfield = OrgSubfield.create(:name => params[:name])
|
||||||
if !params[:sub_dir].blank?
|
@organization = Organization.find(params[:organization_id])
|
||||||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
@organization.org_subfields << @subfield
|
||||||
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
if !params[:sub_dir].blank?
|
||||||
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||||
SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir])
|
"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 => @subfield.id, :name => params[:sub_dir])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||||
|
else
|
||||||
|
@res = false
|
||||||
end
|
end
|
||||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
$("#org_subfield_list").html("");
|
<% if @res %>
|
||||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
|
$("#org_subfield_list").html("");
|
||||||
:locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',
|
||||||
:subfields => @organization.org_subfields.where("field_type != 'default'") }) %>");
|
:locals => {:default_fields => @organization.org_subfields.where("field_type='default'"),
|
||||||
$("#sub_field_left_lists").html("");
|
:subfields => @organization.org_subfields.where("field_type != 'default'") }) %>");
|
||||||
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
|
$("#sub_field_left_lists").html("");
|
||||||
$("#subfield_name").val("");
|
$("#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>
|
||||||
<li class="orgListStatus">新增</li>
|
<li class="orgListStatus">新增</li>
|
||||||
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></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" %>
|
<%#= 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>
|
<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" %>
|
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
|
||||||
|
|
Loading…
Reference in New Issue