Skip to content

Commit 8f5413a

Browse files
committed
Add annotations to actions
1 parent b3ee87f commit 8f5413a

17 files changed

+511
-6
lines changed

app/controllers/accounts_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def update
4040
end
4141
end
4242

43+
# GET /webhooks/stripe(.:format)
4344
def webhook
4445
data = JSON.parse request.body.read
4546
if data[:type] == "invoice.payment_succeeded"

app/controllers/achievements_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def show
1414
redirect_to(destination_url) if @badge && @user.username.downcase != show_achievements_params[:username].downcase
1515
end
1616

17+
# POST /award(.:format)
1718
def award
1819

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

app/controllers/alerts_controller.rb

Lines changed: 2 additions & 0 deletions
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/comments_controller.rb

Lines changed: 5 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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/follows_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def index
1616
@network = @network.order('score_cache DESC').page(params[:page]).per(50)
1717
end
1818

19+
# POST /users/:username/follow(.:format)
1920
def create
2021
apply_cache_buster
2122

app/controllers/home_controller.rb

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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/networks_controller.rb

Lines changed: 3 additions & 0 deletions
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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ def visit
6969
end
7070
header_ok
7171
end
72-
72+
73+
# GET /jobs(/:location(/:skill))(.:format)
7374
def index
7475
current_user.seen(:jobs) if signed_in?
7576
store_location! unless signed_in?
7677
chosen_location = (params[:location] || closest_to_user(current_user)).try(:titleize)
7778
chosen_location = nil if chosen_location == 'Worldwide'
78-
7979
@remote_allowed = params[:remote] == 'true'
8080

8181
@page = params[:page].try(:to_i) || 1
@@ -94,13 +94,14 @@ def index
9494
@lat, @lng = geocode_location(chosen_location)
9595

9696
respond_to do |format|
97-
format.html { render layout: 'jobs' }
97+
format.html { render layout: 'coderwallv2' }
9898
format.json { render json: @jobs.map(&:to_public_hash) }
9999
format.js
100100
end
101101

102102
end
103103

104+
# GET /jobs-map(.:format)
104105
def map
105106
@job_locations = all_job_locations
106107
@job_skills = all_job_skills

app/controllers/pages_controller.rb

Lines changed: 7 additions & 1 deletion
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/protips_controller.rb

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ class ProtipsController < ApplicationController
1818

1919
layout :choose_protip_layout
2020

21+
# root /
22+
#GET /p(.:format)
2123
def index
2224
trending
2325
end
2426

27+
# GET /p/t/trending(.:format)
2528
def trending
2629
@context = "trending"
2730
track_discovery
@@ -30,6 +33,7 @@ def trending
3033
render :index
3134
end
3235

36+
# GET /p/popular(.:format)
3337
def popular
3438
@context = "popular"
3539
track_discovery
@@ -38,6 +42,7 @@ def popular
3842
render :index
3943
end
4044

45+
# GET /p/fresh(.:format)
4146
def fresh
4247
redirect_to_signup_if_unauthenticated(protips_path, "You must login/signup to view fresh protips from coders, teams and networks you follow") do
4348
@context = "fresh"
@@ -48,6 +53,7 @@ def fresh
4853
end
4954
end
5055

56+
# GET /p/liked(.:format)
5157
def liked
5258
redirect_to_signup_if_unauthenticated(protips_path, "You must login/signup to view protips you have liked/upvoted") do
5359
@context = "liked"
@@ -58,6 +64,7 @@ def liked
5864
end
5965
end
6066

67+
# GET /p/u/:username(.:format)
6168
def user
6269
user_params = params.permit(:username, :page, :per_page)
6370

@@ -71,6 +78,7 @@ def user
7178
render :topic
7279
end
7380

81+
# GET /p/team/:team_slug(.:format)
7482
def team
7583
team_params = params.permit(:team_slug, :page, :per_page)
7684

@@ -83,6 +91,7 @@ def team
8391
render :topic
8492
end
8593

94+
# GET /p/d/:date(/:start)(.:format)
8695
def date
8796
date_params = params.permit(:date, :query, :page, :per_page)
8897

@@ -98,6 +107,7 @@ def date
98107
render :topic
99108
end
100109

110+
# GET /p/me(.:format)
101111
def me
102112
me_params = params.permit(:section, :page, :per_page)
103113

@@ -108,6 +118,9 @@ def me
108118
@topic_user = nil
109119
end
110120

121+
# GET /p/dpvbbg(.:format)
122+
# GET /gh(.:format)
123+
# GET /p/:id/:slug(.:format)
111124
def show
112125
show_params = if is_admin?
113126
params.permit(:reply_to, :q, :t, :i, :p)
@@ -127,11 +140,13 @@ def show
127140
respond_with @protip
128141
end
129142
143+
# GET /p/random(.:format)
130144
def random
131145
@protip = Protip.random(1).first
132146
render :show
133147
end
134148
149+
# GET /p/new(.:format)
135150
def new
136151
new_params = params.permit(:topic_list)
137152
@@ -140,10 +155,12 @@ def new
140155
respond_with @protip
141156
end
142157
158+
# GET /p/:id/edit(.:format)
143159
def edit
144160
respond_with @protip
145161
end
146162
163+
# POST /p(.:format)
147164
def create
148165
create_params = if params[:protip] && params[:protip].keys.present?
149166
params.require(:protip).permit(:title, :body, :user_id, :topic_list)
@@ -165,6 +182,7 @@ def create
165182
end
166183
end
167184
185+
# protips_update GET|PUT /protips/update(.:format) protips#update
168186
def update
169187
# strong_parameters will intentionally fail if a key is present but has an empty hash. :(
170188
update_params = if params[:protip] && params[:protip].keys.present?
@@ -197,16 +215,19 @@ def destroy
197215
end
198216
end
199217
218+
# POST /p/:id/upvote(.:format)
200219
def upvote
201220
@protip.upvote_by(viewing_user, tracking_code, request.remote_ip)
202221
@protip
203222
end
204223
224+
# POST /p/:id/tag(.:format)
205225
def tag
206226
tag_params = params.permit(:topic_list)
207227
@protip.topic_list.add(tag_params[:topic_list]) unless tag_params[:topic_list].nil?
208228
end
209229
230+
# PUT /p/t(/*tags)/subscribe(.:format)
210231
def subscribe
211232
tags = params.permit(:tags)
212233
redirect_to_signup_if_unauthenticated(view_context.topic_protips_path(tags)) do
@@ -217,6 +238,7 @@ def subscribe
217238
end
218239
end
219240
241+
# PUT /p/t(/*tags)/unsubscribe(.:format)
220242
def unsubscribe
221243
tags = params.permit(:tags)
222244
redirect_to_signup_if_unauthenticated(view_context.topic_protips_path(tags)) do
@@ -227,6 +249,7 @@ def unsubscribe
227249
end
228250
end
229251
252+
# POST /p/:id/report_inappropriate(.:format)
230253
def report_inappropriate
231254
protip_public_id = params[:id]
232255
protip = Protip.find_by_public_id!(protip_public_id)
@@ -241,7 +264,8 @@ def report_inappropriate
241264
end
242265
end
243266
244-
def flag
267+
# POST /p/:id/flag(.:format)
268+
def flag
245269
times_to_flag = is_moderator? ? Protip::MIN_FLAG_THRESHOLD : 1
246270
times_to_flag.times do
247271
@protip.flag
@@ -270,6 +294,7 @@ def unflag
270294
end
271295
end
272296
297+
# POST /p/:id/feature(.:format)
273298
def feature
274299
#TODO change with @protip.toggle_featured_state!
275300
if @protip.featured?
@@ -287,6 +312,7 @@ def feature
287312
end
288313
end
289314
315+
#POST /p/:id/delete_tag/:topic(.:format) protips#delete_tag {:topic=>/[A-Za-z0-9#\$\+\-_\.(%23)(%24)(%2B)]+/}
290316
def delete_tag
291317
@protip.topic_list.remove(params.permit(:topic))
292318
respond_to do |format|
@@ -300,6 +326,7 @@ def delete_tag
300326
end
301327
end
302328
329+
# GET /p/admin(.:format)
303330
def admin
304331
admin_params = params.permit(:page, :per_page)
305332
@@ -309,6 +336,7 @@ def admin
309336
render :topic
310337
end
311338
339+
# GET /p/t/by_tags(.:format)
312340
def by_tags
313341
by_tags_params = params.permit(:page, :per_page)
314342
@@ -318,6 +346,7 @@ def by_tags
318346
@tags = ActsAsTaggableOn::Tag.joins('inner join taggings on taggings.tag_id = tags.id').group('tags.id').order('count(tag_id) desc').page(page).per(per_page)
319347
end
320348
349+
# POST /p/preview(.:format)
321350
def preview
322351
preview_params = params.require(:protip).permit(:title, :body)
323352
@@ -330,6 +359,7 @@ def preview
330359
render partial: 'protip', locals: { protip: protip, mode: 'preview', include_comments: false, job: nil }
331360
end
332361
362+
# POST - GET /p/search(.:format)
333363
def search
334364
search_params = params.permit(:search)
335365

0 commit comments

Comments
 (0)