how to get rails angular app to render jade templates? - ruby-on-rails

I'm trying to render jade templates from app/assets/javascripts/templates and I can't seem to get things to work. am getting chrome console errors,
GET http://localhost:3000/templates/lunch.jst.jade 404 (Not Found)
what direction should I be going with this ? Thanks !
source repository on github
https://github.com/jcdavison/lookingtolunch/
application.js
//= require jquery
//= require jquery_ujs
//= require angular
//= require angular-route
//= require_tree ./app
//= require_tree ./templates
app.js.coffee
Lunch = angular.module('lunch', ['ngRoute'])
Lunch.config([ '$routeProvider', ($routeProvider) ->
# $routeProvider.when("/", { templateUrl: "../templates/test.jst", controller: "LunchCtrl" } )
$routeProvider.when("/", { templateUrl: "../templates/lunch.jst.jade", controller: "LunchCtrl" } )
# $routeProvider.when("/", { templateUrl: "test.jst", controller: "LunchCtrl" } )
# $routeProvider.otherwise( { templateUrl: "test.html", controller: "LunchCtrl" })
])
app/assets/javascripts/templates/lunch.jst.jade
h1 some text goes here
config/initializers/jader.rb -used for jade preprocessing following configuration instructions from https://github.com/zohararad/jader
Jader.configure do |config|
config.views_path = Rails.root.join('app','assets','javascripts','templates')
end
Gemfile
source 'https://rubygems.org'
ruby "2.1.0"
gem 'rails', '4.0.1'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
gem "haml", "~> 4.0.4"
gem "angularjs-rails", "~> 1.2.7"
gem "zeus", "~> 0.13.3"
gem "pg", "~> 0.17.1"
gem "pry-debugger", "~> 0.2.2"
gem "devise"
gem "omniauth"
gem "omniauth-twitter"
gem "uuidtools"
gem "quiet_assets", "~> 1.0.2"
gem "thin", "~> 1.6.1"
gem "jader", "~> 0.0.8"
gem "ngmin-rails", "~> 0.4.0"
group :test do
gem "rspec-rails", "~> 2.14.1"
gem 'factory_girl_rails', '4.2.1'
end
group :doc do
gem 'sdoc', require: false
end
and of course, some screenshots...

Related

Rails 4.2.4 in production mode in coffeescript could not catch page load event, turbolinks disabled, how to do it in Production?

in development-environment - work 1,3,4,5 cases
in Production-environment - no one !
how can i get it on production ?
settings of my project below :
coffeescript
$ ->
alert('->')
$(document).on "page:change", ->
alert('page:change')
jQuery ->
alert('jQuery ->')
$(document).on 'ready page:load', ->
alert('ready page:load')
$(document).on 'ready', ->
alert('ready')
gems
source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jbuilder', '~> 2.0'
gem 'paperclip', '~> 4.3.0'
gem 'uikit-sass-rails'
gem 'normalize-rails'
group :production do
gem 'rails_12factor'
end
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
application.js
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require uikit
//= require_tree .
Try using this command mostly your assets are not yet compiled on production environment
rake assets:precompile RAILS_ENV = production

Sprockets::FileNotFound couldn't find file 'jquery-fileupload/basic'

I am attempting to upload multiple pictures with jquery file upload. In my application.js file I added //= require jquery-fileupload/basic and in my Gemfile I added jquery-fileupload-rails under the assets group. This causes the error: couldn't find file jquery-fileupload/basic. I have reset my rails server and checked for spaces in application.js however the error stays. Any help would be greatly appreciated
application.js
//= require jquery
//= require jquery_ujs
//= require jquery-fileupload/basic
//= require jquery.ui.datepicker
//= require jquery.ui.tooltip
//= require jquery-ui-1.10.4.custom.min
//= require jquery.timepicker.min
//= require bootstrap/dropdown
//= require bootstrap/modal
//= require raty
//= require_tree .
gemfile
gem 'byebug', '~> 3.5.1'
gem 'rails', '4.0.3'
gem 'pg'
gem 'bootstrap-sass', '~> 3.1.1'
gem 'devise'
gem 'faker'
gem 'geocoder'
gem 'carrierwave'
gem 'mini_magick'
gem 'figaro'
gem 'state_machine'
gem 'jquery-ui-rails', '~> 4.2.1'
gem 'rails_12factor'
gem 'elasticsearch-model'
gem 'simple_form'
gem 'omniauth-facebook'
gem 'omniauth-linkedin'
gem 'omniauth'
gem 'pry-rails'
group :development, :test do
gem 'rspec-rails', '2.13.1'
gem 'quiet_assets'
# gem 'pry-debugger'
gem 'meta_request'
gem 'interactive_editor'
gem 'hirb'
gem 'quiet_assets'
gem 'awesome_print'
end
#
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
gem 'factory_girl_rails', '4.2.1'
end
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
group :assets do
gem 'jquery-ui-rails', '~> 4.2.1'
gem 'jquery-fileupload-rails'
end
put it outside the assets group and run bundle install.
btw jquery-ui-rails does not belong there either

Rails wrapbootstrap template less parse error

I have purchased a wrapbootstrap template and now I have problem to apply it to my project in Ruby on Rails. All js and css files I insert into /vendor/assets and in /app/assets/stylesheets/appplication.css I've inserted this line
*= require_tree ../../../vendor/assets/stylesheets/.
The same I've done in /app/assets/javascript/application.js
*= require_tree ../../../vendor/assets/javascripts/.
My Gemfile is
gem 'rails', '4.1.0'
gem 'mysql2'
gem 'table_print'
gem 'devise'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails'
gem 'jquery-ui-rails'
gem 'less-rails-bootstrap', '~> 3.2.0'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
Finally I'm getting a
Less::ParseError in Home#index
variable #enable-navbar-dropdowns is undefined
(in /home/james/Desktop/SP2/frontend_v2/vendor/assets/stylesheets/less/ace-nav.less)
http://i.imgur.com/8q8oh25.png
Thank you for any help
This is my worked application.css
*= require ace/bootstrap/bootstrap
*= require ace/ace
*= require_self
* Note that I removed require tree .

Foundation 5 - Rails 4 css topbar not working

I am having an issue with foundation 5, rails 4.1.0, as per screenshot, links are underlined, search box is off.
I have created a separate dummy rails app with the same spec and don't see the same issue
I've tried without turbolinks, and different topbar configurations.
any ideas where to troubleshoot this?
Screenshot:
http://postimg.org/image/ohtwc60rj/
application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require foundation
//= require_tree .
$(function() {
$(document).foundation();
});
`
application.css.scss
*= require_tree .
*= require_self
*/
gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
gem 'foundation-rails'
gem 'rails_12factor'
gem 'activeadmin', github: 'gregbell/active_admin'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :development do
#gem 'sqlite3'
gem 'rspec-rails'
gem 'guard-rspec'
gem 'slop'
gem 'guard-livereload', require: false
gem 'jazz_hands'
end
gem 'pg', '0.17.1'
group :test do
gem 'rspec-rails'
gem 'capybara'
gem 'rb-fsevent', :require => false
gem 'growl'
gem 'guard-spork', :github => 'guard/guard-spork'
gem 'spork', :github => 'sporkrb/spork'
end
#Server monitoring
gem 'newrelic_rpm'
Found that active admin was conflicting. commented out active_admin.css.scss resolved the issue. That put me in the right direction
Fix from Foundation when using active admin http://foundation.zurb.com/forum/posts/1359-foundation-5-impacted-by-active-admin-on-rails-4

neo4j-will_paginate gem causing rails not to start

I'm trying to implement pagination in my Rails app with the neo4j-will_paginate gem (I'm using neo4j as my database.) I followed the instructions at https://github.com/dnagir/neo4j-will_paginate#readme viz. added neo4j-will_paginate to my gemfile and required 'neo4j-will_paginate' in my config/application.rb file. I ran bundle install and tried to fire up Rails, but I got this error:
NameError: uninitialized constant Neo4j::Traversal
const_missing at org/jruby/RubyModule.java:2642
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/neo4j-will_paginate-0.1.0/lib/neo4j-will_paginate.rb:43
require at org/jruby/RubyKernel.java:1042
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/neo4j-will_paginate-0.1.0/lib/neo4j-will_paginate.rb:12
require at org/jruby/RubyKernel.java:1042
(root) at /Users/--------/Documents/code/ThreeRing/threering/config/application.rb:53
tap at org/jruby/RubyKernel.java:1787
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/railties-3.2.3/lib/rails/commands.rb:50
require at org/jruby/RubyKernel.java:1042
(root) at script/rails:6
Here's my Gemfile and the relevent part of my config/application.rb
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
require "neo4j"
# require "will_paginate/railtie"
require 'neo4j-will_paginate'
Here's the gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.3'
gem 'neo4j', '~> 2.0.0'
gem 'jruby-openssl', '~> 0.7.7'
gem 'json', '~> 1.7.3'
gem 'jquery-rails', ' ~> 2.0.2'
gem 'haml-rails', '~> 0.3.4'
gem 'bcrypt-ruby', '~> 3.0.1', :require => 'bcrypt'
# gem 'will_paginate', ' ~> 3.0.3'
gem 'neo4j-will_paginate'
gem 'carrierwave', '~> 0.6.2'
gem 'fog', '~> 1.3.1'
gem 'mini_magick', '~> 3.4'
gem 'trinidad', '~> 1.3.5', :require => nil
gem 'nokogiri'
gem 'libxml-jruby'
gem 'sanitize'
group :development do
gem 'rspec-rails', '~> 2.10.0'
gem 'guard-rspec', '~> 1.0.0'
end
group :test do
gem 'factory_girl_rails', '~> 3.3.0'
gem 'spork', ' ~> 1.0rc'
gem 'rb-fsevent', '~> 0.9.1'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.0'
gem 'therubyrhino', '~> 1.73.4'
gem 'uglifier', '>= 1.0.3'
end
Googling the error turns up no help, and I haven't seen any similar problems whose solutions are applicable here. Any ideas of what's going wrong here? Thanks!
It is because version < 0.1.2 of neo4j-will-paginate does not work together with neo4j.rb version 2+
Try version 0.1.2 which was released today.

Resources