diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 28cee3f..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-*.html linguist-detectable=false
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
deleted file mode 100644
index 52567b4..0000000
--- a/.github/workflows/codeql-analysis.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-# For most projects, this workflow file will not need changing; you simply need
-# to commit it to your repository.
-#
-# You may wish to alter this file to override the set of languages analyzed,
-# or to provide custom queries or build logic.
-#
-# ******** NOTE ********
-# We have attempted to detect the languages in your repository. Please check
-# the `language` matrix defined below to confirm you have the correct set of
-# supported CodeQL languages.
-#
-name: "CodeQL"
-
-on:
- push:
- branches: [ master ]
- pull_request:
- # The branches below must be a subset of the branches above
- branches: [ master ]
- schedule:
- - cron: '29 8 * * 1'
-
-jobs:
- analyze:
- name: Analyze
- runs-on: ubuntu-latest
- permissions:
- actions: read
- contents: read
- security-events: write
-
- strategy:
- fail-fast: false
- matrix:
- language: [ 'javascript', 'python' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
- # Learn more about CodeQL language support at https://git.io/codeql-language-support
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v2
- with:
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
- # queries: ./path/to/local/query, your-org/your-repo/queries@main
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v2
-
- # ℹ️ Command-line programs to run using the OS shell.
- # 📚 https://git.io/JvXDl
-
- # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
- # and modify them (or add more) to build your code if your project
- # uses a compiled language
-
- #- run: |
- # make bootstrap
- # make release
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml
deleted file mode 100644
index 2f3d7f4..0000000
--- a/.github/workflows/django.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-name: Django CI
-
-on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
- strategy:
- max-parallel: 4
- matrix:
- python-version: [3.7, 3.8, 3.9]
-
- steps:
- - uses: actions/checkout@v3
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v3
- with:
- python-version: ${{ matrix.python-version }}
- - name: Install Dependencies
- run: |
- python -m pip install --upgrade pip
- pip install -r requirements.txt
- - name: Run Tests
- run: |
- python manage.py test
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 36eb9c1..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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/
-share/python-wheels/
-*.egg-info/
-.installed.cfg
-*.egg
-MANIFEST
-
-# 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/
-.nox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*.cover
-*.py,cover
-.hypothesis/
-.pytest_cache/
-cover/
-
-# Translations
-*.mo
-*.pot
-
-# Django stuff:
-*.log
-local_settings.py
-db.sqlite3
-db.sqlite3-journal
-
-
-
-
-
-# PEP 582; used by e.g. github.com/David-OConnor/pyflow
-__pypackages__/
-
-# Environments
-.env
-.venv
-env/
-venv/
-ENV/
-env.bak/
-venv.bak/
-cloneenv/
-static_cdn/
-staticfiles/
-
-
-
-# PyCharm
-# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
-# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
-# and can be added to the global gitignore or merged into this file. For a more nuclear
-# option (not recommended) you can uncomment the following to ignore the entire idea folder.
-.idea/
\ No newline at end of file
diff --git a/Functionalities.md b/Functionalities.md
deleted file mode 100644
index 3be869f..0000000
--- a/Functionalities.md
+++ /dev/null
@@ -1,41 +0,0 @@
-
-### Functionalities ###
-Functionalities | Status
-------------- | -------------|
-Close Questions | Completed
-Flag Question | Completed
-Flag Answer | Completed
-Offer Bounty | Completed
-Question Timeline | Completed
-Question Edit History | Completed
-Answer Timeline | Completed
-Answer Timeline | Completed
-Ajax Tags Search | Completed
-Ajax Users Search | Completed
-Bronze Badges | Completed
-Silver Badges | Completed
-Graph for Reputation Representation | Completed
-Track Badge | Completed
-Track Tag | Completed
-Bookmark Question | Completed
-Reputation Track | Completed
-Record Every Action | Completed
-Live Markdown Review | Completed
-Review Closed Questions | Completed
-Review Low Quality Posts | Completed
-Review First Questions | Completed
-Review First Answers | Completed
-Review Re-Open Question | Completed
-Review Suggested Edits | Completed
-Review Flagged Posts | Completed
-Review Flagged Comments | Completed
-Notifications | Completed
-Privilege Notification | Completed
-Moderator Tools | Completed
-Privileges | Completed
-Search Functionality | Completed
-Storing Edit History | Completed
-
-
-Some functionalities are still left to implement (like Forgot Password, Reset Password, Advanced Ban User)and I will implement some of them
-in next commit or update
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 96c1b3e..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (C) 2022 Yawan-1
-
-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.
\ No newline at end of file
diff --git a/Procfile b/Procfile
deleted file mode 100644
index 5bdc8a3..0000000
--- a/Procfile
+++ /dev/null
@@ -1 +0,0 @@
-web: gunicorn main.wsgi --log-file -
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index 463d391..0000000
--- a/README.md
+++ /dev/null
@@ -1,118 +0,0 @@
-## StackOver Flow - Clone
-
- Nothing to preview
-
-
-
-
-A Clone of StackOver Flow, I implemented almost every functionalities,
-I just wanted to notice and show developers how StackOver-Flow works
-, do tasks under the hood, how tasks and queries are executing behind the scenes.
-
-## Images
-
-
-
-## Demo
-
-Here is a working live demo : Demo (Removed from heroku because usage of so's production LOGO But I will be back with my own better design than them)
-
-## Technology Stack
-
-* [Python 3.7.x](https://www.python.org/)
-* [Django Web Framework 3.2.x](https://www.djangoproject.com/)
-* [Redis 5.x](https://pypi.org/project/django-redis/)
-* [BootStrap 4](https://getbootstrap.com/)
-* [Jquery 3](https://api.jquery.com/)
-* [Postgresql 14](https://www.postgresql.org/)
-
-
-## Functionalities
-
-
-* 50+ Badges are implemented to award
-* 20 Privileges to Earn
-* Track Badges
-* Reputation Awarding
-* Privilege and Activity Notifications
-* Live Q&A MarkDown Preview
-* User @mentioning in comments
-* Create and award Bounties
-*
Threading
to keep track of the remaining days of Bounty.
-* Reviewing Tasks :
- * First Question Review
- * First Answer Review
- * Late Answer Review
- * Review Flag Posts
- * Review Flag Comments
- * Review Close Votes
- * Review ReOpen Votes
- * Review Low-Quality Posts
- * Review Suggested Edits
-
-
-* And much more. You can find list of all functionalities Here
-
-
-## Setup Commands
-
-Clone this repository
-
-1. Clone this project using
-````
-$ git clone https://github.com/Yawan-1/StackOverFlow--Clone
-````
-
-For Postgresql usage*, you will need to download and install it.
-
-1. Download Postgresql from [this Link](https://www.postgresql.org/download/)
-2. After installation, create Database in postgresql shell using these commands
- 1. `CREATE DATABASE so_clone;`
- 2. `CREATE USER so_clone_user WITH PASSWORD 'password';`
- 3. `GRANT ALL PRIVILEGES ON DATABASE so_clone TO so_clone_user;`
-3. and fill **database name** , **database password** and **user** in `settings.py` like
-
- ````
- DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.postgresql_psycopg2',
- 'NAME': 'so_clone',
- 'USER': 'so_clone_user',
- 'PASSWORD': 'password',
- 'HOST': 'localhost',
- 'PORT': '',
- }
-}
- ````
-
-_*Note: You can skip postgresql installation if you're setting up this project using sqlite. simply just comment the postgresql configuration and uncomment sqlite configuration_
-
-
-
-Now run make migrations
command, running make migrations command will perform Data Migrations to save the "Badges" in the database.
-then migrate to load the operations of Data Migrations in database.
-````
-$ python manage.py makemigrations
-$ python manage.py migrate
-````
-
-Then, simply run the server using this command.
-````
-$ python manage.py runserver
-````
-
-## Deployment
-
-The following details and steps on how to deploy this application
-
-#### Heroku
-
-See detailed [Deploying django app on Heroku](https://devcenter.heroku.com/articles/django-app-configuration)
-
-
-## Contributing
-
-If you have any question or issues, It may have bugs that i may have missed. You can create Pull request or you can also contact me.
-
-
-
diff --git a/SECURITY.md b/SECURITY.md
deleted file mode 100644
index 034e848..0000000
--- a/SECURITY.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Security Policy
-
-## Supported Versions
-
-Use this section to tell people about which versions of your project are
-currently being supported with security updates.
-
-| Version | Supported |
-| ------- | ------------------ |
-| 5.1.x | :white_check_mark: |
-| 5.0.x | :x: |
-| 4.0.x | :white_check_mark: |
-| < 4.0 | :x: |
-
-## Reporting a Vulnerability
-
-Use this section to tell people how to report a vulnerability.
-
-Tell them where to go, how often they can expect to get an update on a
-reported vulnerability, what to expect if the vulnerability is accepted or
-declined, etc.
diff --git a/Upcoming Features and Issues to Fix.md b/Upcoming Features and Issues to Fix.md
deleted file mode 100644
index be4483a..0000000
--- a/Upcoming Features and Issues to Fix.md
+++ /dev/null
@@ -1,15 +0,0 @@
-## New Features to Implement in next update or commit.
-
-1). **Feature of Ban and UnBan User**
-
-2). **Better threading options or better background task handler instead of Threads**
-
-3). **Forget PassWord**
-
-4). **Reset Password**
-
-5). **Add tests**
-
-6). **Show popup of Available Tags to attach with the posts**
-
-7). **Adding Search Bar**
diff --git a/db.sqlite3 b/db.sqlite3
new file mode 100644
index 0000000..1c4f10d
Binary files /dev/null and b/db.sqlite3 differ
diff --git a/help/apps.py b/help/apps.py
deleted file mode 100644
index 1fff0bd..0000000
--- a/help/apps.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.apps import AppConfig
-
-
-class HelpConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'help'
diff --git a/help/urls.py b/help/urls.py
deleted file mode 100644
index 8efe8cf..0000000
--- a/help/urls.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from django.urls import path
-from django.conf import settings
-from django.conf.urls.static import static
-from . import views
-
-app_name = 'help'
-
-urlpatterns = [
-
- path('privileges/', views.privileges, name='privileges'),
-
-
-]
\ No newline at end of file
diff --git a/help/views.py b/help/views.py
deleted file mode 100644
index 7d02915..0000000
--- a/help/views.py
+++ /dev/null
@@ -1,69 +0,0 @@
-from django.shortcuts import render
-
-def privileges(request):
-
- context = {}
- return render(request, 'help/privileges.html', context)
-
-
-
-def CreateWikiPosts_Privilege_Info_Page(request):
-
- return render(request, 'privileges/createWikiPosts.html', context)
-
-def RemoveNewUserRestric_Privilege_Info_Page(request):
-
- return render(request, 'privileges/RemoveNewUserRestric.html', context)
-
-def VoteUp_Privilege_Info_Page(request):
-
- return render(request, 'privileges/VoteUp.html', context)
-
-def FlagPost_Privilege_Info_Page(request):
-
- return render(request, 'privileges/FlagPost.html', context)
-
-def CommentEveryWhere_Privillege_Info_Page(request):
-
- return render(request, 'privileges/CommentEveryWhere.html', context)
-
-def SetBounty_Privilege_Info_Page(request):
-
- return render(request, 'privileges/SetBounty.html', context)
-
-def VoteDown_Privilege_Info_Page(request):
-
- return render(request, 'privileges/VoteDown.html', context)
-
-def ViewCloseVote_Privilege_Info_Page(request):
-
- return render(request, 'privileges/ViewCloseVote.html', context)
-
-def AccessReviewQueue_Privilege_Info_Page(request):
-
- return render(request, 'privileges/AccessReviewQueue.html', context)
-
-def EstablishedUser_Privilege_Info_Page(request):
-
- return render(request, 'privileges/EstablishedUser.html', context)
-
-def CreateTags_Privilege_Info_Page(request):
-
- return render(request, 'privileges/CreateTags.html', context)
-
-def EditQuestionAnswer__Privilege_Info_Page(request):
-
- return render(request, 'privileges/EditQuestionAnswer.html', context)
-
-def AccessToModTools_Privilege_Info_Page(request):
-
- return render(request, 'privileges/AccessToModTools.html', context)
-
-def ProtectQ_Privilege_Info_Page(request):
-
- return render(request, 'privileges/ProtectQ.html', context)
-
-def TrustedUser_Privilege_Info_Page(request):
-
- return render(request, 'privileges/TrustedUser.html', context)
-
diff --git a/images/animation.gif b/images/animation.gif
deleted file mode 100644
index 871bc7a..0000000
Binary files a/images/animation.gif and /dev/null differ
diff --git a/main/config.py b/main/config.py
deleted file mode 100644
index f14caf4..0000000
--- a/main/config.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# VOTE SHOULD LOCK IN MINUTES.
-# In question_upvote_downvote
-UPVOTE_TIME_LIMIT = timezone.now() - timedelta(hours=10)
-
-# NEW USER CAN ASK SECOND QUESTION IN MINUTES.
-# In new_question
-NEW_QUESTION_MINUTE_LIMIT = timezone.now() - timedelta(minutes=90)
-
diff --git a/main/settings.py b/main/settings.py
deleted file mode 100644
index 7c279a2..0000000
--- a/main/settings.py
+++ /dev/null
@@ -1,271 +0,0 @@
-from pathlib import Path
-import os
-import django_heroku
-from django.conf import settings
-
-# Build paths inside the project like this: BASE_DIR / 'subdir'.
-BASE_DIR = Path(__file__).resolve().parent.parent
-
-
-# Quick-start development settings - unsuitable for production
-
-# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'django-insecure-=dei9kx=^q))zm#z-(_cwdii75e-4bsf5_7suo9ll&besz088u'
-# from django.conf import settings
-settings.configure()
-# SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = False
-
-ALLOWED_HOSTS = ['https://stackoverflow---clone.herokuapp.com/','localhost','http://127.0.0.1','stackoverflow---clone.herokuapp.com','.herokuapp.com']
-
-# Application definition
-
-INSTALLED_APPS = [
- 'adminactions',
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'django.contrib.humanize',
- # App
- 'profile',
- # App
- 'users',
- # App
- 'qa',
- # App
- 'notification',
- # App
- 'review',
- # App
- 'tagbadge',
- # App
- 'help',
- 'taggit',
- 'crispy_forms',
- 'martor',
- 'simple_history',
- # 'background_task',
- 'review.templatetags',
- 'tagbadge.tb_templatetags',
- 'online_users',
- # 'debug_toolbar',
- 'tools',
-]
-
-MAX_ATTEMPTS = 1
-
-SECURE_BROWSER_XSS_FILTER = True
-
-
-CRISPY_TEMPLATE_PACK = 'bootstrap4'
-
-MIDDLEWARE = [
- 'simple_history.middleware.HistoryRequestMiddleware',
- 'whitenoise.middleware.WhiteNoiseMiddleware', #add whitenoise
- 'django.middleware.security.SecurityMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.middleware.common.CommonMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
- 'django.middleware.clickjacking.XFrameOptionsMiddleware',
- 'online_users.middleware.OnlineNowMiddleware',
- # 'debug_toolbar.middleware.DebugToolbarMiddleware',
-]
-
-ROOT_URLCONF = 'main.urls'
-
-TEMPLATE_DIR = os.path.join(BASE_DIR,"templates")
-
-TEMPLATES = [
- {
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [TEMPLATE_DIR],
- 'APP_DIRS': True,
- 'OPTIONS': {
- 'context_processors': [
- 'django.template.context_processors.debug',
- 'django.template.context_processors.request',
- 'django.contrib.auth.context_processors.auth',
- 'django.contrib.messages.context_processors.messages',
- 'review.context_processors.reviewAnswer_cp',
- 'review.context_processors.returnTrue',
- 'review.context_processors.reviewQuestion_cp',
- 'review.context_processors.returnTrue_or_False',
- 'review.context_processors.reviewLateAnswer_cp',
- 'review.context_processors.returnLateReview_True_or_False',
- 'review.context_processors.reviewClosedQuestions',
- 'review.context_processors.returnTrue_or_FalseClosedQuestions',
- 'review.context_processors.reviewReOpenQuestion_sVotes',
- 'review.context_processors.returnTrue_or_FalseUnCloseQuestion_s',
- 'review.context_processors.reviewEditedPosts',
- 'review.context_processors.returnTrue_or_FalseEditPosts',
- 'review.context_processors.reviewLowQualityPosts',
- 'review.context_processors.returnTrue_or_FalseLowPosts',
- 'review.context_processors.reviewFlagPosts',
- 'review.context_processors.returnTrue_or_FalseFlagPosts',
- 'review.context_processors.reviewFlagComments',
- 'review.context_processors.returnTrue_or_FalseFlagComments',
- 'notification.context_processors.privNotificationViewer',
- 'notification.context_processors.notificationViewer',
- 'profile.context_processors.top_questions',
- 'profile.context_processors.count_all_bounties',
-
- ],
- },
- },
-]
-
-WSGI_APPLICATION = 'main.wsgi.application'
-
-
-# DATABASES
-
-"""
-If you don't want to use postgresql then remove comment of sqlite's configuration and
-comment in the postgresql configuration
-"""
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': BASE_DIR / 'db.sqlite3',
- }
-}
-
-# DATABASES = {
-# 'default': {
-# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
-# 'NAME': 'POSTGRESQL_NAME',
-# 'USER': 'POSTGRESQL_USER',
-# 'PASSWORD': 'POSTGRESQL_PASSWORD',
-# 'HOST': 'localhost',
-# 'PORT': '',
-# }
-# }
-
-# Password validation
-
-AUTH_PASSWORD_VALIDATORS = [
- {
- 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
- },
-]
-
-CACHES = {
- "default": {
- "BACKEND": "django_redis.cache.RedisCache",
- "LOCATION": "redis://127.0.0.1:6379/1",
- "OPTIONS": {
- "CLIENT_CLASS": "django_redis.client.DefaultClient"
- },
- "KEY_PREFIX": "example"
- }
-}
-CACHE_TTL = 60 * 15
-
-# Internationalization
-
-LANGUAGE_CODE = 'en-us'
-
-TIME_ZONE = 'Asia/Kolkata'
-
-USE_I18N = True
-
-USE_L10N = True
-
-USE_TZ = True
-
-
-# os.path.join(BASE_DIR, "static", "static")
-
-#MY SETTINGS FOR LOGIN.
-LOGIN_URL = 'users:login_request'
-
-# STATICFILES_DIRS = [
-# os.path.join(BASE_DIR, 'static'),
-# os.path.join(BASE_DIR, 'media'),
-# ]
-
-# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-
-BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-
-STATICFILES_DIRS = (
- os.path.join(BASE_DIR, 'static'),
-)
-# Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/1.9/howto/static-files/
-STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
-STATIC_URL = '/static/'
-
-# Extra places for collectstatic to find static files.
-
-MEDIA_URL = '/media/'
-MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
-
-# Heroku setting
-# Serving the statics through Whitenoise in Heroku
-STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
-
-DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
-
-# Martor Configuration
-MARTOR_THEME = 'bootstrap' # semantic
-MARTOR_ENABLE_LABEL = True
-MARTOR_ENABLE_CONFIGS = {
- 'emoji': 'true', # to enable/disable emoji icons.
- 'imgur': 'true', # to enable/disable imgur/custom uploader.
- 'mention': 'true', # to enable/disable mention
- 'jquery': 'true', # to include/revoke jquery (require for admin default django)
- 'living': 'true', # to enable/disable live updates in preview
- 'spellcheck': 'true', # to enable/disable spellcheck in form textareas
- 'hljs': 'true', # to enable/disable hljs highlighting in preview
-}
-MARTOR_TOOLBAR_BUTTONS = [
- 'bold', 'italic', 'horizontal', 'heading', 'pre-code',
- 'blockquote', 'unordered-list', 'ordered-list',
- 'link', 'image-link', 'image-upload', 'emoji',
- 'direct-mention', 'toggle-maximize', 'help'
-]
-
-CKEDITOR_JQUERY_URL = 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js'
-
-CKEDITOR_UPLOAD_PATH = 'uploads/'
-CKEDITOR_IMAGE_BACKEND = "pillow"
-
-# django debug toolbar configuration
-# INTERNAL_IPS = [
-# '127.0.0.1',
-# ]
-
-# DEBUG_TOOLBAR_PANELS = [
-# 'debug_toolbar.panels.history.HistoryPanel',
-# 'debug_toolbar.panels.versions.VersionsPanel',
-# 'debug_toolbar.panels.timer.TimerPanel',
-# 'debug_toolbar.panels.settings.SettingsPanel',
-# 'debug_toolbar.panels.headers.HeadersPanel',
-# 'debug_toolbar.panels.request.RequestPanel',
-# 'debug_toolbar.panels.sql.SQLPanel',
-# 'debug_toolbar.panels.staticfiles.StaticFilesPanel',
-# 'debug_toolbar.panels.templates.TemplatesPanel',
-# 'debug_toolbar.panels.cache.CachePanel',
-# 'debug_toolbar.panels.signals.SignalsPanel',
-# 'debug_toolbar.panels.logging.LoggingPanel',
-# 'debug_toolbar.panels.redirects.RedirectsPanel',
-# 'debug_toolbar.panels.profiling.ProfilingPanel',
-# ]
-
-# Heroku setting
-django_heroku.settings(locals())
diff --git a/main/urls.py b/main/urls.py
deleted file mode 100644
index 0f44a8f..0000000
--- a/main/urls.py
+++ /dev/null
@@ -1,43 +0,0 @@
-"""main URL Configuration
-
-The `urlpatterns` list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/3.2/topics/http/urls/
-Examples:
-Function views
- 1. Add an import: from my_app import views
- 2. Add a URL to urlpatterns: path('', views.home, name='home')
-Class-based views
- 1. Add an import: from other_app.views import Home
- 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
-Including another URLconf
- 1. Import the include() function: from django.urls import include, path
- 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
-"""
-from django.contrib import admin
-from django.urls import path,include
-from django.conf.urls.static import static
-from django.conf import settings
-from qa import views as qa_views
-# import debug_toolbar
-
-handler404 = qa_views.handler404
-handler500 = qa_views.handler500
-
-urlpatterns = [
- path('admin/', admin.site.urls),
- path('', include('profile.urls')),
- path('', include('qa.urls')),
- path('', include('notification.urls')),
- path('', include('tagbadge.urls')),
- path('', include('help.urls')),
- path('', include('review.urls')),
- path('', include('tools.urls')),
- path('accounts/',include('users.urls')),
- path('adminactions/', include('adminactions.urls')),
- path('martor/', include('martor.urls')),
- # path('__debug__/', include(debug_toolbar.urls)),
-
-]
-
-urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
-urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
diff --git a/manage.py b/manage.py
index fbda2b3..11e8b4e 100644
--- a/manage.py
+++ b/manage.py
@@ -6,7 +6,7 @@
def main():
"""Run administrative tasks."""
- os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings')
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "telhub.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
@@ -18,5 +18,5 @@ def main():
execute_from_command_line(sys.argv)
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/media/media/isle.jpg b/media/media/isle.jpg
deleted file mode 100644
index 0621ff1..0000000
Binary files a/media/media/isle.jpg and /dev/null differ
diff --git a/media/profile_photos/isle.jpg b/media/profile_photos/isle.jpg
deleted file mode 100644
index 0621ff1..0000000
Binary files a/media/profile_photos/isle.jpg and /dev/null differ
diff --git a/migrations.py b/migrations.py
deleted file mode 100644
index b766b4c..0000000
--- a/migrations.py
+++ /dev/null
@@ -1,154 +0,0 @@
-# Generated by Django __version__ on __date__
-
-from django.db import migrations
-
-from django.db import migrations
-from django.utils import timezone
-
-def saveTagBadge(apps, schema_editor):
- TagBadge = apps.get_model("tagbadge", "TagBadge")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First bounty you manually award on another person's question", tag_name="Altruist",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First bounty you manually award on your own question", tag_name="Benefactor",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Question bookmarked by 25 users", tag_name="Favorite Question",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Question bookmarked by 100 users", tag_name="Stellar Question",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First bounty you offer on another person's question", tag_name="Investor",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Question score of 10 or more", tag_name="Nice Question",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Question score of 25 or more", tag_name="Good Question",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Question score of 100 or more", tag_name="Great Question",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Question with 1,000 views", tag_name="Popular Question",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Question with 2,500 views", tag_name="Notable Question",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Question with 10,000 views", tag_name="Famous Question",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First bounty you offer on your own question", tag_name="Promoter",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Ask a question and accept an answer", tag_name="Scholar",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First question with score of 1 or more", tag_name="Student",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="First to answer and accepted with score of 10 or more", tag_name="Enlightened",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Edit and answer 1 question (both actions within 12 hours, answer score > 0)", tag_name="Explainer",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Edit and answer 50 questions (both actions within 12 hours, answer score > 0)", tag_name="Refiner",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Edit and answer 500 questions (both actions within 12 hours, answer score > 0)", tag_name="Illuminator",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Accepted answer and score of 40 or more", tag_name="Guru",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Answer score of 5 or more to a question score of -2 or less that goes on to receive a score of 2 or more", tag_name="Lifejacket",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Answer score of 20 or more to a question score of -3 or less that goes on to receive a score of 3 or more", tag_name="Lifeboat",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Answer score of 10 or more", tag_name="Nice Answer",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Answer score of 25 or more", tag_name="Good Answer",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Answer score of 100 or more", tag_name="Great Answer",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="GOLD", tag_name="Populist",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Answer more than 30 days after a question was asked as first answer scoring 2 or more", tag_name="Revival",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Answer a question more than 60 days later with score of 5 or more", tag_name="Necromancer",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Answer your own question with score of 3 or more", tag_name="Self-Learner",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Answer a question with score of 1 or more", tag_name="Teacher",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="SILVER", tag_name="Tanacious",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="GOLD", tag_name="Unsung Hero",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Complete 'About Me' section of user profile", tag_name="Autobiographer",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Leave 10 comments", tag_name="Commentator",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Leave 10 comments with score of 5 or more", tag_name="Pundit",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="BRONZE", tag_name="Mortarboard",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Earn 200 daily reputation 50 times", tag_name="Epic",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Earn 200 daily reputation 150 times", tag_name="Legendary",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="BRONZE", tag_name="Bronze Badge",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="SILVER", tag_name="Silver Badge",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="GOLD", tag_name="Gold Badge",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First flagged post", tag_name="Citizen Patrol",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Raise 80 helpful flags", tag_name="Deputy",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Raise 500 helpful flags", tag_name="Marshal",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Vote 300 or more times", tag_name="Civic Duty",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First down vote", tag_name="Critic",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Complete at least one review task. This badge is awarded once per review type", tag_name="Custodian",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Complete at least 250 review tasks. This badge is awarded once per review type", tag_name="Reviewer",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Complete at least 1,000 review tasks. This badge is awarded multiple times per review type", tag_name="Steward",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Delete own post with score of 3 or higher", tag_name="Disciplined",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First edit", tag_name="Editor",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Edit 80 posts", tag_name="Strunk & White",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Edit 500 posts (excluding own or deleted posts and tag edits)", tag_name="Copy Editor",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="GOLD",description="Edit 500 posts (excluding own or deleted posts and tag edits)", tag_name="Electorate",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Edit first post that was inactive for 6 months", tag_name="Excavator",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="SILVER",description="Edit 100 posts that were inactive for 6 months", tag_name="Archaologist",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Delete own post with score of -3 or lower", tag_name="Peer Pressure",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Approve or reject 100 suggested edits", tag_name="Proodreader",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="SILVER", tag_name="Sportsmanship",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Use 30 votes in a day", tag_name="Suffrage",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="First up vote", tag_name="Supporter",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="GOLD",description="Provide an answer of +20 score to a question of -5 score", tag_name="Reversal",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- # TagBadge.objects.get_or_create(badge_type="BRONZE", tag_name="Tubbleweed",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Use the maximum 40 votes in a day", tag_name="Vox Populi",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
- TagBadge.objects.get_or_create(badge_type="BRONZE",description="Read the entire tour page", tag_name="Informed",date=timezone.now(),preBuild=True, bade_position="Tag", url="#")
-
-
-
-def saveTag(apps, schema_editor):
- Tag = apps.get_model("taggit", "Tag")
- Tag.objects.get_or_create(name="Altruist", slug="altruist")
- Tag.objects.get_or_create(name="Benefactor", slug="benefactor")
- Tag.objects.get_or_create(name="Favorite Question", slug="favorite-question")
- Tag.objects.get_or_create(name="Stellar Question", slug="stellar-question")
- Tag.objects.get_or_create(name="Investor", slug="investor")
- Tag.objects.get_or_create(name="Nice Question", slug="nice-question")
- Tag.objects.get_or_create(name="Good Question", slug="good-question")
- Tag.objects.get_or_create(name="Great Question", slug="great-question")
- Tag.objects.get_or_create(name="Popular Question", slug="popular-question")
- Tag.objects.get_or_create(name="Notable Question", slug="notable-question")
- Tag.objects.get_or_create(name="Famous Question", slug="famous-question")
- Tag.objects.get_or_create(name="Promoter", slug="promoter")
- Tag.objects.get_or_create(name="Scholar", slug="scholar")
- Tag.objects.get_or_create(name="Student", slug="student")
- Tag.objects.get_or_create(name="Enlightened", slug="enlightened")
- Tag.objects.get_or_create(name="Explainer", slug="explainer")
- Tag.objects.get_or_create(name="Refiner", slug="refiner")
- Tag.objects.get_or_create(name="Illuminator", slug="illuminator")
- Tag.objects.get_or_create(name="Guru", slug="guru")
- Tag.objects.get_or_create(name="Lifejacket", slug="lifejacket")
- Tag.objects.get_or_create(name="Lifeboat", slug="lifeboat")
- Tag.objects.get_or_create(name="Nice Answer", slug="nice-answer")
- Tag.objects.get_or_create(name="Good Answer", slug="good-answer")
- Tag.objects.get_or_create(name="Great Answer", slug="great-answer")
- # Tag.objects.get_or_create(name="Populist", slug="populist")
- Tag.objects.get_or_create(name="Revival", slug="revival")
- Tag.objects.get_or_create(name="Necromancer", slug="necromancer")
- Tag.objects.get_or_create(name="Self-Learner", slug="self-learner")
- Tag.objects.get_or_create(name="Teacher", slug="teacher")
- # Tag.objects.get_or_create(name="Tanacious", slug="tanacious")
- # Tag.objects.get_or_create(name="Unsung Hero", slug="unsung-hero")
- Tag.objects.get_or_create(name="Autobiographer", slug="autobiographer")
- Tag.objects.get_or_create(name="Commentator", slug="commentator")
- Tag.objects.get_or_create(name="Pundit", slug="pundit")
- Tag.objects.get_or_create(name="Mortarboard", slug="mortarboard")
- Tag.objects.get_or_create(name="Epic", slug="epic")
- Tag.objects.get_or_create(name="Legendary", slug="legendary")
- # Tag.objects.get_or_create(name="Bronze Badge", slug="bronze-badge")
- # Tag.objects.get_or_create(name="Silver Badge", slug="silver-badge")
- # Tag.objects.get_or_create(name="Gold Badge", slug="gold-badge")
- Tag.objects.get_or_create(name="Citizen Patrol", slug="citizen-patrol")
- Tag.objects.get_or_create(name="Deputy", slug="deputy")
- Tag.objects.get_or_create(name="Marshal", slug="marshal")
- Tag.objects.get_or_create(name="Civic Duty", slug="civic-duty")
- Tag.objects.get_or_create(name="Critic", slug="critic")
- Tag.objects.get_or_create(name="Custodian", slug="custodian")
- Tag.objects.get_or_create(name="Reviewer", slug="reviewer")
- Tag.objects.get_or_create(name="Steward", slug="steward")
- Tag.objects.get_or_create(name="Disciplined", slug="disciplined")
- Tag.objects.get_or_create(name="Edit", slug="edit")
- Tag.objects.get_or_create(name="Strunk & White", slug="strunk-&-white")
- Tag.objects.get_or_create(name="Copy Editor", slug="copy-editor")
- Tag.objects.get_or_create(name="Electorate", slug="electorate")
- Tag.objects.get_or_create(name="Excavator", slug="excavator")
- Tag.objects.get_or_create(name="Archaologist", slug="archaologist")
- Tag.objects.get_or_create(name="Peer Pressure", slug="peer-pressure")
- Tag.objects.get_or_create(name="Proodreader", slug="proodreader")
- # Tag.objects.get_or_create(name="Sportsmanship", slug="sportsmanship")
- Tag.objects.get_or_create(name="Suffrage", slug="suffrage")
- Tag.objects.get_or_create(name="Supporter", slug="supporter")
- Tag.objects.get_or_create(name="Reversal", slug="reversal")
- # Tag.objects.get_or_create(name="Tubbleweed", slug="tubbleweed")
- Tag.objects.get_or_create(name="Vox Populi", slug="vox-populi")
- Tag.objects.get_or_create(name="Informed", slug="informed")
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('tagbadge', '_____migrate_code_____'),
- ]
-
- operations = [
- migrations.RunPython(saveTag),
- migrations.RunPython(saveTagBadge)
- ]
diff --git a/notification/__init__.py b/notification/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/notification/admin.py b/notification/admin.py
deleted file mode 100644
index deaf43d..0000000
--- a/notification/admin.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from django.contrib import admin
-
-from .models import Notification,PrivRepNotification
-
-admin.site.register(Notification)
-
-admin.site.register(PrivRepNotification)
diff --git a/notification/apps.py b/notification/apps.py
deleted file mode 100644
index 8757bbe..0000000
--- a/notification/apps.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.apps import AppConfig
-
-
-class NotificationConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'notification'
diff --git a/notification/context_processors.py b/notification/context_processors.py
deleted file mode 100644
index 2b2958c..0000000
--- a/notification/context_processors.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from django.shortcuts import render
-from .models import PrivRepNotification,Notification
-from django.http import JsonResponse, HttpResponseRedirect, HttpResponse
-from django.db.models import Count,BooleanField, ExpressionWrapper, Q,Exists, OuterRef,Avg, Min,Max, Sum,F, IntegerField, FloatField,Case, Value, When
-
-def notificationViewer(request):
- if request.user.is_authenticated:
- notifications = Notification.objects.filter(noti_receiver=request.user).order_by('-date_created')
- countUnreadNotifications = Notification.objects.filter(noti_receiver=request.user, is_read=False).count()
- if countUnreadNotifications >= 1:
- showAlert = True
- else:
- showAlert = False
-
- else:
- notifications = ''
- countUnreadNotifications = ''
- showAlert = False
-
-
- return {
- 'notifications':notifications,
- 'countUnreadNotifications':countUnreadNotifications,
- 'showAlert':showAlert,
- }
-
-def privNotificationViewer(request):
- if request.user.is_authenticated:
- privNotifications = PrivRepNotification.objects.filter(for_user=request.user).order_by('-date_created_PrivNotify')
- countUnreadPrivNotifications_1 = PrivRepNotification.objects.filter(
- for_user=request.user, is_read=False).count()
- countUnreadPrivNotifications = PrivRepNotification.objects.filter(for_user=request.user, is_read=False).aggregate(countTheUnRead_Rep=Sum('missingReputation'))
- # if countUnreadPrivNotifications >= 1:
- # showPrivAlert = True
- # else:
- # showPrivAlert = False
-
- else:
- privNotifications = ''
- countUnreadPrivNotifications = ''
- # showPrivAlert = False
- countUnreadPrivNotifications_1 = ''
-
- return {
- 'privNotifications':privNotifications,
- 'countUnreadPrivNotifications':countUnreadPrivNotifications,
- 'countUnreadPrivNotifications_1':countUnreadPrivNotifications_1,
- }
\ No newline at end of file
diff --git a/notification/migrations/0001_initial.py b/notification/migrations/0001_initial.py
deleted file mode 100644
index 2d96caf..0000000
--- a/notification/migrations/0001_initial.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# Generated by Django 3.2.6 on 2022-01-04 20:58
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='Notification',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('type_of_noti', models.CharField(choices=[('comment_answer', 'comment_answer'), ('question_comment', 'question_comment'), ('community_message', 'community_message'), ('question_edit', 'question_edit'), ('question_reopen_voted', 'Question ReOpen Voted'), ('question_suggested_edit', 'Question Suggested Edit'), ('NEW_ANSWER', 'New_Answer')], default='', max_length=30)),
- ('url', models.URLField(blank=True, null=True)),
- ('date_created', models.DateTimeField(auto_now_add=True)),
- ('is_read', models.BooleanField(default=False)),
- ],
- ),
- migrations.CreateModel(
- name='PrivRepNotification',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('url', models.URLField(blank=True, default='#', null=True)),
- ('for_if', models.CharField(default='', max_length=30)),
- ('date_created_PrivNotify', models.DateTimeField(auto_now_add=True)),
- ('is_read', models.BooleanField(default=False)),
- ('type_of_PrivNotify', models.CharField(choices=[('EDIT_GOT_APPROVED', 'Edit Approved'), ('ANSWER_ACCEPT_REP_P', 'Answer Accept Rep Plus'), ('BOUNTY_AWARDED_REP_P', 'Bounty Award Rep Plus'), ('MY_ANSWER_UPVOTE_REP_P', 'Answered Answer Upvote Rep Plus'), ('QUESTION_DOWNVOTE', 'Question DownVote'), ('MY_QUESTION_UPVOTE_REP_P', 'Asked Question Upvote Rep Plus'), ('Privilege_Earned', 'Privilege Earned'), ('BADGE_EARNED', 'Badge Earned')], default='', max_length=30)),
- ('missingReputation', models.IntegerField(blank=True, default=0, null=True)),
- ('privilegeURL', models.URLField(blank=True, null=True)),
- ('description', models.CharField(default='', max_length=1000)),
- ],
- ),
- ]
diff --git a/notification/migrations/0002_initial.py b/notification/migrations/0002_initial.py
deleted file mode 100644
index 2896eb0..0000000
--- a/notification/migrations/0002_initial.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Generated by Django 3.2.6 on 2022-01-04 20:58
-
-from django.conf import settings
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ('notification', '0001_initial'),
- ('qa', '0001_initial'),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ]
-
- operations = [
- migrations.AddField(
- model_name='privrepnotification',
- name='answer_priv_noti',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='qa.answer'),
- ),
- migrations.AddField(
- model_name='privrepnotification',
- name='for_user',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
- ),
- migrations.AddField(
- model_name='privrepnotification',
- name='question_priv_noti',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='qa.question'),
- ),
- migrations.AddField(
- model_name='notification',
- name='answer_noti',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='qa.answer'),
- ),
- migrations.AddField(
- model_name='notification',
- name='noti_receiver',
- field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='noti_receiver', to=settings.AUTH_USER_MODEL),
- ),
- migrations.AddField(
- model_name='notification',
- name='question_noti',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='qa.question'),
- ),
- ]
diff --git a/notification/migrations/__init__.py b/notification/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/notification/models.py b/notification/models.py
deleted file mode 100644
index 815283b..0000000
--- a/notification/models.py
+++ /dev/null
@@ -1,80 +0,0 @@
-from django.db import models
-from django.contrib.auth.models import User
-from qa.models import Question,Answer
-
-TYPE_OF_NOTI = [
-
- ('comment_answer','comment_answer'),
- ('question_comment','question_comment'),
- ('community_message','community_message'),
- ('question_edit', 'question_edit'),
- ('question_reopen_voted','Question ReOpen Voted'),
- ('question_suggested_edit', 'Question Suggested Edit'),
- ('NEW_ANSWER', 'New_Answer'),
-
-]
-
-class Notification(models.Model):
- noti_receiver = models.ForeignKey(User,on_delete=models.CASCADE, default='', related_name='noti_receiver')
- type_of_noti = models.CharField(max_length=30,choices=TYPE_OF_NOTI,default='')
- url = models.URLField(null=True,blank=True)
- date_created = models.DateTimeField(auto_now_add=True)
- is_read = models.BooleanField(default=False)
- question_noti = models.ForeignKey(Question, on_delete=models.CASCADE, blank=True, null=True)
- answer_noti = models.ForeignKey(Answer, on_delete=models.CASCADE, blank=True, null=True)
-
- def __str__(self):
- return f"{self.type_of_noti} - [USER] {self.noti_receiver} - [READED?] - {self.is_read}"
-
-PRIV_NOTIFY_CHOICES = [
-
- ('EDIT_GOT_APPROVED', 'Edit Approved'),
- # ('DOWN_VOTE_ANSWER_REP_M', 'Answer Down Vote Rep Minus'),
- ('ANSWER_ACCEPT_REP_P', 'Answer Accept Rep Plus'),
- ('BOUNTY_AWARDED_REP_P', 'Bounty Award Rep Plus'),
- ('MY_ANSWER_UPVOTE_REP_P', 'Answered Answer Upvote Rep Plus'),
- ('QUESTION_DOWNVOTE', 'Question DownVote'),
- ('MY_QUESTION_UPVOTE_REP_P', 'Asked Question Upvote Rep Plus'),
- ('Privilege_Earned', 'Privilege Earned'),
- ('BADGE_EARNED', 'Badge Earned')
-]
-
-class PrivRepNotification(models.Model):
- for_user = models.ForeignKey(User, on_delete=models.CASCADE)
- url = models.URLField(null=True, blank=True, default="#")
- for_if = models.CharField(max_length=30,default='')
- date_created_PrivNotify = models.DateTimeField(auto_now_add=True)
- is_read = models.BooleanField(default=False)
- type_of_PrivNotify = models.CharField(max_length=30, choices=PRIV_NOTIFY_CHOICES,default='')
- missingReputation = models.IntegerField(default=0, blank=True, null=True)
- privilegeURL = models.URLField(null=True, blank=True)
- description = models.CharField(max_length=1000, default='')
- question_priv_noti = models.ForeignKey(Question, on_delete=models.CASCADE, blank=True, null=True)
- answer_priv_noti = models.ForeignKey(Answer, on_delete=models.CASCADE, blank=True, null=True)
-
- def __str__(self):
- return self.type_of_PrivNotify
-
-# PRIV_NOTIFY_CHOICES = [
-
-# ('QUESTION_EDIT_REP_P', 'Question edit Rep Plus'),
-# ('ANSWER_EDIT_REP_P', 'Answer edit Rep Plus'),
-# ('DOWN_VOTE_ANSWER_REP_M', 'Answer Down Vote Rep Minus'),
-# ('ANSWER_ACCEPT_REP_P', 'Answer Accept Rep Plus'),
-# ('BOUNTY_AWARDED_REP_P', 'Bounty Award Rep Plus'),
-# ('MY_ANSWER_UPVOTE_REP_P', 'Answered Answer Upvote Rep Plus'),
-# ('QUESTION_DOWNVOTE', 'Question DownVote'),
-# ('MY_QUESTION_UPVOTE_REP_P', 'Asked Question Upvote Rep Plus'),
-# ("EDIT_GOT_APPROVED", "Approved Edit"),
-# ('Privilege_Earned', 'Privilege Earned'),
-# ]
-
-# class privilegeNotification(models.Model):
-# for_user = models.ForeignKey(User, on_delete=models.CASCADE)
-# url = models.URLField(null=True, blank=True)
-# is_read = models.BooleanField(default=False)
-# date = models.DateTimeField(auto_now_add=True)
-# type_of_PrivNotify = models.CharField(max_length=30, choices=PRIV_NOTIFY_CHOICES,default='')
-
-
-
diff --git a/notification/urls.py b/notification/urls.py
deleted file mode 100644
index 6cb5a16..0000000
--- a/notification/urls.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from django.urls import path
-from . import views
-
-app_name = 'notification'
-
-urlpatterns = [
-
- path('read_All_Notifications/', views.read_All_Notifications, name='read_All_Notifications'),
-
- path('read_All_Priv_Notifications/', views.read_All_Priv_Notifications, name='read_All_Priv_Notifications'),
-
-
-]
\ No newline at end of file
diff --git a/notification/views.py b/notification/views.py
deleted file mode 100644
index c09740c..0000000
--- a/notification/views.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from django.shortcuts import render
-from .models import PrivRepNotification,Notification
-from django.http import JsonResponse, HttpResponseRedirect, HttpResponse
-
-
-def read_All_Notifications(request):
-
- notifics = Notification.objects.filter(noti_receiver=request.user).order_by('-date_created')
-
- for objs in notifics:
- objs.is_read = True
- objs.save()
-
- # return HttpResponse(status=204)
- return JsonResponse({'action': 'readedAll'})
-
-def read_All_Priv_Notifications(request):
-
- notifications = PrivRepNotification.objects.filter(for_user=request.user)
-
- for obj in notifications:
- obj.is_read = True
- obj.save()
-
- return JsonResponse({'action':'readedAllPrivNotifications'})
-
diff --git a/profile/__init__.py b/profile/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/profile/admin.py b/profile/admin.py
deleted file mode 100644
index 8699843..0000000
--- a/profile/admin.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from django.contrib import admin
-
-from .models import Profile
-
-admin.site.register(Profile)
-
-# admin.site.register(Position)
-
-# admin.site.register(DeveloperStory)
-
diff --git a/profile/apps.py b/profile/apps.py
deleted file mode 100644
index ad627ff..0000000
--- a/profile/apps.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.apps import AppConfig
-
-
-class profileConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'profile'
diff --git a/profile/context_processors.py b/profile/context_processors.py
deleted file mode 100644
index 83b5173..0000000
--- a/profile/context_processors.py
+++ /dev/null
@@ -1,22 +0,0 @@
-from django.shortcuts import render, redirect
-import datetime
-from django.utils import timezone
-from datetime import timedelta
-from django.db.models import Avg, Count, Min, Sum, Q
-from qa.models import Question
-from notification.models import PrivRepNotification,Notification
-
-def top_questions(request):
- questionsHome = Question.objects.filter(
- is_deleted=False, is_bountied=False).order_by(
- '-date')[:50]
- return {
- 'questionsHome':questionsHome
- }
-
-def count_all_bounties(request):
- bounties = Question.objects.filter(is_bountied=True)
-
- return {
- 'count_bounty': bounties.count()
- }
\ No newline at end of file
diff --git a/profile/decorators.py b/profile/decorators.py
deleted file mode 100644
index bdaa416..0000000
--- a/profile/decorators.py
+++ /dev/null
@@ -1,33 +0,0 @@
-from django.shortcuts import redirect
-from django.contrib.auth import logout
-from django.core.exceptions import PermissionDenied
-from qa.models import BannedUser
-
-def unBanRequired(function):
-
- def keepUserOut(request, *args, **kwargs):
- if request.user.is_authenticated:
- if BannedUser.objects.filter(user=request.user, is_banned=False).exists():
- return redirect('profile:home')
- else:
- return function(request, *args, **kwargs)
-
- else:
- return redirect('users:login_request')
-
- return keepUserOut
-
-def profileOwnerRequired_For_Edit(function):
-
- def keepUnknownUser_Out(request, *args, **kwargs):
- if request.user.is_authenticated:
- if request.user == request.user.profile.user:
- return function(request, *args, **kwargs)
- else:
- messages.error(request, 'Not Authorised')
-
- else:
- return redirect('users:login_request')
-
- return keepUnknownUser_Out
-
diff --git a/profile/forms.py b/profile/forms.py
deleted file mode 100644
index 4cd6d53..0000000
--- a/profile/forms.py
+++ /dev/null
@@ -1,52 +0,0 @@
-from django import forms
-from .models import Profile,Position
-from martor.fields import MartorFormField
-
-class EditProfileForm(forms.ModelForm):
-
- class Meta:
- model = Profile
- fields = ['profile_photo','full_name','location','title','about_me',
- 'website_link','twitter_link','github_link',
- 'not_to_Display_Full_name']
-
-class EmailForm(forms.Form):
- name = forms.CharField(max_length=25)
- email = forms.EmailField()
- review = MartorFormField()
-
-class PositionCreateForm(forms.ModelForm):
-
- class Meta:
- model = Position
- fields = ['company_name','title']
-
-JOB_TYPE_CHOICES = [
-
- ('FULL_TIME', 'Full Time'),
- ('CONTRCT', 'Contract'),
- ('InternShip', 'InternShip'),
-
-]
-
-
-class EditJobPrefrences(forms.ModelForm):
- # job_type = forms.MultipleChoiceField(choices=JOB_TYPE_CHOICES, widget=forms.CheckboxSelectMultiple())
-
- class Meta:
- model = Profile
- fields = ['min_expierence_level',
- 'max_expierence_level','job_type',
- 'job_search_status','phone_number']
- widgets = {
- 'job_search_status': forms.RadioSelect(),
- # 'job_type': forms.CheckboxSelectMultiple(),
- }
-
-
-
-class EditEmailForm(forms.ModelForm):
-
- class Meta:
- model = Profile
- fields = ['email']
\ No newline at end of file
diff --git a/profile/migrations/0001_initial.py b/profile/migrations/0001_initial.py
deleted file mode 100644
index e1ed16d..0000000
--- a/profile/migrations/0001_initial.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# Generated by Django 3.2.6 on 2022-01-04 20:58
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='Position',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('company_name', models.CharField(default='', max_length=30)),
- ('title', models.CharField(default='', max_length=30)),
- ('company_website', models.CharField(default='', max_length=30)),
- ('technologies', models.CharField(default='', max_length=30)),
- ('responsibilities', models.CharField(default='', max_length=30)),
- ],
- ),
- migrations.CreateModel(
- name='Profile',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('full_name', models.CharField(default='', max_length=30)),
- ('not_to_Display_Full_name', models.CharField(default='', max_length=30)),
- ('email', models.EmailField(default='', max_length=30)),
- ('location', models.CharField(default='', max_length=30)),
- ('title', models.CharField(default='', max_length=30)),
- ('profile_photo', models.ImageField(default='media/isle.jpg', upload_to='profile_photos')),
- ('about_me', models.CharField(blank=True, default='', max_length=30, null=True)),
- ('website_link', models.URLField(blank=True)),
- ('twitter_link', models.URLField(blank=True)),
- ('github_link', models.URLField(blank=True)),
- ('q_edited_counter', models.IntegerField(default=0)),
- ('time', models.DateTimeField(auto_now_add=True)),
- ('reputation', models.IntegerField(default=1)),
- ('is_banned', models.BooleanField(default=False)),
- ('post_edit_inactive_for_six_month', models.IntegerField(default=0)),
- ('is_moderator', models.BooleanField(default=False)),
- ('is_high_moderator', models.BooleanField(default=False)),
- ('targeted_tag', models.CharField(default='Commenter', max_length=30)),
- ('review_close_votes', models.BooleanField(default=False)),
- ('favorite_question_S', models.BooleanField(default=False)),
- ('lifeJacket', models.BooleanField(default=False)),
- ('altruist', models.BooleanField(default=False)),
- ('commenter', models.BooleanField(default=False)),
- ('logout_on_all_devices', models.BooleanField(default=False)),
- ('send_email_notifications', models.BooleanField(default=False)),
- ('voting_flags', models.IntegerField(default=0)),
- ('helpful_close_votes', models.IntegerField(default=0)),
- ('name', models.CharField(default='', max_length=30)),
- ('prefered_technologies', models.CharField(default='', max_length=30)),
- ('min_expierence_level', models.CharField(choices=[('Student', 'Student'), ('Junior', 'Junior'), ('Mid_Level', 'Mid Level'), ('Senior', 'Senior'), ('Lead', 'Lead'), ('Manager', 'Manager')], default='', max_length=30)),
- ('max_expierence_level', models.CharField(choices=[('Student', 'Student'), ('Junior', 'Junior'), ('Mid_Level', 'Mid Level'), ('Senior', 'Senior'), ('Lead', 'Lead'), ('Manager', 'Manager')], default='', max_length=30)),
- ('job_type', models.CharField(choices=[('FULL_TIME', 'Full Time'), ('CONTRCT', 'Contract'), ('InternShip', 'InternShip')], max_length=30)),
- ('job_search_status', models.CharField(choices=[('looking_for_job', 'Actively looking right now'), ('open_but_not_looking', 'Open, but not actively looking'), ('not_interested_in_jobs', 'Not interested in jobs')], max_length=30)),
- ('phone_number', models.CharField(blank=True, max_length=30, null=True)),
- ('create_posts', models.BooleanField(default=True)),
- ('create_wiki_posts', models.BooleanField(default=False)),
- ('remove_new_user_restrictions', models.BooleanField(default=False)),
- ('voteUpPriv', models.BooleanField(default=False)),
- ('flag_posts', models.BooleanField(default=False)),
- ('comment_everywhere_Priv', models.BooleanField(default=False)),
- ('set_bounties', models.BooleanField(default=False)),
- ('edit_community_wiki', models.BooleanField(default=False)),
- ('voteDownPriv', models.BooleanField(default=False)),
- ('view_close_votes_Priv', models.BooleanField(default=False)),
- ('access_review_queues', models.BooleanField(default=False)),
- ('established_user_Priv', models.BooleanField(default=False)),
- ('create_tags', models.BooleanField(default=False)),
- ('edit_questions_answers', models.BooleanField(default=False)),
- ('cast_close_AND_Reopen_votes', models.BooleanField(default=False)),
- ('accessTo_moderatorTools', models.BooleanField(default=False)),
- ('protect_questions', models.BooleanField(default=False)),
- ('trusted_user_Priv', models.BooleanField(default=False)),
- ('helpful_flags_counter', models.IntegerField(blank=True, default=0, null=True)),
- ('posts_edited_counter', models.IntegerField(blank=True, default=0, null=True)),
- ('suggested_Edit_counter', models.IntegerField(blank=True, default=0, null=True)),
- ('editPostTimeOfUser', models.DateTimeField(blank=True, null=True)),
- ('Refiner_Illuminator_TagPostCounter', models.IntegerField(blank=True, default=0, null=True)),
- ],
- ),
- ]
diff --git a/profile/migrations/0002_initial.py b/profile/migrations/0002_initial.py
deleted file mode 100644
index 203437a..0000000
--- a/profile/migrations/0002_initial.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Generated by Django 3.2.6 on 2022-01-04 20:58
-
-from django.conf import settings
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ('profile', '0001_initial'),
- ('qa', '0001_initial'),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ]
-
- operations = [
- migrations.AddField(
- model_name='profile',
- name='bookmark_questions',
- field=models.ManyToManyField(blank=True, related_name='bookmark_questions', to='qa.Question'),
- ),
- migrations.AddField(
- model_name='profile',
- name='user',
- field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL),
- ),
- migrations.AddField(
- model_name='position',
- name='user',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
- ),
- ]
diff --git a/profile/migrations/__init__.py b/profile/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/profile/models.py b/profile/models.py
deleted file mode 100644
index 4feab73..0000000
--- a/profile/models.py
+++ /dev/null
@@ -1,164 +0,0 @@
-from django.db import models
-from django.contrib.auth.models import User
-from django.db.models.signals import post_save
-from django.dispatch import receiver
-from django.conf import settings
-from qa.models import Question
-import os
-from random import choice
-from os.path import join as path_join
-from os import listdir
-from os.path import isfile
-import datetime
-from django.utils import timezone
-from datetime import timedelta
-from datetime import datetime as dt
-from django.urls import reverse
-from qa.models import CommentQ
-
-def random_img():
- dir_path = 'media/'
- files = [content for content in listdir(
- dir_path) if isfile(path_join(dir_path, content))]
- return path_join(dir_path, choice(files))
-
-
-
-JOB_STATUS = [
- ('looking_for_job', 'Actively looking right now'),
- ('open_but_not_looking', 'Open, but not actively looking'),
- ('not_interested_in_jobs', 'Not interested in jobs'),
-]
-
-
-EXPERIENCE_LEVEL = [
-
- ('Student','Student'),
- ('Junior', 'Junior'),
- ('Mid_Level', 'Mid Level'),
- ('Senior', 'Senior'),
- ('Lead', 'Lead'),
- ('Manager', 'Manager'),
-
-]
-
-JOB_TYPE_CHOICES = [
-
- ('FULL_TIME', 'Full Time'),
- ('CONTRCT', 'Contract'),
- ('InternShip', 'InternShip'),
-
-]
-
-
-
-class Profile(models.Model):
- user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
- full_name = models.CharField(max_length=30, default='', blank=True)
- not_to_Display_Full_name = models.CharField(max_length=30, default='', blank=True)
- email = models.EmailField(max_length=30, default='')
- location = models.CharField(max_length=30, default='', blank=True)
- title = models.CharField(max_length=30, default='', blank=True)
- profile_photo = models.ImageField(upload_to='profile_photos', default='media/isle.jpg')
- about_me = models.CharField(max_length=30, default='', blank=True, null=True)
- website_link = models.URLField(blank=True)
- twitter_link = models.URLField(blank=True)
- github_link = models.URLField(blank=True)
- bookmark_questions = models.ManyToManyField(Question, related_name='bookmark_questions', blank=True)
- q_edited_counter = models.IntegerField(default=0)
- time = models.DateTimeField(auto_now_add=True)
- reputation = models.IntegerField(default=1)
- is_banned = models.BooleanField(default=False)
- post_edit_inactive_for_six_month = models.IntegerField(default=0)
- is_moderator = models.BooleanField(default=False)
- is_high_moderator = models.BooleanField(default=False)
- targeted_tag = models.CharField(max_length=30, default='Commenter')
-# BADGES
- review_close_votes = models.BooleanField(default=False)
- favorite_question_S = models.BooleanField(default=False)
- lifeJacket = models.BooleanField(default=False)
-
-
- altruist = models.BooleanField(default=False)
-# PRIVILEGES
- commenter = models.BooleanField(default=False)
-
-
-# OTHERS
-
-
- logout_on_all_devices = models.BooleanField(default=False)
- send_email_notifications = models.BooleanField(default=False)
-
- voting_flags = models.IntegerField(default=0)
- helpful_close_votes = models.IntegerField(default=0)
-
-
-# DEVELOPER STORY
- name = models.CharField(max_length=30, default='')
- prefered_technologies = models.CharField(max_length=30, default='')
- min_expierence_level = models.CharField(max_length=30,choices=EXPERIENCE_LEVEL, default='')
- max_expierence_level = models.CharField(max_length=30,choices=EXPERIENCE_LEVEL, default='')
- job_type = models.CharField(max_length=30, choices=JOB_TYPE_CHOICES)
- job_search_status = models.CharField(max_length=30, choices=JOB_STATUS)
- phone_number = models.CharField(max_length=30, blank=True, null=True)
-
-
- create_posts = models.BooleanField(default=True) # Done
- create_wiki_posts = models.BooleanField(default=False) # Done
- remove_new_user_restrictions = models.BooleanField(default=False) # Done
- voteUpPriv = models.BooleanField(default=False) # Done
- flag_posts = models.BooleanField(default=False) # Done
- comment_everywhere_Priv = models.BooleanField(default=False) # Done
- set_bounties = models.BooleanField(default=False) # Done
- edit_community_wiki = models.BooleanField(default=False)
- voteDownPriv = models.BooleanField(default=False) # Done
- view_close_votes_Priv = models.BooleanField(default=False)
- access_review_queues = models.BooleanField(default=False)
- established_user_Priv = models.BooleanField(default=False) # Done
- create_tags = models.BooleanField(default=False) # Done
- edit_questions_answers = models.BooleanField(default=False) # Done
- cast_close_AND_Reopen_votes = models.BooleanField(default=False) # Done
- accessTo_moderatorTools = models.BooleanField(default=False)
- protect_questions = models.BooleanField(default=False) # Done
- trusted_user_Priv = models.BooleanField(default=False)
-
- helpful_flags_counter = models.IntegerField(default=0, blank=True, null=True)
- posts_edited_counter = models.IntegerField(default=0, blank=True, null=True)
- suggested_Edit_counter = models.IntegerField(default=0, blank=True, null=True)
- editPostTimeOfUser = models.DateTimeField(auto_now_add=False, blank=True, null=True)
- Refiner_Illuminator_TagPostCounter = models.IntegerField(default=0, blank=True, null=True)
-
- def __str__(self):
- return f'{self.user}'
-
- def get_absolute_url(self):
- return reverse('profile:activityPageTabProfile', kwargs={'user_id': self.user_id,'username': self.user.username})
-
- @property
- def age(self):
- current_datetime = datetime.datetime.now(timezone.utc)
- return (current_datetime - self.time).days
-
- # def countComments_done(self):
- # countComments = CommentQ.objects.filter(commented_by=self)
-
-
-
-@receiver(post_save, sender=User) # add this
-def create_user_profile(sender, instance, created, **kwargs):
- if created:
- Profile.objects.create(user=instance)
-
-@receiver(post_save, sender=User) # add this
-def save_user_profile(sender, instance, **kwargs):
- instance.profile.save()
-
-
-class Position(models.Model):
- user = models.ForeignKey(User, on_delete=models.CASCADE)
- company_name = models.CharField(max_length=30, default='')
- title = models.CharField(max_length=30, default='')
- company_website = models.CharField(max_length=30, default='')
- technologies = models.CharField(max_length=30, default='')
- responsibilities = models.CharField(max_length=30, default='')
diff --git a/profile/tests.py b/profile/tests.py
deleted file mode 100644
index 7ce503c..0000000
--- a/profile/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/profile/urls.py b/profile/urls.py
deleted file mode 100644
index 5362410..0000000
--- a/profile/urls.py
+++ /dev/null
@@ -1,87 +0,0 @@
-from django.urls import path
-from django.conf import settings
-from django.conf.urls.static import static
-from . import views
-from django.views.decorators.cache import cache_page
-
-app_name = 'profile'
-
-urlpatterns = [
-
- path('', views.home, name='home'),
-
- path('activityPageTabProfile/
Nothing to preview
'); - } - }, - error: function(response) { - console.log("error", response); - } - }); - }; - - // Refresh the preview unconditionally on first load. - window.onload = function() { - refreshPreview(); - } - - if (editorConfig.living !== 'true') { - previewTabButton.click(function(){ - // hide the `.martor-toolbar` for this current editor if under preview. - $(this).closest('.tab-martor-menu').find('.martor-toolbar').hide(); - refreshPreview(); - }); - }else { - editor.on('change', refreshPreview); - } - - var editorTabButton = $('.item[data-tab=editor-tab-'+field_name+']'); - editorTabButton.click(function(){ - // show the `.martor-toolbar` for this current editor if under preview. - $(this).closest('.tab-martor-menu').find('.martor-toolbar').show(); - }); - - if (editorConfig.spellcheck == 'true') { - try { - enable_spellcheck(editorId); - }catch (e) { - console.log("Spellcheck lib doesn't installed."); - } - } - - // win/linux: Ctrl+B, mac: Command+B - var markdownToBold = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' **** '); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+3); - }else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '**'+text+'**'); - originalRange.end.column += 4; // this because injected from 4 `*` characters. - editor.focus(); - editor.selection.setSelectionRange(originalRange); - } - }; - // win/linux: Ctrl+I, mac: Command+I - var markdownToItalic = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' __ '); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+2); - }else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '_'+text+'_'); - originalRange.end.column += 2; // this because injected from 2 `_` characters. - editor.focus(); - editor.selection.setSelectionRange(originalRange); - } - }; - // win/linux: Ctrl+Shift+U - var markdownToUnderscores = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' ++++ '); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+3); - }else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '++'+text+'++'); - originalRange.end.column += 4; // this because injected from 4 `*` characters. - editor.focus(); - editor.selection.setSelectionRange(originalRange); - } - }; - // win/linux: Ctrl+Shift+S - var markdownToStrikethrough = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' ~~~~ '); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+3); - }else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '~~'+text+'~~'); - originalRange.end.column += 4; // this because injected from 4 `*` characters. - editor.focus(); - editor.selection.setSelectionRange(originalRange); - } - }; - // win/linux: Ctrl+H, mac: Command+H - var markdownToHorizontal = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '\n\n----------\n\n'); - editor.focus(); - editor.selection.moveTo(curpos.row+4, curpos.column+10); - } - else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '\n\n----------\n\n'+text); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row+4, - originalRange.end.column+10 - ); - } - }; - // win/linux: Ctrl+Alt+1, mac: Command+Option+1 - var markdownToH1 = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '\n\n# '); - editor.focus(); - editor.selection.moveTo(curpos.row+2, curpos.column+2); - } - else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '\n\n# '+text+'\n'); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row+2, - originalRange.end.column+2 - ); - } - }; - // win/linux: Ctrl+Alt+2, mac: Command+Option+2 - var markdownToH2 = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '\n\n## '); - editor.focus(); - editor.selection.moveTo(curpos.row+2, curpos.column+3); - } - else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '\n\n## '+text+'\n'); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row+2, - originalRange.end.column+3 - ); - } - }; - // win/linux: Ctrl+Alt+3, mac: Command+Option+3 - var markdownToH3 = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '\n\n### '); - editor.focus(); - editor.selection.moveTo(curpos.row+2, curpos.column+4); - } - else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '\n\n### '+text+'\n'); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row+2, - originalRange.end.column+4 - ); - } - }; - // win/linux: Ctrl+Alt+P, mac: Command+Option+P - var markdownToPre = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '\n\n```\n\n```\n'); - editor.focus(); - editor.selection.moveTo(curpos.row+3, curpos.column); - } - else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '\n\n```\n'+text+'\n```\n'); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row+3, - originalRange.end.column+3 - ); - } - }; - // win/linux: Ctrl+Alt+C, mac: Command+Option+C - var markdownToCode = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' `` '); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+2); - }else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '`'+text+'`'); - originalRange.end.column += 2; // this because injected from 2 `_` characters. - editor.focus(); - editor.selection.setSelectionRange(originalRange); - } - }; - // win/linux: Ctrl+Q, mac: Command+Q - var markdownToBlockQuote = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '\n\n> \n'); - editor.focus(); - editor.selection.moveTo(curpos.row+2, curpos.column+2); - } - else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '\n\n> '+text+'\n'); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row+2, - originalRange.end.column+2 - ); - } - }; - // win/linux: Ctrl+U, mac: Command+U - var markdownToUnorderedList = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '\n\n* '); - editor.focus(); - editor.selection.moveTo(curpos.row+2, curpos.column+2); - } - else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '\n\n* '+text); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row+2, - originalRange.end.column+2 - ); - } - }; - // win/linux: Ctrl+Shift+O, mac: Command+Option+O - var markdownToOrderedList = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '\n\n1. '); - editor.focus(); - editor.selection.moveTo(curpos.row+2, curpos.column+3); - } - else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '\n\n1. '+text); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row+2, - originalRange.end.column+3 - ); - } - }; - // win/linux: Ctrl+L, mac: Command+L - var markdownToLink = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' [](https://) '); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+2); - }else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '['+text+'](https://) '); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row, - originalRange.end.column+10 - ); - } - }; - // win/linux: Ctrl+Shift+I, mac: Command+Option+I - // or via upload: imageData={name:null, link:null} - var markdownToImageLink = function(editor, imageData) { - var originalRange = editor.getSelectionRange(); - if (typeof(imageData) === 'undefined') { - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, '  '); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+3); - }else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, ' '); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row, - originalRange.end.column+11 - ); - } - }else { // this if use image upload to imgur. - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' '); - editor.focus(); - editor.selection.moveTo( - curpos.row, - curpos.column+imageData.name.length+2 - ); - } - }; - // win/linux: Ctrl+M, mac: Command+M - var markdownToMention = function(editor) { - var originalRange = editor.getSelectionRange(); - if (editor.selection.isEmpty()) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' @[]'); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+3); - }else { - var range = editor.getSelectionRange(); - var text = editor.session.getTextRange(range); - editor.session.replace(range, '@['+text+']'); - editor.focus(); - editor.selection.moveTo( - originalRange.end.row, - originalRange.end.column+3 - ) - } - }; - // Insert Emoji to text editor: $('.insert-emoji').data('emoji-target') - var markdownToEmoji = function(editor, data_target) { - var curpos = editor.getCursorPosition(); - editor.session.insert(curpos, ' '+data_target+' '); - editor.focus(); - editor.selection.moveTo(curpos.row, curpos.column+data_target.length+2); - }; - // Markdown Image Uploader auto insert to editor. - // with special insert, eg:  - var markdownToUploadImage = function(editor) { - var firstForm = $('#'+editorId).closest('form').get(0); - var field_name = editor.container.id.replace('martor-', ''); - var form = new FormData(firstForm); - form.append('csrfmiddlewaretoken', getCookie('csrftoken')); - - $.ajax({ - url: textareaId.data('upload-url'), - type: 'POST', - data: form, - async: true, - cache: false, - contentType: false, - enctype: 'multipart/form-data', - processData: false, - beforeSend: function() { - console.log('Uploading...'); - $('.upload-progress[data-field-name='+field_name+']').show(); - }, - success: function (response) { - $('.upload-progress[data-field-name='+field_name+']').hide(); - if (response.status == 200) { - console.log(response); - markdownToImageLink( - editor=editor, - imageData={name: response.name, link: response.link} - ); - }else { - alert(response.error); - } - }, - error: function(response) { - console.log("error", response); - $('.upload-progress[data-field-name='+field_name+']').hide(); - } - }); - return false; - }; - - // Trigger Keyboards - editor.commands.addCommand({ - name: 'markdownToBold', - bindKey: {win: 'Ctrl-B', mac: 'Command-B'}, - exec: function(editor) { - markdownToBold(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToItalic', - bindKey: {win: 'Ctrl-I', mac: 'Command-I'}, - exec: function(editor) { - markdownToItalic(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToUnderscores', - bindKey: {win: 'Ctrl-Shift-U', mac: 'Command-Option-U'}, - exec: function(editor) { - markdownToUnderscores(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToStrikethrough', - bindKey: {win: 'Ctrl-Shift-S', mac: 'Command-Option-S'}, - exec: function(editor) { - markdownToStrikethrough(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToHorizontal', - bindKey: {win: 'Ctrl-H', mac: 'Command-H'}, - exec: function(editor) { - markdownToHorizontal(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToH1', - bindKey: {win: 'Ctrl-Alt-1', mac: 'Command-Option-1'}, - exec: function(editor) { - markdownToH1(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToH2', - bindKey: {win: 'Ctrl-Alt-2', mac: 'Command-Option-3'}, - exec: function(editor) { - markdownToH2(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToH3', - bindKey: {win: 'Ctrl-Alt-3', mac: 'Command-Option-3'}, - exec: function(editor) { - markdownToH3(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToPre', - bindKey: {win: 'Ctrl-Alt-P', mac: 'Command-Option-P'}, - exec: function(editor) { - markdownToPre(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToCode', - bindKey: {win: 'Ctrl-Alt-C', mac: 'Command-Option-C'}, - exec: function(editor) { - markdownToCode(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToBlockQuote', - bindKey: {win: 'Ctrl-Q', mac: 'Command-Q'}, - exec: function(editor) { - markdownToBlockQuote(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToUnorderedList', - bindKey: {win: 'Ctrl-U', mac: 'Command-U'}, - exec: function(editor) { - markdownToUnorderedList(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToOrderedList', - bindKey: {win: 'Ctrl-Shift+O', mac: 'Command-Option-O'}, - exec: function(editor) { - markdownToOrderedList(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToLink', - bindKey: {win: 'Ctrl-L', mac: 'Command-L'}, - exec: function(editor) { - markdownToLink(editor); - }, - readOnly: true - }); - editor.commands.addCommand({ - name: 'markdownToImageLink', - bindKey: {win: 'Ctrl-Shift-I', mac: 'Command-Option-I'}, - exec: function(editor) { - markdownToImageLink(editor); - }, - readOnly: true - }); - if (editorConfig.mention === 'true') { - editor.commands.addCommand({ - name: 'markdownToMention', - bindKey: {win: 'Ctrl-M', mac: 'Command-M'}, - exec: function(editor) { - markdownToMention(editor); - }, - readOnly: true - }); - } - - // Trigger Click - $('.markdown-bold[data-field-name='+field_name+']').click(function(){ - markdownToBold(editor); - }); - $('.markdown-italic[data-field-name='+field_name+']').click(function(){ - markdownToItalic(editor); - }); - $('.markdown-horizontal[data-field-name='+field_name+']').click(function(){ - markdownToHorizontal(editor); - }); - $('.markdown-h1[data-field-name='+field_name+']').click(function(){ - markdownToH1(editor); - }); - $('.markdown-h2[data-field-name='+field_name+']').click(function(){ - markdownToH2(editor); - }); - $('.markdown-h3[data-field-name='+field_name+']').click(function(){ - markdownToH3(editor); - }); - $('.markdown-pre[data-field-name='+field_name+']').click(function(){ - markdownToPre(editor); - }); - $('.markdown-code[data-field-name='+field_name+']').click(function(){ - markdownToCode(editor); - }); - $('.markdown-blockquote[data-field-name='+field_name+']').click(function(){ - markdownToBlockQuote(editor); - }); - $('.markdown-unordered-list[data-field-name='+field_name+']').click(function(){ - markdownToUnorderedList(editor); - }); - $('.markdown-ordered-list[data-field-name='+field_name+']').click(function(){ - markdownToOrderedList(editor); - }); - $('.markdown-link[data-field-name='+field_name+']').click(function(){ - markdownToLink(editor); - }); - $('.markdown-image-link[data-field-name='+field_name+']').click(function(){ - markdownToImageLink(editor); - }); - - // Custom decission for toolbar buttons. - var btnMention = $('.markdown-direct-mention[data-field-name='+field_name+']'); // To Direct Mention - var btnUpload = $('.markdown-image-upload[data-field-name='+field_name+']'); // To Upload Image - if (editorConfig.mention === 'true' && editorConfig.imgur === 'true') { - btnMention.click(function(){ - markdownToMention(editor); - }); - btnUpload.on('change', function(evt){ - evt.preventDefault(); - markdownToUploadImage(editor); - }); - }else if (editorConfig.mention === 'true' && editorConfig.imgur === 'false') { - btnMention.click(function(){ - markdownToMention(editor); - }); - btnUpload.remove(); - }else if (editorConfig.mention === 'false' && editorConfig.imgur === 'true') { - btnMention.remove(); - btnUpload.on('change', function(evt){ - evt.preventDefault(); - markdownToUploadImage(editor); - }); - } - else { - btnMention.remove(); - btnUpload.remove(); - // Disable help of `mention` - $('.markdown-reference tbody tr')[1].remove(); - } - - // Modal Popup for Help Guide & Emoji Cheat Sheet - $('.markdown-help[data-field-name='+field_name+']').click(function(){ - $('.modal-help-guide[data-field-name='+field_name+']').modal('show'); - }); - - // Handle tabs. - mainMartor.find('.ui.martor-toolbar .ui.dropdown').dropdown(); - mainMartor.find('.ui.tab-martor-menu .item').tab(); - - // Toggle editor, preview, maximize - var martorField = $('.martor-field-'+field_name); - var btnToggleMaximize = $('.markdown-toggle-maximize[data-field-name='+field_name+']'); - - // Toggle maximize and minimize - var handleToggleMinimize = function() { - $(document.body).removeClass('overflow'); - $(this).attr({'title': 'Full Screen'}); - $(this).find('.minimize.icon').removeClass('minimize').addClass('maximize'); - $('.main-martor-fullscreen').find('.martor-preview').removeAttr('style'); - mainMartor.removeClass('main-martor-fullscreen'); - martorField.removeAttr('style'); - editor.resize(); - } - var handleToggleMaximize = function(selector) { - selector.attr({'title': 'Minimize'}); - selector.find('.maximize.icon').removeClass('maximize').addClass('minimize'); - mainMartor.addClass('main-martor-fullscreen'); - - var clientHeight = document.body.clientHeight-90; - martorField.attr({'style':'height:'+clientHeight+'px'}); - - var preview = $('.main-martor-fullscreen').find('.martor-preview'); - preview.attr({'style': 'overflow-y: auto;height:'+clientHeight+'px'}); - - editor.resize(); - selector.one('click', handleToggleMinimize); - $(document.body).addClass('overflow'); - } - btnToggleMaximize.on('click', function(){ - handleToggleMaximize($(this)); - }); - - // Exit full screen when `ESC` is pressed. - $(document).keyup(function(e) { - if (e.keyCode == 27 && mainMartor.hasClass('main-martor-fullscreen')) { - $('.minimize.icon').trigger('click'); - } - }); - - // markdown insert emoji from the modal - $('.markdown-emoji[data-field-name='+field_name+']').click(function(){ - var modalEmoji = $('.modal-emoji[data-field-name='+field_name+']'); - var emojiList = typeof(emojis) != "undefined" ? emojis : []; // from `plugins/js/emojis.min.js` - var segmentEmoji = modalEmoji.find('.emoji-content-body'); - var loaderInit = modalEmoji.find('.emoji-loader-init'); - - // setup initial loader - segmentEmoji.html(''); - loaderInit.show(); - modalEmoji.modal({ - onVisible: function () { - for (var i = 0; i < emojiList.length; i++) { - var linkEmoji = textareaId.data('base-emoji-url') + emojiList[i].replace(/:/g, '') + '.png'; - segmentEmoji.append('' - +'