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.
Related
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
I'm new to alchemy-cms.
I created a fresh install from the guides. I did not add any concept or structure.
Going to localhost:3000 I have to add the first user and after that I have a clean site.
When trying to add a new page, I have to select a type (page-layout?) and type in a name.
The Type combobox remains empty, and therefore the website don't allow me to add a page. What am I doing wrong? I think I'm missing something very obvious here.
I have looked allready in the source code, and running the following:
rails console
Alchemy::PageLayout.all
and this results in:
=> [{"name"=>"index", "unique"=>true, "elements"=>["article"], "autogenerate"=>["article"]}]
So I would guess the combobox should be filled with this item.
The index page layout is marked as unique, so it can only be added once per language. And as the so called language root page (the first most page in your page tree) already has this page layout, no new page can be created using this page layout.
In order to fix your problem you need to add another page layout to your page_layouts.yml file. It is good practice to add an standard page layout that is not unique (default) and can therefore be added multiple times per language.
I have a Home controller and a Business controller. The business controller has a few action methods on it: Search, Create, Update, Delete.
On my home page I have links to the Search and Create views on the Business controller. The Search view also has a link to the Create view.
I want the bread crumb to look like the following when Create is accessed from the home page:
Home > Create
…and i want it to look like the following when Create is accessed from the Search page:
Home > Business > Create
In both the cases the controller/action method is the same, but the breadcrumb I want displayed is different. Is it possible to do this using MvcSiteMapProvider?
As far as I know this is not supported out of the box. Meaning that you have to adapt the HtmlHelper template to you needs, see https://github.com/maartenba/MvcSiteMapProvider/wiki/HtmlHelper-functions.
The only way this can be done is if you add some information to your route to tell one request apart from the other, then you can configure 2 different nodes to create both breadcrumb trails.
I have a working example of how to do that on my blog: http://www.shiningtreasures.com/post/2013/08/10/mvcsitemapprovider-4-seo-features#canonical-tag. Make sure to check out the code download.
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) %>
The ActiveScaffold list view has a search form that is loaded via ajax when a user click the search link. I'd prefer to have the form show by default when a user opens a list page.
I've figured out a way to trigger the ajax call when the page loads, but I'm wondering if there's a way to get ActiveScaffold to render the form automatically. Is there a template or a method I can override? I've had a look through the code but there's nothing obvious, at least to me.
Update:
srboisvert's answer inspired me to have a better look.
The trick is to use Template overrides to refactor the following: list.rhtml, _list_header.rhtml, _search.rhtml so that the search form partial renders inline.
There is a way to get it rendered automatically:
active_scaffold :model do |config|
config.list.always_show_search = true
end
I don't currently have an active scaffold project handy but here is how I would figure it out.
I'd use firefox with firebug installed and take a look at what is called when the link is clicked. Then I would go look at that javascript and what it is generating. Then I would search the source for any part of the code or combination that would be fairly unique to the search box ajax. After that it should be easy to cut and past it in without the ajaxyness.
The option
config.list.always_show_search = true
works fine, but only on concrete controller. It throws an exception when used in AS set_default block. Somebody know better solution then to include it in every controller (apart from overriding the template which is handy but complicates version updates)