Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item13069: fixed templating for pattern
- rewrite of anchor urls not required (disabled for now)
  • Loading branch information
MichaelDaum committed Nov 4, 2014
1 parent 7e97391 commit cf5d7d0
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 58 deletions.
9 changes: 7 additions & 2 deletions pub/System/AngularSkin/directives.uncompressed.js
Expand Up @@ -27,12 +27,13 @@ app.directive('foswikiContents', [

var viewScriptUrl = foswiki.getScriptUrl("origview"),
angularScriptUrl = foswiki.getScriptUrl("view"),
urlFilter = new RegExp("^"+viewScriptUrl+"/[A-Z]"),
urlFilter = new RegExp("^"+viewScriptUrl+"(?=/[A-Z])"),
anchorFilter = new RegExp("^"+angularScriptUrl+"/[A-Z].*#");

// rewrite local links
function _rewriteUrls(content) {

// view urls
content.find("a").filter(function() { return urlFilter.test(this.href); }).each(function() {

var $this = angular.element(this),
Expand All @@ -59,19 +60,23 @@ app.directive('foswikiContents', [
}
});

// view forms
if (0) {
// anchor urls
content.find("a").filter(function() { return anchorFilter.test(this.href); }).each(function() {
var $this = angular.element(this),
hash = this.href.replace(/^.*#/, "");

$this.on("click", function(ev) {
//$log.debug("clicked hash link", hash);
$log.debug("clicked hash link", hash);
$timeout(function() {
$location.hash(hash);
$anchorScroll();
});
ev.preventDefault();
});
});
}


}
Expand Down
9 changes: 7 additions & 2 deletions pub/System/AngularSkin/pkg.uncompressed.js
Expand Up @@ -387,12 +387,13 @@ app.directive('foswikiContents', [

var viewScriptUrl = foswiki.getScriptUrl("origview"),
angularScriptUrl = foswiki.getScriptUrl("view"),
urlFilter = new RegExp("^"+viewScriptUrl+"/[A-Z]"),
urlFilter = new RegExp("^"+viewScriptUrl+"(?=/[A-Z])"),
anchorFilter = new RegExp("^"+angularScriptUrl+"/[A-Z].*#");

// rewrite local links
function _rewriteUrls(content) {

// view urls
content.find("a").filter(function() { return urlFilter.test(this.href); }).each(function() {

var $this = angular.element(this),
Expand All @@ -419,19 +420,23 @@ app.directive('foswikiContents', [
}
});

// view forms
if (0) {
// anchor urls
content.find("a").filter(function() { return anchorFilter.test(this.href); }).each(function() {
var $this = angular.element(this),
hash = this.href.replace(/^.*#/, "");

$this.on("click", function(ev) {
//$log.debug("clicked hash link", hash);
$log.debug("clicked hash link", hash);
$timeout(function() {
$location.hash(hash);
$anchorScroll();
});
ev.preventDefault();
});
});
}


}
Expand Down
36 changes: 36 additions & 0 deletions templates/angular.pattern.tmpl
@@ -0,0 +1,36 @@
%TMPL:INCLUDE{"view"}%

%TMPL:DEF{"sidebar"}%<div id="patternSideBar"><div id="patternClearHeaderLeft"></div>
<div id="patternSideBarContents" class="foswikiContents" name="websidebar" reload="web">
</div></div>%TMPL:END%

%TMPL:DEF{"main"}%<div class="foswikiPage">
<div id="patternScreen">
<div id="patternPageShadow">%TMPL:P{"metanavigation"}%
<div id="patternPage">%TMPL:P{"startsidebarwrapper"}%
<div id="patternOuter">
<div id="patternFloatWrap">
<div id="patternMain">%TMPL:P{"topbarspacer"}%%TMPL:P{"horizontalnavigation"}%
<div id="patternMainContents" class="foswikiContents" name="patterntopiccontents"></div>
</div>%TMPL:P{"sidebar"}%
</div>
<div class="clear">&nbsp;</div>
</div>%TMPL:P{"endsidebarwrapper"}%%TMPL:P{"topbar"}%%TMPL:P{"bottombar"}%
</div>
</div>
</div>
</div>%TMPL:P{"javascript::angular"}%%TMPL:P{"css::angular"}%%TMPL:END%

%TMPL:DEF{"head:meta"}%<meta http-equiv="Content-Type" content="text/html; charset=%CHARSET%" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.5, user-scalable=yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="icon" href="%FAVICON%" type="image/x-icon" />
<link rel="shortcut icon" href="%FAVICON%" type="image/x-icon" />
<link rel="alternate" href="%SCRIPTURL{edit}%/%BASEWEB%/%BASETOPIC%?t=%GMTIME{"$epoch"}%" type="application/x-wiki" title="edit %BASETOPIC%" />
<meta name="TEXT_NUM_TOPICS" content="%MAKETEXT{"Number of topics:"}%" />
<meta name="TEXT_MODIFY_SEARCH" content="%MAKETEXT{"Modify search"}%" />
<meta name="robots" content="noindex" />%HTTP_EQUIV_ON_VIEW%
<base href="%SCRIPTURL{"angular"}%/" /><!--[if IE]></base><![endif]-->%TMPL:END%
1 change: 1 addition & 0 deletions templates/angular.tmpl
@@ -0,0 +1 @@
%TMPL:INCLUDE{"view"}%
1 change: 0 additions & 1 deletion templates/foswiki.angular.tmpl
Expand Up @@ -41,4 +41,3 @@ jQuery.extend(foswiki.preferences, {
id="ANGULARPLUGIN::CSS"
text="<link rel='stylesheet' type='text/css' href='%PUBURLPATH%/%SYSTEMWEB%/AngularSkin/pkg.css' media='all' >"
}%%TMPL:END%

27 changes: 0 additions & 27 deletions templates/view.angular.nat.tmpl

This file was deleted.

26 changes: 0 additions & 26 deletions templates/view.angular.pattern.tmpl

This file was deleted.

0 comments on commit cf5d7d0

Please sign in to comment.