RefineryCMS - Page Templates of Page-Parts possible? - ruby-on-rails

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.

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

Removing price information and 'Add to Cart' from spree website

I am building an e-commerce site using spree. I am new to Ruby/RoR and Spree, though not to programming and web development.
I am still carrying out research on logistics, pricing, which products to actually stock up on etc., so I simply want to display product information, and not the price and/or ability to purchase.
I have searched extensively online (to no avail), on how to do the following things I ave listed below:
I want to know how (perhaps, this requires code modification):
NOT show the price of products ANYWHERE on the site (including the product page)
On the product page, NOT show the 'Add to Cart' button
On the product page, SHOW a form that allows the user to register to the site, so that they can be contacted when the product becomes available
I am not looking for detailed steps, simply guidelines that I can follow to make the appropriate changes to the configuration (or code - if required), in order to meet these requirements.
You're going to need to override the view templates.
Try running bundle show spree or bundle open spree if you have an editor setup for bundle, this way you'll know which file you need to change. Its likely going to be somewhere here or in one of the partials, look around.
Then you can override it with deface, see Spree Docs here
If you want override the whole file, then just create the file in your app, for example, if you wanted to override spree/frontend/app/views/spree/products/show.html.erb from the gem.
You'd create the same file with your custom code in it, make sure to follow the same path and naming.

Ember search engine

I am creating an Ember app that has a search engine built into it say for houses. My results change a lot as houses are found / added or removed / sold. Therefore my search results change all the time.
I also have pages for each house which has a similar houses section on it that shows always changing similar houses to this one.
I am trying to find the best way to make this app crawlable to search engines.
I could like discourse use noscript tages for each page but as all my houses pages can hold different information and structure depending on the agent/ seller this would be a lot more work basically duplicating what the client is doing!
I could go down the phantomjs route and cache all my pages and serve via the escapedfragment_ method but i am thinking this would be a resource intensive approach with content changing so much. Also with my house pages having similar houses on them that can change depending on the user / location etc, i am not sure how to cache these sections.
Another method i am toying with is to convert my page / section templates into a serverside template so i can render it on the server. For example when a customer creates a house page via my ember app in the format they require they click publish and i convert the rendered html into serverside template with placeholders etc for data.
Anyone help with this ? Any ideas / suggestions / advice would be great!
I think you've kind of answered your own question. This is all about trade offs and finding the solution that is best for your particular case. There is no silver bullet. Personally I go with something close to the noscript route, but instead of putting things inside noscript tags, I put them in regular divs with a class of no-ember, which are visible by default. Then when the document is ready I test to see if the client supports push state. If so, I initialize my Ember app and hide the no-ember divs. If not, then all of the no-ember divs are visible so that the client can see/use the content like normal.

customizing the record details page (show page?)

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.

How to grab a record ID from a search form in rails

I'm very verrry new to rails.
I'm using the autocomplete (plugin) text field to browse through titles of my records. When the user selects the record, I'd like to forward them to a custom built URL, based on that record's ID.
How should I do this?
Thanks!
-Elliot
To be more specific. I'm trying to make a simple search form, that redirects right to the record filled in by the autocomplete. If the record does not exist, I'd either like a message saying it doesn't yet exist, or a create record page.
UPDATE:
This may be more helpful, how can I just grab the value currently in the text box?
The auto-complete plugin you are using may not be the best for you to use. Here is another option for you to consider:
Model Auto Completer
This plugin returns the text, but also stores the id in a hidden field.
There was another plugin I thought that did this as well, I can't remember it now though.
I think what you are referring to is directing to a page like "/record/my_awesome_product" rather than the boring "/record/1234".
Although this article is a little outdated (in Rails development terms) it still may help you.

Resources