<commit_before>class OneClickController < ApplicationController
  before_filter :current_organisation
  
  def index
    redirect_to(:action => 'dashboard')
  end
  
  def constitution
    @page_title = "Constitution"
    prepare_constitution_view
    
    respond_to do |format|
      format.html
      format.pdf {
        html = render_to_string(:layout => false , :action => "constitution.pdf.haml")
        kit = PDFKit.new(html)
        kit.stylesheets << "#{Rails.root}/public/stylesheets/pdf.css"
        send_data(kit.to_pdf, :filename => "#{@organisation_name} Constitution.pdf",
          :type => 'application/pdf', :disposition => 'inline')        
        return
      }
    end
  end
  
  def dashboard
    # only_provides :html
    
    if current_organisation.pending? || current_organisation.proposed?
      redirect_to(:action => 'constitution')
      return
    end
            
    # Fetch open proposals
    @proposals = co.proposals.currently_open
    
    @new_proposal = co.proposals.new<commit_msg>Comment PDF creation in one_click_controller and experiment with headers/footers<commit_after>class OneClickController < ApplicationController
  before_filter :current_organisation
  
  def index
    redirect_to(:action => 'dashboard')
  end
  
  def constitution
    @page_title = "Constitution"
    prepare_constitution_view
    
    respond_to do |format|
      format.html
      format.pdf {
        html = render_to_string(:layout => false , :action => "constitution.pdf.haml")
        
        # Call PDFKit with any wkhtmltopdf --extended-help options
        kit = PDFKit.new(html, :page_size => 'A4', :header_right => 'Printed on [date]')
        
        # Add our CSS file
        kit.stylesheets << "#{Rails.root}/public/stylesheets/pdf.css"

        send_data(kit.to_pdf, :filename => "#{@organisation_name} Constitution.pdf",
          :type => 'application/pdf', :disposition => 'inline')
          # disposition can be set to `attachment` to force a download
        
        return
      }
    end
  end
  
  def dashboard
    # only_provides :html
    
    if current_organisation.pending? || current_organisation.proposed?
      redirect_to(:action => 'constitution')
      return
    end
            
    # Fetch open proposals
    @proposals = co.proposals.currently_open
    
    @new_proposal = co.proposals.new
{'fraction_non_alphanumeric': 0.09796437659033079, 'fraction_numerical': 0.00042408821034775233, 'mean_word_length': 2.6460587326120555, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5093585', 'n_tokens_mistral': 704, 'n_tokens_neox': 693, 'n_words': 150}