Sha256: c9f7cbe9e4cf9a678acd2fe3afc290a3b71ceb28ead6432cb0753653358a3ad8

Contents?: true

Size: 1.09 KB

Versions: 43

Compression:

Stored size: 1.09 KB

Contents

class MainController < Ramaze::Controller
  

  def index handle = "main"
    @handle = handle
    @entry = WikiEntry.new(handle)
    if @entry.exists?
      @text = EntryView.render(@entry.content)
      @history = @entry.history.map{|f|
        DateTime.strptime(File.basename(f, ".mkd"),
        "%Y-%m-%d_%H-%M-%S")
      }.join("<br />\n")
    else
      @text = "No Entry"
    end
  end

  def edit handle
    @handle = handle
    @entry = WikiEntry.new(handle)
    @text = @entry.content
  end

  def revert handle
    WikiEntry[handle].revert
    redirect Rs(handle)
  end

  def unrevert handle
    WikiEntry[handle].unrevert
    redirect Rs(handle)
  end

  def delete handle
    WikiEntry[handle].delete
    redirect_referer
  end

  def save
    redirect_referer unless request.post?
    handle = request['handle']
    entry = WikiEntry.new(handle)
    entry.save(request['text'])
    redirect Rs(:index, handle)
  end

  def html_layout
    @nodes = WikiEntry.titles.map{|f|
        name = File.basename(f)
        %[<a href="/#{name}">#{name}</a>]
      }.join("\n")
  end

  layout '/html_layout'
end

Version data entries

43 entries across 43 versions & 6 rubygems

Version Path
Pistos-ramaze-2008.09 examples/app/wiktacular/src/controller.rb
Pistos-ramaze-2008.12 examples/app/wiktacular/src/controller.rb
Pistos-ramaze-2009.01 examples/app/wiktacular/src/controller.rb
Pistos-ramaze-2009.02 examples/app/wiktacular/src/controller.rb
Pistos-ramaze-2009.04.08 examples/app/wiktacular/src/controller.rb
Pistos-ramaze-2009.06.12 examples/app/wiktacular/src/controller.rb
clivecrous-ramaze-0.3.9.5 examples/wiktacular/src/controller.rb
manveru-ramaze-2008.07 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2008.08 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2008.09 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2008.10 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2008.12 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2009.01 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2009.04.01 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2009.04.08 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2009.04.18 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2009.04.22 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2009.04 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2009.05.08 examples/app/wiktacular/src/controller.rb
manveru-ramaze-2009.05 examples/app/wiktacular/src/controller.rb