Merge branch 'master' into moving-users
This commit is contained in:
commit
6b55a28813
53 changed files with 1105 additions and 318 deletions
|
|
@ -20,14 +20,6 @@
|
|||
color: black;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
input[type=text],
|
||||
input[type=password] {
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
display: block;
|
||||
margin: auto;
|
||||
width: 255px;
|
||||
}
|
||||
.btn-group {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -89,4 +89,8 @@ p.comment-body {
|
|||
|
||||
.changeset{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.box{
|
||||
height: 230px;
|
||||
}
|
||||
|
|
|
|||
94
app/controllers/admin/booths_controller.rb
Normal file
94
app/controllers/admin/booths_controller.rb
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
module Admin
|
||||
class BoothsController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource through: :conference
|
||||
|
||||
def index; end
|
||||
|
||||
def show; end
|
||||
|
||||
def new; end
|
||||
|
||||
def create
|
||||
@booth = @conference.booths.new(booth_params)
|
||||
|
||||
@booth.submitter = current_user
|
||||
|
||||
if @booth.save
|
||||
redirect_to admin_conference_booths_path,
|
||||
notice: 'Booth successfully created.'
|
||||
else
|
||||
flash[:error] = "Creating booth failed. #{@booth.errors.full_messages.to_sentence}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def update
|
||||
@booth.update_attributes(booth_params)
|
||||
|
||||
if @booth.save
|
||||
redirect_to admin_conference_booths_path,
|
||||
notice: "Successfully updated booth for #{@booth.title}."
|
||||
else
|
||||
flash[:error] = "An error prohibited the Booth for #{@booth.title} "\
|
||||
"#{@booth.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @booth.destroy
|
||||
redirect_to admin_conference_booths_path,
|
||||
notice: 'Booth successfully destroyed.'
|
||||
else
|
||||
redirect_to admin_conference_booths_path,
|
||||
error: "Booth couldn't be deleted. #{@booth.errors.full_messages.join('. ')}."
|
||||
end
|
||||
end
|
||||
|
||||
def accept
|
||||
update_state(:accept, 'Booth accepted!')
|
||||
end
|
||||
|
||||
def to_accept
|
||||
update_state(:to_accept, 'Booth to accept')
|
||||
end
|
||||
|
||||
def to_reject
|
||||
update_state(:to_reject, 'Booth to reject')
|
||||
end
|
||||
|
||||
def reject
|
||||
update_state(:reject, 'Booth rejected')
|
||||
end
|
||||
|
||||
def restart
|
||||
update_state(:restart, 'Booth is submitted')
|
||||
end
|
||||
|
||||
def cancel
|
||||
update_state(:cancel, 'Booth is canceled')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_state(transition, notice)
|
||||
alert = @booth.update_state(transition, notice)
|
||||
|
||||
if alert.blank?
|
||||
flash[:notice] = notice
|
||||
redirect_back_or_to(admin_conference_booths_path(conference_id: @conference.short_title)) && return
|
||||
else
|
||||
flash[:error] = alert
|
||||
return redirect_back_or_to(admin_conference_booths_path(conference_id: @conference.short_title)) && return
|
||||
end
|
||||
end
|
||||
|
||||
def booth_params
|
||||
params.require(:booth).permit(:title, :description, :reasoning, :state, :picture, :conference_id,
|
||||
:created_at, :updated_at, :submitter_relationship, :website_url, responsible_ids: [])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
class PhysicalTicketController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource
|
||||
load_and_authorize_resource find_by: :token
|
||||
authorize_resource :conference_registrations, class: Registration
|
||||
|
||||
def index
|
||||
|
|
@ -13,5 +13,15 @@ class PhysicalTicketController < ApplicationController
|
|||
@file_name = "ticket_for_#{@conference.short_title}"
|
||||
@user = @physical_ticket.user
|
||||
@ticket_layout = @conference.ticket_layout.to_sym
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.pdf do
|
||||
pdf = TicketPdf.new(@conference, @user, @physical_ticket, @ticket_layout, @file_name)
|
||||
send_data pdf.render,
|
||||
filename: @file_name,
|
||||
type: 'application/pdf',
|
||||
disposition: 'attachment'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,17 +5,19 @@ class SubscriptionsController < ApplicationController
|
|||
|
||||
def create
|
||||
@subscription = current_user.subscriptions.build(conference_id: @conference.id)
|
||||
if @subscription.save!
|
||||
redirect_to root_path, notice: "You have been subscribed to receive email notifications for #{@conference.short_title}."
|
||||
if @subscription.save
|
||||
redirect_to root_path, notice: "You have subscribed to receive email notifications for #{@conference.title}."
|
||||
else
|
||||
redirect_to root_path, error: subscription.errors.full_messages.to_sentence
|
||||
redirect_to root_path, error: @subscription.errors.full_messages.to_sentence
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@subscription = current_user.subscriptions.find_by(conference_id: @conference.id)
|
||||
|
||||
redirect_to(root_path, error: "You are not subscribed to #{@conference.title}.") && return unless @subscription
|
||||
if @subscription.destroy
|
||||
redirect_to root_path, notice: "You have been unsubscribed and now you will not be receiving email notifications for #{@conference.short_title}."
|
||||
redirect_to root_path, notice: "You have unsubscribed and you will not be receiving email notifications for #{@conference.title}."
|
||||
else
|
||||
redirect_to root_path, error: @subscription.errors.full_messages.to_sentence
|
||||
end
|
||||
|
|
|
|||
|
|
@ -162,6 +162,13 @@ module ApplicationHelper
|
|||
include_blank: false, label: 'Speakers', input_html: { class: 'select-help-toggle', multiple: 'true' }
|
||||
end
|
||||
|
||||
def responsibles_selector_input(form)
|
||||
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].blank? ? user[2] : user[1], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
||||
form.input :responsibles, as: :select,
|
||||
collection: options_for_select(users.map {|user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]]}, @booth.responsibles.map(&:id)),
|
||||
include_blank: false, label: 'Responsibles', input_html: { class: 'select-help-toggle', multiple: 'true' }
|
||||
end
|
||||
|
||||
def event_types(conference)
|
||||
conference.program.event_types.map { |et| et.title.pluralize }.to_sentence
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,6 +8,22 @@ class Mailbot < ActionMailer::Base
|
|||
conference.email_settings.registration_body))
|
||||
end
|
||||
|
||||
def ticket_confirmation_mail(ticket_purchase)
|
||||
@ticket_purchase = ticket_purchase
|
||||
@conference = ticket_purchase.conference
|
||||
@user = ticket_purchase.user
|
||||
|
||||
PhysicalTicket.last(ticket_purchase.quantity).each do |physical_ticket|
|
||||
pdf = TicketPdf.new(@conference, @user, physical_ticket, @conference.ticket_layout.to_sym, "ticket_for_#{@conference.short_title}_#{physical_ticket.id}")
|
||||
attachments["ticket_for_#{@conference.short_title}_#{physical_ticket.id}"] = pdf.render
|
||||
end
|
||||
|
||||
mail(to: @user.email,
|
||||
from: @conference.contact.email,
|
||||
template_name: 'ticket_confirmation_template',
|
||||
subject: "#{@conference.title} | Ticket Confirmation and PDF!")
|
||||
end
|
||||
|
||||
def acceptance_mail(event)
|
||||
conference = event.program.conference
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ class AdminAbility
|
|||
commercialable_id: conf_ids
|
||||
can :manage, Registration, conference_id: conf_ids
|
||||
can :manage, RegistrationPeriod, conference_id: conf_ids
|
||||
can :manage, Booth, conference_id: conf_ids
|
||||
can :manage, Question, conference_id: conf_ids
|
||||
can :manage, Question do |question|
|
||||
!(question.conferences.pluck(:id) & conf_ids).empty?
|
||||
|
|
@ -169,6 +170,7 @@ class AdminAbility
|
|||
conf_ids_for_cfp.include?(conf.id)
|
||||
end
|
||||
can [:index, :show, :update], Resource, conference_id: conf_ids_for_cfp
|
||||
can :manage, Booth, conference_id: conf_ids_for_cfp
|
||||
can :manage, Event, program: { conference_id: conf_ids_for_cfp }
|
||||
can :manage, EventType, program: { conference_id: conf_ids_for_cfp }
|
||||
can :manage, Track, program: { conference_id: conf_ids_for_cfp }
|
||||
|
|
|
|||
76
app/models/booth.rb
Normal file
76
app/models/booth.rb
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
class Booth < ActiveRecord::Base
|
||||
include ActiveRecord::Transitions
|
||||
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
||||
|
||||
belongs_to :conference
|
||||
has_many :booth_requests, dependent: :destroy
|
||||
has_many :users, through: :booth_requests
|
||||
|
||||
has_one :submitter_booth_user, -> { where(role: 'submitter') }, class_name: 'BoothRequest'
|
||||
has_one :submitter, through: :submitter_booth_user, source: :user
|
||||
|
||||
has_many :responsibles_booth_user, -> { where(role: 'responsible') }, class_name: 'BoothRequest'
|
||||
has_many :responsibles, through: :responsibles_booth_user, source: :user
|
||||
|
||||
validates :title,
|
||||
uniqueness: { case_sensitive: false },
|
||||
presence: true
|
||||
|
||||
validates :description,
|
||||
:reasoning,
|
||||
:state,
|
||||
:responsibles,
|
||||
:conference_id,
|
||||
:website_url,
|
||||
:submitter_relationship,
|
||||
presence: true
|
||||
|
||||
mount_uploader :picture, PictureUploader, mount_on: :logo_link
|
||||
|
||||
state_machine initial: :new do
|
||||
state :new
|
||||
state :withdrawn
|
||||
state :to_accept
|
||||
state :accepted
|
||||
state :to_reject
|
||||
state :rejected
|
||||
state :canceled
|
||||
|
||||
event :restart do
|
||||
transitions to: :new, from: [:withdrawn, :to_accept, :to_reject, :canceled]
|
||||
end
|
||||
event :withdraw do
|
||||
transitions to: :withdrawn, from: [:new, :to_accept, :accepted, :to_reject, :rejected]
|
||||
end
|
||||
event :to_accept do
|
||||
transitions to: :to_accept, from: [:new, :to_reject]
|
||||
end
|
||||
event :to_reject do
|
||||
transitions to: :to_reject, from: [:new, :to_accept]
|
||||
end
|
||||
event :accept do
|
||||
transitions to: :accepted, from: [:new, :to_accept]
|
||||
end
|
||||
event :reject do
|
||||
transitions to: :rejected, from: [:new, :to_reject]
|
||||
end
|
||||
event :cancel do
|
||||
transitions to: :canceled, from: [:accepted, :rejected, :to_accept, :to_reject]
|
||||
end
|
||||
end
|
||||
|
||||
def transition_possible?(transition)
|
||||
self.class.state_machine.events_for(current_state).include?(transition)
|
||||
end
|
||||
|
||||
def update_state(transition, _notice)
|
||||
alert = ''
|
||||
begin
|
||||
send(transition)
|
||||
save
|
||||
rescue Transitions::InvalidTransition => e
|
||||
alert = "Update state failed. #{e.message}"
|
||||
end
|
||||
alert
|
||||
end
|
||||
end
|
||||
9
app/models/booth_request.rb
Normal file
9
app/models/booth_request.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class BoothRequest < ActiveRecord::Base
|
||||
belongs_to :booth
|
||||
belongs_to :user
|
||||
|
||||
validates :role,
|
||||
presence: true
|
||||
|
||||
ROLES = %w[submitter responsible].freeze
|
||||
end
|
||||
|
|
@ -28,6 +28,7 @@ class Conference < ActiveRecord::Base
|
|||
has_many :supporters, through: :ticket_purchases, source: :user
|
||||
has_many :tickets, dependent: :destroy
|
||||
has_many :resources, dependent: :destroy
|
||||
has_many :booths, dependent: :destroy
|
||||
|
||||
has_many :lodgings, dependent: :destroy
|
||||
has_many :registrations, dependent: :destroy
|
||||
|
|
|
|||
|
|
@ -4,4 +4,19 @@ class PhysicalTicket < ActiveRecord::Base
|
|||
has_one :conference, through: :ticket_purchase
|
||||
has_one :user, through: :ticket_purchase
|
||||
has_many :ticket_scannings
|
||||
|
||||
before_create :set_token
|
||||
|
||||
private
|
||||
|
||||
def set_token
|
||||
self.token = generate_token
|
||||
end
|
||||
|
||||
def generate_token
|
||||
loop do
|
||||
token = SecureRandom.hex(10)
|
||||
break token unless PhysicalTicket.exists?(token: token)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
class Subscription < ActiveRecord::Base
|
||||
validates :user_id, uniqueness: { scope: [:conference_id] }
|
||||
belongs_to :conference
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ class TicketPurchase < ActiveRecord::Base
|
|||
PhysicalTicket.transaction do
|
||||
quantity.times { physical_tickets.create }
|
||||
end
|
||||
Mailbot.ticket_confirmation_mail(self).deliver_later
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ class User < ActiveRecord::Base
|
|||
has_many :voted_events, through: :votes, source: :events
|
||||
has_many :subscriptions, dependent: :destroy
|
||||
has_many :tracks, foreign_key: 'submitter_id'
|
||||
has_many :booth_requests
|
||||
has_many :booth_requests, dependent: :destroy
|
||||
has_many :booths, through: :booth_requests
|
||||
accepts_nested_attributes_for :roles
|
||||
|
||||
scope :admin, -> { where(is_admin: true) }
|
||||
|
|
|
|||
81
app/pdfs/ticket_pdf.rb
Normal file
81
app/pdfs/ticket_pdf.rb
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
class TicketPdf < Prawn::Document
|
||||
def initialize(conference, user, physical_ticket, ticket_layout, file_name)
|
||||
super(page_layout: ticket_layout, page_size: 'A4', filename: file_name)
|
||||
@user = user
|
||||
@physical_ticket = physical_ticket
|
||||
@conference = conference
|
||||
|
||||
@left = bounds.left
|
||||
@right = bounds.right
|
||||
@mid_vertical = (bounds.top - bounds.bottom) / 2
|
||||
@mid_horizontal = (bounds.right - bounds.left) / 2
|
||||
@x = 0
|
||||
|
||||
draw_first_square
|
||||
draw_second_square
|
||||
draw_third_square
|
||||
draw_fourth_square
|
||||
end
|
||||
|
||||
def draw_first_square
|
||||
move_down @mid_vertical
|
||||
dash(2, space: 1)
|
||||
stroke_horizontal_rule
|
||||
stroke_vertical_line bounds.top, bounds.bottom, at: @mid_horizontal
|
||||
move_up @mid_vertical
|
||||
draw_text 'TICKET HOLDER', at: [@x, cursor - 30], size: 17
|
||||
dash(2, space: 0)
|
||||
stroke_rectangle [@x, cursor - 50], 230, 150
|
||||
move_down 80
|
||||
draw_text 'NAME', at: [@x + 10, cursor], size: 13
|
||||
fill_color '808080'
|
||||
draw_text @user.name.to_s, at: [@x + 10, cursor - 25], size: 20
|
||||
fill_color '000000'
|
||||
draw_text 'EMAIL', at: [@x + 10, cursor - 50], size: 13
|
||||
fill_color '808080'
|
||||
draw_text @user.email.to_s, at: [@x + 10, cursor - 75], size: 20
|
||||
fill_color '000000'
|
||||
move_up 20
|
||||
end
|
||||
|
||||
def draw_second_square
|
||||
if @conference.picture?
|
||||
if 7 * @conference.picture.image[:width] > 12 * @conference.picture.image[:height]
|
||||
image "#{Rails.root}/public#{@conference.picture_url}", at: [@mid_horizontal + 30, cursor], width: 120
|
||||
else
|
||||
image "#{Rails.root}/public#{@conference.picture_url}", at: [@mid_horizontal + 30, cursor], height: 70
|
||||
end
|
||||
else
|
||||
image "#{Rails.root}/public/img/osem-logo.png", at: [@mid_horizontal + 30, cursor], height: 70
|
||||
end
|
||||
move_down 70
|
||||
draw_text @conference.title.to_s, at: [@mid_horizontal + 30, cursor - 30], size: 12
|
||||
draw_text @conference.organization.name.to_s, at: [@mid_horizontal + 30, cursor - 50], size: 12
|
||||
draw_text @conference.venue.name.to_s, at: [@mid_horizontal + 30, cursor - 70]
|
||||
move_up 130
|
||||
move_down @mid_vertical
|
||||
end
|
||||
|
||||
def draw_third_square
|
||||
draw_text 'EVENT', at: [@x, cursor - 40], size: 15
|
||||
fill_color '808080'
|
||||
draw_text @conference.title.to_s, at: [@x, cursor - 60], size: 12
|
||||
draw_text @conference.start_date.strftime('%B %d, %Y').to_s, at: [@x, cursor - 80], size: 12
|
||||
move_down 80
|
||||
fill_color '000000'
|
||||
draw_text 'TICKET', at: [@x, cursor - 30], size: 15
|
||||
fill_color '808080'
|
||||
draw_text @physical_ticket.ticket.title.to_s, at: [@x, cursor - 50], size: 12
|
||||
move_down 50
|
||||
fill_color '000000'
|
||||
draw_text 'TICKET REF.', at: [@x, cursor - 30], size: 15
|
||||
fill_color '808080'
|
||||
draw_text @physical_ticket.ticket_purchase.id.to_s, at: [@x, cursor - 50], size: 12
|
||||
move_down 50
|
||||
fill_color '000000'
|
||||
draw_text 'Powered By OSEM', at: [(@mid_horizontal - @left - 100) / 2, cursor - 100], size: 11
|
||||
move_up 180
|
||||
end
|
||||
|
||||
def draw_fourth_square; end
|
||||
end
|
||||
29
app/views/admin/booths/_change_state_dropdown.html.haml
Normal file
29
app/views/admin/booths/_change_state_dropdown.html.haml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
- if booth.transition_possible? :accept
|
||||
%li= link_to 'Accept booth',
|
||||
accept_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, id: "accept_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :reject
|
||||
%li= link_to 'Reject booth',
|
||||
reject_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, confirm: 'Are you sure?', id: "reject_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :to_reject
|
||||
%li= link_to 'To reject booth',
|
||||
to_reject_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, confirm: 'Are you sure?', id: "to_reject_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :restart
|
||||
%li= link_to 'Start review',
|
||||
restart_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, id: "restart_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :to_accept
|
||||
%li= link_to 'To accept booth',
|
||||
to_accept_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, id: "to_accept_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :cancel
|
||||
%li= link_to 'Cancel booth',
|
||||
cancel_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, id: "cancel_booth_#{booth.id}"
|
||||
33
app/views/admin/booths/_form.html.haml
Normal file
33
app/views/admin/booths/_form.html.haml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%title Request a Booth
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@booth, url: @booth.new_record? ? admin_conference_booths_path(@conference.short_title) : admin_conference_booth_path(@conference.short_title, @booth.id), html: { multipart: true }) do |f|
|
||||
= f.input :title, as: :string, autofocus: true, required: true
|
||||
= f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
||||
hint: 'This field becomes public upon request acceptance'
|
||||
= f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
||||
label: 'How it fits the conference'
|
||||
= f.input :submitter_relationship, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
||||
label: 'Submitter\'s relation',
|
||||
hint: 'e.g. employee, comunity manager, etc'
|
||||
= f.input :website_url
|
||||
= responsibles_selector_input f
|
||||
= image_tag f.object.picture.thumb.url if f.object.picture?
|
||||
= f.input :picture
|
||||
|
||||
%p.text-right
|
||||
- if @booth.new_record?
|
||||
= f.submit 'Create Booth Request', class: 'btn btn-success'
|
||||
- else
|
||||
= f.submit 'Update Booth Request', class: 'btn btn-success'
|
||||
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
$('#booth_responsible_ids').selectize({
|
||||
plugins: ['remove_button'],
|
||||
minItems: 2
|
||||
} )
|
||||
});
|
||||
5
app/views/admin/booths/edit.html.haml
Normal file
5
app/views/admin/booths/edit.html.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
%h1
|
||||
Editing
|
||||
= @booth.title
|
||||
|
||||
= render 'form'
|
||||
59
app/views/admin/booths/index.html.haml
Normal file
59
app/views/admin/booths/index.html.haml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
Booths
|
||||
= "(#{@booths.length})" if @booths.any?
|
||||
.pull-right
|
||||
- if can? :create, Booth
|
||||
= link_to 'Add Booth', new_admin_conference_booth_path(@conference.short_title), class: 'button btn btn-primary'
|
||||
%p.text-muted
|
||||
All the booth requests
|
||||
.row
|
||||
.col-md-12
|
||||
.margin-booth-table
|
||||
%table.table.table-striped.table-bordered.table-hover.datatable
|
||||
%thead
|
||||
%th
|
||||
%b ID
|
||||
%th
|
||||
%b Logo
|
||||
%th
|
||||
%b Title
|
||||
%th
|
||||
%b Submitter
|
||||
%th
|
||||
%b Responsibles
|
||||
%th
|
||||
%b State
|
||||
%th
|
||||
%b Actions
|
||||
- @booths.each do |booth|
|
||||
%tr
|
||||
%td
|
||||
= booth.id
|
||||
%td
|
||||
- if booth.logo_link
|
||||
= image_tag(booth.picture.thumb.url, width: '20%')
|
||||
%td
|
||||
= link_to booth.title, admin_conference_booth_path(@conference.short_title, booth)
|
||||
%td
|
||||
= link_to booth.submitter.name, admin_user_path(booth.submitter) if booth.submitter
|
||||
%td
|
||||
.responsibles
|
||||
- booth.responsibles.each do |responsible|
|
||||
= link_to responsible.name, admin_user_path(responsible)
|
||||
%td
|
||||
.btn-group
|
||||
%button{ type: 'button', class: 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown' }
|
||||
= booth.state.humanize
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
= render 'change_state_dropdown', booth: booth
|
||||
%td
|
||||
.btn-group{ role: "group" }
|
||||
= link_to 'Edit', edit_admin_conference_booth_path(@conference.short_title, booth.id),
|
||||
class: 'btn btn-primary'
|
||||
= link_to 'Delete', admin_conference_booth_path(@conference.short_title, booth.id),
|
||||
method: :delete, class: 'btn btn-danger',
|
||||
data: {confirm: "Do you really want to delete this booth request?"}
|
||||
3
app/views/admin/booths/new.html.haml
Normal file
3
app/views/admin/booths/new.html.haml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
%h1 New booth
|
||||
|
||||
= render 'form'
|
||||
57
app/views/admin/booths/show.html.haml
Normal file
57
app/views/admin/booths/show.html.haml
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
.row
|
||||
.col-md-12
|
||||
%h3
|
||||
= image_tag(@booth.picture.thumb.url, size: '20%', alt: '')
|
||||
= @booth.title
|
||||
.btn-group.pull-right
|
||||
= link_to 'Edit', edit_admin_conference_booth_path(@conference.short_title, @booth), class: 'btn btn-mini btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Description
|
||||
%td
|
||||
= markdown(@booth.description)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Reasoning
|
||||
%td
|
||||
= markdown(@booth.reasoning)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Website
|
||||
%td
|
||||
- if @booth.website_url.present?
|
||||
= link_to @booth.website_url, @booth.website_url
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Submitter
|
||||
%td
|
||||
= link_to @booth.submitter.name, admin_user_path(@booth.submitter)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Submitter's relationship
|
||||
%td
|
||||
= @booth.submitter_relationship
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Responsibles
|
||||
%td
|
||||
- @booth.responsibles.each do |responsibles|
|
||||
.responsibles
|
||||
= link_to responsibles.name, admin_user_path(responsibles)
|
||||
(
|
||||
= responsibles.email
|
||||
)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Submitted on
|
||||
%td
|
||||
= @booth.created_at
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Last updated on
|
||||
%td
|
||||
= @booth.updated_at
|
||||
|
|
@ -1,6 +1,23 @@
|
|||
.text-center
|
||||
%h4 #{title}
|
||||
%canvas.doughnut_chart{ 'data-chart' => data.to_json }
|
||||
%canvas.doughnut_chart{ id: "dough_#{title}", 'data-chart' => data.to_json }
|
||||
- if data
|
||||
- data.each do |key, value|
|
||||
%span{ 'style' => "border-bottom: 3px solid #{value['color']}" } #{key}: #{value['value']}
|
||||
|
||||
:javascript
|
||||
$(document).ready( function(){
|
||||
|
||||
var d = $("#dough_#{title}");
|
||||
var dt = d.get(0).getContext('2d');
|
||||
|
||||
$(window).resize( respondCanvas );
|
||||
|
||||
function respondCanvas(){
|
||||
dt.canvas.width = 150;
|
||||
dt.canvas.height = 150;
|
||||
}
|
||||
|
||||
respondCanvas();
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -27,3 +27,21 @@
|
|||
%span{ 'style' => "border-bottom: 3px solid #{conference[:color]};", 'data-chart' => "#{name}" }
|
||||
%input{ 'type' => 'checkbox', 'name' => "#{conference[:short_title]}" }
|
||||
#{conference[:short_title]}
|
||||
|
||||
:javascript
|
||||
$(document).ready( function(){
|
||||
|
||||
var c = $("#line_chart_#{name}");
|
||||
var ct = c.get(0).getContext('2d');
|
||||
var container = $(c).parent();
|
||||
|
||||
$(window).resize( respondCanvas );
|
||||
|
||||
function respondCanvas(){
|
||||
c.attr('width', $(container).width() );
|
||||
c.attr('height', $(container).height() );
|
||||
}
|
||||
|
||||
respondCanvas();
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@
|
|||
.btn-group
|
||||
= link_to 'Show',
|
||||
conference_physical_ticket_path(@conference.short_title,
|
||||
physical_ticket.id),
|
||||
physical_ticket.token),
|
||||
class: 'btn btn-primary'
|
||||
= link_to 'Generate PDF',
|
||||
conference_physical_ticket_path(@conference.short_title,
|
||||
physical_ticket.id,
|
||||
format: :pdf),
|
||||
physical_ticket.token,
|
||||
format: :pdf),
|
||||
class: 'button btn btn-default btn-info'
|
||||
- else
|
||||
%h5 No Tickets sold!
|
||||
|
|
|
|||
|
|
@ -80,6 +80,12 @@
|
|||
= link_if_alive version, 'contact details',
|
||||
edit_admin_conference_contact_path(conference_id: Conference.find(version.conference_id).short_title)
|
||||
|
||||
- when 'Booth'
|
||||
= 'booth'
|
||||
- booth = current_or_last_object_state(version.item_type, version.item_id)
|
||||
= link_if_alive version, booth.title,
|
||||
admin_conference_booth_path(conference_id: Conference.find(version.conference_id).short_title, id: version.item_id )
|
||||
|
||||
- when 'Program'
|
||||
= link_if_alive version, 'program',
|
||||
admin_conference_program_path(conference_id: Conference.find(version.conference_id).short_title)
|
||||
|
|
|
|||
|
|
@ -60,13 +60,13 @@
|
|||
.dropdown-menu
|
||||
- if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||
= form_tag User.ichain_login_url do
|
||||
= text_field_tag 'username', nil, id: 'user_ichain_email_dd', placeholder: 'Username'
|
||||
= password_field_tag 'password', nil, id: 'user_ichain_password_dd', placeholder: 'Password'
|
||||
= text_field_tag 'username', nil, id: 'user_ichain_email_dd', class: 'form-control', placeholder: 'Username'
|
||||
= password_field_tag 'password', nil, id: 'user_ichain_password_dd', class: 'form-control', placeholder: 'Password'
|
||||
%button.btn.btn-success.btn-block Sign in
|
||||
- else
|
||||
= form_tag new_user_session_path do
|
||||
= text_field_tag 'user[login]', nil, id: 'user_login_dd', placeholder: 'Username / E-Mail'
|
||||
= password_field_tag 'user[password]', nil, id: 'user_password_dd', placeholder: 'Password'
|
||||
= text_field_tag 'user[login]', nil, id: 'user_login_dd', class: 'form-control', placeholder: 'Username / E-Mail'
|
||||
= password_field_tag 'user[password]', nil, id: 'user_password_dd', class: 'form-control', placeholder: 'Password'
|
||||
%p.text-right
|
||||
%small
|
||||
%label{for: 'user_remember_me'} Remember me
|
||||
|
|
|
|||
8
app/views/mailbot/ticket_confirmation_template.text.erb
Normal file
8
app/views/mailbot/ticket_confirmation_template.text.erb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Dear <%= @user.name %>,
|
||||
|
||||
Thanks! You have successfully booked <%= @ticket_purchase.quantity %> <%= @ticket_purchase.ticket.title %> ticket(s) for the event <%= @conference.title %>. Your transaction id is <%= @ticket_purchase.id %>.
|
||||
|
||||
Please, find the ticket(s) pdf attached.
|
||||
|
||||
Best wishes,
|
||||
<%= @conference.title %> Team
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
.btn-group
|
||||
= link_to 'Show',
|
||||
conference_physical_ticket_path(@conference.short_title,
|
||||
physical_ticket.id),
|
||||
physical_ticket.token),
|
||||
class: 'btn btn-primary'
|
||||
= link_to 'Generate PDF',
|
||||
conference_physical_ticket_path(@conference.short_title,
|
||||
physical_ticket.id,
|
||||
physical_ticket.token,
|
||||
format: :pdf),
|
||||
class: 'button btn btn-default btn-info'
|
||||
- else
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
.container
|
||||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
Ticket for
|
||||
= @conference.title
|
||||
%p.text-muted
|
||||
- if @conference.venue
|
||||
at
|
||||
%strong
|
||||
#{@conference.venue.name},
|
||||
#{@conference.venue.street},
|
||||
#{@conference.venue.city} / #{@conference.venue.country_name}.
|
||||
%small
|
||||
= date_string(@conference.start_date, @conference.end_date)
|
||||
.row
|
||||
.col-md-5.box.well
|
||||
%h3.text-center
|
||||
Ticket Holder
|
||||
%p.text-left
|
||||
%strong
|
||||
Name
|
||||
%br
|
||||
= @user.name
|
||||
%br
|
||||
%br
|
||||
%strong
|
||||
Email
|
||||
%br
|
||||
= @user.email
|
||||
.col-md-5.col-md-offset-2.box.well
|
||||
- if @conference.picture?
|
||||
- width = @conference.picture.image[:width]
|
||||
- height = @conference.picture.image[:height]
|
||||
- if 10 * width > 15 * height
|
||||
= image_tag(@conference.picture_url, width: '150')
|
||||
- else
|
||||
= image_tag(@conference.picture_url, height: '100')
|
||||
- else
|
||||
= image_tag('/img/osem-logo.png', class: 'img-responsive')
|
||||
%p.text-left
|
||||
%br
|
||||
%strong
|
||||
Organization
|
||||
%br
|
||||
= @conference.organization.name
|
||||
.col-md-5.box.well
|
||||
%p.text-left
|
||||
%strong
|
||||
Event
|
||||
%br
|
||||
= @conference.title
|
||||
%br
|
||||
= @conference.start_date.strftime('%B %d, %Y')
|
||||
%br
|
||||
%br
|
||||
%strong
|
||||
Ticket
|
||||
%br
|
||||
= @physical_ticket.ticket.title
|
||||
%br
|
||||
%br
|
||||
%strong
|
||||
Ticket Ref.
|
||||
%br
|
||||
= @physical_ticket.ticket_purchase.id
|
||||
%br
|
||||
.col-md-5.col-md-offset-2.box.well
|
||||
.row
|
||||
.col-md-12
|
||||
%p.text-left
|
||||
= link_to 'Generate PDF',
|
||||
conference_physical_ticket_path(@conference.short_title,
|
||||
@physical_ticket.token,
|
||||
format: :pdf),
|
||||
class: 'button btn btn-default btn-info'
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
prawn_document(filename: @file_name, page_layout: @ticket_layout, :page_size =>'A4' ) do |pdf|
|
||||
# Vertical Layout
|
||||
top = pdf.bounds.top
|
||||
bottom = pdf.bounds.bottom
|
||||
left = pdf.bounds.left
|
||||
right = pdf.bounds.right
|
||||
mid_vertical = (pdf.bounds.top-pdf.bounds.bottom)/2
|
||||
mid_horizontal = (pdf.bounds.right-pdf.bounds.left)/2
|
||||
x = 0
|
||||
|
||||
pdf.move_down mid_vertical
|
||||
pdf.dash(2, :space => 1)
|
||||
pdf.stroke_horizontal_rule
|
||||
pdf.stroke_vertical_line pdf.bounds.top, pdf.bounds.bottom, :at => mid_horizontal
|
||||
pdf.move_up mid_vertical
|
||||
pdf.draw_text "TICKET HOLDER", :at => [x,pdf.cursor-30], :size => 17
|
||||
pdf.dash(2, :space => 0)
|
||||
pdf.stroke_rectangle [x, pdf.cursor-50], 230, 150
|
||||
pdf.move_down 80
|
||||
pdf.draw_text "NAME", :at => [x+10,pdf.cursor], :size => 13
|
||||
pdf.fill_color "808080"
|
||||
pdf.draw_text "#{@user.name}", :at => [x+10,pdf.cursor-25], size: 20
|
||||
pdf.fill_color "000000"
|
||||
pdf.draw_text "EMAIL", :at => [x+10,pdf.cursor-50], :size => 13
|
||||
pdf.fill_color "808080"
|
||||
pdf.draw_text "#{@user.email}", :at => [x+10,pdf.cursor-75], size: 20
|
||||
pdf.fill_color "000000"
|
||||
pdf.move_up 20
|
||||
if @conference.picture?
|
||||
if 7 * @conference.picture.image[:width] > 12 * @conference.picture.image[:height]
|
||||
pdf.image "#{Rails.root}/public#{@conference.picture_url}", :at => [mid_horizontal+30, pdf.cursor], :width => 120
|
||||
else
|
||||
pdf.image "#{Rails.root}/public#{@conference.picture_url}", :at => [mid_horizontal+30, pdf.cursor], :height => 70
|
||||
end
|
||||
else
|
||||
pdf.image "#{Rails.root}/public/img/osem-logo.png", :at => [mid_horizontal+30, pdf.cursor], :height => 70
|
||||
end
|
||||
pdf.move_down 70
|
||||
pdf.draw_text "#{@conference.title}", :at => [mid_horizontal+30,pdf.cursor-30], :size => 12
|
||||
pdf.draw_text "#{@conference.organization.name}", :at => [mid_horizontal+30,pdf.cursor-50], :size => 12
|
||||
pdf.draw_text "#{@conference.venue.name}", :at => [mid_horizontal+30,pdf.cursor-70]
|
||||
pdf.move_up 130
|
||||
pdf.move_down mid_vertical
|
||||
pdf.draw_text "EVENT", :at => [x,pdf.cursor-40], :size => 15
|
||||
pdf.fill_color "808080"
|
||||
pdf.draw_text "#{@conference.title}", :at => [x,pdf.cursor-60], size: 12
|
||||
pdf.draw_text "#{@conference.start_date.strftime('%B %d, %Y')}", :at => [x,pdf.cursor-80], size: 12
|
||||
pdf.move_down 80
|
||||
pdf.fill_color "000000"
|
||||
pdf.draw_text "TICKET", :at => [x,pdf.cursor-30], :size => 15
|
||||
pdf.fill_color "808080"
|
||||
pdf.draw_text "#{@physical_ticket.ticket.title}", :at => [x,pdf.cursor-50], size: 12
|
||||
pdf.move_down 50
|
||||
pdf.fill_color "000000"
|
||||
pdf.draw_text "TICKET REF.", :at => [x,pdf.cursor-30], :size => 15
|
||||
pdf.fill_color "808080"
|
||||
pdf.draw_text "#{@physical_ticket.ticket_purchase.id}", :at => [x,pdf.cursor-50], size: 12
|
||||
pdf.move_down 50
|
||||
pdf.fill_color "000000"
|
||||
pdf.draw_text "Powered By OSEM", :at => [(mid_horizontal-left-100)/2,pdf.cursor-100], :size => 11
|
||||
pdf.move_up 180
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue