Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
ELAN carrés
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Littérature et Arts Numériques
ELAN carrés
Commits
f2db5c57
Commit
f2db5c57
authored
Apr 11, 2019
by
Arnaud Bey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add img upload & inthepipeline property
parent
6a51f9d7
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
234 additions
and
146 deletions
+234
-146
.gitignore
.gitignore
+1
-0
application/assets/css/project.css
application/assets/css/project.css
+3
-0
application/config/packages/doctrine.yaml
application/config/packages/doctrine.yaml
+1
-0
application/public/upload/.gitkeep
application/public/upload/.gitkeep
+0
-0
application/src/Controller/AdminController.php
application/src/Controller/AdminController.php
+19
-0
application/src/Controller/DefaultController.php
application/src/Controller/DefaultController.php
+4
-5
application/src/Entity/Square.php
application/src/Entity/Square.php
+34
-0
application/src/Form/SquareType.php
application/src/Form/SquareType.php
+19
-5
application/templates/default/elan.html.twig
application/templates/default/elan.html.twig
+67
-0
application/templates/default/index.html.twig
application/templates/default/index.html.twig
+13
-136
application/templates/default/square.html.twig
application/templates/default/square.html.twig
+73
-0
No files found.
.gitignore
View file @
f2db5c57
...
...
@@ -26,6 +26,7 @@
!/application/public/export/.gitkeep
/application/public/js
/application/public/upload/*
!/application/public/upload/.gitkeep
/application/npm-debug.log
/application/yarn-error.log
/application/package-lock.json
...
...
application/assets/css/project.css
View file @
f2db5c57
...
...
@@ -13,3 +13,6 @@
#main-container
.card.clickable
{
cursor
:
pointer
;
}
.custom-file-label
{
opacity
:
0
;
}
.custom-file-input
{
opacity
:
1
;
}
application/config/packages/doctrine.yaml
View file @
f2db5c57
...
...
@@ -4,6 +4,7 @@ parameters:
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL)
:
'
'
upload_directory
:
'
%kernel.project_dir%/public/upload'
doctrine
:
dbal
:
...
...
application/public/upload/.gitkeep
0 → 100644
View file @
f2db5c57
application/src/Controller/AdminController.php
View file @
f2db5c57
...
...
@@ -32,6 +32,19 @@ class AdminController extends AbstractController
$form
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
()
&&
$form
->
isValid
())
{
if
(
$file
=
$form
[
'image'
]
->
getData
())
{
$fullFileName
=
$file
->
getClientOriginalName
();
$fileName
=
pathinfo
(
$fullFileName
,
PATHINFO_FILENAME
);
$random
=
md5
(
uniqid
());
$directory
=
$this
->
getUploadDir
();
$extension
=
$file
->
guessExtension
();
$finalFileName
=
$fileName
.
'-'
.
$random
.
'.'
.
$extension
;
$file
->
move
(
$directory
,
$finalFileName
);
$square
->
setImageURL
(
$finalFileName
);
}
$square
->
setLastUpdate
(
new
\
Datetime
);
$em
->
persist
(
$square
);
$em
->
flush
();
...
...
@@ -45,6 +58,12 @@ class AdminController extends AbstractController
]);
}
private
function
getUploadDir
()
{
return
$this
->
getParameter
(
'upload_directory'
);
}
/**
* @Route("/remove/{id}", name="remove_square")
*/
...
...
application/src/Controller/DefaultController.php
View file @
f2db5c57
...
...
@@ -16,13 +16,12 @@ class DefaultController extends AbstractController
public
function
index
(
EntityManagerInterface
$em
)
{
$elan
=
$em
->
getRepository
(
Elan
::
class
)
->
findAll
();
$elan
=
(
$elan
)
?
$elan
[
0
]
:
null
;
$elan
=
(
$elan
)
?
$elan
[
0
]
:
null
;
$squares
=
$em
->
getRepository
(
Square
::
class
)
->
findBy
([],
[
"position"
=>
"ASC"
]);
$squares
=
$em
->
getRepository
(
Square
::
class
)
->
findBy
([
"inThePipeline"
=>
false
],
[
"position"
=>
"ASC"
]);
$inThePipelines
=
$em
->
getRepository
(
Square
::
class
)
->
findBy
([
"inThePipeline"
=>
true
],
[
"position"
=>
"ASC"
]);
return
$this
->
render
(
'default/index.html.twig'
,
[
"squares"
=>
$squares
,
'elan'
=>
$elan
]);
return
$this
->
render
(
'default/index.html.twig'
,
[
"squares"
=>
$squares
,
'elan'
=>
$elan
,
"inThePipelines"
=>
$inThePipelines
]);
}
/**
...
...
application/src/Entity/Square.php
View file @
f2db5c57
...
...
@@ -91,6 +91,16 @@ class Square
*/
private
$position
=
2
;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private
$inThePipeline
=
false
;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private
$imageURL
;
public
function
getId
():
?int
{
...
...
@@ -276,4 +286,28 @@ class Square
return
$this
;
}
public
function
getInThePipeline
():
?bool
{
return
$this
->
inThePipeline
;
}
public
function
setInThePipeline
(
bool
$inThePipeline
):
self
{
$this
->
inThePipeline
=
$inThePipeline
;
return
$this
;
}
public
function
getImageURL
():
?string
{
return
$this
->
imageURL
;
}
public
function
setImageURL
(
?string
$imageURL
):
self
{
$this
->
imageURL
=
$imageURL
;
return
$this
;
}
}
application/src/Form/SquareType.php
View file @
f2db5c57
...
...
@@ -3,14 +3,16 @@
namespace
App\Form
;
use
App\Entity\Square
;
use
FOS\CKEditorBundle\Form\Type\CKEditorType
;
use
Symfony\Component\Form\AbstractType
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Component\OptionsResolver\OptionsResolver
;
use
Symfony\Component\Form\Extension\Core\Type\TextareaType
;
use
Symfony\Component\Form\Extension\Core\Type\TextType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\ColorType
;
use
Symfony\Component\Form\Extension\Core\Type\FileType
;
use
Symfony\Component\Form\Extension\Core\Type\SubmitType
;
use
FOS\CKEditorBundle\Form\Type\CKEditorType
;
use
Symfony\Component\Form\Extension\Core\Type\TextareaType
;
use
Symfony\Component\Form\Extension\Core\Type\TextType
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Component\OptionsResolver\OptionsResolver
;
class
SquareType
extends
AbstractType
{
...
...
@@ -25,7 +27,19 @@ class SquareType extends AbstractType
'label'
=>
'Sous-titre'
,
'required'
=>
false
,
])
->
add
(
'image'
,
FileType
::
class
,
[
'label'
=>
'Image'
,
'mapped'
=>
false
,
'required'
=>
false
,
])
->
add
(
'position'
)
->
add
(
'inThePipeline'
,
ChoiceType
::
class
,
[
'expanded'
=>
true
,
'multiple'
=>
false
,
'label'
=>
'Dans les tuyaux (sera placé plus bas, sans modale)'
,
'required'
=>
true
,
'choices'
=>
[
'Oui'
=>
true
,
'Non'
=>
false
],
])
->
add
(
'twoWords'
,
CKEditorType
::
class
,
[
'label'
=>
'2 mots à propos du projet'
,
'required'
=>
false
,
...
...
application/templates/default/elan.html.twig
0 → 100644
View file @
f2db5c57
{%
if
elan
%}
<div
data-toggle=
"modal"
data-target=
"#square-elan"
class=
"col-6"
>
<div
class=
"card clickable"
style=
"background:rgba(255, 255, 255, 0.7);"
>
<div
class=
"card-body"
style=
"color:rgba(0, 0, 0);"
>
<h1
class=
"card-title text-center"
>
{{
elan.title
}}
</h1>
<h4
class=
"card-text text-center"
>
{{
elan.subtitle
}}
</h4>
</div>
<div
class=
"card-footer text-center"
>
<a
target=
"_blank"
href=
"https://www.univ-grenoble-alpes.fr/"
>
<img
src=
"
{{
asset
(
'img/logo_univ_grenoble_alpes.jpg'
)
}}
"
/>
</a>
<a
target=
"_blank"
href=
"http://www.cnrs.fr"
>
<img
src=
"
{{
asset
(
'img/logo_cnrs.jpg'
)
}}
"
/>
</a>
<a
target=
"_blank"
href=
"http://litt-arts.univ-grenoble-alpes.fr/"
>
<img
src=
"
{{
asset
(
'img/logo_littarts.png'
)
}}
"
/>
</a>
</div>
</div>
</div>
<div
id=
"square-elan"
class=
"modal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog modal-lg"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
style=
"background:rgba(255, 255, 255, 0.7);color:rgba(0, 0, 0);"
>
<h5
class=
"modal-title"
>
{{
elan.title
~
' - '
~
elan.subtitle
}}
</h5>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"modal-body text-justify"
>
<div
class=
"row"
>
<div
class=
"col"
>
<p
class=
"text-muted text-right"
>
<small>
Dernière mise à jour :
{{
elan.lastUpdate
|
date
}}
{%
if
isAdmin
%}
<a
href=
"
{{
path
(
'admin_create_elan'
,
{
id
:
elan.id
}
)
}}
"
><i
class=
"fas fa-edit"
></i></a>
{%
endif
%}
</small>
</p>
<p>
{{
elan.content
|
raw
}}
</p>
</div>
<div
class=
"col-3 text-center"
>
{%
if
elan.link
%}
<a
class=
"btn btn-secondary"
target=
"_blank"
href=
"
{{
elan.link
}}
"
>
Accéder au site
</a>
{%
endif
%}
</div>
</div>
</div>
</div>
</div>
</div>
{%
else
%}
{%
if
isAdmin
%}
<div
class=
"col-3 text-white text-center"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Init. ELAN
</h5>
<p
class=
"card-text"
>
<a
href=
"
{{
path
(
'admin_create_elan'
)
}}
"
><i
class=
"fas fa-plus fa-6x"
></i></a>
</p>
</div>
</div>
</div>
{%
endif
%}
{%
endif
%}
application/templates/default/index.html.twig
View file @
f2db5c57
...
...
@@ -3,144 +3,10 @@
{%
block
title
%}
{{
parent
()
}}
Page d'accueil
{%
endblock
%}
{%
block
body
%}
{%
if
elan
%}
<div
data-toggle=
"modal"
data-target=
"#square-elan"
class=
"col-6"
>
<div
class=
"card clickable"
style=
"background:rgba(255, 255, 255, 0.7);"
>
<div
class=
"card-body"
style=
"color:rgba(0, 0, 0);"
>
<h1
class=
"card-title text-center"
>
{{
elan.title
}}
</h1>
<h4
class=
"card-text text-center"
>
{{
elan.subtitle
}}
</h4>
</div>
<div
class=
"card-footer text-center"
>
<a
target=
"_blank"
href=
"https://www.univ-grenoble-alpes.fr/"
>
<img
src=
"
{{
asset
(
'img/logo_univ_grenoble_alpes.jpg'
)
}}
"
/>
</a>
<a
target=
"_blank"
href=
"http://www.cnrs.fr"
>
<img
src=
"
{{
asset
(
'img/logo_cnrs.jpg'
)
}}
"
/>
</a>
<a
target=
"_blank"
href=
"http://litt-arts.univ-grenoble-alpes.fr/"
>
<img
src=
"
{{
asset
(
'img/logo_littarts.png'
)
}}
"
/>
</a>
</div>
</div>
</div>
<div
id=
"square-elan"
class=
"modal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog modal-lg"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
style=
"background:rgba(255, 255, 255, 0.7);color:rgba(0, 0, 0);"
>
<h5
class=
"modal-title"
>
{{
elan.title
~
' - '
~
elan.subtitle
}}
</h5>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"modal-body text-justify"
>
<div
class=
"row"
>
<div
class=
"col"
>
<p
class=
"text-muted text-right"
>
<small>
Dernière mise à jour :
{{
elan.lastUpdate
|
date
}}
{%
if
isAdmin
%}
<a
href=
"
{{
path
(
'admin_create_elan'
,
{
id
:
elan.id
}
)
}}
"
><i
class=
"fas fa-edit"
></i></a>
{%
endif
%}
</small>
</p>
<p>
{{
elan.content
|
raw
}}
</p>
</div>
<div
class=
"col-3 text-center"
>
{%
if
elan.link
%}
<a
class=
"btn btn-secondary"
target=
"_blank"
href=
"
{{
elan.link
}}
"
>
Accéder au site
</a>
{%
endif
%}
</div>
</div>
</div>
</div>
</div>
</div>
{%
else
%}
{%
if
isAdmin
%}
<div
class=
"col-3 text-white text-center"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
Init. ELAN
</h5>
<p
class=
"card-text"
>
<a
href=
"
{{
path
(
'admin_create_elan'
)
}}
"
><i
class=
"fas fa-plus fa-6x"
></i></a>
</p>
</div>
</div>
</div>
{%
endif
%}
{%
endif
%}
{%
include
'default/elan.html.twig'
%}
{%
for
square
in
squares
%}
<div
data-toggle=
"modal"
data-target=
"#square-
{{
square.id
}}
"
class=
"col-
{{
square.width
}}
"
>
<div
class=
"card clickable"
style=
"background:rgba(
{{
square.color
|
hex2rgb
(
0.7
)
}}
);"
>
<div
class=
"card-body"
style=
"color:rgba(
{{
square.textColor
|
hex2rgb
(
1
)
}}
);"
>
<h4
class=
"card-title text-center"
>
{{
square.title
}}
</h4>
<p
class=
"card-text text-center"
>
{{
square.subtitle
}}
</p>
</div>
</div>
</div>
<div
id=
"square-
{{
square.id
}}
"
class=
"modal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog modal-lg"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
style=
"background:rgba(
{{
square.color
|
hex2rgb
(
1
)
}}
);color:rgba(
{{
square.textColor
|
hex2rgb
(
1
)
}}
);"
>
<h5
class=
"modal-title"
>
{{
square.title
}}
</h5>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"modal-body text-justify"
>
<div
class=
"row"
>
<div
class=
"col"
>
<p
class=
"text-muted text-right"
>
<small>
Dernière mise à jour :
{{
square.lastUpdate
|
date
}}
{%
if
isAdmin
%}
<a
href=
"
{{
path
(
'admin_create_square'
,
{
id
:
square.id
}
)
}}
"
><i
class=
"fas fa-edit"
></i></a>
{%
endif
%}
</small>
</p>
{%
if
square.manager
%}
<p><strong>
Responsable :
</strong>
{{
square.manager
|
raw
}}
</p>
{%
endif
%}
{%
if
square.twoWords
%}
<strong>
Le projet en deux mots :
</strong>
<p>
{{
square.twoWords
|
raw
}}
</p>
{%
endif
%}
<div
class=
"bg-light rounded p-4"
>
<strong>
ELAN dans ce projet :
</strong>
<p>
{{
square.elan
|
raw
}}
</p>
{%
if
square.dataType
%}
<p><strong>
Type de données :
</strong>
{{
square.dataType
}}
</p>
{%
endif
%}
{%
if
square.startDate
%}
<p><strong>
Début du projet :
</strong>
{{
square.startDate
}}
</p>
{%
endif
%}
{%
if
square.endDate
%}
<p><strong>
Fin du projet :
</strong>
{{
square.endDate
}}
</p>
{%
endif
%}
{%
if
square.state
%}
<p><strong>
Etat du projet :
</strong>
{{
square.state
}}
</p>
{%
endif
%}
</div>
</div>
<div
class=
"col-3 text-center"
>
{%
if
square.link
%}
<a
class=
"btn btn-secondary"
target=
"_blank"
href=
"
{{
square.link
}}
"
>
Accéder au site
</a>
{%
endif
%}
</div>
</div>
</div>
</div>
</div>
</div>
{%
include
'default/square.html.twig'
%}
{%
endfor
%}
{%
if
isAdmin
%}
...
...
@@ -155,4 +21,15 @@
</div>
</div>
{%
endif
%}
</div>
<div
class=
"row"
>
<div
class=
"col-12"
>
<h3>
Dans les tuyaux
</h3>
</div>
{%
for
inThePipeline
in
inThePipelines
%}
{%
include
'default/square.html.twig'
%}
{%
endfor
%}
{%
endblock
%}
application/templates/default/square.html.twig
0 → 100644
View file @
f2db5c57
<div
data-toggle=
"modal"
data-target=
"#square-
{{
square.id
}}
"
class=
"col-
{{
square.width
}}
"
>
<div
class=
"card clickable"
style=
"background:rgba(
{{
square.color
|
hex2rgb
(
0.7
)
}}
);"
>
<div
class=
"card-body"
style=
"color:rgba(
{{
square.textColor
|
hex2rgb
(
1
)
}}
);"
>
<h4
class=
"card-title text-center"
>
{{
square.title
}}
</h4>
<p
class=
"card-text text-center"
>
{{
square.subtitle
}}
</p>
</div>
</div>
</div>
{%
if
not
square.inThePipeline
%}
<div
id=
"square-
{{
square.id
}}
"
class=
"modal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog modal-lg"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
style=
"background:rgba(
{{
square.color
|
hex2rgb
(
1
)
}}
);color:rgba(
{{
square.textColor
|
hex2rgb
(
1
)
}}
);"
>
<h5
class=
"modal-title"
>
{{
square.title
}}
</h5>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"modal-body text-justify"
>
<div
class=
"row"
>
<div
class=
"col"
>
<p
class=
"text-muted text-right"
>
<small>
Dernière mise à jour :
{{
square.lastUpdate
|
date
}}
{%
if
isAdmin
%}
<a
href=
"
{{
path
(
'admin_create_square'
,
{
id
:
square.id
}
)
}}
"
><i
class=
"fas fa-edit"
></i></a>
{%
endif
%}
</small>
</p>
{%
if
square.manager
%}
<p><strong>
Responsable :
</strong>
{{
square.manager
|
raw
}}
</p>
{%
endif
%}
{%
if
square.twoWords
%}
<strong>
Le projet en deux mots :
</strong>
<p>
{{
square.twoWords
|
raw
}}
</p>
{%
endif
%}
<div
class=
"bg-light rounded p-4"
>
<strong>
ELAN dans ce projet :
</strong>
<p>
{{
square.elan
|
raw
}}
</p>
{%
if
square.dataType
%}
<p><strong>
Type de données :
</strong>
{{
square.dataType
}}
</p>
{%
endif
%}
{%
if
square.startDate
%}
<p><strong>
Début du projet :
</strong>
{{
square.startDate
}}
</p>
{%
endif
%}
{%
if
square.endDate
%}
<p><strong>
Fin du projet :
</strong>
{{
square.endDate
}}
</p>
{%
endif
%}
{%
if
square.state
%}
<p><strong>
Etat du projet :
</strong>
{{
square.state
}}
</p>
{%
endif
%}
</div>
</div>
<div
class=
"col-3 text-center"
>
{%
if
square.link
%}
<a
style=
"display:block;width:100%"
class=
"btn btn-secondary mb-2"
target=
"_blank"
href=
"
{{
square.link
}}
"
>
Accéder au site
</a>
{%
endif
%}
{%
if
square.imageURL
%}
<img
width=
"100%"
src=
"
{{
asset
(
'upload/'
~
square.imageURL
)
}}
"
/>
{%
endif
%}
</div>
</div>
</div>
</div>
</div>
</div>
{%
endif
%}
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