Various small fixes for the participant UI
This commit is contained in:
parent
b6abe96279
commit
d13efa5f52
31 changed files with 287 additions and 279 deletions
|
|
@ -105,7 +105,14 @@ class Ability
|
|||
# Abilities for everyone, even guests (not logged in users)
|
||||
def guest
|
||||
# can view conferences
|
||||
can [:index, :show, :schedule], Conference
|
||||
can [:index], Conference
|
||||
can [:show], Conference do |conference|
|
||||
conference.splashpage && conference.splashpage.public == true
|
||||
end
|
||||
can [:schedule], Conference do |conference|
|
||||
conference.call_for_paper && conference.call_for_paper.schedule_public
|
||||
end
|
||||
|
||||
# can view confirmed Events
|
||||
can :show, Event do |event|
|
||||
event.state == 'confirmed'
|
||||
|
|
|
|||
|
|
@ -13,11 +13,18 @@ class TicketPurchase < ActiveRecord::Base
|
|||
scope: :ticket_id,
|
||||
message: 'already bought this ticket!'
|
||||
|
||||
delegate :title, to: :ticket
|
||||
delegate :description, to: :ticket
|
||||
delegate :price, to: :ticket
|
||||
delegate :price_cents, to: :ticket
|
||||
delegate :price_currency, to: :ticket
|
||||
|
||||
def self.purchase(conference, user, purchases)
|
||||
errors = []
|
||||
ActiveRecord::Base.transaction do
|
||||
conference.tickets.each do |ticket|
|
||||
quantity = purchases[ticket.id.to_s].to_i
|
||||
# if the user bought the ticket, just update the quantity
|
||||
if ticket.bought?(user)
|
||||
purchase = update_quantity(conference, quantity, ticket, user)
|
||||
else
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ class Track < ActiveRecord::Base
|
|||
has_many :events
|
||||
|
||||
before_create :generate_guid
|
||||
validates :name, presence: true
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
|
|
@ -59,13 +59,17 @@ class User < ActiveRecord::Base
|
|||
self.subscriptions.find_by(conference_id: conference.id).present?
|
||||
end
|
||||
|
||||
# Returns the ticket purchased ticket
|
||||
# Returns the purchased ticket
|
||||
# ====Returns
|
||||
# * +TicketUser::ActiveRecord_Relation+ -> user
|
||||
def ticket(id)
|
||||
ticket_purchases.where(ticket_id: id).first
|
||||
end
|
||||
|
||||
def supports? conference
|
||||
ticket_purchases.find_by(conference_id: conference.id).present?
|
||||
end
|
||||
|
||||
def self.for_ichain_username(username, attributes)
|
||||
user = find_by(username: username)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class Venue < ActiveRecord::Base
|
|||
after_update :send_mail_notification
|
||||
|
||||
def address
|
||||
"#{conference.venue.street}, #{conference.venue.postalcode} #{conference.venue.city}, #{conference.venue.country}"
|
||||
"#{street}, #{city}, #{country_name}"
|
||||
end
|
||||
|
||||
def country_name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue