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
lifecycle do | |
state :unverified, :default => true | |
state :verified,:active, :inactive, :banned | |
create :signup, :available_to => "Guest", | |
:params => [:name, :real_name, :birthday, :email_address, :password, :password_confirmation], | |
:become => :unverified, :new_key => true do | |
if self.birthday.to_time < 18.years.ago | |
UserMailer.deliver_email_verification(self, lifecycle.key) |
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
# --- Signup lifecycle --- # | |
lifecycle do | |
state :unverified, :default => true | |
state :verified,:active, :inactive, :banned | |
create :signup, :available_to => "Guest", | |
:params => [:name, :real_name, :birthday, :email_address, :password, :password_confirmation], | |
:become => :unverified, :new_key => true do |
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 UserMailer < ActionMailer::Base | |
def forgot_password(user, key) | |
host = Hobo::Controller.request_host | |
app_name = Hobo::Controller.app_name || host | |
@subject = "#{app_name} -- forgotten password" | |
@body = { :user => user, :key => key, :host => host, :app_name => app_name } | |
@recipients = user.email_address | |
@from = "no-reply@#{host}" | |
@sent_on = Time.now |
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 Bid < AR::Base | |
belongs_to :project | |
belongs_to :bidder, :creator => true, :class_name => "User" | |
def create_permitted? | |
return false if acting_user == project_owner | |
return false if project.already_bidded?(acting_user) | |
bidder_is? acting_user | |
end | |
def view_permitted?(attribute) |
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
<extend tag="form" for="Picture"> | |
<old-form enctype="multipart/form-data" merge> | |
<field-list: fields="name,description,license,notes,image" /> | |
</old-form> | |
</extend> | |
<extend tag="card" for="Picture"> | |
<card> | |
<h5><a /></h5> | |
<p> | |
<a><img src="#{this.image.url :thumbnail}" /></a> |
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
<def tag="card" for="Comment" attrs="gravatar"> | |
<div class="card linkable comment" param="default"> | |
<h5 param="card-heading"><You:owner /> wrote <view:created_at format="on %B %d, %Y at %I:%M%p" param="card-timestamp" />:</h5> | |
<gravatar:owner unless="&gravatar == 'false'" rating="pg" size="50" param /> | |
<p><view:body param="card-body" /></p> | |
<delete-button class="actions" param /> | |
<report-content-link /> | |
</div> | |
</def> |
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
UnixPermissions = classy_module do | |
belongs_to :owner, :creator => true, :class_name => "User" | |
belongs_to :group | |
fields do | |
group_read :boolean | |
group_write :boolean | |
group_destroy :boolean | |
everyone_read :boolean | |
everyone_write :boolean |
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
<extend tag="form" for="Picture"> | |
<old-form enctype="multipart/form-data" merge> | |
<field-list: fields="name,description,license,notes,image" /> | |
</old-form> | |
</extend> | |
<extend tag="card" for="Picture"> | |
<card> | |
<h5><a /></h5> | |
<p> | |
<a><img src="#{this.image.url :thumbnail}" /></a> |
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 Comment < ActiveRecord::Base | |
hobo_model # Don't put anything above this | |
fields do | |
body :text, :required | |
timestamps | |
end | |
belongs_to :commentable, :polymorphic => true, :counter_cache => true |
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 Comment < ActiveRecord::Base | |
hobo_model # Don't put anything above this | |
fields do | |
body :text, :required | |
timestamps | |
end | |
belongs_to :commentable, :polymorphic => true, :counter_cache => true |
OlderNewer