Skip to content

Commit

Permalink
Extension convertion
Browse files Browse the repository at this point in the history
  • Loading branch information
ardacebi committed Aug 5, 2018
1 parent 2a5c8fe commit bc08461
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
vendor
composer.lock
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
# flarum-ext-topic-count
Let your users know how many discussions are in a tag.
# Topic Count

---

![License](https://img.shields.io/badge/license-MIT-blue.svg) [![Latest Stable Version](https://img.shields.io/packagist/v/extum/flarum-ext-topic-count.svg)](https://packagist.org/packages/extum/flarum-ext-topic-count)

A [Flarum](http://flarum.org) extension. Let your users know how many discussions are in a tag.

### Installation

Use [Bazaar](https://discuss.flarum.org/d/5151-flagrow-bazaar-the-extension-marketplace) or install manually with composer:

```sh
composer require extum/flarum-ext-topic-count
```

### Updating

```sh
composer update extum/flarum-ext-topic-count
php flarum cache:clear
```

### Links

- [Packagist](https://packagist.org/packages/extum/flarum-ext-topic-count)
19 changes: 19 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* This file is part of extum/flarum-ext-topic-count.
*
* Copyright (c) 2018 .
*
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/

namespace Extum\TopicCount;

use Illuminate\Contracts\Events\Dispatcher;

return function (Dispatcher $events) {
$events->subscribe(Listeners\AddClientAssets::class);
};
37 changes: 37 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "extum/flarum-ext-topic-count",
"description": "Let your users know how many discussions are in a tag.",
"keywords": [
"flarum"
],
"type": "flarum-extension",
"license": "MIT",
"require": {
"flarum/core": "^0.1.0-beta-7"
},
"authors": [
{
"name": "Extum",
"email": "[email protected]",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Extum\\TopicCount\\": "src/"
}
},
"extra": {
"flarum-extension": {
"title": "Topic Count",
"icon": {
"name": "",
"backgroundColor": "",
"color": ""
}
},
"flagrow": {
"discuss": ""
}
}
}
9 changes: 9 additions & 0 deletions js/forum/Gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var gulp = require('flarum-gulp');

gulp({
modules: {
'extum/flarum-ext-topic-count': [
'src/**/*.js',
]
}
});
8 changes: 8 additions & 0 deletions js/forum/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"private": true,
"devDependencies": {
"gulp": "^3.9.1",
"flarum-gulp": "^0.2.0"
},
"dependencies": {}
}
5 changes: 5 additions & 0 deletions js/forum/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import app from 'flarum/app';

app.initializers.add('extum/flarum-ext-topic-count', () => {
console.log('Hello, forum!');
});
Empty file added resources/less/app.less
Empty file.
52 changes: 52 additions & 0 deletions src/Listeners/AddClientAssets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

/**
* This file is part of extum/flarum-ext-topic-count.
*
* Copyright (c) 2018 .
*
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/

namespace Extum\TopicCount\Listeners;

use DirectoryIterator;
use Flarum\Event\ConfigureLocales;
use Flarum\Event\ConfigureWebApp;
use Illuminate\Contracts\Events\Dispatcher;

class AddClientAssets
{

/**
* Subscribes to the Flarum events.
*
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(ConfigureWebApp::class, [$this, 'configureWebApp']);

}

/**
* Modifies the client view for forum/admin.
*
* @param ConfigureWebApp $event
*/
public function configureWebApp(ConfigureWebApp $event)
{


if ($event->isForum()) {
$event->addAssets([
__DIR__.'/../../js/forum/dist/extension.js',
__DIR__.'/../../resources/less/app.less',
]);
$event->addBootstrapper('extum/flarum-ext-topic-count/main');
}
}

}

0 comments on commit bc08461

Please sign in to comment.