-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into features/issue_57_nomad_helper_compare
- Loading branch information
Showing
7 changed files
with
207 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...pacheRoyaleTemplatedApp/view/controls/snackbarNomadHelperUrl/SnackbarNomadPopupBlocked.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package view.controls.snackbarNomadHelperUrl | ||
{ | ||
import org.apache.royale.jewel.Snackbar; | ||
|
||
public class SnackbarNomadPopupBlocked extends Snackbar | ||
{ | ||
public function SnackbarNomadPopupBlocked() | ||
{ | ||
super(); | ||
|
||
this.typeNames = "jewel snackbar layout SnackbarNomadPopupBlocked"; | ||
} | ||
|
||
public static function show(message:String = "", parent:Object = null):SnackbarNomadPopupBlocked | ||
{ | ||
var snackbar:SnackbarNomadPopupBlocked = new SnackbarNomadPopupBlocked(); | ||
snackbar.message = message; | ||
snackbar.duration = 0; | ||
snackbar.action = "Close"; | ||
|
||
snackbar.show(parent); | ||
return snackbar; | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...leTemplatedApp/view/controls/snackbarNomadHelperUrl/SnackbarNomadPopupBlockedContent.mxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<j:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009" | ||
xmlns:j="library://ns.apache.org/royale/jewel" xmlns:html="library://ns.apache.org/royale/html" xmlns:js="library://ns.apache.org/royale/basic" | ||
percentWidth="100" initComplete="onSnackbarInitComplete(event)"> | ||
<fx:Script> | ||
<![CDATA[ | ||
private function onSnackbarInitComplete(event:Event):void | ||
{ | ||
this.refreshAllowMessage(); | ||
} | ||
private function refreshAllowMessage():void | ||
{ | ||
var allowUrl:String = window['link'].baseURI; | ||
var domainPattern:RegExp = new RegExp(/^(?:https?:\/\/)?([^\/:?#]+)(?:[\/:?#]|$)/, "i"); | ||
var result:Object = domainPattern.exec(allowUrl); | ||
if (result) | ||
{ | ||
allowMessage.html = 'Allow popups for <code>' + result.pop() + '</code>'; | ||
} | ||
else | ||
{ | ||
allowMessage.text = "Always allow pop-ups from this site."; | ||
} | ||
} | ||
]]> | ||
</fx:Script> | ||
<j:Label multiline="true" | ||
text="It looks like your browser has blocked a pop-up window. To proceed, please enable pop-ups for this site in your browser settings. If you need assistance, follow these steps:"/> | ||
<html:Ol percentWidth="100"> | ||
<html:Li> | ||
<j:Label multiline="true" text="Click on the pop-up blocker icon in the address bar."/> | ||
</html:Li> | ||
<html:Li> | ||
<j:Label localId="allowMessage" multiline="true" /> | ||
</html:Li> | ||
<html:Li> | ||
<j:Label multiline="true" text="Reload the page."/> | ||
</html:Li> | ||
</html:Ol> | ||
</j:VGroup> |
84 changes: 84 additions & 0 deletions
84
...eTemplatedApp/view/controls/snackbarNomadHelperUrl/beads/SnackbarNomadPopupBlockedView.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package view.controls.snackbarNomadHelperUrl.beads | ||
{ | ||
import org.apache.royale.core.IStrand; | ||
import org.apache.royale.events.Event; | ||
import org.apache.royale.html.elements.Div; | ||
import org.apache.royale.jewel.Snackbar; | ||
import org.apache.royale.jewel.beads.models.SnackbarModel; | ||
import org.apache.royale.jewel.beads.views.SnackbarView; | ||
|
||
import view.controls.snackbarNomadHelperUrl.SnackbarNomadPopupBlockedContent; | ||
|
||
public class SnackbarNomadPopupBlockedView extends SnackbarView | ||
{ | ||
public function SnackbarNomadPopupBlockedView() | ||
{ | ||
super(); | ||
} | ||
|
||
override public function set strand(value:IStrand):void | ||
{ | ||
super.strand = value; | ||
|
||
var model:SnackbarNomadHelperUrlModel = host.model as SnackbarNomadHelperUrlModel; | ||
model.addEventListener("messageChange", messageChangeHandler); | ||
model.addEventListener("actionChange", actionChangeHandler); | ||
|
||
var content:NodeList = host.element.getElementsByClassName("snackbar-content"); | ||
host.element.removeChild(content.item(0)); | ||
|
||
var snackbarMessage:SnackbarNomadPopupBlockedContent = new SnackbarNomadPopupBlockedContent(); | ||
snackbarMessage.className = "jewel snackbar-message"; | ||
|
||
var snackbarContent:Div = new Div(); | ||
snackbarContent.className = "jewel snackbar-content"; | ||
snackbarContent.addElement(snackbarMessage); | ||
host.addElement(snackbarContent); | ||
|
||
this.actionElement = null; | ||
if (model.action) | ||
{ | ||
actionChangeHandler(null); | ||
} | ||
} | ||
|
||
/** | ||
* Update the text when message changed. | ||
*/ | ||
override protected function messageChangeHandler(event:Event):void { | ||
|
||
} | ||
|
||
/** | ||
* Show the action element or remove it, based on action text. | ||
*/ | ||
override protected function actionChangeHandler(event:Event):void { | ||
var model:SnackbarModel = host.model as SnackbarModel; | ||
|
||
if (model.action) { | ||
if (!actionElement) { | ||
actionElement = document.createElement("div"); | ||
actionElement.className = "jewel snackbar-action"; | ||
actionElement.addEventListener("click", actionClickHandler); | ||
host.element.firstChild.appendChild(actionElement); | ||
} | ||
actionElement.innerText = model.action; | ||
} else { | ||
if (actionElement) { | ||
actionElement.removeEventListener("click", actionClickHandler); | ||
host.element.firstChild.removeChild(actionElement); | ||
actionElement = null; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Trigger event and dismiss the host when action clicked. | ||
*/ | ||
override protected function actionClickHandler(event:Event):void { | ||
actionElement.removeEventListener("click", actionClickHandler); | ||
host.dispatchEvent(new Event(Snackbar.ACTION)); | ||
SnackbarModel(host.model).duration = -1; // set -1 to dismiss | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters