mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-10 23:06:32 +03:00
added users, blog, fixed docker
This commit is contained in:
commit
bf8e191a65
10
.dockerignore
Normal file
10
.dockerignore
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.editorconfig
|
||||||
|
.gitattributes
|
||||||
|
.github
|
||||||
|
.gitignore
|
||||||
|
.gitlab-ci.yml
|
||||||
|
.idea
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
.readthedocs.yml
|
||||||
|
.travis.yml
|
||||||
|
venv
|
27
.editorconfig
Normal file
27
.editorconfig
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# http://editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.{py,rst,ini}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{html,css,scss,json,yml,xml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[nginx.conf]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
4
.env.example
Normal file
4
.env.example
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
DATABASE_URL=
|
||||||
|
CELERY_BROKER_URL=
|
||||||
|
USE_DOCKER=
|
||||||
|
EMAIL_HOST=
|
14
.envs/.local/.django
Normal file
14
.envs/.local/.django
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# General
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
USE_DOCKER=yes
|
||||||
|
IPYTHONDIR=/app/.ipython
|
||||||
|
# Redis
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
|
||||||
|
# Celery
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Flower
|
||||||
|
CELERY_FLOWER_USER=debug
|
||||||
|
CELERY_FLOWER_PASSWORD=debug
|
7
.envs/.local/.postgres
Normal file
7
.envs/.local/.postgres
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# PostgreSQL
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
POSTGRES_HOST=postgres
|
||||||
|
POSTGRES_PORT=5432
|
||||||
|
POSTGRES_DB=akarpov
|
||||||
|
POSTGRES_USER=debug
|
||||||
|
POSTGRES_PASSWORD=debug
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* text=auto
|
79
.github/dependabot.yml
vendored
Normal file
79
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
# Config for Dependabot updates. See Documentation here:
|
||||||
|
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
# Update GitHub actions in workflows
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Enable version updates for Docker
|
||||||
|
# We need to specify each Dockerfile in a separate entry because Dependabot doesn't
|
||||||
|
# support wildcards or recursively checking subdirectories. Check this issue for updates:
|
||||||
|
# https://github.com/dependabot/dependabot-core/issues/2178
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
# Look for a `Dockerfile` in the `compose/local/django` directory
|
||||||
|
directory: "compose/local/django/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Enable version updates for Docker
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
# Look for a `Dockerfile` in the `compose/local/docs` directory
|
||||||
|
directory: "compose/local/docs/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Enable version updates for Docker
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
# Look for a `Dockerfile` in the `compose/local/node` directory
|
||||||
|
directory: "compose/local/node/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Enable version updates for Docker
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
# Look for a `Dockerfile` in the `compose/production/aws` directory
|
||||||
|
directory: "compose/production/aws/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Enable version updates for Docker
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
# Look for a `Dockerfile` in the `compose/production/django` directory
|
||||||
|
directory: "compose/production/django/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Enable version updates for Docker
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
# Look for a `Dockerfile` in the `compose/production/postgres` directory
|
||||||
|
directory: "compose/production/postgres/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Enable version updates for Docker
|
||||||
|
- package-ecosystem: "docker"
|
||||||
|
# Look for a `Dockerfile` in the `compose/production/traefik` directory
|
||||||
|
directory: "compose/production/traefik/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Enable version updates for Python/Pip - Production
|
||||||
|
- package-ecosystem: "pip"
|
||||||
|
# Look for a `requirements.txt` in the `root` directory
|
||||||
|
# also 'setup.cfg', 'runtime.txt' and 'requirements/*.txt'
|
||||||
|
directory: "/"
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
60
.github/workflows/ci.yml
vendored
Normal file
60
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
# Enable Buildkit and let compose use it to speed up image building
|
||||||
|
env:
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ "master", "main" ]
|
||||||
|
paths-ignore: [ "docs/**" ]
|
||||||
|
|
||||||
|
push:
|
||||||
|
branches: [ "master", "main" ]
|
||||||
|
paths-ignore: [ "docs/**" ]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linter:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout Code Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: "3.10"
|
||||||
|
cache: pip
|
||||||
|
cache-dependency-path: |
|
||||||
|
requirements/base.txt
|
||||||
|
requirements/local.txt
|
||||||
|
|
||||||
|
- name: Run pre-commit
|
||||||
|
uses: pre-commit/action@v2.0.3
|
||||||
|
|
||||||
|
# With no caching at all the entire ci process takes 4m 30s to complete!
|
||||||
|
pytest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout Code Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build the Stack
|
||||||
|
run: docker-compose -f local.yml build
|
||||||
|
|
||||||
|
- name: Run DB Migrations
|
||||||
|
run: docker-compose -f local.yml run --rm django python manage.py migrate
|
||||||
|
|
||||||
|
- name: Run Django Tests
|
||||||
|
run: docker-compose -f local.yml run django pytest
|
||||||
|
|
||||||
|
- name: Tear down the Stack
|
||||||
|
run: docker-compose -f local.yml down
|
335
.gitignore
vendored
Normal file
335
.gitignore
vendored
Normal file
|
@ -0,0 +1,335 @@
|
||||||
|
.idea
|
||||||
|
|
||||||
|
### Python template
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
.hypothesis/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
staticfiles/
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# celery beat schedule file
|
||||||
|
celerybeat-schedule
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.venv
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
|
||||||
|
|
||||||
|
### Node template
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Typescript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
|
||||||
|
### Linux template
|
||||||
|
*~
|
||||||
|
|
||||||
|
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||||
|
.fuse_hidden*
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
|
.nfs*
|
||||||
|
|
||||||
|
|
||||||
|
### VisualStudioCode template
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
|
||||||
|
# Provided default Pycharm Run/Debug Configurations should be tracked by git
|
||||||
|
# In case of local modifications made by Pycharm, use update-index command
|
||||||
|
# for each changed file, like this:
|
||||||
|
# git update-index --assume-unchanged .idea/akarpov.iml
|
||||||
|
### JetBrains template
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff:
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
|
||||||
|
# Sensitive or high-churn files:
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.xml
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
|
||||||
|
# Gradle:
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-debug/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin:
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
## File-based project format:
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
## Plugin-specific files:
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Windows template
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
|
||||||
|
### macOS template
|
||||||
|
# General
|
||||||
|
*.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
|
||||||
|
### SublimeText template
|
||||||
|
# Cache files for Sublime Text
|
||||||
|
*.tmlanguage.cache
|
||||||
|
*.tmPreferences.cache
|
||||||
|
*.stTheme.cache
|
||||||
|
|
||||||
|
# Workspace files are user-specific
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Project files should be checked into the repository, unless a significant
|
||||||
|
# proportion of contributors will probably not be using Sublime Text
|
||||||
|
# *.sublime-project
|
||||||
|
|
||||||
|
# SFTP configuration file
|
||||||
|
sftp-config.json
|
||||||
|
|
||||||
|
# Package control specific files
|
||||||
|
Package Control.last-run
|
||||||
|
Package Control.ca-list
|
||||||
|
Package Control.ca-bundle
|
||||||
|
Package Control.system-ca-bundle
|
||||||
|
Package Control.cache/
|
||||||
|
Package Control.ca-certs/
|
||||||
|
Package Control.merged-ca-bundle
|
||||||
|
Package Control.user-ca-bundle
|
||||||
|
oscrypto-ca-bundle.crt
|
||||||
|
bh_unicode_properties.cache
|
||||||
|
|
||||||
|
# Sublime-github package stores a github token in this file
|
||||||
|
# https://packagecontrol.io/packages/sublime-github
|
||||||
|
GitHub.sublime-settings
|
||||||
|
|
||||||
|
|
||||||
|
### Vim template
|
||||||
|
# Swap
|
||||||
|
[._]*.s[a-v][a-z]
|
||||||
|
[._]*.sw[a-p]
|
||||||
|
[._]s[a-v][a-z]
|
||||||
|
[._]sw[a-p]
|
||||||
|
|
||||||
|
# Session
|
||||||
|
Session.vim
|
||||||
|
|
||||||
|
# Temporary
|
||||||
|
.netrwhist
|
||||||
|
|
||||||
|
# Auto-generated tag files
|
||||||
|
tags
|
||||||
|
|
||||||
|
### Project template
|
||||||
|
akarpov/media/
|
||||||
|
|
||||||
|
.pytest_cache/
|
||||||
|
.ipython/
|
||||||
|
.env
|
||||||
|
.envs/*
|
||||||
|
!.envs/.local/
|
39
.pre-commit-config.yaml
Normal file
39
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
exclude: "^docs/|/migrations/"
|
||||||
|
default_stages: [commit]
|
||||||
|
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.3.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-yaml
|
||||||
|
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v3.2.2
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: [--py310-plus]
|
||||||
|
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 22.10.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
|
||||||
|
- repo: https://github.com/PyCQA/isort
|
||||||
|
rev: 5.10.1
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
|
||||||
|
- repo: https://github.com/PyCQA/flake8
|
||||||
|
rev: 5.0.4
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
args: ["--config=setup.cfg"]
|
||||||
|
additional_dependencies: [flake8-isort]
|
||||||
|
|
||||||
|
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
|
||||||
|
ci:
|
||||||
|
autoupdate_schedule: weekly
|
||||||
|
skip: []
|
||||||
|
submodules: false
|
14
.pylintrc
Normal file
14
.pylintrc
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[MASTER]
|
||||||
|
load-plugins=pylint_django, pylint_celery
|
||||||
|
django-settings-module=config.settings.local
|
||||||
|
[FORMAT]
|
||||||
|
max-line-length=120
|
||||||
|
|
||||||
|
[MESSAGES CONTROL]
|
||||||
|
disable=missing-docstring,invalid-name
|
||||||
|
|
||||||
|
[DESIGN]
|
||||||
|
max-parents=13
|
||||||
|
|
||||||
|
[TYPECHECK]
|
||||||
|
generated-members=REQUEST,acl_users,aq_parent,"[a-zA-Z]+_set{1,2}",save,delete
|
12
.readthedocs.yml
Normal file
12
.readthedocs.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
sphinx:
|
||||||
|
configuration: docs/conf.py
|
||||||
|
|
||||||
|
build:
|
||||||
|
image: testing
|
||||||
|
|
||||||
|
python:
|
||||||
|
version: 3.10
|
||||||
|
install:
|
||||||
|
- requirements: requirements/local.txt
|
1
CONTRIBUTORS.txt
Normal file
1
CONTRIBUTORS.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
sanspie
|
9
LICENSE
Normal file
9
LICENSE
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2022, sanspie
|
||||||
|
|
||||||
|
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.
|
83
README.md
Normal file
83
README.md
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
# akarpov
|
||||||
|
|
||||||
|
My collection of apps and tools
|
||||||
|
|
||||||
|
[![Built with Cookiecutter Django](https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg?logo=cookiecutter)](https://github.com/cookiecutter/cookiecutter-django/)
|
||||||
|
[![Black code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
Moved to [settings](http://cookiecutter-django.readthedocs.io/en/latest/settings.html).
|
||||||
|
|
||||||
|
## Basic Commands
|
||||||
|
|
||||||
|
### Setting Up Your Users
|
||||||
|
|
||||||
|
- To create a **normal user account**, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.
|
||||||
|
|
||||||
|
- To create a **superuser account**, use this command:
|
||||||
|
|
||||||
|
$ python manage.py createsuperuser
|
||||||
|
|
||||||
|
For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.
|
||||||
|
|
||||||
|
### Type checks
|
||||||
|
|
||||||
|
Running type checks with mypy:
|
||||||
|
|
||||||
|
$ mypy akarpov
|
||||||
|
|
||||||
|
### Test coverage
|
||||||
|
|
||||||
|
To run the tests, check your test coverage, and generate an HTML coverage report:
|
||||||
|
|
||||||
|
$ coverage run -m pytest
|
||||||
|
$ coverage html
|
||||||
|
$ open htmlcov/index.html
|
||||||
|
|
||||||
|
#### Running tests with pytest
|
||||||
|
|
||||||
|
$ pytest
|
||||||
|
|
||||||
|
### Live reloading and Sass CSS compilation
|
||||||
|
|
||||||
|
Moved to [Live reloading and SASS compilation](https://cookiecutter-django.readthedocs.io/en/latest/developing-locally.html#sass-compilation-live-reloading).
|
||||||
|
|
||||||
|
### Celery
|
||||||
|
|
||||||
|
This app comes with Celery.
|
||||||
|
|
||||||
|
To run a celery worker:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
cd akarpov
|
||||||
|
celery -A config.celery_app worker -l info
|
||||||
|
```
|
||||||
|
|
||||||
|
Please note: For Celery's import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
|
||||||
|
|
||||||
|
### Email Server
|
||||||
|
|
||||||
|
In development, it is often nice to be able to see emails that are being sent from your application. For that reason local SMTP server [MailHog](https://github.com/mailhog/MailHog) with a web interface is available as docker container.
|
||||||
|
|
||||||
|
Container mailhog will start automatically when you will run all docker containers.
|
||||||
|
Please check [cookiecutter-django Docker documentation](http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html) for more details how to start all containers.
|
||||||
|
|
||||||
|
With MailHog running, to view messages that are sent by your application, open your browser and go to `http://127.0.0.1:8025`
|
||||||
|
|
||||||
|
### Sentry
|
||||||
|
|
||||||
|
Sentry is an error logging aggregator service. You can sign up for a free account at <https://sentry.io/signup/?code=cookiecutter> or download and host it yourself.
|
||||||
|
The system is set up with reasonable defaults, including 404 logging and integration with the WSGI application.
|
||||||
|
|
||||||
|
You must set the DSN url in production.
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
The following details how to deploy this application.
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
See detailed [cookiecutter-django Docker documentation](http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html).
|
5
akarpov/__init__.py
Normal file
5
akarpov/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
__version__ = "0.1.0"
|
||||||
|
__version_info__ = tuple(
|
||||||
|
int(num) if num.isdigit() else num
|
||||||
|
for num in __version__.replace("-", ".", 1).split(".")
|
||||||
|
)
|
0
akarpov/blog/__init__.py
Normal file
0
akarpov/blog/__init__.py
Normal file
10
akarpov/blog/admin.py
Normal file
10
akarpov/blog/admin.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from akarpov.blog.models import Post, PostRating, Tag
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Post)
|
||||||
|
admin.site.register(Tag)
|
||||||
|
admin.site.register(PostRating)
|
13
akarpov/blog/apps.py
Normal file
13
akarpov/blog/apps.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
|
class BlogConfig(AppConfig):
|
||||||
|
name = "akarpov.blog"
|
||||||
|
verbose_name = _("Blog")
|
||||||
|
|
||||||
|
def ready(self):
|
||||||
|
try:
|
||||||
|
import akarpov.blog.signals # noqa F401
|
||||||
|
except ImportError:
|
||||||
|
pass
|
16
akarpov/blog/forms.py
Normal file
16
akarpov/blog/forms.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from ckeditor.fields import RichTextFormField
|
||||||
|
from django import forms
|
||||||
|
|
||||||
|
from akarpov.blog.models import Post, Tag
|
||||||
|
|
||||||
|
|
||||||
|
class PostForm(forms.ModelForm):
|
||||||
|
body = RichTextFormField(label="")
|
||||||
|
image = forms.ImageField(help_text="better use horizontal images", required=False)
|
||||||
|
tags = forms.ModelMultipleChoiceField(
|
||||||
|
queryset=Tag.objects.all(), widget=forms.CheckboxSelectMultiple, required=True
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Post
|
||||||
|
fields = ["title", "body", "image", "tags"]
|
90
akarpov/blog/migrations/0001_initial.py
Normal file
90
akarpov/blog/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
# Generated by Django 4.0.8 on 2022-11-23 08:30
|
||||||
|
|
||||||
|
import akarpov.utils.files
|
||||||
|
import ckeditor_uploader.fields
|
||||||
|
import colorfield.fields
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Tag',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=20, unique=True)),
|
||||||
|
('color', colorfield.fields.ColorField(blank=True, default='#FF0000', image_field=None, max_length=18, samples=None)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Post',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=100)),
|
||||||
|
('body', ckeditor_uploader.fields.RichTextUploadingField()),
|
||||||
|
('slug', models.SlugField(blank=True, max_length=20)),
|
||||||
|
('post_views', models.IntegerField(default=0)),
|
||||||
|
('rating', models.IntegerField(default=0)),
|
||||||
|
('rating_up', models.IntegerField(default=0)),
|
||||||
|
('rating_down', models.IntegerField(default=0)),
|
||||||
|
('comment_count', models.IntegerField(default=0)),
|
||||||
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('edited', models.DateTimeField(auto_now=True)),
|
||||||
|
('image', models.ImageField(blank=True, upload_to=akarpov.utils.files.user_file_upload_mixin)),
|
||||||
|
('image_cropped', models.ImageField(blank=True, upload_to='cropped/')),
|
||||||
|
('creator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='posts', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('tags', models.ManyToManyField(related_name='posts', to='blog.tag')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['-created'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Comment',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('body', models.CharField(max_length=500)),
|
||||||
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('rating', models.IntegerField(default=0)),
|
||||||
|
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='blog.comment')),
|
||||||
|
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='blog.post')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['-rating'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='PostRating',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('vote_up', models.BooleanField()),
|
||||||
|
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ratings', to='blog.post')),
|
||||||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='post_ratings', to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'unique_together': {('user', 'post')},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='CommentRating',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('vote_up', models.BooleanField()),
|
||||||
|
('comment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ratings', to='blog.comment')),
|
||||||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comment_ratings', to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'unique_together': {('comment', 'user')},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
0
akarpov/blog/migrations/__init__.py
Normal file
0
akarpov/blog/migrations/__init__.py
Normal file
118
akarpov/blog/models.py
Normal file
118
akarpov/blog/models.py
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
from ckeditor_uploader.fields import RichTextUploadingField
|
||||||
|
from colorfield.fields import ColorField
|
||||||
|
from django.db import models
|
||||||
|
from django.db.models import Count, ImageField, SlugField
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from akarpov.users.models import User
|
||||||
|
from akarpov.utils.files import user_file_upload_mixin
|
||||||
|
|
||||||
|
|
||||||
|
class Post(models.Model):
|
||||||
|
title = models.CharField(max_length=100, blank=False)
|
||||||
|
body = RichTextUploadingField(blank=False)
|
||||||
|
|
||||||
|
creator = models.ForeignKey(User, on_delete=models.CASCADE, related_name="posts")
|
||||||
|
slug = SlugField(max_length=20, blank=True)
|
||||||
|
|
||||||
|
post_views = models.IntegerField(default=0)
|
||||||
|
rating = models.IntegerField(default=0)
|
||||||
|
rating_up = models.IntegerField(default=0)
|
||||||
|
rating_down = models.IntegerField(default=0)
|
||||||
|
comment_count = models.IntegerField(default=0)
|
||||||
|
|
||||||
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
|
edited = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
image = ImageField(upload_to=user_file_upload_mixin, blank=True)
|
||||||
|
image_cropped = ImageField(upload_to="cropped/", blank=True)
|
||||||
|
|
||||||
|
tags = models.ManyToManyField("blog.Tag", related_name="posts")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
def get_rating(self):
|
||||||
|
return f"+{self.rating}" if self.rating > 0 else self.rating
|
||||||
|
|
||||||
|
def get_comments(self):
|
||||||
|
return self.comments.all()
|
||||||
|
|
||||||
|
def h_tags(self):
|
||||||
|
tags = (
|
||||||
|
Tag.objects.all()
|
||||||
|
.annotate(num_posts=Count("posts"))
|
||||||
|
.filter(posts__id=self.id)
|
||||||
|
.order_by("-num_posts")
|
||||||
|
)
|
||||||
|
return tags
|
||||||
|
|
||||||
|
def h_tag(self):
|
||||||
|
return self.h_tags().first()
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return reverse("blog:post", kwargs={"slug": self.slug})
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ["-created"]
|
||||||
|
|
||||||
|
|
||||||
|
class Tag(models.Model):
|
||||||
|
name = models.CharField(max_length=20, unique=True)
|
||||||
|
color = ColorField(blank=True, default="#FF0000")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class PostRating(models.Model):
|
||||||
|
user = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, related_name="post_ratings"
|
||||||
|
)
|
||||||
|
post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name="ratings")
|
||||||
|
|
||||||
|
vote_up = models.BooleanField(blank=False)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return (
|
||||||
|
f"{self.user}'s vote up on {self.post.title}"
|
||||||
|
if self.vote_up
|
||||||
|
else f"{self.user}'s vote down on {self.post.title}"
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ["user", "post"]
|
||||||
|
|
||||||
|
|
||||||
|
class Comment(models.Model):
|
||||||
|
parent = models.ForeignKey("self", blank=True, null=True, on_delete=models.CASCADE)
|
||||||
|
post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name="comments")
|
||||||
|
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="comments")
|
||||||
|
|
||||||
|
body = models.CharField(max_length=500)
|
||||||
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
rating = models.IntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.author.username}'s comment on {self.post.title}"
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ["-rating"]
|
||||||
|
|
||||||
|
|
||||||
|
class CommentRating(models.Model):
|
||||||
|
comment = models.ForeignKey(
|
||||||
|
Comment, on_delete=models.CASCADE, related_name="ratings"
|
||||||
|
)
|
||||||
|
user = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, related_name="comment_ratings"
|
||||||
|
)
|
||||||
|
|
||||||
|
vote_up = models.BooleanField(blank=False)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.user}'s vote up" if self.vote_up else f"{self.user}'s vote down"
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ["comment", "user"]
|
54
akarpov/blog/services.py
Normal file
54
akarpov/blog/services.py
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from akarpov.blog import models
|
||||||
|
from akarpov.users.models import User
|
||||||
|
|
||||||
|
|
||||||
|
def get_rating_bar(user: User, post):
|
||||||
|
try:
|
||||||
|
post_r = models.PostRating.objects.get(user=user, post=post)
|
||||||
|
except models.PostRating.DoesNotExist:
|
||||||
|
post_r = None
|
||||||
|
url_up = reverse("blog:rate_post_up", kwargs={"slug": post.slug})
|
||||||
|
url_down = reverse("blog:rate_post_down", kwargs={"slug": post.slug})
|
||||||
|
if post.rating > 0:
|
||||||
|
base = f"""<div class="danger
|
||||||
|
col-auto align-self-center"> +{ post.rating }</div> """
|
||||||
|
elif post.rating < 0:
|
||||||
|
base = f"""<div class="
|
||||||
|
col-auto align-self-center"> { post.rating }</div> """
|
||||||
|
else:
|
||||||
|
base = f"""<div class="gray fw-light
|
||||||
|
col-auto align-self-center"> { post.rating }</div> """
|
||||||
|
if post_r:
|
||||||
|
if post_r.vote_up:
|
||||||
|
return (
|
||||||
|
f"""<div class="row g-0 col-auto d-flex justify-content-center text-center"><form method="post"
|
||||||
|
action="{url_up}" class="col-auto align-self-center"><button
|
||||||
|
class="btn border-0 btn-small"><i style="font-size: 1rem;" class="bi
|
||||||
|
bi-arrow-up-circle-fill"></i></button></form> """
|
||||||
|
+ base
|
||||||
|
+ f"""<form method="post" action="{url_down}" class="col-auto align-self-center">
|
||||||
|
<button class="btn border-0 btn-small"><i style="font-size: 1rem;" class="bi bi-arrow-down-circle"></i>
|
||||||
|
</button></form></div>"""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return (
|
||||||
|
f"""<div class="row g-0 col-auto d-flex justify-content-center text-center">
|
||||||
|
<form method="post" action="{url_up}" class="col-auto align-self-center"><button
|
||||||
|
class="btn border-0 btn-small"><i style="font-size: 1rem;" class="bi
|
||||||
|
bi-arrow-up-circle"></i></button></form> """
|
||||||
|
+ base
|
||||||
|
+ f"""<form method="post" action="{url_down}" class="col-auto align-self-center">
|
||||||
|
<button class="btn border-0 btn-small"><i style="font-size: 1rem;" class="bi bi-arrow-down-circle-fill">
|
||||||
|
</i></button></form></div>"""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return (
|
||||||
|
f"""<div class="row g-0 col-auto d-flex justify-content-center text-center">
|
||||||
|
<form method="post" action="{url_up}" class="col-auto align-self-center"><button class="btn
|
||||||
|
border-0 btn-small"><i style="font-size: 1rem;" class="bi bi-arrow-up-circle"></i></button></form> """
|
||||||
|
+ base
|
||||||
|
+ f"""<form method="post" action="{url_down}" class="col-auto align-self-center"><button class="btn border-0
|
||||||
|
btn-small"><i style="font-size: 1rem;" class="bi bi-arrow-down-circle"></i></button></form></div>"""
|
||||||
|
)
|
77
akarpov/blog/signals.py
Normal file
77
akarpov/blog/signals.py
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
from django.db.models.signals import post_save, pre_delete, pre_save
|
||||||
|
from django.dispatch import receiver
|
||||||
|
|
||||||
|
from akarpov.blog.models import Post, PostRating, Tag
|
||||||
|
from akarpov.common.tasks import crop_model_image
|
||||||
|
from akarpov.utils.generators import generate_charset, generate_hex_color
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(pre_save, sender=Post)
|
||||||
|
def post_on_save(sender, instance: Post, **kwargs):
|
||||||
|
if instance.id is None:
|
||||||
|
slug = generate_charset(3)
|
||||||
|
while Post.objects.filter(slug=slug).exists():
|
||||||
|
slug = generate_charset(3)
|
||||||
|
instance.slug = slug
|
||||||
|
else:
|
||||||
|
previous = Post.objects.get(id=instance.id)
|
||||||
|
if previous.image != instance.image and kwargs["update_fields"] != frozenset(
|
||||||
|
{"image_cropped"}
|
||||||
|
):
|
||||||
|
if instance.image:
|
||||||
|
crop_model_image.delay(instance.pk, "blog", "Post")
|
||||||
|
else:
|
||||||
|
instance.image_cropped = None
|
||||||
|
instance.save()
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(pre_save, sender=Tag)
|
||||||
|
def tag_create(sender, instance: Tag, **kwargs):
|
||||||
|
if instance.id is None:
|
||||||
|
color = generate_hex_color()
|
||||||
|
while Tag.objects.filter(color=color).exists():
|
||||||
|
color = generate_hex_color()
|
||||||
|
instance.color = color
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(pre_save, sender=PostRating)
|
||||||
|
def post_rating(sender, instance: PostRating, **kwargs):
|
||||||
|
post = instance.post
|
||||||
|
if instance.id is None:
|
||||||
|
if instance.vote_up:
|
||||||
|
post.rating += 1
|
||||||
|
post.rating_up += 1
|
||||||
|
else:
|
||||||
|
post.rating -= 1
|
||||||
|
post.rating_down += 1
|
||||||
|
else:
|
||||||
|
previous = PostRating.objects.get(id=instance.id)
|
||||||
|
if previous.vote_up != instance.vote_up:
|
||||||
|
if previous.vote_up:
|
||||||
|
post.rating -= 2
|
||||||
|
post.rating_up -= 1
|
||||||
|
post.rating_down += 1
|
||||||
|
else:
|
||||||
|
post.rating += 2
|
||||||
|
post.rating_up += 1
|
||||||
|
post.rating_down -= 1
|
||||||
|
post.save()
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(pre_delete, sender=PostRating)
|
||||||
|
def post_rating_delete(sender, instance: PostRating, **kwargs):
|
||||||
|
post = instance.post
|
||||||
|
if instance.vote_up:
|
||||||
|
post.rating -= 1
|
||||||
|
post.rating_up -= 1
|
||||||
|
else:
|
||||||
|
post.rating += 1
|
||||||
|
post.rating_down -= 1
|
||||||
|
post.save()
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(post_save, sender=Post)
|
||||||
|
def post_on_create(sender, instance: Post, created, **kwargs):
|
||||||
|
if created:
|
||||||
|
if instance.image:
|
||||||
|
crop_model_image.delay(instance.pk, "blog", "Post")
|
22
akarpov/blog/urls.py
Normal file
22
akarpov/blog/urls.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from akarpov.blog.views import (
|
||||||
|
comment,
|
||||||
|
post_create_view,
|
||||||
|
post_detail_view,
|
||||||
|
post_list_view,
|
||||||
|
post_update_view,
|
||||||
|
rate_post_down,
|
||||||
|
rate_post_up,
|
||||||
|
)
|
||||||
|
|
||||||
|
app_name = "blog"
|
||||||
|
urlpatterns = [
|
||||||
|
path("", post_list_view, name="post_list"),
|
||||||
|
path("<str:slug>", post_detail_view, name="post"),
|
||||||
|
path("create/", post_create_view, name="post_create"),
|
||||||
|
path("<str:slug>/edit", post_update_view, name="post_edit"),
|
||||||
|
path("<str:slug>/comment", comment, name="comment"),
|
||||||
|
path("<str:slug>/rate_up", rate_post_up, name="rate_post_up"),
|
||||||
|
path("<str:slug>/rate_down", rate_post_down, name="rate_post_down"),
|
||||||
|
]
|
132
akarpov/blog/views.py
Normal file
132
akarpov/blog/views.py
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
from django.shortcuts import get_object_or_404
|
||||||
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.views.generic import CreateView, DetailView, ListView, UpdateView
|
||||||
|
|
||||||
|
from akarpov.blog.forms import PostForm
|
||||||
|
from akarpov.blog.models import Comment, Post, PostRating
|
||||||
|
from akarpov.blog.services import get_rating_bar
|
||||||
|
|
||||||
|
|
||||||
|
class PostDetailView(DetailView):
|
||||||
|
model = Post
|
||||||
|
slug_field = "slug"
|
||||||
|
slug_url_kwarg = "slug"
|
||||||
|
template_name = "blog/post.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
# that's kind of trash code, but CBS forced me to do so
|
||||||
|
post = self.get_object()
|
||||||
|
post.post_views += 1
|
||||||
|
post.save(update_fields=["post_views"])
|
||||||
|
|
||||||
|
if self.request.user.is_authenticated:
|
||||||
|
context["rating_bar"] = get_rating_bar(self.request.user, post)
|
||||||
|
else:
|
||||||
|
context["rating_bar"] = None
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
post_detail_view = PostDetailView.as_view()
|
||||||
|
|
||||||
|
|
||||||
|
class PostListView(ListView):
|
||||||
|
model = Post
|
||||||
|
template_name = "blog/list.html"
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
try:
|
||||||
|
posts = Post.objects.all()
|
||||||
|
params = self.request.GET
|
||||||
|
if "tag" in params:
|
||||||
|
posts = posts.filter(tags__name=params["tag"])
|
||||||
|
return posts
|
||||||
|
except Post.DoesNotExist:
|
||||||
|
return Post.objects.none()
|
||||||
|
|
||||||
|
|
||||||
|
post_list_view = PostListView.as_view()
|
||||||
|
|
||||||
|
|
||||||
|
class PostUpdateView(LoginRequiredMixin, UpdateView):
|
||||||
|
model = Post
|
||||||
|
form_class = PostForm
|
||||||
|
|
||||||
|
def get_object(self):
|
||||||
|
return get_object_or_404(Post, slug=self.kwargs["slug"])
|
||||||
|
|
||||||
|
template_name = "blog/form.html"
|
||||||
|
|
||||||
|
|
||||||
|
post_update_view = PostUpdateView.as_view()
|
||||||
|
|
||||||
|
|
||||||
|
class PostCreateView(LoginRequiredMixin, CreateView):
|
||||||
|
model = Post
|
||||||
|
form_class = PostForm
|
||||||
|
|
||||||
|
template_name = "blog/form.html"
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
form.instance.creator = self.request.user
|
||||||
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
|
||||||
|
post_create_view = PostCreateView.as_view()
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
def rate_post_up(request, slug):
|
||||||
|
if request.method == "POST":
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
post = get_object_or_404(Post, slug=slug)
|
||||||
|
try:
|
||||||
|
post_r = PostRating.objects.get(user=request.user, post=post)
|
||||||
|
except PostRating.DoesNotExist:
|
||||||
|
post_r = None
|
||||||
|
if post_r:
|
||||||
|
if post_r.vote_up:
|
||||||
|
post_r.delete()
|
||||||
|
else:
|
||||||
|
post_r.vote_up = not post_r.vote_up
|
||||||
|
post_r.save()
|
||||||
|
else:
|
||||||
|
PostRating.objects.create(user=request.user, post=post, vote_up=True)
|
||||||
|
return HttpResponseRedirect(f"/{slug}" + "#rating")
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
def rate_post_down(request, slug):
|
||||||
|
if request.method == "POST":
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
post = get_object_or_404(Post, slug=slug)
|
||||||
|
try:
|
||||||
|
post_r = PostRating.objects.get(user=request.user, post=post)
|
||||||
|
except PostRating.DoesNotExist:
|
||||||
|
post_r = None
|
||||||
|
if post_r:
|
||||||
|
if not post_r.vote_up:
|
||||||
|
post_r.delete()
|
||||||
|
else:
|
||||||
|
post_r.vote_up = not post_r.vote_up
|
||||||
|
post_r.save()
|
||||||
|
else:
|
||||||
|
PostRating.objects.create(user=request.user, post=post, vote_up=False)
|
||||||
|
return HttpResponseRedirect(f"/{slug}" + "#rating")
|
||||||
|
|
||||||
|
|
||||||
|
def comment(request, slug):
|
||||||
|
if request.method == "POST":
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
post = get_object_or_404(Post, slug=slug)
|
||||||
|
if "body" not in request.POST or len(request.POST["body"]) > 100:
|
||||||
|
raise ValidationError("incorrect body")
|
||||||
|
Comment.objects.create(
|
||||||
|
post=post, author=request.user, body=request.POST["body"]
|
||||||
|
)
|
||||||
|
|
||||||
|
return HttpResponseRedirect(f"/{slug}" + "#comments")
|
0
akarpov/common/__init__.py
Normal file
0
akarpov/common/__init__.py
Normal file
19
akarpov/common/api.py
Normal file
19
akarpov/common/api.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
from rest_framework.pagination import PageNumberPagination
|
||||||
|
|
||||||
|
|
||||||
|
class SmallResultsSetPagination(PageNumberPagination):
|
||||||
|
page_size = 10
|
||||||
|
page_size_query_param = "page_size"
|
||||||
|
max_page_size = 100
|
||||||
|
|
||||||
|
|
||||||
|
class StandardResultsSetPagination(PageNumberPagination):
|
||||||
|
page_size = 50
|
||||||
|
page_size_query_param = "page_size"
|
||||||
|
max_page_size = 200
|
||||||
|
|
||||||
|
|
||||||
|
class BigResultsSetPagination(PageNumberPagination):
|
||||||
|
page_size = 100
|
||||||
|
page_size_query_param = "page_size"
|
||||||
|
max_page_size = 1000
|
18
akarpov/common/tasks.py
Normal file
18
akarpov/common/tasks.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
from celery import shared_task
|
||||||
|
from django.apps import apps
|
||||||
|
from django.core.files import File
|
||||||
|
|
||||||
|
from akarpov.utils.files import crop_image
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task()
|
||||||
|
def crop_model_image(pk: int, app_label: str, model_name: str):
|
||||||
|
model = apps.get_model(app_label=app_label, model_name=model_name)
|
||||||
|
instance = model.objects.get(pk=pk)
|
||||||
|
instance.image_cropped.save(
|
||||||
|
instance.image.path.split(".")[0].split("/")[-1] + ".png",
|
||||||
|
File(crop_image(instance.image.path, cut_to=(250, 250))),
|
||||||
|
save=False,
|
||||||
|
)
|
||||||
|
instance.save(update_fields=["image_cropped"])
|
||||||
|
return pk
|
14
akarpov/conftest.py
Normal file
14
akarpov/conftest.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from akarpov.users.models import User
|
||||||
|
from akarpov.users.tests.factories import UserFactory
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def media_storage(settings, tmpdir):
|
||||||
|
settings.MEDIA_ROOT = tmpdir.strpath
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def user(db) -> User:
|
||||||
|
return UserFactory()
|
5
akarpov/contrib/__init__.py
Normal file
5
akarpov/contrib/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
"""
|
||||||
|
To understand why this file is here, please read:
|
||||||
|
|
||||||
|
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||||
|
"""
|
5
akarpov/contrib/sites/__init__.py
Normal file
5
akarpov/contrib/sites/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
"""
|
||||||
|
To understand why this file is here, please read:
|
||||||
|
|
||||||
|
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||||
|
"""
|
42
akarpov/contrib/sites/migrations/0001_initial.py
Normal file
42
akarpov/contrib/sites/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import django.contrib.sites.models
|
||||||
|
from django.contrib.sites.models import _simple_domain_name_validator
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Site",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.AutoField(
|
||||||
|
verbose_name="ID",
|
||||||
|
serialize=False,
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"domain",
|
||||||
|
models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
verbose_name="domain name",
|
||||||
|
validators=[_simple_domain_name_validator],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("name", models.CharField(max_length=50, verbose_name="display name")),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"ordering": ("domain",),
|
||||||
|
"db_table": "django_site",
|
||||||
|
"verbose_name": "site",
|
||||||
|
"verbose_name_plural": "sites",
|
||||||
|
},
|
||||||
|
bases=(models.Model,),
|
||||||
|
managers=[("objects", django.contrib.sites.models.SiteManager())],
|
||||||
|
)
|
||||||
|
]
|
20
akarpov/contrib/sites/migrations/0002_alter_domain_unique.py
Normal file
20
akarpov/contrib/sites/migrations/0002_alter_domain_unique.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import django.contrib.sites.models
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [("sites", "0001_initial")]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="site",
|
||||||
|
name="domain",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
unique=True,
|
||||||
|
validators=[django.contrib.sites.models._simple_domain_name_validator],
|
||||||
|
verbose_name="domain name",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]
|
|
@ -0,0 +1,63 @@
|
||||||
|
"""
|
||||||
|
To understand why this file is here, please read:
|
||||||
|
|
||||||
|
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||||
|
"""
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def _update_or_create_site_with_sequence(site_model, connection, domain, name):
|
||||||
|
"""Update or create the site with default ID and keep the DB sequence in sync."""
|
||||||
|
site, created = site_model.objects.update_or_create(
|
||||||
|
id=settings.SITE_ID,
|
||||||
|
defaults={
|
||||||
|
"domain": domain,
|
||||||
|
"name": name,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if created:
|
||||||
|
# We provided the ID explicitly when creating the Site entry, therefore the DB
|
||||||
|
# sequence to auto-generate them wasn't used and is now out of sync. If we
|
||||||
|
# don't do anything, we'll get a unique constraint violation the next time a
|
||||||
|
# site is created.
|
||||||
|
# To avoid this, we need to manually update DB sequence and make sure it's
|
||||||
|
# greater than the maximum value.
|
||||||
|
max_id = site_model.objects.order_by('-id').first().id
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
cursor.execute("SELECT last_value from django_site_id_seq")
|
||||||
|
(current_id,) = cursor.fetchone()
|
||||||
|
if current_id <= max_id:
|
||||||
|
cursor.execute(
|
||||||
|
"alter sequence django_site_id_seq restart with %s",
|
||||||
|
[max_id + 1],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def update_site_forward(apps, schema_editor):
|
||||||
|
"""Set site domain and name."""
|
||||||
|
Site = apps.get_model("sites", "Site")
|
||||||
|
_update_or_create_site_with_sequence(
|
||||||
|
Site,
|
||||||
|
schema_editor.connection,
|
||||||
|
"akarpov.ru",
|
||||||
|
"akarpov",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def update_site_backward(apps, schema_editor):
|
||||||
|
"""Revert site domain and name to default."""
|
||||||
|
Site = apps.get_model("sites", "Site")
|
||||||
|
_update_or_create_site_with_sequence(
|
||||||
|
Site,
|
||||||
|
schema_editor.connection,
|
||||||
|
"example.com",
|
||||||
|
"example.com",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [("sites", "0002_alter_domain_unique")]
|
||||||
|
|
||||||
|
operations = [migrations.RunPython(update_site_forward, update_site_backward)]
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Generated by Django 3.1.7 on 2021-02-04 14:49
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("sites", "0003_set_site_domain_and_name"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="site",
|
||||||
|
options={
|
||||||
|
"ordering": ["domain"],
|
||||||
|
"verbose_name": "site",
|
||||||
|
"verbose_name_plural": "sites",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
5
akarpov/contrib/sites/migrations/__init__.py
Normal file
5
akarpov/contrib/sites/migrations/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
"""
|
||||||
|
To understand why this file is here, please read:
|
||||||
|
|
||||||
|
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||||
|
"""
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*
|
||||||
|
This is part of jsdifflib v1.0. <http://github.com/cemerick/jsdifflib>
|
||||||
|
|
||||||
|
Copyright 2007 - 2011 Chas Emerick <cemerick@snowtide.com>. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY Chas Emerick ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Chas Emerick OR
|
||||||
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
The views and conclusions contained in the software and documentation are those of the
|
||||||
|
authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
or implied, of Chas Emerick.
|
||||||
|
*/
|
||||||
|
.diffContent {
|
||||||
|
height: 300px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
.diff * {
|
||||||
|
white-space: pre-wrap!important;
|
||||||
|
}
|
||||||
|
table.diff {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border: 1px solid darkgray
|
||||||
|
}
|
||||||
|
table.diff tbody {
|
||||||
|
font-family: Courier, monospace;
|
||||||
|
}
|
||||||
|
table.diff tbody th {
|
||||||
|
font-family: verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
|
||||||
|
background: #EED;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: normal;
|
||||||
|
border: 1px solid #BBC;
|
||||||
|
color: #886;
|
||||||
|
padding: .3em .5em .1em 2em;
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
table.diff thead {
|
||||||
|
border-bottom: 1px solid #BBC;
|
||||||
|
background: #EFEFEF;
|
||||||
|
font-family: Verdana;
|
||||||
|
}
|
||||||
|
table.diff thead th.texttitle {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
table.diff tbody td {
|
||||||
|
padding:0 .4em;
|
||||||
|
vertical-align: top;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
table.diff .empty {
|
||||||
|
background-color:#DDD;
|
||||||
|
}
|
||||||
|
table.diff .replace {
|
||||||
|
background-color: #FFC;
|
||||||
|
}
|
||||||
|
table.diff .delete {
|
||||||
|
background-color: #FCC;
|
||||||
|
width: 380px;
|
||||||
|
-ms-word-break: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
table.diff .skip {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
border: 1px solid #AAA;
|
||||||
|
border-right: 1px solid #BBC;
|
||||||
|
}
|
||||||
|
table.diff .insert {
|
||||||
|
background-color: #CFC;
|
||||||
|
width: 380px;
|
||||||
|
-ms-word-break: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
table.diff th.author {
|
||||||
|
text-align: right;
|
||||||
|
border-top: 1px solid #BBC;
|
||||||
|
background: #EFEFEF
|
||||||
|
}
|
||||||
|
del {
|
||||||
|
background-color: #EE9999 !important;
|
||||||
|
text-decoration: underline !important;
|
||||||
|
}
|
||||||
|
ins {
|
||||||
|
background-color: #99EE99 !important;
|
||||||
|
text-decoration: underline !important;
|
||||||
|
}
|
||||||
|
a.cke_dialog_autosave_ok span {
|
||||||
|
width: auto !important;
|
||||||
|
}
|
||||||
|
div.autoSaveMessage div {
|
||||||
|
left: 42%;
|
||||||
|
position: absolute;
|
||||||
|
padding: 2px;
|
||||||
|
top: 4px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.cke .hidden {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.cke .show {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
-moz-transition: visibility 0.2s linear, opacity 0.2s linear;
|
||||||
|
-o-transition: visibility 0.2s linear, opacity 0.2s linear;
|
||||||
|
-webkit-transition: visibility 0.2s linear, opacity 0.2s linear;
|
||||||
|
transition: visibility 0.2s linear, opacity 0.2s linear;
|
||||||
|
}
|
1
akarpov/static/ckeditor/ckeditor/plugins/autosave/css/autosave.min.css
vendored
Normal file
1
akarpov/static/ckeditor/ckeditor/plugins/autosave/css/autosave.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.diffContent{height:300px;overflow:auto}.diff *{white-space:pre-wrap!important}table.diff{border-collapse:collapse;border:1px solid #a9a9a9}table.diff tbody{font-family:Courier,monospace}table.diff tbody th{font-family:verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;background:#eed;font-size:11px;font-weight:400;border:1px solid #bbc;color:#886;padding:.3em .5em .1em 2em;text-align:right;vertical-align:top}table.diff thead{border-bottom:1px solid #bbc;background:#efefef;font-family:Verdana}table.diff thead th.texttitle{text-align:left}table.diff tbody td{padding:0 .4em;vertical-align:top;word-break:break-word}table.diff .empty{background-color:#ddd}table.diff .replace{background-color:#ffc}table.diff .delete{background-color:#fcc;width:380px;-ms-word-break:break-word;word-break:break-word}table.diff .skip{background-color:#efefef;border:1px solid #aaa;border-right:1px solid #bbc}table.diff .insert{background-color:#cfc;width:380px;-ms-word-break:break-word;word-break:break-word}table.diff th.author{text-align:right;border-top:1px solid #bbc;background:#efefef}del{background-color:#e99!important;text-decoration:underline!important}ins{background-color:#9e9!important;text-decoration:underline!important}a.cke_dialog_autosave_ok span{width:auto!important}div.autoSaveMessage div{left:42%;position:absolute;padding:2px;top:4px;font-weight:700}.cke .hidden{opacity:0;visibility:hidden}.cke .show{opacity:1;visibility:visible;-moz-transition:visibility .2s linear,opacity .2s linear;-o-transition:visibility .2s linear,opacity .2s linear;-webkit-transition:visibility .2s linear,opacity .2s linear;transition:visibility .2s linear,opacity .2s linear}
|
396
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/difflib.js
Normal file
396
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/difflib.js
Normal file
|
@ -0,0 +1,396 @@
|
||||||
|
/***
|
||||||
|
This is part of jsdifflib v1.0. <http://snowtide.com/jsdifflib>
|
||||||
|
|
||||||
|
Copyright (c) 2007, Snowtide Informatics Systems, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the Snowtide Informatics Systems nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGE.
|
||||||
|
***/
|
||||||
|
/* Author: Chas Emerick <cemerick@snowtide.com> */
|
||||||
|
__whitespace = {" ":true, "\t":true, "\n":true, "\f":true, "\r":true};
|
||||||
|
|
||||||
|
difflib = {
|
||||||
|
defaultJunkFunction: function (c) {
|
||||||
|
return c in __whitespace;
|
||||||
|
},
|
||||||
|
|
||||||
|
stripLinebreaks: function (str) { return str.replace(/^[\n\r]*|[\n\r]*$/g, ""); },
|
||||||
|
|
||||||
|
stringAsLines: function (str) {
|
||||||
|
var lfpos = str.indexOf("\n");
|
||||||
|
var crpos = str.indexOf("\r");
|
||||||
|
var linebreak = ((lfpos > -1 && crpos > -1) || crpos < 0) ? "\n" : "\r";
|
||||||
|
|
||||||
|
var lines = str.split(linebreak);
|
||||||
|
for (var i = 0; i < lines.length; i++) {
|
||||||
|
lines[i] = difflib.stripLinebreaks(lines[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
|
},
|
||||||
|
|
||||||
|
// iteration-based reduce implementation
|
||||||
|
__reduce: function (func, list, initial) {
|
||||||
|
if (initial != null) {
|
||||||
|
var value = initial;
|
||||||
|
var idx = 0;
|
||||||
|
} else if (list) {
|
||||||
|
var value = list[0];
|
||||||
|
var idx = 1;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; idx < list.length; idx++) {
|
||||||
|
value = func(value, list[idx]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
|
||||||
|
// comparison function for sorting lists of numeric tuples
|
||||||
|
__ntuplecomp: function (a, b) {
|
||||||
|
var mlen = Math.max(a.length, b.length);
|
||||||
|
for (var i = 0; i < mlen; i++) {
|
||||||
|
if (a[i] < b[i]) return -1;
|
||||||
|
if (a[i] > b[i]) return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return a.length == b.length ? 0 : (a.length < b.length ? -1 : 1);
|
||||||
|
},
|
||||||
|
|
||||||
|
__calculate_ratio: function (matches, length) {
|
||||||
|
return length ? 2.0 * matches / length : 1.0;
|
||||||
|
},
|
||||||
|
|
||||||
|
// returns a function that returns true if a key passed to the returned function
|
||||||
|
// is in the dict (js object) provided to this function; replaces being able to
|
||||||
|
// carry around dict.has_key in python...
|
||||||
|
__isindict: function (dict) {
|
||||||
|
return function (key) { return key in dict; };
|
||||||
|
},
|
||||||
|
|
||||||
|
// replacement for python's dict.get function -- need easy default values
|
||||||
|
__dictget: function (dict, key, defaultValue) {
|
||||||
|
return key in dict ? dict[key] : defaultValue;
|
||||||
|
},
|
||||||
|
|
||||||
|
SequenceMatcher: function (a, b, isjunk) {
|
||||||
|
this.set_seqs = function (a, b) {
|
||||||
|
this.set_seq1(a);
|
||||||
|
this.set_seq2(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set_seq1 = function (a) {
|
||||||
|
if (a == this.a) return;
|
||||||
|
this.a = a;
|
||||||
|
this.matching_blocks = this.opcodes = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set_seq2 = function (b) {
|
||||||
|
if (b == this.b) return;
|
||||||
|
this.b = b;
|
||||||
|
this.matching_blocks = this.opcodes = this.fullbcount = null;
|
||||||
|
this.__chain_b();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.__chain_b = function () {
|
||||||
|
var b = this.b;
|
||||||
|
var n = b.length;
|
||||||
|
var b2j = this.b2j = {};
|
||||||
|
var populardict = {};
|
||||||
|
for (var i = 0; i < b.length; i++) {
|
||||||
|
var elt = b[i];
|
||||||
|
if (elt in b2j) {
|
||||||
|
var indices = b2j[elt];
|
||||||
|
if (n >= 200 && indices.length * 100 > n) {
|
||||||
|
populardict[elt] = 1;
|
||||||
|
delete b2j[elt];
|
||||||
|
} else {
|
||||||
|
indices.push(i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b2j[elt] = [i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var elt in populardict)
|
||||||
|
delete b2j[elt];
|
||||||
|
|
||||||
|
var isjunk = this.isjunk;
|
||||||
|
var junkdict = {};
|
||||||
|
if (isjunk) {
|
||||||
|
for (var elt in populardict) {
|
||||||
|
if (isjunk(elt)) {
|
||||||
|
junkdict[elt] = 1;
|
||||||
|
delete populardict[elt];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var elt in b2j) {
|
||||||
|
if (isjunk(elt)) {
|
||||||
|
junkdict[elt] = 1;
|
||||||
|
delete b2j[elt];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isbjunk = difflib.__isindict(junkdict);
|
||||||
|
this.isbpopular = difflib.__isindict(populardict);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.find_longest_match = function (alo, ahi, blo, bhi) {
|
||||||
|
var a = this.a;
|
||||||
|
var b = this.b;
|
||||||
|
var b2j = this.b2j;
|
||||||
|
var isbjunk = this.isbjunk;
|
||||||
|
var besti = alo;
|
||||||
|
var bestj = blo;
|
||||||
|
var bestsize = 0;
|
||||||
|
var j = null;
|
||||||
|
|
||||||
|
var j2len = {};
|
||||||
|
var nothing = [];
|
||||||
|
for (var i = alo; i < ahi; i++) {
|
||||||
|
var newj2len = {};
|
||||||
|
var jdict = difflib.__dictget(b2j, a[i], nothing);
|
||||||
|
for (var jkey in jdict) {
|
||||||
|
j = jdict[jkey];
|
||||||
|
if (j < blo) continue;
|
||||||
|
if (j >= bhi) break;
|
||||||
|
newj2len[j] = k = difflib.__dictget(j2len, j - 1, 0) + 1;
|
||||||
|
if (k > bestsize) {
|
||||||
|
besti = i - k + 1;
|
||||||
|
bestj = j - k + 1;
|
||||||
|
bestsize = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
j2len = newj2len;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (besti > alo && bestj > blo && !isbjunk(b[bestj - 1]) && a[besti - 1] == b[bestj - 1]) {
|
||||||
|
besti--;
|
||||||
|
bestj--;
|
||||||
|
bestsize++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (besti + bestsize < ahi && bestj + bestsize < bhi &&
|
||||||
|
!isbjunk(b[bestj + bestsize]) &&
|
||||||
|
a[besti + bestsize] == b[bestj + bestsize]) {
|
||||||
|
bestsize++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (besti > alo && bestj > blo && isbjunk(b[bestj - 1]) && a[besti - 1] == b[bestj - 1]) {
|
||||||
|
besti--;
|
||||||
|
bestj--;
|
||||||
|
bestsize++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (besti + bestsize < ahi && bestj + bestsize < bhi && isbjunk(b[bestj + bestsize]) &&
|
||||||
|
a[besti + bestsize] == b[bestj + bestsize]) {
|
||||||
|
bestsize++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [besti, bestj, bestsize];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.get_matching_blocks = function () {
|
||||||
|
if (this.matching_blocks != null) return this.matching_blocks;
|
||||||
|
var la = this.a.length;
|
||||||
|
var lb = this.b.length;
|
||||||
|
|
||||||
|
var queue = [[0, la, 0, lb]];
|
||||||
|
var matching_blocks = [];
|
||||||
|
var alo, ahi, blo, bhi, qi, i, j, k, x;
|
||||||
|
while (queue.length) {
|
||||||
|
qi = queue.pop();
|
||||||
|
alo = qi[0];
|
||||||
|
ahi = qi[1];
|
||||||
|
blo = qi[2];
|
||||||
|
bhi = qi[3];
|
||||||
|
x = this.find_longest_match(alo, ahi, blo, bhi);
|
||||||
|
i = x[0];
|
||||||
|
j = x[1];
|
||||||
|
k = x[2];
|
||||||
|
|
||||||
|
if (k) {
|
||||||
|
matching_blocks.push(x);
|
||||||
|
if (alo < i && blo < j)
|
||||||
|
queue.push([alo, i, blo, j]);
|
||||||
|
if (i+k < ahi && j+k < bhi)
|
||||||
|
queue.push([i + k, ahi, j + k, bhi]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matching_blocks.sort(difflib.__ntuplecomp);
|
||||||
|
|
||||||
|
var i1 = j1 = k1 = block = 0;
|
||||||
|
var non_adjacent = [];
|
||||||
|
for (var idx in matching_blocks) {
|
||||||
|
block = matching_blocks[idx];
|
||||||
|
i2 = block[0];
|
||||||
|
j2 = block[1];
|
||||||
|
k2 = block[2];
|
||||||
|
if (i1 + k1 == i2 && j1 + k1 == j2) {
|
||||||
|
k1 += k2;
|
||||||
|
} else {
|
||||||
|
if (k1) non_adjacent.push([i1, j1, k1]);
|
||||||
|
i1 = i2;
|
||||||
|
j1 = j2;
|
||||||
|
k1 = k2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k1) non_adjacent.push([i1, j1, k1]);
|
||||||
|
|
||||||
|
non_adjacent.push([la, lb, 0]);
|
||||||
|
this.matching_blocks = non_adjacent;
|
||||||
|
return this.matching_blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.get_opcodes = function () {
|
||||||
|
if (this.opcodes != null) return this.opcodes;
|
||||||
|
var i = 0;
|
||||||
|
var j = 0;
|
||||||
|
var answer = [];
|
||||||
|
this.opcodes = answer;
|
||||||
|
var block, ai, bj, size, tag;
|
||||||
|
var blocks = this.get_matching_blocks();
|
||||||
|
for (var idx in blocks) {
|
||||||
|
block = blocks[idx];
|
||||||
|
ai = block[0];
|
||||||
|
bj = block[1];
|
||||||
|
size = block[2];
|
||||||
|
tag = '';
|
||||||
|
if (i < ai && j < bj) {
|
||||||
|
tag = 'replace';
|
||||||
|
} else if (i < ai) {
|
||||||
|
tag = 'delete';
|
||||||
|
} else if (j < bj) {
|
||||||
|
tag = 'insert';
|
||||||
|
}
|
||||||
|
if (tag) answer.push([tag, i, ai, j, bj]);
|
||||||
|
i = ai + size;
|
||||||
|
j = bj + size;
|
||||||
|
|
||||||
|
if (size) answer.push(['equal', ai, i, bj, j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is a generator function in the python lib, which of course is not supported in javascript
|
||||||
|
// the reimplementation builds up the grouped opcodes into a list in their entirety and returns that.
|
||||||
|
this.get_grouped_opcodes = function (n) {
|
||||||
|
if (!n) n = 3;
|
||||||
|
var codes = this.get_opcodes();
|
||||||
|
if (!codes) codes = [["equal", 0, 1, 0, 1]];
|
||||||
|
var code, tag, i1, i2, j1, j2;
|
||||||
|
if (codes[0][0] == 'equal') {
|
||||||
|
code = codes[0];
|
||||||
|
tag = code[0];
|
||||||
|
i1 = code[1];
|
||||||
|
i2 = code[2];
|
||||||
|
j1 = code[3];
|
||||||
|
j2 = code[4];
|
||||||
|
codes[0] = [tag, Math.max(i1, i2 - n), i2, Math.max(j1, j2 - n), j2];
|
||||||
|
}
|
||||||
|
if (codes[codes.length - 1][0] == 'equal') {
|
||||||
|
code = codes[codes.length - 1];
|
||||||
|
tag = code[0];
|
||||||
|
i1 = code[1];
|
||||||
|
i2 = code[2];
|
||||||
|
j1 = code[3];
|
||||||
|
j2 = code[4];
|
||||||
|
codes[codes.length - 1] = [tag, i1, Math.min(i2, i1 + n), j1, Math.min(j2, j1 + n)];
|
||||||
|
}
|
||||||
|
|
||||||
|
var nn = n + n;
|
||||||
|
var groups = [];
|
||||||
|
for (var idx in codes) {
|
||||||
|
code = codes[idx];
|
||||||
|
tag = code[0];
|
||||||
|
i1 = code[1];
|
||||||
|
i2 = code[2];
|
||||||
|
j1 = code[3];
|
||||||
|
j2 = code[4];
|
||||||
|
if (tag == 'equal' && i2 - i1 > nn) {
|
||||||
|
groups.push([tag, i1, Math.min(i2, i1 + n), j1, Math.min(j2, j1 + n)]);
|
||||||
|
i1 = Math.max(i1, i2-n);
|
||||||
|
j1 = Math.max(j1, j2-n);
|
||||||
|
}
|
||||||
|
|
||||||
|
groups.push([tag, i1, i2, j1, j2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groups && groups[groups.length - 1][0] == 'equal') groups.pop();
|
||||||
|
|
||||||
|
return groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ratio = function () {
|
||||||
|
matches = difflib.__reduce(
|
||||||
|
function (sum, triple) { return sum + triple[triple.length - 1]; },
|
||||||
|
this.get_matching_blocks(), 0);
|
||||||
|
return difflib.__calculate_ratio(matches, this.a.length + this.b.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.quick_ratio = function () {
|
||||||
|
var fullbcount, elt;
|
||||||
|
if (this.fullbcount == null) {
|
||||||
|
this.fullbcount = fullbcount = {};
|
||||||
|
for (var i = 0; i < this.b.length; i++) {
|
||||||
|
elt = this.b[i];
|
||||||
|
fullbcount[elt] = difflib.__dictget(fullbcount, elt, 0) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fullbcount = this.fullbcount;
|
||||||
|
|
||||||
|
var avail = {};
|
||||||
|
var availhas = difflib.__isindict(avail);
|
||||||
|
var matches = numb = 0;
|
||||||
|
for (var i = 0; i < this.a.length; i++) {
|
||||||
|
elt = this.a[i];
|
||||||
|
if (availhas(elt)) {
|
||||||
|
numb = avail[elt];
|
||||||
|
} else {
|
||||||
|
numb = difflib.__dictget(fullbcount, elt, 0);
|
||||||
|
}
|
||||||
|
avail[elt] = numb - 1;
|
||||||
|
if (numb > 0) matches++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return difflib.__calculate_ratio(matches, this.a.length + this.b.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.real_quick_ratio = function () {
|
||||||
|
var la = this.a.length;
|
||||||
|
var lb = this.b.length;
|
||||||
|
return _calculate_ratio(Math.min(la, lb), la + lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isjunk = isjunk ? isjunk : difflib.defaultJunkFunction;
|
||||||
|
this.a = this.b = null;
|
||||||
|
this.set_seqs(a, b);
|
||||||
|
}
|
||||||
|
}
|
203
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/diffview.js
Normal file
203
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/diffview.js
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
/***
|
||||||
|
This is part of jsdifflib v1.0. <http://snowtide.com/jsdifflib>
|
||||||
|
|
||||||
|
Copyright (c) 2007, Snowtide Informatics Systems, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the Snowtide Informatics Systems nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGE.
|
||||||
|
***/
|
||||||
|
/* Author: Chas Emerick <cemerick@snowtide.com> */
|
||||||
|
/* Modified by Richard Bondi http://richardbondi.net */
|
||||||
|
diffview = {
|
||||||
|
/**
|
||||||
|
* Builds and returns a visual diff view. The single parameter, `params', should contain
|
||||||
|
* the following values:
|
||||||
|
*
|
||||||
|
* - baseTextLines: the array of strings that was used as the base text input to SequenceMatcher
|
||||||
|
* - newTextLines: the array of strings that was used as the new text input to SequenceMatcher
|
||||||
|
* - opcodes: the array of arrays returned by SequenceMatcher.get_opcodes()
|
||||||
|
* - baseTextName: the title to be displayed above the base text listing in the diff view; defaults
|
||||||
|
* to "Base Text"
|
||||||
|
* - newTextName: the title to be displayed above the new text listing in the diff view; defaults
|
||||||
|
* to "New Text"
|
||||||
|
* - contextSize: the number of lines of context to show around differences; by default, all lines
|
||||||
|
* are shown
|
||||||
|
* - viewType: if 0, a side-by-side diff view is generated (default); if 1, an inline diff view is
|
||||||
|
* generated
|
||||||
|
*/
|
||||||
|
buildView: function (params) {
|
||||||
|
var baseTextLines = params.baseTextLines;
|
||||||
|
var newTextLines = params.newTextLines;
|
||||||
|
var opcodes = params.opcodes;
|
||||||
|
var baseTextName = params.baseTextName ? params.baseTextName : "Base Text";
|
||||||
|
var newTextName = params.newTextName ? params.newTextName : "New Text";
|
||||||
|
var contextSize = params.contextSize;
|
||||||
|
var inline = (params.viewType == 0 || params.viewType == 1) ? params.viewType : 0;
|
||||||
|
|
||||||
|
if (baseTextLines == null)
|
||||||
|
throw "Cannot build diff view; baseTextLines is not defined.";
|
||||||
|
if (newTextLines == null)
|
||||||
|
throw "Cannot build diff view; newTextLines is not defined.";
|
||||||
|
if (!opcodes)
|
||||||
|
throw "Canno build diff view; opcodes is not defined.";
|
||||||
|
|
||||||
|
function celt (name, clazz) {
|
||||||
|
var e = document.createElement(name);
|
||||||
|
e.className = clazz;
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
function telt (name, text) {
|
||||||
|
var e = document.createElement(name);
|
||||||
|
e.appendChild(document.createTextNode(text));
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ctelt (name, clazz, text) {
|
||||||
|
var e = document.createElement(name);
|
||||||
|
e.className = clazz;
|
||||||
|
e.innerHTML = text;
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tdata = document.createElement("thead");
|
||||||
|
var node = document.createElement("tr");
|
||||||
|
tdata.appendChild(node);
|
||||||
|
if (inline) {
|
||||||
|
node.appendChild(document.createElement("th"));
|
||||||
|
node.appendChild(document.createElement("th"));
|
||||||
|
node.appendChild(ctelt("th", "texttitle", baseTextName + " vs. " + newTextName));
|
||||||
|
} else {
|
||||||
|
node.appendChild(document.createElement("th"));
|
||||||
|
node.appendChild(ctelt("th", "texttitle", baseTextName));
|
||||||
|
node.appendChild(document.createElement("th"));
|
||||||
|
node.appendChild(ctelt("th", "texttitle", newTextName));
|
||||||
|
}
|
||||||
|
tdata = [tdata];
|
||||||
|
|
||||||
|
var rows = [];
|
||||||
|
var node2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds two cells to the given row; if the given row corresponds to a real
|
||||||
|
* line number (based on the line index tidx and the endpoint of the
|
||||||
|
* range in question tend), then the cells will contain the line number
|
||||||
|
* and the line of text from textLines at position tidx (with the class of
|
||||||
|
* the second cell set to the name of the change represented), and tidx + 1 will
|
||||||
|
* be returned. Otherwise, tidx is returned, and two empty cells are added
|
||||||
|
* to the given row.
|
||||||
|
*/
|
||||||
|
function addCells (row, tidx, tend, textLines, change) {
|
||||||
|
if (tidx < tend) {
|
||||||
|
row.appendChild(telt("th", (tidx + 1).toString()));
|
||||||
|
row.appendChild(ctelt("td", change, textLines[tidx].replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0")));
|
||||||
|
return tidx + 1;
|
||||||
|
} else {
|
||||||
|
row.appendChild(document.createElement("th"));
|
||||||
|
row.appendChild(celt("td", "empty"));
|
||||||
|
return tidx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addCellsInline (row, tidx, tidx2, textLines, change) {
|
||||||
|
row.appendChild(telt("th", tidx == null ? "" : (tidx + 1).toString()));
|
||||||
|
row.appendChild(telt("th", tidx2 == null ? "" : (tidx2 + 1).toString()));
|
||||||
|
row.appendChild(ctelt("td", change, textLines[tidx != null ? tidx : tidx2].replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0")));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var idx = 0; idx < opcodes.length; idx++) {
|
||||||
|
code = opcodes[idx];
|
||||||
|
change = code[0];
|
||||||
|
var b = code[1];
|
||||||
|
var be = code[2];
|
||||||
|
var n = code[3];
|
||||||
|
var ne = code[4];
|
||||||
|
var rowcnt = Math.max(be - b, ne - n);
|
||||||
|
var toprows = [];
|
||||||
|
var botrows = [];
|
||||||
|
for (var i = 0; i < rowcnt; i++) {
|
||||||
|
// jump ahead if we've alredy provided leading context or if this is the first range
|
||||||
|
if (contextSize && opcodes.length > 1 && ((idx > 0 && i == contextSize) || (idx == 0 && i == 0)) && change=="equal") {
|
||||||
|
var jump = rowcnt - ((idx == 0 ? 1 : 2) * contextSize);
|
||||||
|
if (jump > 1) {
|
||||||
|
toprows.push(node = document.createElement("tr"));
|
||||||
|
|
||||||
|
b += jump;
|
||||||
|
n += jump;
|
||||||
|
i += jump - 1;
|
||||||
|
node.appendChild(telt("th", "..."));
|
||||||
|
if (!inline) node.appendChild(ctelt("td", "skip", ""));
|
||||||
|
node.appendChild(telt("th", "..."));
|
||||||
|
node.appendChild(ctelt("td", "skip", ""));
|
||||||
|
|
||||||
|
// skip last lines if they're all equal
|
||||||
|
if (idx + 1 == opcodes.length) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toprows.push(node = document.createElement("tr"));
|
||||||
|
if (inline) {
|
||||||
|
if (change == "insert") {
|
||||||
|
addCellsInline(node, null, n++, newTextLines, change);
|
||||||
|
} else if (change == "replace") {
|
||||||
|
botrows.push(node2 = document.createElement("tr"));
|
||||||
|
if (b < be) addCellsInline(node, b++, null, baseTextLines, "delete");
|
||||||
|
if (n < ne) addCellsInline(node2, null, n++, newTextLines, "insert");
|
||||||
|
} else if (change == "delete") {
|
||||||
|
addCellsInline(node, b++, null, baseTextLines, change);
|
||||||
|
} else {
|
||||||
|
// equal
|
||||||
|
addCellsInline(node, b++, n++, baseTextLines, change);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var wdiff = diffString2(b < be ? baseTextLines[b]:"", n < ne ? newTextLines[n]:"");
|
||||||
|
if(b < be) baseTextLines[b] = wdiff.o;
|
||||||
|
if(n < ne)newTextLines[n] = wdiff.n;
|
||||||
|
b = addCells(node, b, be, baseTextLines, change=="replace" ? "delete" : change);
|
||||||
|
n = addCells(node, n, ne, newTextLines, change=="replace" ? "insert" : change);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < toprows.length; i++) rows.push(toprows[i]);
|
||||||
|
for (var i = 0; i < botrows.length; i++) rows.push(botrows[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var msg = "combined <a href='http://snowtide.com/jsdifflib'>jsdifflib</a> ";
|
||||||
|
msg += "and John Resig's <a href='http://ejohn.org/projects/javascript-diff-algorithm/'>diff</a> ";
|
||||||
|
msg += "by <a href='http://richardbondi.net'>Richard Bondi</a>";
|
||||||
|
rows.push(node = ctelt("th", "author", msg));
|
||||||
|
node.setAttribute("colspan", inline ? 3 : 4);
|
||||||
|
|
||||||
|
tdata.push(node = document.createElement("tbody"));
|
||||||
|
for (var idx in rows) rows.hasOwnProperty(idx) && node.appendChild(rows[idx]);
|
||||||
|
|
||||||
|
node = celt("table", "diff" + (inline ? " inlinediff" : ""));
|
||||||
|
for (var idx in tdata) tdata.hasOwnProperty(idx) && node.appendChild(tdata[idx]);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
15141
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/extensions.js
Normal file
15141
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/extensions.js
Normal file
File diff suppressed because it is too large
Load Diff
1
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/extensions.min.js
vendored
Normal file
1
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/extensions.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
160
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/jsdiff.js
Normal file
160
akarpov/static/ckeditor/ckeditor/plugins/autosave/js/jsdiff.js
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
/*
|
||||||
|
* Javascript Diff Algorithm
|
||||||
|
* By John Resig (http://ejohn.org/)
|
||||||
|
* Modified by Chu Alan "sprite"
|
||||||
|
* diffstring2 random colors removed by Richard Bondi for use with jsdifflib
|
||||||
|
*
|
||||||
|
* Released under the MIT license.
|
||||||
|
*
|
||||||
|
* More Info:
|
||||||
|
* http://ejohn.org/projects/javascript-diff-algorithm/
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function escape_jsdiff(s) {
|
||||||
|
var n = s;
|
||||||
|
n = n.replace(/&/g, "&");
|
||||||
|
n = n.replace(/</g, "<");
|
||||||
|
n = n.replace(/>/g, ">");
|
||||||
|
n = n.replace(/"/g, """);
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
function diffString( o, n ) {
|
||||||
|
o = o.replace(/\s+$/, '');
|
||||||
|
n = n.replace(/\s+$/, '');
|
||||||
|
|
||||||
|
var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/) );
|
||||||
|
var str = "";
|
||||||
|
|
||||||
|
var oSpace = o.match(/\s+/g);
|
||||||
|
if (oSpace == null) {
|
||||||
|
oSpace = ["\n"];
|
||||||
|
} else {
|
||||||
|
oSpace.push("\n");
|
||||||
|
}
|
||||||
|
var nSpace = n.match(/\s+/g);
|
||||||
|
if (nSpace == null) {
|
||||||
|
nSpace = ["\n"];
|
||||||
|
} else {
|
||||||
|
nSpace.push("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (out.n.length == 0) {
|
||||||
|
for (var i = 0; i < out.o.length; i++) {
|
||||||
|
str += '<del>' + escape_jsdiff(out.o[i]) + oSpace[i] + "</del>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (out.n[0].text == null) {
|
||||||
|
for (n = 0; n < out.o.length && out.o[n].text == null; n++) {
|
||||||
|
str += '<del>' + escape_jsdiff(out.o[n]) + oSpace[n] + "</del>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( var i = 0; i < out.n.length; i++ ) {
|
||||||
|
if (out.n[i].text == null) {
|
||||||
|
str += '<ins>' + escape_jsdiff(out.n[i]) + nSpace[i] + "</ins>";
|
||||||
|
} else {
|
||||||
|
var pre = "";
|
||||||
|
|
||||||
|
for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) {
|
||||||
|
pre += '<del>' + escape_jsdiff(out.o[n]) + oSpace[n] + "</del>";
|
||||||
|
}
|
||||||
|
str += " " + out.n[i].text + nSpace[i] + pre;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomColor() {
|
||||||
|
return "rgb(" + (Math.random() * 100) + "%, " +
|
||||||
|
(Math.random() * 100) + "%, " +
|
||||||
|
(Math.random() * 100) + "%)";
|
||||||
|
}
|
||||||
|
function diffString2( o, n ) {
|
||||||
|
o = o.replace(/\s+$/, '');
|
||||||
|
n = n.replace(/\s+$/, '');
|
||||||
|
|
||||||
|
var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/) );
|
||||||
|
|
||||||
|
var oSpace = o.match(/\s+/g);
|
||||||
|
if (oSpace == null) {
|
||||||
|
oSpace = ["\n"];
|
||||||
|
} else {
|
||||||
|
oSpace.push("\n");
|
||||||
|
}
|
||||||
|
var nSpace = n.match(/\s+/g);
|
||||||
|
if (nSpace == null) {
|
||||||
|
nSpace = ["\n"];
|
||||||
|
} else {
|
||||||
|
nSpace.push("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
var os = "";
|
||||||
|
var colors = new Array();
|
||||||
|
for (var i = 0; i < out.o.length; i++) {
|
||||||
|
colors[i] = randomColor();
|
||||||
|
|
||||||
|
if (out.o[i].text != null) {
|
||||||
|
os += escape_jsdiff(out.o[i].text) + oSpace[i];
|
||||||
|
} else {
|
||||||
|
os += "<del>" + escape_jsdiff(out.o[i]) + oSpace[i] + "</del>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var ns = "";
|
||||||
|
for (var i = 0; i < out.n.length; i++) {
|
||||||
|
if (out.n[i].text != null) {
|
||||||
|
ns += escape_jsdiff(out.n[i].text) + nSpace[i];
|
||||||
|
} else {
|
||||||
|
ns += "<ins>" + escape_jsdiff(out.n[i]) + nSpace[i] + "</ins>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { o : os , n : ns };
|
||||||
|
}
|
||||||
|
|
||||||
|
function diff( o, n ) {
|
||||||
|
var ns = new Object();
|
||||||
|
var os = new Object();
|
||||||
|
|
||||||
|
for ( var i = 0; i < n.length; i++ ) {
|
||||||
|
if ( ns[ n[i] ] == null )
|
||||||
|
ns[ n[i] ] = { rows: new Array(), o: null };
|
||||||
|
ns[ n[i] ].rows.push( i );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( var i = 0; i < o.length; i++ ) {
|
||||||
|
if ( os[ o[i] ] == null )
|
||||||
|
os[ o[i] ] = { rows: new Array(), n: null };
|
||||||
|
os[ o[i] ].rows.push( i );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( var i in ns ) {
|
||||||
|
if ( ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1 ) {
|
||||||
|
n[ ns[i].rows[0] ] = { text: n[ ns[i].rows[0] ], row: os[i].rows[0] };
|
||||||
|
o[ os[i].rows[0] ] = { text: o[ os[i].rows[0] ], row: ns[i].rows[0] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( var i = 0; i < n.length - 1; i++ ) {
|
||||||
|
if ( n[i].text != null && n[i+1].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null &&
|
||||||
|
n[i+1] == o[ n[i].row + 1 ] ) {
|
||||||
|
n[i+1] = { text: n[i+1], row: n[i].row + 1 };
|
||||||
|
o[n[i].row+1] = { text: o[n[i].row+1], row: i + 1 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( var i = n.length - 1; i > 0; i-- ) {
|
||||||
|
if ( n[i].text != null && n[i-1].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null &&
|
||||||
|
n[i-1] == o[ n[i].row - 1 ] ) {
|
||||||
|
n[i-1] = { text: n[i-1], row: n[i].row - 1 };
|
||||||
|
o[n[i].row-1] = { text: o[n[i].row-1], row: i - 1 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { o: o, n: n };
|
||||||
|
}
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/bg.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/bg.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'bg', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Запазено автоматично',
|
||||||
|
loadSavedContent: 'Намерена е автоматично запазена версия на това съдържание от "{0}". Искате ли да сравните версиите на съдържанието и да изберете коя да се зареди? "Отказ" ще премахне по-рано автоматично запазеното съдържание.',
|
||||||
|
title: 'Сравнете автоматично запазеното съдържание със зареденото от сайта',
|
||||||
|
loadedContent: 'Заредено съдържание',
|
||||||
|
localStorageFull: 'LocalStorage на браузърът е пълен, изчистете хранилището си или увеличете размера на базата данни',
|
||||||
|
autoSavedContent: 'Автоматично запазено съдържание от: \'',
|
||||||
|
ok: 'Да, заредете автоматично запазеното съдържание',
|
||||||
|
no: 'Не',
|
||||||
|
diffType: 'Изберете вид на изгледа:',
|
||||||
|
sideBySide: 'Изглед един до друг',
|
||||||
|
inline: 'Поредов изглед'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/ca.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/ca.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'ca', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Auto desat',
|
||||||
|
loadSavedContent: 'S\'ha trobat una versió auto-desada d\'aquest contingut de "{0}". Voleu comparar les versions del contingut i escollir quina carregar?',
|
||||||
|
title: 'Compareu el contingut auto-desat amb el contingut carregat del lloc web',
|
||||||
|
loadedContent: 'Contingut carregat',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: 'Contingut auto-desat de: \'',
|
||||||
|
ok: 'Sí, carrega el contingut auto-desat',
|
||||||
|
no: 'No',
|
||||||
|
diffType: 'Esculliu el tipus de visualització:',
|
||||||
|
sideBySide: 'Visualització un al costat de l\'altre',
|
||||||
|
inline: 'Visualització en línia'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/cs.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/cs.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'cs', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Automaticky uloženo',
|
||||||
|
loadSavedContent: 'Byla nalezena automaticky uložená verze obsahu ze dne "{0}". Chcete porovnat obsah a zvolit si s kterým obsahem chete pracovat?',
|
||||||
|
title: 'Porovnejte automaticky uložený obsah s obsahem nahraným z webové stránky',
|
||||||
|
loadedContent: 'Nahraný obsah',
|
||||||
|
localStorageFull: 'Místní úložiště prohlížeče je plné, vymažte úložiště nebo zvětšete velikost databáze',
|
||||||
|
autoSavedContent: 'Automaticky uložený obsah z: \'',
|
||||||
|
ok: 'Ano, zvolit automaticky uložený obsah',
|
||||||
|
no: 'Ne',
|
||||||
|
diffType: 'Zvolte si typ náhledu:',
|
||||||
|
sideBySide: 'Pohled HTML vedle HTML',
|
||||||
|
inline: 'Pohled Obsah/Obsah'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/de.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/de.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'de', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Automatisch gespeichert',
|
||||||
|
loadSavedContent: 'Es wurde ein autom. Gespeicherter Inhalt gefunden (vom "{0}"). Wollen Sie den Inhalt vergleichen, um dann entscheiden zu können ob der Inhalt geladen werden soll?',
|
||||||
|
title: 'Temp. Gespeichert Inhalt vergleichen',
|
||||||
|
loadedContent: 'Geladener Inhalt',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: 'Autom. Gespeicherten Inhalt (vom: \'',
|
||||||
|
ok: 'Ja, Lade Autom. Gespeicherten Inhalt',
|
||||||
|
no: 'Nein',
|
||||||
|
diffType: 'Diff Anzeigetyp:',
|
||||||
|
sideBySide: 'Nebeneinander',
|
||||||
|
inline: 'Inline'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/en.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/en.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'en', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Auto Saved',
|
||||||
|
loadSavedContent: 'An auto-saved version of this content from "{0}" has been found. Would you like to compare content versions and choose which one to load? Clicking Cancel will remove previously auto-saved content.',
|
||||||
|
title: 'Compare auto-saved content with that loaded from the website',
|
||||||
|
loadedContent: 'Loaded content',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: 'Auto-saved content from: \'',
|
||||||
|
ok: 'Yes, load auto-saved content',
|
||||||
|
no: 'No',
|
||||||
|
diffType: 'Choose view type:',
|
||||||
|
sideBySide: 'Side by side view',
|
||||||
|
inline: 'Inline view'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/es.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/es.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'es', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Auto guardado',
|
||||||
|
loadSavedContent: 'Se ha encontrado una versión auto-guardada de este contenido de "{0}". Queréis comparar el contenido de las versiones y elegir cual cargar?',
|
||||||
|
title: 'Compara el contenido auto-guardado con el cargado del sitio web',
|
||||||
|
loadedContent: 'Contenido cargado',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: 'Contenido auto-guardado de: \'',
|
||||||
|
ok: 'Si, carga el contenido auto-guardado',
|
||||||
|
no: 'No',
|
||||||
|
diffType: 'Escoge el tipo de visualización:',
|
||||||
|
sideBySide: 'Visualización uno al lado del otro',
|
||||||
|
inline: 'Visualización en línea'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/eu.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/eu.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'eu', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Automatikoki gorde da',
|
||||||
|
loadSavedContent: 'Eduki honen automatikoki gordetako "{0}"(e)ko bertsio bat aurkitu da. Edukien bertsioak konparatu eta zein kargatu aukeratu nahi duzu? Utzi botoian klik eginez gero aurrez automatikoki gordetako edukia ezabatuko da.',
|
||||||
|
title: 'Konparatu automatikoki gordetako edukia webgunetik kargatutakoarekin',
|
||||||
|
loadedContent: 'Kargatutako edukia',
|
||||||
|
localStorageFull: 'Nabigatzailearen biltegiratze lokala beteta dago, garbitu biltegiratzea edo handitu datu-basearen tamaina',
|
||||||
|
autoSavedContent: 'Hemendik automatikoki gordetako edukia: \'',
|
||||||
|
ok: 'Bai, kargatu automatikoki gordetako edukia',
|
||||||
|
no: 'Ez',
|
||||||
|
diffType: 'Aukeratu ikuspegi mota:',
|
||||||
|
sideBySide: 'Alboz-alboko ikuspegia',
|
||||||
|
inline: 'Lineako ikuspegia'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/fr.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/fr.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'fr', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Sauvegarde automatique',
|
||||||
|
loadSavedContent: 'Une précédente version a été sauvegardée le "{0}". Voulez-vous l\'afficher et la comparer avec le document en cours ?',
|
||||||
|
title: 'Comparaison du document en cours et du document sauvegardé',
|
||||||
|
loadedContent: 'Document en cours',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: 'Document sauvegardé le : \'',
|
||||||
|
ok: 'Oui, charger le document sauvegardé',
|
||||||
|
no: 'Non, continuer avec le document en cours',
|
||||||
|
diffType: 'Afficher les deux documents : ',
|
||||||
|
sideBySide: 'Côte à côte',
|
||||||
|
inline: 'L\'un sous l\'autre'
|
||||||
|
});
|
17
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/it.js
Normal file
17
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/it.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'it', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Salvataggio automatico',
|
||||||
|
loadSavedContent: 'C\'è una versione salvata automaticamente di questi contenuti da "{0}": desideri confrontare le due versioni per decidere quale utilizzare?',
|
||||||
|
title: 'Confronta i contenuti salvati automaticamente con quelli caricati dal sito web',
|
||||||
|
loadedContent: 'Contenuti caricati',
|
||||||
|
autoSavedContent: 'Contenuti salvati automaticamente da: \'',
|
||||||
|
ok: 'Si, carica i contenuti salvati automaticamente',
|
||||||
|
no: 'No',
|
||||||
|
diffType: 'Scegli il tipo di visualizzazione:',
|
||||||
|
sideBySide: 'Vista affiancata',
|
||||||
|
inline: 'Vista in linea'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/ja.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/ja.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'ja', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: '自動保存されました',
|
||||||
|
loadSavedContent: '投稿途中だった内容があります({0})。現在保存されている投稿と比較しますか?',
|
||||||
|
title: 'Compare auto-saved content with that loaded from the website',
|
||||||
|
loadedContent: '現在保存されている投稿',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: '投稿途中だった内容: \'',
|
||||||
|
ok: '投稿途中だった内容(緑)を使う',
|
||||||
|
no: 'いいえ',
|
||||||
|
diffType: '比較モード',
|
||||||
|
sideBySide: '横に並べる',
|
||||||
|
inline: '行ごとに比較'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/nl.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/nl.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'nl', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Automatisch opgeslagen',
|
||||||
|
loadSavedContent: 'Een automatisch opgeslagen versie van deze inhoud van "{0}" is gevonden. Wilt u de inhoud van deze versies vergelijken en kiezen welke te laden?',
|
||||||
|
title: 'Vergelijk automatisch opgeslagen inhoud met die geladen van de website',
|
||||||
|
loadedContent: 'Geladen inhoud',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: 'Automatisch opgeslagen inhoud van: \'',
|
||||||
|
ok: 'Ja, laad automatisch opgeslagen inhoud',
|
||||||
|
no: 'Nee',
|
||||||
|
diffType: 'Selecteer weergave:',
|
||||||
|
sideBySide: 'Zij aan zij weergave',
|
||||||
|
inline: 'In lijn weergave'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/pl.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/pl.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'pl', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Auto Saved',
|
||||||
|
loadSavedContent: 'Istnieje automatycznie zapisana wersja zawartości (z "{0}"). Otworzyć okno porównawcze, w którym można zadecydować o wczytaniu automatycznie zapisanej zawartości?',
|
||||||
|
title: 'Porównanie tymczasowo zapisanej zawartości z zawartością wczytaną w witrynie',
|
||||||
|
loadedContent: 'Zawartość wczytania',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: 'Zawartość zapisana automatycznie (z: \'',
|
||||||
|
ok: 'Tak, wczytaj automatycznie zapisaną treść',
|
||||||
|
no: 'Nie',
|
||||||
|
diffType: 'Widok porównawczy:',
|
||||||
|
sideBySide: 'Obok siebie',
|
||||||
|
inline: 'Osadzony'
|
||||||
|
});
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'pt-br', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Salvo automaticamente',
|
||||||
|
loadSavedContent: 'Uma versão salva automaticamente deste conteúdo de "{0}" foi encontrada. Gostaria de comparar o conteúdo dessas versões e escolher qual delas será carregada?',
|
||||||
|
title: 'Compare o conteúdo salvo automaticamente com o carregado a partir do site',
|
||||||
|
loadedContent: 'Carregar conteúdo',
|
||||||
|
localStorageFull: 'O armazenamento do navegador está cheio, limpe o armazenamento ou aumente o tamanho do banco de dados',
|
||||||
|
autoSavedContent: 'Conteúdo gravado automaticamente em: \'',
|
||||||
|
ok: 'Sim, carregue o conteúdo salvo',
|
||||||
|
no: 'Não',
|
||||||
|
diffType: 'Escolher tipo de visualização:',
|
||||||
|
sideBySide: 'Visão lado-a-lado',
|
||||||
|
inline: 'Visão em linha'
|
||||||
|
});
|
17
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/ru.js
Normal file
17
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/ru.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'ru', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Автоматическое сохранение',
|
||||||
|
loadSavedContent: 'Найдена сохраненная версия этого документа от "{0}". Хотите ли сравнить с текущей и выбрать актуальную версию?',
|
||||||
|
title: 'Сравнение сохраненной копии и текущей версии',
|
||||||
|
loadedContent: 'Текущий документ',
|
||||||
|
autoSavedContent: 'Сохраненный вариант от: \'',
|
||||||
|
ok: 'Да, загрузить сохраненный вариант',
|
||||||
|
no: 'Нет',
|
||||||
|
diffType: 'Выберите вариант отображения:',
|
||||||
|
sideBySide: 'Построчное сравнение ',
|
||||||
|
inline: 'Сплошной текст'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/sk.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/sk.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'sk', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Automaticky uložené',
|
||||||
|
loadSavedContent: 'Bola nájdená automaticky uložená verzia z "{0}". Chcete porovnať obsah a vybrať verziu, ktorú chcete použiť?',
|
||||||
|
title: 'Porovnanie automaticky uloženého obsahu s obsahom nahraným z webu',
|
||||||
|
loadedContent: 'Nahraný obsah z webu',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: 'Automaticky uložený obsah z: \'',
|
||||||
|
ok: 'Použiť automaticky uložený obsah',
|
||||||
|
no: 'Použiť obsah z webu',
|
||||||
|
diffType: 'Zvoliť typ náhľadu:',
|
||||||
|
sideBySide: 'Vedľa seba',
|
||||||
|
inline: 'Pod sebou'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/sv.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/sv.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'sv', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Autosparat',
|
||||||
|
loadSavedContent: 'En autosparad version av det här innehållet (från "{0}") hittades. Vill du öppna en dialogruta för att jämföra, där du även kan välja att läsa in det autosparade innehållet?',
|
||||||
|
title: 'Jämför temporärt sparat innehåll med det inladdade innehållet från sidan',
|
||||||
|
loadedContent: 'Inladdat innehåll',
|
||||||
|
localStorageFull: 'Webbläsarens localStorage är full, töm din lagring eller öka databasstorleken',
|
||||||
|
autoSavedContent: 'Autosparat innehåll från: \'',
|
||||||
|
ok: 'Ja, läs in autosparat innehåll',
|
||||||
|
no: 'Nej',
|
||||||
|
diffType: 'Visa skillnader:',
|
||||||
|
sideBySide: 'Sida vid sida',
|
||||||
|
inline: 'Ihop'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/tr.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/tr.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'tr', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Otomatik Kaydedildi',
|
||||||
|
loadSavedContent: 'Bu içeriğin "{0}" tarihli otomatik kaydedilmiş versiyonu bulundu. İki versiyonu karşılaştırmak ve hangisi yüklenmek istediğinizi belirlemek ister misiniz? İptal tuşuna basılınca otomatik kaydedilen içerik silinir.',
|
||||||
|
title: 'Otomatik olarak kaydedilen içerik ile yüklenen içeriği karşılaştır',
|
||||||
|
loadedContent: 'Yüklenen içerik',
|
||||||
|
localStorageFull: 'Tarayıcı belleği(localStorage) dolu, belleği temizleyin veya boyutunu artırın',
|
||||||
|
autoSavedContent: 'Otomatik kaydedilen içerik: \'',
|
||||||
|
ok: 'Evet, otomatik kaydedilen içeriği yükle',
|
||||||
|
no: 'Hayır',
|
||||||
|
diffType: 'Gösterim tipini seç:',
|
||||||
|
sideBySide: 'Sutunlu görünüm',
|
||||||
|
inline: 'Sıralı görünüm'
|
||||||
|
});
|
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/uk.js
Normal file
18
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/uk.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'uk', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: 'Автоматичне збереження',
|
||||||
|
loadSavedContent: 'Знайдено автоматично збережену версію цього вмісту від "{0}". Бажаєте порівняти версії вмісту та вибрати, яку з них завантажити? Якщо натиснути "Скасувати", раніше збережений вміст буде вилучено.',
|
||||||
|
title: 'Порівняння автоматично збереженого вмісту із поточним',
|
||||||
|
loadedContent: 'Завантажений вміст',
|
||||||
|
localStorageFull: 'Локальне сховище(localStorage) браузера заповнено, очистіть сховище або збільшіть розмір бази даних',
|
||||||
|
autoSavedContent: 'Автоматично збережений вміст від: \'',
|
||||||
|
ok: 'Так, завантажити автоматично збережений вміст',
|
||||||
|
no: 'Ні',
|
||||||
|
diffType: 'Виберіть тип перегляду:',
|
||||||
|
sideBySide: 'Переглянути поряд',
|
||||||
|
inline: 'Вбудований вигляд'
|
||||||
|
});
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'zh-cn', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: '自动保存',
|
||||||
|
loadSavedContent: '已经存在这个内容之前保存的版本 "{0}". 你希望比较两个不同的版本并从中选择你想要加载的那个么?',
|
||||||
|
title: '比较自动保存的版本',
|
||||||
|
loadedContent: '已经加载的内容',
|
||||||
|
localStorageFull: 'Browser localStorage is full, clear your storage or Increase database size',
|
||||||
|
autoSavedContent: '自动保存的内容: \'',
|
||||||
|
ok: '我确认,加载自动保存的内容',
|
||||||
|
no: '取消',
|
||||||
|
diffType: '选择视图类型:',
|
||||||
|
sideBySide: '并排视图',
|
||||||
|
inline: '内嵌视图'
|
||||||
|
});
|
17
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/zh.js
Normal file
17
akarpov/static/ckeditor/ckeditor/plugins/autosave/lang/zh.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
CKEDITOR.plugins.setLang('autosave', 'zh', {
|
||||||
|
dateFormat: 'LLL',
|
||||||
|
autoSaveMessage: '自動儲存 :)',
|
||||||
|
loadSavedContent: '你在 “{0}” 有一個自動儲存的版本。你想要比較新舊內容,並選擇使用哪一個嗎?點取消按鈕將會移除先前的自動儲存紀錄。',
|
||||||
|
title: '新舊內容比較',
|
||||||
|
loadedContent: '目前內容',
|
||||||
|
autoSavedContent: '自動儲存的內容: \'',
|
||||||
|
ok: '是,我要讀取自動儲存的內容',
|
||||||
|
no: '否',
|
||||||
|
diffType: '選擇比較方式:',
|
||||||
|
sideBySide: '雙欄式',
|
||||||
|
inline: '條列式'
|
||||||
|
});
|
448
akarpov/static/ckeditor/ckeditor/plugins/autosave/plugin.js
Normal file
448
akarpov/static/ckeditor/ckeditor/plugins/autosave/plugin.js
Normal file
|
@ -0,0 +1,448 @@
|
||||||
|
/**
|
||||||
|
* @license Copyright (c) CKSource - Frederico Knabben. All rights reserved.
|
||||||
|
* For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
if (!supportsLocalStorage()) {
|
||||||
|
CKEDITOR.plugins.add("autosave", {}); //register a dummy plugin to pass CKEditor plugin initialization process
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CKEDITOR.plugins.add("autosave",
|
||||||
|
{
|
||||||
|
lang: "bg,ca,cs,de,en,es,eu,fr,it,ja,nl,pl,pt-br,ru,sk,sv,uk,zh,zh-cn", // %REMOVE_LINE_CORE%
|
||||||
|
requires: "notification",
|
||||||
|
version: "0.18.6",
|
||||||
|
init: function(editor) {
|
||||||
|
|
||||||
|
// Construct default configuration
|
||||||
|
var defaultConfig = {
|
||||||
|
delay: 5,
|
||||||
|
messageType: "notification",
|
||||||
|
saveDetectionSelectors: "a[href^='javascript:__doPostBack'][id*='Save'],a[id*='Cancel']",
|
||||||
|
saveOnDestroy: false,
|
||||||
|
NotOlderThen: 1440,
|
||||||
|
SaveKey: "",
|
||||||
|
diffType: "sideBySide",
|
||||||
|
autoLoad: false,
|
||||||
|
removeStorageAfterAutoLoad: false,
|
||||||
|
SaveKeyAttribute: "name",
|
||||||
|
SaveKeyDelimiter: "_",
|
||||||
|
SaveKeyIgnoreProto: false,
|
||||||
|
SaveKeyPrefix: "autosave",
|
||||||
|
SaveKeyIgnoreParams: ""
|
||||||
|
};
|
||||||
|
|
||||||
|
// Extend CKEDITOR config and lang - config also available at loadPlugin()
|
||||||
|
var config = CKEDITOR.tools.extend(defaultConfig, editor.config.autosave || {}, true);
|
||||||
|
|
||||||
|
if (!config.SaveKey.length) {
|
||||||
|
// Prepare temp vars for constructing local storage SaveKey name
|
||||||
|
var saveKeyUrl = config.SaveKeyIgnoreProto
|
||||||
|
? window.location.href.replace(/https?:\/\//, "")
|
||||||
|
: window.location.href;
|
||||||
|
|
||||||
|
if (config.SaveKeyIgnoreParams.length) {
|
||||||
|
CKEDITOR.tools.array.forEach(config.SaveKeyIgnoreParams,
|
||||||
|
function() {
|
||||||
|
saveKeyUrl = RemoveUrlParam(this, null, saveKeyUrl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
config.SaveKey =
|
||||||
|
config.SaveKeyPrefix +
|
||||||
|
config.SaveKeyDelimiter +
|
||||||
|
saveKeyUrl +
|
||||||
|
config.SaveKeyDelimiter +
|
||||||
|
editor[config.SaveKeyAttribute];
|
||||||
|
}
|
||||||
|
|
||||||
|
CKEDITOR.document.appendStyleSheet(
|
||||||
|
CKEDITOR.getUrl(CKEDITOR.plugins.getPath("autosave") + "css/autosave.min.css"));
|
||||||
|
|
||||||
|
editor.addCommand("removeAutoSaveStorage",
|
||||||
|
{
|
||||||
|
exec: function(editor) {
|
||||||
|
RemoveStorage(config.SaveKey, editor);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
editor.on("uiSpace",
|
||||||
|
function(event) {
|
||||||
|
if (event.data.space == "bottom" &&
|
||||||
|
config.messageType != null &&
|
||||||
|
config.messageType == "statusbar") {
|
||||||
|
|
||||||
|
event.data.html +=
|
||||||
|
'<div class="autoSaveMessage" unselectable="on"><div unselectable="on" id="' +
|
||||||
|
autoSaveMessageId(event.editor) +
|
||||||
|
'"class="hidden">' +
|
||||||
|
event.editor.lang.autosave.autoSaveMessage +
|
||||||
|
"</div></div>";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
editor,
|
||||||
|
null,
|
||||||
|
100);
|
||||||
|
|
||||||
|
editor.on("instanceReady",
|
||||||
|
function() {
|
||||||
|
if (typeof requirejs === "function") {
|
||||||
|
requirejs([CKEDITOR.getUrl(CKEDITOR.plugins.getPath("autosave") + "js/extensions.min.js")],
|
||||||
|
function() {
|
||||||
|
loadPlugin(editor, config);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
CKEDITOR.scriptLoader.load(
|
||||||
|
CKEDITOR.getUrl(CKEDITOR.plugins.getPath("autosave") + "js/extensions.min.js"),
|
||||||
|
function() {
|
||||||
|
loadPlugin(editor, config);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
editor,
|
||||||
|
null,
|
||||||
|
100);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadPlugin(editorInstance, config) {
|
||||||
|
|
||||||
|
GenerateAutoSaveDialog(editorInstance, config, config.SaveKey);
|
||||||
|
|
||||||
|
CheckForAutoSavedContent(editorInstance, config, config.SaveKey, config.NotOlderThen);
|
||||||
|
|
||||||
|
CKEDITOR.tools.array.forEach(CKEDITOR.document.find(config.saveDetectionSelectors).toArray(),
|
||||||
|
function(el) {
|
||||||
|
el.$.addEventListener("click",
|
||||||
|
function() {
|
||||||
|
RemoveStorage(config.SaveKey, editorInstance);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
editorInstance.on("change",
|
||||||
|
function() {
|
||||||
|
startTimer(config, editorInstance);
|
||||||
|
});
|
||||||
|
|
||||||
|
editorInstance.on("blur",
|
||||||
|
function() {
|
||||||
|
startTimer(config, editorInstance);
|
||||||
|
});
|
||||||
|
|
||||||
|
editorInstance.on("destroy",
|
||||||
|
function() {
|
||||||
|
if (config.saveOnDestroy) {
|
||||||
|
SaveData(config.SaveKey, editorInstance, config);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function autoSaveMessageId(editorInstance) {
|
||||||
|
return "cke_autoSaveMessage_" + editorInstance.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
var startTimer = function(configAutosave, editorInstance) {
|
||||||
|
if (editorInstance.config.autosave_timeOutId == null) {
|
||||||
|
var delay = configAutosave.delay != null ? configAutosave.delay : 10;
|
||||||
|
editorInstance.config.autosave_timeOutId = setTimeout(function() {
|
||||||
|
onTimer(configAutosave, editorInstance);
|
||||||
|
},
|
||||||
|
delay * 1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function onTimer(configAutosave, editorInstance) {
|
||||||
|
if (editorInstance.checkDirty() || editorInstance.plugins.bbcode) {
|
||||||
|
var editor = editorInstance,
|
||||||
|
autoSaveKey = configAutosave.SaveKey != null
|
||||||
|
? configAutosave.SaveKey
|
||||||
|
: "autosave_" + window.location + "_" + document.getElementById(editor.name).getAttribute("name");
|
||||||
|
|
||||||
|
SaveData(autoSaveKey, editor, configAutosave);
|
||||||
|
|
||||||
|
clearTimeout(editorInstance.config.autosave_timeOutId);
|
||||||
|
|
||||||
|
editorInstance.config.autosave_timeOutId = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// localStorage detection
|
||||||
|
function supportsLocalStorage() {
|
||||||
|
if (typeof (Storage) === "undefined") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
localStorage.getItem("___test_key");
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function GenerateAutoSaveDialog(editorInstance, config, autoSaveKey) {
|
||||||
|
CKEDITOR.dialog.add("autosaveDialog",
|
||||||
|
function() {
|
||||||
|
return {
|
||||||
|
title: editorInstance.lang.autosave.title,
|
||||||
|
minHeight: 155,
|
||||||
|
height: 300,
|
||||||
|
width: 800,
|
||||||
|
onShow: function() {
|
||||||
|
RenderDiff(this, editorInstance, autoSaveKey);
|
||||||
|
},
|
||||||
|
onOk: function() {
|
||||||
|
if (localStorage.getItem(autoSaveKey)) {
|
||||||
|
var jsonSavedContent = LoadData(autoSaveKey);
|
||||||
|
|
||||||
|
RemoveStorage(autoSaveKey, editorInstance);
|
||||||
|
|
||||||
|
editorInstance.setData(jsonSavedContent.data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onCancel: function() {
|
||||||
|
RemoveStorage(autoSaveKey, editorInstance);
|
||||||
|
},
|
||||||
|
contents: [
|
||||||
|
{
|
||||||
|
label: "",
|
||||||
|
id: "general",
|
||||||
|
elements: [
|
||||||
|
{
|
||||||
|
type: "radio",
|
||||||
|
id: "diffType",
|
||||||
|
label: editorInstance.lang.autosave.diffType,
|
||||||
|
items: [
|
||||||
|
[editorInstance.lang.autosave.sideBySide, "sideBySide"],
|
||||||
|
[editorInstance.lang.autosave.inline, "inline"]
|
||||||
|
],
|
||||||
|
'default': config.diffType,
|
||||||
|
onClick: function() {
|
||||||
|
RenderDiff(this._.dialog, editorInstance, autoSaveKey);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
type: "html",
|
||||||
|
id: "diffContent",
|
||||||
|
html: ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: "ok",
|
||||||
|
type: "button",
|
||||||
|
label: editorInstance.lang.autosave.ok,
|
||||||
|
'class': "cke_dialog_ui_button_ok cke_dialog_autosave_ok",
|
||||||
|
onClick: function(evt) {
|
||||||
|
var dialog = evt.data.dialog;
|
||||||
|
if (dialog.fire("ok", { hide: true }).hide !== false)
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "cancel",
|
||||||
|
type: "button",
|
||||||
|
label: editorInstance.lang.autosave.no,
|
||||||
|
'class': "cke_dialog_ui_button_cancel",
|
||||||
|
onClick: function(evt) {
|
||||||
|
var dialog = evt.data.dialog;
|
||||||
|
if (dialog.fire("cancel", { hide: true }).hide !== false)
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function CheckForAutoSavedContent(editorInstance, config, autoSaveKey, notOlderThen) {
|
||||||
|
// Checks If there is data available and load it
|
||||||
|
if (localStorage.getItem(autoSaveKey)) {
|
||||||
|
var jsonSavedContent = LoadData(autoSaveKey);
|
||||||
|
|
||||||
|
var autoSavedContent = jsonSavedContent.data;
|
||||||
|
var autoSavedContentDate = jsonSavedContent.saveTime;
|
||||||
|
|
||||||
|
var editorLoadedContent = editorInstance.getData();
|
||||||
|
|
||||||
|
// check if the loaded editor content is the same as the auto saved content
|
||||||
|
if (editorLoadedContent == autoSavedContent) {
|
||||||
|
localStorage.removeItem(autoSaveKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore if auto saved content is older then x minutes
|
||||||
|
if (moment(new Date()).diff(new Date(autoSavedContentDate), "minutes") > notOlderThen) {
|
||||||
|
RemoveStorage(autoSaveKey, editorInstance);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.autoLoad) {
|
||||||
|
if (localStorage.getItem(autoSaveKey)) {
|
||||||
|
var jsonSavedContent = LoadData(autoSaveKey);
|
||||||
|
editorInstance.setData(jsonSavedContent.data);
|
||||||
|
|
||||||
|
if (config.removeStorageAfterAutoLoad) {
|
||||||
|
RemoveStorage(autoSaveKey, editorInstance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var confirmMessage = editorInstance.lang.autosave.loadSavedContent.replace("{0}",
|
||||||
|
moment(autoSavedContentDate).locale(editorInstance.config.language)
|
||||||
|
.format(editorInstance.lang.autosave.dateFormat));
|
||||||
|
|
||||||
|
if (confirm(confirmMessage)) {
|
||||||
|
// Open DIFF Dialog
|
||||||
|
editorInstance.openDialog("autosaveDialog");
|
||||||
|
} else {
|
||||||
|
RemoveStorage(autoSaveKey, editorInstance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function LoadData(autoSaveKey) {
|
||||||
|
var compressedJSON = LZString.decompressFromUTF16(localStorage.getItem(autoSaveKey));
|
||||||
|
return JSON.parse(compressedJSON);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SaveData(autoSaveKey, editorInstance, config) {
|
||||||
|
var compressedJSON =
|
||||||
|
LZString.compressToUTF16(JSON.stringify({ data: editorInstance.getData(), saveTime: new Date() }));
|
||||||
|
|
||||||
|
var quotaExceeded = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
localStorage.setItem(autoSaveKey, compressedJSON);
|
||||||
|
} catch (e) {
|
||||||
|
quotaExceeded = isQuotaExceeded(e);
|
||||||
|
if (quotaExceeded) {
|
||||||
|
console.log(editorInstance.lang.autosave.localStorageFull);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quotaExceeded) {
|
||||||
|
var notificationError = new CKEDITOR.plugins.notification(editorInstance,
|
||||||
|
{ message: editorInstance.lang.autosave.localStorageFull, type: "warning" });
|
||||||
|
notificationError.show();
|
||||||
|
} else {
|
||||||
|
var messageType = config.messageType != null ? config.messageType : "notification";
|
||||||
|
|
||||||
|
if (editorInstance.plugins.wordcount &&
|
||||||
|
messageType == "statusbar" &&
|
||||||
|
editorInstance.container.$.clientWidth < 150) {
|
||||||
|
messageType = "notification";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (messageType == "statusbar") {
|
||||||
|
var autoSaveMessage = document.getElementById(autoSaveMessageId(editorInstance));
|
||||||
|
|
||||||
|
if (autoSaveMessage) {
|
||||||
|
autoSaveMessage.className = "show";
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
autoSaveMessage.className = "hidden";
|
||||||
|
},
|
||||||
|
2000);
|
||||||
|
}
|
||||||
|
} else if (messageType == "notification") {
|
||||||
|
var notification = new CKEDITOR.plugins.notification(editorInstance,
|
||||||
|
{ message: editorInstance.lang.autosave.autoSaveMessage, type: "success" });
|
||||||
|
notification.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function RemoveStorage(autoSaveKey, editor) {
|
||||||
|
if (editor.config.autosave_timeOutId) {
|
||||||
|
clearTimeout(editor.config.autosave_timeOutId);
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.removeItem(autoSaveKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RenderDiff(dialog, editorInstance, autoSaveKey) {
|
||||||
|
var jsonSavedContent = LoadData(autoSaveKey);
|
||||||
|
|
||||||
|
var base = difflib.stringAsLines(editorInstance.getData());
|
||||||
|
var newtxt = difflib.stringAsLines(jsonSavedContent.data);
|
||||||
|
var sm = new difflib.SequenceMatcher(base, newtxt);
|
||||||
|
var opcodes = sm.get_opcodes();
|
||||||
|
|
||||||
|
dialog.getContentElement("general", "diffContent").getElement().setHtml('<div class="diffContent">' +
|
||||||
|
diffview.buildView({
|
||||||
|
baseTextLines: base,
|
||||||
|
newTextLines: newtxt,
|
||||||
|
opcodes: opcodes,
|
||||||
|
baseTextName: editorInstance.lang.autosave.loadedContent,
|
||||||
|
newTextName: editorInstance.lang.autosave.autoSavedContent +
|
||||||
|
(moment(jsonSavedContent.saveTime).locale(editorInstance.config.language)
|
||||||
|
.format(editorInstance.lang.autosave.dateFormat)) +
|
||||||
|
"'",
|
||||||
|
contextSize: 3,
|
||||||
|
viewType: dialog.getContentElement("general", "diffType").getValue() == "inline" ? 1 : 0
|
||||||
|
}).outerHTML +
|
||||||
|
"</div>");
|
||||||
|
}
|
||||||
|
|
||||||
|
function isQuotaExceeded(e) {
|
||||||
|
var quotaExceeded = false;
|
||||||
|
if (e) {
|
||||||
|
if (e.code) {
|
||||||
|
switch (e.code) {
|
||||||
|
case 22:
|
||||||
|
quotaExceeded = true;
|
||||||
|
break;
|
||||||
|
case 1014:
|
||||||
|
// Firefox
|
||||||
|
if (e.name === "NS_ERROR_DOM_QUOTA_REACHED") {
|
||||||
|
quotaExceeded = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (e.number === -2147024882) {
|
||||||
|
// Internet Explorer 8
|
||||||
|
quotaExceeded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return quotaExceeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Querystring mitigator - Quick and dirty paste.
|
||||||
|
// I don't know who original author is for creds.
|
||||||
|
// https://stackoverflow.com/a/11654436/2418655
|
||||||
|
function RemoveUrlParam(key, value, url) {
|
||||||
|
if (!url) url = window.location.href;
|
||||||
|
var re = new RegExp("([?&])" + key + "=.*?(&|#|$)(.*)", "gi"),
|
||||||
|
hash;
|
||||||
|
|
||||||
|
if (re.test(url)) {
|
||||||
|
if (typeof value !== "undefined" && value !== null) {
|
||||||
|
return url.replace(re, "$1" + key + "=" + value + "$2$3");
|
||||||
|
} else {
|
||||||
|
hash = url.split("#");
|
||||||
|
url = hash[0].replace(re, "$1$3").replace(/(&|\?)$/, "");
|
||||||
|
if (typeof hash[1] !== "undefined" && hash[1] !== null) {
|
||||||
|
url += "#" + hash[1];
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (typeof value !== "undefined" && value !== null) {
|
||||||
|
var separator = url.indexOf("?") !== -1 ? "&" : "?";
|
||||||
|
hash = url.split("#");
|
||||||
|
url = hash[0] + separator + key + "=" + value;
|
||||||
|
if (typeof hash[1] !== "undefined" && hash[1] !== null) {
|
||||||
|
url += "#" + hash[1];
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
} else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
7
akarpov/static/css/bootstrap.min.css
vendored
Normal file
7
akarpov/static/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
494
akarpov/static/css/project.css
Normal file
494
akarpov/static/css/project.css
Normal file
|
@ -0,0 +1,494 @@
|
||||||
|
/* These styles are generated from project.scss. */
|
||||||
|
|
||||||
|
.alert-debug {
|
||||||
|
color: black;
|
||||||
|
background-color: white;
|
||||||
|
border-color: #d6e9c6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-error {
|
||||||
|
color: #b94a48;
|
||||||
|
background-color: #f2dede;
|
||||||
|
border-color: #eed3d7;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2 {
|
||||||
|
font-weight: 500;
|
||||||
|
margin: 0px 0px 5px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-card {
|
||||||
|
background: #E0E0E0;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
z-index: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
margin-top: 70px;
|
||||||
|
-webkit-transform: translate(-50%, -50%);
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
-webkit-border-radius: 50%;
|
||||||
|
border-radius: 50%;
|
||||||
|
-webkit-box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16), 0px 3px 6px rgba(0, 0, 0, 0.23);
|
||||||
|
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16), 0px 3px 6px rgba(0, 0, 0, 0.23);
|
||||||
|
-webkit-animation: init 0s 0.2s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards, moveDown 0s 0.1s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards, moveUp 0s 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, materia 0.5s 1s cubic-bezier(0.86, 0, 0.07, 1) forwards;
|
||||||
|
animation: init 0s 0.2s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards, moveDown 0s 0.1s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards, moveUp 0s 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, materia 0.5s 1s cubic-bezier(0.86, 0, 0.07, 1) forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-card header {
|
||||||
|
width: 179px;
|
||||||
|
height: 280px;
|
||||||
|
padding: 40px 20px 30px 20px;
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
border-right: 2px dashed #EEEEEE;
|
||||||
|
background: #FFFFFF;
|
||||||
|
color: #000000;
|
||||||
|
margin-top: 50px;
|
||||||
|
opacity: 0;
|
||||||
|
text-align: center;
|
||||||
|
-webkit-animation: moveIn 0s 1s ease forwards;
|
||||||
|
animation: moveIn 0s 1s ease forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-card header h1 {
|
||||||
|
color: #FF5722;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-card header a {
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
margin: 25px 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.profile-card header a > img {
|
||||||
|
width: 120px;
|
||||||
|
max-width: 100%;
|
||||||
|
-webkit-border-radius: 50%;
|
||||||
|
border-radius: 50%;
|
||||||
|
-webkit-transition: -webkit-box-shadow 0.3s ease;
|
||||||
|
transition: box-shadow 0.3s ease;
|
||||||
|
-webkit-box-shadow: 0px 0px 0px 8px rgba(0, 0, 0, 0.06);
|
||||||
|
box-shadow: 0px 0px 0px 8px rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-card header a:hover > img {
|
||||||
|
-webkit-box-shadow: 0px 0px 0px 12px rgba(0, 0, 0, 0.1);
|
||||||
|
box-shadow: 0px 0px 0px 12px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-card .profile-bio {
|
||||||
|
width: 175px;
|
||||||
|
height: 180px;
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
padding: 50px 20px 30px 20px;
|
||||||
|
background: #FFFFFF;
|
||||||
|
color: #333333;
|
||||||
|
margin-top: 50px;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-animation: moveIn 0s 1s ease forwards;
|
||||||
|
animation: moveIn 0s 1s ease forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-social-links {
|
||||||
|
width: 218px;
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 15px 20px;
|
||||||
|
background: #FFFFFF;
|
||||||
|
margin-top: 50px;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-webkit-animation: moveIn 0s 1s ease forwards;
|
||||||
|
animation: moveIn 0s 1s ease forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-social-links li {
|
||||||
|
list-style: none;
|
||||||
|
margin: -5px 0px 0px 0px;
|
||||||
|
padding: 0px;
|
||||||
|
float: left;
|
||||||
|
width: 25%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-social-links li a {
|
||||||
|
display: inline-block;
|
||||||
|
width: 24px;
|
||||||
|
padding: 6px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-social-links li a i {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-social-links li a img,
|
||||||
|
.profile-social-links li a svg {
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes init {
|
||||||
|
0% {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
margin-top: 0px;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
margin-top: 0px;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes init {
|
||||||
|
0% {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
margin-top: 0px;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
margin-top: 0px;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes puff {
|
||||||
|
100% {
|
||||||
|
top: 50%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0px 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes puff {
|
||||||
|
0% {
|
||||||
|
top: 100%;
|
||||||
|
height: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
top: 50%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0px 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes borderRadius {
|
||||||
|
0% {
|
||||||
|
-webkit-border-radius: 50%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-border-radius: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes borderRadius {
|
||||||
|
0% {
|
||||||
|
-webkit-border-radius: 50%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes moveDown {
|
||||||
|
0% {
|
||||||
|
top: 100%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
top: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes moveDown {
|
||||||
|
0% {
|
||||||
|
top: 100%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
top: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes moveUp {
|
||||||
|
0% {
|
||||||
|
background: #E0E0E0;
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
top: 50%;
|
||||||
|
background: #E0E0E0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes moveUp {
|
||||||
|
0% {
|
||||||
|
background: #E0E0E0;
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
top: 50%;
|
||||||
|
background: #E0E0E0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes materia {
|
||||||
|
0% {
|
||||||
|
background: #E0E0E0;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
width: 440px;
|
||||||
|
height: 280px;
|
||||||
|
background: #FFFFFF;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes materia {
|
||||||
|
0% {
|
||||||
|
background: #E0E0E0;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
width: 440px;
|
||||||
|
height: 280px;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes moveIn {
|
||||||
|
0% {
|
||||||
|
margin-top: 50px;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
margin-top: -20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes moveIn {
|
||||||
|
0% {
|
||||||
|
margin-top: 50px;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
margin-top: -20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes scaleIn {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: scale(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes scaleIn {
|
||||||
|
0% {
|
||||||
|
transform: scale(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes ripple {
|
||||||
|
0% {
|
||||||
|
transform: scale3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
50%,
|
||||||
|
100% {
|
||||||
|
-webkit-transform: scale3d(1, 1, 1);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ripple {
|
||||||
|
0% {
|
||||||
|
transform: scale3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
50%,
|
||||||
|
100% {
|
||||||
|
transform: scale3d(1, 1, 1);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-aspect-ratio: 4/3) {
|
||||||
|
body {
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
body:before {
|
||||||
|
width: 0px;
|
||||||
|
}
|
||||||
|
@-webkit-keyframes puff {
|
||||||
|
0% {
|
||||||
|
top: 100%;
|
||||||
|
width: 0px;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
top: 50%;
|
||||||
|
width: 100%;
|
||||||
|
padding-bottom: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes puff {
|
||||||
|
0% {
|
||||||
|
top: 50%;
|
||||||
|
width: 0px;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
top: 50%;
|
||||||
|
width: 100%;
|
||||||
|
padding-bottom: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-height: 480px) {
|
||||||
|
.profile-card header {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
padding: 30px 20px;
|
||||||
|
display: block;
|
||||||
|
float: none;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
.profile-card .profile-bio {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
padding: 15px 20px 30px 20px;
|
||||||
|
display: block;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
.profile-social-links {
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
@-webkit-keyframes materia {
|
||||||
|
0% {
|
||||||
|
background: #E0E0E0;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
width: 280px;
|
||||||
|
height: 440px;
|
||||||
|
background: #FFFFFF;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes materia {
|
||||||
|
0% {
|
||||||
|
background: #E0E0E0;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
width: 280px;
|
||||||
|
height: 440px;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.django-ckeditor-widget{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stretched-link::after {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
pointer-events: auto;
|
||||||
|
content: "";
|
||||||
|
background-color: rgba(0,0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-comments {
|
||||||
|
padding-bottom: 9px;
|
||||||
|
margin: 5px 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comments-nav {
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-comments .comment-meta {
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-comments .media {
|
||||||
|
border-left: 1px dotted #000;
|
||||||
|
border-bottom: 1px dotted #000;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-comments .media-heading {
|
||||||
|
font-size: 12px;
|
||||||
|
color: grey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-comments .comment-meta a {
|
||||||
|
font-size: 12px;
|
||||||
|
color: grey;
|
||||||
|
font-weight: bolder;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
0
akarpov/static/fonts/.gitkeep
Normal file
0
akarpov/static/fonts/.gitkeep
Normal file
BIN
akarpov/static/images/favicons/favicon.ico
Normal file
BIN
akarpov/static/images/favicons/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
7
akarpov/static/js/bootstrap.bundle.min.js
vendored
Normal file
7
akarpov/static/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
akarpov/static/js/project.js
Normal file
1
akarpov/static/js/project.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/* Project specific Javascript goes here. */
|
9
akarpov/templates/403.html
Normal file
9
akarpov/templates/403.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Forbidden (403){% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>Forbidden (403)</h1>
|
||||||
|
|
||||||
|
<p>{% if exception %}{{ exception }}{% else %}You're not allowed to access this page.{% endif %}</p>
|
||||||
|
{% endblock content %}
|
9
akarpov/templates/404.html
Normal file
9
akarpov/templates/404.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Page not found{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>Page not found</h1>
|
||||||
|
|
||||||
|
<p>{% if exception %}{{ exception }}{% else %}This is not the page you were looking for.{% endif %}</p>
|
||||||
|
{% endblock content %}
|
11
akarpov/templates/500.html
Normal file
11
akarpov/templates/500.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Server Error{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>Ooops!!! 500</h1>
|
||||||
|
|
||||||
|
<h3>Looks like something went wrong!</h3>
|
||||||
|
|
||||||
|
<p>We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.</p>
|
||||||
|
{% endblock content %}
|
11
akarpov/templates/account/account_inactive.html
Normal file
11
akarpov/templates/account/account_inactive.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Account Inactive" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Account Inactive" %}</h1>
|
||||||
|
|
||||||
|
<p>{% translate "This account is inactive." %}</p>
|
||||||
|
{% endblock %}
|
10
akarpov/templates/account/base.html
Normal file
10
akarpov/templates/account/base.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}{% block head_title %}{% endblock head_title %}{% endblock title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 offset-md-3">
|
||||||
|
{% block inner %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
78
akarpov/templates/account/email.html
Normal file
78
akarpov/templates/account/email.html
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Account" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "E-mail Addresses" %}</h1>
|
||||||
|
|
||||||
|
{% if user.emailaddress_set.all %}
|
||||||
|
<p>{% translate 'The following e-mail addresses are associated with your account:' %}</p>
|
||||||
|
|
||||||
|
<form action="{% url 'account_email' %}" class="email_list" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<fieldset class="blockLabels">
|
||||||
|
|
||||||
|
{% for emailaddress in user.emailaddress_set.all %}
|
||||||
|
<div class="radio">
|
||||||
|
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
|
||||||
|
|
||||||
|
<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{%endif %} value="{{emailaddress.email}}"/>
|
||||||
|
|
||||||
|
{{ emailaddress.email }}
|
||||||
|
{% if emailaddress.verified %}
|
||||||
|
<span class="verified">{% translate "Verified" %}</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="unverified">{% translate "Unverified" %}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if emailaddress.primary %}<span class="primary">{% translate "Primary" %}</span>{% endif %}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<button class="secondaryAction btn btn-primary" type="submit" name="action_primary" >{% translate 'Make Primary' %}</button>
|
||||||
|
<button class="secondaryAction btn btn-primary" type="submit" name="action_send" >{% translate 'Re-send Verification' %}</button>
|
||||||
|
<button class="primaryAction btn btn-primary" type="submit" name="action_remove" >{% translate 'Remove' %}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<p><strong>{% translate 'Warning:'%}</strong> {% translate "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<h2>{% translate "Add E-mail Address" %}</h2>
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'account_email' %}" class="add_email">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<button class="btn btn-primary" name="action_add" type="submit">{% translate "Add E-mail" %}</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block inline_javascript %}
|
||||||
|
{{ block.super }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener('DOMContentLoaded',function() {
|
||||||
|
const message = "{% translate 'Do you really want to remove the selected e-mail address?' %}";
|
||||||
|
const actions = document.getElementsByName('action_remove');
|
||||||
|
if (actions.length) {
|
||||||
|
actions[0].addEventListener("click",function(e) {
|
||||||
|
if (!confirm(message)) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Array.from(document.getElementsByClassName('form-group')).forEach(x => x.classList.remove('row'));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
31
akarpov/templates/account/email_confirm.html
Normal file
31
akarpov/templates/account/email_confirm.html
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load account %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Confirm E-mail Address" %}{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Confirm E-mail Address" %}</h1>
|
||||||
|
|
||||||
|
{% if confirmation %}
|
||||||
|
|
||||||
|
{% user_display confirmation.email_address.user as user_display %}
|
||||||
|
|
||||||
|
<p>{% blocktranslate with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="btn btn-primary" type="submit">{% translate 'Confirm' %}</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% url 'account_email' as email_url %}
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
59
akarpov/templates/account/login.html
Normal file
59
akarpov/templates/account/login.html
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load account socialaccount %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Sign In" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
|
||||||
|
<h1>{% translate "Sign In" %}</h1>
|
||||||
|
|
||||||
|
{% get_providers as socialaccount_providers %}
|
||||||
|
|
||||||
|
{% if socialaccount_providers %}
|
||||||
|
<p>
|
||||||
|
{% translate "Please sign in with one of your existing third party accounts:" %}
|
||||||
|
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||||
|
{% blocktranslate trimmed %}
|
||||||
|
Or, <a href="{{ signup_url }}">sign up</a>
|
||||||
|
for a {{ site_name }} account and sign in below:
|
||||||
|
{% endblocktranslate %}
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="socialaccount_ballot">
|
||||||
|
|
||||||
|
<ul class="socialaccount_providers">
|
||||||
|
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="login-or">{% translate "or" %}</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include "socialaccount/snippets/login_extra.html" %}
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||||
|
<p>
|
||||||
|
{% blocktranslate trimmed %}
|
||||||
|
If you have not created an account yet, then please
|
||||||
|
<a href="{{ signup_url }}">sign up</a> first.
|
||||||
|
{% endblocktranslate %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<form class="login" method="POST" action="{% url 'account_login' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
{% if redirect_field_value %}
|
||||||
|
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
||||||
|
{% endif %}
|
||||||
|
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% translate "Forgot Password?" %}</a>
|
||||||
|
<button class="primaryAction btn btn-primary" type="submit">{% translate "Sign In" %}</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
19
akarpov/templates/account/logout.html
Normal file
19
akarpov/templates/account/logout.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Sign Out" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Sign Out" %}</h1>
|
||||||
|
|
||||||
|
<p>{% translate 'Are you sure you want to sign out?' %}</p>
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'account_logout' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% if redirect_field_value %}
|
||||||
|
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
|
||||||
|
{% endif %}
|
||||||
|
<button class="btn btn-danger" type="submit">{% translate 'Sign Out' %}</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
16
akarpov/templates/account/password_change.html
Normal file
16
akarpov/templates/account/password_change.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Change Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Change Password" %}</h1>
|
||||||
|
|
||||||
|
<form method="POST" action="{% url 'account_change_password' %}" class="password_change">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<button class="btn btn-primary" type="submit" name="action">{% translate "Change Password" %}</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
25
akarpov/templates/account/password_reset.html
Normal file
25
akarpov/templates/account/password_reset.html
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load account %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Password Reset" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
|
||||||
|
<h1>{% translate "Password Reset" %}</h1>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
{% include "account/snippets/already_logged_in.html" %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p>{% translate "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>
|
||||||
|
|
||||||
|
<form method="POST" action="{% url 'account_reset_password' %}" class="password_reset">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<input class="btn btn-primary" type="submit" value="{% translate 'Reset My Password' %}" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}Please contact us if you have any trouble resetting your password.{% endblocktranslate %}</p>
|
||||||
|
{% endblock %}
|
16
akarpov/templates/account/password_reset_done.html
Normal file
16
akarpov/templates/account/password_reset_done.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load account %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Password Reset" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Password Reset" %}</h1>
|
||||||
|
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
{% include "account/snippets/already_logged_in.html" %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p>
|
||||||
|
{% endblock %}
|
24
akarpov/templates/account/password_reset_from_key.html
Normal file
24
akarpov/templates/account/password_reset_from_key.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
{% block head_title %}{% translate "Change Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% if token_fail %}{% translate "Bad Token" %}{% else %}{% translate "Change Password" %}{% endif %}</h1>
|
||||||
|
|
||||||
|
{% if token_fail %}
|
||||||
|
{% url 'account_reset_password' as passwd_reset_url %}
|
||||||
|
<p>{% blocktranslate %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktranslate %}</p>
|
||||||
|
{% else %}
|
||||||
|
{% if form %}
|
||||||
|
<form method="POST" action=".">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<input class="btn btn-primary" type="submit" name="action" value="{% translate 'change password' %}"/>
|
||||||
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<p>{% translate 'Your password is now changed.' %}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% block head_title %}{% translate "Change Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Change Password" %}</h1>
|
||||||
|
<p>{% translate 'Your password is now changed.' %}</p>
|
||||||
|
{% endblock %}
|
16
akarpov/templates/account/password_set.html
Normal file
16
akarpov/templates/account/password_set.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Set Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Set Password" %}</h1>
|
||||||
|
|
||||||
|
<form method="POST" action="{% url 'account_set_password' %}" class="password_set">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<input class="btn btn-primary" type="submit" name="action" value="{% translate 'Set Password' %}"/>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
22
akarpov/templates/account/signup.html
Normal file
22
akarpov/templates/account/signup.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Signup" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Sign Up" %}</h1>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
{% if redirect_field_value %}
|
||||||
|
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
||||||
|
{% endif %}
|
||||||
|
<button class="btn btn-primary" type="submit">{% translate "Sign Up" %} »</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
11
akarpov/templates/account/signup_closed.html
Normal file
11
akarpov/templates/account/signup_closed.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Sign Up Closed" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Sign Up Closed" %}</h1>
|
||||||
|
|
||||||
|
<p>{% translate "We are sorry, but the sign up is currently closed." %}</p>
|
||||||
|
{% endblock %}
|
12
akarpov/templates/account/verification_sent.html
Normal file
12
akarpov/templates/account/verification_sent.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Verify Your E-mail Address" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Verify Your E-mail Address" %}</h1>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
{% endblock %}
|
21
akarpov/templates/account/verified_email_required.html
Normal file
21
akarpov/templates/account/verified_email_required.html
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Verify Your E-mail Address" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Verify Your E-mail Address" %}</h1>
|
||||||
|
|
||||||
|
{% url 'account_email' as email_url %}
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}This part of the site requires us to verify that
|
||||||
|
you are who you claim to be. For this purpose, we require that you
|
||||||
|
verify ownership of your e-mail address. {% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}We have sent an e-mail to you for
|
||||||
|
verification. Please click on the link inside this e-mail. Please
|
||||||
|
contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your e-mail address</a>.{% endblocktranslate %}</p>
|
||||||
|
{% endblock %}
|
113
akarpov/templates/base.html
Normal file
113
akarpov/templates/base.html
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
{% load static i18n %}<!DOCTYPE html>
|
||||||
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
|
<html lang="{{ LANGUAGE_CODE }}">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
<title>{% block title %}akarpov{% endblock title %}</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="My collection of apps and tools">
|
||||||
|
<meta name="author" content="sanspie">
|
||||||
|
|
||||||
|
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
<!-- Latest compiled and minified Bootstrap CSS -->
|
||||||
|
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.2/font/bootstrap-icons.css">
|
||||||
|
<!-- Your stuff: Third-party CSS libraries go here -->
|
||||||
|
|
||||||
|
<!-- This file stores project-specific CSS -->
|
||||||
|
<link href="{% static 'css/project.css' %}" rel="stylesheet">
|
||||||
|
{% endblock %}
|
||||||
|
<!-- Le javascript
|
||||||
|
================================================== -->
|
||||||
|
{# Placed at the top of the document so pages load faster with defer #}
|
||||||
|
{% block javascript %}
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script defer src="{% static 'js/bootstrap.bundle.min.js' %}" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
<!-- Your stuff: Third-party javascript libraries go here -->
|
||||||
|
|
||||||
|
<!-- place project specific Javascript in this file -->
|
||||||
|
<script defer src="{% static 'js/project.js' %}"></script>
|
||||||
|
|
||||||
|
{% endblock javascript %}
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<nav class="navbar navbar-expand-md navbar-light bg-light">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="{% url 'blog:post_list' %}">akarpov</a>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
<li class="nav-item active">
|
||||||
|
<a class="nav-link" href="{% url 'home' %}">Home <span class="visually-hidden">(current)</span></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'about' %}">About</a>
|
||||||
|
</li>
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
<li class="nav-item">
|
||||||
|
{# URL provided by django-allauth/account/urls.py #}
|
||||||
|
<a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% translate "My Profile" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
{# URL provided by django-allauth/account/urls.py #}
|
||||||
|
<a class="nav-link" href="{% url 'account_logout' %}">{% translate "Sign Out" %}</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||||
|
<li class="nav-item">
|
||||||
|
{# URL provided by django-allauth/account/urls.py #}
|
||||||
|
<a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% translate "Sign Up" %}</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
<li class="nav-item">
|
||||||
|
{# URL provided by django-allauth/account/urls.py #}
|
||||||
|
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% translate "Sign In" %}</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
{% if messages %}
|
||||||
|
{% for message in messages %}
|
||||||
|
<div class="alert alert-dismissible {% if message.tags %}alert-{{ message.tags }}{% endif %}">
|
||||||
|
{{ message }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<p>Use this document as a way to quick start any new project.</p>
|
||||||
|
{% endblock content %}
|
||||||
|
|
||||||
|
</div> <!-- /container -->
|
||||||
|
|
||||||
|
{% block modal %}{% endblock modal %}
|
||||||
|
|
||||||
|
{% block inline_javascript %}
|
||||||
|
{% comment %}
|
||||||
|
Script tags with only code, no src (defer by default). To run
|
||||||
|
with a "defer" so that you run inline code:
|
||||||
|
<script>
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {/* Run whatever you want */});
|
||||||
|
</script>
|
||||||
|
{% endcomment %}
|
||||||
|
{% endblock inline_javascript %}
|
||||||
|
</body>
|
||||||
|
</html>
|
20
akarpov/templates/blog/form.html
Normal file
20
akarpov/templates/blog/form.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block title %}editing post on akarpov{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form class="pt-2" enctype="multipart/form-data" method="POST" id="designer-form">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.media }}
|
||||||
|
{% for field in form %}
|
||||||
|
{{ field|as_crispy_field }}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="mt-4 flex justify-end space-x-4">
|
||||||
|
<button class="btn btn-secondary" type="submit" id="submit">
|
||||||
|
Save Changes
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
32
akarpov/templates/blog/list.html
Normal file
32
akarpov/templates/blog/list.html
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load humanize %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}posts on akarpov{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
<button class="btn mb-3 btn-sm btn-outline-light" type="button"><a href="{% url 'blog:post_create' %}" style="text-decoration: none; color:lightgray"><i class="bi bi-pen"></i>write new post</a></button>
|
||||||
|
{% endif %}
|
||||||
|
<div class="row mb-2">
|
||||||
|
{% for post in post_list %}
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="row g-0 border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative">
|
||||||
|
<div class="col p-4 d-flex flex-column position-static">
|
||||||
|
<strong style="color: {{ post.h_tag.color }}" class="d-inline-block mb-2">{{ post.h_tag.name }}</strong>
|
||||||
|
<h3 class="mb-0">{{ post.title }}</h3>
|
||||||
|
<p class="card-text"><small class="text-muted">{{ post.edited | naturaltime }}</small></p>
|
||||||
|
<p class="card-text mb-auto">This is a wider card with supporting text below as a natural lead-in to additional content.</p>
|
||||||
|
<a href="{% url 'blog:post' post.slug %}" class="stretched-link"></a>
|
||||||
|
<p class="card-text mt-4">{{ post.get_rating }}
|
||||||
|
<i class="bi bi-eye ms-3"></i>{{ post.post_views }}
|
||||||
|
<i class="bi bi-chat ms-3"></i> {{ post.comment_count }}</p>
|
||||||
|
</div>
|
||||||
|
{% if post.image_cropped %}
|
||||||
|
<img class="col-auto d-none d-lg-block img-fluid" style="object-fit: cover" src="{{ post.image_cropped.url }}" alt="">
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}z
|
116
akarpov/templates/blog/post.html
Normal file
116
akarpov/templates/blog/post.html
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load humanize %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}{{ post.title }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="mb-5 mt-3">
|
||||||
|
<h1 class="title fs-1">{{ post.title }}
|
||||||
|
{% if request.user == post.creator %}
|
||||||
|
<a class="justify-content-center" href="{% url 'blog:post_edit' post.slug %}">
|
||||||
|
<i style="color:black" class="bi bi-pen fs-6"></i></a>
|
||||||
|
{% endif %}
|
||||||
|
</h1>
|
||||||
|
<div class="row g-2 ms-1">
|
||||||
|
<div class="col-md-auto">
|
||||||
|
By: <a href="{% url 'users:detail' post.creator.username %}">
|
||||||
|
{% if post.creator.image_cropped %}<img class="rounded" width="20" src="{{ post.creator.image_cropped.url }}" alt=""> {% endif %}
|
||||||
|
{{ post.creator.username }}</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-auto fw-light">
|
||||||
|
Created {{ post.created | naturalday }},
|
||||||
|
updated {{ post.edited | naturaltime }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-2 ms-1 mt-1">
|
||||||
|
<div class="col-auto">Tags: </div>
|
||||||
|
{% for tag in post.h_tags %}
|
||||||
|
<div class="col-auto">
|
||||||
|
<a href="{% url 'blog:post_list' %}?tag={{ tag.name }}" style="color:{{ tag.color }}; text-decoration: none">{{ tag.name }}</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% if post.image %}
|
||||||
|
<img class="mt-2 img-responsive img-fluid" alt="" style="width: 100%; height: 25rem; object-fit: cover" src="{{ post.image.url }}">
|
||||||
|
{% endif %}
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
<p>{{ post.body|safe }}</p>
|
||||||
|
<div class="mt-4">
|
||||||
|
<hr>
|
||||||
|
<div class="row g-2">
|
||||||
|
<div class="col-md-auto" id="rating">
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
{% autoescape off %} {{ rating_bar }} {% endautoescape %}
|
||||||
|
{% else %}
|
||||||
|
{% if post.rating < 0 %}
|
||||||
|
<div class="success col-auto align-self-center mt-1"> {{ post.rating }}</div>
|
||||||
|
{% elif post.rating == 0 %}
|
||||||
|
<div class="success col-auto align-self-center gray fw-light mt-1"> {{ post.rating }}</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="success col-auto align-self-center mt-1"> +{{ post.rating }}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-auto mt-2 d-flex justify-content-center text-center col-sm-2">
|
||||||
|
<i class="bi bi-eye align-self-center"></i> <div class="align-self-center ms-1">{{ post.post_views | intword }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-auto mt-2 d-flex justify-content-center text-center col-sm-2">
|
||||||
|
<i class="bi bi-chat align-self-center"></i> <div class="align-self-center ms-1"> {{ post.comment_count }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-sm-2 col-xl-6"></div>
|
||||||
|
<div class="col-md-auto mt-3 col-sm-2 d-flex justify-content-center text-center">
|
||||||
|
Created: {{ post.created|date:"d.m.Y" }} {{ post.created|time:"H:i" }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-auto mt-3 d-flex justify-content-center text-center">
|
||||||
|
Updated: {{ post.edited|date:"d.m.Y" }} {{ post.edited|time:"H:i" }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mt-2 mb-3">
|
||||||
|
<form action="{% url 'blog:comment' post.slug %}" method="post" class="col" id="comments">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div>
|
||||||
|
<label for="textarea" class="form-label">write your comments</label>
|
||||||
|
<textarea name="body" class="form-control" id="textarea" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-sm btn-secondary mt-2" type="submit">Send</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-md-12 col-lg-10 col-xl-8">
|
||||||
|
{% for comment in post.get_comments %}
|
||||||
|
<div class="col mb-5">
|
||||||
|
<div class="d-flex flex-start">
|
||||||
|
{% if comment.author.image_cropped %}
|
||||||
|
<img class="rounded-circle shadow-1-strong me-3"
|
||||||
|
src="{{ comment.author.image_cropped.url }}" alt="avatar" width="65"
|
||||||
|
height="65" />
|
||||||
|
{% endif %}
|
||||||
|
<div class="flex-grow-1 flex-shrink-1">
|
||||||
|
<div>
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<p class="mb-1">
|
||||||
|
{{ comment.author.username }} <span class="small">- {{ comment.created | naturaltime }}</span>
|
||||||
|
</p>
|
||||||
|
<button class="btn btn-outline-primary"><i class="bi bi-reply"></i><span class="small"> reply</span></button>
|
||||||
|
</div>
|
||||||
|
<p class="small mb-0">
|
||||||
|
{{ comment.body }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function addComment(){
|
||||||
|
console.log("aaaaa")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
1
akarpov/templates/pages/about.html
Normal file
1
akarpov/templates/pages/about.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{% extends "base.html" %}
|
1
akarpov/templates/pages/home.html
Normal file
1
akarpov/templates/pages/home.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{% extends "base.html" %}
|
47
akarpov/templates/users/user_detail.html
Normal file
47
akarpov/templates/users/user_detail.html
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}User: {{ object.username }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<aside class="profile-card">
|
||||||
|
<header>
|
||||||
|
<!-- here’s the avatar -->
|
||||||
|
<a target="_blank" href="#">
|
||||||
|
{% if object.image_cropped %}<img src="{{ object.image_cropped.url }}" class="hoverZoomLink">{% endif %}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- the username -->
|
||||||
|
<h1>{{ object.username }}</h1>
|
||||||
|
|
||||||
|
<!-- and role or location -->
|
||||||
|
<h2>{% if object.name %}{{ object.name }}{% endif %}</h2>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- bit of a bio; who are you? -->
|
||||||
|
<div class="profile-bio">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ object.about }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<ul class="profile-social-links">
|
||||||
|
{% if object == request.user %}
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'users:update' %}">
|
||||||
|
<i class="bi bi-sliders"></i>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'users:update' %}">
|
||||||
|
<i class="bi bi-envelope"></i>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
<!-- End Action buttons -->
|
||||||
|
</aside>
|
||||||
|
{% endblock content %}
|
17
akarpov/templates/users/user_form.html
Normal file
17
akarpov/templates/users/user_form.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block title %}{{ user.username }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ user.username }}</h1>
|
||||||
|
<form class="form-horizontal" enctype="multipart/form-data" method="post" action="{% url 'users:update' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<button type="submit" class="btn btn-primary">Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
0
akarpov/users/__init__.py
Normal file
0
akarpov/users/__init__.py
Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user