Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sfcode
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush
sfcode
Commits
4f8a5487
Commit
4f8a5487
authored
Dec 04, 2020
by
Paarth
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.cse.iitb.ac.in/ayushjangir/sfcode
merging to move filesave.php and newdir.php upstream
parents
72e5d6a2
6fefb93a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
6 deletions
+126
-6
src/app/file.service.ts
src/app/file.service.ts
+10
-1
src/app/file/file.component.html
src/app/file/file.component.html
+37
-3
src/app/file/file.component.scss
src/app/file/file.component.scss
+40
-1
src/app/file/file.component.ts
src/app/file/file.component.ts
+36
-0
src/app/ide/ide.component.html
src/app/ide/ide.component.html
+1
-0
src/app/ide/ide.component.scss
src/app/ide/ide.component.scss
+2
-1
No files found.
src/app/file.service.ts
View file @
4f8a5487
...
@@ -9,7 +9,9 @@ import { HttpClient } from '@angular/common/http';
...
@@ -9,7 +9,9 @@ import { HttpClient } from '@angular/common/http';
})
})
export
class
FileService
{
export
class
FileService
{
constructor
(
private
httpClient
:
HttpClient
)
{
}
baseApiUrl
=
"
https://file.io
"
;
constructor
(
private
http
:
HttpClient
)
{
}
getFiles
():
Observable
<
File
[]
>
{
getFiles
():
Observable
<
File
[]
>
{
...
@@ -29,4 +31,11 @@ export class FileService {
...
@@ -29,4 +31,11 @@ export class FileService {
return
of
(
ret
);
return
of
(
ret
);
}
}
upload
(
file
):
Observable
<
any
>
{
const
formData
=
new
FormData
();
formData
.
append
(
"
file
"
,
file
,
file
.
name
);
return
this
.
http
.
post
(
this
.
baseApiUrl
,
formData
)
}
}
}
src/app/file/file.component.html
View file @
4f8a5487
<div
id=
"tray"
>
<div
id=
"tray"
>
<button>
Upload A File
</button>
<button
style=
"margin-right: 10px;"
routerLink=
"/arena"
routerLinkActive=
"active"
>
Create A File
</button>
<button
(click)=
"onClick()"
id=
"myBtn"
style=
"margin-left: 10px;"
>
Upload A File
</button>
</div>
</div>
<div>
<div>
...
@@ -11,8 +12,41 @@
...
@@ -11,8 +12,41 @@
<div
class=
"lang"
>
{{file.language}}
</div>
<div
class=
"lang"
>
{{file.language}}
</div>
<div
class=
"details"
>
{{file.text}}
</div>
<div
class=
"details"
>
{{file.text}}
</div>
<button
style=
"margin-right: 20px;"
>
Run File
</button>
<button
style=
"margin-right: 15px;"
>
Run File
</button>
<button
style=
"margin-left: 20px;"
>
Remove from Database
</button>
<button
style=
"margin-left: 15px; margin-right: 15px;"
>
Edit File
</button>
<button
style=
"margin-left: 15px;"
>
Remove From Database
</button>
<!-- <button [routerLink]="['/arena', problem.id]" class="attempt">Attempt</button> -->
<!-- <button [routerLink]="['/arena', problem.id]" class="attempt">Attempt</button> -->
</div>
</div>
<div
id=
"myModal"
class=
"modal"
>
<!-- Modal content -->
<div
class=
"modal-content"
>
<span
(click)=
"onClick2()"
class=
"close"
>
×
</span>
<div
class=
"text-center"
>
<input
class=
"form-control"
type=
"file"
(change)=
"onChange($event)"
>
<button
(click)=
"onUpload()"
class=
"btn btn-success"
>
Upload
</button>
</div>
<!-- Shareable short link of uoloaded file -->
<div
class=
"container text-center jumbotron"
*ngIf=
"shortLink"
>
<h2>
Visit Here
</h2>
<a
href=
"{{shortLink}}"
>
{{shortLink}}
</a>
</div>
<!--Flag variable is used here-->
<div
class=
"container"
*ngIf=
"loading"
>
<h3>
Loading ...
</h3>
</div>
</div>
</div>
\ No newline at end of file
src/app/file/file.component.scss
View file @
4f8a5487
...
@@ -34,3 +34,42 @@
...
@@ -34,3 +34,42 @@
margin
:
10px
;
margin
:
10px
;
}
}
}
}
.modal
{
display
:
none
;
/* Hidden by default */
position
:
fixed
;
/* Stay in place */
z-index
:
100
;
/* Sit on top */
padding-top
:
100px
;
/* Location of the box */
left
:
0
;
top
:
0
;
width
:
100%
;
/* Full width */
height
:
100%
;
/* Full height */
overflow
:
auto
;
/* Enable scroll if needed */
background-color
:
rgb
(
0
,
0
,
0
);
/* Fallback color */
background-color
:
rgba
(
0
,
0
,
0
,
0
.5
);
/* Black w/ opacity */
}
/* Modal Content */
.modal-content
{
background
:
var
(
--
bgcolor
);
margin
:
auto
;
padding
:
20px
;
border
:
2px
solid
var
(
--
color
);
border-radius
:
10px
;
width
:
80%
;
}
/* The Close Button */
.close
{
color
:
var
(
--
color
);
float
:
right
;
font-size
:
28px
;
font-weight
:
bold
;
}
.close
:hover
,
.close
:focus
{
color
:
white
;
text-decoration
:
none
;
cursor
:
pointer
;
}
src/app/file/file.component.ts
View file @
4f8a5487
...
@@ -11,6 +11,10 @@ export class FileComponent implements OnInit {
...
@@ -11,6 +11,10 @@ export class FileComponent implements OnInit {
constructor
(
private
fileService
:
FileService
)
{
}
constructor
(
private
fileService
:
FileService
)
{
}
files
:
File
[];
files
:
File
[];
// File upload variables
shortLink
:
string
=
""
;
loading
:
boolean
=
false
;
// Flag variable
fileToUpload
:
File
=
null
;
fileToUpload
:
File
=
null
;
ngOnInit
():
void
{
ngOnInit
():
void
{
...
@@ -21,4 +25,36 @@ export class FileComponent implements OnInit {
...
@@ -21,4 +25,36 @@ export class FileComponent implements OnInit {
this
.
fileService
.
getFiles
()
this
.
fileService
.
getFiles
()
.
subscribe
(
files
=>
this
.
files
=
files
);
.
subscribe
(
files
=>
this
.
files
=
files
);
}
}
onClick
():
void
{
var
modal
=
document
.
getElementById
(
"
myModal
"
);
modal
.
style
.
display
=
"
block
"
;
}
onClick2
():
void
{
var
modal
=
document
.
getElementById
(
"
myModal
"
);
modal
.
style
.
display
=
"
none
"
;
this
.
shortLink
=
""
;
this
.
loading
=
false
;
}
onChange
(
event
)
{
this
.
fileToUpload
=
event
.
target
.
files
[
0
];
}
onUpload
()
{
this
.
loading
=
!
this
.
loading
;
console
.
log
(
this
.
fileToUpload
);
this
.
fileService
.
upload
(
this
.
fileToUpload
).
subscribe
(
(
event
:
any
)
=>
{
if
(
typeof
(
event
)
===
'
object
'
)
{
this
.
shortLink
=
event
.
link
;
this
.
loading
=
false
;
}
}
);
}
}
}
src/app/ide/ide.component.html
View file @
4f8a5487
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
<div
id=
"attempt"
>
<div
id=
"attempt"
>
<button
id=
"input"
>
Input
</button>
<button
id=
"input"
>
Input
</button>
<button
id=
"run"
>
Run Code
</button>
<button
id=
"run"
>
Run Code
</button>
<button
id=
"save"
>
Save File
</button>
</div>
</div>
<label
for=
"editor"
></label>
<label
for=
"editor"
></label>
<textarea
name=
"editor"
id=
"editor"
></textarea>
<textarea
name=
"editor"
id=
"editor"
></textarea>
...
...
src/app/ide/ide.component.scss
View file @
4f8a5487
...
@@ -24,7 +24,8 @@
...
@@ -24,7 +24,8 @@
z-index
:
100
;
z-index
:
100
;
#run
,
#run
,
#input
{
#input
,
#save
{
display
:
inline-block
;
display
:
inline-block
;
background
:
transparent
;
background
:
transparent
;
color
:
#ddf
;
color
:
#ddf
;
...
...
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