diff --git a/Web/lib/MJB/Web.pm b/Web/lib/MJB/Web.pm index 7daf3d8..758d195 100644 --- a/Web/lib/MJB/Web.pm +++ b/Web/lib/MJB/Web.pm @@ -127,8 +127,10 @@ sub startup ($self) { $auth->post( '/dashboard/blog/:id/config' )->to('Dashboard#do_blog_config' )->name('do_dashboard_blog_config' ); # Blog Management - $auth->get ( '/blog/create' )->to('Blog#create' )->name('show_blog_create' ); - $auth->post( '/blog/create' )->to('Blog#do_create' )->name('do_blog_create' ); + $auth->get ( '/blog' )->to('Blog#create' )->name('show_blog_create' ); + $auth->post( '/blog' )->to('Blog#do_create' )->name('do_blog_create' ); + $auth->get ( '/blog/:id/settings' )->to('Blog#settings' )->name('show_blog_settings' ); + $auth->post( '/blog/:id/settings' )->to('Blog#do_settings' )->name('do_blog_settings' ); } 1; diff --git a/Web/lib/MJB/Web/Controller/Blog.pm b/Web/lib/MJB/Web/Controller/Blog.pm index 4d4a57c..3ab9878 100644 --- a/Web/lib/MJB/Web/Controller/Blog.pm +++ b/Web/lib/MJB/Web/Controller/Blog.pm @@ -71,9 +71,46 @@ sub do_create ($c) { parents => [ $ssl_job_id ], }); - # Take the user to the management panel for the site + $c->redirect_to( $c->url_for( 'show_blog_settings', { id => $blog->id } ) ); } +sub settings ( $c ) { + +} + +sub do_settings ( $c ) { + my $blog = $c->stash->{blog} = $c->db->blog( $c->param('id') ); + + if ( $blog->person->id ne $c->stash->{person}->id ) { + $c->render( + text => "Error: This blog isn't owned by you.", + status => 404, + format => 'txt', + ); + return; + } + + my $jekyll = $c->jekyll($blog->domain->name); + + my $title = $c->stash->{form_title} = $c->param( 'configTitle' ); + my $desc = $c->stash->{form_desc} = $c->param( 'configDesc' ); + my $email = $c->stash->{form_email} = $c->param( 'configEmail' ); + + $jekyll->config->data->{title} = $title; + $jekyll->config->data->{description} = $desc; + $jekyll->config->data->{email} = $email; + $jekyll->config->data->{url} = 'https://' . $blog->domain->name ; + + $jekyll->write_config; + + $c->minion->enqueue( 'deploy_blog', [ $blog->id ], { + notes => { '_mjb_bid_' . $blog->id => 1 }, + }); + + $c->flash( confirmation => "Welcome to the dashboard for your new blog!" ); + $c->redirect_to( $c->url_for( 'show_dashboard_blog', { id => $blog->id } ) ); +} + 1; diff --git a/Web/templates/blog/create.html.ep b/Web/templates/blog/create.html.ep index 2ae30cf..c5d6158 100644 --- a/Web/templates/blog/create.html.ep +++ b/Web/templates/blog/create.html.ep @@ -1,23 +1,21 @@ % layout 'standard', title => 'Create Blog', sb_active => 'dashboard'; -

Create a new blog

-
-
-
+
+
-
Connect Repo
-
Choose Domain
-
Select Builder
+
Domain Name
+
Blog Settings
+
Finish
-

Choose a domain

+

New Blog: Domain

-

Next you can choose a domain name for your website. You can host your website on a subdomain of <%= $c->config->{customer_domain} %> without any further configuration on your part, just enter YourSiteName below.

+

You will want to choose a domain name for your new blog. You can host your blog on a subdomain of <%= $c->config->{customer_domain} %> without any further configuration on your part, just enter YourSiteName below.

If you have your own domain, you can also use that. Be sure to set your DNS records to match *.<%= $c->config->{customer_domain} %>.

diff --git a/Web/templates/blog/settings.html.ep b/Web/templates/blog/settings.html.ep new file mode 100644 index 0000000..5b1b47a --- /dev/null +++ b/Web/templates/blog/settings.html.ep @@ -0,0 +1,57 @@ +% layout 'standard', title => 'Create Blog', sb_active => 'dashboard'; + +

+
+
+
+
+
+
+
Domain Name
+
Blog Settings
+
Finish
+
+
+ +

Blog Settings

+ +

Let's name and describe this!

+ +% if ( $c->stash->{success} ) { + +% } + +% if ( $c->stash->{errors} ) { + +% } + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
diff --git a/Web/templates/dashboard/blog.html.ep b/Web/templates/dashboard/blog.html.ep index c2f0f14..670e5ac 100644 --- a/Web/templates/dashboard/blog.html.ep +++ b/Web/templates/dashboard/blog.html.ep @@ -17,6 +17,29 @@ +% if ( my $confirmation = flash 'confirmation' ) { + +% } + +% if ( $c->stash->{success} ) { + +% } + +% if ( $c->stash->{errors} ) { + +% } + % if ( $blog ) {

My Websites