GithubHelp home page GithubHelp logo

Comments (2)

JonJagger avatar JonJagger commented on June 3, 2024

I have restored the CSS for .file_content and the new file now has correct size.
However, it is still resizeable, and it does not have line-numbers.
I think the relevant previous commits related to line-numbers are
a1301fe
Date: Tue May 22 10:15:21 2018 +0100
and in particular
2255220
Date: Tue May 22 12:05:30 2018 +0100

from web.

JonJagger avatar JonJagger commented on June 3, 2024

Fixed. The problem was naive code like this in app/views/kata/run_tests.js.erb
<% @new_files.each do |filename,content| %>
cd.newFileContent("<%= filename %>", "<%= content %>");
<% end %>

which was simply not expanding to legal js code when the content was multi-line.
At first I fixed using js_partial, eg

$("#visible-files-container").append("<%= js_partial('new_files') %>");

which uses js_partial() in app/helpers/application_helper.rb

def js_partial(partial)
escape_javascript(render :partial => partial)
end

But now it looks like this...
<% @new_files.each do |filename,content| %>
cd.newFileContent("<%= j raw(filename) %>", "<%= j raw(content) %>");
<% end %>

The raw() call is so that, for example, a " in a filename does not appear as "
The j call is an alias for escape_javascript

from web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.