Enable/Disable add participants based on participant value in calendar edit

This commit is contained in:
Hadi Nategh 2016-04-18 13:56:47 +00:00
parent c4ff76b47d
commit 0ba271d581
6 changed files with 26 additions and 11 deletions

View File

@ -94,7 +94,7 @@ var et2_button = (function(){ "use strict"; return et2_baseWidget.extend([et2_II
this.setDOMNode(this.image[0]); this.setDOMNode(this.image[0]);
return; return;
} }
if (!this.options.readonly) if (!this.options.readonly || this.options.ro_image)
{ {
this.btn = $j(document.createElement("button")) this.btn = $j(document.createElement("button"))
.addClass("et2_button") .addClass("et2_button")

View File

@ -254,6 +254,7 @@ button.et2_button_with_image {
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 16px; background-size: 16px;
height: 24px; height: 24px;
background-position: center;
} }
button.et2_button_with_image.et2_button_text { button.et2_button_with_image.et2_button_text {
background-position: 4px center; background-position: 4px center;

View File

@ -1119,6 +1119,18 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
} }
}, },
/**
* Change participant add button status based on
* participants field value
*
*/
participantOnChange: function () {
var add = this.et2.getWidgetById('add');
var participant = this.et2.getWidgetById('participant');
add.set_readonly(!Number(participant.get_value()));
},
/** /**
* print_participants_status(egw,widget) * print_participants_status(egw,widget)
* Handle to apply changes from status in print popup * Handle to apply changes from status in print popup
@ -3288,13 +3300,13 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
{ {
$j(window).trigger('resize'); $j(window).trigger('resize');
this.setState({state:this.state}); this.setState({state:this.state});
// Hide loader after 1 second as a fallback, it will also be hidden // Hide loader after 1 second as a fallback, it will also be hidden
// after loading is complete. // after loading is complete.
window.setTimeout(jQuery.proxy(function() { window.setTimeout(jQuery.proxy(function() {
egw.loading_prompt(this.appname,false); egw.loading_prompt(this.appname,false);
}, this),1000); }, this),1000);
} }
}, },

View File

@ -54,9 +54,9 @@
</columns> </columns>
<rows> <rows>
<row class="th"></row> <row class="th"></row>
<row disabled="@no_add" height="35"> <row disabled="@no_add" height="35" class="et2_toolbar">
<button align="center" id="add" image="add" background_image="1" novalidate="1"/> <button align="center" id="add" image="add" novalidate="1" background_image="1" readonly="true" ro_image="add"/>
<calendar-owner id="participant" allowFreeEntries="true" span="2" empty_label="Add new participants or resource"/> <calendar-owner id="participant" allowFreeEntries="true" span="2" empty_label="Add new participants or resource" onchange="app.calendar.participantOnChange"/>
<textbox type="integer" align="center" id="quantity" min="1" size="3"/> <textbox type="integer" align="center" id="quantity" min="1" size="3"/>
<menulist> <menulist>
<menupopup class="selectRole" id="role"/> <menupopup class="selectRole" id="role"/>

View File

@ -11,7 +11,7 @@
* @package calendar * @package calendar
* @version $Id$ * @version $Id$
*/ */
/* $Id: app.css 55754 2016-04-15 11:12:08Z hnategh $ */ /* $Id: app.css 55760 2016-04-18 08:34:53Z hnategh $ */
/*Media print classes*/ /*Media print classes*/
@media print { @media print {
#calendar-view.et2_container, #calendar-view.et2_container,
@ -2383,8 +2383,9 @@ button#exception:active {
} }
/*calendar series add*/ /*calendar series add*/
#calendar-edit_add { #calendar-edit_add {
/* .Complete_Button_add; padding-left: 24px;
&:hover {.Complete_Button_add_hover;} */ background-size: 16px;
background-position: center;
} }
#calendar-edit_add:active { #calendar-edit_add:active {
background-color: #1aa200 !important; background-color: #1aa200 !important;

View File

@ -1089,8 +1089,9 @@ button#exception {
/*calendar series add*/ /*calendar series add*/
#calendar-edit_add { #calendar-edit_add {
&:active {background-color: @color_positive_action_active !important;} &:active {background-color: @color_positive_action_active !important;}
/* .Complete_Button_add; padding-left:24px;
&:hover {.Complete_Button_add_hover;} */ background-size:16px;
background-position: center;
} }
/*calendar search freetime*/ /*calendar search freetime*/
#calendar-edit_freetime{ #calendar-edit_freetime{