使用Rails中的Irwi Wiki gem编辑页面视图

时间:2021-12-26 15:18:28

What's the best way to edit and format page views using Irwi Wiki in Rails?

在Rails中使用Irwi Wiki编辑和格式化页面视图的最佳方法是什么?

Here is the controller it's set up for me:

这是为我设置的控制器:

class WikiPagesController < ApplicationController
  acts_as_wiki_pages_controller
end

Though there's no views folder corresponding to the controller. I just want to be able to edit the html or add css to the wiki articles I can create now.

虽然没有与控制器对应的视图文件夹。我只是希望能够编辑html或将css添加到我现在可以创建的wiki文章中。

https://github.com/alno/irwi

https://github.com/alno/irwi

2 个解决方案

#1


1  

As it says in the docs:

正如文档中所述:

You may create your own templates for controller actions (show, edit and history), in other case default built-in templates will be used.

您可以为控制器操作(显示,编辑和历史记录)创建自己的模板,在其他情况下,将使用默认的内置模板。

So, in your views folder, create a folder called wiki_pages and then put your new templates in that folder.

因此,在views文件夹中,创建一个名为wiki_pages的文件夹,然后将新模板放在该文件夹中。

Here's what's going on:

这是发生了什么:

When your WikiPagesController currently goes to render a wiki page, it looks for a template in apps/views/wiki_page corresponding to the current action. That folder/file doesn't exist, so it looks in other directories and ultimately finds the template in the gem. (You should be able to see this process in your console.)

当您的WikiPagesController当前用于呈现Wiki页面时,它会在与当前操作对应的apps / views / wiki_page中查找模板。该文件夹/文件不存在,因此它在其他目录中查找并最终在gem中找到该模板。 (您应该能够在控制台中看到此过程。)

When you create the folder and add the template (as above), the WikiPagesController finds the template in your application and renders that, instead of rendering the template provided by the gem.

当您创建文件夹并添加模板(如上所述)时,WikiPagesController会在您的应用程序中找到该模板并呈现该模板,而不是呈现gem提供的模板。

#2


0  

So I have done a little research and I think you can just copy all files from here: https://github.com/alno/irwi/tree/master/app/views/base_wiki_pages into views/wiki_pages folder so you will have all views locally and you will be able to edit them.

所以我做了一些研究,我认为你可以从这里复制所有文件:https://github.com/alno/irwi/tree/master/app/views/base_wiki_pages到views / wiki_pages文件夹,这样你就可以了本地查看,您将能够编辑它们。

#1


1  

As it says in the docs:

正如文档中所述:

You may create your own templates for controller actions (show, edit and history), in other case default built-in templates will be used.

您可以为控制器操作(显示,编辑和历史记录)创建自己的模板,在其他情况下,将使用默认的内置模板。

So, in your views folder, create a folder called wiki_pages and then put your new templates in that folder.

因此,在views文件夹中,创建一个名为wiki_pages的文件夹,然后将新模板放在该文件夹中。

Here's what's going on:

这是发生了什么:

When your WikiPagesController currently goes to render a wiki page, it looks for a template in apps/views/wiki_page corresponding to the current action. That folder/file doesn't exist, so it looks in other directories and ultimately finds the template in the gem. (You should be able to see this process in your console.)

当您的WikiPagesController当前用于呈现Wiki页面时,它会在与当前操作对应的apps / views / wiki_page中查找模板。该文件夹/文件不存在,因此它在其他目录中查找并最终在gem中找到该模板。 (您应该能够在控制台中看到此过程。)

When you create the folder and add the template (as above), the WikiPagesController finds the template in your application and renders that, instead of rendering the template provided by the gem.

当您创建文件夹并添加模板(如上所述)时,WikiPagesController会在您的应用程序中找到该模板并呈现该模板,而不是呈现gem提供的模板。

#2


0  

So I have done a little research and I think you can just copy all files from here: https://github.com/alno/irwi/tree/master/app/views/base_wiki_pages into views/wiki_pages folder so you will have all views locally and you will be able to edit them.

所以我做了一些研究,我认为你可以从这里复制所有文件:https://github.com/alno/irwi/tree/master/app/views/base_wiki_pages到views / wiki_pages文件夹,这样你就可以了本地查看,您将能够编辑它们。