Skip to content

Commit b23c3d5

Browse files
alouanemedmdeiters
authored andcommitted
Add annotations to actions [ci skip]
1 parent 75ed6d8 commit b23c3d5

25 files changed

+151
-7
lines changed

app/controllers/accounts_controller.rb

+5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ class AccountsController < ApplicationController
66
before_action :determine_plan, only: [:create, :update]
77
before_action :ensure_eligibility, only: [:new]
88

9+
# GET /teams/:team_id/account/new(.:format)
910
def new
1011
@account ||= current_user.team.build_account
1112
@plan = params[:public_id]
1213
end
1314

15+
# POST /teams/:team_id/account(.:format)
1416
def create
1517
redirect_to teamname_path(slug: @team.slug) if @plan.free?
1618

@@ -31,6 +33,7 @@ def create
3133
end
3234
end
3335

36+
# PUT /teams/:team_id/account(.:format)
3437
def update
3538
if @account.update_attributes(account_params) && @account.save_with_payment(@plan)
3639
redirect_to new_team_opportunity_path(@team), notice: "You are subscribed to #{@plan.name}." + plan_capability(@plan, @team)
@@ -40,6 +43,7 @@ def update
4043
end
4144
end
4245

46+
# GET /webhooks/stripe(.:format)
4347
def webhook
4448
data = JSON.parse request.body.read
4549
if data[:type] == "invoice.payment_succeeded"
@@ -55,6 +59,7 @@ def webhook
5559
end
5660
end
5761

62+
# POST /teams/:team_id/account/send_invoice(.:format)
5863
def send_invoice
5964
team, period = Team.find(params[:team_id]), 1.month.ago
6065

app/controllers/achievements_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class AchievementsController < ApplicationController
66

77
respond_to :json, only: [:award]
88

9+
# GET /:username/achievements/:id(.:format)
910
def show
1011
show_achievements_params = params.permit(:id, :username)
1112

@@ -14,6 +15,7 @@ def show
1415
redirect_to(destination_url) if @badge && @user.username.downcase != show_achievements_params[:username].downcase
1516
end
1617

18+
# POST /award(.:format)
1719
def award
1820

1921
award_params = params.permit(:badge, :twitter, :linkedin, :github, :date)

app/controllers/alerts_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class AlertsController < ApplicationController
77
GA_VISITORS_ALERT_INTERVAL = 30.minutes
88
TRACTION_ALERT_INTERVAL = 30.minutes
99

10+
# GET /alerts(.:format)
1011
def create
1112
case @alert[:type].to_sym
1213
when :traction
@@ -18,6 +19,7 @@ def create
1819
head(:ok)
1920
end
2021

22+
#GET /alerts(.:format)
2123
def index
2224
@alerts = []
2325
[:traction, :google_analytics].each do |type|

app/controllers/bans_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class BansController < BaseAdminController
2+
3+
# POST /users/:user_id/bans(.:format)
24
def create
35
ban_params = params.permit(:user_id)
46
user = User.find(ban_params[:user_id])

app/controllers/callbacks/hawt_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Callbacks::HawtController < ApplicationController
77
protect_from_forgery with: :null_session
88
respond_to :json
99

10+
# POST /callbacks/hawt/feature(.:format)
1011
def feature
1112
logger.ap(params, :debug)
1213

@@ -17,6 +18,7 @@ def feature
1718
end
1819
end
1920

21+
# POST /callbacks/hawt/unfeature(.:format)
2022
def unfeature
2123
unfeature!(hawt_callback_params[:protip_id], hawt_callback_params[:hawt?])
2224

app/controllers/comments_controller.rb

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class CommentsController < ApplicationController
77
before_action :lookup_protip, only: [:create]
88
before_action :require_moderator!, only: [:mark_as_spam]
99

10+
# POST /p/:protip_id/comments(.:format)
1011
def create
1112
redirect_to_signup_if_unauthenticated(request.referer + "?" + (comment_params.try(:to_query) || ""), "You must signin/signup to add a comment") do
1213
@comment = @protip.comments.build(comment_params)
@@ -26,6 +27,7 @@ def create
2627
end
2728
end
2829

30+
# PUT /p/:protip_id/comments/:id(.:format)
2931
def update
3032
respond_to do |format|
3133
if @comment.update_attributes(comment_params)
@@ -38,6 +40,7 @@ def update
3840
end
3941
end
4042

43+
# DELETE /p/:protip_id/comments/:id(.:format)
4144
def destroy
4245
return head(:forbidden) if @comment.nil?
4346
@comment.destroy
@@ -47,6 +50,7 @@ def destroy
4750
end
4851
end
4952

53+
# POST /p/:protip_id/comments/:id/like(.:format)
5054
def like
5155
redirect_to_signup_if_unauthenticated(request.referer, "You must signin/signup to like a comment") do
5256
@comment.like_by(current_user)
@@ -57,6 +61,7 @@ def like
5761
end
5862
end
5963

64+
# POST /p/:protip_id/comments/:id/mark_as_spam(.:format)
6065
def mark_as_spam
6166
@comment.mark_as_spam
6267
respond_to do |format|

app/controllers/emails_controller.rb

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class EmailsController < ApplicationController
2+
3+
# GET /unsubscribe(.:format)
24
def unsubscribe
35
Rails.logger.info("Mailgun Unsubscribe: #{params.inspect}")
46
if mailgun?(ENV['MAILGUN_API_KEY'], params['token'], params['timestamp'], params['signature'])
@@ -17,6 +19,7 @@ def unsubscribe
1719
return head(200)
1820
end
1921

22+
# GET /delivered(.:format)
2023
def delivered
2124
Rails.logger.info("Mailgun Delivered: #{params.inspect}")
2225
if mailgun?(ENV['MAILGUN_API_KEY'], params['token'], params['timestamp'], params['signature'])

app/controllers/endorsements_controller.rb

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class EndorsementsController < ApplicationController
22

3+
# GET /users/:user_id/endorsements(.:format)
34
def index
45
flash[:notice] = 'You must be signed in to make an endorsement.'
56
#This is called when someone tries to endorse while unauthenticated
@@ -8,6 +9,7 @@ def index
89
redirect_to(signin_path)
910
end
1011

12+
# POST /users/:user_id/endorsements(.:format)
1113
def create
1214
return head(:forbidden) unless signed_in? && params[:user_id] != current_user.id.to_s
1315
@user = User.find(params[:user_id])
@@ -21,6 +23,8 @@ def create
2123
}
2224
end
2325

26+
# GET /users/:user_id/endorsements/:id(.:format)
27+
# GET /:username/endorsements.json(.:format)
2428
def show #Used by api.coderwall.com
2529
@user = User.find_by_username(params[:username])
2630
return head(:not_found) if @user.nil?

app/controllers/errors_controller.rb

+4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
class ErrorsController < ApplicationController
2+
3+
# GET|POST|PATCH|DELETE /404(.:format)
24
def not_found
35
render status: :not_found
46
end
57

8+
# GET|POST|PATCH|DELETE /422(.:format)
69
def unacceptable
710
respond_to do |format|
811
format.html { render 'public/422', status: :unprocessable_entity }
@@ -11,6 +14,7 @@ def unacceptable
1114
end
1215
end
1316

17+
# GET|POST|PATCH|DELETE /500(.:format)
1418
def internal_error
1519
respond_to do |format|
1620
format.html { render 'public/500', status: :internal_server_error }

app/controllers/follows_controller.rb

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ class FollowsController < ApplicationController
44

55
helper_method :is_viewing_followers?
66

7+
# GET /users/:user_id/follows(.:format)
8+
# GET /:username/followers(.:format)
9+
# GET /:username/following(.:format)
710
def index
811
@user = User.find_by_username(params[:username])
912
return redirect_to(user_follows_url(username: current_user.username)) unless @user == current_user || current_user.admin?
@@ -16,6 +19,7 @@ def index
1619
@network = @network.order('score_cache DESC').page(params[:page]).per(50)
1720
end
1821

22+
# POST /users/:username/follow(.:format)
1923
def create
2024
apply_cache_buster
2125

app/controllers/home_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class HomeController < ApplicationController
22
layout 'home4-layout'
3-
3+
# GET /welcome(.:format)
44
def index
55
return redirect_to destination_url, flash: flash if signed_in?
66
end

app/controllers/invitations_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
class InvitationsController < ApplicationController
22

3+
# GET /invitations/:id(.:format)
4+
# GET /i/:id/:r(.:format)
35
def show
46
@team = Team.find(params[:id])
57
invitation_failed! unless @team.has_user_with_referral_token?(params[:r])

app/controllers/members_controller.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class MembersController < ApplicationController
22
before_action :set_team
33

4+
# DELETE /teams/:team_id/members/:id(.:format)
45
def destroy
56
self_removal = current_user.id == params[:id]
67
return head(:forbidden) unless signed_in? && (@team.admin?(current_user) || self_removal)

app/controllers/networks_controller.rb

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class NetworksController < ApplicationController
77
respond_to :html, :json, :js
88
cache_sweeper :follow_sweeper, only: [:join, :leave]
99

10+
# GET /n(.:format)
1011
def index
1112
@index_networks_params = params.permit(:sort, :action)
1213

@@ -18,6 +19,7 @@ def index
1819
end
1920
end
2021

22+
#POST /n/:id/join(.:format)
2123
def join
2224
redirect_to_signup_if_unauthenticated(request.referer, 'You must login/signup to join a network') do
2325
return leave if current_user.member_of?(@network)
@@ -28,6 +30,7 @@ def join
2830
end
2931
end
3032

33+
# POST /n/:id/leave(.:format)
3134
def leave
3235
redirect_to_signup_if_unauthenticated(request.referer, 'You must login/signup to leave a network') do
3336
return join unless current_user.member_of?(@network)

app/controllers/opportunities_controller.rb

+12-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class OpportunitiesController < ApplicationController
66
before_action :verify_payment, only: [:new, :create]
77
before_action :stringify_location, only: [:create, :update]
88

9+
# POST /teams/:team_id/opportunities/:id/apply(.:format)
910
def apply
1011
redirect_to_signup_if_unauthenticated(request.referer, "You must login/signup to apply for an opportunity") do
1112
job = Opportunity.find(params[:id])
@@ -20,14 +21,17 @@ def apply
2021
end
2122
end
2223

24+
# GET /teams/:team_id/opportunities/new(.:format)
2325
def new
2426
team_id = params[:team_id]
2527
@job = Opportunity.new(team_id: team_id)
2628
end
2729

30+
# GET /teams/:team_id/opportunities/:id/edit(.:format)
2831
def edit
2932
end
3033

34+
# POST /teams/:team_id/opportunities(.:format)
3135
def create
3236
opportunity_create_params = params.require(:opportunity).permit(:name, :team_id, :opportunity_type, :description, :tag_list, :location, :link, :salary, :apply, :remote)
3337
@job = Opportunity.new(opportunity_create_params)
@@ -41,6 +45,7 @@ def create
4145
end
4246
end
4347

48+
# PUT /teams/:team_id/opportunities/:id(.:format)
4449
def update
4550
opportunity_update_params = params.require(:opportunity).permit(:id, :name, :team_id, :opportunity_type, :description, :tag_list, :location, :link, :salary, :apply)
4651
respond_to do |format|
@@ -52,30 +57,33 @@ def update
5257
end
5358
end
5459

60+
# GET /teams/:team_id/opportunities/:id/activate(.:format)
5561
def activate
5662
@job.activate!
5763
header_ok
5864
end
5965

66+
# GET /teams/:team_id/opportunities/:id/deactivate(.:format)
6067
def deactivate
6168
@job.deactivate!
6269
header_ok
6370
end
6471

72+
# POST /teams/:team_id/opportunities/:id/visit(.:format)
6573
def visit
6674
unless is_admin?
6775
viewing_user.track_opportunity_view!(@job) if viewing_user
6876
@job.viewed_by(viewing_user || session_id)
6977
end
7078
header_ok
7179
end
72-
80+
81+
# GET /jobs(/:location(/:skill))(.:format)
7382
def index
7483
current_user.seen(:jobs) if signed_in?
7584
store_location! unless signed_in?
7685
chosen_location = (params[:location] || closest_to_user(current_user)).try(:titleize)
7786
chosen_location = nil if chosen_location == 'Worldwide'
78-
7987
@remote_allowed = params[:remote] == 'true'
8088

8189
@page = params[:page].try(:to_i) || 1
@@ -94,13 +102,14 @@ def index
94102
@lat, @lng = geocode_location(chosen_location)
95103

96104
respond_to do |format|
97-
format.html { render layout: 'jobs' }
105+
format.html { render layout: 'coderwallv2' }
98106
format.json { render json: @jobs.map(&:to_public_hash) }
99107
format.js
100108
end
101109

102110
end
103111

112+
# GET /jobs-map(.:format)
104113
def map
105114
@job_locations = all_job_locations
106115
@job_skills = all_job_skills

app/controllers/pages_controller.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
class PagesController < ApplicationController
22

3-
3+
# GET /faq(.:format)
4+
# GET /tos(.:format)
5+
# GET /privacy_policy(.:format)
6+
# GET /contact_us(.:format)
7+
# GET /api(.:format)
8+
# GET /achievements(.:format)
9+
# GET /pages/:page(.:format)
410
def show
511
show_pages_params = params.permit(:page, :layout)
612

app/controllers/pictures_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class PicturesController < ApplicationController
2+
3+
# POST /users/:user_id/pictures(.:format)
24
def create
35
picture = current_user.create_picture(file: params[:picture])
46
render json: picture

0 commit comments

Comments
 (0)