richpeck / exception_handler

Ruby on Rails Custom Error Pages
507 stars 72 forks source link

You guys just ruined my whole project #27

Closed BatuhanW closed 8 years ago

BatuhanW commented 8 years ago

I just wanted to update error page view so I rendered them. All my theme settings css files overwriten. Almost nothing is working.

How can i somehow ROLLBACK your actions. You have no idea how bad its for me.

richpeck commented 8 years ago

The settings CSS files won't be overwritten - the CSS files are placed into assets/stylesheets/exception_handler - your settings.css file should be intact.

If you can give me a link to your project, I'll take a look and tell you what the problem is. If your settings.css is overwritten, it's likely that it's conflicting with some of our classes. Either way, I can't do anything without seeing your code

BatuhanW commented 8 years ago

https://github.com/MrWilhelm/esnafin-com-app

Hello there is my project. There are some weird changes in my template, I can't figure out why.

Like my right panel went to the down left.

richpeck commented 8 years ago

Thank you, let me take a look

richpeck commented 8 years ago

untitled-1asdfasdf

I have just tested this locally and have absolutely no problem with the gem.

The only issue I had were references to different paths in the layout files, which have to be prepended with main_app -> main_app.root_path etc.

If you can post a screenshot of your issue, maybe I can help you better. Ultimately, the one thing I did find was a MASS of assets loaded each time. This suggests a hapharzard directory structure in the backend, which is likely the cause of your issue.

If you show me a screenshot, I'll take another look.

R

BatuhanW commented 8 years ago

It must be related to me so. I close Issue.

What should I do with assets ? Is there anything I can do to do better ?

richpeck commented 8 years ago

The assets & files seem to be individualized and you're loading many unnecessary asset dependencies (EG bootstrap languages which you don't need).

I found a lot of partials, especially in the "layout" directories, which, although technically fine, should probably be extracted into helper methods. Having said this, many of the partials seem to be legitimate.

The best thing to do is keep your files to a bare minimum. Always think about if you come back to the application in 12 months, would you be proud of the structure? If not, you should work to make it much DRYer.

A good example of this is the inherited_resources gem (which is no longer maintained). This used to create the standard CRUD methods, so that your controller actions could have a single set of views. We use similar functionality to this to achieve DRY / Modular views in our current app fleet.

Thanks for using exception_handler - do you have any other questions?

BatuhanW commented 8 years ago

Thanks for information, I'm new to rails and this is my first project, with the help of you community I think I will be better.

BatuhanW commented 8 years ago

Should I make one big asset file ?

richpeck commented 8 years ago

Nope, you can still have the assets you need -- the only thing you should do is only load the assets you need to use, when you need them

I think most of the issue is bootstrap -- it looked like you were loading every bootstrap component to me, even though you weren't using them.

A tip you can use right now:

You've explicitly included dependent asset libraries in /app/assets -- most notably stylesheets/font-awesome.min.css & stylesheets/bootstrap.min.css

These files should be present within their respective gems -- you don't need to include them yourself. The beauty of dependencies / libraries is they can be maintained by third parties & imported into your app at a base level... basically meaning you don't have to include them yourself.

If you removed files like this, you'd clean up your system a lot more - allowing it to run much smoother.

BatuhanW commented 8 years ago

I just removed them(bootstrap.min, font-awesome.min) from directory, and my whole styling went off. What am I missing ?

richpeck commented 8 years ago

You need to import the file in your application.css file - you've done it with application.css.scss but I think it's missing from application.css

polaski commented 8 years ago

There IS a problem with how you handle stylesheets. I just ran into this problem. I believe many people just use the default assets structure (which contains the line *= require_tree .) which means everything under assets/stylesheet gets included when compiling to deploy... say to heroku. Your generator automatically adds the error stylesheet under assets/stylesheet, which means it's included when compiling to final result. In this scenario you override all existing styles for any page just by including this library.

I'm not a newbie but I still use the default structure rails gives me, and was at a loss for a while when I saw your stylesheet effectively took over my entire app.

richpeck commented 8 years ago

Hi @polaski thank you for bringing this to our attention.

Okay I see the problem -> https://github.com/richpeck/exception_handler/blob/master/app/assets/stylesheets/exception_handler/error.css.erb#L23

In the next update, I'll fix it. I should be able to add a class to the error layout so we can distinguish between the error layout styling & normal styling.

In regards your references, just to clarify - including our stylesheet will not override the other elements. CSS will be overridden depending on the classes you include.

Our stylesheet is overriding your styling is because we added styling for html / body tags, which - when included alongside the other stylesheets - will seem like it's overriding them.

I'll fix this in a new update, or if you want to PR I'll definitely look into it