merge
This commit is contained in:
commit
4703235799
|
@ -122,7 +122,7 @@ DATABASES = {
|
|||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'codepedia',
|
||||
'USER': 'root',
|
||||
'PASSWORD': 'codepedia123',
|
||||
'PASSWORD': 'root',
|
||||
'HOST': '127.0.0.1'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,286 @@
|
|||
"""
|
||||
Django settings for Codepedia2 project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.0.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.0/ref/settings/
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
DOMAIN_URL="http://120.132.101.149:8000"
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '-v3mo%rerbbh%7xez9^jg^htsn53e4v-)ij-xa5c7gku%8o%p)'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
COMPRESS_ENABLED = True
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
AUTH_USER_MODEL= 'users.User'
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
# 自己开发的app
|
||||
'users',
|
||||
'projects',
|
||||
'actions',
|
||||
'operations',
|
||||
# xadminxadmin
|
||||
'xadmin',
|
||||
'crispy_forms',
|
||||
'reversion',
|
||||
# 静态文件压缩插件
|
||||
"compressor",
|
||||
# 第三方登陆
|
||||
'django.contrib.sites',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'allauth.socialaccount',
|
||||
# 验证码
|
||||
'captcha',
|
||||
# 微信登陆
|
||||
#'allauth.socialaccount.providers.weixin',
|
||||
# 微博登陆
|
||||
#'allauth.socialaccount.providers.weibo',
|
||||
# github登陆
|
||||
#'allauth.socialaccount.providers.github',
|
||||
# debug_toolbar
|
||||
#'debug_toolbar',
|
||||
# 扩展插件
|
||||
#'django_extensions',
|
||||
|
||||
# # package:django-users
|
||||
# 'django.contrib.sites',
|
||||
# 'users',
|
||||
]
|
||||
|
||||
|
||||
|
||||
MIDDLEWARE = [
|
||||
'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',
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'Codepedia2.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates')],
|
||||
'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',
|
||||
'django.template.context_processors.media',
|
||||
# allauth
|
||||
'django.template.context_processors.request',
|
||||
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'Codepedia2.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'codepedia',
|
||||
'USER': 'root',
|
||||
'PASSWORD': 'root',
|
||||
'HOST': '127.0.0.6'
|
||||
}
|
||||
}
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
# 自定义
|
||||
'users.views.CustomBackend',
|
||||
|
||||
# django admin所使用的用户登录与django-allauth无关
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
|
||||
# `allauth` specific authentication methods, such as login by e-mail
|
||||
'allauth.account.auth_backends.AuthenticationBackend',
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
SITE_ID = 1
|
||||
ACCOUNT_AUTHENTICATION_METHOD = 'username_email'
|
||||
ACCOUNT_EMAIL_REQUIRED = True
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
|
||||
|
||||
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',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'zh-hans'
|
||||
|
||||
TIME_ZONE = 'Asia/Shanghai'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
# 数据库存储使用时间,True时间会被存为UTC的时间
|
||||
USE_TZ = False
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.0/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, "static"),
|
||||
|
||||
]
|
||||
STATIC_ROOT="/Users/yujie/Downloads/static/"
|
||||
|
||||
|
||||
# 处理静态压缩文件
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'compressor.finders.CompressorFinder',
|
||||
)
|
||||
|
||||
# 配置邮件发送
|
||||
# EMAIL_HOST = 'smtp.yeah.net'
|
||||
# EMAIL_PORT = 25
|
||||
# EMAIL_HOST_USER = 'alexkie@yeah.net'
|
||||
# EMAIL_HOST_PASSWORD = 'Mr8023Mr'
|
||||
# EMAIL_USE_TLS = False
|
||||
# EMAIL_FROM = 'alexkie@yeah.net'
|
||||
|
||||
EMAIL_HOST = 'smtp.yeah.net'
|
||||
EMAIL_PORT = 25
|
||||
EMAIL_HOST_USER = 'codepedia@yeah.net'
|
||||
EMAIL_HOST_PASSWORD = 'codepedia123123'
|
||||
EMAIL_USE_TLS = True
|
||||
# EMAIL_FROM = 'codepedia@yeah.net'
|
||||
|
||||
# 设置我们上传文件的路径
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
INTERNAL_IPS = ('127.0.0.1', )
|
||||
|
||||
|
||||
# 工程路径
|
||||
SOURCEPATH = '/opt/opengrok/source/'
|
||||
|
||||
# OpenGrok
|
||||
OPENGROK_BASE = 'http://localhost:8080/myopengrok/'
|
||||
OPENGROK_XREF_URL = OPENGROK_BASE+'myxref/'
|
||||
OPENGROK_NAVIGATION_URL = OPENGROK_BASE+'navigation/'
|
||||
OPENGROK_SEARCH_URL = OPENGROK_BASE+'mysearch?'
|
||||
|
||||
# # logging日志配置
|
||||
# LOGGING = {
|
||||
# 'version': 1,
|
||||
# 'disable_existing_loggers': True,
|
||||
# 'formatters': { # 日志格式
|
||||
# 'standard': {
|
||||
# 'format': '%(asctime)s [%(threadName)s:%(thread)d] [%(name)s:%(lineno)d] [%(module)s:%(funcName)s] [%(levelname)s]- %(message)s'}
|
||||
# },
|
||||
# 'filters': { # 过滤器
|
||||
# 'require_debug_false': {
|
||||
# '()': 'django.utils.log.RequireDebugFalse',
|
||||
# }
|
||||
# },
|
||||
# 'handlers': { # 处理器
|
||||
# 'null': {
|
||||
# 'level': 'DEBUG',
|
||||
# 'class': 'logging.NullHandler',
|
||||
# },
|
||||
# 'mail_admins': { # 发送邮件通知管理员
|
||||
# 'level': 'ERROR',
|
||||
# 'class': 'django.utils.log.AdminEmailHandler',
|
||||
# 'filters': ['require_debug_false'], # 仅当 DEBUG = False 时才发送邮件
|
||||
# 'include_html': True,
|
||||
# },
|
||||
# 'debug': { # 记录到日志文件(需要创建对应的目录,否则会出错)
|
||||
# 'level': 'DEBUG',
|
||||
# 'class': 'logging.handlers.RotatingFileHandler',
|
||||
# 'filename': os.path.join(BASE_DIR, "log", 'debug.log'), # 日志输出文件
|
||||
# 'maxBytes': 1024 * 1024 * 5, # 文件大小
|
||||
# 'backupCount': 5, # 备份份数
|
||||
# 'formatter': 'standard', # 使用哪种formatters日志格式
|
||||
# },
|
||||
# 'console': { # 输出到控制台
|
||||
# 'level': 'DEBUG',
|
||||
# 'class': 'logging.StreamHandler',
|
||||
# 'formatter': 'standard',
|
||||
# },
|
||||
# },
|
||||
# 'loggers': { # logging管理器
|
||||
# 'django': {
|
||||
# 'handlers': ['console'],
|
||||
# 'level': 'DEBUG',
|
||||
# 'propagate': False
|
||||
# },
|
||||
# 'django.request': {
|
||||
# 'handlers': ['debug', 'mail_admins'],
|
||||
# 'level': 'ERROR',
|
||||
# 'propagate': True,
|
||||
# },
|
||||
# # 对于不在 ALLOWED_HOSTS 中的请求不发送报错邮件
|
||||
# 'django.security.DisallowedHost': {
|
||||
# 'handlers': ['null'],
|
||||
# 'propagate': False,
|
||||
# },
|
||||
# }
|
||||
# }
|
|
@ -1,8 +1,13 @@
|
|||
* {
|
||||
margin: 0;
|
||||
padding: 0
|
||||
padding: 0;
|
||||
-webkit-box-sizing:border-box;
|
||||
}
|
||||
|
||||
html{height:100%;}
|
||||
body{margin:0;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
form,
|
||||
ul,
|
||||
ol,
|
||||
|
@ -57,8 +62,8 @@ html {
|
|||
background: none rgba(50, 50, 50, 0.7);
|
||||
text-decoration: none;
|
||||
position: fixed;
|
||||
right: 21rem;
|
||||
top: 8rem;
|
||||
right: 2.7rem;
|
||||
top: 1.3rem;
|
||||
}
|
||||
|
||||
.WPGclose:hover {
|
||||
|
@ -66,11 +71,16 @@ html {
|
|||
}
|
||||
|
||||
.WPGstep {
|
||||
color: #eee;
|
||||
background: none rgba(0, 0, 0, 0.7);
|
||||
border-radius: 5px;
|
||||
height: auto;
|
||||
margin-bottom: 1000px;
|
||||
color: #eee;
|
||||
background: none rgba(0, 0, 0, 0.7);
|
||||
/* border-radius: 5px; */
|
||||
height: auto;
|
||||
margin-bottom: 1000px;
|
||||
height: 7rem;
|
||||
margin-top: 0.5rem;
|
||||
margin-left: 1rem;
|
||||
max-width: 14rem;
|
||||
border: 1px solid #CCC;
|
||||
}
|
||||
|
||||
.WPGstep .WPGjt {
|
||||
|
@ -130,10 +140,11 @@ html {
|
|||
.WPGstep .h2 {
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-left: 275px;
|
||||
margin-left: 1.75rem;
|
||||
/* padding-top: 32px; */
|
||||
margin-top: 110px;
|
||||
margin-bottom: 0.3rem;
|
||||
display: inline-block;
|
||||
margin-top: 0.8rem;
|
||||
}
|
||||
|
||||
.WPGstep .WPGnext,
|
||||
|
@ -144,8 +155,8 @@ html {
|
|||
float: right;
|
||||
margin-top: 10px;
|
||||
text-decoration: none;
|
||||
margin-right: 21rem;
|
||||
margin-top: 20px;
|
||||
margin-right:1.7rem;
|
||||
margin-top: 11px;
|
||||
}
|
||||
|
||||
.WPGstep .WPGnext:hover,
|
||||
|
@ -158,17 +169,20 @@ html {
|
|||
display: block;
|
||||
}
|
||||
.WPGstepContent img{
|
||||
width: 116rem;
|
||||
margin-left: 21rem;
|
||||
margin-top: 9px;
|
||||
height: 53rem;
|
||||
width: 75%;
|
||||
margin-left: 1.6rem;
|
||||
/* margin-top: 9px; */
|
||||
height: 5rem;
|
||||
}
|
||||
|
||||
.demonstration{
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 44%;
|
||||
top: 0.8rem;
|
||||
left: 43%;
|
||||
margin-bottom: 0px !important;
|
||||
/* margin-left: 7rem; */
|
||||
/* margin-top: 0.5rem; */
|
||||
/* margin: 0 auto; */
|
||||
}
|
||||
.webinputcheckbox{
|
||||
color: #fff;
|
||||
|
@ -176,7 +190,7 @@ html {
|
|||
float: left;
|
||||
text-decoration: none;
|
||||
margin-top: 10px;
|
||||
margin-left: 14%;
|
||||
margin-left: 1.77rem;
|
||||
font-size: 16px;
|
||||
}
|
||||
.newwebinputcheckbox{
|
||||
|
@ -193,19 +207,17 @@ html {
|
|||
/*margin-right: 3rem;*/
|
||||
/*margin-top: 20px;*/
|
||||
/*}*/
|
||||
.WPGstep .WPGnext,
|
||||
.WPGstep .topWPGnext {
|
||||
.WPGstep .topWPGnext{
|
||||
border: 1px solid #fff;
|
||||
color: #fff;
|
||||
padding: 5px 28px;
|
||||
float: right;
|
||||
margin-top: 10px;
|
||||
text-decoration: none;
|
||||
margin-right: 3rem;
|
||||
margin-top: 20px;
|
||||
margin-right: 0.5rem;
|
||||
margin-top: 11px;
|
||||
}
|
||||
|
||||
.WPGstep .WPGnext:hover,
|
||||
.WPGstep .topWPGnext:hover {
|
||||
.WPGstep .topWPGnext:hover{
|
||||
background: none gray
|
||||
}
|
|
@ -311,6 +311,7 @@ a:hover {
|
|||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#filelist-content ul {
|
||||
|
@ -635,7 +636,7 @@ a:hover {
|
|||
#ItemcommentPanel {
|
||||
position: absolute;
|
||||
right: 60px;
|
||||
width: 340px;
|
||||
width: 4rem;
|
||||
top: 19px;
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
|
@ -809,7 +810,7 @@ a:hover {
|
|||
|
||||
.downList-panel span {
|
||||
margin-top: 15px;
|
||||
color: #666;
|
||||
color: #fff;
|
||||
float: left;
|
||||
margin-left: 10px
|
||||
}
|
||||
|
@ -1460,7 +1461,7 @@ pre.prettyprint {
|
|||
}
|
||||
.wi216{
|
||||
width:100%;
|
||||
max-height: 200px;
|
||||
min-height: 150px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
@ -1535,7 +1536,7 @@ pre.prettyprint {
|
|||
margin-left: 0rem;
|
||||
}
|
||||
.topthumbsThis{
|
||||
margin:48px 0px 0px 17px;
|
||||
margin:20px 0px 0px 17px;
|
||||
width: 27px;
|
||||
padding-left: 7px;
|
||||
}
|
||||
|
@ -1547,8 +1548,8 @@ pre.prettyprint {
|
|||
height: 12px;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
margin-left: 0.15rem;
|
||||
display: flex;
|
||||
margin-left: 0.015rem;
|
||||
display: flex;
|
||||
}
|
||||
.margin003{
|
||||
margin: 0 0px -3px;
|
||||
|
|
|
@ -10,7 +10,8 @@ function WebPageGuide(options) {
|
|||
source: null
|
||||
}
|
||||
this.closeButton = '<a href="javascript:void(0);" class="WPGclose" title="关闭使用帮助">×</a>';
|
||||
this.stepTemplate = '<div class="WPGstep" step="" >'
|
||||
this.stepTemplate = '<div class="WPGnextbox" step="" >'
|
||||
+'<div class="WPGstep" step="" >'
|
||||
+ '<b class="WPGjt" style=""></b>'
|
||||
+ '<span class="h1 demonstration">代码标注使用提示</span>'
|
||||
+ '<p><span class="h2 WPGstepTitle"></span>'
|
||||
|
@ -19,7 +20,8 @@ function WebPageGuide(options) {
|
|||
'<a href="###" class="WPGnext">下一步</a>' +
|
||||
'<a href="###" class="topWPGnext">上一步</a>' +
|
||||
'</p>' +
|
||||
'</div>';
|
||||
'</div>'+
|
||||
'</div>';
|
||||
|
||||
this.settings = $.extend(this.settings, options);
|
||||
this.stepList = [];
|
||||
|
@ -63,16 +65,16 @@ function WebPageGuide(options) {
|
|||
var img3;
|
||||
for(var i=0;i<content.length;i++){
|
||||
if(i===0){
|
||||
img1="<div class='Codelabeimg'><a href="+content[0].codepath+">"+1+"."+content[0].code+"</a></div>"
|
||||
img1="<div class='Codelabeimg'><a href="+content[0].codepath+" target=\"_self\">"+1+"."+content[0].code+"</a></div>"
|
||||
}
|
||||
if(i===1){
|
||||
img2="<div class='Codelabeimg'><a href="+content[1].codepath+">"+2+"."+content[1].code+"</a></div>"
|
||||
img2="<div class='Codelabeimg'><a href="+content[1].codepath+" target=\"_self\">"+2+"."+content[1].code+"</a></div>"
|
||||
}
|
||||
if(i===2){
|
||||
img3="<div class='Codelabeimg'><a href="+content[2].codepath+">"+3+"."+content[2].code+"</a></div>"
|
||||
img3="<div class='Codelabeimg'><a href="+content[2].codepath+" target=\"_self\">"+3+"."+content[2].code+"</a></div>"
|
||||
}
|
||||
}
|
||||
img="<div>"+img1+img2+img2+"</div>";
|
||||
img="<div>"+img1+img2+img3+"</div>";
|
||||
item.container.find(".WPGstepContent").append(img);
|
||||
}
|
||||
|
||||
|
@ -83,7 +85,7 @@ function WebPageGuide(options) {
|
|||
|
||||
//绑定下一步事件
|
||||
item.container.find(".WPGnext").click(function () {
|
||||
var obj = $(this).parents('.WPGstep');
|
||||
var obj = $(this).parents('.WPGnextbox');
|
||||
step = obj.attr('step');
|
||||
obj.hide();
|
||||
if (parseInt(step) == num)//最后一个按钮时候删除添加的标签
|
||||
|
@ -98,7 +100,6 @@ function WebPageGuide(options) {
|
|||
}, 400);
|
||||
}
|
||||
stepnuma=parseInt(step)+1;
|
||||
console.log(stepnuma)
|
||||
});
|
||||
|
||||
//绑定上一步事件
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
!function($){$.fn.autoHeightTextareaDefaults={rows:0,minRows:0,maxRows:null,HIDDEN_STYLE:"height:0 !important;visibility:hidden !important;overflow:hidden !important;position:absolute !important;z-index:-1000 !important;top:0 !important;right:0 !important;",CONTEXT_STYLE:["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"],calculateNodeStyling:function(targetElement){var _this=this,style=window.getComputedStyle(targetElement),boxSizing=style.getPropertyValue("box-sizing"),paddingSize=parseFloat(style.getPropertyValue("padding-bottom"))+parseFloat(style.getPropertyValue("padding-top")),borderSize=parseFloat(style.getPropertyValue("border-bottom-width"))+parseFloat(style.getPropertyValue("border-top-width")),contextStyle;return{contextStyle:this.CONTEXT_STYLE.map(function(value){return value+":"+style.getPropertyValue(value)}).join(";"),paddingSize:paddingSize,borderSize:borderSize,boxSizing:boxSizing}},mainAlgorithm:function(hiddenTextarea,textareaElement){var _this=this,{paddingSize:paddingSize,borderSize:borderSize,boxSizing:boxSizing,contextStyle:contextStyle}=this.calculateNodeStyling(textareaElement);hiddenTextarea.setAttribute("style",this.HIDDEN_STYLE+contextStyle),hiddenTextarea.value=textareaElement.value||textareaElement.placeholder||"";var height=hiddenTextarea.scrollHeight;"border-box"===boxSizing?height+=borderSize:"content-box"===boxSizing&&(height-=paddingSize),hiddenTextarea.value="";var singleRowHeight=hiddenTextarea.scrollHeight-paddingSize,minRows,dataRows=$(textareaElement).attr("rows"),dataMinRows=$(textareaElement).attr("data-min-rows");minRows=dataRows>0&&dataMinRows>0?Math.max(dataRows,dataMinRows):dataRows>0?dataRows:dataMinRows>0?dataMinRows:1;var maxRows=$(textareaElement).attr("data-max-rows")?$(textareaElement).attr("data-max-rows"):null;if(this.rows&&this.minRows?minRows=Math.max(this.rows,this.minRows,minRows):this.rows?minRows=Math.max(this.rows,minRows):this.minRows&&(minRows=Math.max(this.minRows,minRows)),this.maxRows&&null!==maxRows?maxRows=Math.min(this.maxRows,maxRows):this.maxRows&&(maxRows=this.maxRows),null!==minRows){var minHeight=singleRowHeight*minRows;"border-box"===boxSizing&&(minHeight=minHeight+paddingSize+borderSize),height=Math.max(minHeight,height)}if(null!==maxRows){var maxHeight=singleRowHeight*maxRows;"border-box"===boxSizing&&(maxHeight=maxHeight+paddingSize+borderSize),height=Math.min(maxHeight,height)}$(textareaElement).css("height",height+"px")}},$.fn.autoHeightTextarea=function(options){var options=$.extend({},$.fn.autoHeightTextareaDefaults,options);return this.each(function(index,textareaElement){var hiddenTextarea;hiddenTextarea||(hiddenTextarea=document.createElement("textarea"),document.body.appendChild(hiddenTextarea)),options.mainAlgorithm(hiddenTextarea,textareaElement),hiddenTextarea.parentNode&&hiddenTextarea.parentNode.removeChild(hiddenTextarea),hiddenTextarea=null,$(textareaElement).on("focus",function(){hiddenTextarea||(hiddenTextarea=document.createElement("textarea"),document.body.appendChild(hiddenTextarea),hiddenTextarea.setAttribute("style",options.HIDDEN_STYLE))}).on("input",function(){options.mainAlgorithm(hiddenTextarea,textareaElement)}).on("blur",function(){hiddenTextarea.parentNode&&hiddenTextarea.parentNode.removeChild(hiddenTextarea),hiddenTextarea=null})}),this}}(jQuery);
|
|
@ -138,6 +138,7 @@ function getCookie(name) {
|
|||
var csrftoken = getCookie('csrftoken');
|
||||
|
||||
function show_annotation(file_id, line_num) {
|
||||
$("#modify_anno_textarea").autoHeightTextarea();
|
||||
ev = window.event;
|
||||
if(ev==undefined){
|
||||
ev=arguments.callee.caller.arguments[0]||window.event;
|
||||
|
@ -472,6 +473,7 @@ function show_new_question_answer(item, content, username) {
|
|||
|
||||
|
||||
function add_annotation(item,file_id, line_num) {
|
||||
|
||||
// 获取当前是注释还是问题
|
||||
function_name="add_annotation(this"+","+file_id+","+line_num+")"
|
||||
make_button_disable($(item))
|
||||
|
@ -479,7 +481,6 @@ function add_annotation(item,file_id, line_num) {
|
|||
var selectValue = $(item).siblings(".put-select").find(".active").html().trim();
|
||||
var text_context = "#addno-text-" + file_id+"-"+line_num;
|
||||
var content = $(text_context).val();
|
||||
|
||||
|
||||
if (content.trim().length == 0) {
|
||||
alert("内容不能为空")
|
||||
|
@ -506,6 +507,20 @@ function add_annotation(item,file_id, line_num) {
|
|||
}
|
||||
|
||||
function submit_annotation(file_id, line_num, content) {
|
||||
// 因为可能注释或问题没有值的时候,不会为该代码块添加html代码,所以首先判断
|
||||
// 然后将注释数+1
|
||||
var codeopration_anno_div = $("#codeopration_anno_"+file_id+"_" + line_num).html()
|
||||
var str = '<span id="annonums_' + line_num + '" class="annonums" onclick="show_annotation(' + file_id + ',' + line_num + ')">';
|
||||
str +='</span>';
|
||||
$("#codeopration_anno_" + +file_id + "_" + line_num).html(str);
|
||||
$(".addno-panel").hide();
|
||||
$(".source-addno-panel").remove();
|
||||
// show_annotation(file_id,line_num);
|
||||
//将注释添加到当前行的上一行
|
||||
var contenthtml ='<div class="linenum"></div>'+'<div class="sourcecode">'+'<div class="mypre newaddmypre hljs-comment ' + file_id+line_num + '">'+"//"+ content+'</div>'+'</div>'+'<div class="linestatus"></div>';
|
||||
var html = '<div class="newcodeline newcodelinebox">'+contenthtml+'</div>';
|
||||
var id=file_id+'_'+"L"+line_num;
|
||||
$("#"+id).before(html);
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type: "POST",
|
||||
|
@ -518,22 +533,9 @@ function submit_annotation(file_id, line_num, content) {
|
|||
},
|
||||
success: function (data) {
|
||||
if (data.status == 'success') {
|
||||
// 因为可能注释或问题没有值的时候,不会为该代码块添加html代码,所以首先判断
|
||||
// 然后将注释数+1
|
||||
var codeopration_anno_div = $("#codeopration_anno_"+file_id+"_" + line_num).html()
|
||||
var str = '<span id="annonums_' + line_num + '" class="annonums" onclick="show_annotation(' + file_id + ',' + line_num + ')">';
|
||||
str +='</span>';
|
||||
$("#codeopration_anno_" + +file_id + "_" + line_num).html(str);
|
||||
$(".addno-panel").hide();
|
||||
$(".source-addno-panel").remove();
|
||||
// show_annotation(file_id,line_num);
|
||||
//将注释添加到当前行的上一行
|
||||
var contenthtml ='<div class="linenum"></div>'+'<div class="sourcecode">'+'<div class="mypre newaddmypre hljs-comment ' + file_id+line_num + '">'+data.anno_content+'</div>'+'</div>'+'<div class="linestatus"></div>';
|
||||
var html = '<div class="newcodeline newcodelinebox">'+contenthtml+'</div>';
|
||||
var id=file_id+'_'+"L"+line_num;
|
||||
$("#"+id).before(html);
|
||||
layer.msg('提交成功');
|
||||
}else{
|
||||
alert(data.msg)
|
||||
layer.msg(data.msg);
|
||||
}
|
||||
},error:function(jqXHR, textStatus, errorThrown){
|
||||
if(jqXHR.readyState===0&&jqXHR.status===0){
|
||||
|
@ -1096,7 +1098,6 @@ function get_path_link_and_archor(path){
|
|||
return [path,null]
|
||||
}
|
||||
|
||||
|
||||
function add_tab(project_id,path,filename) {
|
||||
|
||||
// var tree_node = $("#jstree").jstree("get_selected");
|
||||
|
@ -1259,7 +1260,9 @@ function add_tab(project_id,path,filename) {
|
|||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
highlight_jstree_node(project_id,normal_path);
|
||||
|
||||
tabSet.add(path);
|
||||
}
|
||||
}
|
||||
|
@ -1447,7 +1450,7 @@ function inject_addnoPanel_html(item,file_id,linenum) {
|
|||
html_str = '<div class="addno-panel source-addno-panel" id="addno-panelsource-addno-panel" style="display:block">'+
|
||||
'<div class="trangle-op"></div>'+
|
||||
'<div class="put-content">'+
|
||||
'<div class="put-content newput-selectspanactive">为该行添加注释或者提问:</div>'+
|
||||
'<div class="put-content newput-selectspanactive">为该行或该代码块添加注释或者提问:</div>'+
|
||||
'<p class="put-select clearfix" id="addno-select-'+linenum+'">'+
|
||||
'<span class="active put-selectspanactive" onclick=\'$(this).siblings("span").removeClass("active");$(this).addClass("active");addannotation('+file_id+','+linenum+');\'>注释</span>'+
|
||||
'<span class="put-selectspanactive" onclick=\'$(this).siblings("span").removeClass("active"); $(this).addClass("active");addissue('+file_id+','+linenum+');\'>问题</span>'+
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,10 +31,10 @@
|
|||
<p class="thumbsThisnth2 thumbsThisnthnew"><span id="annosum_{{self_anno.id}}">{{ self_anno.voteup | add:self_anno.votedown }}</span></p>
|
||||
{% endif %}
|
||||
{% if self_anno.voteup > 9 %}
|
||||
<p class="thumbsThisnth2 thumbsThisnthnew" style="margin-left: -2px;"><span id="annosum_{{self_anno.id}}">{{ self_anno.voteup | add:self_anno.votedown }}</span></p>
|
||||
<p class="thumbsThisnth2 thumbsThisnthnew" style="margin-left: -3px;"><span id="annosum_{{self_anno.id}}">{{ self_anno.voteup | add:self_anno.votedown }}</span></p>
|
||||
{% endif %}
|
||||
{% if self_anno.voteup > 99 %}
|
||||
<p class="thumbsThisnth2 thumbsThisnthnew" style="margin-left: -6px;"><span id="annosum_{{self_anno.id}}">{{ self_anno.voteup | add:self_anno.votedown }}</span></p>
|
||||
<p class="thumbsThisnth2 thumbsThisnthnew" style="margin-left: -7px;"><span id="annosum_{{self_anno.id}}">{{ self_anno.voteup | add:self_anno.votedown }}</span></p>
|
||||
{% endif %}
|
||||
{% if self_anno.id in anno_vote_map and anno_vote_map|keyValue:self_anno.id == -1 %}
|
||||
<p><i class="fa fa-play thumbs_active deg90" aria-hidden="true" onclick="thumbsAnno(this,{{self_anno.pk}},-1)"></i> </p>
|
||||
|
@ -74,7 +74,7 @@
|
|||
{% for comment in anno_comments %}
|
||||
{% if comment.annotation.pk == self_anno.pk %}
|
||||
<div class="fl thumbsThis newtopthumbs">
|
||||
<div class="fl mt15">
|
||||
<div class="fl">
|
||||
{% if comment.id in comment_vote_map and comment_vote_map|keyValue:comment.id == 1 %}
|
||||
<p style="height:10px;" class="margin003"><i class="fa fa-play thumbs_active deg270" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},1)"></i> </p>
|
||||
{% else %}
|
||||
|
@ -152,7 +152,7 @@
|
|||
{% for comment in anno_comments %}
|
||||
{% if comment.annotation.pk == anno.pk %}
|
||||
<div class="fl thumbsThis newtopthumbs">
|
||||
<div class="fl mt15">
|
||||
<div class="fl">
|
||||
{% if comment.id in comment_vote_map and comment_vote_map|keyValue:comment.id == 1 %}
|
||||
<p class="margin003"><i class="fa fa-play thumbs_active deg270" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},1)"></i> </p>
|
||||
{% else %}
|
||||
|
|
|
@ -145,12 +145,12 @@
|
|||
<p class="clearfix">
|
||||
|
||||
<div class="panel-font">代码模块/文件标注:</div>
|
||||
<div class="newpanel-font">点击本页面右上方概述信息区域“<img src="/static/image/newadd.png" class="mr3 rightimgcommentblue">”可为该代码模块/文件添加标注,点击“<img src="/static/image/annotation.png" class="mr3 rightimgcommentblue">”号可查看/评论已添加的注释或修改自己添加的注释,点击“<img src="/static/image/question.png" class="mr3 rightimgcommentblue">”可查看/回答相关问题。</div>
|
||||
<div class="newpanel-font">点击本页面右上方概述信息区域“<img src="/static/image/newadd.png" class="mr3 rightimgcommentblue">”可为该代码模块/文件添加标注,点击“<img src="/static/image/annotation.png" class="mr3 rightimgcommentblue">”可查看/评论已添加的注释或修改自己添加的注释,点击“<img src="/static/image/question.png" class="mr3 rightimgcommentblue">”可查看/回答相关问题。</div>
|
||||
|
||||
</p>
|
||||
<p class="clearfix">
|
||||
<div class="panel-font">代码行标注:</div>
|
||||
<div class="newpanel-font">鼠标移至代码展示区域某代码行,点击该代码行行尾出现的“<img src="/static/image/newadd.png" class="mr3 rightimgcommentblue">”即可为该行代码或者以该行为起始的代码块添加标注;点击“<img src="/static/image/annotation.png" class="mr3 rightimgcommentblue">”号即可查看/评论已添加的注释/修改自己的注释;点击“<img src="/static/image/question.png" class="mr3 rightimgcommentblue">”可查看/回答”。</div>
|
||||
<div class="newpanel-font">鼠标移至代码展示区域某代码行,点击该代码行行尾出现的“<img src="/static/image/newadd.png" class="mr3 rightimgcommentblue">”即可为该行代码或者以该行为起始的代码块添加标注;点击“<img src="/static/image/annotation.png" class="mr3 rightimgcommentblue">”即可查看/评论已添加的注释/修改自己的注释;点击“<img src="/static/image/question.png" class="mr3 rightimgcommentblue">”可查看/回答”。</div>
|
||||
</p>
|
||||
|
||||
<div class="both"></div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="fl thumbsThis newtopthumbs">
|
||||
<div class="fl mt15">
|
||||
<div class="fl">
|
||||
<p class="margin003"><i class="fa fa-play deg270" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},1)"></i> </p>
|
||||
<p class="margin023 thumbsThisnth2 thumbsmarginLeft"><span id="comment_{{comment.pk}}">{{ comment.voteup | add:comment.votedown}}</span></p>
|
||||
<p><i class="fa fa-play deg90" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},-1)"></i> </p>
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,scalable=no">
|
||||
<script>
|
||||
document.documentElement.style.fontSize=innerWidth/16+"px";
|
||||
</script>
|
||||
<script type="application/javascript" src="{% static 'js/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js' %}"></script>
|
||||
<script type="application/javascript" src="{% static 'js/prettify.js' %}"></script>
|
||||
<script type="application/javascript" src="{% static 'js/WebPageGuide.js' %}"></script>
|
||||
<script type="application/javascript" src="{% static 'js/jquery-ui.min.js' %}"></script>
|
||||
<script type="application/javascript" src="{% static 'js/layer.js' %}"></script>
|
||||
<script type="application/javascript" src="{% static 'js/jquery-autoHeightTextarea.min.js' %}"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'vendor/bootstrap/css/bootstrap1.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'vendor/qtip/jquery.qtip.css' %}">
|
||||
|
@ -234,7 +239,11 @@
|
|||
steplist.newGuidStep("#codepanel","4.打开项目代码文件:","{% static 'css/img/4.png' %}");
|
||||
steplist.newGuidStep("#codepanel","5.为代码文件添加标注:","{% static 'css/img/5.png' %}");
|
||||
steplist.newGuidStep("#codepanel","6.为代码行/块添加标注:","{% static 'css/img/6.png' %}");
|
||||
steplist.newGuidStep("#codepanel","7.点击下面链接查看代码标注范例:",[{code:"C++ - TensorFlow/.../tensor_slice.cc",codepath:"http://120.132.101.149/projects/tensorflow/tensorflow/core/framework/tensor_slice.cc#"},{code:"Java - Hadoop/.../Mapper.java",codepath:"http://120.132.101.149/projects/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Mapper.java#"},{code:" Python - Nova/.../db.py",codepath:"http://120.132.101.149/projects/OpenStack-nova/nova/servicegroup/drivers/db.py#"}]);
|
||||
steplist.newGuidStep("#codepanel","7.点击下面链接查看代码标注范例:",[
|
||||
{code:"C++ - TensorFlow/.../tensor_slice.cc",codepath:"http://120.132.101.149/projects/tensorflow/tensorflow/core/framework/tensor_slice.cc#"},
|
||||
{code:"Java - Hadoop/.../Mapper.java",codepath:"http://120.132.101.149/projects/hadoop/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Mapper.java#"},
|
||||
{code:" Python - Nova/.../db.py",codepath:"http://120.132.101.149/projects/OpenStack-nova/nova/servicegroup/drivers/db.py#"}
|
||||
]);
|
||||
steplist.startGuide();
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue