search for: element_id

Displaying 18 results from an estimated 18 matches for "element_id".

2006 Jun 19
10
Trying to delete from a unordered list using ajax
I have a controller method as such: def delete @category = Category.find_by_name(params[:name]) @element_id = @category.name Category.delete_all(["name = ?", @category.name]) end (For the purpose of this exercise, category names are unique) I have the corresponding delete.rjs file: if @element_id page.remove :id => @element_id page.visual_effect :highlight, ''categories'&...
2006 Jun 24
6
Ajax fade effect
I have a list of categories, when I delete one of them, I want that item to fade and then get removed. So I do the following: 1. home_controller: def delete @category = Category.find_by_name(params[:name]) @element_id = @category.name Category.delete_all(["name = ?", @category.name]) end 2. delete.rjs: if @element_id page.visual_effect :fade, @element_id page.delay(5.seconds) do page.remove @element_id end end 3. index.rhtml: <%= f...
2007 Nov 14
1
has_many_polymorphs and acts_as_list ?
...2 belongs_to :page 3 end 1 class Belonging < ActiveRecord::Base 2 belongs_to :collector, 3 :class_name => "Collection", 4 :foreign_key => "collector_id" 5 belongs_to :element, :polymorphic => true 6 acts_as_list :scope => ''element_id=#{element_id} and element_type=#{quote_value element_type}'' 7 end The belongings database table structure: collector_id (integer) ; element_id (integer) ; element_type (string) ; position (integer) The self referential polymorphic aspect works like a charm! But the acts_as_list doesn&...
2006 Apr 07
2
Re: Re: page.replace_html "#{var_containing_id_name}", :partial
> you mean like this? > > def do_some_ajax_thing > <at> element_id = "content_div" > end > > do_some_ajax_thing.rjs > > page.replace_html <at> element_id, :partial => "edit" > > remember, the view templates have access to the attributes defined > in the controller Actually, its more like this: I have a list p...
2006 Jan 25
2
Using ''GET''-method in Forms
Hi all, I''m using a selection-list / dropdown-list to choose an element in a number of grouped elements. Is there a way of passing an element_id to the form AND using the HTTP-''get''-method? I found that the <% start_tag %> has a :method-switch as an option, but it passes the arguments on like "/controller/action/?action=1". I would need something like "/controller/action/1" Can you help? -- Timo...
2005 Oct 14
6
Draggables onDragStart
Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 1027 bytes Desc: image001.gif Url : http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20051014/b3c26edf/attachment.gif
2006 May 20
7
Polymorphic, many-to-many, self-referential data model
...Containers and Element. Here''s some code: create_table :containers do |t| t.column :name, :string end create_table :chunks do |t| t.column :name, :string end create_table :ownerships do |t| t.column :name, :string t.column :container_id, :integer t.column :element_id, :integer t.column :element_type, :string end Then in the models: class Chunk < ActiveRecord::Base has_many :ownerships, :as => :element end class Ownership < ActiveRecord::Base belongs_to :element, :polymorphic => true # belongs_to :container end class C...
2006 Apr 05
1
New AJAX function: remote_replace_with_partial() <-- write less code
...string end application.rb file: def partial_handler string = render_to_string :partial => params[:partial] render :inline => string end javascript code: (this can be placed in a JS file or in your template) <%= javascript_tag "function update_page_element(element_id, controller ,partial_file, params) { new Ajax.Updater(element_id, ''/'' + controller + ''/partial_handler? partial='' + partial_file + params, {asynchronous:true, evalScripts:true}); return false; } " %> View code: <%= remote_replace_with_partial(...
2006 Mar 24
1
Multiple table relationships
...ve the following table structure. I understand how to do a two table has many join but I actually need to relate a third table. Here is my structure: components id name updated_at elements id name updated_at element_types id name updated_at components_elements component_id element_id element_type_id updated_at My Component model has the following: class Component < ActiveRecord::Base has_and_belongs_to_many :elements end I haven''t actually added anything to my Element model but suspect that it also needs a habtm association. My bigger issue is, how to I ass...
2010 Jan 20
0
putting labels back on a matrix.
...where I strip the Site_ID value from the input data. library(vegan) library(reshape) csv_base <- read.csv("c:/temp/cvs_export.csv", header=T, as.is=T) csv_basef <- subset(csv_base, Site_Id >= 1) testm <- melt(csv_basef, id = 1:4, measure = 5) test <- cast(testm, Site_Id ~ Element_Id, sum) dim(test) names(test) csv.data <- test[,c(-1)] csv.m <- as.matrix(csv.data,) dimnames(csv.m) <- list(test$site_id, names(csv.data)) csv.dis <- vegdist(csv.m, "jaccard",binary="TRUE",diag="FALSE", upper="TRUE") x <- as.matrix(csv.dis,) tri...
2006 Apr 07
2
Re: page.replace_html "#{var_containing_id_name}", :partial
Jeff Coleman <progressions@...> writes: > > Jason Tuttle wrote: > > The subject line says it all. -- Is there a way to do something like: > > > > page.replace_html "#{var_containing_id_name}", :partial => ''edit'' > > > > That line of code does not work, but I would like to pass the name of > > a variable to
2006 Sep 29
3
no setClassName or removeAllClassNames in prototype - why?
Often I have the need to set one class name to an element. I don''t care what was there before, just remove it and set it to the new class. I don''t see any easy way to remove all the class names or to set just one class name. Why is this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on
2009 Oct 23
2
validates_uniqueness_of across multiple rows?
Ok, that''s not the best subject line, but I couldn''t think of a concise way to describe what I''m trying to do. I''ve got two models. Grouping simply contains an id and a few other attributes (e.g. rating). A grouping can contain many elements which are stored the Element model. A set of elements is tied together by a grouping_id. An element can be one of
2006 Apr 16
2
AJAX effect when inserting new div
Can some one point me in the right direction? I''ve got several pages that will respond to user input by creating a new div in the content area. I want that new div to visually expand into view or flash with a background color rather than just appear. Thanks. -- Posted via http://www.ruby-forum.com/.
2006 Apr 14
11
Whats the best Ajax way to update a textarea''s text?
I am looking for a way to update the text-value within a textarea from an Ajax render call inside of a controller. Is there a way to do this without rendering an the partial containing the textarea? Thanks, Andy -- Posted via http://www.ruby-forum.com/.
2006 Aug 07
5
RJS Change Background Color
What''s the page.method to change the background color of a DOM element? I''m trying to change the background color of a couple of styled <li>''s when an Ajax link is clicked. Thanks, David -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060807/63de04bf/attachment.html
2006 Jan 16
11
Preventing bubble
I''m trying to prevent double ajax requests when I have nested onclick handlers. I have a table with clickable column headings (for sorting by that column). I have onclick handlers on both the <th> and the <a> link so that clicking anywhere on the table heading should work. <th onclick="window.location.href=''http://foo?sort=foo'';">
2006 Jan 23
16
Adding form fields (extending a form) on the fly
Hello, I just can''t seem to find a way to extend a form dynamically in ROR. Say I am writing a recipe website. There is one form to enter the recipe. There is room for N number of ingredients (let''s say a text field for each ingredient name and selection list for the amount). What if the user wants to add more than N ingredients as he types them in? how do I do this without