diff --git a/.gitignore b/.gitignore index 80a536ca6..9a82a1138 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,11 @@ pids *.seed *.pid.lock +# Ignore master key for decrypting credentials and more. +/config/master.key +/config/database.yml +/.idea/* + # Directory for instrumented libs generated by jscoverage/JSCover lib-cov @@ -80,3 +85,4 @@ typings/ .dynamodb/ .DS_Store +.idea/* diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 15a15b218..000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/forgeplus-react.iml b/.idea/forgeplus-react.iml deleted file mode 100644 index c3cd732c0..000000000 --- a/.idea/forgeplus-react.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 03d9549ea..000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index e95b9d032..000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 956c9e829..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b746d2e22..f50517c47 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,7 @@ - - + - - + + - - + + + + + + + + + + + - + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -58,11 +101,17 @@ textcount forks commentCtx + 上传文件 + subFileType + .ide + .idea + deleteUser + axios.delete $PROJECT_DIR$/src/forge - $PROJECT_DIR$/src $PROJECT_DIR$ + $PROJECT_DIR$/src @@ -81,13 +130,18 @@ @@ -107,11 +161,6 @@ - - - - - @@ -128,7 +177,7 @@ - + - this.jsCopy()}> + + this.jsCopy()}> + diff --git a/src/forge/Branch/branch.css b/src/forge/Branch/branch.css index ebff0be94..a8c1deeec 100644 --- a/src/forge/Branch/branch.css +++ b/src/forge/Branch/branch.css @@ -3,9 +3,13 @@ border-radius: 4px; display: flex; justify-content: center; - padding:0px 10px; height: 35px; line-height: 35px; + width: 150px; +} +.branchDropdown .ant-dropdown-trigger{ + width: 100%; + text-align: center; } .branchOptions{ width: 200px; @@ -16,7 +20,7 @@ max-height: 200px; } .OptionsUl{ - max-height: 100px; + max-height: 200px; overflow-y: auto; } .OptionsUl li{ diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 095674a39..ef818de7d 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -36,7 +36,6 @@ class CoderRootDirectory extends Component{ branchList:undefined, fileDetail:undefined, branchLastCommit:undefined, - current_user:undefined, rootData:undefined } @@ -293,10 +292,10 @@ class CoderRootDirectory extends Component{
{ - subFileType !== "file" && isManager && isDeveloper && -

+ subFileType !== "file" && (isManager || isDeveloper) && +

新建文件 - 上传文件 + {/* 上传文件 */}

} { diff --git a/src/forge/Main/CoderRootFileDetail.js b/src/forge/Main/CoderRootFileDetail.js index a871c771c..9204fcd63 100644 --- a/src/forge/Main/CoderRootFileDetail.js +++ b/src/forge/Main/CoderRootFileDetail.js @@ -1,5 +1,14 @@ import React , { Component } from "react"; -import Editor from "react-monaco-editor"; +// import Editor from "react-monaco-editor"; + +import {UnControlled as CodeMirror} from 'react-codemirror2'; +import 'codemirror/mode/cmake/cmake'; +import 'codemirror/mode/sql/sql'; +import 'codemirror/mode/xml/xml'; +import 'codemirror/mode/clike/clike'; +import 'codemirror/mode/javascript/javascript'; +import 'codemirror/addon/hint/show-hint.css'; +import 'codemirror/addon/hint/show-hint.js'; import { Popconfirm, Result } from 'antd'; @@ -42,16 +51,16 @@ class CoderRootFileDetail extends Component{ } // 编辑文件 - changeContent=(e)=>{ + + changeMmirror=(e,e1,value)=>{ this.setState({ - value:e + value }) } deleteFile=()=>{ - const { author , branch , detail }= this.props; + const { branch , detail }= this.props; const { projectsId } = this.props.match.params; - const authorLogin = this.props.match.params.author; const url = `/repositories/${projectsId}/delete_file.json`; axios.delete(url,{ @@ -97,30 +106,35 @@ class CoderRootFileDetail extends Component{ } render(){ - const { detail } = this.props; + const { detail , current_user , isManager , isReporter , isDeveloper } = this.props; const { readOnly ,value } = this.state; + let flag = current_user && current_user.login && (isManager || isReporter); + return(

{bytesToSize(detail && detail.size)} - { - readOnly ? - - : - - - - - } + flag && + + { + readOnly ? + + : + + + + + } - - - - + + + + + }

@@ -130,13 +144,30 @@ class CoderRootFileDetail extends Component{ 下载原始文件
: - + // }
diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index bf53fe729..9aebb40a1 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -291,12 +291,11 @@ class Detail extends Component{ render(){ - const { projectDetail , watchers_count , praises_count , forked_count , isSpin } = this.state; + const { projectDetail , watchers_count , praises_count , forked_count , isSpin , isManager } = this.state; const url = this.props.history.location.pathname; const urlArr= url.split("/"); const urlFlag = (urlArr.length === 3); - const { isManager } = this.props; const { projectsId } = this.props.match.params; const { state } = this.props.history.location; diff --git a/src/forge/Main/list.css b/src/forge/Main/list.css index 1fc86cb8d..8b3f4777d 100644 --- a/src/forge/Main/list.css +++ b/src/forge/Main/list.css @@ -368,8 +368,8 @@ body,#root{ } /* 分支 */ .branchTable{ - border:1px solid #f4f4f4; - background-color: #f4f4f4; + border:1px solid #f7f7f7; + background-color: #f7f7f7; border-radius: 4px; margin-top:20px; } @@ -442,10 +442,10 @@ body,#root{ padding: 0px 10px; } .addFile a:first-child{ - border-radius: 4px 0px 0px 4px; + border-radius: 4px; } .addFile a:last-child{ - border-radius: 0px 4px 4px 0px; + /* border-radius: 0px 4px 4px 0px; */ border-left: 1px solid rgba(247, 247, 247, 0.3); } .addFile a:active{ @@ -559,4 +559,10 @@ body,#root{ border: 1px solid #2185d0; } .content-file{margin-top: 8px;} + +.content-file .CodeMirror{ + background-color: #f7f7f7; + border: 1px solid #e4e4e4; + border-radius: 4px; +} .text-center{text-align: center;} diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index a11c99300..bb840f777 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -5,15 +5,20 @@ import axios from 'axios'; import Nav from '../Order/Nav'; import UploadComponent from '../Upload/Index'; import { getImageUrl } from 'educoder'; -import {Modal, Col, Form, Input, Tooltip, Popconfirm, Pagination , Spin,Dropdown,Icon,Menu} from 'antd' -import NoneData from '../../modules/courses/coursesPublic/NoneData'; +import {Modal, Form, Input, Tooltip, Popconfirm, Pagination , Spin,Dropdown,Icon,Menu} from 'antd' import Attachments from '../Upload/attachment' import './merge.css'; - +import QuillForEditor from '../quillForEditor'; const TextArea = Input.TextArea; - +const options = [ + ['bold', 'italic', 'underline'], + [{header: [1,2,3,false]}], + ['blockquote', 'code-block'], + ['link', 'image'], + ['formula'] +]; class MessageCount extends Component{ constructor(props){ super(props); @@ -39,7 +44,9 @@ class MessageCount extends Component{ mergename:'合并请求', mergekey:'merge', title:'', - body:'' + body:'', + commentsContent:undefined, + quillFlag:false } } @@ -81,12 +88,19 @@ class MessageCount extends Component{ //添加评论 addjournals=()=>{ + const { data, page, limit, fileList , commentsContent } = this.state; + if(!commentsContent){ + this.setState({ + quillFlag:true + }) + return; + } this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ - const { data, page, limit, fileList } = this.state; const url = `/issues/${data.issue.id}/journals.json`; axios.post(url,{ ...values, + content:JSON.stringify(commentsContent), issue_id:data.id, attachment_ids:fileList }).then(result=>{ @@ -96,7 +110,9 @@ class MessageCount extends Component{ attachments_ids: undefined }); this.setState({ - showFiles: false + showFiles: false, + quillFlag:false, + commentsContent:undefined }) this.getjournalslist(page, limit); this.props.showNotification("评论成功!"); @@ -160,7 +176,7 @@ class MessageCount extends Component{ project_id:projectsId, id:data.pull_request.id, do:mergekey, - body:body, + body:JSON.stringify(body), title:title, }).then(result=>{ if(result){ @@ -173,14 +189,14 @@ class MessageCount extends Component{ //修改评论 updatedetail=(id)=>{ - console.log("updtedetail", this.state) + // console.log("updtedetail", this.state) const {page, limit,data } = this.state; const {orderId} = this.props.match.params; const url = `/issues/${data.issue.id}/journals/${id}.json`; axios.put(url,{ issue_id:orderId, id:id, - content:this.state.countvalue + content:JSON.stringify(this.state.countvalue) }).then(result=>{ if(result){ this.setState({ @@ -217,9 +233,9 @@ class MessageCount extends Component{ }) } - changmodelname=(e)=>{ + changmodelname=(value)=>{ this.setState({ - countvalue:e.target.value + countvalue:value }) } changtitlepr=(e)=>{ @@ -228,9 +244,9 @@ class MessageCount extends Component{ }) } - changbodypr=(e)=>{ + changbodypr=(value)=>{ this.setState({ - body:e.target.value + body:value }) } editdetail=(count,status)=>{ @@ -314,9 +330,48 @@ class MessageCount extends Component{ }) } + changeComments=(value)=>{ + this.setState({ + commentsContent:value + }) + if(value){ + this.setState({ + quillFlag:false + }) + } + } + + stringJson=(value) =>{ + let _value = null; + + try { + _value = JSON.parse(value); + } catch (e) { + _value = value; + } + return _value + } + commentCtx = (ctx) => { + let _ctx = null; + + try { + _ctx = JSON.parse(ctx); + } catch (e) { + _ctx = ctx; + } + + return ( + + ) + }; + render(){ const { projectsId,mergeId } = this.props.match.params; - const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles } = this.state; + const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles , commentsContent , quillFlag } = this.state; const { getFieldDecorator } = this.props.form; const { current_user } = this.props; const url = this.props.history.location.pathname; @@ -370,7 +425,7 @@ class MessageCount extends Component{
{ item.content ? -
{item.content}
+ this.commentCtx(item.content) :
{this.renderJournalList(item.journal_details)} @@ -384,7 +439,20 @@ class MessageCount extends Component{ }
-