[haml] Re: css not updated in Rails3 development environment

2010-06-03 Thread yannis_
Hi Nathan, I still got the following error when I start the rails console: /usr/local/lib/ruby/gems/1.8/gems/haml-3.0.6/lib/haml/util.rb:267:in `rails_root': ERROR: Rails.root is nil! (RuntimeError) My gemfile is looking either like gem rails, :git = git://github.com/rails/rails.git gem mysql,

[haml] ruby variables in sass

2010-06-03 Thread Eumir
is there a way to access ruby variables in sass or do i have to make a custom function for it? what im trying to do is to generate a stylesheet for each user so in the controller, i do something like: def show respond_to do |format| format.css{render :partial = styles} end end then in

Re: [haml] ruby variables in sass

2010-06-03 Thread Nathan Weizenbaum
You have to make a custom function. See http://sass-lang.com/docs/yardoc/file.FAQ.html#q-ruby-code for details. On Thu, Jun 3, 2010 at 1:56 AM, Eumir imacaterpil...@gmail.com wrote: is there a way to access ruby variables in sass or do i have to make a custom function for it? what im trying

[haml] Re: ruby variables in sass

2010-06-03 Thread Eumir
but how do you call the variable as argument for the function? On Jun 3, 5:19 pm, Nathan Weizenbaum nex...@gmail.com wrote: You have to make a custom function. Seehttp://sass-lang.com/docs/yardoc/file.FAQ.html#q-ruby-codefor details. On Thu, Jun 3, 2010 at 1:56 AM, Eumir

Re: [haml] Re: ruby variables in sass

2010-06-03 Thread Nathan Weizenbaum
I'm not sure I understand the question. On Thu, Jun 3, 2010 at 3:06 AM, Eumir imacaterpil...@gmail.com wrote: but how do you call the variable as argument for the function? On Jun 3, 5:19 pm, Nathan Weizenbaum nex...@gmail.com wrote: You have to make a custom function. Seehttp://

[haml] Re: ruby variables in sass

2010-06-03 Thread Eumir
Hmm so if i make a custom function like module Sass::Script::Functions def banner_url(company_id) Sass::Script::String.new(Company.find(company_id).settings.banner.url) end end how do i call it in sass since the input itself will also be a variable? :sass :background url

Re: [haml] ruby variables in sass

2010-06-03 Thread Yannis Jaquet
Would'nt be easier to dynamically set the class of this #header and change the background color of this header depending on this class? On 3 juin 2010, at 10:56, Eumir imacaterpil...@gmail.com wrote: is there a way to access ruby variables in sass or do i have to make a custom function for

[haml] Re: ruby variables in sass

2010-06-03 Thread Eumir
I don't think so since the url will be based on an uploaded file by a user. so would you mean to say that we make a sass file that includes all possible headers then just switch it in the view depending on the user? Something like #header-for-user1 :background url(etc) #header-for-user2

Re: [haml] Re: ruby variables in sass

2010-06-03 Thread Yannis Jaquet
Yes, exactly. Of course, this could be completely unmaintainable if you have a large number of users or if the style you need to set is quite complex. You should also think of simply settings your style inline: #header{:style = 'background-color: whatever'}. There's also many ways to

[haml] Re: ruby variables in sass

2010-06-03 Thread Eumir
Hmm maybe I'll try that inline style. i kinda thought about it but like you said, if the style wasn't just about the header then we're in trouble. Also, was the link deliberate? page titles? we already use that unless the link was wrong or there are other tips in the screencast besides page

Re: [haml] Re: ruby variables in sass

2010-06-03 Thread Yannis Jaquet
Yes, you can add stylesheets dynamically to your page via the following helper method: def stylesheet(*files) content_for(:head) { stylesheet_link_tag(*files)} end Best, Yannis On 3 juin 2010, at 15:43, Eumir wrote: Hmm maybe I'll try that inline style. i kinda thought about it but

Re: [haml] Re: ruby variables in sass

2010-06-03 Thread Chris Eppstein
You can pass data to your functions via the engine options that you pass to Engine.new when you compile your stylesheet. Like so: css_contents = Sass::Engine.new(contents_of_sass_file, :custom = {:company_id = current_user.company.id}, :style = :compressed).render Then in your function you can

[haml] HAML Case always outputs and error, code looks good, bug or errror? I dont see it please help

2010-06-03 Thread rubytastic
Below application.html.haml gives me From the Haml reference my code should appear to be correct except there was no else statement example in the haml reference so not shure about that part. I really dont see it anyone knows how to fix this? application.html.haml:35: syntax error, unexpected

Re: [haml] HAML Case always outputs and error, code looks good, bug or errror? I dont see it please help

2010-06-03 Thread Chris Eppstein
try: - case @controller.controller_name instead of =. On Thu, Jun 3, 2010 at 4:18 AM, rubytastic voorr...@gmail.com wrote: Below application.html.haml gives me From the Haml reference my code should appear to be correct except there was no else statement example in the haml reference so

[haml] Custom output style?

2010-06-03 Thread Rich
Is there a way to create a custom output style? I like the style of :nested with the exception of the close bracket. I find it much easier to read as following: #main { color: #fff; background-color: #000; } #main p { width: 10em; } Is there a way for me to

[haml] Re: ruby variables in sass

2010-06-03 Thread Eumir
Thanks for the help guys! I'll try to ask our other devs which is more feasible to them and if the css will have more complicated styles than the different header images. otherwise, I'll just stick to the inline style for the header. thanks again for all the suggestions! On Jun 3, 11:02 pm, Chris

[haml] Re: ruby variables in sass

2010-06-03 Thread Eumir
Sorry just a clarification: in HAML #header{:style = background-url: #...@company.settings.banner.url}} is not possible right? On Jun 3, 11:41 pm, Eumir imacaterpil...@gmail.com wrote: Thanks for the help guys! I'll try to ask our other devs which is more feasible to them and if the css will

[haml] Re: ruby variables in sass

2010-06-03 Thread Eumir
okay it looks like i can't do that but i did this: - @header_image = background-url: #...@company.settings.banner.url} #header{:style = @header_image} it now works as planned but just for cleanliness' sake, is there another way to refactor this? sorry if i ask too many questions :( On Jun 3,

Re: [haml] Custom output style?

2010-06-03 Thread Nathan Weizenbaum
Not at the moment. We'd like to add something like this in the future, but currently you're limited to the preexisting styles. You could monkeypatch the Sass source to change the :nested style, though. On Thu, Jun 3, 2010 at 8:27 AM, Rich rich.hamb...@gmail.com wrote: Is there a way to create

[haml] Re: Strange error with :javascript filter (For the last 5 hours :))

2010-06-03 Thread drKreso
In my enviroment I have require lib/string lib/string.rb is like this: #encoding: utf-8 class String def downcase self.tr 'QWERTZUIOPASDFGHJKLYXCVBNMŠĐŽČĆ', 'qwertzuiopasdfghjklyxcvbnmšđžčć' end end I need it to cast to lower case for special (Croatian characters). That

[haml] Re: Strange error with :javascript filter (For the last 5 hours :))

2010-06-03 Thread drKreso
I've got it figured out, there is Unicode gem. When I use it, it'a all good require 'unicode' #encoding: utf-8 class String def downcase Unicode::downcase(self) end end Thanks for help. Kresimir On Jun 4, 12:11 am, drKreso kresimir.boj...@gmail.com wrote: In my enviroment I have