finished mappings#create except it doesn't authenticate...
This commit is contained in:
parent
4e5fb95c7e
commit
564d18df4d
1 changed files with 11 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
||||||
class MappingsController < ApplicationController
|
class MappingsController < ApplicationController
|
||||||
|
respond_to :js, :html
|
||||||
|
|
||||||
# GET mappings
|
# GET mappings
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
@ -12,9 +14,13 @@ class MappingsController < ApplicationController
|
||||||
|
|
||||||
# POST mappings
|
# POST mappings
|
||||||
def create
|
def create
|
||||||
@user = current_user
|
|
||||||
@mapping = Mapping.new()
|
@mapping = Mapping.new()
|
||||||
@mapping.user = @user
|
|
||||||
|
//TODO authenticate and put a user
|
||||||
|
|
||||||
|
@mapping.xloc = params[:xloc] if params[:xloc]
|
||||||
|
@mapping.yloc = params[:yloc] if params[:yloc]
|
||||||
|
|
||||||
if params[:map]
|
if params[:map]
|
||||||
if params[:map][:id]
|
if params[:map][:id]
|
||||||
@map = Map.find(params[:map][:id])
|
@map = Map.find(params[:map][:id])
|
||||||
|
@ -25,13 +31,16 @@ class MappingsController < ApplicationController
|
||||||
if params[:topic][:id]
|
if params[:topic][:id]
|
||||||
@topic = Topic.find(params[:topic][:id])
|
@topic = Topic.find(params[:topic][:id])
|
||||||
@mapping.topic = @topic
|
@mapping.topic = @topic
|
||||||
|
@mapping.category = "Topic"
|
||||||
end
|
end
|
||||||
elsif params[:synapse]
|
elsif params[:synapse]
|
||||||
if params[:synapse][:id]
|
if params[:synapse][:id]
|
||||||
@topic = Synapse.find(params[:synapse][:id])
|
@topic = Synapse.find(params[:synapse][:id])
|
||||||
@mapping.synapse = @synapse
|
@mapping.synapse = @synapse
|
||||||
|
@mapping.category = "Synapse"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@mapping.save()
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /mappings/:id
|
# GET /mappings/:id
|
||||||
|
|
Loading…
Reference in a new issue