Pārlūkot izejas kodu

WIP for a post wizard.

George Baugh 2 mēneši atpakaļ
vecāks
revīzija
920c16f314

+ 29 - 0
lib/Trog/Routes/HTML.pm

@@ -162,6 +162,13 @@ our %routes = (
         noindex  => 1,
         nocache  => 1,
     },
+    '/admin/wyzzerdd' => {
+        method   => 'GET',
+        auth     => 1,
+        callback => \&Trog::Routes::HTML::post_wizard,
+        noindex  => 1,
+        nocache  => 1,
+    },
 
     #TODO transform into posts?
     '/sitemap',
@@ -1719,6 +1726,28 @@ sub sessions ($query) {
     );
 }
 
+sub post_wizard ($query) {
+    return $query->{tpsgi}->see_also('/login')  unless $query->{user};
+    return $query->{tpsgi}->forbidden($query) unless grep { $_ eq 'admin' } @{ $query->{user_acls} };
+
+    # Get the existing post types
+    my $forms = Trog::Themes::templates_in_dir( "forms", 'text/html', 1 );
+
+    return Trog::Routes::HTML::index(
+        {
+            title        => 'tCMS Post Wizard',
+            theme_dir    => Trog::Themes::td(),
+            template     => 'post_wizard.tx',
+            is_admin     => 1,
+            forms        => $forms,
+            %$query,
+        },
+        undef,
+        ['post.css'],
+    );
+}
+
+
 # basically a file rewrite rule for themes
 sub icon ($query) {
     my $path = $query->{route};

+ 1 - 0
www/templates/html/components/post_wizard.tx

@@ -0,0 +1 @@
+TEST

+ 1 - 0
www/templates/html/sysbar.tx

@@ -6,6 +6,7 @@
         <a href="/manual"      title="Manual"        class="topbar">Manual</a>
         <a href="/metrics?period=hour&num_periods=24"     title="Metrics"       class="topbar">Metrics</a>
         <a href="/admin/sessions"  title="Session Audit Log" class="topbar">Sessions</a>
+        <a href="/admin/wyzzerdd"  title="Post Type wizard" class="topbar">Post Types</a>
         <a href="/totp"        title="TOTP"          class="topbar">Enable/View TOTP 2fa</a>
         <a href="/password_reset" title="Reset Auth" class="topbar">Reset Password/TOTP</a>
         <a href="/logout"      title="Logout"        class="topbar">🚪</a>