From 8c1422103ea807afc86ebe15b4005eaaeeaef875 Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Fri, 10 Jun 2016 10:40:13 +0200 Subject: [PATCH 1/3] Frio: login button opens a modal --- view/theme/frio/templates/nav.tpl | 20 +++++++++++++++++++- view/theme/frio/templates/nav_head.tpl | 6 ++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/view/theme/frio/templates/nav.tpl b/view/theme/frio/templates/nav.tpl index b8d5b2307e..a3f479db99 100644 --- a/view/theme/frio/templates/nav.tpl +++ b/view/theme/frio/templates/nav.tpl @@ -240,11 +240,29 @@ + + {{/if}} {{* The second navbar which contains nav points of the actual page - (nav points are actual handled by this theme throug js *}} diff --git a/view/theme/frio/templates/nav_head.tpl b/view/theme/frio/templates/nav_head.tpl index f00ff0355f..13842bbe8a 100644 --- a/view/theme/frio/templates/nav_head.tpl +++ b/view/theme/frio/templates/nav_head.tpl @@ -2,5 +2,11 @@ From f8c62f04079fba8795a83771c5c3615e233ba5ca Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sat, 11 Jun 2016 09:40:50 +0200 Subject: [PATCH 2/3] Frio: make jslint more happy --- view/theme/frio/js/modal.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index f1efbd752e..973847509e 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -19,7 +19,7 @@ $(document).ready(function(){ // restore cached jot at its hidden position ("#jot-content") $("#jot-content").append(jotcache); // clear the jotcache - jotcache = '' + jotcache = ''; }); // Add Colorbox for viewing Network page images @@ -60,7 +60,7 @@ $(document).ready(function(){ // Open filebrowser for elements with the class "image-select" // The following part handles the filebrowser for field_fileinput.tpl - $("body").on("click", ".image-select", function(e){ + $("body").on("click", ".image-select", function(){ // set a extra attribute to mark the clicked button this.setAttribute("image-input", "select"); Dialog.doImageBrowser("input"); @@ -69,7 +69,7 @@ $(document).ready(function(){ // Insert filebrowser images into the input field (field_fileinput.tpl) $("body").on("fbrowser.image.input", function(e, filename, embedcode, id, img) { // select the clicked button by it's attribute - var elm = $("[image-input='select']") + var elm = $("[image-input='select']"); // select the input field which belongs to this button var input = elm.parent(".input-group").children("input"); // remove the special indicator attribut from the button @@ -134,7 +134,7 @@ Dialog._load = function(url) { // initialize the filebrowser var jsbrowser = function() { FileBrowser.init(nickname, type, hash); - } + }; loadScript("view/theme/frio/js/filebrowser.js", jsbrowser); }; @@ -166,7 +166,7 @@ function loadModalTitle() { function addToModal(url) { var char = qOrAmp(url); - var url = url + char + 'mode=none'; + url = url + char + 'mode=none'; var modal = $('#modal').modal(); modal @@ -182,7 +182,7 @@ function addToModal(url) { loadModalTitle(); } }); -}; +} // function to load the html from the edit post page into // the jot modal @@ -201,7 +201,7 @@ function editpost(url) { } var modal = $('#jot-modal').modal(); - var url = url + " #profile-jot-form"; + url = url + " #profile-jot-form"; //var rand_num = random_digits(12); $(".jot-nav #jot-perms-lnk").parent("li").hide(); From 2ec06c1a38bc28ea32ed791f1fb85df697b3474d Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sat, 11 Jun 2016 09:58:26 +0200 Subject: [PATCH 3/3] use js/modal.js to show Login page in modal --- view/theme/frio/js/modal.js | 10 ++++++++-- view/theme/frio/templates/nav.tpl | 22 +++++----------------- view/theme/frio/templates/nav_head.tpl | 8 +------- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 973847509e..0a881f10f6 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -50,7 +50,11 @@ $(document).ready(function(){ } }); - + // Navbar login + $("body").on("click", "#nav-login", function(e){ + e.preventDefault(); + Dialog.show(this.href, this.dataset.originalTitle || this.title); + }); // Jot nav menu. $("body").on("click", "#jot-modal .jot-nav li a", function(e){ @@ -81,8 +85,9 @@ $(document).ready(function(){ }); // overwrite Dialog.show from main js to load the filebrowser into a bs modal -Dialog.show = function(url) { +Dialog.show = function(url, title="") { var modal = $('#modal').modal(); + modal.find("#modal-header h4").html(title); modal .find('#modal-body') .load(url, function (responseText, textStatus) { @@ -129,6 +134,7 @@ Dialog._load = function(url) { // try to fetch the hash form the url var match = url.match(/fbrowser\/[a-z]+\/\?mode=none(.*)/); + if (match===null) return; //not fbrowser var hash = match[1]; // initialize the filebrowser diff --git a/view/theme/frio/templates/nav.tpl b/view/theme/frio/templates/nav.tpl index a3f479db99..a0ee088843 100644 --- a/view/theme/frio/templates/nav.tpl +++ b/view/theme/frio/templates/nav.tpl @@ -240,29 +240,17 @@ - {{/if}} {{* The second navbar which contains nav points of the actual page - (nav points are actual handled by this theme throug js *}} diff --git a/view/theme/frio/templates/nav_head.tpl b/view/theme/frio/templates/nav_head.tpl index 13842bbe8a..d7b50a58d0 100644 --- a/view/theme/frio/templates/nav_head.tpl +++ b/view/theme/frio/templates/nav_head.tpl @@ -1,12 +1,6 @@