slim-lang

Kaminari generates string instead of html

若如初见. 提交于 2019-12-10 10:54:15
问题 There was question like this in november, but no anwers was given. Kaminari generates string instead of html in production And no feedback from author, lack of reputation does not give me the opportunity to ask question there, also my problem a little bit different too. I'm using Rails 4.2.4, Kaminari 0.16.3 and slim as my template language. The pagination navigation is generated correctly, but = paginate @articles generates ALMOST a string instead of html. So it's escape tags and show them

How do I close the container <div> in a loop?

爱⌒轻易说出口 提交于 2019-12-10 10:08:42
问题 I have a list of products and I want to show an ad in the product feed. I want something like: <div id="container"> <div id="product">Bla..</div> <div id="product">Bla..</div> <div id="product">Bla..</div> </div> <div id="add"> Adsense Stuff </div> <div id="container"> <div id="product">Bla..</div> <div id="product">Bla..</div> <div id="product">Bla..</div> <div id="product">Bla..</div> <div id="product">Bla..</div> </div> In ERB, I would have: <div id="container"> <% productes.each_with

refile simple_form undefined method attachment_field

北战南征 提交于 2019-12-07 08:49:02
问题 I am trying to hook up refile to my view and I am getting the following error: Here are my models: class Job < ActiveRecord::Base acts_as_paranoid acts_as_taggable acts_as_taggable_on :languages belongs_to :company belongs_to :category validates :title, :location, :category, :language_list, :short_description, :description, :application_process, presence: true end class Company < ActiveRecord::Base acts_as_paranoid has_many :jobs attachment :company_logo, type: :image validates :name, :url,

Apply <strong> tags to a string in my js.coffee file

落爺英雄遲暮 提交于 2019-12-06 13:53:49
问题 I am currently using Angular and Slim in my Ruby On Rails Project. I have an array of questions in my js.coffee that are currently being rendered in my view. One of the strings in the array has strong tags, but it is not being displayed properly in my html. Instead of getting Standard , I get this... On which Playfield is the <strong>Standard</strong> game played ? I am fairly new to angular, what am I missing? JAVASCRIPT game_create_ctrl.js.coffee angular.module('OombangularApp').controller

How do I close the container <div> in a loop?

别说谁变了你拦得住时间么 提交于 2019-12-05 19:35:50
I have a list of products and I want to show an ad in the product feed. I want something like: <div id="container"> <div id="product">Bla..</div> <div id="product">Bla..</div> <div id="product">Bla..</div> </div> <div id="add"> Adsense Stuff </div> <div id="container"> <div id="product">Bla..</div> <div id="product">Bla..</div> <div id="product">Bla..</div> <div id="product">Bla..</div> <div id="product">Bla..</div> </div> In ERB, I would have: <div id="container"> <% productes.each_with_index do |product,index| %> <div id="product"><%= product %></div> <% if index == 2 %> </div> <div id="add"

Apply <strong> tags to a string in my js.coffee file

空扰寡人 提交于 2019-12-04 19:40:40
I am currently using Angular and Slim in my Ruby On Rails Project. I have an array of questions in my js.coffee that are currently being rendered in my view. One of the strings in the array has strong tags, but it is not being displayed properly in my html. Instead of getting Standard , I get this... On which Playfield is the <strong>Standard</strong> game played ? I am fairly new to angular, what am I missing? JAVASCRIPT game_create_ctrl.js.coffee angular.module('OombangularApp').controller 'GameCreateCtrl', [ '$scope', '$sce', '$uibModal', 'Game', 'GameFormat', 'PlayfieldType', 'Persona', (

Convert html.slim views to html.erb - Rails, Slim, ERB

混江龙づ霸主 提交于 2019-12-04 13:14:15
问题 Trying to convert *.html.slim views to *.html.erb . I've looked at these two questions: How can I convert html.slim to html.erb? - getting uninitialized constant when called from the console How can I convert html.slim files to html or html.erb? - parser hits a NoMethodError: undefined method image_tag for nil:NilClass when it comes across the first = image_tag . I am not using any variables inside my call, the image tag points to and svg I think the latter solution would work best, if the

How to install and use Slim template engine with Middleman

好久不见. 提交于 2019-12-04 12:47:02
问题 I'm new to Middleman and ruby in general. I've installed Ruby I've installed Middleman and the gems to get it running. I need to use slim instead of the default template system. So I installed the Slim gem. Slim's website only says that I need to require 'slim' in order to get it to work. The middleman website says I only need add the template engine to the config.rb file, but it gives no examples... For someone with no ruby background, this is no help. I looked for several config.rb on git

Slim template engine syntax for [if lt IE 9

一个人想着一个人 提交于 2019-12-04 04:12:16
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]--> It should use /! /![if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif] Looking through the documentation github-slim-template/slim I found: IE conditional comment /[...] /[if IE] p Get a better browser. renders as <!--[if IE]><p>Get a better browser.</p><![endif]--> In your case you could write: /[if lt IE 9] script src=

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

瘦欲@ 提交于 2019-12-04 03:03:06
li = link_to 'Account', '#account', data: { toggle: 'tab' } I need span tags around 'Account'. li = link_to content_tag(:span, 'Account'), '#account', data: { toggle: 'tab' } http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-tag 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" li = link_to "<span>Account</span>".html_safe, '#account', data: { toggle: 'tab' } 来源: https://stackoverflow.com/questions/15987566/how-do-i-wrap-span-tags-in-a