diff --git a/.flake8 b/.flake8
new file mode 100644
index 00000000..aa4b98ef
--- /dev/null
+++ b/.flake8
@@ -0,0 +1,5 @@
+[flake8]
+exclude = .git, *migrations*, .tox, dist, htmlcov
+select = C,E,F,W,B,B950
+ignore = E203, E231, E501, W503, W291, W293
+max-line-length = 120
diff --git a/.github/workflows/automated-checks.yml b/.github/workflows/automated-checks.yml
new file mode 100644
index 00000000..7fab4b8d
--- /dev/null
+++ b/.github/workflows/automated-checks.yml
@@ -0,0 +1,64 @@
+name: Run Automated Checks
+
+on:
+ push:
+ branches:
+ - '**'
+
+ tags-ignore:
+ - v*
+
+jobs:
+ # pre-commit checks
+ pre-commit:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+
+ - name: Run Pre Commit Checks
+ uses: pre-commit/action@v2.0.0
+
+ # black formatter
+ black-format:
+ needs: pre-commit
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Run Black Formatter Checks
+ uses: Ahuge/black-action@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ BLACK_ARGS: "."
+
+ # pypi build test
+ build-test:
+ needs: black-format
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Set up Python 3.8
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+
+ - name: Install Tools
+ run: |
+ python -m pip install --upgrade pip
+ pip install setuptools wheel
+
+ - name: Package Build
+ env:
+ STACKMANAGER_VERSION: 9999
+ run: |
+ python setup.py sdist bdist_wheel
diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml
deleted file mode 100644
index 03a2dd57..00000000
--- a/.github/workflows/black.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Black Code Formatter
-
-on:
- push:
- branches:
- - '**'
-
- tags-ignore:
- - v*
-
-jobs:
- black-format:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- name: Checkout
-
- - uses: Ahuge/black-action@master
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- BLACK_ARGS: "."
diff --git a/.github/workflows/pypi-package-build-test.yml b/.github/workflows/pypi-package-build-test.yml
deleted file mode 100644
index ecda6de8..00000000
--- a/.github/workflows/pypi-package-build-test.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-name: PyPI build test
-
-on:
- push:
- branches:
- - '**'
-
- tags-ignore:
- - v*
-
-jobs:
- build-test:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: Set up Python 3.8
- uses: actions/setup-python@v2
- with:
- python-version: 3.8
- - name: Install Tools
- run: |
- python -m pip install --upgrade pip
- pip install setuptools wheel twine
- - name: Package Build
- env:
- STACKMANAGER_VERSION: 9999
- TWINE_USERNAME: __token__
- TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }}
- run: |
- python setup.py sdist bdist_wheel
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..aabece0f
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,26 @@
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.3.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-json
+ - id: check-xml
+ - id: check-yaml
+ - id: fix-byte-order-marker
+ - id: trailing-whitespace
+ exclude: \.(min\.css|min\.js|po|mo)$
+ - id: end-of-file-fixer
+ exclude: \.(min\.css|min\.js|po|mo)$
+ - id: mixed-line-ending
+ args: [ '--fix=lf' ]
+
+ - repo: https://github.com/psf/black
+ rev: 20.8b1
+ hooks:
+ - id: black
+ language_version: python3.6
+
+ - repo: https://gitlab.com/pycqa/flake8
+ rev: '3.8.4'
+ hooks:
+ - id: flake8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8afe74f4..c74f406a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+## [2.4.3] - 2020-12-10
+
+### Fixed
+
+- An issue with quotes in the doctrines field (#38)
+
+
## [2.4.2] - 2020-11-08
### Fixed
@@ -32,7 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Important!
Before updating to this version, make sure you have your Alliance Auth updated to version 2.8.0 (or newer).
-This version of AA Fleetpings uses a JavaScript library that is introduced in Alliance Auth 2.8.0,
+This version of AA Fleetpings uses a JavaScript library that is introduced in Alliance Auth 2.8.0,
so have your Auth updated before installing this version.
### Fixed
@@ -76,7 +83,7 @@ so have your Auth updated before installing this version.
### Added
-- Option to use the fittings from the [Fittings and Doctrines](https://gitlab.com/colcrunch/fittings) module if you have it installed
+- Option to use the fittings from the [Fittings and Doctrines](https://gitlab.com/colcrunch/fittings) module if you have it installed
## [2.1.0] - 2020-09-16
@@ -89,11 +96,11 @@ so have your Auth updated before installing this version.
## [2.0.0] - 2020-09-15
-This is the official re-brand of AA Discord Ping Formatter, since the original name didn't fit anymore with
+This is the official re-brand of AA Discord Ping Formatter, since the original name didn't fit anymore with
the new features, like automatic pings and now the new Slack implementation.
-If you were testing one of the alpha versions of AA Discord Ping Formatter, make sure to migrate
-discordpingformatter zero and deactivate the old app in your local.py before activating this one.
+If you were testing one of the alpha versions of AA Discord Ping Formatter, make sure to migrate
+discordpingformatter zero and deactivate the old app in your local.py before activating this one.
They will not run side by side.
This is how you do it:
@@ -102,7 +109,7 @@ python manage.py migrate discordpingformatter zero
```
Now remove the `'discordpingformatter',` line and add `'fleetpings',` instead.
-Once done, run collectstatic and migrations again. You now have to re-do your settings in the admin
+Once done, run collectstatic and migrations again. You now have to re-do your settings in the admin
backend, since we just nuked them from the old app.
### Added
@@ -111,7 +118,7 @@ backend, since we just nuked them from the old app.
### Changed
-- **!! breaking change !!** Settings are no longer in your `local.py`. You find them now in your admin backend. Which means. after installing this version, you _have_ to re-do you setting in the admin backend of Auth. But trust me, it's worth the effort.
+- **!! breaking change !!** Settings are no longer in your `local.py`. You find them now in your admin backend. Which means. after installing this version, you _have_ to re-do you setting in the admin backend of Auth. But trust me, it's worth the effort.
- Minimum AA version set to 2.7.4 since we use a feature that was introduced in this version. So make sure to update your Alliance Auth before testing this app.
### Fixed
@@ -119,7 +126,6 @@ backend, since we just nuked them from the old app.
- Several logic errors in the JavaScript
-
## From the discontinued AA Discord Ping Formatter (to keep the history alive)
@@ -171,7 +177,7 @@ backend, since we just nuked them from the old app.
- Set time selection steps to 15 minutes instead of 60 in te datepicker
- Set Monday as the beginning of the week in the datepicker
-### Fixed
+### Fixed
- Our Australian time travelers and everyone else who lives in the future (UTC+x) is now able to pre-ping fleets that are coming up in 2 hours Eve time, which might still be in their past local time, depending on how far in the future they live. (#19)
@@ -256,7 +262,7 @@ backend, since we just nuked them from the old app.
### Fixed
-- sanitizing form field input
+- sanitizing form field input
## [0.1.1] - 2020-06-13
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..acba8ce0
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,37 @@
+# Contributing to AA Fleet Pings
+
+## Code Formatting
+
+This app is utilizing the [Black](https://black.readthedocs.io/en/stable/the_black_code_style.html)
+code style. Every commit has to adhere to it.
+
+This repository uses [pre-commit](https://github.com/pre-commit/pre-commit) to
+verify compliance with formatting rules. To use:
+
+1. Install `pre-commit`.
+2. From inside the `aa-srp` root directory, run `pre-commit install`.
+3. You're all done! Code will be checked automatically using git hooks.
+
+You can check if your code to commit adheres to the given style by simply running:
+```shell script
+pre-commit
+```
+or to check all files:
+```shell script
+pre-commit run --all-files
+```
+
+The following will be checked by `pre-commit`:
+
+- no trailing whitespaces (excluded are: minified js and css, .po and .mo files)
+- one, and only one, empty line at the end of every file (excluded are: minified js and css, .po and .mo files)
+- line ending is LF
+- code formatted according to black code style
+- code conforms with flake8
+
+
+## Contributing via pull requests
+
+To contribute code via pull request, make sure that you fork the repository and branch
+your changes from the `development` branch. Only pull requests towards the development
+branch will be considered.
diff --git a/README.md b/README.md
index ef9de8aa..6ee49163 100644
--- a/README.md
+++ b/README.md
@@ -9,16 +9,16 @@
App for Alliance Auth that can format your fleet pings and also ping for you to Discord and Slack.
Formerly known as [AA Discord Ping Formatter](https://github.com/ppfeufer/aa-discord-ping-formatter).
-
-Since the original app evolved and with the now added support to ping Slack as well,
-I felt the name was no longer fitting, so I re-branded the app as "AA Fleet Pings". The old Discord ping
+
+Since the original app evolved and with the now added support to ping Slack as well,
+I felt the name was no longer fitting, so I re-branded the app as "AA Fleet Pings". The old Discord ping
formatter will be discontinued in favor of this one.
-If you used the old app until now (not the alpha versions), don't worry, nothing is breaking. At least I hope so.
+If you used the old app until now (not the alpha versions), don't worry, nothing is breaking. At least I hope so.
Since this app has a complete new code base and a different name it shouldn't interfere with the old one.
All you need to do is to set the new permission for the groups that need to have access to this app.
-If you run into any trouble, feel free to shout at me on the [Alliance Auth Support Discord](https://discord.gg/fjnHAmk).
+If you run into any trouble, feel free to shout at me on the [Alliance Auth Support Discord](https://discord.gg/fjnHAmk).
You find me there as Rounon Dax.
## Contents
@@ -31,8 +31,8 @@ You find me there as Rounon Dax.
## Installation
-**Important**: This app is a plugin for Alliance Auth. If you don't have Alliance Auth running already,
-please install it first before proceeding.
+**Important**: This app is a plugin for Alliance Auth. If you don't have Alliance Auth running already,
+please install it first before proceeding.
(see the official [AA installation guide](https://allianceauth.readthedocs.io/en/latest/installation/allianceauth.html) for details)
### Step 0 - Migrating from AA Discord Ping Formatter
@@ -54,7 +54,7 @@ Once done, feel free to install this app by following the steps above.
### Step 1 - Install the app
-Make sure you are in the virtual environment (venv) of your Alliance Auth installation.
+Make sure you are in the virtual environment (venv) of your Alliance Auth installation.
Then install the latest version:
```bash
@@ -84,15 +84,15 @@ Restart your supervisor services for AA
### Step 4 - Setup permission
-Now you can setup permissions in Alliance Auth for your users.
-Add ``fleetpings | aa fleet pings | Can access this app`` to the states and/or
+Now you can setup permissions in Alliance Auth for your users.
+Add ``fleetpings | aa fleet pings | Can access this app`` to the states and/or
groups you would like to have access.
### Step 5 - Setup the app
-In your admin backend you'll find a new section called `Fleet Pings`.
-This is where you set all your stuff up, like the webhooks you want to ping and who can ping them,
-fleet types, comms, formup locations and so on. It's pretty straight forward,
+In your admin backend you'll find a new section called `Fleet Pings`.
+This is where you set all your stuff up, like the webhooks you want to ping and who can ping them,
+fleet types, comms, formup locations and so on. It's pretty straight forward,
so you shouldn't have any issues. Go nuts!
## Updating
@@ -136,15 +136,15 @@ Finally restart your AA supervisor services.
### Using Slack instead of Discord?
-Don't worry, I don't judge and you still can use this module. It supports also pings to Slack.
-Simply add the following to your `local.py`.
+Don't worry, I don't judge and you still can use this module. It supports also pings to Slack.
+Simply add the following to your `local.py`.
```python
## AA Fleet Pings
AA_FLEETPINGS_USE_SLACK = True
```
-Although you cannot use your Auth groups as targets for pings with Slack. Auth doesn't supprt Slack as of yet.
+Although you cannot use your Auth groups as targets for pings with Slack. Auth doesn't supprt Slack as of yet.
(Maybe if someone writes a service?)
### Slack Ping Example
@@ -153,8 +153,8 @@ Although you cannot use your Auth groups as targets for pings with Slack. Auth d
### Use Doctrines from Fittings module
-If you have the [Fittings and Doctrines](https://gitlab.com/colcrunch/fittings) module installed and your doctrines configured there,
-you don't have to re-build your doctrine list for this module. You can simply use the doctrines you
+If you have the [Fittings and Doctrines](https://gitlab.com/colcrunch/fittings) module installed and your doctrines configured there,
+you don't have to re-build your doctrine list for this module. You can simply use the doctrines you
already have configured in the Fittings and Doctrines module.
To do so, add the following to your `local.py`:
diff --git a/fleetpings/__init__.py b/fleetpings/__init__.py
index 582dcdfe..46f14fdd 100644
--- a/fleetpings/__init__.py
+++ b/fleetpings/__init__.py
@@ -6,5 +6,5 @@
default_app_config: str = "fleetpings.apps.AaFleetpingsConfig"
-__version__ = "2.4.2"
+__version__ = "2.4.3"
__title__ = "Fleet Pings"
diff --git a/fleetpings/static/fleetpings/js/fleetpings.js b/fleetpings/static/fleetpings/js/fleetpings.js
index 0ac39a58..75ab3e41 100644
--- a/fleetpings/static/fleetpings/js/fleetpings.js
+++ b/fleetpings/static/fleetpings/js/fleetpings.js
@@ -66,12 +66,55 @@ jQuery(document).ready(function($) {
/**
* sanitize input string
*
- * @param {string} element
- * @returns {undefined}
+ * @param {string} input string to sanitize
+ * @returns {string} sanitized string
*/
var sanitizeInput = function(input) {
if(input) {
- return input.replace(/<(|\/|[^>\/bi]|\/[^>bi]|[^\/>][^>]+|\/[^>][^>]+)>/g, '');
+ var returnValue = input
+ .replace(
+ /<(|\/|[^>\/bi]|\/[^>bi]|[^\/>][^>]+|\/[^>][^>]+)>/g,
+ ''
+ );
+
+ return returnValue;
+ } else {
+ return input;
+ }
+ };
+
+ /**
+ * escape input string
+ *
+ * @param {string} input string to escape
+ * @param {boolean} quotesToEntities transform quotes into entities
+ * @returns {string} escaped string
+ */
+ var escapeInput = function(input, quotesToEntities) {
+ quotesToEntities = quotesToEntities || false;
+
+ if(input) {
+ var returnValue = sanitizeInput(input)
+ .replace(
+ /&/g,
+ '&'
+ );
+
+ if(quotesToEntities === true) {
+ returnValue = returnValue.replace(
+ /"/g,
+ '"'
+ );
+ }
+
+ if(quotesToEntities === false) {
+ returnValue = returnValue.replace(
+ /"/g,
+ '\\"'
+ );
+ }
+
+ return returnValue;
} else {
return input;
}
@@ -154,7 +197,7 @@ jQuery(document).ready(function($) {
*/
var getTimezonesUrl = function(formupTime) {
var formupDateTime = new Date(formupTime);
- var formupTimestamp = (formupDateTime.getTime() - formupDateTime.getTimezoneOffset() *60 * 1000) / 1000;
+ var formupTimestamp = (formupDateTime.getTime() - formupDateTime.getTimezoneOffset() * 60 * 1000) / 1000;
var timezonesUrl = '';
if(fleetpingsSettings.useNewTimezoneLinks === true) {
@@ -191,7 +234,7 @@ jQuery(document).ready(function($) {
// let's see if we can find a doctrine link
var fleetDoctrineLink = null;
if(fleetDoctrine !== '') {
- var selectedLink = $('#fleetDoctrineList [value="' + fleetDoctrine + '"]').data('doctrine-url');
+ var selectedLink = $('#fleetDoctrineList [value="' + escapeInput(fleetDoctrine, false) + '"]').data('doctrine-url');
if(undefined !== selectedLink && selectedLink !== '') {
// Houston, we have a link!
diff --git a/fleetpings/static/fleetpings/js/fleetpings.min.js b/fleetpings/static/fleetpings/js/fleetpings.min.js
index 0f3ce904..da3cb97b 100644
--- a/fleetpings/static/fleetpings/js/fleetpings.min.js
+++ b/fleetpings/static/fleetpings/js/fleetpings.min.js
@@ -1 +1 @@
-jQuery(document).ready(function($){var nl2br=function(string,isXhtml){var breakTag=isXhtml||typeof isXhtml==="undefined"?"
":"
";return(string+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+breakTag+"$2")};var closeCopyMessageElement=function(element){$(element).fadeTo(1e4,500).slideUp(500,function(){$(this).slideUp(500,function(){$(this).remove()})})};var showSuccess=function(message,element){$(element).html('
"+nl2br(discordPingTarget+pingText)+"
")}if(fleetpingsSettings.platformUsed==="Slack"){$(".aa-fleetpings-ping-text").html(""+nl2br(discordPingTarget+pingText.split("**").join("*"))+"
")}if(webhookUrl!==false&&webhookUrl!==""){if(fleetpingsSettings.pingCreator!==""){pingText+="\n\n"+"*(Ping sent by: "+fleetpingsSettings.pingCreator+")*";webhookPingTextFooter="(Ping sent by: "+fleetpingsSettings.pingCreator+")"}var embedColor="#faa61a";if(fleetType!==""&&embedColor!==""){embedColor=webhookEmbedColor}if(fcName!==""){webhookPingTextHeader+=" under "+fcName}var copyPasteText="";if(webhookType==="Discord"){if(undefined!==webhookEmbedPing&&webhookEmbedPing==="True"){if(pingTarget!==""){webhookPingTarget+=" :: "}sendEmbeddedDiscordPing(webhookUrl,webhookPingTarget+"**"+webhookPingTextHeader+"**"+"\n"+"** **",{title:"**.: Fleet Details :.**",description:webhookPingTextContent,color:hexToDecimal(embedColor),footer:{text:webhookPingTextFooter}})}else{sendDiscordPing(webhookUrl,webhookPingTarget+pingText)}}if(webhookType==="Slack"){var slackEmbedPingTarget="";if(pingTarget!==""){slackEmbedPingTarget="<"+webhookPingTarget.replace("@","!")+"> :: "}var payload={attachments:[{fallback:pingText,color:embedColor,pretext:slackEmbedPingTarget+"*"+webhookPingTextHeader+"*",text:"*.: Fleet Details :.*"+"\n"+webhookPingTextContent.split("**").join("*"),footer:webhookPingTextFooter}]};sendSlackPing(webhookUrl,payload)}showSuccess(fleetpingsTranslations.ping.success,".aa-fleetpings-ping-copyresult")}if(fleetpingsSettings.optimerInstalled===true){if($("input#prePing").is(":checked")&&$("input#createOptimer").is(":checked")&&formupTime!==""){var ajaxUrl=fleetpingsSettings.siteUrl+"fleetpings/create_optimer/";$.ajax({url:ajaxUrl,type:"post",data:{fleet_doctrine:fleetDoctrine,formup_location:formupLocation,formup_time:formupTime,fleet_name:fleetName,fleet_commander:fcName},headers:{"X-CSRFToken":$('input[name="csrfmiddlewaretoken"]').val()}});$("input#createOptimer").removeAttr("checked");showSuccess(fleetpingsTranslations.optimer.created,".fleetpings-create-optimer-message")}}};var copyFleetPing=function(){var clipboardFleetPingData=new ClipboardJS("button#copyFleetPing");clipboardFleetPingData.on("success",function(e){showSuccess(fleetpingsTranslations.copyToClipboard.success,".aa-fleetpings-ping-copyresult");e.clearSelection();clipboardFleetPingData.destroy()});clipboardFleetPingData.on("error",function(){showError(fleetpingsTranslations.copyToClipboard.error,".aa-fleetpings-ping-copyresult");clipboardFleetPingData.destroy()})};$("#prePing").on("change",function(){if($("input#prePing").is(":checked")){$("input#formupTimeNow").removeAttr("checked");$("input#formupTime").removeAttr("disabled");if(fleetpingsSettings.optimerInstalled===true){$(".fleetpings-create-optimer").show()}}else{$("input#formupTimeNow").prop("checked",true);$("input#formupTimeNow").removeAttr("disabled");$("input#formupTime").prop("disabled",true);if(fleetpingsSettings.optimerInstalled===true){$("input#createOptimer").removeAttr("checked");$(".fleetpings-create-optimer").hide()}}});$("input#formupTimeNow").on("change",function(){if($("input#formupTimeNow").is(":checked")){$("input#prePing").removeAttr("checked");$("input#formupTime").prop("disabled",true);if(fleetpingsSettings.optimerInstalled===true){$("input#createOptimer").removeAttr("checked");$(".fleetpings-create-optimer").hide()}}else{$("input#prePing").prop("checked",true);$("input#prePing").removeAttr("disabled");$("input#formupTime").removeAttr("disabled");if(fleetpingsSettings.optimerInstalled===true){$(".fleetpings-create-optimer").show()}}});$("button#createPingText").on("click",function(){generateFleetPing();return false});$("button#copyFleetPing").on("click",function(){copyFleetPing()})}); \ No newline at end of file +jQuery(document).ready(function($){var nl2br=function(string,isXhtml){var breakTag=isXhtml||typeof isXhtml==="undefined"?""+nl2br(discordPingTarget+pingText)+"
")}if(fleetpingsSettings.platformUsed==="Slack"){$(".aa-fleetpings-ping-text").html(""+nl2br(discordPingTarget+pingText.split("**").join("*"))+"
")}if(webhookUrl!==false&&webhookUrl!==""){if(fleetpingsSettings.pingCreator!==""){pingText+="\n\n"+"*(Ping sent by: "+fleetpingsSettings.pingCreator+")*";webhookPingTextFooter="(Ping sent by: "+fleetpingsSettings.pingCreator+")"}var embedColor="#faa61a";if(fleetType!==""&&embedColor!==""){embedColor=webhookEmbedColor}if(fcName!==""){webhookPingTextHeader+=" under "+fcName}var copyPasteText="";if(webhookType==="Discord"){if(undefined!==webhookEmbedPing&&webhookEmbedPing==="True"){if(pingTarget!==""){webhookPingTarget+=" :: "}sendEmbeddedDiscordPing(webhookUrl,webhookPingTarget+"**"+webhookPingTextHeader+"**"+"\n"+"** **",{title:"**.: Fleet Details :.**",description:webhookPingTextContent,color:hexToDecimal(embedColor),footer:{text:webhookPingTextFooter}})}else{sendDiscordPing(webhookUrl,webhookPingTarget+pingText)}}if(webhookType==="Slack"){var slackEmbedPingTarget="";if(pingTarget!==""){slackEmbedPingTarget="<"+webhookPingTarget.replace("@","!")+"> :: "}var payload={attachments:[{fallback:pingText,color:embedColor,pretext:slackEmbedPingTarget+"*"+webhookPingTextHeader+"*",text:"*.: Fleet Details :.*"+"\n"+webhookPingTextContent.split("**").join("*"),footer:webhookPingTextFooter}]};sendSlackPing(webhookUrl,payload)}showSuccess(fleetpingsTranslations.ping.success,".aa-fleetpings-ping-copyresult")}if(fleetpingsSettings.optimerInstalled===true){if($("input#prePing").is(":checked")&&$("input#createOptimer").is(":checked")&&formupTime!==""){var ajaxUrl=fleetpingsSettings.siteUrl+"fleetpings/create_optimer/";$.ajax({url:ajaxUrl,type:"post",data:{fleet_doctrine:fleetDoctrine,formup_location:formupLocation,formup_time:formupTime,fleet_name:fleetName,fleet_commander:fcName},headers:{"X-CSRFToken":$('input[name="csrfmiddlewaretoken"]').val()}});$("input#createOptimer").removeAttr("checked");showSuccess(fleetpingsTranslations.optimer.created,".fleetpings-create-optimer-message")}}};var copyFleetPing=function(){var clipboardFleetPingData=new ClipboardJS("button#copyFleetPing");clipboardFleetPingData.on("success",function(e){showSuccess(fleetpingsTranslations.copyToClipboard.success,".aa-fleetpings-ping-copyresult");e.clearSelection();clipboardFleetPingData.destroy()});clipboardFleetPingData.on("error",function(){showError(fleetpingsTranslations.copyToClipboard.error,".aa-fleetpings-ping-copyresult");clipboardFleetPingData.destroy()})};$("#prePing").on("change",function(){if($("input#prePing").is(":checked")){$("input#formupTimeNow").removeAttr("checked");$("input#formupTime").removeAttr("disabled");if(fleetpingsSettings.optimerInstalled===true){$(".fleetpings-create-optimer").show()}}else{$("input#formupTimeNow").prop("checked",true);$("input#formupTimeNow").removeAttr("disabled");$("input#formupTime").prop("disabled",true);if(fleetpingsSettings.optimerInstalled===true){$("input#createOptimer").removeAttr("checked");$(".fleetpings-create-optimer").hide()}}});$("input#formupTimeNow").on("change",function(){if($("input#formupTimeNow").is(":checked")){$("input#prePing").removeAttr("checked");$("input#formupTime").prop("disabled",true);if(fleetpingsSettings.optimerInstalled===true){$("input#createOptimer").removeAttr("checked");$(".fleetpings-create-optimer").hide()}}else{$("input#prePing").prop("checked",true);$("input#prePing").removeAttr("disabled");$("input#formupTime").removeAttr("disabled");if(fleetpingsSettings.optimerInstalled===true){$(".fleetpings-create-optimer").show()}}});$("button#createPingText").on("click",function(){generateFleetPing();return false});$("button#copyFleetPing").on("click",function(){copyFleetPing()})}); \ No newline at end of file diff --git a/fleetpings/urls.py b/fleetpings/urls.py index c85d7641..60205d49 100644 --- a/fleetpings/urls.py +++ b/fleetpings/urls.py @@ -4,7 +4,6 @@ pages url config """ -from django.urls import path from django.conf.urls import url from fleetpings import views