Skip to content
This repository was archived by the owner on Apr 3, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ engines:
ratings:
enabled: true
paths:
- "app/**/*"
- "lib/**/*"
- app/**
- lib/**
- "**.rb"
- "**.css"
- "**.scss"
- "**.js"
- "**.coffee"
rubocop:
enabled: true
exclude_paths:
Expand All @@ -29,6 +33,7 @@ exclude_paths:
- bin/**
- db/**
- config/**
- coverage/**
- public/assets/**
- spec/**
- UI/**
Expand Down
9 changes: 7 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ gem 'bootstrap-sass', '~> 3.3.3'
gem 'font-awesome-rails', '~> 4.6.3.1'

gem 'aasm', '~> 4.2.0'
gem 'activevalidators', '~> 4.0.0'
gem 'activerecord-humanized_errors', '~> 2.0.1'
gem 'activevalidators', '~> 4.0.0'
gem 'awesome_print', '~> 1.6.1'
gem 'faker', '~> 1.4.3'
gem 'lograge', '~> 0.4.1'
Expand All @@ -31,20 +31,25 @@ group :development do
gem 'dotenv-rails', '~> 2.0.0'
gem 'powder', '~> 0.3.0'
gem 'rails_best_practices', '~> 1.16.0'
gem 'rubocop', '~> 0.42.0'
gem 'spring', '~> 1.7.2'
gem 'spring-commands-rspec', '~> 1.0.4'
end

group :development, :test do
gem 'capybara', '~> 2.4.4'
gem 'capybara-webkit', '~> 1.4.1'
gem 'fabrication', '~> 2.12.2'
gem 'guard-rspec', '~> 4.7.3', require: false
gem 'pry-byebug', '~> 3.3.0'
gem 'pry-rails', '~> 0.3.4'
gem 'rails-controller-testing', '~> 0.1.1'
gem 'rspec-rails', '~> 3.5.1', require: false
end

group :development, :review, :test do
gem 'fabrication', '~> 2.12.2'
end

group :production do
gem 'airbrake', '~> 5.4.3'
gem 'newrelic_rpm', '~> 3.16.0.318'
Expand Down
16 changes: 16 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ GEM
airbrake-ruby (~> 1.4)
airbrake-ruby (1.4.4)
arel (7.1.1)
ast (2.3.0)
autoprefixer-rails (6.3.7)
execjs
awesome_print (1.6.1)
Expand Down Expand Up @@ -185,6 +186,8 @@ GEM
omniauth-oauth2 (1.4.0)
oauth2 (~> 1.0)
omniauth (~> 1.2)
parser (2.3.1.2)
ast (~> 2.2)
pg (0.18.4)
phony (2.15.27)
pkg-config (1.1.7)
Expand All @@ -194,13 +197,16 @@ GEM
websocket-driver (>= 0.2.0)
powder (0.3.0)
thor (>= 0.11.5)
powerpack (0.1.1)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-byebug (3.3.0)
byebug (~> 8.0)
pry (~> 0.10)
pry-rails (0.3.4)
pry (>= 0.9.10)
puma (3.6.0)
rack (2.0.1)
rack-test (0.6.3)
Expand Down Expand Up @@ -245,6 +251,7 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)
rake (10.5.0)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
Expand All @@ -271,6 +278,12 @@ GEM
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
rubocop (0.42.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
ruby_dep (1.3.1)
sass (3.4.22)
Expand Down Expand Up @@ -316,6 +329,7 @@ GEM
thread_safe (~> 0.1)
uglifier (3.0.1)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.1.1)
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
Expand Down Expand Up @@ -350,13 +364,15 @@ DEPENDENCIES
poltergeist (~> 1.10.0)
powder (~> 0.3.0)
pry-byebug (~> 3.3.0)
pry-rails (~> 0.3.4)
puma (~> 3.6.0)
rails (~> 5.0.0)
rails-controller-testing (~> 0.1.1)
rails_12factor (~> 0.0.3)
rails_best_practices (~> 1.16.0)
rake (~> 10.5.0)
rspec-rails (~> 3.5.1)
rubocop (~> 0.42.0)
sass-rails (~> 5.0.6)
simplecov (~> 0.12.0)
slim-rails (~> 3.1.0)
Expand Down
1 change: 0 additions & 1 deletion app/assets/stylesheets/app/widgets.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
}
.company a {
color: #b3b3b3;
text-transform: uppercase;
&:hover {
color: #666666;
}
Expand Down
8 changes: 6 additions & 2 deletions app/controllers/app/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ class App::HomeController < AppController

def show
@event = Event.includes(event_associations).current
@sponsors = Sponsor.active_sponsors
@sponsors = Sponsor.active.shuffle
end

private

def event_associations
{ accepted_talks: :speaker, confirmed_speakers: :authorization, venue: :location }
{
accepted_talks: :speaker,
confirmed_speakers: :authorization,
venue: :location
}
end

end
29 changes: 29 additions & 0 deletions app/helpers/app_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
module AppHelper

SOCIAL_URLS = {
facebook: 'facebook.com',
googlegroups: 'groups.google.com/forum/#!forum',
twitter: 'twitter.com'
}

def link_to_social(resource, link, options = {})
target = resource.respond_to?(link) ? resource.send(link) : resource

url = SOCIAL_URLS[link] ? "https://#{SOCIAL_URLS[link]}/#{target}" : target

return unless url.is_a?(String)

options[:icon] ||= link
options[:title] ||= ''

link_to(url, target: '_blank') do
content_tag(:i, nil, class: "fa fa-#{options[:icon]}") << options[:title]
end
end

def oauth_providers
[
{
Expand Down Expand Up @@ -30,6 +51,14 @@ def oauth_providers_for_environment
oauth_providers.select{|provider| provider[:name].in?(providers) }
end

def render_affiliation(title, org, url = nil)
return unless [title, org].reject(&:blank?).any?

org = org && url ? link_to(org, url, target: '_blank') : org

[title, org].reject(&:blank?).join(' en ').try(:html_safe)
end

def render_login_links
links = []

Expand Down
6 changes: 5 additions & 1 deletion app/models/speaker.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
class Speaker < User

default_scope -> { joins(:talks).having('count(*) > 0').group(:id) }
alias_attribute :link, :url

has_many :talks

default_scope -> { where('talks_count > 0') }

end
4 changes: 3 additions & 1 deletion app/models/sponsor.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
class Sponsor < ActiveRecord::Base
scope :active_sponsors, -> { where(active: true).shuffle }

scope :active, -> { where(active: true) }

end
8 changes: 4 additions & 4 deletions app/models/talk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class Talk < ActiveRecord::Base
end
end

default_scope { order('id DESC') }

belongs_to :event
belongs_to :speaker, class_name: 'User'
belongs_to :speaker, counter_cache: true

default_scope { order('id DESC') }

validates_presence_of :event, :speaker, :title, :description
validates_presence_of :event, :speaker, :title

end
11 changes: 4 additions & 7 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
class User < ActiveRecord::Base

has_many :talks, foreign_key: 'speaker_id'

has_one :authorization

validates :email, email: { strict: true, message: 'is invalid' }
validates_presence_of :authorization, on: :update
validates_presence_of :email, :name
validates_uniqueness_of :email

Expand All @@ -15,14 +12,14 @@ def avatar_url

private

def full_user_photo_path(nickname)
Dir.glob("app/assets/images/speakers/**/#{nickname}.{jpg,jpeg,png}").first
end

def auth_photo_url
authorization.photo_url if authorization
end

def full_user_photo_path(nickname)
Dir.glob("app/assets/images/speakers/**/#{nickname}.{jpg,jpeg,png}").first
end

def local_photo_path
full_user_photo_path(twitter).try(:sub, %r{.*(speakers)}, 'assets/\1')
end
Expand Down
47 changes: 39 additions & 8 deletions app/views/admin/speakers/_form.html.slim
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
= form_for [:admin, speaker], html: { class: "form-horizontal" } do |f|
= form_for [:admin, speaker], html: { class: 'form-horizontal' } do |f|

.form-group
= f.label :name, "Nombre", class: "col-md-2"
= f.label :name, 'Nombre', class: 'col-md-2'
.col-md-8
= f.text_field :name, class: "form-control"
= f.text_field :name, class: 'form-control'

.form-group
= f.label :email, "Correo", class: "col-md-2"
= f.label :email, 'Correo', class: 'col-md-2'
.col-md-8
= f.email_field :email, class: "form-control"
= f.email_field :email, class: 'form-control'

.form-group
= f.label :twitter, "Twitter", class: "col-md-2"
= f.label :url, 'Sitio Web', class: 'col-md-2'
.col-md-8
= f.text_field :twitter, class: "form-control"
= f.text_field :url, class: 'form-control'

.form-group
= f.label :facebook, 'Facebook', class: 'col-md-2'
.col-md-8
= f.text_field :facebook, class: 'form-control'

.form-group
= f.label :twitter, 'Twitter', class: 'col-md-2'
.col-md-8
= f.text_field :twitter, class: 'form-control'

fieldset
legend.col-md-10 Organización

.clearfix

.form-group
= f.label :title, 'Rol', class: 'col-md-2'
.col-md-8
= f.text_field :title, class: 'form-control'

.form-group
= f.label :organization_name, 'Nombre', class: 'col-md-2'
.col-md-8
= f.text_field :organization_name, class: 'form-control'

.form-group
= f.label :organization_url, 'Sitio Web', class: 'col-md-2'
.col-md-8
= f.text_field :organization_url, class: 'form-control'


.form-group
.col-md-offset-2.col-md-2
= f.submit "#{speaker.new_record? ? "Crear" : "Guardar"} ponente", class: "btn btn-primary"
= f.submit "#{speaker.new_record? ? 'Crear' : 'Guardar'} ponente", class: 'btn btn-primary'
34 changes: 14 additions & 20 deletions app/views/app/home/_speakers.html.slim
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
- if event.confirmed_speakers.present?
- if talks.present?
#speakers.speakers.widget-content
.row
.columns.small-12.medium-12.large-12
.center-content
h2 Ponentes
div
ul.small-block-grid-1.medium-block-grid-2 class="large-block-grid-#{event.confirmed_speakers.size}"
- event.accepted_talks.each do |talk|
ul.small-block-grid-1.medium-block-grid-2 class="large-block-grid-#{talks.size}"
- talks.map{|talk| [talk, talk.speaker] }.each do |talk, speaker|
li
.avatar
img alt="Imágen de perfil de #{talk.speaker.name}" height='220' src="#{talk.speaker.avatar_url}" width='220'
= image_tag(speaker.avatar_url, height: 220, width: 220)
.social
/! Speaker profile / blog url
/a href='#' target='_blank'
/i.fa.fa-user
/! Speaker Twitter URL
a href="https://twitter.com/#{talk.speaker.twitter}"
i.fa.fa-twitter
/! Speaker Facebook URL
/a href='#'
/i.fa.fa-facebook
- %i{ link facebook twitter }.each do |profile|
= link_to_social(speaker, profile)
.title
= talk.title
.name
a[href='#' target='_blank'] = talk.speaker.name
.company = talk.title
/a href='http://tauziet.com/' target='_blank' Facebook
/! View all Speakers Button
/.view-all-speakers
/a.btn-default href='speakers.html' VE A TODOS LOS PONENTES

- if speaker.url.present?
= link_to(speaker.name, speaker.url, target: '_blank')
- else
= speaker.name
.company
= render_affiliation(speaker.title, speaker.organization_name, speaker.organization_url)
5 changes: 2 additions & 3 deletions app/views/app/home/_sponsors.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
div
ul.small-block-grid-1.medium-block-grid-2.large-block-grid-4
- sponsors.each do |sponsor|
li
= link_to sponsor[:website], target: '_blank' do
= image_tag sponsor[:image], height: 85, width: 200
li= link_to sponsor.website, target: '_blank' do
= image_tag sponsor.image, height: 85, width: 200
Loading