[Lada-commits] [PATCH 01 of 56] Added Docstrings

Wald Commits scm-commit at wald.intevation.org
Tue Aug 13 09:53:27 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1376045792 -7200
# Node ID 6c030e5739a71e284d9efae20c4ffcfca2db31eb
# Parent  c32be5f97b5d2d08187a289e2d1d29c65aa99a1a
Added Docstrings

diff -r c32be5f97b5d -r 6c030e5739a7 app/controller/Kommentare.js
--- a/app/controller/Kommentare.js	Thu Aug 08 15:50:07 2013 +0200
+++ b/app/controller/Kommentare.js	Fri Aug 09 12:56:32 2013 +0200
@@ -1,3 +1,10 @@
+/**
+ * Controller for Kommentare
+ *
+ * The controller defines the main logic of the application. It provides
+ * various methods which are bound to listeners and called when the defined
+ * events in the various UI elements occour (e.g User clicks on a button)
+ */
 Ext.define('Lada.controller.Kommentare', {
     extend: 'Ext.app.Controller',
     views: [
@@ -32,22 +39,43 @@
             }
         });
     },
+    /**
+     * Method to save the kommentar in the database. The method is called when
+     * the user clicks on the "Save" button
+     */
     saveKommentar: function(button) {
         console.log('Saving Kommentar');
         var form = button.up('window').down('form');
         form.commit();
     },
+    /**
+     * Method to open a window to enter the values for a new kommentar.
+     * The method is called when the user clicks on the "Add" button in the
+     * grid toolbar.
+     */
     addKommentar: function(button) {
         console.log('Adding new Kommentar for Probe ' + button.probeId);
         var kommentar = Ext.create('Lada.model.Kommentar');
         kommentar.set('probeId', button.probeId);
         var view = Ext.widget('kommentarecreate', {model: kommentar});
     },
+    /**
+     * Method to open a window to edit the values for an existing kommentar.
+     * The method is called when the user doubleclicks on the item in the
+     * grid.
+     */
     editKommentar: function(grid, record) {
         console.log('Editing Kommentar');
         var view = Ext.widget('kommentarecreate', {model: record});
         console.log("Loaded Kommentar with ID " + record.getId()); //outputs ID
     },
+    /**
+     * Method to delete a kommentar. This will trigger the display of a
+     * Confirmation dialog. After the deletion the related store will be
+     * refreshed.
+     * The method is called when the user selects the item in the grid and
+     * selects the delete button in the grid toolbar.
+     */
     deleteKommentar: function(button) {
         // Get selected item in grid
         var grid = button.up('grid');
@@ -69,6 +97,10 @@
             }
         });
     },
+    /**
+     * Method to trigger the action after successfull save (create or edit).
+     * In this case the related store is refreshed and the window is closed.
+     */
     createSuccess: function(form, record, operation) {
         // Reload store
         var store = this.getKommentareStore();
@@ -76,6 +108,10 @@
         var win = form.up('window');
         win.close();
     },
+    /**
+     * Method to trigger the action after save (create or edit) fails.
+     * In this case a Message Boss with a general error is shown.
+     */
     createFailure: function(form, record, operation) {
         Ext.MessageBox.show({
             title: 'Fehler beim Speichern',


More information about the Lada-commits mailing list