Skip to content
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

Add new password field #998

Merged
merged 1 commit into from
Mar 2, 2018
Merged

Conversation

OscarPay
Copy link
Contributor

@OscarPay OscarPay commented Oct 6, 2017

  • New Field::Password
  • More tests for the new field
  • Modify the Customer Dashboard to show new field
  • Add field information in Customizing Dashboards documentation

SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys - [:name]
FORM_ATTRIBUTES = [
:name,
:email,
:email_subscriber,
:kind,
:country,
:password

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 item of a multiline array.

}

COLLECTION_ATTRIBUTES = ATTRIBUTE_TYPES.keys
COLLECTION_ATTRIBUTES = ATTRIBUTE_TYPES.keys - [:created_at, :updated_at]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use %i or %I for an array of symbols.

@@ -12,16 +12,18 @@ class CustomerDashboard < Administrate::BaseDashboard
kind: Field::Select.with_options(collection: Customer::KINDS),
country: Field::BelongsTo.
with_options(primary_key: :code, foreign_key: :country_code),
password: Field::Password

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 item of a multiline hash.

end
end
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final newline missing.

end

def character
options.fetch(:character, '•')

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

it "different to the default character" do
password = password_with_options(lorem(30), character: '*')

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

it "defaults to displaying up to 50 characters" do
short = Administrate::Field::Password.new(:short_password, lorem(30), :show)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [82/80]


expect(path).to eq("/fields/password/#{page}")
end

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.

include FieldMatchers

describe "#to_partial_path" do

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.

@@ -28,6 +28,7 @@
name: name,
email: Faker::Internet.safe_email(name),
country: countries.sample,
password: Faker::Internet.password

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 item of a multiline hash.

@OscarPay OscarPay closed this Oct 6, 2017
end
end

it {should_permit_param(:foo, for_attribute: :foo)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing inside {.
Space missing inside }.

}

COLLECTION_ATTRIBUTES = ATTRIBUTE_TYPES.keys
COLLECTION_ATTRIBUTES = ATTRIBUTE_TYPES.keys - %i[created_at, updated_at]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Within %i/%I, ':' and ',' are unnecessary and may be unwanted in the resulting symbols.

end
end

it {should_permit_param(:foo, for_attribute: :foo)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing inside {.
Space missing inside }.

}

COLLECTION_ATTRIBUTES = ATTRIBUTE_TYPES.keys
COLLECTION_ATTRIBUTES = ATTRIBUTE_TYPES.keys - %i[created_at, updated_at]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Within %i/%I, ':' and ',' are unnecessary and may be unwanted in the resulting symbols.

@OscarPay OscarPay reopened this Oct 6, 2017
@nickcharlton
Copy link
Member

Hi @OscarPay!

Thanks for contributing this PR! I'm a bit apprehensive about adding additional fields as we've got our plugin system, but I think this is a reasonable default field to have.

Would you be able to rebase so that I can go ahead and merge this?

@m5o
Copy link

m5o commented Jan 22, 2018

Hey @nickcharlton - Rebase and merge pull requests should be
available in the dropdown of the merge button.
This probably helps if @OscarPay is not responding 🤓✌️
There are a lot PR’s that are 95% done, only stopped by minor issues.
Let’s grab the low hanging fruits.

@nickcharlton nickcharlton force-pushed the password-field branch 2 times, most recently from 06a858f to 709b614 Compare March 2, 2018 17:19
* New Field::Password
* Modify the Customer Dashboard to show new field
* Add field information in Customizing Dashboards documentation
@nickcharlton nickcharlton merged commit 7d9ef41 into thoughtbot:master Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants