mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 17:12:13 +08:00
commit
17da649d0a
|
@ -174,8 +174,12 @@ export default class DiscussionListItem extends Component {
|
|||
const discussion = this.props.discussion;
|
||||
|
||||
if (discussion.isUnread()) {
|
||||
discussion.save({readNumber: discussion.lastPostNumber()});
|
||||
m.redraw();
|
||||
const confirmation = confirm(app.translator.trans('core.forum.discussion_list.mark_all_as_read_confirmation'));
|
||||
|
||||
if (confirmation) {
|
||||
discussion.save({readNumber: discussion.lastPostNumber()});
|
||||
m.redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -358,6 +358,10 @@ export default class IndexPage extends Page {
|
|||
* @return void
|
||||
*/
|
||||
markAllAsRead() {
|
||||
app.session.user.save({readTime: new Date()});
|
||||
const confirmation = confirm(app.translator.trans('core.forum.index.mark_all_as_read_confirmation'));
|
||||
|
||||
if (confirmation) {
|
||||
app.session.user.save({readTime: new Date()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,9 @@ class PostStream extends Component {
|
|||
return this.goToLast().then(() => {
|
||||
$('html,body').stop(true).animate({
|
||||
scrollTop: $(document).height() - $(window).height()
|
||||
}, 'fast');
|
||||
}, 'fast', () => {
|
||||
this.flashItem(this.$('.PostStream-item:last-child'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Object.assign(User.prototype, {
|
|||
|
||||
avatarUrl: Model.attribute('avatarUrl'),
|
||||
bio: Model.attribute('bio'),
|
||||
bioHtml: computed('bio', bio => bio ? '<p>' + $('<div/>').text(bio).html().replace(/\n/g, '<br>').autoLink() + '</p>' : ''),
|
||||
bioHtml: computed('bio', bio => bio ? '<p>' + $('<div/>').text(bio).html().replace(/\n/g, '<br>').autoLink({rel: 'nofollow'}) + '</p>' : ''),
|
||||
preferences: Model.attribute('preferences'),
|
||||
groups: Model.hasMany('groups'),
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
@import url(//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700,600);
|
||||
|
||||
@import "font-awesome.less";
|
||||
@fa-font-path: "../../assets/fonts";
|
||||
|
||||
|
|
|
@ -110,13 +110,6 @@ class ApiServiceProvider extends AbstractServiceProvider
|
|||
$toController('Flarum\Api\Controller\ShowForumController')
|
||||
);
|
||||
|
||||
// Save forum information
|
||||
$routes->patch(
|
||||
'/forum',
|
||||
'forum.update',
|
||||
$toController('Flarum\Api\Controller\UpdateForumController')
|
||||
);
|
||||
|
||||
// Retrieve authentication token
|
||||
$routes->post(
|
||||
'/token',
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
|
||||
namespace Flarum\Event;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Flarum\Locale\LocaleManager;
|
||||
use RuntimeException;
|
||||
|
||||
class ConfigureLocales
|
||||
{
|
||||
|
@ -26,4 +28,45 @@ class ConfigureLocales
|
|||
{
|
||||
$this->locales = $locales;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load language pack resources from the given directory.
|
||||
*
|
||||
* @param $directory
|
||||
*/
|
||||
public function loadLanguagePackFrom($directory)
|
||||
{
|
||||
$name = $title = basename($directory);
|
||||
|
||||
if (file_exists($manifest = $directory.'/composer.json')) {
|
||||
$json = json_decode(file_get_contents($manifest), true);
|
||||
|
||||
if (empty($json)) {
|
||||
throw new RuntimeException("Error parsing composer.json in $name: ".json_last_error_msg());
|
||||
}
|
||||
|
||||
$locale = array_get($json, 'extra.flarum-locale.code');
|
||||
$title = array_get($json, 'extra.flarum-locale.title', $title);
|
||||
}
|
||||
|
||||
if (! isset($locale)) {
|
||||
throw new RuntimeException("Language pack $name must define \"extra.flarum-locale.code\" in composer.json.");
|
||||
}
|
||||
|
||||
$this->locales->addLocale($locale, $title);
|
||||
|
||||
if (! is_dir($localeDir = $directory.'/locale')) {
|
||||
throw new RuntimeException("Language pack $name must have a \"locale\" subdirectory.");
|
||||
}
|
||||
|
||||
if (file_exists($file = $localeDir.'/config.js')) {
|
||||
$this->locales->addJsFile($locale, $file);
|
||||
}
|
||||
|
||||
foreach (new DirectoryIterator($localeDir) as $file) {
|
||||
if ($file->isFile() && in_array($file->getExtension(), ['yml', 'yaml'])) {
|
||||
$this->locales->addTranslations($locale, $file->getPathname());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,14 +78,6 @@ abstract class AbstractServer
|
|||
*/
|
||||
protected function getApp()
|
||||
{
|
||||
// franzliedke/studio currently doesn't autoload files (see issue
|
||||
// below), so we will need to load them manually if we're using studio.
|
||||
// https://github.com/franzliedke/studio/issues/29
|
||||
if (file_exists($corePath = $this->path.'/core')) {
|
||||
require $corePath.'/src/helpers.php';
|
||||
require $corePath.'/vendor/swiftmailer/swiftmailer/lib/swift_required.php';
|
||||
}
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
$app = new Application($this->path);
|
||||
|
|
|
@ -127,6 +127,8 @@ class ClientView implements Renderable
|
|||
$this->assets = $assets;
|
||||
$this->layout = $layout;
|
||||
$this->localeJs = $localeJs;
|
||||
|
||||
$this->addHeadString('<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700,600">', 'font');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,9 +166,13 @@ class ClientView implements Renderable
|
|||
*
|
||||
* @param string $string
|
||||
*/
|
||||
public function addHeadString($string)
|
||||
public function addHeadString($string, $name = null)
|
||||
{
|
||||
$this->headStrings[] = $string;
|
||||
if ($name) {
|
||||
$this->headStrings[$name] = $string;
|
||||
} else {
|
||||
$this->headStrings[] = $string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user