add back to project button; pre-filled inline snippets from projects
This commit is contained in:
@@ -138,7 +138,38 @@ class v1 {
|
||||
return _flitter.error(res, 401, {reason: 'You do not have permission to view this project.'})
|
||||
}
|
||||
|
||||
return _flitter.view(res, 'dash_v1:view', {user: req.session.auth.user, snippets, project, outs, show_back: true, title: 'View: '+project.name })
|
||||
return _flitter.view(res, 'dash_v1:view', {user: req.session.auth.user, snippets, project, outs, show_back: true, window_back: true, title: 'View: '+project.name })
|
||||
}
|
||||
|
||||
async project_view_inline_helper(req, res, next){
|
||||
const project = await Project.findById(req.params.id)
|
||||
|
||||
if ( !project ){
|
||||
return _flitter.error(res, 404, {reason: 'Project not found with the specified ID.'})
|
||||
}
|
||||
|
||||
if ( !await devbug.permission.project.view(project, req.session.auth.user) ){
|
||||
return _flitter.error(res, 401, {reason: 'You do not have permission to view this project.'})
|
||||
}
|
||||
|
||||
const code = devbug.get_inline(req.params.type, project)
|
||||
|
||||
if ( !code ) return _flitter.error(res, 404, {reason: 'Inline helper snippet not found with the specified type.'})
|
||||
|
||||
let type;
|
||||
if ( req.params.type === 'node' ) type = 'javascript'
|
||||
else if ( req.params.type === 'php' ) type = 'php'
|
||||
else type = 'text'
|
||||
|
||||
return _flitter.view(res, 'dash_v1:in_editor', {
|
||||
user: req.session.auth.user,
|
||||
project,
|
||||
show_back: true,
|
||||
readonly: true,
|
||||
editor_code: code,
|
||||
editor_lang: 'ace/mode/'+type,
|
||||
title: 'Inline Helper for '+project.name+' ('+req.params.type+')'
|
||||
})
|
||||
}
|
||||
|
||||
async out_view(req, res, next){
|
||||
|
||||
Reference in New Issue
Block a user