Skip to content

Commit 7120a54

Browse files
committed
Replace option "disable syntax HL" with "enable syntax HL"
1 parent 72cd15e commit 7120a54

10 files changed

+59
-16
lines changed

app/Http/Controllers/EditPasteController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function index($link, Request $request){
3333
'privacy' => $paste->privacy,
3434
'date' => $paste->created_at->format('Y-m-d'),
3535
'fulldate' => $paste->created_at->format('Y-m-d H:i:s'),
36-
'noSyntax' => $paste->noSyntax,
36+
'syntaxHl' => $paste->syntaxHl,
3737
]);
3838
}
3939

@@ -90,7 +90,7 @@ public function edit($link, Requests\EditPaste $request){
9090
$paste->expiration = $timestampExp;
9191
$paste->privacy = $privacy;
9292
$paste->password = $password;
93-
$paste->noSyntax = Input::has('noSyntax');
93+
$paste->syntaxHl = Input::has('syntaxHl');
9494
$paste->burnAfter = $burnAfter;
9595

9696
$paste->save();

app/Http/Controllers/PasteController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function submit(Requests\StorePaste $request){
9191
'expiration' => $timestampExp,
9292
'privacy' => $privacy,
9393
'password' => $password,
94-
'noSyntax' => Input::has('noSyntax'),
94+
'syntaxHl' => Input::has('syntaxHl'),
9595
'burnAfter' => $burnAfter,
9696
]);
9797

@@ -177,7 +177,7 @@ public function view($link, Request $request){
177177
'privacy' => $privacy,
178178
'date' => $paste->created_at->format('Y-m-d'),
179179
'fulldate' => $paste->created_at->format('Y-m-d H:i:s'),
180-
'noSyntax' => $paste->noSyntax,
180+
'syntaxHl' => $paste->syntaxHl,
181181
]);
182182
}
183183

app/Paste.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class Paste extends Model
88
{
9-
protected $fillable = ['link', 'userId', 'title', 'content', 'ip', 'noSyntax', 'expiration', 'privacy', 'password', 'views', 'burnAfter'];
9+
protected $fillable = ['link', 'userId', 'title', 'content', 'ip', 'syntaxHl', 'expiration', 'privacy', 'password', 'views', 'burnAfter'];
1010

1111
public function user()
1212
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
use App\Paste;
8+
9+
class InvertSyntaxhlOption extends Migration
10+
{
11+
/**
12+
* Run the migrations.
13+
*
14+
* @return void
15+
*/
16+
public function up()
17+
{
18+
Schema::table('pastes', function (Blueprint $table) {
19+
$table->boolean('syntaxHl')->nullable();
20+
});
21+
Paste::where('noSyntax', 1)->update(['syntaxHl' => 0]);
22+
Paste::where('noSyntax', 0)->update(['syntaxHl' => 1]);
23+
Schema::table('pastes', function (Blueprint $table) {
24+
$table->dropColumn(['noSyntax']);
25+
});
26+
}
27+
28+
/**
29+
* Reverse the migrations.
30+
*
31+
* @return void
32+
*/
33+
public function down()
34+
{
35+
Schema::table('pastes', function (Blueprint $table) {
36+
$table->boolean('noSyntax')->nullable();
37+
});
38+
Paste::where('syntaxHl', 1)->update(['noSyntax' => 0]);
39+
Paste::where('syntaxHl', 0)->update(['noSyntax' => 1]);
40+
Schema::table('pastes', function (Blueprint $table) {
41+
$table->dropColumn(['syntaxHl']);
42+
});
43+
}
44+
}

resources/lang/en/edpaste.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'paste.content.placeholder' => 'Paste your text here...',
1414
'paste.expiration' => 'Paste expiration',
1515
'paste.privacy' => 'Privacy',
16-
'paste.option.disable.syntax' => 'Disable syntax highlighting',
16+
'paste.option.enable.syntax' => 'Enable syntax highlighting',
1717
'paste.submit.tooltip' => 'Registered users have access to other privacy tools',
1818
'paste.submit' => 'Submit',
1919

resources/lang/fr/edpaste.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'paste.content.placeholder' => 'Collez votre texte ici...',
1414
'paste.expiration' => 'Expiration du post-it',
1515
'paste.privacy' => 'Type d\'accès',
16-
'paste.option.disable.syntax' => 'Désactiver le surlignage syntaxique',
16+
'paste.option.enable.syntax' => 'Activer le surlignage syntaxique',
1717
'paste.submit.tooltip' => 'Plus d\'options de visibilité sont disponibles pour les utilisateurs authentifés',
1818
'paste.submit' => 'Soumettre',
1919

resources/views/paste/dashboard.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
@foreach ($userPastes as $userPaste)
4747
<tr>
4848
<td><a href="/{{ $userPaste->link }}">@if (strlen($userPaste->title) <= 20) {{ $userPaste->title}} @else {{ mb_substr($userPaste->title,0,20,'UTF-8') }}... @endif</a></td>
49-
<td class="hidden-xs"><i>@if (!$userPaste->noSyntax) <i class="fa fa-file-code-o"></i> &nbsp; @endif @if (strlen($userPaste->content) < 90) {{ $userPaste->content}} @else {{ mb_substr($userPaste->content,0,90,'UTF-8') }}... @endif</i></td>
49+
<td class="hidden-xs"><i>@if ($userPaste->syntaxHl) <i class="fa fa-file-code-o"></i> &nbsp; @endif @if (strlen($userPaste->content) < 90) {{ $userPaste->content}} @else {{ mb_substr($userPaste->content,0,90,'UTF-8') }}... @endif</i></td>
5050
{{-- Bloc d'infos --}}
5151
<td class="hidden-xs">
5252
@if ($userPaste->privacy == "link") <i class="fa fa-globe fa-lg" data-toggle="tooltip" data-placement="bottom" title="{{ __('edpaste.paste.option.privacy.link') }}"></i>

resources/views/paste/edit.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function checkvalue(value)
113113
</script>
114114
{{-- La tooltip n'apparaît que pour les users non-id et le btn devient danger si y'a des erreurs --}}
115115
<div class="checkbox">
116-
<label><input type="checkbox" name="noSyntax" @if ($noSyntax) checked @endif>{{ __('edpaste.paste.option.disable.syntax') }}</label>
116+
<label><input type="checkbox" name="syntaxHl" @if ($syntaxHl) checked @endif>{{ __('edpaste.paste.option.enable.syntax') }}</label>
117117
</div>
118118
<button type="submit" id="submit" class="btn @if (count($errors) > 0) btn-danger @else btn-outline-success @endif btn-lg" @if (!cas()->isAuthenticated()) data-toggle="tooltip" data-placement="top" title="Registered users have access to other privacy tools" @endif>{{ __('edpaste.paste.submit') }}</button>
119119
</div>

resources/views/paste/index.blade.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ function checkvalue(value)
103103
</script>
104104
{{-- La tooltip n'apparaît que pour les users non-id et le btn devient danger si y'a des erreurs --}}
105105
<div class="checkbox">
106-
107-
<label><input type="checkbox" name="noSyntax" checked="true">{{ __('edpaste.paste.option.disable.syntax') }}</label>
106+
<label><input type="checkbox" name="syntaxHl">{{ __('edpaste.paste.option.enable.syntax') }}</label>
108107
</div>
109108
<button type="submit" id="submit" class="btn @if (count($errors) > 0) btn-danger @else btn-outline-success @endif btn-lg" @if (!cas()->isAuthenticated()) data-toggle="tooltip" data-placement="top" title="{{ __('edpaste.paste.submit.tooltip') }}" @endif>{{ __('edpaste.paste.submit') }}</button>
110109
</div>

resources/views/paste/view.blade.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
@section('style')
2323
<link rel="stylesheet" href="/highlight_styles/tomorrow.css">
2424
<style>
25-
@if ($noSyntax == false)
25+
@if ($syntaxHl == true)
2626
pre {
2727
overflow: auto;
2828
word-wrap: normal;
@@ -55,7 +55,7 @@
5555
@endsection
5656

5757
@section('script')
58-
@if ($noSyntax == false)
58+
@if ($syntaxHl == true)
5959
<script src="highlight.pack.js"></script>
6060
<script src="highlightjs-line-numbers.min.js"></script>
6161
<script>
@@ -132,12 +132,12 @@
132132
</div>
133133

134134
{{-- N'est formaté que si le SH est activé --}}
135-
<div class="row" @if ($noSyntax == true) style="margin-bottom:20px;" @endif>
135+
<div class="row" @if ($syntaxHl == true) style="margin-bottom:20px;" @endif>
136136
<div class="col-sm-12">
137-
<label for="paste"><i>@if ($noSyntax == false) {{ __('edpaste.paste.syntax-highlighted') }} @else {{ __('edpaste.paste.plain-text') }} @endif</i></label>
137+
<label for="paste"><i>@if ($syntaxHl == true) {{ __('edpaste.paste.syntax-highlighted') }} @else {{ __('edpaste.paste.plain-text') }} @endif</i></label>
138138
@if ($privacy != "Password-protected") <i class="pull-right"><a href="/raw/{{ $link }}">{{ __('edpaste.paste.raw') }}</a> @endif </i>
139139
@if ($sameUser) <i class="pull-right" style="margin-right: 10px;"><a href="/edit/{{ $link }}">{{ __('edpaste.paste.edit') }}</a> @endif </i>
140-
<pre id="paste"><code class="code">@if ($noSyntax == true)<i>@endif{{ $content }} @if ($noSyntax == true)</i>@endif</code></pre>
140+
<pre id="paste"><code class="code">@if ($syntaxHl == false)<i>@endif{{ $content }} @if ($syntaxHl == false)</i>@endif</code></pre>
141141
</div>
142142
</div>
143143
</div>

0 commit comments

Comments
 (0)