search for: escape_javascript

Displaying 20 results from an estimated 45 matches for "escape_javascript".

2011 Jun 08
1
Problem with escape_javascript in 3.0.9rc1
Specifically, this does not work! $("#lightbox_content").html(''<%= escape_javascript(render(:partial => "form")) %>''); Is this the correct way to do JQuery html replacement using a partial? This works fine in 3.0.7. Tony -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this g...
2009 Sep 04
2
escape_javascript error
...ng jQuery for all ajax stuff and recently got following error: ActionView::TemplateError (private method `gsub'' called for #<Array: 0x2425ae8>) on line #1 of... and the code where it happens: $("#notice_ajax").before(''<div id="notice_ajax"><%= escape_javascript (flash.delete(:notice)) %></div>'').remove(); when I remove ''escape_javascript'' then everything works fine. It seems that ''gsub'' thinks that its argument (flash.delete(:notice)) is an array....?? Any suggestion?? Thanks, bogumbiker
2010 Dec 21
8
Rails - escape_javascript without all the \n\n\n\n\n
Hello, I''m using escape_javascript to return a partial to the browser via ajax. Something like: $("#inject").html("<%=escape_javascript(render :partial =>"feed/ index")%>"); Problem is escape_javascript ends up outputing all kinds of wasted space like \n\n\n\n\n \n I...
2011 Sep 10
4
Finding HTML attributes with jQuery in Rails 3.1
...b an HTML attribute and use the value of that attribute to load a partial. HTML fragment: <a href="/toggle" data-remote="true" section="training"> jQuery string (now setting a static partial, I need this to be dynamic) $("#services").html("<%= escape_javascript(render(:partial => "operations" )) %>").show() I want the value of "section" as that corresponds to the name of the partial. I''ve tried to look at this in Firebug, but I''m not able to set the proper breakpoint so I can see the context when the jQuer...
2006 May 19
1
how to access ActionView::Helpers::JavaScriptHelper::escape_javascript in a model (a newbie question)
Hi all, Please forgive me for this newbie question. But I really want to know how how to access ActionView::Helpers::JavaScriptHelper::escape_javascript method in a model. I can access this method in view, but when call it in the model, it ends up with undefined method. It seems to me they are in different scope. So what''s the best way to access view helper methods in model. -- Many thanks, Yi -------------- next part --------------...
2011 Jun 15
5
rails 3.0.9
Today was expected the new stable rails release 3.0.9 with some fixed, among all the problem with escape_javascript. It seems that it see that has not been released, unfortunately. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscri...
2012 Feb 29
4
how to use link_to with :remote=>true in rails 3.2.1
...v id="allclick"> <%= render :partial => ''goclick'' %> </div> -------------------------------------------- _goclick.html.erb <%= @clk %> -------------------------------------------- clickme.js.erb $("allclick").update("<%= escape_javascript(render(:partial => "goclick")) %>"); -------------------------------------------- On my web-page everything is fine when I click on click here link nothing change. But when I check Firebug console it shows me: $("allclick").update("you click me"); --------...
2010 Sep 27
9
Rails 3 - Creating a comment and then returning the Partial with JUST the new comment
...but it works... if @comment.save flash[:notice] = "Successfully created comment." respond_to do |format| format.js end end Ok and this is where I''m stuck, then the create.js.erb: $(".cmtBox").html("<%=escape_javascript(render :partial =>"comments/comment")%>"); And the partial: <div class="cmtBox" id="comment_<%=comment.id%>"> <%=comment.content%> </div> Where I''m stuck is calling the partial in create.js.erb... How do I pas...
2012 Feb 17
0
Passing a value to js.erb
...uot;, @video.id, { :id => "video-id" } %> then, I can retrieve it by var idval = $(''#video-id'').val(); It certainly gets the value. The problem is then I need to pass it to the following. I tried, $(''#listtrans'').html(''<%= escape_javascript(render :partial => "videos/script_list", :locals => { :scripts => Script.find_all_by_video_id( idval ) } ) %>''); //<= idval this does not work. $(''#listtrans'').html(''<%= escape_javascript(render :partial => "videos/script_l...
2006 Nov 04
0
stumped trying to escape javascript
...javascript function that I call from within my render method in my controller, to take the contents of the flash and display them in a div that appears and then disappears. I''m using the following: render :update do |page| page << ''ShowMessage("'' + escape_javascript(flash[:notice]) + ''");'' .... end however, it fails to work if the flash message contains single quote characters. I''ve now tried the following variations: # works with double quotes, fails with single quotes page << "ShowMessage(''&quo...
2011 Nov 29
1
ajax question
...;"Select one", :id=>:id},{:id=>"select_skill"}) %> <div id="skills_list"> </div> app/assets/javascripts/index.js $(document).ready(function() { $("#select_skill").change(function() { $("#skills_list").append("<%= escape_javascript(render :partial=>''skills_list'') %>"); }); }); _skills_list.html.erb <div id="skills_list"> <table> <tr> <th>Title</th> <th>Parent</th> </tr> <% @skills.each do |skill| %> <tr> &l...
2012 May 21
4
Rendering partial views with ajax calls in rails 3.1
...def show @host = Host.find(params[:id]) respond_to do |format| format.html #show.html format.js format.json { render :json => @host } end end And the respective template (show.js.erb): $(''#tabs-1'').html("<%= escape_javascript(render @host) %>"); And a partial file named _host.html.erb All this works fine. The template "_host.html.erb" is rendered in div tabs-1, but now i need to add some other partial template to a different id (#tabs-2), but use the same @host How can i do this? by default, render @...
2011 Sep 27
1
Rails 3.1 assets path for video player Flash script 'player.swf'
...#39;containerLocker'', ''width'': ''480'', ''height'': ''270'',''logo.hide'' : ''false'', ''logo.position'' : ''top-right'', ''file'': "<%= escape_javascript( first_valid_clip_url(@clips) ) -%>", ''type'' : ''video'', ''streching'' : ''uniform'' , ''smoothing'' : ''true'', ''controlbar.position'' : ''bottom'', ''...
2013 Oct 02
2
Rails 4 ujs button only works after second click
Here''s the code https://gist.github.com/dasibre/6786245 *new.js.erb file has the following js code* $(''a.pinbutton'').on(''click'', function() { $(this).parent().append(''<%= escape_javascript(render("select")) %>'') }); *here''s the player index with the new link* <%= link_to "Pin", {controller: "pinboard_players", action: "new", id: player}, remote: true, class: "pinbutton", id: "#{player.id}" %>...
2012 Aug 07
4
how to do render partial on jquery ajax success method with rails 3
...all. My juqery code is : jQuery.ajax({ url: "/org_pages", data: ''org_id=''+ org_id, type: "POST", success: function(result){ jQuery("#image_center").html("<%= escape_javascript(render(:partial => ''pages/top_link'')) %>"); }, error: function(){ alert(''Error occured''); } }); My problem is on the web page the output is showing this : <%= render :...
2013 Mar 06
2
Refresh a partial onClick using ajax call in rails 3.x
Hi All, I want to refresh a partial onClick, onClick i am making ajax call and getting the data but i am unable to refresh the partial. here is the code IN views: home.html.erb $(document).ready(function() { var currentCellText; $(".inline").click(function() { currentCellText = $(this).text(); $.ajax({ type: ''GET'', dataType: "json",
2007 Jan 23
7
Ajax
Hi, I need some help. I`m developing a data base administrator using ruby and ajax, both for the first time and I have a problem: I have a form where you can add or delete some information about a person., information related with their studies. There is no problem when I add, but when I delete, it deletes from the database but when I try to save it throughs me an error because it tries to find
2009 Mar 30
0
Trying to bind an appended partial that has REST_in_place attached to it with jquery?
...w I am creating a new model in the view. On creation I want to have the appended partial in the dom and selectable so I can click it''s name and run the plugin REST in place with Jquery. #create.js.erb $("#new_show").before(''<div id="flash_notice"><%= escape_javascript (flash.delete(:notice)) %></div>''); $("#shows").append("<%= escape_javascript(render(:partial => @show)) %>").effect("highlight", {}, 3000); $(".rest_in_place").livequery(''click'', function(){rest_in_place()}); $(&...
2009 Aug 23
0
Best way of moving some jQuery from a view helper
...:locals => { :faddress => faddress, :uid => ''NEW_RECORD'', :show_edit_form => true }) page << "jQuery(''#address_list'').prepend(''#{escape_javascript(html)}''.replace(/NEW_RECORD/g, new Date().getTime())).effect(''highlight'', {}, 300)" end end end [/code] So basically I want to move the line [code] "jQuery(''#address_list'').prepend(''#{escape_javascript(html)}''.re...
2009 Oct 19
1
Combobox population by means of JQuery and Ajax.
This is the view municipalities.js.erb I have: <% list_opt = options_from_collection_for_select(@municipalities, :id, :name) %> <% puts list_opt %> #ok! list_opt contains the options $(''#municipality_id'').html(''<%= list_opt %>''); and this is the combobox in the view: ... Comune <select id="event_municipality_id"