mirror of
https://github.com/flarum/core.git
synced 2025-08-28 18:40:46 +02:00
Compare commits
14 Commits
v0.1.0-bet
...
v0.1.0-bet
Author | SHA1 | Date | |
---|---|---|---|
|
4734dbf46d | ||
|
783a14610a | ||
|
351d2d1366 | ||
|
e7b417121a | ||
|
9e3ecd528e | ||
|
3518fb2299 | ||
|
a6eff9383b | ||
|
d806c4491d | ||
|
c9a878d49c | ||
|
30856a8e2b | ||
|
3d3be6983a | ||
|
96b85f1330 | ||
|
25932cf7c4 | ||
|
7dcb99621d |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -2,6 +2,16 @@
|
||||
All notable changes to Flarum and its bundled extensions will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [0.1.0-beta.4] - 2015-11-05
|
||||
### Added
|
||||
- Add an icon/label to the back button to indicate where it leads
|
||||
- Add "Loading..." text while the JavaScript payload is loading
|
||||
|
||||
### Fixed
|
||||
- Fix some admin actions resulting in "You do not have permission to do that"
|
||||
- Fix translation keys persisting after enabling an initial language pack
|
||||
- Fix translation `=>` references not being parsed in some cases
|
||||
|
||||
## [0.1.0-beta.3] - 2015-11-03
|
||||
### Architecture improvements
|
||||
- **Composer-driven extension architecture.** All extensions are Composer packages installable via Packagist.
|
||||
@@ -93,6 +103,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
## 0.1.0-beta - 2015-08-27
|
||||
First Version
|
||||
|
||||
[unreleased]: https://github.com/flarum/core/compare/v0.1.0-beta.2...HEAD
|
||||
[0.1.0-beta.4]: https://github.com/flarum/core/compare/v0.1.0-beta.3...v0.1.0-beta.4
|
||||
[0.1.0-beta.3]: https://github.com/flarum/core/compare/v0.1.0-beta.2...v0.1.0-beta.3
|
||||
[0.1.0-beta.2]: https://github.com/flarum/core/compare/v0.1.0-beta...v0.1.0-beta.2
|
||||
|
6
js/admin/dist/app.js
vendored
6
js/admin/dist/app.js
vendored
@@ -18996,10 +18996,13 @@ System.register('flarum/components/Navigation', ['flarum/Component', 'flarum/com
|
||||
var _app2 = app;
|
||||
var history = _app2.history;
|
||||
|
||||
var previous = history.getPrevious() || {};
|
||||
|
||||
return LinkButton.component({
|
||||
className: 'Button Button--icon Navigation-back',
|
||||
className: 'Button Navigation-back ' + (previous.title ? '' : 'Button--icon'),
|
||||
href: history.backUrl(),
|
||||
icon: 'chevron-left',
|
||||
children: previous.title,
|
||||
config: function config() {},
|
||||
onclick: function onclick(e) {
|
||||
if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return;
|
||||
@@ -20663,6 +20666,7 @@ System.register('flarum/initializers/boot', ['flarum/utils/ScrollListener', 'fla
|
||||
canGoBack: function canGoBack() {
|
||||
return true;
|
||||
},
|
||||
getPrevious: function getPrevious() {},
|
||||
backUrl: function backUrl() {
|
||||
return app.forum.attribute('baseUrl');
|
||||
},
|
||||
|
@@ -31,6 +31,7 @@ export default function boot(app) {
|
||||
app.alerts = m.mount(document.getElementById('alerts'), AlertManager.component());
|
||||
app.history = {
|
||||
canGoBack: () => true,
|
||||
getPrevious: () => {},
|
||||
backUrl: () => app.forum.attribute('baseUrl'),
|
||||
back: function() {
|
||||
window.location = this.backUrl();
|
||||
|
58
js/forum/dist/app.js
vendored
58
js/forum/dist/app.js
vendored
@@ -21026,6 +21026,7 @@ System.register('flarum/components/DiscussionPage', ['flarum/components/Page', '
|
||||
value: function show(discussion) {
|
||||
this.discussion = discussion;
|
||||
|
||||
app.history.push('discussion', discussion.title());
|
||||
app.setTitle(discussion.title());
|
||||
app.setTitleCount(0);
|
||||
|
||||
@@ -21145,7 +21146,7 @@ System.register('flarum/components/DiscussionPage', ['flarum/components/Page', '
|
||||
m.route(url, true);
|
||||
window.history.replaceState(null, document.title, url);
|
||||
|
||||
app.history.push('discussion');
|
||||
app.history.push('discussion', discussion.title());
|
||||
|
||||
// If the user hasn't read past here before, then we'll update their read
|
||||
// state and redraw.
|
||||
@@ -22406,7 +22407,7 @@ System.register('flarum/components/HeaderSecondary', ['flarum/Component', 'flaru
|
||||
}
|
||||
};
|
||||
});;
|
||||
System.register('flarum/components/IndexPage', ['flarum/extend', 'flarum/components/Page', 'flarum/utils/ItemList', 'flarum/helpers/listItems', 'flarum/components/DiscussionList', 'flarum/components/WelcomeHero', 'flarum/components/DiscussionComposer', 'flarum/components/LogInModal', 'flarum/components/DiscussionPage', 'flarum/components/Select', 'flarum/components/Button', 'flarum/components/LinkButton', 'flarum/components/SelectDropdown'], function (_export) {
|
||||
System.register('flarum/components/IndexPage', ['flarum/extend', 'flarum/components/Page', 'flarum/utils/ItemList', 'flarum/helpers/listItems', 'flarum/helpers/icon', 'flarum/components/DiscussionList', 'flarum/components/WelcomeHero', 'flarum/components/DiscussionComposer', 'flarum/components/LogInModal', 'flarum/components/DiscussionPage', 'flarum/components/Select', 'flarum/components/Button', 'flarum/components/LinkButton', 'flarum/components/SelectDropdown'], function (_export) {
|
||||
|
||||
/**
|
||||
* The `IndexPage` component displays the index page, including the welcome
|
||||
@@ -22414,7 +22415,7 @@ System.register('flarum/components/IndexPage', ['flarum/extend', 'flarum/compone
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var extend, Page, ItemList, listItems, DiscussionList, WelcomeHero, DiscussionComposer, LogInModal, DiscussionPage, Select, Button, LinkButton, SelectDropdown, IndexPage;
|
||||
var extend, Page, ItemList, listItems, icon, DiscussionList, WelcomeHero, DiscussionComposer, LogInModal, DiscussionPage, Select, Button, LinkButton, SelectDropdown, IndexPage;
|
||||
return {
|
||||
setters: [function (_flarumExtend) {
|
||||
extend = _flarumExtend.extend;
|
||||
@@ -22424,6 +22425,8 @@ System.register('flarum/components/IndexPage', ['flarum/extend', 'flarum/compone
|
||||
ItemList = _flarumUtilsItemList['default'];
|
||||
}, function (_flarumHelpersListItems) {
|
||||
listItems = _flarumHelpersListItems['default'];
|
||||
}, function (_flarumHelpersIcon) {
|
||||
icon = _flarumHelpersIcon['default'];
|
||||
}, function (_flarumComponentsDiscussionList) {
|
||||
DiscussionList = _flarumComponentsDiscussionList['default'];
|
||||
}, function (_flarumComponentsWelcomeHero) {
|
||||
@@ -22491,7 +22494,7 @@ System.register('flarum/components/IndexPage', ['flarum/extend', 'flarum/compone
|
||||
app.cache.discussionList = new DiscussionList({ params: params });
|
||||
}
|
||||
|
||||
app.history.push('index');
|
||||
app.history.push('index', icon('bars'));
|
||||
|
||||
this.bodyClass = 'App--index';
|
||||
}
|
||||
@@ -23701,10 +23704,13 @@ System.register('flarum/components/Navigation', ['flarum/Component', 'flarum/com
|
||||
var _app2 = app;
|
||||
var history = _app2.history;
|
||||
|
||||
var previous = history.getPrevious() || {};
|
||||
|
||||
return LinkButton.component({
|
||||
className: 'Button Button--icon Navigation-back',
|
||||
className: 'Button Navigation-back ' + (previous.title ? '' : 'Button--icon'),
|
||||
href: history.backUrl(),
|
||||
icon: 'chevron-left',
|
||||
children: previous.title,
|
||||
config: function config() {},
|
||||
onclick: function onclick(e) {
|
||||
if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return;
|
||||
@@ -28854,6 +28860,7 @@ System.register('flarum/components/UserPage', ['flarum/components/Page', 'flarum
|
||||
value: function show(user) {
|
||||
this.user = user;
|
||||
|
||||
app.history.push('user', user.username());
|
||||
app.setTitle(user.username());
|
||||
|
||||
m.redraw();
|
||||
@@ -29651,7 +29658,7 @@ System.register("flarum/helpers/username", [], function (_export) {
|
||||
execute: function () {}
|
||||
};
|
||||
});;
|
||||
System.register('flarum/initializers/boot', ['flarum/utils/ScrollListener', 'flarum/utils/Pane', 'flarum/utils/Drawer', 'flarum/utils/mapRoutes', 'flarum/components/Navigation', 'flarum/components/HeaderPrimary', 'flarum/components/HeaderSecondary', 'flarum/components/Composer', 'flarum/components/ModalManager', 'flarum/components/AlertManager'], function (_export) {
|
||||
System.register('flarum/initializers/boot', ['flarum/utils/ScrollListener', 'flarum/utils/Pane', 'flarum/utils/Drawer', 'flarum/utils/mapRoutes', 'flarum/helpers/icon', 'flarum/components/Navigation', 'flarum/components/HeaderPrimary', 'flarum/components/HeaderSecondary', 'flarum/components/Composer', 'flarum/components/ModalManager', 'flarum/components/AlertManager'], function (_export) {
|
||||
/*global FastClick*/
|
||||
|
||||
/**
|
||||
@@ -29662,7 +29669,7 @@ System.register('flarum/initializers/boot', ['flarum/utils/ScrollListener', 'fla
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var ScrollListener, Pane, Drawer, mapRoutes, Navigation, HeaderPrimary, HeaderSecondary, Composer, ModalManager, AlertManager;
|
||||
var ScrollListener, Pane, Drawer, mapRoutes, icon, Navigation, HeaderPrimary, HeaderSecondary, Composer, ModalManager, AlertManager;
|
||||
|
||||
_export('default', boot);
|
||||
|
||||
@@ -29679,7 +29686,7 @@ System.register('flarum/initializers/boot', ['flarum/utils/ScrollListener', 'fla
|
||||
}
|
||||
|
||||
app.routes[defaultAction].path = '/';
|
||||
app.history.push(defaultAction, '/');
|
||||
app.history.push(defaultAction, icon('bars'), '/');
|
||||
|
||||
m.startComputation();
|
||||
|
||||
@@ -29737,6 +29744,8 @@ System.register('flarum/initializers/boot', ['flarum/utils/ScrollListener', 'fla
|
||||
Drawer = _flarumUtilsDrawer['default'];
|
||||
}, function (_flarumUtilsMapRoutes) {
|
||||
mapRoutes = _flarumUtilsMapRoutes['default'];
|
||||
}, function (_flarumHelpersIcon) {
|
||||
icon = _flarumHelpersIcon['default'];
|
||||
}, function (_flarumComponentsNavigation) {
|
||||
Navigation = _flarumComponentsNavigation['default'];
|
||||
}, function (_flarumComponentsHeaderPrimary) {
|
||||
@@ -32171,26 +32180,39 @@ System.register('flarum/utils/History', [], function (_export) {
|
||||
* Get the item on the top of the stack.
|
||||
*
|
||||
* @return {Object}
|
||||
* @protected
|
||||
* @public
|
||||
*/
|
||||
babelHelpers.createClass(History, [{
|
||||
key: 'getTop',
|
||||
value: function getTop() {
|
||||
key: 'getCurrent',
|
||||
value: function getCurrent() {
|
||||
return this.stack[this.stack.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the previous item on the stack.
|
||||
*
|
||||
* @return {Object}
|
||||
* @public
|
||||
*/
|
||||
}, {
|
||||
key: 'getPrevious',
|
||||
value: function getPrevious() {
|
||||
return this.stack[this.stack.length - 2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an item to the top of the stack.
|
||||
*
|
||||
* @param {String} name The name of the route.
|
||||
* @param {String} title The title of the route.
|
||||
* @param {String} [url] The URL of the route. The current URL will be used if
|
||||
* not provided.
|
||||
* @public
|
||||
*/
|
||||
}, {
|
||||
key: 'push',
|
||||
value: function push(name) {
|
||||
var url = arguments.length <= 1 || arguments[1] === undefined ? m.route() : arguments[1];
|
||||
value: function push(name, title) {
|
||||
var url = arguments.length <= 2 || arguments[2] === undefined ? m.route() : arguments[2];
|
||||
|
||||
// If we're pushing an item with the same name as second-to-top item in the
|
||||
// stack, we will assume that the user has clicked the 'back' button in
|
||||
@@ -32204,11 +32226,11 @@ System.register('flarum/utils/History', [], function (_export) {
|
||||
|
||||
// If we're pushing an item with the same name as the top item in the stack,
|
||||
// then we'll overwrite it with the new URL.
|
||||
var top = this.getTop();
|
||||
var top = this.getCurrent();
|
||||
if (top && top.name === name) {
|
||||
top.url = url;
|
||||
babelHelpers._extends(top, { url: url, title: title });
|
||||
} else {
|
||||
this.stack.push({ name: name, url: url });
|
||||
this.stack.push({ name: name, url: url, title: title });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32234,7 +32256,7 @@ System.register('flarum/utils/History', [], function (_export) {
|
||||
value: function back() {
|
||||
this.stack.pop();
|
||||
|
||||
m.route(this.getTop().url);
|
||||
m.route(this.getCurrent().url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32258,7 +32280,7 @@ System.register('flarum/utils/History', [], function (_export) {
|
||||
}, {
|
||||
key: 'home',
|
||||
value: function home() {
|
||||
this.stack.splice(1);
|
||||
this.stack.splice(0);
|
||||
|
||||
m.route('/');
|
||||
}
|
||||
|
@@ -159,6 +159,7 @@ export default class DiscussionPage extends Page {
|
||||
show(discussion) {
|
||||
this.discussion = discussion;
|
||||
|
||||
app.history.push('discussion', discussion.title());
|
||||
app.setTitle(discussion.title());
|
||||
app.setTitleCount(0);
|
||||
|
||||
@@ -273,7 +274,7 @@ export default class DiscussionPage extends Page {
|
||||
m.route(url, true);
|
||||
window.history.replaceState(null, document.title, url);
|
||||
|
||||
app.history.push('discussion');
|
||||
app.history.push('discussion', discussion.title());
|
||||
|
||||
// If the user hasn't read past here before, then we'll update their read
|
||||
// state and redraw.
|
||||
|
@@ -2,6 +2,7 @@ import { extend } from 'flarum/extend';
|
||||
import Page from 'flarum/components/Page';
|
||||
import ItemList from 'flarum/utils/ItemList';
|
||||
import listItems from 'flarum/helpers/listItems';
|
||||
import icon from 'flarum/helpers/icon';
|
||||
import DiscussionList from 'flarum/components/DiscussionList';
|
||||
import WelcomeHero from 'flarum/components/WelcomeHero';
|
||||
import DiscussionComposer from 'flarum/components/DiscussionComposer';
|
||||
@@ -54,7 +55,7 @@ export default class IndexPage extends Page {
|
||||
app.cache.discussionList = new DiscussionList({params});
|
||||
}
|
||||
|
||||
app.history.push('index');
|
||||
app.history.push('index', icon('bars'));
|
||||
|
||||
this.bodyClass = 'App--index';
|
||||
}
|
||||
|
@@ -74,6 +74,7 @@ export default class UserPage extends Page {
|
||||
show(user) {
|
||||
this.user = user;
|
||||
|
||||
app.history.push('user', user.username());
|
||||
app.setTitle(user.username());
|
||||
|
||||
m.redraw();
|
||||
|
@@ -4,7 +4,7 @@ import ScrollListener from 'flarum/utils/ScrollListener';
|
||||
import Pane from 'flarum/utils/Pane';
|
||||
import Drawer from 'flarum/utils/Drawer';
|
||||
import mapRoutes from 'flarum/utils/mapRoutes';
|
||||
|
||||
import icon from 'flarum/helpers/icon';
|
||||
import Navigation from 'flarum/components/Navigation';
|
||||
import HeaderPrimary from 'flarum/components/HeaderPrimary';
|
||||
import HeaderSecondary from 'flarum/components/HeaderSecondary';
|
||||
@@ -31,7 +31,7 @@ export default function boot(app) {
|
||||
}
|
||||
|
||||
app.routes[defaultAction].path = '/';
|
||||
app.history.push(defaultAction, '/');
|
||||
app.history.push(defaultAction, icon('bars'), '/');
|
||||
|
||||
m.startComputation();
|
||||
|
||||
|
@@ -24,21 +24,32 @@ export default class History {
|
||||
* Get the item on the top of the stack.
|
||||
*
|
||||
* @return {Object}
|
||||
* @protected
|
||||
* @public
|
||||
*/
|
||||
getTop() {
|
||||
getCurrent() {
|
||||
return this.stack[this.stack.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the previous item on the stack.
|
||||
*
|
||||
* @return {Object}
|
||||
* @public
|
||||
*/
|
||||
getPrevious() {
|
||||
return this.stack[this.stack.length - 2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an item to the top of the stack.
|
||||
*
|
||||
* @param {String} name The name of the route.
|
||||
* @param {String} title The title of the route.
|
||||
* @param {String} [url] The URL of the route. The current URL will be used if
|
||||
* not provided.
|
||||
* @public
|
||||
*/
|
||||
push(name, url = m.route()) {
|
||||
push(name, title, url = m.route()) {
|
||||
// If we're pushing an item with the same name as second-to-top item in the
|
||||
// stack, we will assume that the user has clicked the 'back' button in
|
||||
// their browser. In this case, we don't want to push a new item, so we will
|
||||
@@ -51,11 +62,11 @@ export default class History {
|
||||
|
||||
// If we're pushing an item with the same name as the top item in the stack,
|
||||
// then we'll overwrite it with the new URL.
|
||||
const top = this.getTop();
|
||||
const top = this.getCurrent();
|
||||
if (top && top.name === name) {
|
||||
top.url = url;
|
||||
Object.assign(top, {url, title});
|
||||
} else {
|
||||
this.stack.push({name, url});
|
||||
this.stack.push({name, url, title});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +88,7 @@ export default class History {
|
||||
back() {
|
||||
this.stack.pop();
|
||||
|
||||
m.route(this.getTop().url);
|
||||
m.route(this.getCurrent().url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +108,7 @@ export default class History {
|
||||
* @public
|
||||
*/
|
||||
home() {
|
||||
this.stack.splice(1);
|
||||
this.stack.splice(0);
|
||||
|
||||
m.route('/');
|
||||
}
|
||||
|
@@ -47,11 +47,13 @@ export default class Navigation extends Component {
|
||||
*/
|
||||
getBackButton() {
|
||||
const {history} = app;
|
||||
const previous = history.getPrevious() || {};
|
||||
|
||||
return LinkButton.component({
|
||||
className: 'Button Button--icon Navigation-back',
|
||||
className: 'Button Navigation-back ' + (previous.title ? '' : 'Button--icon'),
|
||||
href: history.backUrl(),
|
||||
icon: 'chevron-left',
|
||||
children: previous.title,
|
||||
config: () => {},
|
||||
onclick: e => {
|
||||
if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return;
|
||||
|
@@ -70,7 +70,6 @@
|
||||
@media @tablet-up {
|
||||
.DiscussionPage-list {
|
||||
left: -@pane-width - 6px;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
z-index: @zindex-pane;
|
||||
overflow: auto;
|
||||
|
@@ -109,29 +109,27 @@
|
||||
}
|
||||
|
||||
|
||||
@media @tablet-up {
|
||||
.Dropdown--split {
|
||||
.Dropdown-toggle .Button-icon {
|
||||
.Dropdown--split {
|
||||
.Dropdown-toggle .Button-icon {
|
||||
display: none;
|
||||
}
|
||||
.Dropdown-toggle .Button-caret {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.itemCount1 {
|
||||
.Button {
|
||||
border-radius: @border-radius !important;
|
||||
}
|
||||
.Dropdown-toggle {
|
||||
display: none;
|
||||
}
|
||||
.Dropdown-toggle .Button-caret {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.itemCount1 {
|
||||
.Button {
|
||||
border-radius: @border-radius !important;
|
||||
}
|
||||
.Dropdown-toggle {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.Dropdown-menu li:first-child {
|
||||
&, + li.Dropdown-separator {
|
||||
display: none;
|
||||
}
|
||||
.Dropdown-menu li:first-child {
|
||||
&, + li.Dropdown-separator {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,10 @@
|
||||
.Form--centered {
|
||||
text-align: center;
|
||||
|
||||
.FormControl, .Button {
|
||||
.FormControl[type=text],
|
||||
.FormControl[type=email],
|
||||
.FormControl[type=password],
|
||||
.Button {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
height: 50px;
|
||||
@@ -20,6 +23,9 @@
|
||||
.Form-group {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.checkbox {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.Form-group > label {
|
||||
|
@@ -2,8 +2,17 @@
|
||||
z-index: 3 !important; // z-index of an active .btn-group .btn is 2
|
||||
border-radius: @border-radius !important;
|
||||
.transition(border-radius 0.2s);
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding-left: 8px;
|
||||
|
||||
.icon {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.Navigation-pin {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
margin-left: -5px !important;
|
||||
border-radius: 0 @border-radius @border-radius 0;
|
||||
@@ -15,6 +24,9 @@
|
||||
}
|
||||
|
||||
@media @desktop-hd {
|
||||
.Navigation-pin {
|
||||
display: block;
|
||||
}
|
||||
.hasPane.panePinned, .hasPane.paneShowing {
|
||||
.Navigation-back {
|
||||
border-radius: @border-radius 0 0 @border-radius !important;
|
||||
|
@@ -137,3 +137,10 @@ blockquote ol:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#flarum-loading {
|
||||
text-align: center;
|
||||
padding: 50px 0;
|
||||
font-size: 18px;
|
||||
color: @muted-more-color;
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ class CoreServiceProvider extends AbstractServiceProvider
|
||||
});
|
||||
|
||||
$this->app->make('flarum.gate')->before(function (User $actor, $ability, $model = null) {
|
||||
if (! $model && $actor->hasPermission($ability)) {
|
||||
if ($actor->isAdmin() || (! $model && $actor->hasPermission($ability))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,8 @@ class LocaleServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
$locales = $this->app->make('flarum.localeManager');
|
||||
|
||||
$locales->addLocale($this->getDefaultLocale(), 'Default');
|
||||
|
||||
$events->fire(new ConfigureLocales($locales));
|
||||
}
|
||||
|
||||
@@ -37,9 +39,7 @@ class LocaleServiceProvider extends AbstractServiceProvider
|
||||
$this->app->alias('Flarum\Locale\LocaleManager', 'flarum.localeManager');
|
||||
|
||||
$this->app->singleton('translator', function () {
|
||||
$defaultLocale = $this->app->isInstalled() && $this->app->isUpToDate()
|
||||
? $this->app->make('flarum.settings')->get('default_locale', 'en')
|
||||
: 'en';
|
||||
$defaultLocale = $this->getDefaultLocale();
|
||||
|
||||
$translator = new Translator($defaultLocale, new MessageSelector());
|
||||
$translator->setFallbackLocales([$defaultLocale, 'en']);
|
||||
@@ -50,4 +50,11 @@ class LocaleServiceProvider extends AbstractServiceProvider
|
||||
$this->app->alias('translator', 'Symfony\Component\Translation\Translator');
|
||||
$this->app->alias('translator', 'Symfony\Component\Translation\TranslatorInterface');
|
||||
}
|
||||
|
||||
private function getDefaultLocale()
|
||||
{
|
||||
return $this->app->isInstalled() && $this->app->isUpToDate()
|
||||
? $this->app->make('flarum.settings')->get('default_locale', 'en')
|
||||
: 'en';
|
||||
}
|
||||
}
|
||||
|
@@ -34,6 +34,11 @@ class Translator extends BaseTranslator
|
||||
|
||||
if ($parse) {
|
||||
$this->parseCatalogue($catalogue);
|
||||
|
||||
$fallbackCatalogue = $catalogue;
|
||||
while ($fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue()) {
|
||||
$this->parseCatalogue($fallbackCatalogue);
|
||||
}
|
||||
}
|
||||
|
||||
return $catalogue;
|
||||
@@ -54,17 +59,17 @@ class Translator extends BaseTranslator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MessageCatalogueInterface $messages
|
||||
* @param MessageCatalogueInterface $catalogue
|
||||
* @param string $id
|
||||
* @param string $domain
|
||||
* @return string
|
||||
*/
|
||||
private function getTranslation(MessageCatalogueInterface $messages, $id, $domain)
|
||||
private function getTranslation(MessageCatalogueInterface $catalogue, $id, $domain)
|
||||
{
|
||||
$translation = $messages->get($id, $domain);
|
||||
$translation = $catalogue->get($id, $domain);
|
||||
|
||||
if (preg_match(self::REFERENCE_REGEX, $translation, $matches)) {
|
||||
return $this->getTranslation($messages, $matches[1], $domain);
|
||||
return $this->getTranslation($catalogue, $matches[1], $domain);
|
||||
}
|
||||
|
||||
return $translation;
|
||||
|
@@ -1,2 +1,28 @@
|
||||
{{name}}:
|
||||
# hello_world: "Hello, world!"
|
||||
|
||||
##
|
||||
# UNIQUE KEYS - The following keys are used in only one location each.
|
||||
##
|
||||
|
||||
# Strings in this namespace are used by the admin interface.
|
||||
admin:
|
||||
|
||||
# These keys are provided as examples; please delete them before using.
|
||||
sample_location:
|
||||
sample_text: "Hello, world!"
|
||||
|
||||
|
||||
# Strings in this namespace are used by the forum user interface.
|
||||
forum:
|
||||
|
||||
|
||||
# Strings in this namespace are used by the forum and admin interfaces.
|
||||
lib:
|
||||
|
||||
|
||||
##
|
||||
# REUSED STRINGS - The following keys are referenced by two or more unique keys.
|
||||
##
|
||||
|
||||
# Strings in this namespace are referenced by two or more unique keys.
|
||||
ref:
|
||||
|
@@ -25,6 +25,8 @@
|
||||
</div>
|
||||
|
||||
<div id="content" class="sideNavOffset"></div>
|
||||
|
||||
{!! $content !!}
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
@@ -22,30 +22,35 @@
|
||||
<div id="alerts"></div>
|
||||
|
||||
@if (! $noJs)
|
||||
@foreach ($scripts as $file)
|
||||
<script src="{{ $forum->attributes->baseUrl . str_replace(public_path(), '', $file) }}"></script>
|
||||
@endforeach
|
||||
<script>
|
||||
document.getElementById('flarum-loading').style.display = 'block';
|
||||
</script>
|
||||
|
||||
<script>
|
||||
@if (! $forum->attributes->debug)
|
||||
try {
|
||||
@endif
|
||||
var app = System.get('flarum/app').default;
|
||||
@foreach ($scripts as $file)
|
||||
<script src="{{ $forum->attributes->baseUrl . str_replace(public_path(), '', $file) }}"></script>
|
||||
@endforeach
|
||||
|
||||
babelHelpers._extends(app, {!! json_encode($app) !!});
|
||||
<script>
|
||||
document.getElementById('flarum-loading').style.display = 'none';
|
||||
@if (! $forum->attributes->debug)
|
||||
try {
|
||||
@endif
|
||||
var app = System.get('flarum/app').default;
|
||||
|
||||
@foreach ($bootstrappers as $bootstrapper)
|
||||
System.get('{{ $bootstrapper }}');
|
||||
@endforeach
|
||||
babelHelpers._extends(app, {!! json_encode($app) !!});
|
||||
|
||||
app.boot();
|
||||
@if (! $forum->attributes->debug)
|
||||
} catch (e) {
|
||||
var nojs = window.location.search ? '&nojs=1' : '?nojs=1';
|
||||
window.location = window.location + nojs;
|
||||
}
|
||||
@endif
|
||||
</script>
|
||||
@foreach ($bootstrappers as $bootstrapper)
|
||||
System.get('{{ $bootstrapper }}');
|
||||
@endforeach
|
||||
|
||||
app.boot();
|
||||
@if (! $forum->attributes->debug)
|
||||
} catch (e) {
|
||||
var nojs = window.location.search ? '&nojs=1' : '?nojs=1';
|
||||
window.location = window.location + nojs;
|
||||
}
|
||||
@endif
|
||||
</script>
|
||||
@endif
|
||||
|
||||
{!! $foot !!}
|
||||
|
@@ -1,12 +1,16 @@
|
||||
<div id="flarum-loading" style="display: none">
|
||||
{{ $translator->trans('core.basic.loading_text') }}
|
||||
</div>
|
||||
|
||||
@if (! $noJs) <noscript> @endif
|
||||
<div class="Alert">
|
||||
<div class="container">
|
||||
@if ($noJs)
|
||||
{{ $translator->trans('core.basic.load_error_message') }}
|
||||
@else
|
||||
{{ $translator->trans('core.basic.javascript_disabled_message') }}
|
||||
@endif
|
||||
</div>
|
||||
<div class="container">
|
||||
@if ($noJs)
|
||||
{{ $translator->trans('core.basic.load_error_message') }}
|
||||
@else
|
||||
{{ $translator->trans('core.basic.javascript_disabled_message') }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!! $content !!}
|
||||
|
Reference in New Issue
Block a user