Merge branch 'master' into rebased_1530

This commit is contained in:
Shlok Srivastava 2017-08-23 18:58:02 +00:00 committed by GitHub
commit aebdd66034
12 changed files with 90 additions and 24 deletions

View file

@ -153,6 +153,7 @@ linters:
- "app/views/layouts/_admin_sidebar_index.html.haml" - "app/views/layouts/_admin_sidebar_index.html.haml"
- "app/views/layouts/_messages.html.haml" - "app/views/layouts/_messages.html.haml"
- "app/views/layouts/_navigation.html.haml" - "app/views/layouts/_navigation.html.haml"
- "app/views/layouts/_user_menu.html.haml"
- "app/views/layouts/application.html.haml" - "app/views/layouts/application.html.haml"
- "app/views/organizations/index.html.haml" - "app/views/organizations/index.html.haml"
- "app/views/payments/_payment.html.haml" - "app/views/payments/_payment.html.haml"

View file

@ -90,6 +90,10 @@ module Admin
update_state(:cancel, 'Booth is canceled') update_state(:cancel, 'Booth is canceled')
end end
def confirm
update_state(:confirm, 'Booth successfully confirmed')
end
private private
def update_state(transition, notice) def update_state(transition, notice)

View file

@ -1,18 +1,29 @@
class ConferencesController < ApplicationController class ConferencesController < ApplicationController
protect_from_forgery with: :null_session protect_from_forgery with: :null_session
before_action :respond_to_options before_action :respond_to_options
load_and_authorize_resource find_by: :short_title load_and_authorize_resource find_by: :short_title, except: :show
load_resource :program, through: :conference, singleton: true, except: :index
def index def index
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc) @current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
@antiquated = @conferences - @current @antiquated = @conferences - @current
end end
def show; end def show
@conference = if params[:id]
Conference.find_by_short_title(params[:id])
else
load_conference_by_domain
end
authorize! :show, @conference
@program = @conference.program
end
private private
def load_conference_by_domain
Conference.find_by(custom_domain: request.domain)
end
def respond_to_options def respond_to_options
respond_to do |format| respond_to do |format|
format.html { head :ok } format.html { head :ok }

View file

@ -42,3 +42,8 @@
%li= link_to 'Cancel booth', %li= link_to 'Cancel booth',
cancel_admin_conference_booth_path(@conference.short_title, booth), cancel_admin_conference_booth_path(@conference.short_title, booth),
method: :patch, id: "cancel_booth_#{booth.id}" method: :patch, id: "cancel_booth_#{booth.id}"
- if booth.transition_possible? :confirm
%li= link_to 'Confirm booth',
confirm_admin_conference_booth_path(@conference.short_title, booth),
method: :patch, id: "confirm_booth_#{booth.id}"

View file

@ -12,22 +12,26 @@
= @conference.venue.city = @conference.venue.city
%p.lead %p.lead
We recommend these affordable lodging accommodations for your visit. We recommend these affordable lodging accommodations for your visit.
- @conference.lodgings.each_slice(3) do |slice|
.row.row-centered .row.row-centered{ style:"display: flex; flex-wrap: wrap" }
- slice.each do |lodging| - @conference.lodgings.each do |lodging|
.col-md-4.col-sm-4.ticket.col-centered.col-top .col-md-4.col-sm-4.col-centered.col-top{ style:"display:flex;" }
.thumbnail .thumbnail
- unless lodging.picture? - if lodging.picture?
%p.text-center -if lodging.website_link.present?
%i.fa.fa-home.fa-5x = link_to(lodging.website_link, class: 'thumbnail') do
= image_tag lodging.picture.large.url, class: 'img-responsive img-lodging'
- else - else
= image_tag lodging.picture.large.url, class: 'img-responsive img-lodging'
- else
%p.text-center
-if lodging.website_link.present? -if lodging.website_link.present?
= link_to(lodging.website_link, class: 'thumbnail') do = link_to(lodging.website_link, class: 'thumbnail') do
= image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' %i.fa.fa-home.fa-5x
- else - else
= image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' %i.fa.fa-home.fa-5x
.caption .caption
%h3.text-center %h3.text-center
= lodging.name = lodging.name
-if lodging.description.present? -if lodging.description.present?
= markdown(lodging.description) = markdown(lodging.description)

View file

@ -116,7 +116,11 @@
- if can? :update, @conference.tickets.build - if can? :update, @conference.tickets.build
%li{class: active_nav_li(admin_conference_tickets_path(@conference.short_title)) } %li{class: active_nav_li(admin_conference_tickets_path(@conference.short_title)) }
= link_to 'Tickets', admin_conference_tickets_path(@conference.short_title) = link_to 'Tickets', admin_conference_tickets_path(@conference.short_title)
- if can? :manage, @conference.booths.build
%li
= link_to admin_conference_booths_path(@conference.short_title) do
%span.fa.fa-shopping-bag
Booths
- if (can? :manage, @conference.targets.build) || (can? :manage, @conference.campaigns.build) - if (can? :manage, @conference.targets.build) || (can? :manage, @conference.campaigns.build)
%li %li
%a %a

View file

@ -16,6 +16,11 @@
= link_to(conference_program_tracks_path(@conference.short_title)) do = link_to(conference_program_tracks_path(@conference.short_title)) do
%span.fa.fa-road %span.fa.fa-road
My Tracks My Tracks
-if @conference && @conference.program && (@conference.program.cfps.for_booths.try(:open?) || current_user.booths.where(conference_id: @conference.id).count > 0)
%li
= link_to (conference_booths_path(@conference.short_title)) do
%span.fa.fa-shopping-bag
My Booth Requests
%li %li
- if ENV['OSEM_ICHAIN_ENABLED'] == 'true' - if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
= link_to(destroy_user_ichain_session_path, method: 'delete') do = link_to(destroy_user_ichain_session_path, method: 'delete') do

View file

@ -0,0 +1,6 @@
class DomainConstraint
def self.matches?(request)
domains = Conference.where.not(custom_domain: nil).pluck(:custom_domain)
domains.include?(request.domain)
end
end

View file

@ -1,5 +1,9 @@
Osem::Application.routes.draw do Osem::Application.routes.draw do
constraints DomainConstraint do
get '/', to: 'conferences#show'
end
if ENV['OSEM_ICHAIN_ENABLED'] == 'true' if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
devise_for :users, controllers: { registrations: :registrations } devise_for :users, controllers: { registrations: :registrations }
else else
@ -53,6 +57,7 @@ Osem::Application.routes.draw do
patch :reset patch :reset
patch :to_reject patch :to_reject
patch :cancel patch :cancel
patch :confirm
end end
end end

View file

@ -0,0 +1,5 @@
class AddCustomDomainToConferences < ActiveRecord::Migration
def change
add_column :conferences, :custom_domain, :string
end
end

View file

@ -11,10 +11,10 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170807092805) do ActiveRecord::Schema.define(version: 20170816203325) do
create_table "ahoy_events", force: :cascade do |t| create_table "ahoy_events", force: :cascade do |t|
t.integer "visit_id" t.uuid "visit_id", limit: 16
t.integer "user_id" t.integer "user_id"
t.string "name" t.string "name"
t.text "properties" t.text "properties"
@ -127,6 +127,7 @@ ActiveRecord::Schema.define(version: 20170807092805) do
t.integer "end_hour", default: 20 t.integer "end_hour", default: 20
t.integer "organization_id" t.integer "organization_id"
t.integer "ticket_layout", default: 0 t.integer "ticket_layout", default: 0
t.string "custom_domain"
t.integer "booth_limit", default: 0 t.integer "booth_limit", default: 0
end end
@ -511,10 +512,10 @@ ActiveRecord::Schema.define(version: 20170807092805) do
create_table "tickets", force: :cascade do |t| create_table "tickets", force: :cascade do |t|
t.integer "conference_id" t.integer "conference_id"
t.string "title", null: false t.string "title", null: false
t.text "description" t.text "description"
t.integer "price_cents", default: 0, null: false t.integer "price_cents", default: 0, null: false
t.string "price_currency", default: "USD", null: false t.string "price_currency", default: "USD", null: false
t.boolean "registration_ticket", default: false t.boolean "registration_ticket", default: false
end end
@ -572,6 +573,7 @@ ActiveRecord::Schema.define(version: 20170807092805) do
t.boolean "is_admin", default: false t.boolean "is_admin", default: false
t.string "username" t.string "username"
t.boolean "is_disabled", default: false t.boolean "is_disabled", default: false
t.string "token"
end end
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true

View file

@ -24,6 +24,20 @@ describe ConferencesController do
expect(response).to render_template :show expect(response).to render_template :show
end end
end end
context 'accessing conference via custom domain' do
before do
conference.update_attribute(:custom_domain, 'lvh.me')
@request.host = 'lvh.me'
end
it 'assigns correct conference' do
get :show
expect(response).to render_template :show
expect(assigns(:conference)).to eq conference
end
end
end end
describe 'OPTIONS #index' do describe 'OPTIONS #index' do