ref: master
plugins/networks/controllers/myprofile/networks_plugin_network_controller.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
class NetworksPluginNetworkController < MyProfileController include NetworksPlugin::TranslationHelper before_filter :load_node, :only => [:structure] helper NetworksPlugin::DisplayHelper def index redirect_to :structure end def structure end def join @enterprises = user.enterprises.visible.select{ |e| e.network != profile } if params[:enterprise_id] @enterprise = environment.enterprises.find params[:enterprise_id] if request.post? NetworksPlugin::AssociateEnterprise.create! :network => profile, :enterprise => @enterprise @request_sent = true end elsif @enterprises.size == 1 @enterprise = @enterprises.first end respond_to do |format| format.html format.js end end protected def load_node @network = profile @node = NetworksPlugin::Node.find_by_id(params[:node_id]) || @network end end |