fix preview

This commit is contained in:
Alexander Machehin 2015-03-17 23:27:11 +05:00
parent 3004074e2e
commit 2175a898be
5 changed files with 9 additions and 11 deletions

View File

@ -57,7 +57,7 @@ CommentsController = (Comment, Preview, confirmMessage, $scope, compileHTML, $ro
promise = Preview.get_preview(vm.project, body)
promise.success( (response) ->
vm.preview_body = response
vm.preview_body = response.html
Preview.old_text = body
).error( (response) ->
vm.preview_body = 'Error :('

View File

@ -46,7 +46,7 @@ IssueController = (dataservice, $http, Issue, $rootScope, Preview, Label, confir
promise = Preview.get_preview(vm.project, body)
promise.success( (response) ->
vm.preview_body = response
vm.preview_body = response.html
Preview.old_text = body
).error( (response) ->
vm.preview_body = 'Error :('

View File

@ -4,14 +4,8 @@ previewService = ($http) ->
old_text: old_text
get_preview: (name_with_owner, text, old_text) ->
return null if text is old_text
path = Routes.project_md_preview_path(
{
name_with_owner: name_with_owner,
text: text
}
)
$http.post(path)
path = Routes.project_md_preview_path(name_with_owner)
$http.post(path, {text: text})
}
angular

View File

@ -166,7 +166,10 @@ class Projects::ProjectsController < Projects::BaseController
end
def preview
render inline: view_context.markdown(params[:text]), layout: false
respond_to do |format|
format.json {}
format.html {render inline: view_context.markdown(params[:text]), layout: false}
end
end
def refs_list

View File

@ -0,0 +1 @@
json.html markdown(params[:text])