commit
9d2e97b498
9 changed files with 95 additions and 13 deletions
11
Gemfile.lock
11
Gemfile.lock
|
|
@ -253,7 +253,7 @@ GEM
|
|||
open4 (~> 1.3.4)
|
||||
rake
|
||||
mini_magick (4.5.1)
|
||||
mini_portile2 (2.0.0)
|
||||
mini_portile2 (2.1.0)
|
||||
minitest (5.9.0)
|
||||
momentjs-rails (2.8.1)
|
||||
railties (>= 3.1)
|
||||
|
|
@ -273,8 +273,9 @@ GEM
|
|||
mysql2 (0.4.2)
|
||||
netrc (0.11.0)
|
||||
nio4r (1.2.1)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
nokogiri (1.6.8)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
pkg-config (~> 1.1.7)
|
||||
oauth2 (0.9.4)
|
||||
faraday (>= 0.8, < 0.10)
|
||||
jwt (~> 1.0)
|
||||
|
|
@ -314,6 +315,7 @@ GEM
|
|||
actionpack
|
||||
activesupport
|
||||
rails (>= 3.0.0)
|
||||
pkg-config (1.1.7)
|
||||
poltergeist (1.9.0)
|
||||
capybara (~> 2.1)
|
||||
cliver (~> 0.3.1)
|
||||
|
|
@ -616,3 +618,6 @@ DEPENDENCIES
|
|||
web-console (~> 2.0)
|
||||
webmock
|
||||
whenever
|
||||
|
||||
BUNDLED WITH
|
||||
1.12.5
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class ConferenceController < ApplicationController
|
|||
def schedule
|
||||
@rooms = @conference.venue.rooms if @conference.venue
|
||||
@events = @conference.program.events
|
||||
@events_xml = @events.scheduled.group_by{ |event| event.start_time.to_date }
|
||||
@dates = @conference.start_date..@conference.end_date
|
||||
|
||||
if @dates == Date.current
|
||||
|
|
|
|||
|
|
@ -1,4 +1,14 @@
|
|||
module ApplicationHelper
|
||||
##
|
||||
# Gets an EventType object, and returns its length in timestamp format (HH:MM)
|
||||
# ====Gets
|
||||
# * +Integer+ -> 30
|
||||
# ====Returns
|
||||
# * +String+ -> "00:30"
|
||||
def length_timestamp(length)
|
||||
[length / 60, length % 60].map { |t| t.to_s.rjust(2, '0') }.join(':')
|
||||
end
|
||||
|
||||
##
|
||||
# ====Returns
|
||||
# * +String+ -> number of registrations / max allowed registrations
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
%h1 Call for Papers
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@cfp, :url => admin_conference_program_cfp_path(@conference.short_title),:html => {:multipart => true}) do |f|
|
||||
= 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" }
|
||||
= semantic_form_for(@cfp, url: admin_conference_program_cfp_path(@conference.short_title),html: {multipart: true}) do |f|
|
||||
= 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" }
|
||||
%p.text-right
|
||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||
= f.action :submit, as: :button, button_html: { class: "btn btn-primary" }
|
||||
|
|
|
|||
35
app/views/conference/schedule.xml.haml
Normal file
35
app/views/conference/schedule.xml.haml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
%schedule
|
||||
%version= @conference.revision
|
||||
%conference
|
||||
%acronym= @conference.short_title
|
||||
%title= @conference.title
|
||||
%start= @conference.start_date
|
||||
%end= @conference.end_date
|
||||
%days= (@conference.end_date - @conference.start_date).to_i + 1
|
||||
%timeslot_duration= length_timestamp(EventType::LENGTH_STEP)
|
||||
|
||||
- if @events_xml.any?
|
||||
- @events_xml.keys.each.with_index(1) do |day, index|
|
||||
%day{ date: day, index: index }
|
||||
- events_in_rooms = @events_xml[day].group_by(&:room)
|
||||
- events_in_rooms.keys.each do |room|
|
||||
%room{ name: room.name }
|
||||
- events_in_rooms[room].each do |event|
|
||||
%event{ guid: event.guid, id: event.id }
|
||||
%date= event.start_time.iso8601
|
||||
%start= event.start_time.strftime('%H:%M')
|
||||
%duration= length_timestamp(event.event_type.length)
|
||||
%room= event.room.name
|
||||
%type= event.event_type.name
|
||||
%language= ISO_639.find_by_english_name(event.language).third if event.language
|
||||
%slug= "#{event.id} #{event.title}".parameterize
|
||||
%title= event.title
|
||||
%subtitle= event.subtitle
|
||||
%track= event.track.name if event.track
|
||||
%abstract= event.abstract
|
||||
%recording
|
||||
%license/
|
||||
%optout=false #FIXME
|
||||
%persons
|
||||
- event.speakers.uniq.each do |speaker|
|
||||
%person{ id: speaker.id }= speaker.name
|
||||
|
|
@ -7,6 +7,7 @@ set :port, 2214
|
|||
set :user, 'osem'
|
||||
set :deploy_to, '/srv/www/vhosts/opensuse.org/events'
|
||||
set :repository, 'https://github.com/openSUSE/osem.git'
|
||||
set :revision, 'one'
|
||||
|
||||
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
|
||||
# They will be linked in the 'deploy:link_shared_paths' step.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ConferenceController do
|
||||
let(:conference) { create(:conference, splashpage: create(:splashpage, public: true)) }
|
||||
let(:conference) { create(:full_conference, splashpage: create(:splashpage, public: true)) }
|
||||
|
||||
describe 'GET #index' do
|
||||
it 'Response code is 200' do
|
||||
|
|
@ -24,6 +24,29 @@ describe ConferenceController do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #schedule' do
|
||||
context 'XML' do
|
||||
before :each do
|
||||
conference.program.schedule_public = true
|
||||
conference.program.save!
|
||||
create(:event_scheduled, program: conference.program)
|
||||
create(:event_scheduled, program: conference.program)
|
||||
|
||||
get :schedule, id: conference.short_title, format: :xml
|
||||
end
|
||||
|
||||
it 'assigns variables' do
|
||||
expect(assigns(:conference)).to eq conference
|
||||
expect(assigns(:events_xml)).to eq conference.program.events.scheduled.
|
||||
group_by{ |event| event.start_time.to_date }
|
||||
end
|
||||
|
||||
it 'renders successfully' do
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'OPTIONS #index' do
|
||||
it 'Response code is 200' do
|
||||
process :index, 'OPTIONS'
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ FactoryGirl.define do
|
|||
event.room = build(:room, venue: venue)
|
||||
event.comment_threads << build(:comment, commentable: event)
|
||||
end
|
||||
|
||||
factory :event_scheduled do
|
||||
after(:build) do |event|
|
||||
event.state = 'confirmed'
|
||||
event.start_time = event.program.conference.start_date.to_time
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ feature Conference do
|
|||
|
||||
today = Date.today - 1
|
||||
page.execute_script(
|
||||
"$('#conference-start-datepicker').val('#{today.strftime('%d/%m/%Y')}')")
|
||||
"$('#registration-period-start-datepicker').val('#{today.strftime('%d/%m/%Y')}')")
|
||||
page.execute_script(
|
||||
"$('#conference-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')")
|
||||
"$('#registration-period-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')")
|
||||
|
||||
click_button 'Create Cfp'
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ feature Conference do
|
|||
|
||||
# Validate update with empty start date will not saved
|
||||
page.execute_script(
|
||||
"$('#conference-start-datepicker').val('')")
|
||||
"$('#registration-period-start-datepicker').val('')")
|
||||
click_button 'Update Cfp'
|
||||
expect(flash).
|
||||
to eq('Updating call for papers failed. ' +
|
||||
|
|
@ -56,9 +56,9 @@ feature Conference do
|
|||
# Fill in date
|
||||
today = Date.today - 9
|
||||
page.execute_script(
|
||||
"$('#conference-start-datepicker').val('#{today.strftime('%d/%m/%Y')}')")
|
||||
"$('#registration-period-start-datepicker').val('#{today.strftime('%d/%m/%Y')}')")
|
||||
page.execute_script(
|
||||
"$('#conference-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')")
|
||||
"$('#registration-period-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')")
|
||||
|
||||
click_button 'Update Cfp'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue