Merge branch 'master' into include_speaker_email_in_events

This commit is contained in:
James Mason 2017-11-07 17:19:42 -08:00 committed by GitHub
commit aca8adf6e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 151 additions and 14 deletions

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

@ -171,4 +171,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

@ -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

@ -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,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

@ -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

@ -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

@ -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