Merge branch 'master' into organizations_index_row

This commit is contained in:
Stella Rouzi 2017-06-15 13:14:43 +03:00 committed by GitHub
commit 195bc3cfb7
10 changed files with 29 additions and 18 deletions

View file

@ -0,0 +1,9 @@
class OpenidsController < ApplicationController
load_and_authorize_resource :user
load_and_authorize_resource through: :user
def destroy
@openid.destroy
redirect_to :back
end
end

View file

@ -100,6 +100,8 @@ class Ability
# can manage the commercials of their own events
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
can [:destroy], Openid
end
# Abilities for signed in users with roles

View file

@ -115,7 +115,7 @@ class Event < ActiveRecord::Base
def average_rating
@total_rating = 0
votes.each do |vote|
@total_rating = @total_rating + vote.rating
@total_rating += vote.rating
end
@total = votes.size
@total_rating > 0 ? number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) : 0

View file

@ -15,7 +15,11 @@
%h4
Currently the following openIDs are associated with your account
- @openids.each do |openid|
%li= "#{openid.provider}:#{openid.email}"
%li{ style: "list-style: none; margin-left: 20px;" }
= link_to user_openid_path(openid, user_id: current_user.id), method: :delete,
data: { confirm: "Remove association with #{openid.provider} account?" } do
%span.fa.fa-times{ style: "color: red;" }
%span #{openid.provider}:#{openid.email}
%br
%h4
To add an openID with a different email address to your account, sign in with your