<commit_before># Copyright (C) 2010 Cykod LLC.

class Blog::WizardController < ModuleController
  
  permit 'blog_config'

  component_info 'Blog'
  
  cms_admin_paths 'website'

  def self.structure_wizard_handler_info
    { :name => "Add a Blog to your Site",
      :description => 'This wizard will add an existing blog to a url on your site.',
      :permit => "blog_config",
      :url => { :controller => '/blog/wizard' }
    }
  end

  def index
    @version = SiteVersion.find_by_id(params[:version])
    SiteVersion.override_current(@version)

    cms_page_path [[ "Website",url_for(:controller => '/structure', :action => 'index', :version => @version.id) ]],"Add a Blog to your site structure"

    @blog_wizard = Blog::AddBlogWizard.new(params[:wizard] || {  :blog_id => params[:blog_id].to_i})
    if request.post? 
      if !params[:commit] 
        redirect_to :controller => '/structure', :action => 'wizards', :version => @version.id
      elsif  @blog_wizard.valid?
        @blog_wizard.add_to_site!
        flash[:notice] = "Added blog to site"
        redirect_to :controller => '/structure', :version => @version.id
      end
    end
  end
  

end<commit_msg>Redirect to create a blog if none exists.<commit_after># Copyright (C) 2010 Cykod LLC.

class Blog::WizardController < ModuleController
  
  permit 'blog_config'

  component_info 'Blog'
  
  cms_admin_paths 'website'

  def self.structure_wizard_handler_info
    { :name => "Add a Blog to your Site",
      :description => 'This wizard will add an existing blog to a url on your site.',
      :permit => "blog_config",
      :url => { :controller => '/blog/wizard' }
    }
  end

  def index
    @version = SiteVersion.find_by_id(params[:version])
    SiteVersion.override_current(@version)

    return redirect_to(:controller => '/blog/admin', :action => 'create', :version => @version.id) if Blog::BlogBlog.count == 0

    cms_page_path [[ "Website",url_for(:controller => '/structure', :action => 'index', :version => @version.id) ]],"Add a Blog to your site structure"

    @blog_wizard = Blog::AddBlogWizard.new(params[:wizard] || {  :blog_id => params[:blog_id].to_i})
    if request.post? 
      if !params[:commit] 
        redirect_to :controller => '/structure', :action => 'wizards', :version => @version.id
      elsif  @blog_wizard.valid?
        @blog_wizard.add_to_site!
        flash[:notice] = "Added blog to site"
        redirect_to :controller => '/structure', :version => @version.id
      end
    end
  end
  

end
{'fraction_non_alphanumeric': 0.13865713150576084, 'fraction_numerical': 0.003575685339690107, 'mean_word_length': 3.3867595818815333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6646130', 'n_tokens_mistral': 823, 'n_tokens_neox': 786, 'n_words': 206}