customizing the record details page (show page?) - ruby-on-rails

I'm brand new to rails, and have inherited an app I'm trying to make modifications to; it uses activeadmin - which seems nice, but is a bit opaque to me at the moment.
The show page - the page that shows a detailed, single record - doesn't seem to be generated by anything I can find. I found the file dealing with the list of all records, but can't find what's actually generating the details.
I need to add some custom info to this page that's not directly linked to the record in the database itself basically group of related resources.
What file am I looking for? Or do I need to create one somewhere? The listing page is in admin/users.rb

You want to edit admin/users.rb.
http://activeadmin.info/docs/6-show-screens.html
The above link documents how to customize the show page.

Related

Trying to create basic blog posts in Umbraco

I've been trying for hours now to add blog posts into our site through the Umbraco back office. It feels so unintuitive how everything works and I'm beginning to get very frustrated, here's what I'm trying to do/have done:
I create a document type, "BlogPost", it contains data that can be entered in a content node relating to the blog post, description, title, etc.
I create a document type, "BlogPage", as a document type to be used as a root content node, which will hold all the BlogPost content nodes, that way I can simply loop through them and render each one on our site
I go to create the BlogPost content node, and it assigns it an url of "/", which simply redirects to the home page
What I don't understand is how am I supposed to just get data that was entered in Umbraco for my view? We have an extremely stylized theme for our site, so I can't use things like Articulate, and I shouldn't have to, all I want to do is store a collection of blog posts together, pull that data from Umbraco, and load it into an ASP.NET view, but there is absolutely zero documentation or examples of how to do this online, I would be incredibly grateful if someone could point me in the right direction on how I should go about doing what I'm trying to do.
If I understand correctly you are developing a blog section on an existing website. First thing to do is inderdaad create a new documenttype for the blogpost itself and add a documenttype for the container of blogposts.
Did you create new templates for these documenttypes? You can find some documentation on templates here
Inside the template you'll want to query data from Umbraco. Information about querying data is available here
Next up is adding the newly created templates to the documenttypes and you're ready to create your content.
Make sure that for the content you create the template is set (see Properties tab), here you can also see the url Umbraco created for the content.
Did you start the Umbraco website from scratch or are you developing on an existing website? Because a blogpost should not redirect to / by default, unless it's the root node of your website. This sounds like custom functiality. Maybe a rewrite or error handling module?
Edit: Also some information on how to get started with templating in Umbraco is available here

Admin generate layout (Rails)

I make a Rails App, where admin can generate the homepage of the App (item positions, adding new items, deleting others, etc). I know that I have to store it in DB. But I am not really sure what I am supposed to store in the table.
So, in Admin page I want to make the edit homepage with drop and drag menu. What is the best way to do that?
The answer is it depends - If you are providing the admin an interface to edit home page with drag and drop or delete specific content, then you should store html contents of that page in DB and if you are giving only reference to edit then you should store those references only. But i will go for storing html contents. And again it completely depends on your requirement and you are the best person to understand and implement that.

RefineryCMS - Page Templates of Page-Parts possible?

Im looking at Rails based CMS's, Refinery looks very nice, clean and simple however I cant find any clarification if templating is possible, or is to be included.
Ive found this pull request. Is this feature now available?
Ive also been looking at Locomotive but the documentation is very sparse at best.
Thanks.
Edit - Sorry, there was not enough of an explanation of what I meant by a template. Is it possible to define the page-parts that a certain page has. Eg I add a "City" page type, which has 5 page-parts, Name, Postcode, Description, Longitude and Latitude. So when a user adds a page, they then choose a page type, in this case a City and that has the pre-defined page-parts in it.
I have seen the copywriting but it does not appear possible to pre-define things when adding a new page.
You could add up layout.css in your stylesheets directory and it will automatically get picked up.
check out this railscast episode for more information.
Edit:
You could use the rails g refinery:engine city name:string ....
It will generate a whole bunch of stuff, follow the instructions printed by this command and you could see a new admin page to CRUD cities and a new app with views to set the HTML of show/index pages.

Loading data from database by Ajax - Ruby on Rails app

Sometimes at websites all comments or other data from DB is hidden by default. When user click at link like "Display comments" all comments from database are dynamically selected and placed under the content. It must be great for mysql performance, because content is generated only when user excatly need it. I would like to implement this stuff at my app.
I've got one idea to do this so far. Remote action with #comments = Content.comments and next page.insert_html at RJS template. Is it good idea or maybe I should choose different way?
The decision is purely based on the application that you are developing. For example if in case of stack overflow it does not make sense to show only the question and show answer link. But in case of a blog post it may be fine.
In the above situation, I don't think there will be a good improvement in performance by removing the comments of the content on show page. We can achieve the same functionality by making use of javascript methods. Hide the content on page load and show in on client request.

Update content when new values are added to database?

I know my question might be ovbious for some of you, but I'm not sure how to do it, and I can't find it on google, probably because I'm not using the right keywords.
I'm using the latest rails. On my view I have a table generated by rails. People are able to add content to that table by sending a rails form.
I want this table to be updated with newly updated values, without having to refresh the page.
For example, if user 1 sent the rails form and added a new value to the database, I want user 2 to see this update without having to refresh the page.
I would highly suggest watching the Polling for Changes - Railscast that covers exactly what you are looking for.
This essentially will cover how to use jQuery to poll the server to see if there are any changes, and apply them to the page without refreshing(ajax).

Resources