Skip to content

Commit

Permalink
fix bug: mistake link in project panel, close #84
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiyuan-Yang committed May 15, 2020
1 parent 8d81842 commit 2cf3a9a
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 90 deletions.
4 changes: 2 additions & 2 deletions app/controllers/auto_test_projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ def trigger

def new_auto_test_point
@classroom_id = params[:classroom_id]
test_type = params[:test_type]
@test_type = params[:test_type]
@public_personal_project_id = AutoTestProject.find_by(
:classroom_id => @classroom_id,
:test_type => test_type,
:test_type => @test_type,
:is_public => 1
).gitlab_id
@errors = []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
<template>
<el-form :model="pairForm" :rules="rules" ref="pairForm" :action="action" method="post">
<csrf></csrf>
<p>请输入结对学生的学号,按每2人一行进行输入,用英文逗号','隔开</p>
<el-input
type="textarea"
:rows="10"
placeholder="请输入内容"
v-model="pairForm.text" name='pairForm[text]'>
</el-input>
<el-form-item>
<el-button type="primary" @click="submitForm('pairForm')">创建仓库</el-button>
</el-form-item>
</el-form>
<el-form :model="pairForm" :rules="rules" ref="pairForm" :action="action" method="post">
<csrf></csrf>
<p>请输入结对学生的学号,按每2人一行进行输入,用英文逗号','隔开</p>
<el-input
type="textarea"
:rows="10"
placeholder="请输入内容"
v-model="pairForm.text" name='pairForm[text]'>
</el-input>
<el-form-item>
<el-button type="primary" @click="submitForm('pairForm')">创建仓库</el-button>
</el-form-item>
</el-form>
</template>

<script>
import Vue from 'vue/dist/vue.esm'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import csrf from '../../shared/components/csrf.vue';
import Vue from 'vue/dist/vue.esm'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import csrf from '../../shared/components/csrf.vue';
Vue.use(ElementUI);
Vue.use(ElementUI);
export default {
props: ['action'],
data() {
return {
pairForm: {
text: ''
},
rules: {
text: [
{required: true, message: '请输入学号', trigger: 'blur'}
]
}
}
export default {
props: ['action'],
data() {
return {
pairForm: {
text: ''
},
components: {
csrf,
},
methods: {
submitForm: function (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
//alert('submit!');
this.$refs[formName].$el.submit();
} else {
console.log('error submit!!');
return false;
}
})
}
rules: {
text: [
{required: true, message: '请输入学号', trigger: 'blur'}
]
}
}
},
components: {
csrf,
},
methods: {
submitForm: function (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
//alert('submit!');
this.$refs[formName].$el.submit();
} else {
console.log('error submit!!');
return false;
}
})
}
}
}
</script>

<style scoped>
Expand Down
13 changes: 6 additions & 7 deletions app/javascript/src/auto_tests/components/test_points.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
export default {
props: ['points', 'testtype', 'createtestpointhref'],
data: function () {
data() {
return {
has_points: false,
selfpoints: [],
Expand All @@ -59,15 +59,14 @@
mounted() {
this.selfpoints = JSON.parse(this.points);
console.log(this.selfpoints);
if (this.testtype === 'personal')
{
// console.log(this.selfpoints);
// console.log(this.testtype);
if (this.testtype === 'personal') {
this.selfscribe = '个人';
}
else if (this.testtype == 'pair')
{
} else if (this.testtype === 'pair') {
this.selfscribe = '结对';
}
// console.log(this.selfscribe);
}
}
Expand Down
66 changes: 33 additions & 33 deletions app/javascript/src/text_component/fold_unfold_text.vue
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
<template>
<div class="text-content">
<p v-if="!need_unfold">
{{text}}
</p>
<template v-if="need_unfold">
<template v-if="fold">
<p>{{text.slice(0, 40) + "..."}}</p>
</template>
<template v-else="">
<p>{{text}}</p>
</template>
<el-button type="text" @click="change_state">{{fold?'展开':'收起'}}</el-button>
</template>
</div>
<div class="text-content">
<p v-if="!need_unfold">
{{text}}
</p>
<template v-if="need_unfold">
<template v-if="fold">
<p>{{text.slice(0, 40) + "..."}}</p>
</template>
<template v-else="">
<p>{{text}}</p>
</template>
<el-button type="text" @click="change_state">{{fold?'展开':'收起'}}</el-button>
</template>
</div>
</template>

<script>
import Vue from 'vue/dist/vue.esm';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import Vue from 'vue/dist/vue.esm';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
export default {
export default {
props: {
text: {
type: String,
required: true
}
text: {
type: String,
required: true
}
},
data() {
return {
need_unfold: false,
fold: true
}
return {
need_unfold: false,
fold: true
}
},
mounted() {
if (this.text.length > 40) {
this.need_unfold = true;
}
if (this.text.length > 40) {
this.need_unfold = true;
}
},
methods: {
change_state() {
this.fold = !this.fold;
}
change_state() {
this.fold = !this.fold;
}
}
}
}
</script>
2 changes: 1 addition & 1 deletion app/views/auto_test_projects/auto_test_points.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
.page-title 查看评测点
%selftp{:points => @points,
:testtype => @test_type,
:createtestpointhref => create_auto_test_point_classroom_auto_test_projects_path(classroom_id: @classroom_id, test_type: 'personal')}
:createtestpointhref => create_auto_test_point_classroom_auto_test_projects_path(classroom_id: @classroom_id, test_type: @test_type)}
6 changes: 5 additions & 1 deletion app/views/auto_test_projects/create_auto_test_point.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

#new-auto-test-point-app.small-container{data: {gitlabid: @public_personal_project_id}}
.page-title-holder
.page-title 创建个人项目测试点
.page-title
- if @test_type == 'personal'
创建个人项目评测点
- else
创建结对项目评测点
%el-form{':model': "form", ref: 'new_auto_test_point', ':rules': 'rules', 'label-width': '100px', action: create_auto_test_point_classroom_auto_test_projects_path, method: 'post'}
- @errors.each do |error|
%el-alert.error-item{type: 'error', 'title': error}
Expand Down

0 comments on commit 2cf3a9a

Please sign in to comment.