Sha256: 42c7ac3dc08e25e693a501c5775fe7a217139a05ca2a2ef005f2cac740771f98

Contents?: true

Size: 1.07 KB

Versions: 14

Compression:

Stored size: 1.07 KB

Contents

class MainController < Ramaze::Controller
  layout :application
  before_all {setup}

  def index(handle = "main")
    @entry = WikiEntry.new(handle)
    @handle = @entry.name

    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)
    @entry = WikiEntry.new(handle)
    @handle = @entry.name
    @text = @entry.content
  end

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

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

  def delete(handle)
    WikiEntry.new(handle).delete
    redirect_referer
  end

  def save
    redirect_referer unless request.post?

    handle = request['handle']
    entry = WikiEntry.new(handle)
    entry.save(request['text'])
    redirect entry.route
  end

  def setup
    @nodes = WikiEntry.titles.map{|f|
      anchor File.basename(f)
    }.join("\n")
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ramaze-2023.01.06 examples/app/wiktacular/src/controller.rb
ramaze-2012.12.08 examples/app/wiktacular/src/controller.rb
ramaze-2012.12.08b examples/app/wiktacular/src/controller.rb
ramaze-2012.04.14 examples/app/wiktacular/src/controller.rb
ramaze-2012.03.07 examples/app/wiktacular/src/controller.rb
ramaze-2011.12.28 examples/app/wiktacular/src/controller.rb
ramaze-2011.10.23 examples/app/wiktacular/src/controller.rb
ramaze-2011.07.25 examples/app/wiktacular/src/controller.rb
ramaze-2011.01.30 examples/app/wiktacular/src/controller.rb
ramaze-2011.01 examples/app/wiktacular/src/controller.rb
ramaze-2010.06.18 examples/app/wiktacular/src/controller.rb
ramaze-2010.04.04 examples/app/wiktacular/src/controller.rb
ramaze-2010.04 examples/app/wiktacular/src/controller.rb
ramaze-2010.03 examples/app/wiktacular/src/controller.rb