haml

Sinatra custom SASS directory

£可爱£侵袭症+ 提交于 2019-12-11 10:54:34
问题 I have problem getting my sass work with my haml template. Recently i have following code in my main sinatra.rb application: require 'sinatra' require 'dm-core' require 'dm-migrations' require 'haml' require 'sass' require 'shotgun' set :views, :sass => 'views/css', :haml => 'template', :default => 'views' helpers do def find_template(views, name, engine, &block) _, folder = views.detect { |k,v| engine == Tilt[k] } folder ||= views[:default] super(folder, name, engine, &block) end end get '

The Haml form tag includes nothing on Rails 3

霸气de小男生 提交于 2019-12-11 10:39:32
问题 I think there may be a bug in Haml? Or something I missed The form tag supposed to enclose the input element, but it doesn't. <form accept-charset="UTF-8" action="/remote_focus/kill_running_task" data-remote="true" method="get"></form> <tr> <td>... Where I expect it is <form accept-charset="UTF-8" action="/remote_focus/kill_running_task" data-remote="true" method="get"> <tr> <td>... </form> This is my haml file, iterate each task from an array, - @running_tasks.each do |running_task| = form

NameError in using custom layout option in sinatra app

烈酒焚心 提交于 2019-12-11 08:19:52
问题 To use custom layout file in my app I'm using this following code, set :views, File.dirname(__FILE__) + "/../views" set :public_folder, File.dirname(__FILE__) + "/../public" get '/' do if !Db.empty? then haml :home, {:layout => :nosetup-layout} elsif request.ip == "127.0.0.1" then haml :setup, {:layout => :nosetup-layout} else haml :nosetup, {:layout => :nosetup-layout} end end there seems to be a problem with the layout option I get the following error undefined local variable or method

Background images do not render on Ruby on Rails application

白昼怎懂夜的黑 提交于 2019-12-11 08:09:09
问题 I am attempting to have a image render in the background of a div with the class head . My application view is written Haml and the body is defined as follows: %body .container .head .sixteen_columns .top-nav Included in my application stylesheet is: .head { background-image: url(/images/background_image.jpg); width: 100%; height: auto; } I have tried a number of variations to specify the path of the image and altered the image name several times but to no avail. What is the issue? 回答1:

Rails 3 ajax response is not executed

我的未来我决定 提交于 2019-12-11 07:52:19
问题 I am creating a simple ajax feature into my application where a user can increase a "like count" through a link. I have managed to get the link to run my controller code and the browser is getting a response back, but the response is not executed. The like link is in partial: .likes .like_up = link_to( image_tag('/images/thumb_up.png'), '/like/' + question.id.to_s, :remote => true) #like_count = 22# question.likecount .like_down = link_to( image_tag('/images/thumb_down.png'), '/dislike/' +

rails 3.2 haml email template link_to error

社会主义新天地 提交于 2019-12-11 07:36:49
问题 I have an application (rails 3.2) with haml (3.1.4) emails. In the email template I wanted to use link_to, but apparently none of those 4 is working in production: #{link_to(my_models_url)} = link_to(my_models_url) / @url set to my_models_url #{link_to(@url)} = link_to(@url) On development mode everything works fine, but in production, I keep getting the following error: No route matches {} actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:503:in `raise_routing_error' It works when

running load_class on mthaml

别等时光非礼了梦想. 提交于 2019-12-11 06:32:31
问题 I'm trying to use load_class to load mthaml as I understood it's necessary for performance reasons. This is the MtHaml library. https://github.com/arnaud-lb/MtHaml It's namespaced everywhere so getting it working with load_class natively hits the first hurdle. Then it gets instantiated through Autoloader.php which does namespace MtHaml; class Autoloader { static public function register() { spl_autoload_register(array(new self, 'autoload')); } static public function autoload($class) { if

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

jQuery UI Tabs: Mismatching fragment identifier

前提是你 提交于 2019-12-11 05:31:02
问题 I'm trying to create an appointment scheduler using jQuery (UI), Haml, and Rails. I'm making a set of tabs for the next 4 weeks. #schedule %ul - @schedule.each_index do |i| %li %a{:href => "#schedule-#{i}"} #{@schedule[i][:week_range]} - @schedule.each_index do |i| %div{:id => "#schedule-#{i}"} %p test Ideally, this would create a set of tabs such as (December 27th-January Nth) as the tab title and then have "test" in each box. In applications.js I have: $('#schedule').tabs(); However, this

What's the rails way to do buttons as simple links?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 05:26:52
问题 I have a button (in a haml view) that I want to use to go to another controller/action. I am more accustomed to PHP than rails. What I have tried works but does not feel like the rails way. Here are my 3 ways. Can anyone offer suggestions? I'd particularly like to see the way the button with a javascript onclick handler would be done. %p =link_to "Edit", edit_user_registration_path(@user) %button.btn.btn-success.doEdit{:onclick => "window.location='#{edit_user_registration_path(@user)}'"}