mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
FIX: update javascript requirements so user JS doesn't error
This commit is contained in:
parent
4bf0a83ad3
commit
7b38707fde
@ -30,7 +30,8 @@
|
|||||||
},
|
},
|
||||||
"expose": [
|
"expose": [
|
||||||
"css",
|
"css",
|
||||||
"javascript"
|
"javascript",
|
||||||
|
"thirdparty"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -70,8 +70,10 @@ SilverStripe\CMS\Model\SiteTree:
|
|||||||
|
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
|
// [...]
|
||||||
// Get the setting
|
// Get the setting
|
||||||
$loginRequired = singleton('SilverStripe\\CMS\\Model\\SiteTree')->getCommentsOption('require_login');
|
$loginRequired = singleton(SiteTree::class)->getCommentsOption('require_login');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +150,7 @@ SilverStripe\CMS\Model\SiteTree:
|
|||||||
gravatar_rating: 'r'
|
gravatar_rating: 'r'
|
||||||
```
|
```
|
||||||
|
|
||||||
Vald values for rating are as follows:
|
Valid values for rating are as follows:
|
||||||
|
|
||||||
* g: suitable for display on all websites with any audience type.
|
* g: suitable for display on all websites with any audience type.
|
||||||
* pg: may contain rude gestures, provocatively dressed individuals, the lesser
|
* pg: may contain rude gestures, provocatively dressed individuals, the lesser
|
||||||
|
@ -1,26 +1,12 @@
|
|||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
## Composer
|
|
||||||
|
|
||||||
Edit your project-wide composer.json file as follows; in the "require" block add:
|
|
||||||
|
|
||||||
"silverstripe/comments": "*"
|
|
||||||
|
|
||||||
Then in the root of your project run:
|
Then in the root of your project run:
|
||||||
|
|
||||||
#> composer update silverstripe/comments
|
```sh
|
||||||
|
composer require silverstripe/comments`
|
||||||
|
```
|
||||||
|
|
||||||
## Web
|
Then run a database rebuild by visiting `dev/build`. This will add the required database columns and tables for the module to function, and refresh the configuration manifest.
|
||||||
|
|
||||||
To begin the installation first download the module online. You can find the version you require for your SilverStripe installation on the [silverstripe.org](http://www.silverstripe.org) website.
|
|
||||||
|
|
||||||
After you have finished downloading the file, extract the downloaded file to your site's root folder and ensure the name of the module is `comments`.
|
|
||||||
|
|
||||||
## All
|
|
||||||
|
|
||||||
Run a database rebuild by visiting *http://yoursite.com/dev/build?flush=1*. This will add the required database columns and tables for the module to function, and refresh the configuration manifest.
|
|
||||||
|
|
||||||
If you previously had SilverStripe version 2.4 installed then you'll also need to run the migration script provided. More information on this is provided in the next section.
|
|
||||||
|
|
||||||
## Enabling Commenting
|
## Enabling Commenting
|
||||||
|
|
||||||
@ -30,8 +16,6 @@ For more configuration options see [Configuration](Configuration.md).
|
|||||||
|
|
||||||
## Upgrading
|
## Upgrading
|
||||||
|
|
||||||
### Migrating from version 2.* SilverStripe installations
|
### Migrating from version SilverStripe 2 installations
|
||||||
|
|
||||||
This module replaces the built-in commenting system available in versions up to SilverStripe 2.4. To migrate from that you'll need to run `dev/build` after installing the module.
|
This module replaces the built-in commenting system available in SilverStripe 2. Running the `dev/build` task will automatically perform a migration if any comments from these old versions exist.
|
||||||
|
|
||||||
You can do this via sake (`sake dev/build flush=1`) or via a web browser by visiting `http://yoursite.com/dev/build?flush=1`
|
|
||||||
|
@ -35,7 +35,7 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor
|
|||||||
|
|
||||||
$manager->addBulkAction(
|
$manager->addBulkAction(
|
||||||
'spam',
|
'spam',
|
||||||
_t('SilverStripe\\Comments\\Admin\\CommentsGridFieldConfig.SPAM', 'Spam'),
|
_t(__CLASS__ . '.SPAM', 'Spam'),
|
||||||
Handler::class,
|
Handler::class,
|
||||||
array(
|
array(
|
||||||
'isAjax' => true,
|
'isAjax' => true,
|
||||||
@ -46,7 +46,7 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor
|
|||||||
|
|
||||||
$manager->addBulkAction(
|
$manager->addBulkAction(
|
||||||
'approve',
|
'approve',
|
||||||
_t('SilverStripe\\Comments\\Admin\\CommentsGridFieldConfig.APPROVE', 'Approve'),
|
_t(__CLASS__ . '.APPROVE', 'Approve'),
|
||||||
Handler::class,
|
Handler::class,
|
||||||
array(
|
array(
|
||||||
'isAjax' => true,
|
'isAjax' => true,
|
||||||
|
@ -274,7 +274,7 @@ class CommentingController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = _t('SilverStripe\\Comments\\Controllers\\CommentingController.RSSTITLE', "Comments RSS Feed");
|
$title = _t(__CLASS__ . '.RSSTITLE', "Comments RSS Feed");
|
||||||
$comments = new PaginatedList($comments, $request);
|
$comments = new PaginatedList($comments, $request);
|
||||||
$comments->setPageLength($this->getOption('comments_per_page'));
|
$comments->setPageLength($this->getOption('comments_per_page'));
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class CommentsExtension extends DataExtension
|
|||||||
'None' => _t(__CLASS__ . '.MODERATIONREQUIRED_NONE', 'No moderation required'),
|
'None' => _t(__CLASS__ . '.MODERATIONREQUIRED_NONE', 'No moderation required'),
|
||||||
'Required' => _t(__CLASS__ . '.MODERATIONREQUIRED_REQUIRED', 'Moderate all comments'),
|
'Required' => _t(__CLASS__ . '.MODERATIONREQUIRED_REQUIRED', 'Moderate all comments'),
|
||||||
'NonMembersOnly' => _t(
|
'NonMembersOnly' => _t(
|
||||||
'SilverStripe\\Comments\\Extensions\\CommentsExtension.MODERATIONREQUIRED_NONMEMBERSONLY',
|
__CLASS__ . '.MODERATIONREQUIRED_NONMEMBERSONLY',
|
||||||
'Only moderate non-members'
|
'Only moderate non-members'
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
@ -450,11 +450,11 @@ class CommentsExtension extends DataExtension
|
|||||||
// Check if enabled
|
// Check if enabled
|
||||||
$enabled = $this->getCommentsEnabled();
|
$enabled = $this->getCommentsEnabled();
|
||||||
if ($enabled && $this->owner->getCommentsOption('include_js')) {
|
if ($enabled && $this->owner->getCommentsOption('include_js')) {
|
||||||
$adminThirdPartyDir = ModuleLoader::getModule('silverstripe/admin')->getRelativePath() . '/thirdparty';
|
Requirements::javascript('silverstripe/admin:thirdparty/jquery/jquery.js');
|
||||||
Requirements::javascript($adminThirdPartyDir . '/jquery/jquery.js');
|
Requirements::javascript('silverstripe/admin:thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
|
||||||
Requirements::javascript($adminThirdPartyDir . '/jquery-entwine/dist/jquery.entwine-dist.js');
|
Requirements::javascript('silverstripe/admin:thirdparty/jquery-form/jquery.form.js');
|
||||||
Requirements::javascript($adminThirdPartyDir . '/jquery-form/jquery.form.js');
|
|
||||||
Requirements::javascript('silverstripe/comments:thirdparty/jquery-validate/jquery.validate.min.js');
|
Requirements::javascript('silverstripe/comments:thirdparty/jquery-validate/jquery.validate.min.js');
|
||||||
|
Requirements::javascript('silverstripe/admin:client/dist/js/i18n.js');
|
||||||
Requirements::add_i18n_javascript('silverstripe/comments:javascript/lang');
|
Requirements::add_i18n_javascript('silverstripe/comments:javascript/lang');
|
||||||
Requirements::javascript('silverstripe/comments:javascript/CommentsInterface.js');
|
Requirements::javascript('silverstripe/comments:javascript/CommentsInterface.js');
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,7 @@ class Comment extends DataObject
|
|||||||
{
|
{
|
||||||
parent::requireDefaultRecords();
|
parent::requireDefaultRecords();
|
||||||
|
|
||||||
|
// Upgrade from SilverStripe 2 version if necessary
|
||||||
if (DB::get_schema()->hasTable('PageComment')) {
|
if (DB::get_schema()->hasTable('PageComment')) {
|
||||||
$comments = DB::query('SELECT * FROM "PageComment"');
|
$comments = DB::query('SELECT * FROM "PageComment"');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user