Skip to content

Commit

Permalink
Update for composer branch
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyzerner committed Oct 13, 2015
1 parent 481daa8 commit 2a4b73f
Show file tree
Hide file tree
Showing 18 changed files with 244 additions and 153 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
composer.phar
.DS_Store
Thumbs.db
bower_components
node_modules
16 changes: 14 additions & 2 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
<?php

require __DIR__.'/vendor/autoload.php';
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

return 'Flarum\Embed\Extension';
use Flarum\Embed\Listener;
use Illuminate\Contracts\Events\Dispatcher;

return function (Dispatcher $events) {
$events->subscribe(Listener\AddEmbedRoute::class);
};
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
{
"name": "flarum/embed",
"description": "Embed Flarum discussions as comments for your blog.",
"type": "flarum-extension",
"keywords": ["discussion"],
"license": "MIT",
"authors": [
{
"name": "Toby Zerner",
"email": "toby.zerner@gmail.com"
}
],
"support": {
"issues": "https://github.com/flarum/core/issues",
"source": "https://github.com/flarum/embed"
},
"require": {
"flarum/core": "^0.1.0-beta.3"
},
"autoload": {
"psr-4": {
"Flarum\\Embed\\": "src/"
}
},
"extra": {
"flarum-extension": {
"title": "Embed",
"icon": {
"name": "code",
"backgroundColor": "#B9D233",
"color": "#fff"
}
}
}
}
21 changes: 0 additions & 21 deletions flarum.json

This file was deleted.

3 changes: 0 additions & 3 deletions js/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions js/admin/Gulpfile.js

This file was deleted.

7 changes: 0 additions & 7 deletions js/admin/package.json

This file was deleted.

5 changes: 0 additions & 5 deletions js/admin/src/main.js

This file was deleted.

2 changes: 1 addition & 1 deletion js/forum/Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ gulp({
'bower_components/iframe-resizer/js/iframeResizer.contentWindow.min.js'
],
modules: {
'embed': 'src/**/*.js'
'flarum/embed': 'src/**/*.js'
}
});
136 changes: 136 additions & 0 deletions js/forum/dist/extension.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/forum/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Composer from 'flarum/components/Composer';
import ModalManager from 'flarum/components/ModalManager';
import AlertManager from 'flarum/components/AlertManager';

import DiscussionPage from 'embed/components/DiscussionPage';
import DiscussionPage from 'flarum/embed/components/DiscussionPage';

app.initializers.add('boot', () => {
override(m, 'route', function(original, root, arg1, arg2, vdom) {
Expand Down
2 changes: 0 additions & 2 deletions locale/en.yml

This file was deleted.

44 changes: 0 additions & 44 deletions scripts/build.sh

This file was deleted.

30 changes: 22 additions & 8 deletions scripts/compile.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
#!/usr/bin/env bash

# This script compiles the extension so that it can be used in a Flarum
# installation. It should be run from the root directory of the extension.

base=$PWD

cd $base
composer install --prefer-dist --optimize-autoloader --ignore-platform-reqs --no-dev
cd "${base}/js"

if [ -f bower.json ]; then
bower install
fi

for app in forum admin; do
cd "${base}/js"

if [ -d $app ]; then
cd $app

cd "${base}/js/forum"
npm install
gulp --production
if [ -f bower.json ]; then
bower install
fi

cd "${base}/js/admin"
npm install
gulp --production
npm install
gulp --production
fi
done
16 changes: 7 additions & 9 deletions src/ClientAction.php → src/DiscussionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,26 @@

namespace Flarum\Embed;

use Flarum\Forum\Actions\DiscussionAction as DiscussionAction;
use Psr\Http\Message\ServerRequestInterface as Request;
use Flarum\Forum\Controller\DiscussionController as BaseDiscussionController;
use Psr\Http\Message\ServerRequestInterface;

class ClientAction extends DiscussionAction
class DiscussionController extends BaseDiscussionController
{
/**
* {@inheritdoc}
*
* @return ClientView
*/
public function render(Request $request, array $routeParams = [])
public function render(ServerRequestInterface $request)
{
$view = parent::render($request, $routeParams);
$view = parent::render($request);

$view->addBootstrapper('embed/main');
$view->addBootstrapper('flarum/embed/main');
$view->setLayout(__DIR__.'/../views/embed.blade.php');

return $view;
}

/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getAssets()
{
Expand Down
12 changes: 0 additions & 12 deletions src/Extension.php

This file was deleted.

33 changes: 33 additions & 0 deletions src/Listener/AddEmbedRoute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Flarum\Embed\Listener;

use Flarum\Event\ConfigureForumRoutes;
use Illuminate\Contracts\Events\Dispatcher;

class AddEmbedRoute
{
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(ConfigureForumRoutes::class, [$this, 'addEmbedRoute']);
}

/**
* @param ConfigureForumRoutes $event
*/
public function addEmbedRoute(ConfigureForumRoutes $event)
{
$event->get('/embed/{id:\d+}', 'embed.discussion', 'Flarum\Embed\DiscussionController');
}
}
31 changes: 0 additions & 31 deletions src/Listeners/AddClientAssets.php

This file was deleted.

0 comments on commit 2a4b73f

Please sign in to comment.