Daniel Werner has submitted this change and it was merged.

Change subject: (bug 48145) TimeInput expert: Applied toggler widget
......................................................................


(bug 48145) TimeInput expert: Applied toggler widget

Using toggler widget to control the visibility of the precision and calender 
input elements
since they are regarded advanced input elements.

Change-Id: Ie5f4f69f25b6b615278409621579edcf35771c2d
---
M ValueView/ValueView.i18n.php
M ValueView/ValueView.resources.php
M ValueView/resources/jquery.ui/jquery.ui.inputextender.css
A ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.css
M ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.js
5 files changed, 47 insertions(+), 2 deletions(-)

Approvals:
  Daniel Werner: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ValueView/ValueView.i18n.php b/ValueView/ValueView.i18n.php
index dceba6f..d6e82e5 100644
--- a/ValueView/ValueView.i18n.php
+++ b/ValueView/ValueView.i18n.php
@@ -36,6 +36,8 @@
 $messages['en'] = array(
        'valueview-desc' => 'UI components for displaying and editing data 
values',
 
+       'valueview-expert-advancedoptions' => 'advanced options',
+
        // UnsupportedValue expert:
        'valueview-expert-unsupportedvalue-unsupporteddatavalue' => 'Handling 
of "$1" values is not yet supported.',
        'valueview-expert-unsupportedvalue-unsupporteddatatype' => 'Handling of 
values for "$1" data type is not yet supported.',
diff --git a/ValueView/ValueView.resources.php 
b/ValueView/ValueView.resources.php
index 413e1fb..834bcd0 100644
--- a/ValueView/ValueView.resources.php
+++ b/ValueView/ValueView.resources.php
@@ -197,12 +197,17 @@
                        'scripts' => array(
                                
'jquery.valueview/valueview.experts/experts.TimeInput.js',
                        ),
+                       'styles' => array(
+                               
'jquery.valueview/valueview.experts/experts.TimeInput.css',
+                       ),
                        'dependencies' => array(
                                'jquery.time.timeinput',
                                'jquery.ui.inputextender',
                                'jquery.ui.listrotator',
+                               'jquery.ui.toggler',
                        ),
                        'messages' => array(
+                               'valueview-expert-advancedoptions',
                                'valueview-expert-timeinput-precision',
                                'valueview-expert-timeinput-calendar',
                                'valueview-preview-label',
diff --git a/ValueView/resources/jquery.ui/jquery.ui.inputextender.css 
b/ValueView/resources/jquery.ui/jquery.ui.inputextender.css
index 23efbde..db4f9d5 100644
--- a/ValueView/resources/jquery.ui/jquery.ui.inputextender.css
+++ b/ValueView/resources/jquery.ui/jquery.ui.inputextender.css
@@ -19,4 +19,5 @@
 .ui-inputextender-extension .ui-inputextender-contentnode {
        float: left;
        clear: both;
+       margin-top: 0.5em;
 }
diff --git 
a/ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.css 
b/ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.css
new file mode 100644
index 0000000..3c41193
--- /dev/null
+++ 
b/ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.css
@@ -0,0 +1,29 @@
+/**
+ * Styles for valueview's TimeInput expert.
+ *
+ * @since 0.1
+ * @file
+ * @ingroup ValueView
+ *
+ * @license GNU GPL v2+
+ * @author H. Snater < [email protected] >
+ */
+
+.valueview-expert-timeinput-input {
+       width: 100%;
+}
+
+.ui-inputextender-extension .valueview-expert-timeinput-advancedtoggler {
+       margin-top: 0;
+}
+
+/* TODO: Put style into more generic place along with moving the preview out 
of the TimeInput expert */
+.valueview-preview {
+       width: 100%;
+       margin-top: 0.5em;
+       padding-top: 0.5em;
+       border-top: 1px dashed #CCC;
+}
+.valueview-preview-value {
+       margin-top: 0.2em;
+}
diff --git 
a/ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.js 
b/ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.js
index 1784a39..0ad56c2 100644
--- 
a/ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.js
+++ 
b/ValueView/resources/jquery.valueview/valueview.experts/experts.TimeInput.js
@@ -157,6 +157,10 @@
                        } )
                        .appendTo( this.$calendarContainer );
 
+                       var $toggler = $( '<a/>' )
+                       .addClass( this.uiBaseClass + '-advancedtoggler' )
+                       .text( mw.msg( 'valueview-expert-advancedoptions' ) );
+
                        this.$input = $( '<input/>', {
                                type: 'text',
                                'class': this.uiBaseClass + '-input 
valueview-input'
@@ -172,13 +176,17 @@
                        // TODO: Move input extender out of here to a more 
generic place since it is not
                        // TimeInput specific.
                        .inputextender( {
-                               content: [ this.$preview, 
this.$precisionContainer, this.$calendarContainer ],
+                               content: [ $toggler, this.$precisionContainer, 
this.$calendarContainer, this.$preview ],
                                initCallback: function() {
                                        self.$precision.data( 'listrotator' 
).initWidths();
                                        self.$calendar.data( 'listrotator' 
).initWidths();
+
+                                       var $subjects = 
self.$precisionContainer.add( self.$calendarContainer );
+                                       $subjects.css( 'display', 'none' );
+                                       $toggler.toggler( { $subject: $subjects 
} );
                                }
                        } )
-                       .on( 'timeinputupdate.' + this.uiBasClass, function( 
event, value ) {
+                       .on( 'timeinputupdate.' + this.uiBaseClass, function( 
event, value ) {
                                self._updatePreview( value );
                                if( value && value.isValid() ) {
                                        self.$precision.data( 'listrotator' 
).rotate( value.precision() );

-- 
To view, visit https://gerrit.wikimedia.org/r/63641
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5f4f69f25b6b615278409621579edcf35771c2d
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
Gerrit-Reviewer: Daniel Werner <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to