]> BookStack Code Mirror - bookstack/commitdiff
Tweaked profile page anchor links and swapped register/login links
authorDan Brown <redacted>
Sat, 5 Jan 2019 15:01:16 +0000 (15:01 +0000)
committerDan Brown <redacted>
Sat, 5 Jan 2019 15:01:16 +0000 (15:01 +0000)
Also added test for login/register links on non-auth app view
Relates to #1146

resources/views/base.blade.php
resources/views/users/profile.blade.php
tests/PublicActionTest.php

index cd8063e12a1b755a81827d9fd63471c386e73db2..3c144fea88760124e2de8c0aee77511671320a88 100644 (file)
                                 <a href="{{ baseUrl('/settings') }}">@icon('settings'){{ trans('settings.settings') }}</a>
                             @endif
                             @if(!signedInUser())
-                                <a href="{{ baseUrl('/login') }}">@icon('login') {{ trans('auth.log_in') }}</a>
-                                                           @if(setting('registration-enabled', false))
+                                @if(setting('registration-enabled', false))
                                     <a href="{{ baseUrl("/register") }}">@icon('new-user') {{ trans('auth.sign_up') }}</a>
                                 @endif
+                                <a href="{{ baseUrl('/login') }}">@icon('login') {{ trans('auth.log_in') }}</a>
                             @endif
                         </div>
                         @if(signedInUser())
index c4a8f6323cdcee50c2d66dec1929352f0e209d73..4f67f1be2a59ba90b880988425a942cb4d21b7ee 100644 (file)
             </div>
             <div class="col-md-5 text-bigger" id="content-counts">
                 <div class="text-muted">{{ trans('entities.profile_created_content') }}</div>
-                <a href="#book">
+                <a href="#recent-books">
                     <div class="text-book">
                         @icon('book')  {{ trans_choice('entities.x_books', $assetCounts['books']) }}
                     </div>
                 </a>
-                <a href="#chapter">
+                <a href="#recent-chapters">
                     <div class="text-chapter">
                         @icon('chapter') {{ trans_choice('entities.x_chapters', $assetCounts['chapters']) }}
                     </div>
                 </a>
-                <a href="#page">
+                <a href="#recent-pages">
                     <div class="text-page">
                         @icon('page') {{ trans_choice('entities.x_pages', $assetCounts['pages']) }}
                     </div>
@@ -57,8 +57,7 @@
 
 
         <hr class="even">
-        <a name="page"></a>
-        <h3>{{ trans('entities.recently_created_pages') }}</h3>
+        <h3 id="recent-pages">{{ trans('entities.recently_created_pages') }}</h3>
         @if (count($recentlyCreated['pages']) > 0)
             @include('partials/entity-list', ['entities' => $recentlyCreated['pages']])
         @else
@@ -66,8 +65,7 @@
         @endif
 
         <hr class="even">
-        <a name="chapter"></a>
-        <h3>{{ trans('entities.recently_created_chapters') }}</h3>
+        <h3 id="recent-chapters">{{ trans('entities.recently_created_chapters') }}</h3>
         @if (count($recentlyCreated['chapters']) > 0)
             @include('partials/entity-list', ['entities' => $recentlyCreated['chapters']])
         @else
@@ -75,8 +73,7 @@
         @endif
 
         <hr class="even">
-        <a name="book"></a>
-        <h3>{{ trans('entities.recently_created_books') }}</h3>
+        <h3 id="recent-books">{{ trans('entities.recently_created_books') }}</h3>
         @if (count($recentlyCreated['books']) > 0)
             @include('partials/entity-list', ['entities' => $recentlyCreated['books']])
         @else
index 671b5ee420453d266618b09a2f795de1c124d7dc..27b4822fa2bce01f5379b50e3558333c01846003 100644 (file)
@@ -14,6 +14,24 @@ class PublicActionTest extends BrowserKitTest
         $this->visit($page->getUrl())->seePageIs('/login');
     }
 
+    public function test_login_link_visible()
+    {
+        $this->setSettings(['app-public' => 'true']);
+        $this->visit('/')->see(url('/login'));
+    }
+
+    public function test_register_link_visible_when_enabled()
+    {
+        $this->setSettings(['app-public' => 'true']);
+
+        $this->visit('/')->see(url('/login'));
+        $this->visit('/')->dontSee(url('/register'));
+
+        $this->setSettings(['app-public' => 'true', 'registration-enabled' => 'true']);
+        $this->visit('/')->see(url('/login'));
+        $this->visit('/')->see(url('/register'));
+    }
+
     public function test_books_viewable()
     {
         $this->setSettings(['app-public' => 'true']);