Skip to content

Conversation

@OtisRed
Copy link
Contributor

@OtisRed OtisRed commented Sep 12, 2018

I had some git problems in PR #1034 so I closed it and recovered it here.

This PR contains form that user uses in order to join offers.

In order to test it you have to pull also #981 as it contains endpoint this code needs to hit

@OtisRed OtisRed mentioned this pull request Sep 12, 2018
@codecov-io
Copy link

codecov-io commented Sep 19, 2018

Codecov Report

Merging #1066 into master will decrease coverage by 0.02%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1066      +/-   ##
==========================================
- Coverage   91.21%   91.18%   -0.03%     
==========================================
  Files         116      116              
  Lines        2845     2847       +2     
  Branches       31       31              
==========================================
+ Hits         2595     2596       +1     
- Misses        246      247       +1     
  Partials        4        4
Impacted Files Coverage Δ
frontend/src/app/homepage-offer/offers.service.ts 56.52% <50%> (-0.63%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93c5960...951d28a. Read the comment docs.

@OtisRed OtisRed changed the title [WIP] Joining offers form (fixes 982) Joining offers form (fixes 982) Sep 26, 2018
Copy link
Contributor

@juliaanholcer juliaanholcer left a comment

Choose a reason for hiding this comment

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

In general, it looks very nice, but I have some remarks you can find in the review.

<div class="form-group row">
<label class="col-sm-4 col-md-3 col-lg-2 col-form-label" for="phone">Telefon:</label>
<div class="col-sm-8 col-md-9 col-lg-10">
<input class="form-control" formControlName="phoneNo" id="phone"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use imask, that was provided by @stanislawK in recent PR, to display the phone number in a more friendly format and to remain consistent through the whole app.

<input type="text" class="form-control" formControlName="honeyValue" />
</div>
</div>
<div class="d-flex justify-content-center" style="padding: 10px">
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of inline style, especially that we use a framework to style this app, so maybe you can use .pt-3 class to set top padding of this element.

import {HttpClient} from '@angular/common/http';
import {Location} from '@angular/common'

import {ActivatedRoute} from '@angular/router';
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, move this import up. We agreed some time ago to stick to { ImportedThing } format, so I will be very happy if you add spaces in imports after opening and before closing brackets.

})

export class OfferJoinFormComponent implements OnInit {
public error;
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose that the type of this variable is HttpRequestError or smth like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so. I haven't put it there. IDE did it itself when I used this expresson
err => this.error = err.error.nonFieldErrors

honeyValue: [''],
});
public offerId: number;
public submitEnabled = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using this variable somewhere? The submit button is disabled based on form validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was used in contact component as part of honey pot solution. After some fixes it works although I'm not really sure why. This variable however seems to be the glue of that solution.

onSubmit() {
if (this.joinForm.valid) {
this.submitEnabled = true;
delete this.joinForm.value.honeyValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not quite sure what is the purpose of deleting this field and how are you actually checking whether the form was filled by a bot or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kind of unreflexively applied the solution used in contact component. I guess the original idea was not to pass the honeyValue along with the rest of form values, but you're right it makes no sense in here since all is getting passed in the body is the message.

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.

3 participants