Bootstrap Tour with an ASP.NET/MVC layout page - html

I'm trying to set up a bootstrap tour. I've got two pages (Design.vbhtml and EditHomePage.vbhtml). They both use a layout page called (_DesignerLayout.vbhtml). I've got all the scripts and stylesheets for bootstrap, tour, jquery, etc. listed on the layout page. All that stuff is correct.
My tour starts on the Design page and displays my first 3 steps correctly. However when it gets to the fourth step (called third-step, not to be confused), it goes to the second page but it doesn't continue with the steps. The tour just stops.
My elements are all id's on div tags (welcome-step, first-step, etc.). I know those are all correct. It has to do something with my paths.
I've looked everywhere and can't seem to find anyone else using a layout page with a tour, so I'm wondering if it has anything to do with the steps jumping from the design page to the layout page to the edithomepage page. Any ideas would be appreciated!
Here is my bootstrap tour code---
Design.vbhtml (first page):
$(function () {
// Instance the tour
var tour = new Tour({
backdrop: true,
steps: [
{
element: "#welcome-step",
title: "Welcome!",
content: "Begin this tour to see how you can design the look of your website.",
orphan: true,
path: "/ClubAthleticsTemplate/Organization/Design/" & "#ViewBag.OrganizationId"
// this element is on the design.vbhtml page
},
{
element: "#first-step",
title: "Change the Look",
content: "Use this section to design how your website looks. You can choose which pages you want to include on your website.",
path: "/ClubAthleticsTemplate/Organization/Design/" & "#ViewBag.OrganizationId"
// this element is on the design.vbhtml page
},
{
element: "#second-step",
title: "Edit Pages",
content: "These are the different pages you can edit for your website. Click on each one to customize.",
path: "/ClubAthleticsTemplate/Organization/Design/" & "#ViewBag.OrganizationId"
// this element is on the _DesignerLayout.vbhtml page
},
{
element: "#third-step",
title: "Main Photo",
content: "You can upload a main photo that will appear on your front page.",
path: "/ClubAthleticsTemplate/Organization/EditHomePage/" & "#ViewBag.OrganizationId"
// this element is on the EditHomePage.vbhtml page
},
{
element: "#fourth-step",
title: "Main Photo Display",
content: "You can specify whether or not you want the main photo show at the top of all of your pages.",
path: "/ClubAthleticsTemplate/Organization/EditHomePage/" & "#ViewBag.OrganizationId"
// this element is on the EditHomePage.vbhtml page
},
{
element: "#fifth-step",
title: "Page Headline",
content: "This is where you can set a title for your page.",
path: "/ClubAthleticsTemplate/Organization/EditHomePage/" & "#ViewBag.OrganizationId"
// this element is on the EditHomePage.vbhtml page
},
{
element: "#sixth-step",
title: "Page Content",
content: "Here is where you add all your content for your page. You can add text, images, media, tables, etc.",
path: "/ClubAthleticsTemplate/Organization/EditHomePage/" & "#ViewBag.OrganizationId"
// this element is on the EditHomePage.vbhtml page
},
{
element: "#seventh-step",
title: "Save Changes",
content: "Make sure to hit the 'Save' button when finished!",
path: "/ClubAthleticsTemplate/Organization/EditHomePage/" & "#ViewBag.OrganizationId"
// this element is on the EditHomePage.vbhtml page
}
]
});
// Initialize the tour
tour.init();
// Start the tour
tour.start();
});
;

I discovered that copying and pasting the entire tour onto the second page gets it to work perfectly. It's not the best coding practice seeing as I have the same code in two different places and have to change both locations each time I make a change in it. But, for now, it works.

Related

Change nav title link in docusaurus

In my docusaurus.config.js file I have the following which defines the contents of my nav bar:
navbar: {
title: 'Utili Documentation',
logo: {
alt: 'Utili Logo',
src: 'https://file.utili.xyz/UtiliSmall.png',
},
items: [
{
href: 'https://utili.xyz/',
label: 'Utili',
position: 'right',
},
{
href: 'https://github.com/230Daniel/UtiliDocs/',
label: 'GitHub',
position: 'right',
},
],
},
I would like to change the link of the navbar title from https://docs.utili.xyz/ to https://docs.utili.xyz/docs. How could I do so? I've tried adding a href value, but when building I was told that it was invalid.
I'm using Docusaurus 2.
Late to the party, but documentation actually shows the correct way, altough it may be a bit puzzleling. The trick is to set the href field of the logo attribute. That field is in fact binded to the link of the title itself (altough the title href cannot be directly set). Citing the documentation, he solution thus may be
logo: {
alt: 'Utili Logo',
src: 'https://file.utili.xyz/UtiliSmall.png'
href: 'https://docs.utili.xyz/docs', // Default to `siteConfig.baseUrl`.
target: '_self', // By default, this value is calculated based on the `href` attribute (the external link will open in a new tab, all others in the current one).
},
How one can set the title without displaying a logo, that I do not know.

How to show a modal popup from the context menu?

How can I display a modal dialog from the context menu?
I can show a new window from context menu which opens in its own tab:
var menuItem = {
"id": "rateMenu",
"title": "Rate Item",
"contexts": ["all"],
}
chrome.contextMenus.create(menuItem);
chrome.contextMenus.onClicked.addListener(function (clickData) {
open('index.html');
});
I also know how to show a modal dialog, using bootstrap (for example) on the page itself:
$('#myModal').modal({
backdrop: 'static',
keyboard: false
})
In this particular case I want to show a modal dialog that you cannot close unless you press the "close" button.
However, I have no idea how to show the modal popup window straight away from the context menu.
Does anyone have any idea how this can be achieved?
Thank you!
I have done the same. Just use content script to show modal.
Example : When user clicks the context menu item, send message to content script to let it know about it so that it should open a modal.
background.js:
chrome.contextMenus.onClicked.addListener(function (clickData) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {type: "openModal"});
});
});
contentscript.js:
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse){
switch (request.type){
case "openModal":
$('#myModal').modal({
backdrop: 'static',
keyboard: false
});
break;
});
Make sure to include necessary css and js files under content_scripts in manifest.json
"content_scripts": [
{
"matches": ["https://*/*"],
"css":["bootstrap.min.css"],
"js":["jquery.min.js","bootstrap.min.js","contentscript.js"],
"run_at":"document_end"
}
]
NOTE : Using bootstrap.min.css may conflict with the page UI and it may change it. To avoid this, move your modal and the required js and css files in a separate html file(modal.html). Then inject your iframe into the tab using content script.
var iframe = document.createElement('iframe');
iframe.src = chrome.extension.getURL("modal.html");
iframe.frameBorder = 0;
iframe.id = "myFrame";
$(iframe).hide();//necessary otherwise frame will be visible
$(iframe).appendTo("body");
Remember to add modal.html and all the css and js files that are used inside modal.html like modal.js,bootstrap.min.js,bootstrap.min.css under web_accessible_resources:
web_accessible_resources": ["modal.html","modal.js","bootstrap.min.js","bootstrap.min.css"]
Now you can hide or show your iframe using content script but to show and hide modal, it can be done from inside iframe only. So you would need to pass a message from background to iframe to show the modal.The code above mentioned for contentscript will work for iframe also.
In case you want to hide the iframe, just send message from iframe to contentscipt using window.parent.postMessage().
Example:
modal.js:
window.parent.postMessage({ type: "hideFrame" }, "*");
contentscript.js:
window.addEventListener("message", function(event) {
if (event.data.type == "hideFrame") {
$("#myFrame").hide();
}
});

Customizing back button in navigationbar

I have two questions regarding the back button in the Navigationbar element of Sencha Touch 2.
My Code
var oNavigationbar = {
docked: 'top',
backButton : {
margin: 7,
docked: "left",
ui : 'back'
},
items: [
Ext.create("Ext.Button", {
text: "Button1"
},
Ext.create("Ext.Button", {
text: "Button2",
align: "right",
}
],
};
Question 1
How do I stick the back button to the left side of the navigation bar?
If I set align:"left" Button1 is still on its left side.
But if I dock it to the left side I have to set a margin, which I rather avoid.
Question 2
How do I set the default text of the back button to something else then "Back".
Which configuration properties do I have to set?
not sure what you mean in q1... AFAIK Navigation Bar (as a subcomponent of Ext.navigation.View) has back button already left aligned.
Q2:
Ext.define('MyNavigator', {
extends: 'Ext.navigation.View',
xtype: 'mynavigator',
config: {
defaultBackButtonText: 'Go Back',
// back button a-la iPhone
// useTitleForBackButtonText: true
....
})
see at http://docs-devel.sencha.com/touch/2-0/#!/api/Ext.navigation.View-cfg-defaultBackButtonText for more info...
Cheers, Oleg

Panel overlay in Sencha touch 2

I have been working on an application using sencha touch 2 .
I have a toolbar on top which contains a button .
When i click this button i will have a panel overlay .
In this panel,i want to have two items :
var shareButton = {
xtype : 'button',
ui: 'action',
width:'36px',
height:'36px',
handler : function(){
var panel=Ext.create('Ext.Panel',{
right: 0,
top: 20,
modal: true,
hideOnMaskTap: true,
hidden: true,
width: 260,
height:'70%' ,
styleHtmlContent: true,
scrollable: true,
items: [
{html:'Tweet</body>',},
{html:'<div ><class="fb-like" data-href="http://test.com" data-send="false" data-layout="button_count" data-width="4" data-show-faces="false"></div>'}]});
Ext.Viewport.add(panel);
panel.show();}};
But this is not working.
In fact,i want the first one to direct me to twitter to share the URL (www.google.com).
And the second one to facebook to share "test.com".
Unfortunately ,nothing is displayed in the panel .
Thank you.
Since the overlay is called after the page is loaded, the facebook and twitter buttons should rendered again
This is the code that should be added after the overlay is shown
FB.XFBML.parse();//facebook
$.ajax({ url: 'http://platform.twitter.com/widgets.js', dataType: 'script', cache:true}); //twitter
This works for me. THe only problem is that the Facebook like button has not got a size, so you cannot see it.
Ensure your floating panel is not scrollable. If it is scrollable, give it a fixed width and height.
Update
Here is an example on Sencha Fiddle: http://www.senchafiddle.com/#jgXtj
Ensure you are adding the panel into Ext.Viewport.

Twitter widget covers up another div that might appear over it . How to make twitter widget appear under?

I'm sure a lot of people use the twitter widget that twitter provides.
Here's the code they provide:
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 3,
interval: 6000,
width: 420,
height: 250,
theme: {
shell: {
background: '#ffffff',
color: '#000000'
},
tweets: {
background: '#ffffff',
color: '#000000',
links: '#666666'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
hashtags: true,
timestamp: true,
avatars: false,
behavior: 'all'
}
}).render().setUser('apumpkinpatch').start();
</script>
You can see an example here how when you click the "feedback" tab on left side of screen, the twitter widget appears over the div. Any idea what I can do to prevent this?
I think the class for the widget is .twtr-doc according to the inspector. Anyone know if there is a css attribute I should be adding to it to stop this from happening?
EDIT -: took out IE part of question to just open it up in another question so I can mark the first answer as correct.
Re: the twitter widget being on top of the feedback div, you need to use z-index property in your styles to correct this.
Try adding z-index:100 to your feedback div. I do not have IE or I would help you debug that.