Skip to content

Commit 9112dfd

Browse files
committedSep 1, 2017
Clean up controller before adding ember routes
1 parent 7565a09 commit 9112dfd

File tree

2 files changed

+116
-12
lines changed

2 files changed

+116
-12
lines changed
 

‎.rubocop.yml

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
AllCops:
2+
TargetRubyVersion: 2.4
3+
DisabledByDefault: true
4+
Exclude:
5+
- 'db/schema.rb'
6+
- 'bundle/**/*'
7+
- 'vendor/**/*'
8+
- 'node_modules/**/*'
9+
10+
# Prefer &&/|| over and/or.
11+
Style/AndOr:
12+
Enabled: true
13+
14+
# Do not use braces for hash literals when they are the last argument of a
15+
# method call.
16+
Style/BracesAroundHashParameters:
17+
Enabled: true
18+
19+
# Align `when` with `case`.
20+
Layout/CaseIndentation:
21+
Enabled: true
22+
23+
# Align comments with method definitions.
24+
Layout/CommentIndentation:
25+
Enabled: true
26+
27+
# No extra empty lines.
28+
Layout/EmptyLines:
29+
Enabled: true
30+
31+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
32+
Style/HashSyntax:
33+
Enabled: true
34+
35+
# Two spaces, no tabs (for indentation).
36+
Layout/IndentationWidth:
37+
Enabled: true
38+
39+
Layout/SpaceAfterColon:
40+
Enabled: true
41+
42+
Layout/SpaceAfterComma:
43+
Enabled: true
44+
45+
Layout/SpaceAroundEqualsInParameterDefault:
46+
Enabled: true
47+
48+
Layout/SpaceAroundKeyword:
49+
Enabled: true
50+
51+
Layout/SpaceAroundOperators:
52+
Enabled: true
53+
54+
Layout/SpaceBeforeFirstArg:
55+
Enabled: true
56+
57+
# Defining a method with parameters needs parentheses.
58+
Style/MethodDefParentheses:
59+
Enabled: true
60+
61+
# Use `foo {}` not `foo{}`.
62+
Layout/SpaceBeforeBlockBraces:
63+
Enabled: true
64+
65+
# Use `foo { bar }` not `foo {bar}`.
66+
Layout/SpaceInsideBlockBraces:
67+
Enabled: true
68+
69+
# Use `{ a: 1 }` not `{a:1}`.
70+
Layout/SpaceInsideHashLiteralBraces:
71+
Enabled: true
72+
73+
Layout/SpaceInsideParens:
74+
Enabled: true
75+
76+
# Detect hard tabs, no hard tabs.
77+
Layout/Tab:
78+
Enabled: true
79+
80+
# Blank lines should not have any spaces.
81+
Layout/TrailingBlankLines:
82+
Enabled: true
83+
84+
# No trailing whitespace.
85+
Layout/TrailingWhitespace:
86+
Enabled: true
87+
88+
Lint/Debugger:
89+
Enabled: true
90+
91+
Lint/BlockAlignment:
92+
Enabled: true
93+
94+
# Align `end` with the matching keyword or starting expression except for
95+
# assignments, where it should be aligned with the LHS.
96+
Lint/EndAlignment:
97+
Enabled: true
98+
EnforcedStyleAlignWith: variable
99+
100+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
101+
Lint/RequireParentheses:
102+
Enabled: true
103+
104+
Layout/MultilineMethodCallIndentation:
105+
Enabled: true
106+
EnforcedStyle: indented
107+
108+
Layout/AlignHash:
109+
Enabled: true
110+
111+
Bundler/OrderedGems:
112+
Enabled: false
+4-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
require "email_backup_token"
22

3-
class DownloadersController < ApplicationController
4-
skip_before_filter :check_xhr
5-
# skip_before_filter :verify_authenticity_token, :if => Proc.new { |c| c.request.format == 'application/json' }
3+
class DownloadersController < Admin::AdminController
4+
requires_plugin 'discourse-sync-to-googledrive'
65

76
def index
87
google_list = DiscourseDownloadFromDrive::DriveDownloader.new(nil).json_list
9-
10-
respond_to do |format|
11-
format.json {render json: google_list}
12-
format.html {render html: google_list}
13-
end
8+
render json: google_list
149
end
1510

1611
def create
1712
@file_id = params[:file_id]
1813
Jobs.enqueue(:send_download_drive_link, file_id: @file_id)
19-
respond_to do |format|
20-
format.json {render json: @file_id}
21-
format.html {render html: @file_id}
22-
end
14+
render json: { file_id: @file_id }
2315
end
2416
end

0 commit comments

Comments
 (0)
Please sign in to comment.