Sha256: 9a3486f07822e9efa9c170f35936c66f6a0f323597ca401761835aea354355f4
Contents?: true
Size: 1020 Bytes
Versions: 2
Compression:
Stored size: 1020 Bytes
Contents
# frozen_string_literal: true module Yaw class WikiPageController < Yaw::ApplicationController layout 'wiki' before_action :set_wiki_space before_action :set_object, only: %i[show edit update] respond_to :html def show @title = @wiki_page.title render 'new' unless @wiki_page.id? end def edit; end def create @wiki_page = @wiki_space.wiki_pages.create(wiki_page_params.merge(user: current_user)) respond_with(@wiki_space, @wiki_page) end def update @wiki_page.update(wiki_page_params.merge(user: current_user)) respond_with(@wiki_space, @wiki_page) end private def path CGI.unescape params[:path] end def set_wiki_space @wiki_space = WikiSpace.find_by!(title: params[:wiki_space_id]) end def set_object @wiki_page = @wiki_space.wiki_pages.find_or_initialize_by(path: path) end def wiki_page_params params.require(:wiki_page).permit(:path, :body, :title) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yaw-0.0.2 | app/controllers/yaw/wiki_page_controller.rb |
yaw-0.0.1 | app/controllers/yaw/wiki_page_controller.rb |