Skip to content

Instantly share code, notes, and snippets.

View bryansray's full-sized avatar

Bryan Ray bryansray

View GitHub Profile
GiftMessage = $.klass({
initialize: function(options) {
this.hoverClass = 'HoverItem';
},
onmouseover: function() {
this.element.addClass(this.hoverClass);
},
onmouseout: function() {
class MonitoredTopic
include DataMapper::Resource
property :id, Serial
belongs_to :user
belongs_to :topic
end
class Topic
class FeedItem
include DataMapper::Resource
property :id, Integer, :serial => true
property :feed_item_id, Integer
property :feed_item_type, String
property :created_at, DateTime
def initialize(feed_item)
self.feed_item_id = feed_item.id
self.feed_item_type = feed_item.class
[581][bryanray@bryan-osx: Desktop]$ irb
>> require 'rubygems'
=> false
>> require 'mollom'
NameError: uninitialized constant Mollom
from ./mollom.rb:4
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
from (irb):2
from :0
select_control(:text_method => :text, :value_method => :method, :collection => [ { :value => 'imperial', :name => 'Imperial' }, { :value => 'british', :name => 'British' }, { :value => 'metric', :name => 'Metric' }], :selected => @user.unit_preference)
it "should render the first and then last values in an array if no text method is specified and collection is an array of arrays" do
form_for @obj do
content = select_control( :foo, :collection => [[0, 'FakeModel']] )
content.should match_tag( :option, :value => "0")
end
end
checkbox_control :is_searchable, :label => "Allow other #{SITE_NAME} members to search for me and view me on the members page?"
# Generates this:
<input type="checkbox" id="user_is_searchable" value="1" name="user[is_searchable]" class="checkbox" checked="checked"/>
<input type="hidden" value="0" name="user[is_searchable]" class="hidden"/>
<label for="user_is_searchable">Send me weekly motivator reports?</label>
# When this is submitted to the controller I get:
RemoveComment = $.klass(Remote.Link, {
initialize: function($super, options) {
$action = $(this)
this.comment = $action.parents(".comment")
$super(options);
},
complete: function(response, result) {
},
<div id="comment_11" class="comment">
<div class="actions">
<a href="/comments/11" class="delete">Delete</a>
</div>
</div>
$(document).ready(function($){
$("div.comment_form form").attach(CommentForm);
$(".comments .actions .delete").attach(RemoveComment, { type: 'DELETE', dataType: 'json' });
});
RemoveComment = $.klass(Remote.Link, {
initialize: function($super, options) {
this.comment = this.element.parents(".comment");
$super(options);