Templates and sub Templates aren't working in Nav - ruby-on-rails

So, I've got this app I'm working on. I've got a nav built and it sort of works. But not right. I'm pretty confident I'm screwing this up some where.
The nav looks like this. The problem is, that it never shows the current view highlighted in the nav (except for dashboard) unless i go directly to that page. But, if I do go directly to the page, none of the angular stuff works? The second problem is, under the Admin menu, I can't get any views to appear. But, if I refresh the page, then I can? That seems odd.
This is what my routes look like. What am I missing?
UPDATE:
Ok, so, if I start from dashboard, then navigate to other pages (such as admin/create or admin/manage) then it doesn't work (except for /properties) and I don't see the view update correctly (again, except for /properties). However, if I start in /properties, refresh the page, I see the content (minus any of the angular stuff), but I can navigate to admin/create and admin/manage. Again, Angular doesn't work, but I can at least navigate and see the rails partials.
UPDATE 2:
So, I figured out my own first mistake. I needed to add the routes into the angular side as well as the rails side. Now, I just need to figure out why highlighting isn't working?

Move the partials to it's own foler:
example: app/views/shared/_partial_name.html.erb
right now, you have the partials under the layout folder. And my guess is that is causing the rendering problem.
Keep application.html.erb as the only file under the layouts
then render the partials as shared/partial_name

Related

Modal window don't work times to times in any browser

I create application on ruby on rails and add modal window for login. I put modal code in partial layouts/header. I expect it must work on every page of my app but not. Modal don't open in home/index. It's start work on home/about. I don't understand why. I'll update my ask If needs code. Can anyone help me understand?
I try to move modal code on another pages but get same effect.
home/index and home/about is URI?
Make sure you use the same layout (header file) and the modal element exist in HTML of home/index (you can use dev tool - f12 for checking)
Please, Does the modal need to be triggered by a button or something?

Rails Layout: Make is so it doesn't reload the whole page everytime

I currently have a layout setup where it <%yeild%>'s the part that changes. However, I have noticed that it reload and fetches the rest of the page css, html & js that never changes while the same layout is in use.
I would like to know if there is a simple and efficient way to make it so that if the user is changing page through the tabs I have setup to navigate it only fetches the part of the page that changes. Not the navbar, the main js, etc.
Please let me know if I wasn't clear enough.
Thank you very much.

Masonry JQuery with Rails for Transistions - Need to refresh page for it to work

I am using masonry rails gem in order to have my posts nicely transition depending on the screen size and stuff but for some reason I always need to refresh the page in order for masonry to start working. Whenever I first visit a page it has all the posts in one column on the left hand side of the screen, then when I refresh the page is displays the posts properly using the masonry transitions. Has any one experienced this before or possible know a solution to resolve this?
Thanks in advanced!
UPDATE: looking into the console as I thought maybe some css ids or classes weren't being applied on the first load but they all are. I also had disable cache checked so I thought that could have been causing it but after unchecking it the problem persists.
I would greatly appreciate any input on what may be causing this.
UPDATE2: I have tried deleted the masonry code to see if its the masonry causing this to occur or previous styling. It appears to be the styling as the page loads with everything in one column on the left when the masonry is disabled. I am not sure why this happening.
I was able to figure it out. I was not including
*= require 'masonry/basic'
in my application.css.scss
After applying this and fixing all the post divs to be the same size masonry is working as it should an no longer are the columns all being pushed to one side. Hooraahh!!

twitter bootstrap modal does not work in rails3 layout?

I have a twitter bootstrap modal dialog. I used the example here:
http://twitter.github.com/bootstrap/javascript.html#modals
and this works well by its self. Works well if I add this to a rails view like index.html.erb of one of my views. Though if I add the same stuff that works to my layout (specifically my navigation one) so that this modal can come down on ANY view in the app, while it works, it never "fades in" it is always behind a darkened screen. I am pulling my hair out trying to figure out why this is. I can literally take the modal div, slap it into the view and it works fine, if its in that layout though. No dice. I am not sure what I am missing or if this is just a bug in twitter boot strap modals or what? Anyone else have this issue? Am I missing something to add to the class of the modal?

Render 2 views at the same time?

I'm kinda new to rails so forgive if this is a stupid question.
The scenario is:
I got my events controller with a index view that shows all events on the page. Now, what i want to achieve is: User clicks on one of the events, lightbox comes up showing all info about about that one event, with all the other events still behind the dark background of the lightbox. User closes the light box and process repeats. Pinterest is a good example of what i'm trying to do.
At the moment, i got these 2 views working properly. User clicks on the event and is taken to the show action.
So i'm wondering if what i'm trying to do is RESTfully achievable(without too much hacking around) in rails(3.2.8) and if so, would appreciate some insight as to where i should start from.
Thanks a lot.
As far as I understand what you want to achieve, it has nothing to do with actually rendering 2 views at the same time. What you're describing is simply making an ajax call with lightbox that opens up an URL that renders another view in the shown DIV or IFRAME (whatever lightbox uses)...
Depending on which version of Rails you use the implementation of this looks a bit different. But actually what you have to do is simply include LightBox2 in your Rails app, by simply adding the appropriate JS and CSS files and then supply the necessary class at your link_to calls...
Hope it's clear what I mean.
UPDATE
See this link for further info.

Resources