This commit is contained in:
@@ -49,7 +49,7 @@ class WikiPagesController < ApplicationController
|
|||||||
case change.action
|
case change.action
|
||||||
when ?=
|
when ?=
|
||||||
{ type: 'context', content: change.old_element }
|
{ type: 'context', content: change.old_element }
|
||||||
when ?|
|
when ?!
|
||||||
[{ type: 'removed', content: change.old_element },
|
[{ type: 'removed', content: change.old_element },
|
||||||
{ type: 'added', content: change.new_element }]
|
{ type: 'added', content: change.new_element }]
|
||||||
when ?+
|
when ?+
|
||||||
@@ -98,13 +98,18 @@ class WikiPagesController < ApplicationController
|
|||||||
return head :unprocessable_entity if title.blank? || body.blank?
|
return head :unprocessable_entity if title.blank? || body.blank?
|
||||||
|
|
||||||
page = WikiPage.find(params[:id])
|
page = WikiPage.find(params[:id])
|
||||||
|
base_revision_id = page.current_revision.id
|
||||||
|
|
||||||
if params[:title].present? && params[:title].strip != page.title
|
if params[:title].present? && params[:title].strip != page.title
|
||||||
return head :unprocessable_entity
|
return head :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
||||||
message = params[:message].presence
|
message = params[:message].presence
|
||||||
Wiki::Commit.content!(page:, body:, created_user: current_user, message:)
|
Wiki::Commit.content!(page:,
|
||||||
|
body:,
|
||||||
|
created_user: current_user,
|
||||||
|
message:,
|
||||||
|
base_revision_id:)
|
||||||
|
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ export default () => {
|
|||||||
{diff
|
{diff
|
||||||
? (
|
? (
|
||||||
diff.diff.map (d => (
|
diff.diff.map (d => (
|
||||||
<span className={cn (d.type === 'added' && 'bg-green-200 dark:bg-green-800',
|
<p className={cn (d.type === 'added' && 'bg-green-200 dark:bg-green-800',
|
||||||
d.type === 'removed' && 'bg-red-200 dark:bg-red-800')}>
|
d.type === 'removed' && 'bg-red-200 dark:bg-red-800')}>
|
||||||
{d.content == '\n' ? <br/> : d.content}
|
{d.content}
|
||||||
</span>)))
|
</p>)))
|
||||||
: 'Loading...'}
|
: 'Loading...'}
|
||||||
</div>
|
</div>
|
||||||
</MainArea>)
|
</MainArea>)
|
||||||
|
|||||||
Reference in New Issue
Block a user