Skip to content

add routing support for 'ostrio:flow-router-extra' on ui interface #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/ui/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ function routePathFromName(name) {
return ironRouter.path(name);
}

// RouterLayer supports the following implementations, but does not provide any abstraction on the base path.
// This will ensure hrefs are formatted with respect to the base path for a given implementation
function basePath() {
if (_.has(Package, 'kadira:flow-router')) {
// TODO: ...
} else if (_.has(Package, 'iron:router')) {
// TODO: ...
} else if (_.has(Package, 'ostrio:flow-router-extra')) {
return RouterLayer.flowRouter._page.base();
}
}

/*
* After user presses ctrl up-down, if the newly highlighted row
* is not above or below the viewable area, scroll appropriately
Expand Down Expand Up @@ -216,6 +228,9 @@ Template.mfTrans.helpers({
strings: function() { return mfPkg.mfStrings.find(); },
stats: function() { return mfPkg.mfMeta.findOne({_id: '__stats'}); },
native: mfPkg.native,
basePath: function() {
return basePath();
}
});

Template.mfTransLang.helpers({
Expand All @@ -242,6 +257,9 @@ Template.mfTransLang.helpers({
}
var strings = Template.instance().pairs.find(query).fetch();
return sortStrings(strings);
},
basePath: function() {
return basePath();
}
});

Expand Down
4 changes: 2 additions & 2 deletions packages/ui/lib/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h2>{{mf 'mf_site_translations' 'Site Translations'}}</h2>
</tr>
{{#each stats.langs}}
<tr>
<td><a href="/translate/{{lang}}">{{lang}}</a></td>
<td><a href="{{basePath}}/translate/{{lang}}">{{lang}}</a></td>
<td>{{trans}}</td>
<td>{{transPercent}}</td>
<td>{{fuzzy}}</td>
Expand Down Expand Up @@ -158,7 +158,7 @@ <h2>{{mf 'mf_site_translations' 'Site Translations'}}</h2>
{{/if}}
<br /><br />
<p>
<a href="/translate">Back to Translation Summary</a>
<a href="{{basePath}}/translate">Back to Translation Summary</a>
</p>

</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: "msgfmt:ui",
version: "2.2.0",
version: "2.2.1",
summary: "web-based translation UI, optional crowd-sourcing",
git: "https://github.com/gadicc/meteor-messageformat.git",
documentation: 'README.md'
Expand Down