<commit_before>#!/usr/bin/env ruby

# This file needs to be loaded before the other controllers, hence the name 
# 01_controller.rb

require "json"

module Dirt
  class Controller

    attr_accessor :tab_spec

    def self.show(params)
      controller = self.new
      controller.get_tab_spec(params[:project], params[:page])
      controller.show(params)
    end 

    def self.edit(params)
      controller = self.new
      controller.edit(params)
    end 

    def self.save(params)
      controller = self.new
      controller.save(params)
    end 

    def get_tab_spec(project_name, page_name)
      @tab_spec = JSON.parse(Dirt::Project.where(:identifier => project_name).first.tab_spec, :symbolize_names=>true)
      @tab_spec.each {|t| t[:page] == page_name ? t[:class] = "active" : t[:class] = ""}
    end

    def haml( template_id )
      layout = File.read('views/layout.haml')
      template = File.read('views/' + template_id.to_s + '.haml')
      layout_engine = Haml::Engine.new(layout)
      layout_engine.render(self) do
        template_engine = Haml::Engine.new(template)
        template_engine.render(self)
      end
    end
  end 
end<commit_msg>Tabs now show on edit and save pages too<commit_after>#!/usr/bin/env ruby

# This file needs to be loaded before the other controllers, hence the name 
# 01_controller.rb

require "json"

module Dirt
  class Controller

    attr_accessor :tab_spec

    def self.show(params)
      controller = self.new
      controller.get_tab_spec(params[:project], params[:page])
      controller.show(params)
    end 

    def self.edit(params)
      controller = self.new
      controller.get_tab_spec(params[:project], params[:page])
      controller.edit(params)
    end 

    def self.save(params)
      controller = self.new
      controller.get_tab_spec(params[:project], params[:page])
      controller.save(params)
    end 

    def get_tab_spec(project_name, page_name)
      @tab_spec = JSON.parse(Dirt::Project.where(:identifier => project_name).first.tab_spec, :symbolize_names=>true)
      @tab_spec.each {|t| t[:page] == page_name ? t[:class] = "active" : t[:class] = ""}
    end

    def haml( template_id )
      layout = File.read('views/layout.haml')
      template = File.read('views/' + template_id.to_s + '.haml')
      layout_engine = Haml::Engine.new(layout)
      layout_engine.render(self) do
        template_engine = Haml::Engine.new(template)
        template_engine.render(self)
      end
    end
  end 
end
{'fraction_non_alphanumeric': 0.11793020457280386, 'fraction_numerical': 0.001604492579221821, 'mean_word_length': 3.1087314662273475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4304681', 'n_tokens_mistral': 816, 'n_tokens_neox': 787, 'n_words': 169}