Merge branch 'master' into render_show_if_one_conf

This commit is contained in:
James Mason 2017-11-14 12:37:21 -08:00 committed by GitHub
commit 747ecc80e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 822 additions and 115 deletions

View file

@ -16,6 +16,12 @@ RUN cd /usr/bin && \
tar -xf dockerize.tar.gz && \
rm dockerize.tar.gz
# dumb-init for a proper PID 1
RUN cd /tmp && \
wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
dpkg -i dumb-init_1.2.0_amd64.deb && \
rm dumb-init_1.2.0_amd64.deb
# explicitly add Gemfile and install dependencies using bundler to make use of
# Docker's caching
WORKDIR /osem/
@ -25,12 +31,13 @@ RUN bundle install --without test development
# add OSEM files and prepare them for use inside a Docker container
COPY . /osem/
RUN chown osem.osem /osem/ -R && \
RUN chown -R osem.root /osem/ && \
chmod -R g=u /osem/ && \
mv /osem/config/database.yml.docker /osem/config/database.yml
# data directory is used to cache the secret key in a file
ENV DATA_DIR /data
RUN install -d -m 0700 -o osem $DATA_DIR
RUN install -d -m 0770 -o osem -g root $DATA_DIR
VOLUME ["$DATA_DIR"]
USER osem
@ -42,4 +49,7 @@ COPY docker/init.sh /init.sh
# from a webserver
ENV RAILS_SERVE_STATIC_FILES 1
# Runs "/usr/bin/dumb-init -- /my/script --with --args"
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["bash", "/init.sh"]

View file

@ -11,7 +11,7 @@ function update_price($this){
$('.total_row').each(function( index ) {
total += parseFloat($(this).text());
});
$('#total_price').text(total);
$('#total_price').text(total.toFixed(2));
}
$( document ).ready(function() {

View file

@ -3,7 +3,24 @@ module Admin
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference
def index; end
def index
@file_name = "booths_for_#{@conference.short_title}"
@booth_export_option = params[:booth_export_option]
respond_to do |format|
format.html
# Explicity call #to_json to avoid the use of EventSerializer
format.json { render json: Booth.where(state: :confirmed, program: @program).to_json }
format.xlsx do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
render 'booths'
end
format.pdf { render 'booths' }
format.csv do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
render 'booths'
end
end
end
def show; end

View file

@ -55,7 +55,7 @@ module Admin
private
def cfp_params
params.require(:cfp).permit(:start_date, :end_date, :cfp_type)
params.require(:cfp).permit(:start_date, :end_date, :description, :cfp_type)
end
end
end

View file

@ -193,6 +193,7 @@ module Admin
def edit
@conferences = Conference.all
@date_string = date_string(@conference.start_date, @conference.end_date)
@affected_event_count = @conference.program.events.scheduled(@conference.program.selected_schedule_id).count
respond_to do |format|
format.html
format.json { render json: @conference.to_json }

View file

@ -7,7 +7,25 @@ module Admin
# Show flash message with ajax calls
after_action :prepare_unobtrusive_flash, only: :toggle_cfp_inclusion
def index; end
def index
@file_name = "tracks_for_#{@conference.short_title}"
@track_export_option = params[:track_export_option]
respond_to do |format|
format.html
# Explicity call #to_json to avoid the use of EventSerializer
format.json { render json: Track.where(state: :confirmed, program: @program).to_json }
format.xlsx do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
render 'tracks'
end
format.pdf { render 'tracks' }
format.csv do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
render 'tracks'
end
end
end
def show
respond_to do |format|

View file

@ -27,8 +27,9 @@ class ConferenceRegistrationsController < ApplicationController
end
def show
@total_price = Ticket.total_price(@conference, current_user, paid: true)
@total_price = Ticket.total_price_user(@conference, current_user, paid: true)
@tickets = current_user.ticket_purchases.by_conference(@conference).paid
@total_price_per_ticket = @tickets.group(:ticket_id).sum('amount_paid * quantity')
@ticket_payments = @tickets.group_by(&:ticket_id)
@total_quantity = @tickets.group(:ticket_id).sum(:quantity)
end

View file

@ -4,4 +4,10 @@ class OrganizationsController < ApplicationController
def index
@organizations = Organization.all
end
def conferences
@current = @organization.conferences.upcoming.reorder(start_date: :asc)
@antiquated = @organization.conferences.past
render '/conferences/index'
end
end

View file

@ -163,6 +163,12 @@ module ApplicationHelper
end
end
def rescheduling_hint(affected_event_count)
if affected_event_count > 0
"You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours."
end
end
##
# ====Gets
# a conference object
@ -171,4 +177,18 @@ module ApplicationHelper
def hidden_if_conference_over(conference)
'hidden' if Date.today > conference.end_date
end
def nav_root_link_for(conference)
link_text = (
conference.try(:organization).try(:name) ||
ENV['OSEM_NAME'] ||
'OSEM'
)
link_to(
link_text,
root_path,
class: 'navbar-brand',
title: 'Open Source Event Manager'
)
end
end

View file

@ -15,7 +15,7 @@ class Ability
# Abilities for not signed in users (guests)
def not_signed_in
can [:index], Organization
can [:index, :conferences], Organization
can [:index], Conference
can [:show], Conference do |conference|
conference.splashpage && conference.splashpage.public == true

View file

@ -496,7 +496,7 @@ class Conference < ActiveRecord::Base
if tickets && ticket_purchases
tickets.each do |ticket|
result[ticket.title] = {
'value' => ApplicationController.helpers.humanized_money(ticket.tickets_turnover).delete(',').to_i,
'value' => ApplicationController.helpers.humanized_money(ticket.tickets_turnover_total(ticket.id)).delete(',').to_i,
'color' => "\##{Digest::MD5.hexdigest(ticket.title)[0..5]}"
}
end

View file

@ -204,11 +204,12 @@ class Event < ActiveRecord::Base
end
def speaker_names
result = Set.new
speakers.each do |speaker|
result.add(speaker.name)
end
result.to_a.to_sentence
speakers.map(&:name).join(', ')
end
# Returns emails of all the speaker belongs to a particular event
def speaker_emails
speakers.map(&:email).join(', ')
end
##

View file

@ -42,7 +42,8 @@ class Program < ActiveRecord::Base
has_many :event_schedules, through: :events
has_many :event_users, through: :events
has_many :speakers, -> { distinct }, through: :event_users, source: :user do
has_many :program_events_speakers, -> {where(event_role: 'speaker')}, through: :events, source: :event_users
has_many :speakers, -> { distinct }, through: :program_events_speakers, source: :user do
def confirmed
joins(:events).where(events: { state: :confirmed })
end

View file

@ -55,12 +55,18 @@ class Ticket < ActiveRecord::Base
result ? result : Money.new(0, 'USD')
end
def tickets_sold
ticket_purchases.paid.sum(:quantity)
def self.total_price_user(conference, user, paid: false)
tickets = TicketPurchase.where(conference: conference, user: user, paid: paid)
tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
end
def tickets_turnover
tickets_sold * price
def tickets_turnover_total(id)
tickets = TicketPurchase.where(ticket_id: id)
tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
end
def tickets_sold
ticket_purchases.paid.sum(:quantity)
end
private

View file

@ -52,7 +52,8 @@ class TicketPurchase < ActiveRecord::Base
purchase = new(ticket_id: ticket.id,
conference_id: conference.id,
user_id: user.id,
quantity: quantity)
quantity: quantity,
amount_paid: ticket.price)
purchase.pay(nil) if ticket.price_cents.zero?
end
purchase

View file

@ -0,0 +1,19 @@
- headers = ['Booth ID',
'Title',
'Description',
'Reasoning',
'Submitter Name',
'Submitter Relationship',
'Website Url',
'State']
= CSV.generate_line ['All booths']
= CSV.generate_line headers
- @booths.each do |booth|
= CSV.generate_line([booth.id,
booth.title,
booth.description,
booth.reasoning,
booth.submitter.name,
booth.submitter_relationship,
booth.website_url,
booth.state]).html_safe

View file

@ -0,0 +1,26 @@
prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf|
booths_array = []
header_array = ['Booth ID',
'Title',
'Description',
'Reasoning',
'Submitter Name',
'Submitter Relationship',
'Website Url',
'State']
booths_array << header_array
@booths.each do |booth|
row = []
row << booth.id
row << booth.title
row << booth.description
row << booth.reasoning
row << booth.submitter.name
row << booth.submitter_relationship
row << booth.website_url
row << booth.state
booths_array << row
end
pdf.text "#{@conference.short_title} booths", font_size: 25, align: :center
pdf.table booths_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [45,70,153,152,70,80,105,45]
end

View file

@ -0,0 +1,27 @@
wb.add_worksheet(name: 'all booths') do |sheet|
bold_style = wb.styles.add_style(b: true)
wrap_text = wb.styles.add_style alignment: {wrap_text: true}
row = ['Booth ID',
'Title',
'Description',
'Reasoning',
'Submitter Name',
'Submitter Relationship',
'Website Url',
'State']
sheet.add_row row, style: bold_style
@booths.each do |booth|
row = []
row << booth.id
row << booth.title
row << booth.description
row << booth.reasoning
row << booth.submitter.name
row << booth.submitter_relationship
row << booth.website_url
row << booth.state
sheet.add_row row , style: wrap_text
sheet.column_widths 10,20,35,35,20,30,35,10
end
end

View file

@ -0,0 +1,19 @@
- headers = ['Booth ID',
'Title',
'Description',
'Reasoning',
'Submitter Name',
'Submitter Relationship',
'Website Url',
'State']
= CSV.generate_line ['All booths']
= CSV.generate_line headers
- @booths.confirmed.each do |booth|
= CSV.generate_line([booth.id,
booth.title,
booth.description,
booth.reasoning,
booth.submitter.name,
booth.submitter_relationship,
booth.website_url,
booth.state]).html_safe

View file

@ -0,0 +1,26 @@
prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf|
booths_array = []
header_array = ['Booth ID',
'Title',
'Description',
'Reasoning',
'Submitter Name',
'Submitter Relationship',
'Website Url',
'State']
booths_array << header_array
@booths.confirmed.each do |booth|
row = []
row << booth.id
row << booth.title
row << booth.description
row << booth.reasoning
row << booth.submitter.name
row << booth.submitter_relationship
row << booth.website_url
row << booth.state
booths_array << row
end
pdf.text "#{@conference.short_title} booths", font_size: 25, align: :center
pdf.table booths_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [45,70,153,152,70,80,105,45]
end

View file

@ -0,0 +1,27 @@
wb.add_worksheet(name: 'all booths') do |sheet|
bold_style = wb.styles.add_style(b: true)
wrap_text = wb.styles.add_style alignment: {wrap_text: true}
row = ['Booth ID',
'Title',
'Description',
'Reasoning',
'Submitter Name',
'Submitter Relationship',
'Website Url',
'State']
sheet.add_row row, style: bold_style
@booths.confirmed.each do |booth|
row = []
row << booth.id
row << booth.title
row << booth.description
row << booth.reasoning
row << booth.submitter.name
row << booth.submitter_relationship
row << booth.website_url
row << booth.state
sheet.add_row row , style: wrap_text
sheet.column_widths 10,20,35,35,20,30,35,10
end
end

View file

@ -0,0 +1,4 @@
- if @booth_export_option == 'confirmed'
= render 'confirmed_booths'
- elsif @booth_export_option == 'all'
= render 'all_booths'

View file

@ -0,0 +1,5 @@
if @booth_export_option == 'confirmed'
render 'confirmed_booths'
elsif @booth_export_option == 'all'
render 'all_booths'
end

View file

@ -0,0 +1,7 @@
wb = xlsx_package.workbook
xlsx_package.use_autowidth = true
if @booth_export_option == 'confirmed'
render partial: 'confirmed_booths', locals: { wb: wb }
elsif @booth_export_option == 'all'
render partial: 'all_booths', locals: { wb: wb }
end

View file

@ -3,6 +3,30 @@
.page-header
%h1
Booths
.pull-right
- if can? :read, Booth
.btn-group
.btn-group
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
Export PDF
%span.caret
%ul.dropdown-menu{ role: 'menu' }
%li= link_to 'All Booths', admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'all')
%li= link_to 'Confirmed Booths', admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'confirmed')
.btn-group
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
Export CSV
%span.caret
%ul.dropdown-menu{ role: 'menu' }
%li= link_to 'All', admin_conference_booths_path(@conference.short_title, format: :csv, booth_export_option: 'all')
%li= link_to 'Confirmed', admin_conference_booths_path(@conference.short_title, format: :csv, booth_export_option: 'confirmed')
.btn-group
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
Export XLS
%span.caret
%ul.dropdown-menu{ role: 'menu' }
%li= link_to 'All', admin_conference_booths_path(@conference.short_title, format: :xlsx, booth_export_option: 'all')
%li= link_to 'Confirmed', admin_conference_booths_path(@conference.short_title, format: :xlsx, booth_export_option: 'confirmed')
= "(#{@booths.length})" if @booths.any?
%p.text-muted
All the booth requests

View file

@ -11,6 +11,10 @@
%dd
= @cfp.end_date.strftime('%A, %B %e. %Y')
%dt
Days Left:
Description
%dd
= markdown(@cfp.description)
%dt
Days Left
%dd
= pluralize(@cfp.remaining_days, 'day')

View file

@ -10,6 +10,10 @@
End Date:
%dd#end_date
= @cfp.end_date.strftime('%A, %B %-d. %Y')
%dt
Description:
%dd#description
= markdown(@cfp.description)
%dt
Days Left:
%dd

View file

@ -8,5 +8,6 @@
= f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly' }
= f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' }
= f.input :cfp_type, as: :select, collection: (@cfp.new_record? ? @program.remaining_cfp_types : [@cfp.cfp_type] + @program.remaining_cfp_types).map {|type| ["#{type.capitalize}", type]}, include_blank: false, label: 'Type', input_html: { class: 'select-help-toggle' }
= f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, hint: markdown_hint
%p.text-right
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -10,6 +10,10 @@
End Date:
%dd#end_date
= @cfp.end_date.strftime('%A, %B %-d. %Y')
%dt
Description:
%dd#description
= markdown(@cfp.description)
%dt
Days Left:
%dd

View file

@ -12,6 +12,7 @@
%th Type
%th Start Date
%th End Date
%th Description
%th Days Left
%th Actions
%tbody
@ -24,6 +25,9 @@
= cfp.start_date.strftime('%A, %B %-d. %Y')
%td
= cfp.end_date.strftime('%A, %B %-d. %Y')
%td
%p
= markdown(truncate(cfp.description))
%td
= pluralize(cfp.remaining_days, 'day')
%td

View file

@ -22,11 +22,11 @@
= f.input :timezone, as: :time_zone, hint: 'The conference time zone'
= f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', readonly: 'readonly' }
= f.input :end_date, as: :string, input_html: { id: 'conference-end-datepicker', readonly: 'readonly' }
= f.input :start_hour, input_html: {size: 2, type: 'number', min: 0, max: 23}
= f.input :end_hour, input_html: {size: 2, type: 'number', min: 1, max: 24}
= f.input :start_hour, input_html: {size: 2, type: 'number', min: 0, max: 23}, hint: rescheduling_hint(@affected_event_count)
= f.input :end_hour, input_html: {size: 2, type: 'number', min: 1, max: 24}, hint: rescheduling_hint(@affected_event_count)
= f.inputs name: 'Registrations' do
= f.input :registration_limit, as: :number, in: 0..9999, hint: 'Limit the number of registrations to the conference (0 no limit). Please note that the registration limit doesn\'t apply to speakers of confirmed events (they will still be able to register even if it has been reached). You currently have ' + pluralize(@conference.registrations.count, 'registration')
= f.inputs name: 'Booths' do
= f.input :booth_limit, as: :number, in: 0..9999,
hint: 'Booth limit is the maximum number of booths that you can accept for this conference. By setting this number (0 no limit) you can be sure that you are not going to accept more booths than the conference can accommodate. You currently have ' + pluralize(@conference.booths.accepted.count, 'accepted booth') +'.'
= f.action :submit, as: :button, button_html: {class: 'btn btn-primary'}
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary', data: { confirm: 'Are you sure you want to proceed?' } }

View file

@ -4,6 +4,7 @@
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
@ -12,8 +13,15 @@
= CSV.generate_line ['All Events']
= CSV.generate_line headers
- @events.each do |event|
= CSV.generate_line([event.id, event.title, event.abstract, (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : ''),
event.submitter.name, event.speaker_names, event.event_type.title,
= CSV.generate_line([event.id,
event.title,
event.abstract,
(event.time.present? ? "#{event.time.strftime("%Y-%m-%d")}#{event.time.strftime("%I:%M%p")} " : ''),
event.submitter.name,
event.speaker_names,
event.speaker_emails,
event.event_type.title,
(event.track.present? ? event.track.name : ''),
(event.difficulty_level.present? ? event.difficulty_level.title : ''),
(event.room.present? ? event.room.name : ''), event.state]).html_safe
(event.room.present? ? event.room.name : ''),
event.state]).html_safe

View file

@ -6,6 +6,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
@ -21,6 +22,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '')
row << event.submitter.name
row << event.speaker_names
row << event.speaker_emails
row << event.event_type.title
row << (event.track.present? ? event.track.name : '')
row << (event.difficulty_level.present? ? event.difficulty_level.title : '')
@ -30,5 +32,5 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
end
pdf.text "#{@conference.short_title} Events", font_size: 25, align: :center
pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1}
pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [40,60,90,50,70,65,85,50,55,50,60,45]
end

View file

@ -1,6 +1,18 @@
wb.add_worksheet(name: 'all events') do |sheet|
bold_style = wb.styles.add_style(b: true)
row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'Event Type', 'Track', 'Difficulty Level', 'Room', 'State']
wrap_text = wb.styles.add_style alignment: {wrap_text: true}
row = ['Event ID',
'Title',
'Abstract',
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
'Room',
'State']
sheet.add_row row, style: bold_style
@events.each do |event|
@ -11,11 +23,13 @@ wb.add_worksheet(name: 'all events') do |sheet|
row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '')
row << event.submitter.name
row << event.speaker_names
row << event.speaker_emails
row << event.event_type.title
row << (event.track.present? ? event.track.name : '')
row << (event.difficulty_level.present? ? event.difficulty_level.title : '')
row << (event.room.present? ? event.room.name : '')
row << event.state
sheet.add_row row
sheet.add_row row , style: wrap_text
sheet.column_widths 10,15,35,13,18,18,28,12,15,15,15,10
end
end

View file

@ -4,6 +4,7 @@
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
@ -16,8 +17,17 @@
- all_comments = ''
- event.root_comments.each do |comment|
- all_comments << "#{comment.created_at.strftime("%Y-%m-%d")} #{comment.created_at.strftime("%I:%M%p")} #{comment.user.name}: #{comment.body}\n"
= CSV.generate_line([event.id, event.title, event.abstract, (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : ''),
event.submitter.name, event.speaker_names, event.event_type.title,
= CSV.generate_line([event.id,
event.title,
event.abstract,
(event.time.present? ? "#{event.time.strftime("%Y-%m-%d")}#{event.time.strftime("%I:%M%p")} " : ''),
event.submitter.name,
event.speaker_names,
event.speaker_emails,
event.event_type.title,
(event.track.present? ? event.track.name : ''),
(event.difficulty_level.present? ? event.difficulty_level.title : ''),
(event.room.present? ? event.room.name : ''), event.state, all_comments]).html_safe
(event.room.present? ? event.room.name : ''),
event.state,
all_comments]).html_safe

View file

@ -6,6 +6,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
@ -21,6 +22,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '')
row << event.submitter.name
row << event.speaker_names
row << event.speaker_emails
row << event.event_type.title
row << (event.track.present? ? event.track.name : '')
row << (event.difficulty_level.present? ? event.difficulty_level.title : '')
@ -31,7 +33,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
pdf.text "#{@conference.short_title} Events", font_size: 25, align: :center
pdf.move_down 10
pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1, position: :center}
pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1, position: :center},column_widths: [40,60,90,50,70,65,85,50,55,50,60,45]
pdf.start_new_page
pdf.text "#{@conference.short_title} Comments", font_size: 25, align: :center
pdf.move_down 20

View file

@ -1,8 +1,20 @@
wb.use_shared_strings = true
wb.add_worksheet(name: 'events with comments') do |sheet|
bold_style = wb.styles.add_style(b: true )
bold_style = wb.styles.add_style(b: true)
cell_style = wb.styles.add_style(alignment: { wrap_text: true, vertical: :top })
row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'Event Type', 'Track', 'Difficulty Level', 'Room', 'State', 'Comments']
row = ['Event ID',
'Title',
'Abstract',
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
'Room',
'State',
'Comments']
sheet.add_row row, style: bold_style
@events.each do |event|
@ -17,6 +29,7 @@ row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'E
row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '')
row << event.submitter.name
row << event.speaker_names
row << event.speaker_emails
row << event.event_type.title
row << (event.track.present? ? event.track.name : '')
row << (event.difficulty_level.present? ? event.difficulty_level.title : '')
@ -24,5 +37,6 @@ row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'E
row << event.state
row << all_comments.strip
sheet.add_row row, style: cell_style
sheet.column_widths 10,15,35,13,18,18,28,12,15,15,15,10
end
end

View file

@ -4,6 +4,7 @@
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
@ -12,8 +13,15 @@
= CSV.generate_line ["Confirmed Events"]
= CSV.generate_line headers
- @events.confirmed.each do |event|
= CSV.generate_line([event.id, event.title, event.abstract, (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : ''),
event.submitter.name, event.speaker_names, event.event_type.title,
= CSV.generate_line([event.id,
event.title,
event.abstract,
(event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : ''),
event.submitter.name,
event.speaker_names,
event.speaker_emails,
event.event_type.title,
(event.track.present? ? event.track.name : ''),
(event.difficulty_level.present? ? event.difficulty_level.title : ''),
(event.room.present? ? event.room.name : ''), event.state]).html_safe
(event.room.present? ? event.room.name : ''),
event.state]).html_safe

View file

@ -6,6 +6,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
@ -21,6 +22,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '')
row << event.submitter.name
row << event.speaker_names
row << event.speaker_emails
row << event.event_type.title
row << (event.track.present? ? event.track.name : '')
row << (event.difficulty_level.present? ? event.difficulty_level.title : '')
@ -30,6 +32,6 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout:
end
pdf.text "#{@conference.short_title} Confirmed Events", font_size: 25, align: :center
pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1}
pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [40,60,90,50,70,65,85,50,55,50,60,45]
end

View file

@ -1,6 +1,18 @@
wb.add_worksheet(name: 'confirmed events') do |sheet|
bold_style = wb.styles.add_style(b: true)
row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'Event Type', 'Track', 'Difficulty Level', 'Room', 'State']
wrap_text = wb.styles.add_style alignment: {wrap_text: true}
row = ['Event ID',
'Title',
'Abstract',
'Start time',
'Submitter',
'Speaker',
'Speaker Email',
'Event Type',
'Track',
'Difficulty Level',
'Room',
'State']
sheet.add_row row, style: bold_style
@events.confirmed.each do |event|
@ -11,11 +23,13 @@ wb.add_worksheet(name: 'confirmed events') do |sheet|
row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '')
row << event.submitter.name
row << event.speaker_names
row << event.speaker_emails
row << event.event_type.title
row << (event.track.present? ? event.track.name : '')
row << (event.difficulty_level.present? ? event.difficulty_level.title : '')
row << (event.room.present? ? event.room.name : '')
row << event.state
sheet.add_row row
sheet.add_row row , style: wrap_text
sheet.column_widths 10,15,35,13,18,18,28,12,15,15,15,10
end
end

View file

@ -0,0 +1,16 @@
%tr
%td= physical_ticket.id
%td= physical_ticket.ticket.title
%td= physical_ticket.user.email
%td= humanized_money_with_symbol physical_ticket.ticket_purchase.amount_paid
%td
.btn-group
= link_to 'Show',
conference_physical_ticket_path(conference.short_title,
physical_ticket.token),
class: 'btn btn-primary'
= link_to 'Generate PDF',
conference_physical_ticket_path(conference.short_title,
physical_ticket.token,
format: :pdf),
class: 'button btn btn-default btn-info'

View file

@ -21,23 +21,11 @@
%th ID
%th Type
%th User
%th Paid
%th Actions
%tbody
- @physical_tickets.each do |physical_ticket|
%tr
%td= physical_ticket.id
%td= physical_ticket.ticket.title
%td= physical_ticket.user.email
%td
.btn-group
= link_to 'Show',
conference_physical_ticket_path(@conference.short_title,
physical_ticket.token),
class: 'btn btn-primary'
= link_to 'Generate PDF',
conference_physical_ticket_path(@conference.short_title,
physical_ticket.token,
format: :pdf),
class: 'button btn btn-default btn-info'
= render "physical_ticket", physical_ticket: physical_ticket,
conference: @conference
- else
%h5 No Tickets sold!

View file

@ -27,7 +27,7 @@
%td
= ticket.tickets_sold
%td
= humanized_money_with_symbol ticket.tickets_turnover
= humanized_money_with_symbol ticket.tickets_turnover_total(ticket.id)
%td
= ticket.registration_ticket? ? 'Yes' : 'No'
%td

View file

@ -0,0 +1,21 @@
- headers = ['Track ID',
'Name',
'Description',
'Room',
'Start Date',
'Start Date',
'Submitter Name',
'Included in Cfp',
'State']
= CSV.generate_line ['All Tracks']
= CSV.generate_line headers
- @tracks.each do |track|
= CSV.generate_line([track.id,
track.name,
track.description,
track.try(:room).try(:name),
track.start_date,
track.end_date,
track.try(:submitter).try(:name),
track.cfp_active? ? 'Yes' : 'No',
track.state]).html_safe

View file

@ -0,0 +1,28 @@
prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf|
tracks_array = []
header_array = ['Track ID',
'Name',
'Description',
'Room',
'Start Date',
'End Date',
'Submitter Name',
'Included in Cfp',
'State']
tracks_array << header_array
@tracks.each do |track|
row = []
row << track.id
row << track.name.to_s
row << track.description.to_s
row << track.try(:room).try(:name)
row << track.start_date.to_s
row << track.end_date.to_s
row << track.try(:submitter).try(:name)
row << (track.cfp_active? ? 'Yes' : 'No')
row << track.state
tracks_array << row
end
pdf.text "#{@conference.short_title} tracks", font_size: 25, align: :center
pdf.table tracks_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [40,70,230,65,55,55,90,65,50]
end

View file

@ -0,0 +1,29 @@
wb.add_worksheet(name: 'all tracks') do |sheet|
bold_style = wb.styles.add_style(b: true)
wrap_text = wb.styles.add_style alignment: {wrap_text: true}
row = ['Track ID',
'Name',
'Description',
'Room',
'Start Date',
'End Date',
'Submitter Name',
'Included in Cfp',
'State']
sheet.add_row row, style: bold_style
@tracks.each do |track|
row = []
row << track.id
row << track.name.to_s
row << track.description.to_s
row << track.try(:room).try(:name)
row << track.start_date.to_s
row << track.end_date.to_s
row << track.try(:submitter).try(:name)
row << (track.cfp_active? ? 'Yes' : 'No')
row << track.state
sheet.add_row row , style: wrap_text
sheet.column_widths 10,20,50,20,12,12,20,15,10
end
end

View file

@ -0,0 +1,21 @@
- headers = ['Track ID',
'Name',
'Description',
'Room',
'Start Date',
'Start Date',
'Submitter Name',
'Included in Cfp',
'State']
= CSV.generate_line ['Confirmed Tracks']
= CSV.generate_line headers
- @tracks.confirmed.each do |track|
= CSV.generate_line([track.id,
track.name,
track.description,
track.try(:room).try(:name),
track.start_date,
track.end_date,
track.try(:submitter).try(:name),
track.cfp_active? ? 'Yes' : 'No',
track.state]).html_safe

View file

@ -0,0 +1,28 @@
prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf|
tracks_array = []
header_array = ['Track ID',
'Name',
'Description',
'Room',
'Start Date',
'End Date',
'Submitter Name',
'Included in Cfp',
'State']
tracks_array << header_array
@tracks.confirmed.each do |track|
row = []
row << track.id
row << track.name.to_s
row << track.description.to_s
row << track.try(:room).try(:name)
row << track.start_date.to_s
row << track.end_date.to_s
row << track.try(:submitter).try(:name)
row << (track.cfp_active? ? 'Yes' : 'No')
row << track.state
tracks_array << row
end
pdf.text "#{@conference.short_title} tracks", font_size: 25, align: :center
pdf.table tracks_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [40,70,230,65,55,55,90,65,50]
end

View file

@ -0,0 +1,29 @@
wb.add_worksheet(name: 'all tracks') do |sheet|
bold_style = wb.styles.add_style(b: true)
wrap_text = wb.styles.add_style alignment: {wrap_text: true}
row = ['Track ID',
'Name',
'Description',
'Room',
'Start Date',
'End Date',
'Submitter Name',
'Included in Cfp',
'State']
sheet.add_row row, style: bold_style
@tracks.confirmed.each do |track|
row = []
row << track.id
row << track.name.to_s
row << track.description.to_s
row << track.try(:room).try(:name)
row << track.start_date.to_s
row << track.end_date.to_s
row << track.try(:submitter).try(:name)
row << (track.cfp_active? ? 'Yes' : 'No')
row << track.state
sheet.add_row row , style: wrap_text
sheet.column_widths 10,20,50,20,12,12,20,15,10
end
end

View file

@ -2,7 +2,32 @@
.row
.col-md-12
.page-header
%h1 Tracks
%h1
Tracks
.pull-right
- if can? :read, Track
.btn-group
.btn-group
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
Export PDF
%span.caret
%ul.dropdown-menu{ role: 'menu' }
%li= link_to 'All Tracks', admin_conference_program_tracks_path(@conference.short_title, format: :pdf, track_export_option: 'all')
%li= link_to 'Confirmed Tracks', admin_conference_program_tracks_path(@conference.short_title, format: :pdf, track_export_option: 'confirmed')
.btn-group
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
Export CSV
%span.caret
%ul.dropdown-menu{ role: 'menu' }
%li= link_to 'All', admin_conference_program_tracks_path(@conference.short_title, format: :csv, track_export_option: 'all')
%li= link_to 'Confirmed', admin_conference_program_tracks_path(@conference.short_title, format: :csv, track_export_option: 'confirmed')
.btn-group
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
Export XLS
%span.caret
%ul.dropdown-menu{ role: 'menu' }
%li= link_to 'All', admin_conference_program_tracks_path(@conference.short_title, format: :xlsx, track_export_option: 'all')
%li= link_to 'Confirmed', admin_conference_program_tracks_path(@conference.short_title, format: :xlsx, track_export_option: 'confirmed')
%p.text-muted
Categorize events in your conference
.row

View file

@ -0,0 +1,4 @@
- if @track_export_option == 'confirmed'
= render 'confirmed_tracks'
- elsif @track_export_option == 'all'
= render 'all_tracks'

View file

@ -0,0 +1,5 @@
if @track_export_option == 'confirmed'
render 'confirmed_tracks'
elsif @track_export_option == 'all'
render 'all_tracks'
end

View file

@ -0,0 +1,6 @@
wb = xlsx_package.workbook
if @track_export_option == 'confirmed'
render partial: 'confirmed_tracks', locals: { wb: wb }
elsif @track_export_option == 'all'
render partial: 'all_tracks', locals: { wb: wb }
end

View file

@ -208,9 +208,7 @@
- when 'DifficultyLevel'
difficulty level
- difficulty_level = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, difficulty_level.title,
admin_conference_program_difficulty_level_path(conference_short_title, version.item_id),
conference
= link_if_alive version, difficulty_level.title,admin_conference_program_difficulty_levels_path(conference_short_title), conference
- when 'Splashpage'
= link_if_alive version, 'splashpage',

View file

@ -101,7 +101,7 @@
= word_pluralize(@total_quantity[ticket_id], 'Ticket')
for
= tickets.first.price.symbol
= humanized_money tickets.first.price
= humanized_money @total_price_per_ticket[ticket_id]
%br
- if @tickets.any?
= link_to 'Get more tickets', conference_tickets_path(@conference.short_title), class: "btn btn-default"

View file

@ -4,7 +4,7 @@
.page-header
%h2 Upcoming Conferences
- @current.each do |conference|
= render partial: 'conference_details', locals: { conference: conference }
= render '/conferences/conference_details', conference: conference
-if @antiquated and @antiquated.any?
.row
.col-md-12
@ -17,7 +17,7 @@
%i.fa.fa-chevron-down{ style: 'display: none' }
#antiquated.collapse
- @antiquated.each do |conference|
= render partial: 'conference_details', locals: { conference: conference}
= render '/conferences/conference_details', conference: conference
-content_for :script_body do
:javascript

View file

@ -13,10 +13,8 @@
%span.icon-bar
%span.icon-bar
%span.icon-bar
- if conference.nil? || conference.new_record?
= link_to (ENV['OSEM_NAME'] || 'OSEM'), root_path, class: 'navbar-brand', title: 'Open Source Event Manager'
- else
= link_to conference.organization.name, organizations_path, class: 'navbar-brand', title: 'Open Source Event Manager'
= nav_root_link_for conference
.collapse.navbar-collapse#main-nav
- if content_for :splash_nav
%ul.nav.navbar-nav#splash-nav

View file

@ -9,15 +9,16 @@
= javascript_include_tag "application"
= csrf_meta_tags
:javascript
window.liveSettings = {
api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}",
picker: "bottom-right",
detectlang: true,
autocollect: true
};
= content_for(:script_head)
= javascript_include_tag "//cdn.transifex.com/live.js"
- if ENV['OSEM_TRANSIFEX_APIKEY']
:javascript
window.liveSettings = {
api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}",
picker: "bottom-right",
detectlang: true,
autocollect: true
};
= javascript_include_tag "//cdn.transifex.com/live.js"
= yield(:head)
%body

View file

@ -12,5 +12,7 @@
.caption
%h4
= organization.name
%button.btn.btn-success Conferences
= link_to 'Conferences',
conferences_organization_path(organization),
class: 'btn btn-success'
/ = link_to 'Edit', edit_organization_path(organization), class: 'btn btn-mini btn-default'

View file

@ -1,11 +1,12 @@
- progress_status = event.progress_status
%ul.list-unstyled
%li{'class'=>class_for_todo(progress_status['registered'])}
%span{'class'=>icon_for_todo(progress_status['registered'])}
- if progress_status['registered']
Speaker(s) registered to the conference
- else
= link_to 'Speaker(s) not registered to the conference', new_conference_conference_registration_path(event.program.conference.short_title)
- if can? :create, @conference.registrations.new
%li{'class'=>class_for_todo(progress_status['registered'])}
%span{'class'=>icon_for_todo(progress_status['registered'])}
- if progress_status['registered']
Speaker(s) registered to the conference
- else
= link_to 'Speaker(s) not registered to the conference', new_conference_conference_registration_path(event.program.conference.short_title)
%li{'class'=>class_for_todo(progress_status['biographies'])}
%span{'class'=>icon_for_todo(progress_status['biographies'])}
- if progress_status['biographies']

View file

@ -6,6 +6,14 @@
%span.notranslate
= @conference.title
- if @program.cfp_open?
- if @program.cfp.description.present?
.row
.col-md-12
= markdown(@program.cfp.description)
.row
.col-md-12
= render partial: 'encouragement_text'
@ -48,12 +56,12 @@
The more information you add to your proposal, the more likely it is that the conference organizers accept your proposal.
%br
It will also be more likely that visitors find your proposal interesting enough to attend.
%p
%strong
Why do I need to register to the conference?
%p
Knowing the number of visitors for the conference helps the organizers plan better.
- if can? :create, @conference.registrations.new
%p
%strong
Why do I need to register to the conference?
%p
Knowing the number of visitors for the conference helps the organizers plan better.
%table.table.table-striped#events
- @events.each do |event|
@ -74,13 +82,20 @@
%td.col-md-2{style: "padding:20px 8px 20px 8px;"}
= link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }"
- progress_percentage = event.calculate_progress
.progress
%div{class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;"}
= event.progress_status.reject{ |_key, value| value || value.nil? }.length
left
- if can? :create, @conference.registrations.new
- progress_percentage = event.calculate_progress
.progress
%div{class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;"}
= event.progress_status.reject{ |_key, value| value || value.nil? }.length
left
- else
:ruby
progress_list = event.progress_status
progress_percentage = (100 * progress_list.values.count(true) / (progress_list.values.compact.count-1)).to_s
.progress
%div{class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;"}
= event.progress_status.reject{ |_key, value| value || value.nil? }.length-1
left
%td.col-md-3{style: "padding:20px 0px 20px 0px;"}
.pull-right
- if event.transition_possible? :confirm

View file

@ -3,6 +3,11 @@
.col-md-12
.page-header
%h1 New Proposal
- if @program.cfp_open?
- if @program.cfp.description.present?
.row
.col-md-12
= markdown(@program.cfp.description)
.row
.col-md-12
= render partial: 'encouragement_text'

View file

@ -36,7 +36,8 @@
.col-md-8
%h4
= link_to speaker.name, user_path(speaker.id)
= "(#{speaker.email})"
- if speaker.email_public?
= "(#{speaker.email})"
- if speaker.affiliation?
.text-muted
from

View file

@ -1,4 +1,10 @@
#!/bin/bash
# set env os release variables
. /etc/os-release
if [[ "$ID" == "opensuse" ]]; then
pushd /vagrant
echo -e "\ninstalling required software packages...\n"
@ -14,6 +20,42 @@ echo 'install: --no-format-executable' >> /etc/gemrc
echo -e "\ninstalling bundler...\n"
gem.ruby2.4 install bundler
elif [[ "$ID" == "centos" || "$VERSION" == "7" ]]; then
_YELLOW='\033[1;33m' # yellow color
_LRED='\033[1;31m' # Light red color
_NO_COLOUR='\033[0m' # no color
printf "${_YELLOW}CEntOS-7 Setup${_NO_COLOUR}\n"
printf "${_YELLOW}installing ruby-2.4${_NO_COLOUR}\n"
yum install -q -y https://github.com/feedforce/ruby-rpm/releases/download/2.4.2/ruby-2.4.2-1.el7.centos.x86_64.rpm
if [[ ! "$?" -eq 0 ]]; then
printf "${_LRED}Error trying to install ruby-2.4${_NO_COLOUR}\n"
fi
printf "${_YELLOW}installing ruby-2.4 gems dependencies${_NO_COLOUR}\n"
gem install bundler
if [[ ! "$?" -eq 0 ]]; then
printf "${_LRED}Error trying to install ruby-2.4 bundler${_NO_COLOUR}\n"
fi
printf "${_YELLOW}installing nodejs repo${_NO_COLOUR}\n"
curl -sL https://rpm.nodesource.com/setup_9.x | bash - > /dev/null
printf "${_YELLOW}installing nodejs and devel tools${_NO_COLOUR}\n"
yum install -q -y git make gcc gcc-c++ libxml2-devel libxslt-devel nodejs screen mariadb mariadb-devel sqlite-devel ImageMagick bzip2
# for production: bundle install --without test development
printf "${_YELLOW}Opening firewall port: 3000${_NO_COLOUR}\n"
iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
printf "${_YELLOW}installing phantomjs${_NO_COLOUR}\n"
curl -L --silent https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -o /tmp/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar jxvf /tmp/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /tmp/ phantomjs-2.1.1-linux-x86_64/bin/phantomjs
mv /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
fi
echo -e "\ninstalling your bundle...\n"
su - vagrant -c "cd /vagrant/; bundle install --quiet"

View file

@ -3,7 +3,7 @@ require 'mina/rails'
require 'mina/git'
set :domain, 'proxy-opensuse.suse.de'
set :port, 2214
set :port, 2252
set :user, 'osem'
set :deploy_to, '/srv/www/vhosts/opensuse.org/events'
set :repository, 'https://github.com/openSUSE/osem.git'
@ -42,7 +42,7 @@ task deploy: :environment do
#invoke :notify_errbit
to :launch do
queue "sudo /etc/init.d/apache2 restart"
queue "sudo /usr/bin/systemctl restart apache2"
queue "cd #{deploy_to}/current && RAILS_ENV=production bin/delayed_job start"
end

View file

@ -149,7 +149,11 @@ Osem::Application.routes.draw do
get '/revision_history/:id/revert_object' => 'versions#revert_object', as: 'revision_history_revert_object'
get '/revision_history/:id/revert_attribute' => 'versions#revert_attribute', as: 'revision_history_revert_attribute'
end
resources :organizations, only: [:index]
resources :organizations, only: [:index] do
member do
get :conferences
end
end
resources :conferences, only: [:index, :show] do
resources :booths do
member do

View file

@ -0,0 +1,5 @@
class AddDescriptionToCfps < ActiveRecord::Migration
def change
add_column :cfps, :description, :text
end
end

View file

@ -0,0 +1,5 @@
class AddAmountPaidToTicketPurchases < ActiveRecord::Migration
def change
add_column :ticket_purchases, :amount_paid, :float, default: 0
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170816203325) do
ActiveRecord::Schema.define(version: 20170924190528) do
create_table "ahoy_events", force: :cascade do |t|
t.uuid "visit_id", limit: 16
@ -68,12 +68,13 @@ ActiveRecord::Schema.define(version: 20170816203325) do
end
create_table "cfps", force: :cascade do |t|
t.date "start_date", null: false
t.date "end_date", null: false
t.date "start_date", null: false
t.date "end_date", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "program_id"
t.string "cfp_type"
t.text "description"
end
create_table "comments", force: :cascade do |t|
@ -504,6 +505,7 @@ ActiveRecord::Schema.define(version: 20170816203325) do
t.integer "user_id"
t.integer "payment_id"
t.integer "week"
t.float "amount_paid"
end
create_table "ticket_scannings", force: :cascade do |t|

View file

@ -252,7 +252,7 @@ describe ConferenceRegistrationsController, type: :controller do
end
it 'does not assign price of purchased tickets to total_price and purchased tickets to tickets without payment' do
expect(assigns(:total_price)).to eq Money.new(0, 'USD')
expect(assigns(:total_price)).to eq 0
end
end
@ -262,7 +262,7 @@ describe ConferenceRegistrationsController, type: :controller do
end
it 'assigns 0 dollars to total_price and empty array to tickets variables' do
expect(assigns(:total_price)).to eq Money.new(0, 'USD')
expect(assigns(:total_price)).to eq 0
expect(assigns(:tickets)).to match_array []
end
end

View file

@ -2,6 +2,26 @@ require 'spec_helper'
describe OrganizationsController do
let!(:organization) { create(:organization) }
let!(:conference) do
create(
:conference,
splashpage: create(:splashpage, public: true),
venue: create(:venue),
organization: organization
)
end
let!(:antiquated_conference) do
create(
:conference,
splashpage: create(:splashpage, public: true),
venue: create(:venue),
organization: organization,
start_date: 2.weeks.ago,
end_date: 1.week.ago
)
end
let!(:other_conference) { create(:conference) }
let!(:user) { create(:user) }
describe 'GET #index' do
@ -12,4 +32,27 @@ describe OrganizationsController do
it { expect(response).to render_template('index') }
end
describe 'GET #conferences' do
before :each do
get :conferences, id: organization.id
end
it 'loads the organization' do
expect(assigns(:organization)).to eq organization
end
it 'includes organization conferences' do
expect(assigns(:current)).to include conference
end
it 'does not include conferences outside organization' do
expect(assigns(:current)).not_to include other_conference
expect(assigns(:antiquated)).not_to include other_conference
end
it 'includes antiquated organization conferences' do
expect(assigns(:antiquated)).to include antiquated_conference
end
end
end

View file

@ -5,7 +5,7 @@ FactoryGirl.define do
start_date { 1.day.ago }
end_date { 2.days.from_now }
cfp_type 'events'
description 'This is a test description'
program
end
end

View file

@ -48,4 +48,12 @@ feature Organization do
it_behaves_like 'successfully updates an organization'
end
context 'anonymously' do
scenario 'index should link to conferences list' do
visit organizations_path
expect(page).to have_link('Conferences', href: "/organizations/#{organization.id}/conferences")
end
end
end

View file

@ -62,14 +62,18 @@ feature Splashpage do
end
end
context 'public splashpage already created' do
context 'navigation' do
let!(:splashpage) { create(:splashpage, conference: conference, public: true)}
scenario 'should have organization name', feature: true, js: true do
sign_in participant
visit conference_path(conference.short_title)
context 'multiple organizations' do
let!(:additional_organization) { create(:organization) }
expect(page).to have_text(conference.organization.name)
scenario 'should have organization name', feature: true, js: true do
sign_in participant
visit conference_path(conference.short_title)
expect(page).to have_text(conference.organization.name)
end
end
end
end

View file

@ -58,5 +58,21 @@ describe ApplicationHelper, type: :helper do
expect(concurrent_events(event).present?).to eq false
end
end
describe 'navigation title link' do
it 'should default to OSEM' do
ENV.delete('OSEM_NAME')
expect(nav_root_link_for(nil)).to match 'OSEM'
end
it 'should use the environment variable' do
ENV['OSEM_NAME'] = Faker::Company.name
expect(nav_root_link_for(nil)).to match ENV['OSEM_NAME']
end
it 'should use the conference organization name' do
expect(nav_root_link_for(conference)).to match conference.organization.name
end
end
end
end

View file

@ -362,7 +362,7 @@ describe Event do
new_event.submitter = submitter
new_event.speakers = [speaker1, speaker2]
expect(new_event.speaker_names).to eq 'user speaker 1 and user speaker 2'
expect(new_event.speaker_names).to eq 'user speaker 1, user speaker 2'
end
end
end

View file

@ -15,8 +15,8 @@ describe Program do
it { is_expected.to have_many(:events).dependent(:destroy) }
it { is_expected.to have_many(:event_schedules).through(:events) }
it { is_expected.to have_many(:event_users).through(:events) }
it { is_expected.to have_many(:speakers).through(:event_users).source(:user) }
it { is_expected.to have_many(:program_events_speakers).through(:events).source(:event_users) }
it { is_expected.to have_many(:speakers).through(:program_events_speakers).source(:user) }
it { is_expected.to accept_nested_attributes_for(:event_types) }
it { is_expected.to accept_nested_attributes_for(:tracks) }
it { is_expected.to accept_nested_attributes_for(:difficulty_levels) }