TimeTrex Community Edition v16.2.0
This commit is contained in:
48
interface/html5/global/widgets/message_box/NoHierarchyBox.js
Normal file
48
interface/html5/global/widgets/message_box/NoHierarchyBox.js
Normal file
@ -0,0 +1,48 @@
|
||||
( function( $ ) {
|
||||
|
||||
$.fn.NoHierarchyBox = function( options ) {
|
||||
var opts = $.extend( {}, $.fn.NoHierarchyBox.defaults, options );
|
||||
var field;
|
||||
var related_view_controller;
|
||||
|
||||
this.each( function() {
|
||||
|
||||
var o = $.meta ? $.extend( {}, opts, $( this ).data() ) : opts;
|
||||
|
||||
if ( o.related_view_controller ) {
|
||||
related_view_controller = o.related_view_controller;
|
||||
}
|
||||
|
||||
var label = $( this ).find( '.p-button-label' );
|
||||
var icon = $( this ).find( '.icon' );
|
||||
var message = $( this ).find( '.message' );
|
||||
|
||||
var ribbon_button = $( this ).find( '.p-button' );
|
||||
|
||||
message.text( Global.no_hierarchy_message );
|
||||
icon.addClass( 'tticon tticon-north_east_black_24dp' );
|
||||
label.html( $.i18n._( 'Hierarchy' ) );
|
||||
|
||||
var len = related_view_controller.context_menu_array.length;
|
||||
|
||||
if ( !PermissionManager.checkTopLevelPermission( 'HierarchyControl' ) ) {
|
||||
ribbon_button.addClass( 'disable-image' );
|
||||
}
|
||||
|
||||
ribbon_button.bind( 'click', function() {
|
||||
|
||||
if ( ribbon_button.hasClass( 'disable-image' ) ) {
|
||||
return;
|
||||
}
|
||||
MenuManager.goToView( 'HierarchyControl' );
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
$.fn.NoHierarchyBox.defaults = {};
|
||||
|
||||
} )( jQuery );
|
81
interface/html5/global/widgets/message_box/NoResultBox.js
Normal file
81
interface/html5/global/widgets/message_box/NoResultBox.js
Normal file
@ -0,0 +1,81 @@
|
||||
( function( $ ) {
|
||||
|
||||
$.fn.NoResultBox = function( options ) {
|
||||
|
||||
Global.addCss( 'global/widgets/message_box/NoResultBox.css' );
|
||||
var opts = $.extend( {}, $.fn.NoResultBox.defaults, options );
|
||||
var related_view_controller;
|
||||
var message = Global.no_result_message;
|
||||
var iconLabel = '';
|
||||
|
||||
this.each( function() {
|
||||
|
||||
var o = $.meta ? $.extend( {}, opts, $( this ).data() ) : opts;
|
||||
|
||||
if ( o.related_view_controller ) {
|
||||
related_view_controller = o.related_view_controller;
|
||||
}
|
||||
|
||||
if ( o.message ) {
|
||||
message = o.message;
|
||||
}
|
||||
|
||||
if ( o.iconLabel ) {
|
||||
iconLabel = o.iconLabel;
|
||||
} else {
|
||||
iconLabel = $.i18n._( 'New' );
|
||||
}
|
||||
|
||||
var ribbon_button = $( this ).find( '.p-button' );
|
||||
var ribbon_button_div = $( this ).find( '.add-div' );
|
||||
var label = $( this ).find( '.p-button-label' );
|
||||
var icon = $( this ).find( '.icon' );
|
||||
var message_div = $( this ).find( '.message' );
|
||||
|
||||
ribbon_button_div.css( 'display', 'block' );
|
||||
|
||||
if ( o.is_new ) {
|
||||
|
||||
icon.addClass( 'tticon tticon-add_black_24dp' );
|
||||
label.text( iconLabel );
|
||||
|
||||
ribbon_button.bind( 'click', function() {
|
||||
related_view_controller.onAddClick();
|
||||
} );
|
||||
|
||||
} else if ( o.is_edit ) {
|
||||
|
||||
icon.addClass( 'tticon tticon-edit_black_24dp' );
|
||||
label.text( $.i18n._( 'Edit' ) );
|
||||
|
||||
ribbon_button.bind( 'click', function() {
|
||||
related_view_controller.onEditClick();
|
||||
} );
|
||||
|
||||
} else {
|
||||
|
||||
ribbon_button_div.css( 'display', 'none' );
|
||||
}
|
||||
|
||||
message_div.text( message );
|
||||
|
||||
} );
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
$.fn.NoResultBox.defaults = {};
|
||||
$.fn.NoResultBox.html_template = `
|
||||
<div class="no-result-div">
|
||||
<span class="message"></span>
|
||||
<div class="add-div">
|
||||
<button class="tt-button p-button p-component" type="button">
|
||||
<span class="icon"></span>
|
||||
<span class="label p-button-label"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
} )( jQuery );
|
@ -0,0 +1,58 @@
|
||||
( function( $ ) {
|
||||
|
||||
$.fn.SaveAndContinueBox = function( options ) {
|
||||
var opts = $.extend( {}, $.fn.SaveAndContinueBox.defaults, options );
|
||||
var field;
|
||||
var related_view_controller;
|
||||
|
||||
this.each( function() {
|
||||
|
||||
var o = $.meta ? $.extend( {}, opts, $( this ).data() ) : opts;
|
||||
|
||||
if ( o.related_view_controller ) {
|
||||
related_view_controller = o.related_view_controller;
|
||||
}
|
||||
|
||||
var label = $( this ).find( '.p-button-label' );
|
||||
var icon = $( this ).find( '.icon' );
|
||||
var message = $( this ).find( '.message' );
|
||||
|
||||
var ribbon_button = $( this ).find( '.p-button' );
|
||||
|
||||
message.text( Global.save_and_continue_message );
|
||||
icon.addClass('tticon tticon tticon-save_black_24dp');
|
||||
label.html( $.i18n._( 'Save & Continue' ) );
|
||||
|
||||
var context_menu_array = ContextMenuManager.getMenuModelByMenuId( related_view_controller.determineContextMenuMountAttributes().id );
|
||||
var len = context_menu_array.length;
|
||||
|
||||
for ( var i = 0; i < len; i++ ) {
|
||||
|
||||
let context_btn = context_menu_array[i];
|
||||
let id = context_btn.id;
|
||||
|
||||
if ( id === 'save_and_continue' ) {
|
||||
if ( !context_btn.visible || context_btn.disabled ) {
|
||||
ribbon_button.addClass( 'disable-image' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ribbon_button.off( 'click' ).on( 'click', function() {
|
||||
|
||||
if ( ribbon_button.hasClass( 'disable-image' ) ) {
|
||||
return;
|
||||
}
|
||||
related_view_controller.onSaveAndContinue();
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
$.fn.SaveAndContinueBox.defaults = {};
|
||||
|
||||
} )( jQuery );
|
Reference in New Issue
Block a user