Class: PseudoControleur
- Inherits:
-
Controller
- Object
- Controller
- PseudoControleur
- Defined in:
- app/controller/PseudoControleur.rb
Overview
Classe permettant de créer un contrôleur pour la vue FenetrePseudo
Instance Method Summary collapse
-
#actionBoutonValider(entreePseudo) ⇒ Object
Action du bouton valider (vérification pseudo).
-
#actionValider(message, entreePseudo) ⇒ Object
Action après clic sur le bouton valider pour choix du pseudo.
-
#initialize ⇒ PseudoControleur
constructor
Initialize.
-
#pseudoExiste(pseudo) ⇒ Object
Permet de savoir si le pseudo existe déjà dans la base.
-
#run ⇒ Object
Méthode à définir dans tous les cas !.
Methods inherited from Controller
inherited, #loadFile, #loadModel, #render, #set_properties
Constructor Details
#initialize ⇒ PseudoControleur
Initialize
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controller/PseudoControleur.rb', line 15 def initialize() #charge le modèle utilisateur loadModel("Utilisateur") #paramètres fenêtre @title = "Sudoku - Pseudo" @width = 600 @height = 550 @resizable = false @position= "CENTER_ALWAYS" end |
Instance Method Details
#actionBoutonValider(entreePseudo) ⇒ Object
Action du bouton valider (vérification pseudo)
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/controller/PseudoControleur.rb', line 62 def actionBoutonValider(entreePseudo) if(entreePseudo.text == "") = Fenetre::creerPopup("Vous devez entrer un pseudo valide pour continuer!", "CLOSE") .run() .destroy() elsif self.pseudoExiste(entreePseudo.text) actionValider("Ce pseudo existe déjà, êtes vous '#{entreePseudo.text}'?", entreePseudo) else if actionValider("Pseudo inconnu, créer un nouveau profil?", entreePseudo) @Utilisateur.creerUtilisateur(entreePseudo.text) end end end |
#actionValider(message, entreePseudo) ⇒ Object
Action après clic sur le bouton valider pour choix du pseudo
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controller/PseudoControleur.rb', line 36 def actionValider(, entreePseudo) = Fenetre::creerPopup(, "YES_NO") reponse = .run() action = false if(reponse == Gtk::ResponseType::YES) ## Ajoute l'entête de la fenêtre avec le profil utilisateur ## puis change de page Header.profil(entreePseudo.text) Core::changeTo("Menu", "pseudo": entreePseudo.text) action = true else entreePseudo.text="" action = false end .destroy() return action end |
#pseudoExiste(pseudo) ⇒ Object
Permet de savoir si le pseudo existe déjà dans la base
83 84 85 |
# File 'app/controller/PseudoControleur.rb', line 83 def pseudoExiste(pseudo) return @Utilisateur.rechercherUtilisateur(pseudo) end |
#run ⇒ Object
Méthode à définir dans tous les cas !
92 93 94 |
# File 'app/controller/PseudoControleur.rb', line 92 def run() return self end |