socialforge/app/controllers/org_subfields_controller.rb

40 lines
1.3 KiB
Ruby
Raw Normal View History

class OrgSubfieldsController < ApplicationController
def create
@subfield = OrgSubfield.create(:name => params[:name])
@organization = Organization.find(params[:organization_id])
@organization.org_subfields << @subfield
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
end
def show
2016-01-12 16:43:40 +08:00
@organization = Organization.find(params[:id])
@subfield = @organization.org_subfields.first
if @subfield.field_type == 'Post'
redirect_to organization_path(@organization, :org_subfield_id => @subfield.id)
else
end
2016-01-12 16:43:40 +08:00
# @org_subfield = OrgSubfield.find(params[:id])
# @organization = @org_subfield.organization.id
# @messages = []
# @messages << @org_subfield.org_document_comments
# @messages << @org_subfield.messages
# @messages.sort{|a, b| b.updated_at <=> a.updated_at}
# respond_to do |format|
# format.html{render :layout => 'base_org'}
# end
end
def destroy
@subfield = OrgSubfield.find(params[:id])
@organization = Organization.find(@subfield.organization_id)
@subfield.destroy
end
def update
@subfield = OrgSubfield.find(params[:id])
@organization = Organization.find(@subfield.organization_id)
@subfield.update_attributes(:name => params[:name])
end
end