I have a skin support in my app. I'm looking for a tool, which will enable the customer (not the programmer, which is current) alter the skins.
Is there an admin tool (gem, plugin) for Rails to manage (edit, create, view) these skins? I looking for some easy solution like /admin/skins page where I could do all the stuff, otherwise I'm going to write my own one.
In case there's no such tool - is there any best practice example (possible from other language/framework)? What kind of approach is used in other languages/frameworks?
Any kind of help is appreciated.
Is the theme_support gem a possible solution?
This actually depends on what you want styled. I'm not sure if there are any plugins out there that I haven't heard of yet, but personally I'd just do my own skin styler if I was in your shoes.
My idea is either give your users the ability to customize their page entirely ala myspace in which case you just have to create a semantically robust HTML then make a css uploader that will use their css files for the design.
Or you could limit your users to what you want styled so you can still maintain the basic layout of your site. Just give them access to coloring their fonts, resizing or coloring their backgrounds. No floats or whatsoever. In this case, you have to create something that will take a color/font-size as an input and change that depending on what the user picked.
Related
I've been thinking of writing my own backend, because I feel active_admin might not support all the requirements.
I wanted to ask if Active_Admin supports any of these just to be sure:
I have a has_and_belongs_to_many relationship between my ad model
and tag model. In the new ad page I would like to have the form for
the ads, as well as all available tags so the admin can choose which
tags to associate with the ad. I was able to do that normally in my
application, but can I do that with active_admin?
Can I add custom buttons.. Like one to convert to PDF for example,
or one to send an e-mail..
Could I add some sort of before_filter, so the admin can only view a
model, but not edit or delete it for example?
Thank you.
All of those things can be done via Active Admin, but as it was pointed out, it can be quite a nightmare actually implementing certain things depending on the amount of flexibility you need it to have. For that exact reason, I decided to start rolling my own administration panels.
I have tried an implemented almost all robust gems for admin panels. I have also sweated over several hand-made ones.
Active-Admin is very usability centred, but it is not configuration centred.
As you rightly aniticipated, some of the more complex modifications can be tedious.
In my experience, rails_admin is the best middle ground I could find.
Take a look at it, it is highly functional, completely modular (made as a Rails 3 Engine) and simpler to modify.
If you can live without some details when customizing this is definitely the way to go. However, if you need to have everything just right, then there is not substitute for hand-made.
So I want to play with the active_admin gem. Two basic pieces I need is pages and images. I could setup a system myself, but is there any gems or anything out there that make setting this up easy? Ideally the pages would have ability to have custom slugs, nested pages, custom fields etc. And maybe ability to add images to the pages.
Yes yes maybe I should just go with a system like refinery. But I'm curious if there something lighter out there for what I need.
My suggestion: if you want the "lightweight" way, just go to implement your own CMS.
In my experience, for rails application, rebuilt is much easier and faster than refactoring/reuse, if your requirement is kinda of complex.
Maybe you should have a look at active_cms, which is still in active development, but already useful for basic functionality. You can find it here: https://github.com/geisters/active_cms
I'm currently building a web app (atop Ruby on Rails), which will let users style their own areas (personal blog pages), and was wondering what are the best ways of accomplishing this?
I think Liquid for templating would be good, but how would you handle styling? My aim was to have a DB field associated with each blog dubbed "style" which will store a custom stylesheet, is this the best approach?
I've tried it so far with the "sanitize_css" helper method, but it just strips the "#stylebox" tags out, meaning nothing is displayed.
Any ideas?
Thanks.
Currently I'm also working on almost a similar requirement as you do. I'm also trying to create a CMS for users to add pages, style them etc..
My Approach as follows
each user will have his/her subdomain. (I use a before_filter to get the current users subdomain and load his/her website)
About styling, I prefer to have the style sheet as a physical file. Given that your method will have the more flexibility of editing the style sheet, I dont like the idea of having the stlesheet code on top of my page. Insted, I allow users to load their styleshets (Using paper clip)
So when the site loads I will get the css paths from the DB and load the stylesheet from the path.
Later I'm planning to read the file and load it to a textarea so that users can edit their stylesheets and when saving override the existing file;
For layouts i use liquid as well
cheers
sameera
I would honestly allow themable elements on your page, and then store each of those style rules as a field (or conglomerate them into one giant field) in the database. Enforce some validation to ensure that they don't use any funny business (if they're only coding for specific div's, they shouldn't need to use any curly braces.)
Then generate the CSS on the fly.
The reason? If you ever want to serve up ad's on your site, and you allow them to just upload the entirety of their CSS, they can easily turn off visibility on the ad div.
I think it's "safer" to control what they're allowed to theme; sure more advanced users will get ticked. But do you really want to be the next MySpace? ;-)
if there is too much of code then serialize the data and store it as text in db.
That would be much better i think
If your going to allow areas for users to have complete control over their CSS, then I would probably avoid the database altogether and use a structured file system approach. You could create a sub-domain or folder for each user that contains a main.css. This also allows you to scale well as features grow for your user (pictures, etc.)
With that said, as Robbie mentioned, you might want to consider limiting what styles a user can and can not control. Otherwise, you would probably find things getting out of hand quickly. For this approach, you would probably want to use the database for storing property values of the elements that can be modified.
on the last projects i've started, I wondered if I should use the admin generator or not. My usual choice is to not use it, as some developers suggested to me, "unless it's for quick backend prototyping and submission to client", they said. Currently i'm starting a project and i'm in the situation that the client need the backend very fast to start loading lots of data, and i'm doubting about using the admin generator or not. I would use it if needed simple form fields. But one of my models must have multiple images, and maybe I need a more complex view that allow the client to load N images, so the admin generator maybe it's not the best choice, but it seems fast, it seems to save time and that's what I need now, time saving!
The project is very simple, it's just a Product model with multiple images and multiple sizes and belongs to a simple category.
What do you think? What would be the best option for this? And where do you think that makes sense to use the admin generator or the regular module generator?
Thanks in advance!
Regards.
I use the admin generator as much as possible. It is really designed to be great for the "backend" of your website-- the administrative screens which authors and editors will use to maintain the app. Any module that needs to be user-editable and is simple cries out for the admin generator.
Recently I have been starting everything with the admin generator so that there's a working prototype to build data with. Then I select certain modules or views that need more magic sauce, and build them out with more customization.
Remember, you can add views and forms to an admin generator module. On my last project I used the admin generator for the "edit" action of my main object but added "show" methods similar to a non-admin-generator form-- adding an executeShow() action and showSuccess template.
The other thing to keep in mind is that the admin generator is only a generator. It writes a bunch of code for you in cache/frontend/env/modules, but you can override any of it by building the equivalent code in apps/frontend/modules/. If you find one part of it that you can't configure with generator.yml, you can copy the file out of the cache into your module dir and hack away. I prefer to take the "out of the box" admin generator as far as possible before customizing it, though.
i've been working with symfony for quite some time now and i've been using the admin generator for simply and complex situations. It's true that it saves time when developing CRUD modules, but i dont think that is not advisable for complex cases.
I think you should use it and also learn the power of customization the generator gives you. If you have complex Forms, leave that for form classes to manage and as you said, if your forms a quite more complex to render, well you should only take care of the rendering of that only segment of the view.
But, if you decide to make if without it, you should start thinking about creating all the view from scrap, that in my case takes quite time ( i'm not so versatile wiht css).
But this is only my opinion, hope this helps you make a more rational choice!
I have a customer that wants to build their own questionnaires. Something like WuFoo (www.wufoo.com) but more secure and contained within the app.
I've looked at Smerf (http://github.com/springbok/smerf) which provides the yaml-to-form conversion, but I'd like something the user can use to create their own forms.
I would look at using active_scaffold. The main version has not been updated for Rails 3, but a fork at the location below has. I think it would work well for your purpose, you just need a way to grab the data and feed it in. Here is a demo of what it looks like when it is running:
https://github.com/vhochstein/active_scaffold
Here is a demo at the top of the page:
http://demo.activescaffold.com/roles
You could always embed Google Forms. Might be easier than reinventing the wheel. Unless you have some specific use case this doesn't cover?
If you are not adverse to going the Javascript route the then you might consider one of the many framework plugins like the JQuery Form Builder. From a usability perspective it seems to me that any good solution is going to involve some Javascript. There should be no reason why this approach wouldn't integrate well into a Rails backend
You might want to check out this one. Dynamic Forms
I too am looking for something very similar. What solution did you come up with?