Refinery CMS: Adding custom field to custom engine index page - ruby-on-rails

i have generated a custom engine "Pianos" inside of refinery cms. On the index piano page, I'd like to display the content of a related custom field called "pianos_introduction_text".
What would be the correct way to generate and display this custom field?
Thanks for your help!

Our preference however is to create custom page parts in the normal pages section, rather than to use the copywriting engine.
Under the pages admin section you should see that a page has been added for pianos.
If you add a new page part (or even use an existing one), you can then retrieve and render it from the engine's index page like this:
<%= raw #page.content_for(:new_page_part) %>

Related

Creating links using root url within Razor view

So I'm within a Razor view in an Asp.net Core app. I need to set links within the page. The problem is that this view belongs to a ProductController and the result of the link below is https://localhost:44390/product/test
Name
The links need to be like this: https://localhost:44390/test/ and not https://localhost:44390/product/test Which is the best way to achieve that?
So writing the link this way produces the output I want to:
Name

Add page content dynamically MVC 5

I need to build a manage environment for my users so they could create new views (to give a title, a category, and the main content) or edit the content of the views that already have been created. I need to store this information in a database and have it appear in my site. I search through the internet but I didn't find a solution. I need this because I would like my site to have searchable content and because I have to many pages. Is that possible to achieve with MVC?
first step
Save view content as string using a wysiwyg editor, I recomend
http://summernote.org/
You need show your html using Html.raw() :
Exemple: Html.Raw("<div class=\"resource-row\">")
that way you will show your string as HTML.
I hope it is useful

Active Admin Customization in Ruby On Rails

I'm using active admin gem. In one table i want admins page to have some extra fields apart from the default functionalities.
Is it possible to have a default active admin page + a provision to render some html.
I want something like this in picture
The extra feature that i was talking was about push notification and message and that text area part
If you want a page with your own content, you could register a page: http://www.activeadmin.info/docs/10-custom-pages.html
But if you want to customise the default html strucure of the index page, you have to re-open the ActiveAdmin::Views::Pages module and override the build_page_content method. You can do this inside your app, for example create a new file in app/lib folder and override the method.
https://github.com/gregbell/active_admin/blob/master/lib/active_admin/views/pages/base.rb#L62
or if you want to customise the index table:
https://github.com/gregbell/active_admin/blob/master/lib/active_admin/views/pages/index.rb
Not a nice solution, but it's work. :/
Unfortunately, it seems index doesn't support custom rendering:
https://github.com/gregbell/active_admin/issues/813#issuecomment-3059957
However, you might have luck using panel, except in my experience that renders above the table ActiveAdmin generates.

How to create a Editor editable sidebar in Umbraco?

How can I create a sidebar in Umbraco that is common to all pages that uses a specific template, but is still editable for a editor?
If I simply create the sidebar in the template I would have to edit it myself every time they want something changes.
On the other hand if I create a sidebar field in the document type and map it to the sidebar in the template the editors have to recreate the same sidebar content for every page.
It's possible to use the recursive property on your template.
Basically what you do is on your homepage, or which ever root node for the section you want to use, you create the property which will contain your sidebar text. I would suggest the homepage.
Then you add a page field on the template with the attribute recursive=true
You can add the page field by adding the property a follows
This would result in a field that looks something like the following
<umbraco:Item field="category" recursive="true" runat="server" />
In my example, the property on the homepage which is being used is category.
Then any page which exists below the homepage, if it doesn't have a property with the same alias, then the value from the homepage will be taken.
A very useful feature :)

ROR: Nested views

I have a page object and various template objects in my application. pages have names, descriptions urls etc and each have a relationship with a template. templates have different numbers of content boxes and relationships with other controllers (like blogs, galleries etc.).
When I am rendering a page I can work out what template is attached to the page, and what the relevant content is based on that. but I am not sure what the best way is to render the nested Items.
Are you meant to somehow render the templates view from within the other view? Or would you have to just rewrite the view altogether? In this case would I have to create an extra template view for each different template, bundle it with the page views, and then only include it if it is the right one?
Would this be the same for galleries and blogs? do they all need to be bundled with the page? Or can it be called from its proper location?
I'm not sure what the best practice is here and haven't had any luck googling it. I'm suspecting that the key words im using aren't correct. Or this is common knowledge that isn't worth documenting.
You can use shared partials to render views. Check out this guide.
In the views, you can render the partials based upon whatever condition you want.
For example:
- if params[:page] == "my_page"
= render "shared/my_page"
Naturally, you will still need to set up the needed data in the controller.
Shared logic for this can be placed in the Application Controller.

Resources