slim-lang

How do I get my dummy app to use the Engine's template engine?

爱⌒轻易说出口 提交于 2019-12-23 12:57:50
问题 I have a Rails Engine I'm working on and the gemspec has this: s.add_development_dependency "rspec-rails" s.add_development_dependency "combustion" s.add_development_dependency "capybara" s.add_development_dependency "factory_girl_rails" s.add_development_dependency "ffaker" s.add_development_dependency "draper" s.add_runtime_dependency "sqlite3" s.add_runtime_dependency "slim-rails" s.add_runtime_dependency "sass-rails" s.add_runtime_dependency "jquery-rails" s.add_runtime_dependency "rails"

Slim template engine syntax for [if lt IE 9

非 Y 不嫁゛ 提交于 2019-12-21 11:26:12
问题 I use slim as view template engine http://slim-lang.com/ How would you write the following piece of code with slim? thanks <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> 回答1: It should use /! /![if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif] 回答2: Looking through the documentation github-slim-template/slim I found: IE conditional comment /[...] /[if IE] p Get a better browser. renders as

How do I wrap span tags in a link_to in slim?

落爺英雄遲暮 提交于 2019-12-21 09:22:11
问题 li = link_to 'Account', '#account', data: { toggle: 'tab' } I need span tags around 'Account'. 回答1: li = link_to content_tag(:span, 'Account'), '#account', data: { toggle: 'tab' } http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-tag 回答2: You can also use a block if you find that you have more complex code inside the link text than just a span tag: li = link_to '#account', data: {toggle: 'tab'} do span = "Account" 回答3: li = link_to "<span>Account</span>".html_safe,

How do I wrap span tags in a link_to in slim?

孤街浪徒 提交于 2019-12-21 09:20:06
问题 li = link_to 'Account', '#account', data: { toggle: 'tab' } I need span tags around 'Account'. 回答1: li = link_to content_tag(:span, 'Account'), '#account', data: { toggle: 'tab' } http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-tag 回答2: You can also use a block if you find that you have more complex code inside the link text than just a span tag: li = link_to '#account', data: {toggle: 'tab'} do span = "Account" 回答3: li = link_to "<span>Account</span>".html_safe,

How to access instance variables in CoffeeScript engine inside a Slim template

匆匆过客 提交于 2019-12-17 08:23:10
问题 I have a Rails controller in which I am setting a instance variable - @user_name = "Some Username" In my .slim template I am using coffee engine to generate javascript and want to print out the user name from client-sie javascript code - coffee: $(document).ready -> name = "#{@user_name}" alert name But this is the javascript that is being generated?? $(document).ready(function() { var name; name = "" + this.my_name; alert(name); } How do I access controller instance variables in my

how to install slim tm bundle in sublime2

孤街浪徒 提交于 2019-12-12 08:25:12
问题 I would like to install the slim textmate bundle to sublime2. I went to this link slim textmate bundle I cloned it to the pristinepackage(as per the nettuts website) but nothing happened.. What am I missing?. 回答1: While it's tempting to install by copying directories, you should really use the Sublime Package Manager. Install instructions are super easy - just copy and paste. After installing you can: browse other packages install packages within Sublime update packages easily One small

Trying to Use 'Angular Rails Templates' gem

天大地大妈咪最大 提交于 2019-12-12 02:47:15
问题 so, I'm trying to use the templates folder in AngularJS instead of the 'views' folders that you'd normally use in Rails. Things work great when I write everything in html, but what if I want to write things in slim, and still work with AngularJS templates, instead of rails Views? The answer: angular rails templates Unfortunately... it doesn't quite work. It adds this at the beginning of my page before it successfully renders the rest from slim into html: Angular Rails Template // source: app

Adding a css class to select in Rails

人走茶凉 提交于 2019-12-12 02:18:26
问题 I've been trying to make the following class applies on the select/dropdown, but I couldn't! = f.select attr, [1,2,3], class: 'form-control', include_blank: true I tried to read the rails code, here and here. it's like it is not implemented ? but it works for text fields: = f.search_field attr, options.merge(class: 'form-control') I'm using slim and simple_form 回答1: select takes 2 hash options, first for 'select options' and another for 'html'. Try following: = f.select(attr, [1,2,3], {

Use SLIM/HAML etc. in a Ruby script?

▼魔方 西西 提交于 2019-12-11 05:59:57
问题 I am currently making a script that analyses some genetic data and then produce the output on a coloured Word document. The script works, however, one method in the script is badly written, the method that creates the Word document. The method creating the document creates a standalone HTML file, which is then saved with a 'docx' extension, which allows me to give different parts of the document different styles. Below is the bare minimum to get this to work. It includes some sample input

Rails3.1 engine: can't get SLIM or HAML to work in test/dummy app

老子叫甜甜 提交于 2019-12-11 03:28:44
问题 I'm developing a Rails 3.1 engine, and to integration test it I want to use SLIM instead of plain ol' ERB. So I tried to simply add s.add_development_dependency "slim" to my .gemspec file, but when renaming my index.html.erb file to index.html.slim , Rails complains: Missing template dummy/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder]}. Searched in: * "/Users/josh/Documents/Work/Sientia/iq_menu/full/spec/dummy/app/views" * "/Users/josh/Documents