Merge branch 'master' into organizations_index_row
This commit is contained in:
commit
195bc3cfb7
10 changed files with 29 additions and 18 deletions
|
|
@ -92,6 +92,10 @@ Style/SpaceAroundOperators:
|
||||||
Style/SpaceInsideBrackets:
|
Style/SpaceInsideBrackets:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
# This cop enforces the use the shorthand for self-assignment.
|
||||||
|
Style/SelfAssignment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
# Use single quotes unless there's string interpolation
|
# Use single quotes unless there's string interpolation
|
||||||
Style/StringLiterals:
|
Style/StringLiterals:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
||||||
|
|
@ -721,14 +721,6 @@ Style/RegexpLiteral:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Guardfile'
|
- 'Guardfile'
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/SelfAssignment:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/event.rb'
|
|
||||||
- 'db/migrate/20141104131625_generate_username.rb'
|
|
||||||
- 'spec/support/save_feature_failures.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ GEM
|
||||||
open4 (~> 1.3.4)
|
open4 (~> 1.3.4)
|
||||||
rake
|
rake
|
||||||
mini_magick (4.5.1)
|
mini_magick (4.5.1)
|
||||||
mini_portile2 (2.1.0)
|
mini_portile2 (2.2.0)
|
||||||
minitest (5.10.1)
|
minitest (5.10.1)
|
||||||
momentjs-rails (2.8.1)
|
momentjs-rails (2.8.1)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
|
|
@ -293,8 +293,8 @@ GEM
|
||||||
mysql2 (0.4.2)
|
mysql2 (0.4.2)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nio4r (1.2.1)
|
nio4r (1.2.1)
|
||||||
nokogiri (1.7.1)
|
nokogiri (1.8.0)
|
||||||
mini_portile2 (~> 2.1.0)
|
mini_portile2 (~> 2.2.0)
|
||||||
oauth2 (0.9.4)
|
oauth2 (0.9.4)
|
||||||
faraday (>= 0.8, < 0.10)
|
faraday (>= 0.8, < 0.10)
|
||||||
jwt (~> 1.0)
|
jwt (~> 1.0)
|
||||||
|
|
|
||||||
9
app/controllers/openids_controller.rb
Normal file
9
app/controllers/openids_controller.rb
Normal 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
|
||||||
|
|
@ -100,6 +100,8 @@ class Ability
|
||||||
|
|
||||||
# can manage the commercials of their own events
|
# can manage the commercials of their own events
|
||||||
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
|
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
|
||||||
|
|
||||||
|
can [:destroy], Openid
|
||||||
end
|
end
|
||||||
|
|
||||||
# Abilities for signed in users with roles
|
# Abilities for signed in users with roles
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ class Event < ActiveRecord::Base
|
||||||
def average_rating
|
def average_rating
|
||||||
@total_rating = 0
|
@total_rating = 0
|
||||||
votes.each do |vote|
|
votes.each do |vote|
|
||||||
@total_rating = @total_rating + vote.rating
|
@total_rating += vote.rating
|
||||||
end
|
end
|
||||||
@total = votes.size
|
@total = votes.size
|
||||||
@total_rating > 0 ? number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) : 0
|
@total_rating > 0 ? number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) : 0
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,11 @@
|
||||||
%h4
|
%h4
|
||||||
Currently the following openIDs are associated with your account
|
Currently the following openIDs are associated with your account
|
||||||
- @openids.each do |openid|
|
- @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
|
%br
|
||||||
%h4
|
%h4
|
||||||
To add an openID with a different email address to your account, sign in with your
|
To add an openID with a different email address to your account, sign in with your
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ Osem::Application.routes.draw do
|
||||||
mount LetterOpenerWeb::Engine, at: "/letter_opener"
|
mount LetterOpenerWeb::Engine, at: "/letter_opener"
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :users, except: [:new, :index, :create, :destroy]
|
resources :users, except: [:new, :index, :create, :destroy] do
|
||||||
|
resources :openids, only: :destroy
|
||||||
|
end
|
||||||
|
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :organizations
|
resources :organizations
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,7 @@ class GenerateUsername < ActiveRecord::Migration
|
||||||
TempUser.all.each do |user|
|
TempUser.all.each do |user|
|
||||||
if user.username.blank?
|
if user.username.blank?
|
||||||
username = user.email.split('@')[0]
|
username = user.email.split('@')[0]
|
||||||
if TempUser.find_by(username: username)
|
username += user.id.to_s if TempUser.find_by(username: username)
|
||||||
username = username + user.id.to_s
|
|
||||||
end
|
|
||||||
user.update_attributes(username: username)
|
user.update_attributes(username: username)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ RSpec.configure do |config|
|
||||||
config.after(:each, type: :feature) do
|
config.after(:each, type: :feature) do
|
||||||
example_filename = RSpec.current_example.full_description
|
example_filename = RSpec.current_example.full_description
|
||||||
example_filename = example_filename.tr(' ', '_')
|
example_filename = example_filename.tr(' ', '_')
|
||||||
example_filename = example_filename + '.html'
|
example_filename += '.html'
|
||||||
example_filename = File.expand_path(example_filename, Capybara.save_and_open_page_path)
|
example_filename = File.expand_path(example_filename, Capybara.save_and_open_page_path)
|
||||||
if RSpec.current_example.exception.present?
|
if RSpec.current_example.exception.present?
|
||||||
save_page(example_filename)
|
save_page(example_filename)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue