search for: textcont

Displaying 6 results from an estimated 6 matches for "textcont".

Did you mean: textconv
2006 Mar 19
2
Multiple polymorphic belongs_to declarations
I have the following models: class Card < ActiveRecord::Base belongs_to :deck belongs_to :front, :polymorphic => true belongs_to :back, :polymorphic => true end class TextContent < ActiveRecord::Base has_one :card, :as => :front has_one :card, :as => :back end The conflicting has_one declarations don''t work. What I need is a way to name the belongs_to associations ''front'' and ''back'', but have them go...
2008 May 19
6
obtaining table cell text data
I''m writing some code to subset a table based on the contents of particular columns. My event handler starts off like this: subsetChange: function(e) { var subset = $F(''subsetSelector''); var rows = $$(''.content-row''); rows.each(function(row) { var value = row.down(''.Platform_Category'').childNodes[0].data;
2007 Oct 18
4
Polymorphic Association?
...e relationships between a series of models for a page creation function. What I''d like is to have a Content Page which consists of a series of Content Blocks. The Content Blocks act as a list relative to the Content Page. And each Content Block can be assigned one of 3 types of content: TextContent, ImageContent, or FileContent. So my current thinking is this: ContentPage has_many :content_blocks, :order => :position ContentBlock belongs_to :content_page acts_as_list :scope => content_page_id has_one :text_content has_one :image_content has_one :file_content TextConte...
2006 Mar 17
10
good javascript xml parser
Anyone know of a javascript function that will take an xml document and turn it into an associative array? Basically it would take something like this: <body> <item> <id>1</id> <name>Bob</name> </item> <item> <id>2</id> <name>John</name> </item> </body> And turn it into something like this: {
2006 Mar 17
6
Updated the xml code to be more object-oriented
...{ hash[node.localName] = this._nodeAsText(node); } else { var key = node.tagName; if (hash[key]) { hash[key].push(this._nodeToHash(node)); } else { hash[key] = [ this._nodeToHash(node) ]; } } }, _nodeAsText: function (node) { return node.textContent || node.innerText || node.text || ''''; } } ); Usage: var doc = new XMLDoc(request.responseXML.documentElement); var hash = doc.asHash(); So, this xml: <document> <item id="1" type="blah" /> <item> <id>2</id> <type>...
2006 Mar 23
4
XML parser fixed
...subNodeToHash: function (hash, node) { var key = node.tagName; if (hash[key]) { hash[key].push(this._nodeToHash(node)); } else { hash[key] = [ this._nodeToHash(node) ]; } }, _nodeAsText: function (node) { return node.textContent || node.innerText || node.text || node.childNodes[0].nodeValue || ''''; } } ); /* --------------------------------------- */ /* How To use it */ /* --------------------------------------- */ <*cript> function showBlog(xml) { $(''outputField'')....