]> git.mxchange.org Git - friendica.git/commitdiff
frio: restructure jot modal and make jot modal work on mobile
authorrabuzarus <>
Mon, 27 Jun 2016 08:33:20 +0000 (10:33 +0200)
committerrabuzarus <>
Mon, 27 Jun 2016 08:33:20 +0000 (10:33 +0200)
view/theme/frio/css/style.css
view/theme/frio/js/modal.js
view/theme/frio/js/theme.js
view/theme/frio/templates/jot-header.tpl
view/theme/frio/templates/jot.tpl

index 1eda19764f7edd73dbd7890cc7062defb3203fcf..c7cf213724eef9c2e4a8da8a12c9d02c1e538ec2 100644 (file)
@@ -69,6 +69,9 @@ iframe, img {
 .fakelink {
     cursor: pointer;
 }
+.hidden {
+    display: none !important;
+}
 
 /*
 * standard page elements
@@ -156,6 +159,15 @@ a#item-delete-selected {
     outline: 0;
     background: $btn_primary_hover_color !important;
 }
+.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover,
+.btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover,
+.open>.dropdown-toggle.btn-primary.focus, .open>.dropdown-toggle.btn-primary:focus,
+.open>.dropdown-toggle.btn-primary:hover,.btn-primary.active, .btn-primary:active,
+.open>.dropdown-toggle.btn-primary {
+    background: $btn_primary_hover_color;
+    border-color: none;
+}
+       
 .btn-link {
 /*    color: #6fdbe8;*/
     color: $link_color;
index 15a4f7f6e63905ec515071c5c841416d4b7d2a5a..b58288318da3b01bc459c00b7fe2793fe42ce8e7 100644 (file)
@@ -224,7 +224,7 @@ function editpost(url) {
        url = url + " #profile-jot-form";
 
        //var rand_num = random_digits(12);
-       $(".jot-nav #jot-perms-lnk").parent("li").hide();
+       $(".jot-nav .jot-perms-lnk").parent("li").addClass("hidden");
 
        // For editpost we load the modal html form the edit page. So we would have two jot forms in
        // the page html. To avoid js conflicts we store the original jot in the variable jotcache.
@@ -241,7 +241,7 @@ function editpost(url) {
        jotreset();
 
        modal
-               .find('#jot-modal-body')
+               .find('#jot-modal-content')
                .load(url, function (responseText, textStatus) {
                        if ( textStatus === 'success' || 
                                textStatus === 'notmodified') 
@@ -267,7 +267,7 @@ function jotreset() {
        // We need this to prevent that the modal displays old content
        $('body').on('hidden.bs.modal', '#jot-modal.edit-jot', function () {
                $(this).removeData('bs.modal');
-               $(".jot-nav #jot-perms-lnk").parent("li").show();
+               $(".jot-nav .jot-perms-lnk").parent("li").removeClass("hidden");
                $("#profile-jot-form #jot-title-wrap").show();
                $("#profile-jot-form #jot-category-wrap").show();
 
@@ -281,14 +281,14 @@ function jotreset() {
 
                // remove the "edit-jot" class so we can the standard behavior on close
                $("#jot-modal.edit-jot").removeClass("edit-jot");
-               $("#jot-modal-body").empty();
+               $("#jot-modal-content").empty();
        });
 }
 
 // Give the active "jot-nav" list element the class "active"
 function toggleJotNav (elm) {
        // select all li of jot-nav and remove the active class
-       $(elm).closest(".jot-nav").children("li").removeClass("active");
+       $(".jot-nav li").removeClass("active");
        // add the active class to the parent of the link which was selected
        $(elm).parent("li").addClass("active");
 }
index 296c4667d30c30484e2ed09a55b580065d94753e..1e26ad7705af71e57e5e782497b920f674db7f28 100644 (file)
@@ -206,6 +206,16 @@ $(document).ready(function(){
                // put the new element to the second nav bar
                $("#topbar-second > .container > #tabmenu").append(newText);
        }
+
+       // Dropdown menus with the class "dropdown-head" will display the active tab
+       // as button text
+       $("body").on('click', '.dropdown-head .dropdown-menu li a', function(){
+               $(this).closest(".dropdown").find('.btn').html($(this).text() + ' <span class="caret"></span>');
+               $(this).closest(".dropdown").find('.btn').val($(this).data('value'));
+               $(this).closest("ul").children("li").show();
+               $(this).parent("li").hide();
+       });
+
 });
 //function commentOpenUI(obj, id) {
 //     $(document).unbind( "click.commentOpen", handler );
index dc4bf32fc599d5728d41ddeee9de5674b3677bc5..3bec6839f082b1ab34e40a5a31dbbdb687d7abbe 100644 (file)
@@ -400,10 +400,9 @@ function enableOnUser(){
                jotcache = $("#profile-jot-form");
 
                modal
-                       .find('#jot-modal-body')
+                       .find('#jot-modal-content')
                        .append(jotcache)
-                       .modal.show
-                       ;
+                       .modal.show;
        }
 
        // the following functions show/hide the specific jot content 
index b1b022f06f4528beefd74899b4d5e6eb2de8cb8a..0d88472863714bf7b6be82e36ad6d670c5e17029 100644 (file)
 
 <div id="jot-content">
        <form id="profile-jot-form" action="{{$action}}" method="post">
-               <div id="profile-jot-wrapper">
-                       <div>
-                               <div id="character-counter" class="grey jothidden text-info pull-left"></div>
-                               <!--<div id="profile-jot-desc" class="jothidden pull-right">&nbsp;</div>-->
-                       </div>
+               <div class="modal-header">
+                       {{* Note: We need 2 modal close buttons here to bypass a bug in bootstrap.
+                       The second is for mobile view. The first one doesnt work with dropdowns. To get a working close button
+                       in with dropdows the close button needs to be inserted after the dropdown. *}}
+                       <button type="button" class="close hidden-xs" data-dismiss="modal" style="float: right;">&times;</button>
+
+                       {{* The Jot navigation menu (text input, permissions, preview, filebrowser) *}}
+                       <ul class="nav nav-tabs hidden-xs jot-nav" role="menubar" data-tabs="tabs">
+                               {{* Mark the first list entry as active because it is the first which is active after opening
+                                       the modal. Changing of the activity status is done by js in jot.tpl-header *}}
+                               <li class="active" role="menuitem"><a id="jot-text-lnk" class="jot-text-lnk" onclick="jotActive(); return false;">{{$message}}</a></li>
+                               {{if $acl}}<li role="menuitem"><a id="jot-perms-lnk" class="jot-perms-lnk" onclick="aclActive();return false;">{{$shortpermset}}</a></li>{{/if}}
+                               {{if $preview}}<li role="menuitem"><a id="jot-preview-lnk" class="jot-preview-lnk" onclick="previewActive();return false;">{{$preview}}</a></li>{{/if}}
+                               <li role="menuitem"><a id="jot-browser-link" onclick="fbrowserActive(); return false;">{{$browser}}</a></li>
+                       </ul>
 
-                       <div id="profile-jot-banner-end"></div>
-
-                       {{* The hidden input fields which submit important values with the post *}}
-                       <input type="hidden" name="type" value="{{$ptyp}}" />
-                       <input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
-                       <input type="hidden" name="return" value="{{$return_path}}" />
-                       <input type="hidden" name="location" id="jot-location" value="{{$defloc}}" />
-                       <input type="hidden" name="coord" id="jot-coord" value="" />
-                       <input type="hidden" name="post_id" value="{{$post_id}}" />
-                       <input type="hidden" name="preview" id="jot-preview" value="0" />
-                       <input type="hidden" name="post_id_random" value="{{$rand_num}}" />
-                       {{if $notes_cid}}
-                       <input type="hidden" name="contact_allow[]" value="<{{$notes_cid}}>" />
-                       {{/if}}
-                       <div id="jot-title-wrap"><input name="title" id="jot-title" class="jothidden jotforms form-control" type="text" placeholder="{{$placeholdertitle}}" title="{{$placeholdertitle}}" value="{{$title}}" style="display:block;" /></div>
-                       {{if $placeholdercategory}}
-                       <div id="jot-category-wrap"><input name="category" id="jot-category" class="jothidden jotforms form-control" type="text" placeholder="{{$placeholdercategory}}" title="{{$placeholdercategory}}" value="{{$category}}" /></div>
-                       {{/if}}
-
-                       {{* The jot text field in which the post text is inserted *}}
-                       <div id="jot-text-wrap">
-                       <textarea rows="2" cols="64" class="profile-jot-text form-control" id="profile-jot-text" name="body" onFocus="jotTextOpenUI(this);" onBlur="jotTextCloseUI(this);" style="min-width:100%; max-width:100%;">{{if $content}}{{$content}}{{else}}{{$share}}{{/if}}</textarea>
+                       <div class="dropdown dropdown-head dropdown-mobile-jot jot-nav hidden-lg hidden-md hidden-sm" role="menubar" data-tabs="tabs" style="float: left;">
+                               <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{{$message}}&nbsp;<span class="caret"></span></button>
+                               <ul class="dropdown-menu nav nav-pills">
+                                       {{* mark the first list entry as active because it is the first which is active after opening
+                                       the modal. Changing of the activity status is done by js in jot.tpl-header *}}
+                                       <li role="menuitem" style="display: none;"><a id="jot-text-lnk-mobile" class="jot-text-lnk" onclick="jotActive(); return false;">{{$message}}</a></li>
+                                       {{if $acl}}<li role="menuitem"><a id="jot-perms-lnk-mobile" class="jot-perms-lnk" onclick="aclActive();return false;">{{$shortpermset}}</a></li>{{/if}}
+                                       {{if $preview}}<li role="menuitem"><a id="jot-preview-lnk-mobile" class="jot-preview-lnk" onclick="previewActive();return false;">{{$preview}}</a></li>{{/if}}
+                               </ul>
                        </div>
+                       <button type="button" class="close hidden-lg hidden-md hidden-sm" data-dismiss="modal" style="float: right;">&times;</button>
+               </div>
+
+               <div id="jot-modal-body" class="modal-body">
 
-                       <ul id="profile-jot-submit-wrapper" class="jothidden nav nav-pills">
-                               {{* uncomment the button for "wall-immage-upload" because we have integrated it directly in the jot modal
-                               <li><a href="#" id="wall-image-upload" title="{{$upload}}"><i class="fa fa-picture-o"></i></a></li>
-                               *}}
-                               <li><a href="#" onclick="return false;" id="wall-file-upload"  title="{{$attach}}"><i class="fa fa-paperclip"></i></a></li>
-                               <li><a id="profile-link"  ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink(); return false;" title="{{$weblink}}"><i class="fa fa-link"></i></a></li>
-                               <li><a id="profile-video" onclick="jotVideoURL();return false;" title="{{$video}}"><i class="fa fa-film"></i></a></li>
-                               <li><a id="profile-audio" onclick="jotAudioURL();return false;" title="{{$audio}}"><i class="fa fa-music"></i></a></li>
-                               <li><a id="profile-location" onclick="jotGetLocation();return false;" title="{{$setloc}}"><i class="fa fa-map-marker"></i></a></li>
-                               <!-- TODO: waiting for a better placement 
-                               <li><a id="profile-nolocation" onclick="jotClearLocation();return false;" title="{{$noloc}}">{{$shortnoloc}}</a></li>
-                               -->
-
-                               <li class="pull-right"><button class="btn btn-primary" id="jot-submit" type="submit" id="profile-jot-submit" name="submit" ><i class="fa fa-slideshare fa-fw"></i> {{$share}}</button></li>
-                               <div id="profile-rotator-wrapper" style="display: {{$visitor}};" >
-                                       <img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
-                               </div> 
-                               <div id="profile-jot-plugin-wrapper">
-                                       {{$jotplugins}}
+                       <div id="profile-jot-wrapper">
+                               <div>
+                                       <div id="character-counter" class="grey jothidden text-info pull-left"></div>
+                                       <!--<div id="profile-jot-desc" class="jothidden pull-right">&nbsp;</div>-->
                                </div>
-                       </ul>
-               </div>
 
-               <div id="profile-jot-acl-wrapper" style="display: none;">
-                       {{$acl}}
-               </div>
+                               <div id="profile-jot-banner-end"></div>
+
+                               {{* The hidden input fields which submit important values with the post *}}
+                               <input type="hidden" name="type" value="{{$ptyp}}" />
+                               <input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
+                               <input type="hidden" name="return" value="{{$return_path}}" />
+                               <input type="hidden" name="location" id="jot-location" value="{{$defloc}}" />
+                               <input type="hidden" name="coord" id="jot-coord" value="" />
+                               <input type="hidden" name="post_id" value="{{$post_id}}" />
+                               <input type="hidden" name="preview" id="jot-preview" value="0" />
+                               <input type="hidden" name="post_id_random" value="{{$rand_num}}" />
+                               {{if $notes_cid}}
+                               <input type="hidden" name="contact_allow[]" value="<{{$notes_cid}}>" />
+                               {{/if}}
+                               <div id="jot-title-wrap"><input name="title" id="jot-title" class="jothidden jotforms form-control" type="text" placeholder="{{$placeholdertitle}}" title="{{$placeholdertitle}}" value="{{$title}}" style="display:block;" /></div>
+                               {{if $placeholdercategory}}
+                               <div id="jot-category-wrap"><input name="category" id="jot-category" class="jothidden jotforms form-control" type="text" placeholder="{{$placeholdercategory}}" title="{{$placeholdercategory}}" value="{{$category}}" /></div>
+                               {{/if}}
+
+                               {{* The jot text field in which the post text is inserted *}}
+                               <div id="jot-text-wrap">
+                               <textarea rows="2" cols="64" class="profile-jot-text form-control" id="profile-jot-text" name="body" onFocus="jotTextOpenUI(this);" onBlur="jotTextCloseUI(this);" style="min-width:100%; max-width:100%;">{{if $content}}{{$content}}{{else}}{{$share}}{{/if}}</textarea>
+                               </div>
+
+                               <ul id="profile-jot-submit-wrapper" class="jothidden nav nav-pills">
+                                       {{* uncomment the button for "wall-immage-upload" because we have integrated it directly in the jot modal
+                                       <li><a href="#" id="wall-image-upload" title="{{$upload}}"><i class="fa fa-picture-o"></i></a></li>
+                                       *}}
+                                       <li><a href="#" onclick="return false;" id="wall-file-upload"  title="{{$attach}}"><i class="fa fa-paperclip"></i></a></li>
+                                       <li><a id="profile-link"  ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink(); return false;" title="{{$weblink}}"><i class="fa fa-link"></i></a></li>
+                                       <li><a id="profile-video" onclick="jotVideoURL();return false;" title="{{$video}}"><i class="fa fa-film"></i></a></li>
+                                       <li><a id="profile-audio" onclick="jotAudioURL();return false;" title="{{$audio}}"><i class="fa fa-music"></i></a></li>
+                                       <li><a id="profile-location" onclick="jotGetLocation();return false;" title="{{$setloc}}"><i class="fa fa-map-marker"></i></a></li>
+                                       <!-- TODO: waiting for a better placement 
+                                       <li><a id="profile-nolocation" onclick="jotClearLocation();return false;" title="{{$noloc}}">{{$shortnoloc}}</a></li>
+                                       -->
+
+                                       <li class="pull-right"><button class="btn btn-primary" id="jot-submit" type="submit" id="profile-jot-submit" name="submit" ><i class="fa fa-slideshare fa-fw"></i> {{$share}}</button></li>
+                                       <div id="profile-rotator-wrapper" style="display: {{$visitor}};" >
+                                               <img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
+                                       </div> 
+                                       <div id="profile-jot-plugin-wrapper">
+                                               {{$jotplugins}}
+                                       </div>
+                               </ul>
+                       </div>
 
-               <div id="jot-preview-content" style="display:none;"></div>
+                       <div id="profile-jot-acl-wrapper" style="display: none;">
+                               {{$acl}}
+                       </div>
+
+                       <div id="jot-preview-content" style="display:none;"></div>
 
-               <div id="jot-fbrowser-wrapper" style="display: none"></div>
+                       <div id="jot-fbrowser-wrapper" style="display: none"></div>
 
-               {{if $content}}<script>initEditor();</script>{{/if}}
+                       {{if $content}}<script>initEditor();</script>{{/if}}
+               </div>
        </form>
 </div>
 
@@ -80,41 +112,7 @@ can load different content into the jot moadl (e.g. the item edit jot)
 *}}
 <div id="jot-modal" class="modal fade" role="dialog">
        <div class="modal-dialog">
-               <div class="modal-content">
-
-                       <div class="modal-header">
-                               <button type="button" class="close" data-dismiss="modal">&times;</button>
-                               <!--<h4 class="modal-title">Modal Header</h4>-->
-                               {{* The Jot navigation menu (text input, permissions, preview, filebrowser) *}}
-                               <ul class="nav nav-tabs hidden-xs jot-nav" role="menubar" data-tabs="tabs">
-                                       {{* Mark the first list entry as active because it is the first which is active after opening
-                                               the modal. Changing of the activity status is done by js in jot.tpl-header *}}
-                                       <li class="active" role="menuitem"><a id="jot-text-lnk" onclick="jotActive(); return false;">{{$message}}</a></li>
-                                       {{if $acl}}<li role="menuitem"><a id="jot-perms-lnk" onclick="aclActive();return false;">{{$shortpermset}}</a></li>{{/if}}
-                                       {{if $preview}}<li role="menuitem"><a id="jot-preview-lnk" onclick="previewActive();return false;">{{$preview}}</a></li>{{/if}}
-                                       <li role="menuitem"><a id="jot-preview-link" onclick="fbrowserActive(); return false;">{{$browser}}</a></li>
-                               </ul>
-                               
-                               <div class="dropdown  hidden-lg hidden-md hidden-sm" role="menubar" data-tabs="tabs">
-                                       <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown"> JOT
-                                       <span class="caret"></span></button>
-                                       <ul class="dropdown-menu nav nav-pills">
-                                               {{* mark the first list entry as active because it is the first which is active after opening
-                                               the modal. Changing of the activity status is done by js in jot.tpl-header *}}
-                                               <li class="active" role="menuitem"><a id="jot-text-lnk-mobile" onclick="jotActive(); return false;">{{$message}}</a></li>
-                                               {{if $acl}}<li role="menuitem"><a id="jot-perms-lnk-mobile" onclick="aclActive();return false;"{{$shortpermset}}</a></li>{{/if}}
-                                               {{if $preview}}<li role="menuitem"><a id="jot-preview-lnk-mobile" onclick="previewActive();return false;">{{$preview}}</a></li>{{/if}}
-                                       </ul>
-                               </div>
-                       </div>
-
-
-                       <div id="jot-modal-body" class="modal-body">
-
-
-<!-- End Modal -->
-                       </div>
-               </div>
+               <div id="jot-modal-content" class="modal-content"></div>
        </div>
 </div>