Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
go
Commits
3b400ddb
Commit
3b400ddb
authored
Feb 13, 2019
by
David Haynes
🙆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete first pass on targetURL and shortcode
- design and functionality looking nice
parent
e90949fa
Pipeline
#3882
passed with stage
in 1 minute and 23 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
22 deletions
+90
-22
go/go_ahead/src/Components/Molecules/NewGoLinkValidator.js
go/go_ahead/src/Components/Molecules/NewGoLinkValidator.js
+4
-1
go/go_ahead/src/Components/Organisms/NewGoLinkForm.jsx
go/go_ahead/src/Components/Organisms/NewGoLinkForm.jsx
+71
-15
go/go_ahead/src/Components/Pages/NewGoLinkPage.jsx
go/go_ahead/src/Components/Pages/NewGoLinkPage.jsx
+15
-6
No files found.
go/go_ahead/src/Components/Molecules/NewGoLinkValidator.js
View file @
3b400ddb
...
@@ -8,7 +8,10 @@ const NewGoLinkValidator = Yup.object().shape({
...
@@ -8,7 +8,10 @@ const NewGoLinkValidator = Yup.object().shape({
targetURL
:
Yup
.
string
()
targetURL
:
Yup
.
string
()
.
required
(
"
You must supply a target URL!
"
)
.
required
(
"
You must supply a target URL!
"
)
.
url
(
"
Not a valid URL!
"
)
.
url
(
"
Not a valid URL!
"
)
.
max
(
1000
,
"
URL is too long!
"
)
.
max
(
1000
,
"
URL is too long!
"
),
shortcode
:
Yup
.
string
()
.
required
(
"
Required
"
)
.
max
(
20
,
"
Your shortcode is too long!
"
)
});
});
export
default
NewGoLinkValidator
;
export
default
NewGoLinkValidator
;
go/go_ahead/src/Components/Organisms/NewGoLinkForm.jsx
View file @
3b400ddb
...
@@ -4,9 +4,28 @@ import { Formik, Field, Form } from "formik";
...
@@ -4,9 +4,28 @@ import { Formik, Field, Form } from "formik";
import
{
GetCSRFToken
}
from
"
../../Utils/GetCSRFToken
"
;
import
{
GetCSRFToken
}
from
"
../../Utils/GetCSRFToken
"
;
import
{
SingleDatePicker
}
from
"
react-dates
"
;
import
{
SingleDatePicker
}
from
"
react-dates
"
;
import
moment
from
"
moment
"
;
import
moment
from
"
moment
"
;
import
{
FormGroup
,
Button
,
Label
,
FormText
}
from
"
reactstrap
"
;
import
{
FormGroup
,
Button
,
Label
,
FormText
,
Row
,
Col
,
InputGroup
,
InputGroupAddon
,
InputGroupText
}
from
"
reactstrap
"
;
import
MasonstrappedFormInput
from
"
../Molecules/MasonstrappedFormInput
"
;
import
MasonstrappedFormInput
from
"
../Molecules/MasonstrappedFormInput
"
;
const
divStyle
=
{
display
:
"
block
"
};
const
style2
=
{
borderTopLeftRadius
:
"
0rem
"
,
borderBottomLeftRadius
:
"
0rem
"
};
const
NewGoLinkForm
=
props
=>
{
const
NewGoLinkForm
=
props
=>
{
const
[
focused
,
setFocused
]
=
useState
(
false
);
const
[
focused
,
setFocused
]
=
useState
(
false
);
var
today
=
new
Date
();
var
today
=
new
Date
();
...
@@ -17,7 +36,7 @@ const NewGoLinkForm = props => {
...
@@ -17,7 +36,7 @@ const NewGoLinkForm = props => {
<
Formik
<
Formik
//
//
initialValues
=
{
{
initialValues
=
{
{
//
shortcode: "",
shortcode
:
""
,
targetURL
:
""
targetURL
:
""
// willExpire: false,
// willExpire: false,
// expires: moment(tomorrow)
// expires: moment(tomorrow)
...
@@ -41,6 +60,8 @@ const NewGoLinkForm = props => {
...
@@ -41,6 +60,8 @@ const NewGoLinkForm = props => {
handleChange
handleChange
})
=>
(
})
=>
(
<
Form
>
<
Form
>
<
Row
>
<
Col
md
=
"12"
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
"targetURL"
>
Target URL
</
Label
>
<
Label
for
=
"targetURL"
>
Target URL
</
Label
>
<
Field
<
Field
...
@@ -49,12 +70,47 @@ const NewGoLinkForm = props => {
...
@@ -49,12 +70,47 @@ const NewGoLinkForm = props => {
placeholder
=
"https://longwebsitelink.com"
placeholder
=
"https://longwebsitelink.com"
component
=
{
MasonstrappedFormInput
}
component
=
{
MasonstrappedFormInput
}
/>
/>
<
FormText
>
Example help text that remains unchanged.
</
FormText
>
<
FormText
>
The URL that you would like to shorten.
</
FormText
>
</
FormGroup
>
</
Col
>
</
Row
>
<
Row
>
<
Col
>
<
FormGroup
>
<
Label
for
=
"shortcode"
>
Shortcode
</
Label
>
<
InputGroup
>
<
InputGroupAddon
addonType
=
"prepend"
style
=
{
divStyle
}
>
https://go.gmu.edu/
</
InputGroupAddon
>
<
Field
name
=
"shortcode"
type
=
"text"
placeholder
=
""
className
=
"form-control"
style
=
{
style2
}
component
=
{
MasonstrappedFormInput
}
/>
</
InputGroup
>
<
FormText
>
The unique address for your target URL.
</
FormText
>
</
FormGroup
>
</
FormGroup
>
</
Col
>
</
Row
>
<
legend
/>
<
Button
type
=
"submit"
disabled
=
{
isSubmitting
}
outline
color
=
"primary"
>
<
Row
>
<
Col
>
<
Button
type
=
"submit"
disabled
=
{
isSubmitting
}
outline
color
=
"primary"
>
Submit
Submit
</
Button
>
</
Button
>
</
Col
>
</
Row
>
</
Form
>
</
Form
>
)
}
)
}
/>
/>
...
...
go/go_ahead/src/Components/Pages/NewGoLinkPage.jsx
View file @
3b400ddb
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
AuthedPageTemplate
from
"
../Templates/AuthedPageTemplate
"
;
import
AuthedPageTemplate
from
"
../Templates/AuthedPageTemplate
"
;
import
NewGolinkForm
from
"
../Organisms/NewGoLinkForm
"
;
import
NewGolinkForm
from
"
../Organisms/NewGoLinkForm
"
;
import
{
Row
,
Col
}
from
"
reactstrap
"
;
const
NewGoLinkPage
=
props
=>
{
const
NewGoLinkPage
=
props
=>
{
return
(
return
(
<
AuthedPageTemplate
>
<
AuthedPageTemplate
>
<
Row
>
<
Col
>
<
h2
className
=
"mt-4 font-weight-light"
>
Create a new Go link
</
h2
>
<
h2
className
=
"mt-4 font-weight-light"
>
Create a new Go link
</
h2
>
</
Col
>
</
Row
>
<
Row
>
<
Col
>
<
p
className
=
"text-muted"
>
<
p
className
=
"text-muted"
>
A Go link is composed of the original "target" URL, and the shortcode to
A Go link is composed of the original "target" URL, and the unique
be used in the Go link.
"shortcode" to
be used in the Go link.
</
p
>
</
p
>
<
legend
/>
<
legend
/>
</
Col
>
</
Row
>
<
NewGolinkForm
/>
<
NewGolinkForm
/>
</
AuthedPageTemplate
>
</
AuthedPageTemplate
>
);
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment