@@ -0,0 +1,26 @@
ul.nav.navbar-nav.navbar-right
li class=active?(:activities) = link_to 'Activities', root_path
li.dropdown class=dropdown_active?
a.dropdown-toggle data-toggle="dropdown" href="#"
| Summer of Code
span.caret
ul.dropdown-menu role="menu"
- if Season.projects_proposable?
li.divider.hidden-xs
li class=active?(:projects) = link_to 'Submit your Project', new_project_path
- if show_application_link?
li.divider.hidden-xs
li class=active?(:application_drafts) = application_disambiguation_link
li class=active?(:projects) = link_to 'Projects', projects_path
- if current_season.started?
li.divider.hidden-xs
li class=active?(:teams) = link_to 'Teams', teams_path

This comment has been minimized.

Copy link
@alicetragedy

alicetragedy Feb 2, 2017

Member

quick info — the “Teams” page should be visible regardless of whether the season has started. will quickly fix it now :)

li class=active?(:conferences) = link_to 'Conferences', conferences_path
li.divider.hidden-xs
li class=active?(:users) = link_to 'Community', users_path
li class=('active' if params[:page] == 'help') = link_to 'Help', page_path('help')

- if signed_in?
= render 'nav_signed_in'
- else
li = link_to icon('github', 'Sign in'), user_github_omniauth_authorize_path
@@ -0,0 +1,28 @@
li.dropdown
a.nav-dropdown-img-toggle data-toggle='dropdown'
= avatar_url(current_user, size: 45)
span.caret
a.dropdown-toggle.visible-xs data-toggle='dropdown'
span = current_user.name
span.caret
ul.dropdown-menu role="menu"
li = link_to 'Profile', current_user
li.divider.hidden-xs
- if current_user.admin?
li = link_to 'Orga Dashboard', orga_dashboard_path
- if current_user.current_student? && current_season.started?
li = link_to 'Status Updates', [:students, :status_updates]
- if current_user.supervisor? && current_season.started?
li = link_to 'Supervisor Dashboard', supervisor_dashboard_path
- if current_user.mentor?
li = link_to 'Mentor Dashboard', mentor_applications_path
li.divider.hidden-xs
- if current_user != true_user
li.hidden-xs = link_to icon('eye-close', 'Stop'), stop_impersonating_users_path, method: :post
- else
li.hidden-xs = link_to 'Sign out', sign_out_path, method: :delete
li.divider.hidden-xs
- if current_user != true_user
li.visible-xs-block = link_to icon('eye-close', 'Stop'), stop_impersonating_users_path, method: :post
- else
li.visible-xs-block = link_to 'Sign out', sign_out_path, method: :delete
@@ -0,0 +1,11 @@
nav#navigation role='navigation'
div.container
div.navbar-header
button.navbar-toggle data-target='#other-menu' data-toggle='collapse' type='button'
span.sr-only Toggle navigation
span.icon-bar
span.icon-bar
span.icon-bar
= link_to image_tag('logo.png'), 'http://railsgirlssummerofcode.org', class: 'navbar-brand'
div#other-menu.collapse.navbar-collapse
= render 'nav_right'

This file was deleted.

@@ -15,13 +15,12 @@ html
link rel="apple-touch-icon" href="/images/apple-touch-icon.png"

body class=controller.controller_name

= render 'navigation'

div.ribbon
a href="//github.com/rails-girls-summer-of-code/rgsoc-teams" Fork me on GitHub

div#wrap
= render 'layouts/header'

div.ribbon
a href="//github.com/rails-girls-summer-of-code/rgsoc-teams" Fork me on GitHub

section.container#content
div.row
div.col-xs-12
@@ -33,9 +32,9 @@ html
p.alert.alert-danger
button.close data-dismiss="alert" type="button" ×
= alert

= yield

section.container#footer
footer.footer
ul
@@ -0,0 +1,3 @@
ul[class=:breadcrumb]
- @breadcrumbs.each do |breadcrumb|
li = link_to breadcrumb[0], [:orga, breadcrumb[1]]
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

nav.page
.back-nav
ul
@@ -11,4 +13,4 @@ nav.actions

h1 Editing conference

== render 'form'
== render 'form'
@@ -1,8 +1,10 @@
= render 'orga/breadcrumbs'

nav.actions
ul.list-inline
li = link_to icon('plus', 'New Conference'), new_orga_conference_path, class: 'btn btn-primary btn-sm'
h1.header
/ = icon('group')
span Conferences (2nd round)

= render 'conferences/table', namespace: :orga
= render 'conferences/table', namespace: :orga
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

nav.page
.back-nav
ul
@@ -7,5 +9,3 @@ nav.page
h1 New conference

== render 'form'


@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

nav.page
.back-nav
ul
@@ -10,4 +12,4 @@ nav.btn-group
= link_to 'Edit', edit_orga_conference_path(conference), class: 'edit btn btn-default'
= link_to 'Delete', orga_conference_path(conference), method: :delete, class: 'edit btn btn-default', data: { confirm: 'Are you sure?' }

= render 'conferences/details', namespace: :orga
= render 'conferences/details', namespace: :orga
@@ -0,0 +1,17 @@
= render 'orga/breadcrumbs'

p Relevant places for you to go as an organizer.

dl.dl-horizontal
dt = link_to 'Projects', [:orga, :projects]
dd View/accept/reject submitted Projects
dt = link_to 'Teams', [:orga, :teams]
dd Current Teams
dt = link_to 'Conferences', [:orga, :conferences]
dd Manage Conferences
dt = link_to 'Seasons', [:orga, :seasons]
dd Season management (including timetravel for test and development
dt  
dd  
dt = link_to 'Exports', [:orga, :exports]
dd Export data for reporting)

This file was deleted.

@@ -0,0 +1,6 @@
= render 'orga/breadcrumbs'

= form_tag [:orga, :exports] do
= select_tag "export", options_for_select(available_exports), prompt: "<Select an exporter method>"
'
= button_tag "Make it so!", type: 'submit'
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

h1 Listing Projects

table.table.table-striped.table-bordered.table-condensed.hidden-sm.hidden-xs
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

h1 Edit Season

== render 'form'
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

nav.actions
ul.list-inline
li = link_to icon('plus', 'New Season'), [:new, :orga, :season], class: 'btn btn-primary'
@@ -32,4 +34,4 @@ table.table.table-striped.table-bordered.table-condensed
br


= render partial: 'orga/seasons/switch' unless Rails.env.production?
= render partial: 'orga/seasons/switch' unless Rails.env.production?
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

h1 New Season

== render 'form'
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

h1 Season #{@season.name}

.conference
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

nav.page
.back-nav
ul
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

nav.actions
ul.list-inline
li = link_to icon('plus', 'New Team'), new_orga_team_path, class: 'btn btn-default btn-sm'
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

nav.page
.back-nav
ul
@@ -1,3 +1,5 @@
= render 'orga/breadcrumbs'

nav.page
.back-nav
ul
@@ -82,6 +82,7 @@

patch 'orga/seasons/switch_phase', to: 'orga/seasons#switch_phase', as: :switch_phase
namespace :orga do
root to: 'dashboard#index', as: :dashboard
resources :projects, only: [:index] do
member do
put :accept
@@ -18,16 +18,16 @@

create_table "activities", force: :cascade do |t|
t.integer "team_id"
t.string "kind"
t.string "guid"
t.string "author"
t.string "title"
t.string "kind", limit: 255
t.string "guid", limit: 255
t.string "author", limit: 255
t.string "title", limit: 255
t.text "content"
t.string "source_url"
t.string "source_url", limit: 255
t.datetime "published_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "img_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "img_url", limit: 255
end

create_table "application_drafts", force: :cascade do |t|
@@ -65,16 +65,16 @@
t.hstore "application_data"
t.datetime "created_at"
t.datetime "updated_at"
t.string "gender_identification_student"
t.string "gender_identification_pair"
t.string "gender_identification_student", limit: 255
t.string "gender_identification_pair", limit: 255
t.text "misc_info"
t.string "sponsor_pick"
t.string "sponsor_pick", limit: 255
t.integer "project_visibility"
t.boolean "hidden"
t.text "flags", default: [], array: true
t.string "country"
t.string "city"
t.string "coaching_company"
t.text "flags", default: [], array: true
t.string "country", limit: 255
t.string "city", limit: 255
t.string "coaching_company", limit: 255
t.integer "form_application_id"
t.integer "season_id"
t.integer "team_id"
@@ -105,41 +105,41 @@
t.text "text"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "commentable_type"
t.integer "commentable_id"
t.string "commentable_type"
t.index ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type", using: :btree
end

create_table "conferences", force: :cascade do |t|
t.string "name"
t.string "location"
t.string "twitter"
t.string "url"
t.string "name", limit: 255
t.string "location", limit: 255
t.string "twitter", limit: 255
t.string "url", limit: 255
t.date "starts_on"
t.date "ends_on"
t.integer "tickets"
t.integer "accomodation"
t.integer "flights"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "round", default: 1
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "round", default: 1
t.boolean "lightningtalkslots"
t.integer "season_id"
t.index ["season_id"], name: "index_conferences_on_season_id", using: :btree
end

create_table "mailings", force: :cascade do |t|
t.string "from"
t.string "to"
t.string "cc"
t.string "bcc"
t.string "subject"
t.string "from", limit: 255
t.string "to", limit: 255
t.string "cc", limit: 255
t.string "bcc", limit: 255
t.string "subject", limit: 255
t.text "body"
t.datetime "sent_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "group", default: 0
t.text "seasons", default: [], array: true
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "group", default: 0
t.text "seasons", default: [], array: true
end

create_table "notes", force: :cascade do |t|
@@ -151,7 +151,7 @@
end

create_table "projects", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.integer "submitter_id"
@@ -164,9 +164,9 @@
t.text "issues_and_features"
t.boolean "beginner_friendly"
t.string "aasm_state"
t.text "tags", default: [], array: true
t.text "tags", default: [], array: true
t.string "source_url"
t.boolean "comments_locked", default: false
t.boolean "comments_locked", default: false
t.string "code_of_conduct"
t.text "requirements"
t.string "license"
@@ -180,24 +180,24 @@
t.integer "user_id"
t.boolean "pick"
t.integer "rateable_id"
t.string "rateable_type"
t.string "rateable_type", limit: 255
t.index ["rateable_id", "rateable_type"], name: "index_ratings_on_rateable_id_and_rateable_type", using: :btree
end

create_table "roles", force: :cascade do |t|
t.integer "team_id"
t.integer "user_id"
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "state", default: "pending", null: false
t.string "name", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "state", default: "pending", null: false
t.string "confirmation_token"
end

create_table "seasons", force: :cascade do |t|
t.date "starts_at"
t.date "ends_at"
t.string "name"
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "applications_open_at"
@@ -208,70 +208,70 @@
end

create_table "sources", force: :cascade do |t|
t.string "url"
t.string "url", limit: 255
t.integer "team_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "kind"
t.string "feed_url"
t.string "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "kind", limit: 255
t.string "feed_url", limit: 255
t.string "title", limit: 255
end

create_table "submissions", force: :cascade do |t|
t.integer "mailing_id"
t.string "to"
t.string "to", limit: 255
t.text "error"
t.datetime "sent_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "teams", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "log_url"
t.string "name", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "log_url", limit: 255
t.text "description"
t.integer "number"
t.string "kind"
t.string "twitter_handle"
t.string "github_handle"
t.string "kind", limit: 255
t.string "twitter_handle", limit: 255
t.string "github_handle", limit: 255
t.date "starts_on"
t.date "finishes_on"
t.string "post_info"
t.string "post_info", limit: 255
t.date "last_checked_at"
t.integer "last_checked_by"
t.integer "season_id"
t.boolean "invisible", default: false
t.integer "applications_count", default: 0, null: false
t.boolean "invisible", default: false
t.integer "applications_count", default: 0, null: false
t.string "project_name"
t.index ["applications_count"], name: "index_teams_on_applications_count", using: :btree
t.index ["season_id"], name: "index_teams_on_season_id", using: :btree
end

create_table "users", force: :cascade do |t|
t.integer "github_id"
t.string "github_handle"
t.string "name"
t.string "email"
t.string "location"
t.string "github_handle", limit: 255
t.string "name", limit: 255
t.string "email", limit: 255
t.string "location", limit: 255
t.text "bio"
t.string "homepage"
t.string "avatar_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "homepage", limit: 255
t.string "avatar_url", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "team_id"
t.string "twitter_handle"
t.string "irc_handle"
t.string "tshirt_size"
t.string "twitter_handle", limit: 255
t.string "irc_handle", limit: 255
t.string "tshirt_size", limit: 255
t.text "postal_address"
t.string "timezone"
t.string "interested_in", default: [], array: true
t.string "timezone", limit: 255
t.string "interested_in", limit: 255, default: [], array: true
t.boolean "hide_email"
t.boolean "is_company", default: false
t.string "company_name"
t.boolean "is_company", default: false
t.string "company_name", limit: 255
t.text "company_info"
t.string "country"
t.string "country", limit: 255
t.integer "application_coding_level"
t.text "application_gender_identification"
t.text "application_minimum_money"
@@ -290,11 +290,11 @@
t.float "application_location_lat"
t.float "application_location_lng"
t.text "application_giving_back"
t.text "application_diversity"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.text "application_diversity"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
end

@@ -0,0 +1,52 @@
require 'spec_helper'

RSpec.describe Orga::DashboardController do
render_views

describe '#GET index' do
context 'without admin role' do
it 'redirects to root patg' do
sign_in create(:student)
get :index
expect(response).to redirect_to root_path
end
end

context 'with admin role' do
before do
user = create(:supervisor)
create(:organizer_role, user: user)
sign_in user
get :index
end

it 'renders the dashboard' do
expect(response).to render_template :index
end

it 'shows link to project space' do
expect(response.body).to include orga_projects_path
end

it 'shows link to teams space' do
expect(response.body).to include orga_teams_path
end

it 'shows link to conferences space' do
expect(response.body).to include orga_conferences_path
end

it 'shows link to seasons space' do
expect(response.body).to include orga_seasons_path
end

it 'shows link to exports' do
expect(response.body).to include orga_exports_path
end

it 'does not show link to rating space' do
expect(response.body).not_to include rating_path
end
end
end
end
@@ -52,7 +52,7 @@
end
end

describe 'scopes' do
describe 'scopes'do
before do
@user1 = create(:user)
@user2 = create(:coach)
@@ -210,6 +210,32 @@
end
end

describe '#admin?' do
it 'returns false for users w/o admin role' do
student = FactoryGirl.create(:student)
expect(student).not_to be_admin
end

it 'returns true if user has a admin role' do
supervisor = FactoryGirl.create(:supervisor)
FactoryGirl.create(:organizer_role, user: supervisor)
expect(supervisor).to be_admin
end
end

describe '#mentor?' do
it 'returns false for users w/o mentor role' do
student = FactoryGirl.create(:student)
expect(student).not_to be_mentor
end

it 'returns true if user has a mentor role' do
mentor = FactoryGirl.create(:mentor)
FactoryGirl.create(:organizer_role, user: mentor)
expect(mentor).to be_mentor
end
end

describe '#student?' do
it 'returns false for users w/o a role' do
expect(subject).not_to be_student
@@ -0,0 +1,240 @@
require 'spec_helper'

RSpec.describe 'Navigation', type: :request do
describe 'during summer' do
before { Timecop.travel(Season.current.starts_at + 1.day) }
after { Timecop.return }

shared_examples :user_nav_during_summer do
it 'displays general and user specific links for the phase' do
expect(response.body).to include activities_path
expect(response.body).to include teams_path
expect(response.body).to include conferences_path
expect(response.body).to include users_path
expect(response.body).to include page_path(:help)
expect(response.body).to include user_path(user)
expect(response.body).to include sign_out_path
end

it 'does not display links to apply or submit a project' do
expect(response.body).not_to include application_drafts_path
expect(response.body).not_to include apply_path
expect(response.body).not_to include new_project_path
end
end

context 'for guest users' do
before { get '/' }

it 'displays sign in and phase specific links' do
expect(response.body).to include activities_path
expect(response.body).to include teams_path
expect(response.body).to include conferences_path
expect(response.body).to include users_path
expect(response.body).to include page_path(:help)
expect(response.body).to include user_github_omniauth_authorize_path
end

it 'hides role specific links' do
expect(response.body).not_to include mentor_applications_path
expect(response.body).not_to include orga_dashboard_path
expect(response.body).not_to include supervisor_dashboard_path
expect(response.body).not_to include students_status_updates_path
end

it 'does not display links from other phases' do
expect(response.body).not_to include application_drafts_path
expect(response.body).not_to include apply_path
expect(response.body).not_to include new_project_path
end
end

context 'for students' do
let(:team) { create :team, :in_current_season, kind: 'sponsored' }
let(:user) { create(:student_role, team: team).user }

before do
sign_in user
get '/'
end

include_examples :user_nav_during_summer

it { expect(response.body).to include students_status_updates_path }

it 'hides other role specific links' do
expect(response.body).not_to include mentor_applications_path
expect(response.body).not_to include orga_dashboard_path
expect(response.body).not_to include supervisor_dashboard_path
end
end

context 'for supervisors' do
let(:user) { create(:supervisor) }

before do
sign_in user
get '/'
end

include_examples :user_nav_during_summer

it { expect(response.body).to include supervisor_dashboard_path }

it 'hides other role specific links' do
expect(response.body).not_to include mentor_applications_path
expect(response.body).not_to include orga_dashboard_path
expect(response.body).not_to include students_status_updates_path
end
end

context 'for supervisors with orga role' do
let(:user) { create(:supervisor) }

before do
create(:organizer_role, user: user)
sign_in user
get '/'
end

include_examples :user_nav_during_summer

it 'displays relevant items for supervisors and orgas' do
expect(response.body).to include supervisor_dashboard_path
expect(response.body).to include orga_dashboard_path
end

it 'hides other role specific links' do
expect(response.body).not_to include mentor_applications_path
expect(response.body).not_to include students_status_updates_path
end
end

context 'for mentors' do
let(:user) { create(:mentor) }

before do
sign_in user
get '/'
end

include_examples :user_nav_during_summer

it { expect(response.body).to include mentor_applications_path }

it 'hides other role specific links' do
expect(response.body).not_to include supervisor_dashboard_path
expect(response.body).not_to include orga_dashboard_path
expect(response.body).not_to include students_status_updates_path
end
end
end

describe 'during application phase' do
before { Timecop.travel(Season.current.applications_open_at + 1.day) }

after { Timecop.return }

shared_examples :user_nav_during_application_phase do
it 'displays sign in and links relevant for the phase' do
expect(response.body).to include activities_path
expect(response.body).to include apply_path
expect(response.body).to include users_path
expect(response.body).to include page_path(:help)
expect(response.body).to include user_path(user)
expect(response.body).to include sign_out_path
end

it 'does not display links for other phases' do
expect(response.body).not_to include application_drafts_path
expect(response.body).not_to include new_project_path
expect(response.body).not_to include teams_path
expect(response.body).not_to include conferences_path
end
end

context 'for guest users' do
before { get '/' }

it 'displays sign in and links relevant for the phase' do
expect(response.body).to include activities_path
expect(response.body).to include apply_path
expect(response.body).to include users_path
expect(response.body).to include page_path(:help)
expect(response.body).to include user_github_omniauth_authorize_path
end

it 'hides role specific links' do
expect(response.body).not_to include mentor_applications_path
expect(response.body).not_to include orga_dashboard_path
expect(response.body).not_to include supervisor_dashboard_path
expect(response.body).not_to include students_status_updates_path
end

it 'does not display any links for other phases' do
expect(response.body).not_to include teams_path
expect(response.body).not_to include conferences_path
expect(response.body).not_to include new_project_path
end
end

context 'for students' do
let(:user) { create(:student) }

before do
sign_in user
get '/'
end

include_examples :user_nav_during_application_phase

it 'hides other role specific links' do
expect(response.body).not_to include mentor_applications_path
expect(response.body).not_to include orga_dashboard_path
expect(response.body).not_to include supervisor_dashboard_path
expect(response.body).not_to include students_status_updates_path
end
end

context 'for supervisors with orga role' do
let(:user) { create(:supervisor) }

before do
create(:organizer_role, user: user)
sign_in user
get '/'
end

include_examples :user_nav_during_application_phase

it 'displays relevant items for supervisors and orgas for the current phase' do
expect(response.body).not_to include supervisor_dashboard_path
expect(response.body).to include orga_dashboard_path
end

it 'hides other role specific links' do
expect(response.body).not_to include mentor_applications_path
expect(response.body).not_to include students_status_updates_path
end
end

context 'for mentors' do
let(:user) { create(:mentor) }

before do
sign_in user
get '/'
end

include_examples :user_nav_during_application_phase

it { expect(response.body).to include mentor_applications_path }

it 'hides other role specific links' do
expect(response.body).not_to include supervisor_dashboard_path
expect(response.body).not_to include orga_dashboard_path
expect(response.body).not_to include students_status_updates_path
end
end
end
end
@@ -0,0 +1,15 @@
require 'spec_helper'

describe Orga::DashboardController do
describe 'routing' do
it 'routes to #index' do
expect(get 'orga/').to route_to 'orga/dashboard#index'
end
end

describe 'routing helpers' do
it 'routes get orga_dashboard_path to #index' do
expect(get orga_dashboard_path).to route_to 'orga/dashboard#index'
end
end
end