Skip to content
Snippets Groups Projects
Commit c659dbb1 authored by Matheus Agio Nerone's avatar Matheus Agio Nerone
Browse files

fixing routes


Signed-off-by: default avatarman13 <man13@inf.ufpr.br>
parent 91730cd8
No related branches found
No related tags found
No related merge requests found
......@@ -42,14 +42,7 @@ class LearningObjectsController < ApplicationController
respond_to do |format|
if publisher.create_draft @draft
# go to file submission page
if @draft.type == 'Link Externo'
notice = 'Seu objeto foi criado! Para que ele seja publicado é necessário informar um link.'
path = upload_link_learning_object_path(id: @draft.id)
else
notice = 'Seu objeto foi criado! Para que ele seja publicado é necessário enviar o arquivo.'
path = upload_learning_object_path(id: @draft.id)
end
format.html { redirect_to path, notice: notice }
format.html { redirect }
else
format.html { redirect_to new_learning_object_path, notice: 'Não foi possível criar o objeto.' }
end
......@@ -135,11 +128,11 @@ class LearningObjectsController < ApplicationController
@type = @learning_object.type
else
@type = case @learning_object.default_attachment.mime_type
when /image\//i then 'Imagem'
when /audio\//i then 'Áudio'
when /video\//i then 'Vídeo'
when 'application/pdf' then 'PDF'
end
when /image\//i then 'Imagem'
when /audio\//i then 'Áudio'
when /video\//i then 'Vídeo'
when 'application/pdf' then 'PDF'
end
end
end
......@@ -154,4 +147,11 @@ class LearningObjectsController < ApplicationController
end
end
def redirect
if @draft.type == "Link Externo"
redirect_to learning_object_path(id: @draft.id) , notice: 'Seu objeto foi criado com sucesso!'
else
redirect_to upload_learning_object_path(id: @draft.id) , notice: 'Seu objeto foi criado! Para que ele seja publicado é necessário enviar o arquivo.'
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment