Tuesday, February 14, 2012

jQuery Frustration and Layouts

Check existing rvm, ruby, rails config:
$ rails -v
Rails 3.0.11
$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.8.0]
$ rvm list

rvm rubies

=* ruby-1.8.7-p302 [ i686 ]
   ruby-1.9.2-p180 [ x86_64 ]

# => - current
# =* - current && default
#  * - default




Removed the following line from application.html.erb
<%= javascript_include_tag "bj_folio", "jquery", "jquery.scrollTo", "jquery.isotope.min", "jquery.localscroll"  %>

(left this include tag for application)
<%= javascript_include_tag "application" %>

And added these lines to application .js
//= require jquery
//= require jquery_ujs
//= require bj_folio
//= require jquery.scrollTo
//= require jquery.localscroll
//= require jquery.isotope.min
//= require jquery.infinitescroll.min
//= require fake-element
//= require fancybox
//= require custom
//= require_tree .

Useful reference for layouts and rendering


Ok, so the application.js lines with //=require jquery, etc are not doing anything.  When I look at the page source, all I see are the scripts referenced in application.html.erb.  So I removed all those requires from the application.js and put back the line in application.html.erb that lists all the js files I think I need.

I also because the application.html.erb file has the line:
<%= stylesheet_link_tag :all %>

I can remove the contents of the _stylesheets.html.erb file.

Page source indicates it finds all the css files in public/stylesheets.

Ok, so no more GET errors when I'm trying to load the homepage.  However, not seeing ANY of the images or js stuff.

*****

Trying to cleanup the home.html.erb file.  Left comments in the file for what I did.
Saw the h5 text in mainmenu go white.  Removed the style-dark.css file and works ok.  Looks like that file's not used anyway (see style.css has that commented out) and conflicts with the style-minimal.css.

****
Looking more into jquery and rails 3, I added the following line into the application.rb file (inside the application class).
config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

jquery github page for reference.


No comments:

Post a Comment