module W2
  module Controller
    get '/style.css' do
      render :text, File.read(File.dirname) + '/public/style.css'
    end

    get '/app.js' do
      render :text, File.read(File.dirname) + '/public/app.js'
    end

    get %r'(.*)/edit' do |path|
      haml :edit, :locals => {:path => path, :text => wiki_text_for(path)}
    end

    get %r'(.*)/changes' do |path|
      haml :changes, :locals => {:path => path, :changes => changes(path)}
    end

    get %r'(.*)/(\d{10})' do |path, time|
      haml :diff, :locals => {:path => path, :time => time, :changes => changes(path)}
    end

    get %r'(.*)' do |path|
      path = '/' if path == ''
      if File.exist? file_path(path)
        haml :show, :locals => {:path => path, :text => parsed_wiki_text_for(path)}
      else 
        haml :edit, :locals => {:path => path, :text => wiki_text_for(path)}
      end
    end

    post %r'(.*)' do |path|
      save_file path, params['wiki_text']
      redirect show_path(path)
    end
  end
end

module W2
  module Controller
    get '/style.css' do
      render :text, File.read(File.dirname) + '/public/style.css'
    end

    get '/app.js' do
      render :text, File.read(File.dirname) + '/public/app.js'
    end

    get %r'(.*)/edit' do |path|
      haml :edit, :locals => {:path => path, :text => wiki_text_for(path)}
    end

    get %r'(.*)/changes' do |path|
      haml :changes, :locals => {:path => path, :changes => changes(path)}
    end

    get %r'(.*)/(\d{10})' do |path, time|
      haml :diff, :locals => {:path => path, :time => time, :changes => changes(path)}
    end

    get %r'(.*)' do |path|
      if File.exist? file_path(path)
        haml :show, :locals => {:path => path, :text => parsed_wiki_text_for(path)}
      else 
        haml :edit, :locals => {:path => path, :text => wiki_text_for(path)}
      end
    end

    post %r'(.*)' do |path|
      save_file path, params['wiki_text']
      redirect show_path(path)
    end
  end
end

Revert "Don't show empty paths"
Revert "Don't show empty paths"

Turns out this wasn't the problem

This reverts commit 5746885bd5da06bea70b8648d68b681281659a42.
