Skip to content

Commit

Permalink
Rubocop controllers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hari Gopal committed Sep 17, 2015
1 parent 2e60e4d commit 5ad4b5b
Show file tree
Hide file tree
Showing 17 changed files with 203 additions and 223 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Expand Up @@ -8,6 +8,7 @@ AllCops:
- 'db/**/*'
- 'app/models/mentor_meeting.rb'
- 'app/models/mentor.rb'
- 'app/controllers/mentoring_controller.rb'
StringLiterals:
Enabled: false
Documentation:
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/about_controller.rb
Expand Up @@ -19,7 +19,7 @@ def leaderboard

# GET /about/press-kit
def press_kit
@press_kit_url = "https://drive.google.com/folderview?id=0B9--SdQuJvHpfjJiam1nTnJCNnVIYkY2NVFXWTQwbXNpWUFoQU1oc1RZSHJraG4yb2Y1cDA&usp=sharing"
@press_kit_url = 'https://drive.google.com/folderview?id=0B9--SdQuJvHpfjJiam1nTnJCNnVIYkY2NVFXWTQwbXNpWUFoQU1oc1RZSHJraG4yb2Y1cDA&usp=sharing'
end

# GET /about/office-hours
Expand Down
13 changes: 9 additions & 4 deletions app/controllers/application_controller.rb
Expand Up @@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
before_filter :set_content_security_policy

def raise_not_found
raise ActionController::RoutingError.new('Not Found')
fail ActionController::RoutingError, 'Not Found'
end

def after_sign_in_path_for(resource)
Expand Down Expand Up @@ -36,13 +36,18 @@ def feature_active?(feature)
helper_method :feature_active?

def configure_permitted_parameters
# TODO: Clean this method up. What is this about, anyway?!
devise_parameter_sanitizer.for(:accept_invitation).concat [:avatar, :twitter_url, :linkedin_url]
# TODO
# Unpermitted parameters: salutation, fullname, born_on(1i), born_on(2i), born_on(3i), is_student, college, course, semester
devise_parameter_sanitizer.for(:sign_up).concat [:fullname]
devise_parameter_sanitizer.for(:accept_invitation).concat [:salutation, :fullname, :email, :born_on, :is_student, :college_id, :course, :semester, :startup, :accept_startup]
devise_parameter_sanitizer.for(:accept_invitation).concat(
[
:salutation, :fullname, :email, :born_on, :is_student, :college_id, :course, :semester, :startup, :accept_startup
]
)
end

# Set headers for CSP. Be careful when changing this.
def set_content_security_policy
image_sources = "img-src 'self' " + [
'https://www.google-analytics.com https://blog.sv.co https://www.startatsv.com http://www.startatsv.com',
Expand All @@ -51,7 +56,7 @@ def set_content_security_policy

csp_directives = [
image_sources,
"script-src 'self' https://ajax.googleapis.com https://www.google-analytics.com " +
"script-src 'self' https://ajax.googleapis.com https://www.google-analytics.com " \
'https://blog.sv.co https://www.youtube.com http://www.startatsv.com https://assets.sv.co;',
"style-src 'self' 'unsafe-inline' fonts.googleapis.com https://assets.sv.co;",
"connect-src 'self';",
Expand Down
124 changes: 63 additions & 61 deletions app/controllers/faculty_controller.rb
@@ -1,66 +1,68 @@
class FacultyController < ApplicationController
def index
@faculty = {
advisory_board: [
{ name: "Kris Gopalakrishnan", title: "Chief Mentor, Co-Founder Infosys" },
{ name: "Kiran Karnik", title: "Board Member, Reserve Bank of India" },
{ name: "Dr. H.K. Mittal", title: "Head, NSTEDB, Department of Science and Technology, Government of India" },
{ name: "Rajan Mathews", title: "Director Generator, Cellular Operators Association of India" },
{ name: "Annie Mathew", title: "Research in Motion" },
{ name: "Murali Gopalan", title: "Charter Member, TIE" },
{ name: "R.K. Nair", title: "Ex CEO, Technopark" },
{ name: "Dr. K.C.C. Nair", title: "Ex CFO, Technopark" },
{ name: "Dr. Jayasankar Prasad", title: "CEO, Kerala Startup Mission" },
{ name: "K.T. Rajagopalan", title: "Ex Director, State Bank of Travancore" },
{ name: "Dr. B. Anil", title: "Principal, Government Engineering College, Barton Hill" }
],
visiting_faculty: [
{ name: "Abhishek Goyal", title: "Co-Founder, Traxcn Labs", key_skills: "Business Ideas", linked_in: "https://www.linkedin.com/in/abhishekgoyal" },
{ name: "Nishant Verman", title: "Director of Corporate Development, Flipkart", key_skills: "Acquisitions", linked_in: "https://in.linkedin.com/in/nishantverman" },
{ name: "Sharad Sharma", title: "Co-Founder, Ispirt", key_skills: "Angel Investments", linked_in: "https://www.linkedin.com/in/sharadsharma" },
{ name: "Karan Mohla", title: "Executive Director, IDG Ventures", key_skills: "Angel Investments", linked_in: "https://in.linkedin.com/pub/karan-mohla/0/998/153" },
{ name: "Sunil Kalra", title: "Professional Angel Investor", key_skills: "Angel Investments", linked_in: "https://www.linkedin.com/pub/sunil-kalra/21/9a6/a12" },
{ name: "Alok Bajpai", title: "Co-Founder IXIGO", key_skills: "Product Strategy", linked_in: "https://www.linkedin.com/in/alokebajpai" },
{ name: "Krishnakumar Natarajan", title: "Co-Founder Mindtree", key_skills: "Scaling up", linked_in: "https://www.linkedin.com/pub/krishnakumar-natarajan/0/338/839" },
{ name: "George Brody", title: "Founder, Globe Ranger", key_skills: "Product Strategy", linked_in: "https://www.linkedin.com/in/georgebrodyprofile" },
{ name: "Ganesh Lakshminarayan", title: "Consultant @ Sequoia Capital", key_skills: "Scaling up", linked_in: "https://www.linkedin.com/in/ganeshls" },
{ name: "Sasha Mirchandani", title: "Founder, Kae Capital", key_skills: "Angel Investments", linked_in: "https://www.linkedin.com/pub/sasha-mirchandani/13/489/81a" },
{ name: "Phanindra Sama", title: "Founder, Red Bus", key_skills: "Business Ideas", linked_in: "https://www.linkedin.com/pub/sasha-mirchandani/13/489/81a" },
{ name: "Nandakumar", title: "CEO, SunTec", key_skills: "Scaling up", linked_in: "https://in.linkedin.com/in/knandakumar" },
{ name: "Aakrit Vaish", title: "Co-Founder, Haptik", key_skills: "Product Strategy", linked_in: "https://www.linkedin.com/in/aakrit" },
{ name: "Ravi Kiran", title: "Co-Founder, Venture Nursery", key_skills: "Accelerating Startups", linked_in: "http://in.linkedin.com/in/ravitwo" },
{ name: "Shradha Sharma", title: "Founder, Yourstory", key_skills: "Public Relations", linked_in: "https://www.linkedin.com/in/sharmashradha" },
{ name: "Amit Gupta", title: "Co-Founder InMobi", key_skills: "Startup Revenues", linked_in: "https://www.linkedin.com/in/amitgupta007" },
{ name: "Freeman Murray", title: "Founder, Jaaga", key_skills: "Startup Prototyping", linked_in: "http://in.linkedin.com/in/freemanmurray" },
{ name: "Shashi Dharan", title: "Founder of BE Group", key_skills: "Public Relations", linked_in: "https://www.linkedin.com/pub/shashi-dharan/9/583/396" }
],
team: [
{ name: "Sanjay Vijayakumar", title: "Chairman" },
{ name: "Pranav Suresh", title: "CEO" },
{ name: "Vishnu Gopal", title: "CTO" },
{ name: "Gautham", title: "COO" },
{ name: "Rohan Kalani", title: "AVP Operations & Finance"},
{ name: "Hari Gopal", title: "Engineering Architect"},
{ name: "Joby Joseph", title: "Product" },
{ name: "Naveen Narayanan", title: "Academic Relations" },
{ name: "Daniel Jeevan", title: "Digital Strategist" },
{ name: "Aditya Nair", title: "Governance & Strategic Initiatives" },
{ name: "Abdul Jaleel", title: "Software Engineer"},
{ name: "Sreerag Dileep", title: "Governance & Operations" },
{ name: "Dinnu Nijo", title: "Incubation" },
{ name: "Sebin John Mathew", title: "Communications & Operations" },
{ name: "Shameem P", title: "Client Relations"},
{ name: "Kiran Baby", title: "Client Relations" },
{ name: "Manoj Krishnan", title: "Head, Startup Studio" },
{ name: "Varun M", title: "Academic & Client Relations" },
{ name: "Vasudeva Rao Thumati", title: "Operations"},
{ name: "Kireeti Varma", title: "Operations"},
{ name: "Bharat Pinnam", title: "Operations", linked_in: "https://in.linkedin.com/pub/pinnam-bharat/64/a6a/3a2" },
{ name: "Mini M", title: "Administration"},
{ name: "Shajahan Ibrahim", title: "Administration" }
]
}
# rubocop:disable Metrics/LineLength
FACULTY = {
advisory_board: [
{ name: "Kris Gopalakrishnan", title: "Chief Mentor, Co-Founder Infosys" },
{ name: "Kiran Karnik", title: "Board Member, Reserve Bank of India" },
{ name: "Dr. H.K. Mittal", title: "Head, NSTEDB, Department of Science and Technology, Government of India" },
{ name: "Rajan Mathews", title: "Director Generator, Cellular Operators Association of India" },
{ name: "Annie Mathew", title: "Research in Motion" },
{ name: "Murali Gopalan", title: "Charter Member, TIE" },
{ name: "R.K. Nair", title: "Ex CEO, Technopark" },
{ name: "Dr. K.C.C. Nair", title: "Ex CFO, Technopark" },
{ name: "Dr. Jayasankar Prasad", title: "CEO, Kerala Startup Mission" },
{ name: "K.T. Rajagopalan", title: "Ex Director, State Bank of Travancore" },
{ name: "Dr. B. Anil", title: "Principal, Government Engineering College, Barton Hill" }
],
visiting_faculty: [
{ name: "Abhishek Goyal", title: "Co-Founder, Traxcn Labs", key_skills: "Business Ideas", linked_in: "https://www.linkedin.com/in/abhishekgoyal" },
{ name: "Nishant Verman", title: "Director of Corporate Development, Flipkart", key_skills: "Acquisitions", linked_in: "https://in.linkedin.com/in/nishantverman" },
{ name: "Sharad Sharma", title: "Co-Founder, Ispirt", key_skills: "Angel Investments", linked_in: "https://www.linkedin.com/in/sharadsharma" },
{ name: "Karan Mohla", title: "Executive Director, IDG Ventures", key_skills: "Angel Investments", linked_in: "https://in.linkedin.com/pub/karan-mohla/0/998/153" },
{ name: "Sunil Kalra", title: "Professional Angel Investor", key_skills: "Angel Investments", linked_in: "https://www.linkedin.com/pub/sunil-kalra/21/9a6/a12" },
{ name: "Alok Bajpai", title: "Co-Founder IXIGO", key_skills: "Product Strategy", linked_in: "https://www.linkedin.com/in/alokebajpai" },
{ name: "Krishnakumar Natarajan", title: "Co-Founder Mindtree", key_skills: "Scaling up", linked_in: "https://www.linkedin.com/pub/krishnakumar-natarajan/0/338/839" },
{ name: "George Brody", title: "Founder, Globe Ranger", key_skills: "Product Strategy", linked_in: "https://www.linkedin.com/in/georgebrodyprofile" },
{ name: "Ganesh Lakshminarayan", title: "Consultant @ Sequoia Capital", key_skills: "Scaling up", linked_in: "https://www.linkedin.com/in/ganeshls" },
{ name: "Sasha Mirchandani", title: "Founder, Kae Capital", key_skills: "Angel Investments", linked_in: "https://www.linkedin.com/pub/sasha-mirchandani/13/489/81a" },
{ name: "Phanindra Sama", title: "Founder, Red Bus", key_skills: "Business Ideas", linked_in: "https://www.linkedin.com/pub/sasha-mirchandani/13/489/81a" },
{ name: "Nandakumar", title: "CEO, SunTec", key_skills: "Scaling up", linked_in: "https://in.linkedin.com/in/knandakumar" },
{ name: "Aakrit Vaish", title: "Co-Founder, Haptik", key_skills: "Product Strategy", linked_in: "https://www.linkedin.com/in/aakrit" },
{ name: "Ravi Kiran", title: "Co-Founder, Venture Nursery", key_skills: "Accelerating Startups", linked_in: "http://in.linkedin.com/in/ravitwo" },
{ name: "Shradha Sharma", title: "Founder, Yourstory", key_skills: "Public Relations", linked_in: "https://www.linkedin.com/in/sharmashradha" },
{ name: "Amit Gupta", title: "Co-Founder InMobi", key_skills: "Startup Revenues", linked_in: "https://www.linkedin.com/in/amitgupta007" },
{ name: "Freeman Murray", title: "Founder, Jaaga", key_skills: "Startup Prototyping", linked_in: "http://in.linkedin.com/in/freemanmurray" },
{ name: "Shashi Dharan", title: "Founder of BE Group", key_skills: "Public Relations", linked_in: "https://www.linkedin.com/pub/shashi-dharan/9/583/396" }
],
team: [
{ name: "Sanjay Vijayakumar", title: "Chairman" },
{ name: "Pranav Suresh", title: "CEO" },
{ name: "Vishnu Gopal", title: "CTO" },
{ name: "Gautham", title: "COO" },
{ name: "Rohan Kalani", title: "AVP Operations & Finance" },
{ name: "Hari Gopal", title: "Engineering Architect" },
{ name: "Joby Joseph", title: "Product" },
{ name: "Naveen Narayanan", title: "Academic Relations" },
{ name: "Daniel Jeevan", title: "Digital Strategist" },
{ name: "Aditya Nair", title: "Governance & Strategic Initiatives" },
{ name: "Abdul Jaleel", title: "Software Engineer" },
{ name: "Sreerag Dileep", title: "Governance & Operations" },
{ name: "Dinnu Nijo", title: "Incubation" },
{ name: "Sebin John Mathew", title: "Communications & Operations" },
{ name: "Shameem P", title: "Client Relations" },
{ name: "Kiran Baby", title: "Client Relations" },
{ name: "Manoj Krishnan", title: "Head, Startup Studio" },
{ name: "Varun M", title: "Academic & Client Relations" },
{ name: "Vasudeva Rao Thumati", title: "Operations" },
{ name: "Kireeti Varma", title: "Operations" },
{ name: "Bharat Pinnam", title: "Operations", linked_in: "https://in.linkedin.com/pub/pinnam-bharat/64/a6a/3a2" },
{ name: "Mini M", title: "Administration" },
{ name: "Shajahan Ibrahim", title: "Administration" }
]
}

def index
@faculty = FACULTY
@skip_container = true
end
end
35 changes: 0 additions & 35 deletions app/controllers/founders_controller.rb

This file was deleted.

44 changes: 23 additions & 21 deletions app/controllers/incubation_controller.rb
Expand Up @@ -28,9 +28,7 @@ def update
# Update startup (and user) with received params.
if @startup.update(incubation_startup_params)
# Finish the incubation flow if submitting from startup profile page.
if step == 'startup_profile'
@startup.finish_incubation_flow!
end
@startup.finish_incubation_flow! if step == 'startup_profile'
end

render_wizard @startup
Expand Down Expand Up @@ -63,7 +61,7 @@ def add_cofounder
flash[:error] = "Couldn't find a user with the SV ID you supplied. Please verify founder's registered email address."
rescue Exceptions::UserAlreadyMemberOfStartup
flash[:info] = 'The SV ID you supplied is already linked to your startup!'
rescue Exceptions:: UserAlreadyHasStartup
rescue Exceptions::UserAlreadyHasStartup
flash[:notice] = 'The SV ID you supplied is already linked to another startup. Are you sure you have the right e-mail address?'
else
flash[:success] = "SV ID #{params[:email]} has been linked to your startup as founder."
Expand All @@ -76,7 +74,7 @@ def add_cofounder

def incubation_startup_params
params.require(:startup).permit(:name, :registration_type, :about, :incubation_location, :website,
:presentation_link, :team_size, :women_employees, :updated_from, { category_ids: [] }, admin_attributes: [
:presentation_link, :team_size, :women_employees, :updated_from, { category_ids: [] }, admin_attributes: [
:id, :gender, :born_on, :roll_number, :communication_address, :district, :state, :pin,
:linkedin_url, :twitter_url, :slack_username, :university_id
])
Expand All @@ -86,33 +84,37 @@ def prevent_repeat!
unless current_user.startup.unready?
if step != 'launch'
flash[:info] = "You've already completed the incubation process. You don't need to repeat that!"
redirect_to root_url and return true
redirect_to root_url
return true
end
end

false
end

def ready_for_incubation_wizard?
redirect_to new_user_startup_url(current_user) and return unless current_user.ready_for_incubation_wizard?
return if current_user.ready_for_incubation_wizard?
redirect_to new_user_startup_url(current_user)
end

def authorize_step!
case params[:id]
when 'startup_profile'
unless current_user.incubation_parameters_available?
flash[:info] = "Please complete your user profile first!"
redirect_to incubation_path(:user_profile) and return
end
when 'launch'
unless current_user.incubation_parameters_available?
flash[:info] = "Please complete your user profile first!"
redirect_to incubation_path(:user_profile) and return
end
unless current_user.startup.incubation_parameters_available?
flash[:info] = "Please complete your startup profile first!"
redirect_to incubation_path(:startup_profile) and return
end
when 'startup_profile'
unless current_user.incubation_parameters_available?
flash[:info] = 'Please complete your user profile first!'
redirect_to incubation_path(:user_profile)
end
when 'launch'
unless current_user.incubation_parameters_available?
flash[:info] = 'Please complete your user profile first!'
redirect_to incubation_path(:user_profile)
return
end

unless current_user.startup.incubation_parameters_available?
flash[:info] = 'Please complete your startup profile first!'
redirect_to incubation_path(:startup_profile)
end
end
end
end

0 comments on commit 5ad4b5b

Please sign in to comment.