Multiple Rails forks with separate designs and layouts - ruby-on-rails

I have a Rails project that is basically a simple web app for a membership-based organization. We've open sourced the code on Github for the web app so that others can use it, but have a licensed design/layout that the original organization is going to use. This layout cannot be open sourced. I was wondering if others have run into the situation where you have an open-source Rails app with a non-OS design.
My initial thought is to put app/views in .gitignore, and to have anyone forking the code add their own views directory, perhaps including an app/views_default directory with a web-app-theme layout or something else to get people running. Is this the best option (realizing that there are other files such as JavaScript, CSS, etc that come with the layout that must also be ignored).
Does anyone have some good thoughts or pointers on this?

Hoopla - svn:externals for Git.
Instead of git:ignore, you can push the non-open-source stuff somewhere else, and your open-source code on github. Use hoopla to manage the externals.
http://6brand.com/git-svn-externals-rails-plugins.html

Rails Theme_Support plugin: http://github.com/aussiegeek/theme_support (There are forks as well). You can create a theme directory with multiple themes, and load the theme programmatically in ApplicationController. This would allow anyone to use the application, and simply supply their own theme in the themes directory, and would allow the project to have a "default" theme which would serve as an example.

Related

Using CodeKit 2 with Wordpress/Bootstrap via Bower

This may be a really dumb question but I've been searching the interwebs and haven't really found much helpful information. I have CodeKit 2 and I want to use Wordpress and Bootstrap in a project. I've never used Bower before but it looks really cool and I thought I'd give it a shot with CodeKit. I installed Wordpress, JQuery, and Bootstrap through the assets tab in my project and they installed into bower_components. In the video from Bryan Jones showing off Bower, he says not to move anything out of that folder or CodeKit won't see it as an asset anymore.
So my question is: how do I go about building my project from here? Obviously I don't want to have to run from the bower_components folder to do everything. In the Bower docs it says the easiest way is to just statically link the components you want. But I don't really understand how that would work with Wordpress and it seems like there'd be a better way to do it with CodeKit.
Thanks for the help!
There is no need to use Bower to manage wordpress, since wordpress can update itself very easily.
I think the best approach to building a WP site with Codekit is described in this tutorial: Use CodeKit 2.0 for Local WordPress Development.
Basically:
setup wordpress locally, any way you like, and use MAMP or AMPPS to serve the site.
drag your theme folder into Codekit - the theme is the project.
In the Browser Refreshing section of your project settings, use the external server option. Paste in the local URL for your new WP site.
Here's an article with some details.
Basically you just need to install bootstrap.less and variables.less in your /less folder, and then point your #import commands to your /bower_components folder. While you technically are running things out of /bower_components, after it's set up, you'll never know the difference.
The most useful thing about having wordpress connected to Bower is that you can just get the files downloaded quickly without having to grab the latest zip.
It makes sense to move the wordpress files to the top level, or where ever you are used to putting them.

Integrating new designs into an old rails application

I was asked to integrate new designs into an old app, but the designs are completely different from what there is now. Due to the functionalities already there in the app, I had to integrate the design into it. Starting with the homepage, I replaced all the html.erb files but there is a bootstrap theme which is consistent in the background. I also have to integrate new js into the app. Can anyone please guide a newbie through this? Been at it since 2 days and I don't even know where I am going wrong. Working with rails 3.2.13. Any suggestions or advice for the same would be very much welcome too. Thanks in advance.
P.S. Any further information/details needed, will be provided on asking.
I don't know how proficient you are with Rails, but the bottom line is this:
Rails is an MVC framework, meaning all the interface stuff is
contained in the views part of the app
When you want to change the look of the homepage, all you need to do
is go into app/views/home_controller/index.html.erb and edit te
file. That will allow you to change the HTML; the CSS is simply about
replacing / changing the app/assets/stylesheets/application.css
files
If you're trying to integrate bootstrap, I would personally:
remove all the CSS (depending on how much changing you wish to do)
add the bootstrap CSS, apply fixes to the layout files (in app/views/layouts/application.html.erb)
begin to re-design the interface for each view using boot
This is obviously very generalised. Maybe you can post some code to give us an idea as to what you're struggling with directly?
Many thanks!

Include assets in engine from main application

I have created an admin interface as a Rails engine. In the project I work in at the moment I need to add some custom javascript. I want to keep this in my main app and not add it in my engine.
Perhaps register some javascript or stylesheet files in a config file and let the engine include them.
Any ideas on how I can achieve this?
you are asking about ideas, so here is one: just use a convention!
it's common to do this in rails, so why not just do it for your engine. just document how to name the files and what to configure for that (assets need to be configured differently when they should not be included in application.js/css). the admin interface typus does the same thing: http://docs.typuscmf.com/customization/custom_css_and_js.html
in your engine, you can just check if that file is present in the mounting app and include it in that case.
should be pretty straight forward.

Can an admin template be used in a Ruby on Rails web app?

I have been doing UI research and have come across admin templates at http://themeforest.net/. I was wondering how do you apply these onto a web app built on Rails. These templates look very similar to wordpress themes. Are they that easy to configure? Is it just as simple as setting up a link to the database to make the fields form capture data? I've been looking at this theme.
For admin templates I recommend using Active Admin. It's relatively easy to implement and gives you great admin screens with little effort.
Yes, You can. I'm trying to solve the same problem and so far I have a couple options:
1.) do it by hand, I've done this before, it works but takes a lot of time to truly understand how your theme is put together. First I would recommend using the included themes assets exactly as they are bundled with the theme. Don't assume that just because you have twitter-bootstrap-rails gem that the bootstrap classes in the theme will work. Link the assets statically and slowly extract out the static assets and replace them in the asset pipeline once you know they work.
2.) Use the strategy suggested in the install_theme gem (http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/) the gem itself is not maintained any longer (i'm not sure about any forks), but the strategy is sound. Extract the core parts of the template into partials.
The short answer is yes, but there is no straight forward way to "import to rails"

Theming a rails app via plugin or engine

What's the best way to go about this? I've tried a bunch of different things but can't quite get the hooks in right. Tons of googling and I can't get it.
I can get everything working right but I cannot seem to override the child apps views/layouts/application.html.erb ... I need to copy over all assets with the gem and have the plugin/engine/gem/whatever's application.html.erb pull from those assets. Help please?
Jquery-UI has a whole spiel on theming, which also allows it to be dynamic across several different themes. Check out http://jqueryui.com/themeroller/
Dont forget about Bootstrap from Twitter. You can just install these and mention the file_name in your layouts and you are good to go.
In fact, in most cases, you can also just copy them in your assets folders and you are ready to go.

Resources