-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field generators #992
Field generators #992
Conversation
end | ||
|
||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at block body end.
|
||
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :index) | ||
contents = File.read(file("app/views/fields/#{field_type}/_index.html.erb")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [86/80]
|
||
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :form) | ||
contents = File.read(file("app/views/fields/#{field_type}/_form.html.erb")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [85/80]
|
||
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :show) | ||
contents = File.read(file("app/views/fields/#{field_type}/_show.html.erb")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [85/80]
|
||
describe "administrate:views:field all" do | ||
|
||
let(:field_types) { Dir.entries("app/views/fields").reject{ |name| name[0] == "."} } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing to the left of {.
Line is too long. [90/80]
Space missing inside }.
context "for an existing field type" do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at block body beginning.
require "generators/administrate/views/field_generator" | ||
require "support/generator_spec_helpers" | ||
|
||
describe Administrate::Generators::Views::FieldGenerator, :generator do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at block body beginning.
template_file = "#{resource_path}/_#{partial_name}.html.erb" | ||
|
||
copy_file( | ||
template_file, | ||
"app/views/fields/#{template_file}", | ||
) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at class body end.
resource_path = args.first.try(:underscore) | ||
|
||
if resource_path == 'all' | ||
field_types = Dir.entries(self.class.template_source_path).reject{ |name| name[0] == "."} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing to the left of {.
Line is too long. [101/80]
Space missing inside }.
copy_field_partial(:form) | ||
resource_path = args.first.try(:underscore) | ||
|
||
if resource_path == 'all' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
end | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at block body end.
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :index) | ||
contents = File.read( | ||
file("app/views/fields/#{field_type}/_index.html.erb") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a comma after the last parameter of a multiline method call.
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :form) | ||
contents = File.read( | ||
file("app/views/fields/#{field_type}/_form.html.erb") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a comma after the last parameter of a multiline method call.
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :show) | ||
contents = File.read( | ||
file("app/views/fields/#{field_type}/_show.html.erb") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a comma after the last parameter of a multiline method call.
@@ -32,6 +34,52 @@ | |||
expect(contents).to eq(expected_contents) | |||
end | |||
end | |||
|
|||
describe "administrate:views:field all" do | |||
let(:field_types) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
end | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at block body end.
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :index) | ||
contents = File.read( | ||
file("app/views/fields/#{field_type}/_index.html.erb") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a comma after the last parameter of a multiline method call.
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :form) | ||
contents = File.read( | ||
file("app/views/fields/#{field_type}/_form.html.erb") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a comma after the last parameter of a multiline method call.
field_types.each do |field_type| | ||
expected_contents = contents_for_field_template(field_type, :show) | ||
contents = File.read( | ||
file("app/views/fields/#{field_type}/_show.html.erb") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a comma after the last parameter of a multiline method call.
@@ -32,6 +34,52 @@ | |||
expect(contents).to eq(expected_contents) | |||
end | |||
end | |||
|
|||
describe "administrate:views:field all" do | |||
let(:field_types) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
6b9694c
to
69e386a
Compare
This is looking great! I'm going to merge this in now! |
This addresses #486. Instead of copying the partials for all field types when no argument is given as suggested in the issue, I added support for passing "all" in place of the field name.