commit 7ecb1eba82a86f8f6c03bac70ab87ebd31a47a55
parent 7dbca60cd4ddfacb838d45da73c064ba5a8f7419
Author: Felicitus <felicitus@felicitus.org>
Date: Fri, 4 Sep 2015 15:00:48 +0200
Added text field with URL button to easily visit the entered URL without copy'n'paste of the URL value.
Diffstat:
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/UrlTextField.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/UrlTextField.js
@@ -0,0 +1,23 @@
+/**
+ * Simple text field with an URL button to easily visit the entered URL.
+ *
+ * The getUrl function may be overridden for custom functionality.
+ */
+Ext.define("PartKeepr.form.field.Text", {
+ extend: "Ext.form.field.Text",
+
+ alias: 'widget.urltextfield',
+
+ triggers: {
+ url: {
+ cls: 'x-form-trigger-link',
+ handler: function () {
+ window.open(this.getUrl(), '_blank');
+ },
+ scope: 'this'
+ }
+ },
+ getUrl: function () {
+ return this.getValue();
+ }
+});
diff --git a/src/PartKeepr/FrontendBundle/Resources/views/index.html.twig b/src/PartKeepr/FrontendBundle/Resources/views/index.html.twig
@@ -111,6 +111,7 @@
'@PartKeeprFrontendBundle/Resources/public/js/Components/Grid/GridMenuPlugin.js'
'@PartKeeprFrontendBundle/Resources/public/js/Components/TimeDisplay.js'
'@PartKeeprFrontendBundle/Resources/public/js/Components/Menu.js'
+ '@PartKeeprFrontendBundle/Resources/public/js/Components/Widgets/UrlTextField.js'
'@PartKeeprFrontendBundle/Resources/public/js/Components/Session/SessionManager.js'
'@PartKeeprFrontendBundle/Resources/public/js/Components/User/Preferences/DisplayPreferencesPanel.js'
'@PartKeeprFrontendBundle/Resources/public/js/Components/User/Preferences/UserPasswordChangePanel.js'