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 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 Eppstein <ch...@eppsteins.net> wrote: > > > > > 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 access the user_id like so: > > > module Sass::Script::Functions > > def banner_url() > > > Sass::Script::String.new(Company.find(options[:custom][:company_id]).settin > > gs.banner.url) > > end > > end > > > But I think if you're css is not too complicated, then ERB+CSS is usually a > > simpler solution. > > > chris > > > On Thu, Jun 3, 2010 at 3:37 AM, Eumir <imacaterpil...@gmail.com> wrote: > > > 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 banner_url(@company_id) > > > > or will the params variable be available in the custom function? like > > > > module Sass::Script::Functions > > > def banner_url > > > > Sass::Script::String.new(Company.find(params[:id).settings.banner.url) > > > end > > > end > > > > then > > > > :sass > > > :background (banner_url) > > > > Is that the right way? > > > > On Jun 3, 6:22 pm, Nathan Weizenbaum <nex...@gmail.com> wrote: > > > > 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:// > > > > > sass-lang.com/docs/yardoc/file.FAQ.html#q-ruby-codefor 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 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 the view name _styles.haml i do this: > > > > > > > > :sass > > > > > > > #header > > > > > > > :background url(user.banner.url) > > > > > > > > is this possible at all? > > > > > > > > -- > > > > > > > You received this message because you are subscribed to the Google > > > > > Groups > > > > > > > "Haml" group. > > > > > > > To post to this group, send email to h...@googlegroups.com. > > > > > > > To unsubscribe from this group, send email to > > > > > > > haml+unsubscr...@googlegroups.com<haml%2bunsubscr...@googlegroups.com> > > > <haml%2bunsubscr...@googlegroups.com<haml%252bunsubscr...@googlegroups.com> > > > >< > > > > > haml%2bunsubscr...@googlegroups.com<haml%252bunsubscr...@googlegroups.com> > > > <haml%252bunsubscr...@googlegroups.com<haml%25252bunsubscr...@googlegroups. > > > com> > > > > > > >. > > > > > > > For more options, visit this group at > > > > > > >http://groups.google.com/group/haml?hl=en. > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > Groups > > > > > "Haml" group. > > > > > To post to this group, send email to h...@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > haml+unsubscr...@googlegroups.com<haml%2bunsubscr...@googlegroups.com>< > > > haml%2bunsubscr...@googlegroups.com<haml%252bunsubscr...@googlegroups.com> > > > >. > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/haml?hl=en. > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Haml" group. > > > To post to this group, send email to h...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > haml+unsubscr...@googlegroups.com <haml%2bunsubscr...@googlegroups.com>. > > > For more options, visit this group at > > >http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.