Wystylizowany Email-sender

This commit is contained in:
Arkadiusz Jurga 2018-12-16 13:35:41 +01:00
parent 446bd9988a
commit 57b54662ec
3 changed files with 29 additions and 12 deletions

View File

@ -295,10 +295,26 @@ textarea {
}
.form-control--input
{
width: 30%;
width: 280px;
height: 200px;
}
.form-emailsend
{
color: black;
width: 500px;
}
.answer-list__add-btn--sendButton
{
/*margin-left: 18%;*/
width:7%;
}
#exampleFormControlTextarea3
{
width: 280px;
}

View File

@ -16,19 +16,20 @@ namespace MailSender.Models
//[ForeignKey]
//public int UserId //id usera ktory wyslal maila
[Display(Name = "Temat")]
[Required(AllowEmptyStrings = false)]
public string Subject { get; set; }
[DataType(DataType.EmailAddress)]
[Required(AllowEmptyStrings = false, ErrorMessage = "You need to type in an e-mail")]
[RegularExpression(".*@.*\\..*", ErrorMessage = "You typed in e-mail in wrong format")]
[Required(AllowEmptyStrings = false, ErrorMessage = "Musisz wprowadzić adres e-mail")]
[RegularExpression(".*@.*\\..*", ErrorMessage = "Zły format")]
[Display(Name = "Adres odbiorcy")]
[EmailAddress(ErrorMessage ="Zły format")]
public string EMailTo { get; set; }
[Display(Name ="Odpowiedź")]
[Required(AllowEmptyStrings = false, ErrorMessage = "You need to type in a message to send")]
[Required(AllowEmptyStrings = false, ErrorMessage = "Proszę wprowadzić odpowiedź")]
[DataType(DataType.MultilineText)]
[StringLength(500, ErrorMessage = "Message has to have between 1 and 500 chars", MinimumLength = 1)]
public string Content { get; set; }

View File

@ -1,5 +1,5 @@
@model MailSender.Models.MailModel
@{
@{
//ViewBag.Title = "Mail Sender";
}
@ -13,23 +13,23 @@
{
<div class="form-group">
@Html.LabelFor(i => i.Subject, new { @class = "label-form" })
@Html.EditorFor(i => i.Subject, new { htmlAttributes = new { @class = "form-control form-control--input", @placeholder = "Temat" } })
@Html.EditorFor(i => i.Subject, new { htmlAttributes = new { @class = "form-control form-emailsend", @placeholder = "Temat" } })
@Html.ValidationMessageFor(i => i.Subject)
</div>
<div class="form-group">
@Html.LabelFor(i => i.EMailTo, new { @class = "label-form" })
@Html.EditorFor(i => i.EMailTo, new { htmlAttributes = new { @class = "form-control form-control--input", @placeholder = "Do" } })
@Html.EditorFor(i => i.EMailTo, new { htmlAttributes = new { @class = "form-control form-emailsend", @placeholder = "Do" } })
@Html.ValidationMessageFor(i => i.EMailTo)
</div>
<div class="form-group" >
@Html.LabelFor(i => i.Content, new { @class = "label-form" })
@Html.EditorFor(i => i.Content, new { htmlAttributes = new { @class = "form-control form-control--input", @placeholder = "Odpowiedź" } })
@Html.EditorFor(i => i.Content, new { htmlAttributes = new { @class = "form-control", @id = "exampleFormControlTextarea3", @rows=9, @placeholder = "Odpowiedź" } })
@Html.ValidationMessageFor(i => i.Content)
</div>
<input type="submit" value="Send" class="answer-list__add-btn" />
<input type="submit" value="Send" class="answer-list__add-btn answer-list__add-btn--sendButton" />
}
@section Scripts {