This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GiftMessage = $.klass({ | |
initialize: function(options) { | |
this.hoverClass = 'HoverItem'; | |
}, | |
onmouseover: function() { | |
this.element.addClass(this.hoverClass); | |
}, | |
onmouseout: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MonitoredTopic | |
include DataMapper::Resource | |
property :id, Serial | |
belongs_to :user | |
belongs_to :topic | |
end | |
class Topic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RemoveComment = $.klass(Remote.Link, { | |
initialize: function($super, options) { | |
$action = $(this) | |
this.comment = $action.parents(".comment") | |
$super(options); | |
}, | |
complete: function(response, result) { | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="comment_11" class="comment"> | |
<div class="actions"> | |
<a href="/comments/11" class="delete">Delete</a> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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); |
OlderNewer