Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
parlote-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
parlote-facil
Validations
c46ad0d7
Valider
c46ad0d7
rédigé
14 years ago
par
mishudark
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
photo description with ajax request
parent
b7bc4b86
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
app/views/photos/edit.html.haml
+1
-0
1 ajout, 0 suppression
app/views/photos/edit.html.haml
app/views/photos/show.html.haml
+45
-3
45 ajouts, 3 suppressions
app/views/photos/show.html.haml
public/stylesheets/application.css
+20
-1
20 ajouts, 1 suppression
public/stylesheets/application.css
avec
66 ajouts
et
4 suppressions
app/views/photos/edit.html.haml
+
1
−
0
Voir le fichier @
c46ad0d7
...
...
@@ -16,6 +16,7 @@
=
form_for
@photo
do
|
p
|
=
p
.
text_field
:caption
,
:value
=>
@photo
.
caption
=
p
.
submit
%div
{
:class
=>
'clear'
}
#content_bottom
.back
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
app/views/photos/show.html.haml
+
45
−
3
Voir le fichier @
c46ad0d7
...
...
@@ -19,15 +19,43 @@
}
});
//asign a flag to determine if textarea has focus
$
(
document
).
ready
(
function
(){
//add a clas to verify if a textarea has focus
$
(
"
textarea
"
).
live
(
'
focus
'
,
function
(){
$
(
this
).
addClass
(
"
hasfocus
"
);
});
$
(
"
textarea
"
).
live
(
'
blur
'
,
function
(){
$
(
this
).
removeClass
(
"
hasfocus
"
);
});
});
//show form to add description
$
(
"
.edit-desc
"
).
click
(
function
(){
$
(
"
.edit_photo
"
).
toggle
();
//$(".caption").toggle();
});
//Add a description with ajax request
$
(
"
#photo_submit
"
).
click
(
function
(
evenet
){
event
.
preventDefault
();
var
method
=
$
(
"
.edit_photo
"
).
attr
(
"
method
"
);
var
url
=
$
(
"
.edit_photo
"
).
attr
(
"
action
"
);
var
data
=
$
(
"
.edit_photo
"
).
serialize
();
$
(
"
.description
"
).
text
(
$
(
"
#photo_caption
"
).
val
());
//$(".caption").toggle();
$
(
"
.edit_photo
"
).
toggle
();
$
.
ajax
({
type
:
method
,
url
:
url
,
data
:
data
,
success
:
function
(
response
){
$
(
"
#add-description
"
).
remove
();
}
});
});
});
//end document ready
=
content_for
:page_title
do
=
link_to
"◂
#{
@photo
.
album
.
name
}
"
,
@photo
.
album
...
...
@@ -54,7 +82,21 @@
#show_photo
=
linked_scaled_photo
@photo
,
@album
.caption
=
@photo
.
caption
-
if
current_user
.
owns?
@album
-
if
@photo
.
caption
and
@photo
.
caption
!=
""
=
link_to
'Edit'
,
'javascript:void(0)'
,
:id
=>
"edit-desc"
,
:class
=>
"edit-desc"
.description
=
@photo
.
caption
-
if
current_user
.
owns?
@album
%div
{
:class
=>
'clear'
}
-
if
!
@photo
.
caption
or
@photo
.
caption
==
""
=
link_to
'Add a description'
,
'javascript:void(0)'
,
:id
=>
"add-description"
,
:class
=>
"edit-desc"
=
form_for
@photo
do
|
p
|
=
p
.
text_field
:caption
,
:value
=>
@photo
.
caption
=
p
.
submit
%div
{
:class
=>
'clear'
}
#content_bottom
.back
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
public/stylesheets/application.css
+
20
−
1
Voir le fichier @
c46ad0d7
...
...
@@ -610,6 +610,25 @@ h1.big_text {
#fancybox-close
:hover
{
background-color
:
transparent
;
}
.edit_photo
{
display
:
none
;}
#photo_caption
{
width
:
100%
;
margin
:
auto
;}
.caption
.description
{
text-align
:
left
;
margin-left
:
3em
;
display
:
block
width
:
90%
;}
.caption
a
{
float
:
left
;
}
#add-description
{
width
:
100%
;}
.caption
,
.edit_photo
{
margin
:
auto
;
width
:
70%
;}
#photo_submit
{
float
:
right
;}
.clear
{
clear
:
both
;}
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter