Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor #25

Open
wants to merge 3 commits into
base: dev-website
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"font-awesome": "fontawesome#^4.6.3",
"jquery": "~2.1.4",
"bootswatch-ustclugFonts": "~3.3.76",
"chart.js": "npm:chart.js#^2.2.2"
"chart.js": "npm:chart.js#^2.2.2",
"simditor": "^2.3.6"
}
}
1 change: 1 addition & 0 deletions resources/lang/en/hc.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
'no data' => 'There is no data here',
'show more comments' => 'Click to show more comments',
'no bio' => 'No bio yet',
'reply' => 'Reply',



Expand Down
1 change: 1 addition & 0 deletions resources/lang/zh-CN/hc.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
'no data' => '暂时没有数据',
'show more comments' => '点击加载更多评论',
'no bio' => '暂无介绍',
'reply' => '回复',



Expand Down
26 changes: 26 additions & 0 deletions resources/views/common/editor.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{-- simditor --}}
<link rel="stylesheet" type="text/css" href="{{ asset('/bower-assets/simditor/styles/simditor.css') }}"/>
<script type="text/javascript" src="{{ asset('/bower-assets/jquery/dist/jquery.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('/bower-assets/simple-module/lib/module.js') }}"></script>
<script type="text/javascript" src="{{ asset('/bower-assets/simple-hotkeys/lib/hotkeys.js') }}"></script>
<script type="text/javascript" src="{{ asset('/bower-assets/simple-uploader/lib/uploader.js') }}"></script>
<script type="text/javascript" src="{{ asset('/bower-assets/simditor/lib/simditor.js') }}"></script>
{{-- markdown --}}
{{--<link rel="stylesheet" href="{{ asset('/bower-assets/simditor-markdown/styles/simditor-markdown.css') }}"/>--}}
{{--<script type="text/javascript" src="{{ asset('/bower-assets/marked/lib/marked.js') }}"></script>--}}
{{--<script type="text/javascript" src="{{ asset('/bower-assets/to-markdown/dist/to-markdown.js') }}"></script>--}}
{{--<script type="text/javascript" src="{{ asset('/bower-assets/simditor-markdown/lib/simditor-markdown.js') }}"></script>--}}
{{-- init simditor --}}
<script>
var editor = new Simditor({
textarea: $('#editor'),
upload: {
{{--url: '{{ route('upload') }}',--}}
params: null,
fileKey: 'upload_file',
connectionCount: 3,
leaveConfirm: 'Uploading is in progress, are you sure to leave this page?'
},
toolbar: ['bold', 'italic', 'underline', 'color', '|', 'ol', 'ul', '|', 'image', '|']
});
</script>
2 changes: 1 addition & 1 deletion resources/views/common/topic.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</span>
</div>
<div class="content">
{{ mb_substr($topic->content, 0, 200) }}
{!! str_limit($topic->content, 200) !!}
</div>
</div>
</div>
4 changes: 3 additions & 1 deletion resources/views/topic/_form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

<div class="form-group">
{!! Form::label('content', '正文') !!}
{!! Form::textarea('content', null, ['class' => 'form-control']) !!}
{!! Form::textarea('content', null, ['class' => 'form-control', 'id' => 'editor']) !!}
</div>

@include('common.editor')

<div class="form-group">
{!! Form::submit('确定', ['class' => ' btn btn-primary form-control']) !!}
</div>
4 changes: 2 additions & 2 deletions resources/views/topic/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

<!-- LG 3 -->
<div class="col-lg-3 hidden-xs-down">
@include('common.userAvatarCard', ['user' => auth()->user()])
@include('common.userInfoCard', ['user' => auth()->user()])
@include('common.userAvatarCard', ['user' => Auth::user()->user()])
@include('common.userInfoCard', ['user' => Auth::user()->user()])
</div>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions resources/views/topic/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@
@foreach ($topics as $topic)
@include('common.topic')
@endforeach

{!! $topics->render() !!}
@else
@include('common.nodata')
@endif
</div>
<br>
<div>
@include('common.pagination', ['paginator' => $topics])
</div>
</div>
</div>
</div>
Expand Down
41 changes: 18 additions & 23 deletions resources/views/topic/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class="pull-left fa fa-chevron-left" style="line-height:1.25"></i> 返回</a>
<br>

<a class="btn btn-block btn-secondary"
href="javascript:$('.form-topic-comment .input-content').focus();">
href="javascript:$('.simditor-body').focus();">
<i class="pull-left fa fa-reply" style="line-height:1.25"></i> 回复
</a>

Expand Down Expand Up @@ -86,25 +86,28 @@ class="pull-left fa fa-chevron-left" style="line-height:1.25"></i> 返回</a>
</div>
@endif

<p class="content">{!! $topic->content !!}</p>
<div class="content">{!! $topic->content !!}</div>

<br>

<div class="mb-2 form-topic-comment" style="margin-bottom:1rem !important;">
{!! Form::open(array('url' => '/topic/store-comment', 'method' => 'POST')) !!}
{!! Form::open(array('url' => '/topic/store-comment', 'method' => 'POST', 'class' => 'form form-horizontal')) !!}
{{ csrf_field() }}
{!! Form::hidden('topic_id', $topic->id) !!}
{!! Form::hidden('topic_comment_id', 0, ['id' => 'parent-id']) !!}

<div class="input-group">
<input type="text" name="content" class="form-control input-content" placeholder="">
<div class="input-group-btn">
<button type="submit" class="btn btn-secondary">
<span class="icon icon-paper-plane"></span>
</button>
</div>
<div class="form-group">
<textarea id="editor" class="form-control" placeholder=""></textarea>
<br>
<button type="submit" class="btn btn-info form-control">
@lang('hc.reply')
</button>
</div>
{!! Form::close() !!}
</div>

@include('common.editor')

<hr style="margin-top:0;">

@if ($comments)
Expand Down Expand Up @@ -132,20 +135,12 @@ class="pull-left fa fa-chevron-left" style="line-height:1.25"></i> 返回</a>
<script>
function replyOne(username, parentId) {
$('#parent-id').val(parentId);
replyContent = $(".input-content");
oldContent = replyContent.val();
replyContent = $(".simditor-body");
oldContent = replyContent.text();
prefix = "@" + username + " ";
newContent = '';

if (oldContent.length > 0) {
if (oldContent != prefix) {
newContent = oldContent + "\n" + prefix;
}
} else {
newContent = prefix
}
replyContent.focus();
replyContent.val(newContent);

$('.simditor-body').focus();
replyContent.prepend(prefix);
}
</script>
@endsection
5 changes: 4 additions & 1 deletion resources/views/ucenter/timeline.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
@foreach ($timelines as $timeline)
@include('common.timeline')
@endforeach
{!! $timelines->render() !!}
@else
@include('common.nodata')
@endif
</ul>
</div>
<br>
<div>
@include('common.pagination', ['paginator' => $timelines])
</div>
</div>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions resources/views/ucenter/topic.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
@foreach ($topics as $topic)
@include('common.topic')
@endforeach

{!! $topics->render() !!}
@else
@include('common.nodata')
@endif
</div>
</div>
<br>
<div>
@include('common.pagination', ['paginator' => $topics])
</div>
</div>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion resources/views/user/timeline.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
@foreach ($timelines as $timeline)
@include('common.timeline')
@endforeach
{!! $timelines->render() !!}
@else
@include('common.nodata')
@endif
</ul>

<br>
<div>
@include('common.pagination', ['paginator' => $timelines])
</div>
</div>
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions resources/views/user/topic.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
@foreach ($topics as $topic)
@include('common.topic')
@endforeach

{!! $topics->render() !!}
@else
@include('common.nodata')
@endif
</div>

<br>
<div>
@include('common.pagination', ['paginator' => $topics])
</div>
</div>
</div>
</div>
Expand Down