Where to store static / "index" page content in database in Rails - html

I've been using Rails for a few weeks now and have loved using it to make a fully-baked application. Now, I'm trying to use it for an agency site where we have services, articles and projects (which fit models and controllers nicely)
I've created the usual new/edit form views for these and it works perfectly (even have Redactor JS set up nicely with it)
The bit where it all feels a bit awkward is trying to allow for editing on the "index" pages - ie: the Services page itself would not only list each service but would have a few different bits of text and buttons that ideally I'd like to be able to content manage. Ditto for some content on contact pages and the like.
I've looked at using ActiveAdmin (which looks like a great tool, but ideally I'd like to keep it less serious and edit these pages in the front-end, this looks a perfect tool for managing large amounts of data)
Am just wondering how experienced devs would go about this? Would you have a model/controller for every page so that you could have routes like services/edit, home/edit, or perhaps there is some other way? Or maybe I'm just trying to get Rails to do something it's not really made for?
Thanks.

This probably comes down to
who's going to edit these semi-static pages?
how often?
If you're the only one doing it, no more than once a month, then just set up static pages with appropriate controllers.
If a bunch of people are doing it, on a fairly frequent basis, then go with ActiveAdmin, or a CMS gem, or etc.
Don't let 'elegant' get in the way of 'just do it'.

Related

Right way to embed HTML Pages to angular app

I am building my own website with Angular2 coupled with Spring boot and postgres as Backend.
The login/logout features are built to perfection but I have trouble understanding how to develop a site like geeksforgeeks where there are multiple links in a page and each page hosts different kind of content.
The idea is large scale and I intend to have lot of pages(topics) as I develop further.
My question is :
1)Should I be creating as many HTML Pages
2)Or What is the standard way of doing it.
I just want to know the right direction, have been scratching my head for quite some time with unsatisfactory solutions.
You should not create as many HTML pages.
Plan to make a category of your type or section of posts
Define templates for each category (e.g. Review something, generic blog post, some solution, etc)
Get the post json from backend along with section or type
Bind it to preferred template to your view

It's fast to build and update a static site or a dynamic site?

Good day, everyone!
I'm currently building 2 sites: one of them is my 'personal website' that will contain contact information, current and finished projects. (Like a presentation card, you know what I'm talking about!).
The other one it's a site regarding a tool that I'm currently developing: I want to make 3-4 section with classic things about a software: what it is, what it does, news about developments, a FAQ section and a download page.
Now, the problem is: I don't want to waste time with such 'silly' website. I want make it fast and update it easily.
I've got 2 ways in my mind:
1) Create a dynamic site (php) that will 'build' pages from a database that contains all things like finished projects, news feed and so on. I have to create the backend for content insertion, but once i've done it I can insert new content in few seconds.
2) Build a site based on static pages (classic html) filled MANUALLY with new content (like the weekly news feed); isn't much 'professional', it's much more fast to grow up but can be difficult to insert new content (Every time I want to make a news I have to write the title in an html tag, bold content with tag and so on) and move manually the old news to another page. Maybe exist external tool to help me doing that?
I always thought that static webpage aren't used even for site that 'allows' new content being updated often (once a week) but I found that isn't completely true: LOT of site that I like (medium popularity software sites) it's just a bunch of text on a static page.
I guess that isn't a smart thing waste time build a nice site for a poor developed software, isn't it?
Also, isn't kind of newbie build a site with such an old way?
What tool can I use for fast 'formatting' html news text?
Any suggestion for creating these website with fewest time spent?
When I develop websites, I use a basic template: a "toolbar" or "navbar" at the top of the page and an iframe tag that contains the content and pages browsed. You can learn how Joomla! and Wordpress platforms work and see the idea behind it: a group of files build an html file from data stored inside XML files (either in physical disk or in a database). Those files and classes build and render those pages until you get what you see in a static (sometimes dynamic with JavaScript/jQuery) page/file. Open-Source is a great thing - the human kind must use it wisely.
I will also recommend using JSON or some other database to get the needed code and append it to the body. I use XMLHttpRequest() to get code inside json, i then parse it get the html string and append it to the body of my website. It works well for me.‎ ‎ ‎ ‎ ‎

How do i code a scrolling window to stay at a certain link per page

On this page, I want to get my scrolling dinosaur name window to specifically keep that dinosaurs name at the top so the person doesn't have to scroll all the way down to the next dinosaur.
I also want to know if there's an easier way to do this window.
My predicament is this....
I have over 30 dinosaurs on here. Each time I add a new one I have to update each and every one of the dinosaurs pages to add that one new dinosaur. Its not really time effective... Is there a better way without having to use frames?
My code is open so you can look at it and modify it at your leasure.
Thanks!
Vince
At this point I would suggest you go for server side code. Since you have 30 dinosaurs, it would be much easier to create and maintain a simple page using server side scripts such as PHP or ASP.NET to load the dinosaur from a database.
What are server side scripts?
Server side scripts allow you to dynamically generate a page on the fly whenever the user requests a page. For example, take youtube's search page. Rather than generate a seperate page for every single possible search term, they simply have a base template there, and then they fetch the relevant results based on the search query. The same can be applied to your site. You can have one page for all the dinosaurs, and you would just load the appropriate dinosaur based on the url.
Once you do that, putting the current dinosaur at the top of the page would be a trivial task. Since it appears that you already have a fair amount of knowledge in HTML, it should be easy for you to pick up and use some PHP. Codecademy has some excellent tutorials.
Along the same lines as Kevins answer but more specifically I'd like to recommend you look into a PHP MVC framework such as CakePHP, Laravel or CodeIgniter.
You've done all the hard work manually building these pages, which is awfully time consuming.
Once you learn one of these frameworks and you'll rebuild this site in a day.
If your links had id attributes on them you could scroll the list to a position by linking to #whatever. Here's a quick code example of a link.
<li id="camarasaurus">Camarasaurus</li>
Here's a small example: http://jsbin.com/ExExEvAB/1/edit?html,css,output
As for making it easier to administrate, I'd look into PHP since it's widely available and there's tons of resources to learn from. When you're basically looking for is <?php include "dinosaur-menu.html" ?> since you're thinking in terms of frames. You can make it even easier but this alone should make it a ton easier to update.
I really started to enjoy Mixture recently. It's great for prototyping and is, in my opinion, perfect for exactly what you're trying to do here.

How to build a navbar that scales with site growth

I have a navbar, and in it right now I have links to various blogs on my site. I have that same markup throughout my site on all pages.
Here is the thing, when I start growing my site, how do I scale something like this? Right now, I have been going to each and every html page, and doing a copy/paste anytime I need a new link to it or something similar.
I'm sure there is a better way to do this.
so a s per the comment's above there is a slew of ways to go about doing this. One possibility, would be to keep each link as a varchar as well as possibly a title that you want to display for each blog post that would be displayed in the nav bar. then you could build your nav bar dynamicaly each time using a scripting language such as php, python, perl, nodejs etc. Im not sure if node.js will be supported by godaddy but undoubtedly the other would be. The approach you take will be a personal choice based on if you control when user upload content (like an administrator) or if uploads can happen freely. if you plan for uploads to happen freely you will most likely want a dynamic approach, However if You plan to have an administrator to oversee each new entry a static approach could be used and called to regenerate the nav. bar each time a new post is made available. Again, if you need some help getting this started you know where to find me!
-best of luck

Generating a static website from a set of content data (possibly with webgen, webby or a similar toolkit)

My company (an engineering firm) is looking to redesign their website with some dynamic content. We have a nice portfolio of projects that we'd like to present on our site by category.
To elaborate, I'd like to have a "Projects Category" menu, where you can choose a sub-project category (such as churches, schools, etc) which links to a page with images of all projects which have been tagged with that category attribute. Clicking on an image would then take you to a detailed page for that project.
I have done a good bit of asp and jsp page development, but I've always worked on the front end in an enterprise environment - I've never built a production site from the back end. The advice I've gotten so far is that a full-blown CMS solution would be somewhat overkill, as we won't have a large hit count, and we'll be displaying a few hundred projects at most.
One big-picture choice I appear to have - whether to dynamically generate the pages (with asp or jsp) or to use a tool to generate a set of static html pages. The tool would build the menus, project summary pages, and individual project pages based on a set of data I could provide (in the form of a database or text file.)
I'm leaning towards trying to use a tool like webgen or webby to statically generate the site due to our current web hosting situation. Any thoughts on which approach is more appropriate? Is webgen or webby capable of doing what I am trying to do? Or can anyone recommend other web authoring tools better equipped to accomplish this?
Thanks for any feedback!
You could always use Template Toolkit :)
Jekyll may be worth a look.
Refer: https://github.com/jekyll/jekyll/wiki/
I've been told that webgen can't do what I'm trying to do (without some manual coding extensions myself) but that nanoc can.
http://nanoc.stoneship.org/