updated rails to 4.2.4
This commit is contained in:
parent
37697517df
commit
42e8bb11ea
55 changed files with 766 additions and 365 deletions
|
|
@ -88,12 +88,13 @@ class Ability
|
|||
# Abilities from not_signed_in and signed_in are also inherited
|
||||
signed_in(user)
|
||||
|
||||
signed_in_with_organizer_role(user)
|
||||
signed_in_with_cfp_role(user)
|
||||
signed_in_with_info_desk_role(user)
|
||||
signed_in_with_volunteers_coordinator_role(user)
|
||||
signed_in_with_organizer_role(user) if user.has_role? :organizer, :any
|
||||
signed_in_with_cfp_role(user) if user.has_role? :cfp, :any
|
||||
signed_in_with_info_desk_role(user) if user.has_role? :info_desk, :any
|
||||
signed_in_with_volunteers_coordinator_role(user) if user.has_role? :volunteer_coordinator, :any
|
||||
|
||||
# for users with any role
|
||||
can :access, Admin
|
||||
can [:show], Conference
|
||||
can :index, Commercial, commercialable_type: 'Conference'
|
||||
cannot [:edit, :update, :destroy], Question, global: true
|
||||
|
|
@ -137,6 +138,8 @@ class Ability
|
|||
can :manage, Sponsor, conference_id: conf_ids_for_organizer
|
||||
can :manage, SponsorshipLevel, conference_id: conf_ids_for_organizer
|
||||
can :manage, Ticket, conference_id: conf_ids_for_organizer
|
||||
can :index, Comment, commentable_type: 'Event',
|
||||
commentable_id: Event.where(conference_id: conf_ids_for_organizer).pluck(:id)
|
||||
end
|
||||
|
||||
def signed_in_with_cfp_role(user)
|
||||
|
|
@ -155,6 +158,8 @@ class Ability
|
|||
can :manage, CallForPaper, conference_id: conf_ids_for_cfp
|
||||
can :manage, Commercial, commercialable_type: 'Event',
|
||||
commercialable_id: Event.where(conference_id: conf_ids_for_cfp).pluck(:id)
|
||||
can :index, Comment, commentable_type: 'Event',
|
||||
commentable_id: Event.where(conference_id: conf_ids_for_cfp).pluck(:id)
|
||||
end
|
||||
|
||||
def signed_in_with_info_desk_role(user)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ class Comment < ActiveRecord::Base
|
|||
attr_accessible :commentable, :body, :user_id
|
||||
validates_presence_of :body
|
||||
validates_presence_of :user
|
||||
after_create :send_notification
|
||||
|
||||
# NOTE: install the acts_as_votable plugin if you
|
||||
# want user to vote on the quality of comments.
|
||||
|
|
@ -40,9 +41,18 @@ class Comment < ActiveRecord::Base
|
|||
where(commentable_type: commentable_str.to_s, commentable_id: commentable_id).order('created_at DESC')
|
||||
}
|
||||
|
||||
scope :find_since_last_login, lambda { |user|
|
||||
where(created_at: (user.last_sign_in_at..Time.now)).order(created_at: :desc)
|
||||
}
|
||||
# Helper class method to look up a commentable object
|
||||
# given the commentable class name and id
|
||||
def self.find_commentable(commentable_str, commentable_id)
|
||||
commentable_str.constantize.find(commentable_id)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def send_notification
|
||||
Mailbot.delay.send_notification_email_for_comment(self)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -114,17 +114,17 @@ class Conference < ActiveRecord::Base
|
|||
before_create :add_color
|
||||
|
||||
def date_range_string
|
||||
startstr = "Unknown - "
|
||||
endstr = "Unknown"
|
||||
startstr = 'Unknown - '
|
||||
endstr = 'Unknown'
|
||||
if start_date.month == end_date.month && start_date.year == end_date.year
|
||||
startstr = start_date.strftime("%B %d - ")
|
||||
endstr = end_date.strftime("%d, %Y")
|
||||
startstr = start_date.strftime('%B %d - ')
|
||||
endstr = end_date.strftime('%d, %Y')
|
||||
elsif start_date.month != end_date.month && start_date.year == end_date.year
|
||||
startstr = start_date.strftime("%B %d - ")
|
||||
endstr = end_date.strftime("%B %d, %Y")
|
||||
startstr = start_date.strftime('%B %d - ')
|
||||
endstr = end_date.strftime('%B %d, %Y')
|
||||
else
|
||||
startstr = start_date.strftime("%B %d, %Y - ")
|
||||
endstr = end_date.strftime("%B %d, %Y")
|
||||
startstr = start_date.strftime('%B %d, %Y - ')
|
||||
endstr = end_date.strftime('%B %d, %Y')
|
||||
end
|
||||
|
||||
result = startstr + endstr
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class EmailSettings < ActiveRecord::Base
|
|||
h['registration_end_date'] = conference.registration_period.end_date
|
||||
end
|
||||
|
||||
if !event.nil?
|
||||
if event
|
||||
h['eventtitle'] = event.title
|
||||
h['proposalslink'] = Rails.application.routes.url_helpers.conference_proposal_index_url(
|
||||
conference.short_title, host: CONFIG['url_for_emails'])
|
||||
|
|
@ -67,6 +67,8 @@ class EmailSettings < ActiveRecord::Base
|
|||
parse_template(conf_update_template, values)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def parse_template(text, values)
|
||||
values.each do |key, value|
|
||||
if value.kind_of?(Date)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ class User < ActiveRecord::Base
|
|||
|
||||
before_create :setup_role
|
||||
|
||||
# add scope
|
||||
scope :comment_notifiable, ->(conference) {joins(:roles).where('roles.name IN (?)', [:organizer, :cfp]).where('roles.resource_type = ? AND roles.resource_id = ?', 'Conference', conference.id)}
|
||||
|
||||
# Include default devise modules. Others available are:
|
||||
# :token_authenticatable, :confirmable,
|
||||
# :lockable, :timeoutable and :omniauthable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue