Saturday 7 October 2017

APEX PROFILE MENU

Let's start


1- Create a custom Report Template using Named Column (row template)





    - add in Row Template 1 the below Code

<div id="accountMenu_menu" class="a-Header-accountDialog" tabindex="-1">
    <div class="a-MediaBlock a-Menu-content">
        <div class="a-MediaBlock-graphic">
            <span class="a-Header-userPhoto a-Header-userPhoto--large">
        <img src="#IMAGE#" height="64" width="64" class="a-Header-photo" alt="Profile image for user #FIRSTNAME#">
      </span>
            <a href="#EDIT_PROFIL#" class="a-Header-accountDialog-editProfile a-Menu-item a-Menu-label" id="EDIT_PROFILE_LINK">Edit Profile</a>
        </div>
        <div class="a-MediaBlock-content">
            <div class="a-Menu-label a-Menu-item" tabindex="-1">
                <span class="a-Header-dialogText a-Header-dialogName">#FIRSTNAME# #LASTNAME#</span>
                <span class="a-Header-dialogText a-Header-dialogUsername">#EMAIL#</span></div>
            <div class="a-Menu-label a-Menu-item" tabindex="-1">
                <span class="a-Header-dialogLabel">
Workspace</span><span class="a-Header-dialogValue">#WORKSPACE#</span></div>
            <div class="a-Menu-label a-Menu-item" tabindex="-1">
                <span class="a-Header-dialogLabel">Role</span><span class="a-Header-dialogValue">#ROLE#</span></div>
        </div>
    </div>
</div>

2- Create your Inline Dialog in Page 0 


3- Add to the Inline Dialogthe below Sql Query. You can call direct the Data for the Database


Add in your inline region a Static ID. Example exitpopup_bg



Create a DA On Page Load
Action: Javascript
$("#exitpopup_bg").dialog({

    autoOpen: false,

    modal: false,
    dialogClass: 'PROF_DID'

});

/* Close when click Outside the Dialog*/
$('html')
    .bind(
        'click',
        function(e) {
            if ($('#exitpopup_bg').dialog('isOpen') && !$(e.target).is('.ui-dialog, a') && !$(e.target).closest('.ui-dialog').length && !$(e.target).is('.image_icon')&&!$(e.target).is('.ui-dialog-titlebar-close')) {
                $('#exitpopup_bg').dialog('close');


                $('.image_icon').removeClass('et');
                $('.image_icon').addClass('st');
            }
        }
    );

4- Add the below Css to make the Profil Menu Beautiful and  at the Top Right of the Page

:focus {
    outline: none !important
}
.PROF_DID .t-DialogRegion-buttons{
    background-color: #FBFBFB;
}
.t-Button.t-Button--header:active, .t-Button.t-Button--header:focus:active {
    background-color: rgba(0, 0, 0, 0)  !important;
}
.t-Button.t-Button--header:focus:before, .t-Button.t-Button--header:active:focus:before {
    box-shadow: none !important;
}
.t-Button.t-Button--header:hover {
    background-color: rgba(0,0,0,0);
    box-shadow: none !important;
}
.PROF_DID.ui-widget.ui-dialog {
  right:0px !important;
  left:initial !important;
  float:right !important;
  top:47px !important;
  border-radius:.4rem !important;
  box-shadow:rgba(0,0,0,.1) 0 0.4rem 1.6rem !important;
}
.PROF_DID.ui-dialog{
    width:320px !important;
    height:260px !important;
}
#exitpopup_bg{
     height:260px !important;
}
.PROF_DID.ui-dialog .ui-dialog-titlebar {
    background-color: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: none;
}
.a-MediaBlock.a-Menu-content {
    background: none;
    border: none;
    box-shadow: none;
}
.a-Header-accountDialog .a-MediaBlock-graphic {
    margin-right: 16px;
}
.a-MediaBlock-graphic {
    float: left;
    margin-right: 8px;
}
.a-Header-accountDialog .a-Header-userPhoto--large {
    background-color: #F8F8F8;
}
.a-Header-userPhoto {
    box-shadow: 0 0 0 1px #B0B0B0 inset;
}
.a-Header-userPhoto {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 100%;
    vertical-align: top;
    overflow: hidden;
    position: relative;
}
.a-Header-accountDialog.a-Menu .a-Menu-label {
    padding: 0;
}
.a-Header-accountDialog.a-Menu .a-Menu-item {
    display: inherit;
    color: inherit;
    line-height: inherit;
    float: none;
}
.a-Header-accountDialog-editProfile.a-Menu-item.a-Menu-label {
    text-align: center;
}
.a-Header-accountDialog-editProfile.a-Menu-item.a-Menu-label, .a-Menu-content .a-Header-dialogLink.a-Menu-item .a-Menu-label {
    display: block;
    margin-top: 4px;
    color: #146fb8;
}
.a-Header-accountDialog-editProfile.a-Menu-item.a-Menu-label, .a-Header-dialogLink.a-Menu-item .a-Menu-label {
    font-size: 11px;
    line-height: 16px;
    padding: 0;
    border-radius: 2px;
    transition: none;
}
.a-Header-accountDialog .a-MediaBlock-content {
    padding: 4px 0;
}
.a-Header-userPhoto--large, .a-Header-userPhoto--large .a-Icon, .a-Header-userPhoto--large img {
    width: 64px;
    height: 64px;
}
.a-Header-dialogName {
    font-weight: 300;
    font-size: 20px;
    line-height: 24px;
}
.a-Header-dialogText {
    display: block;
    line-height: 16px;
}
.a-Header-photoPlaceholder {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    border-radius: 100%;
    box-shadow: 0 0 0 1px rgba(0,0,0,.15)inset;
}
.a-Header-accountDialog.a-Menu .a-Menu-item {
    display: inherit;
    color: inherit;
    line-height: inherit;
    float: none;
}
.a-Header-accountDialog.a-Menu .a-MediaBlock-content .a-Menu-item.a-Menu-label {
    cursor: default;
}
.a-Header-dialogUsername {
    font-size: 11px;
    font-weight: 400;
}
.a-Header-dialogLabel, .a-Header-dialogUsername {
    color: #777;
}
.a-Header-dialogLabel {
    margin-top: 16px;
    line-height: 10px;
    font-size: 9px;
    text-transform: uppercase;
    display: block;
}
.a-Header-dialogValue {
    font-size: 12px;
    line-height: 16px;
}
.a-Header-dialogName, .a-Header-dialogValue {
    color: #404040;
}
.profile-icon {
    background-color: transparent;
    background-repeat: no-repeat;
    background-size: 24px;
    display: inline-block;
    height: 24px;
    width: 24px;
    vertical-align: baseline;
    cursor: pointer;
    border-radius: 100%;
    margin-right: 5px;
}


5- Add class to your Navigation Bar Item. Example image_icon st

6- Add Custom Templete 


7-  Create a DA On Click to Open The Menu( Inline Dialog)
  - Event: Click
  - Selection Type: Jquery Selector
  - Jquery Selector: .image_icon.st ( Remember that we add this class before in the Navigation Bar Item)
 - Event Scope: Dynamic
 - Action: Javascript
openModal("exitpopup_bg");
$('.image_icon').removeClass('st');
$('.image_icon').addClass('et');

8  Create a DA On Click to CloseThe Menu( Inline Dialog)
 - Event: Click
  - Selection Type: Jquery Selector
  - jquery Selector: .image_icon.et
 - Event Scope: Dynamic
 - Action: Javascript
closeModal("exitpopup_bg");
$('.image_icon').removeClass('et');
$('.image_icon').addClass('st');

9- Set Navigation Bar Item Target



12 comments:

  1. Hi!
    please. help me
    where should I add the code wrote in the step 4? In page 0 I have not "Inline"

    ReplyDelete
    Replies
    1. You Should add css code in Theme Roller --> Custom CSS

      Delete
  2. Thanks brother can you send demp application to my email
    amhosny2017@gmai.com

    ReplyDelete
  3. Dear Mugbil,
    Many thanks for your instructions.
    May I ask where to put SQL query in step 3 exactly?

    Regards..

    ReplyDelete
    Replies
    1. when you make the region you have to choose Classic report, so that you can add sql query

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. That is great Idea to make the interface like that.

      I tried to use your idea and approach in Plugin so that developers can implement this.
      Take a look : APEX profiler

      Delete
    2. When I clicked outside the page then the inline dialogue still exist. How can I resolved this issue in your plugin ?

      Delete
  5. Please Help Logout button footer how is it...

    ReplyDelete
  6. In my application saying with an empty box. Please Help me.
    report error:
    ORA-01403: no data found

    ReplyDelete
  7. Thanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle APEX . Actually, I was looking for the same information on internet for
    Oracle Apex Interview Questions and Answers and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject.



    ReplyDelete