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 = Preview.get_preview(vm.project, body)
promise.success( (response) -> promise.success( (response) ->
vm.preview_body = response vm.preview_body = response.html
Preview.old_text = body Preview.old_text = body
).error( (response) -> ).error( (response) ->
vm.preview_body = 'Error :(' 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 = Preview.get_preview(vm.project, body)
promise.success( (response) -> promise.success( (response) ->
vm.preview_body = response vm.preview_body = response.html
Preview.old_text = body Preview.old_text = body
).error( (response) -> ).error( (response) ->
vm.preview_body = 'Error :(' vm.preview_body = 'Error :('

View File

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

View File

@ -166,7 +166,10 @@ class Projects::ProjectsController < Projects::BaseController
end end
def preview 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 end
def refs_list def refs_list

View File

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