新增班级时名称为1个字符时报错

This commit is contained in:
guange 2016-07-08 17:04:17 +08:00
parent ed39b4b4f1
commit 068c8967e1
4 changed files with 29 additions and 36 deletions

View File

@ -72,7 +72,7 @@ class Course < ActiveRecord::Base
validates_presence_of :term,:name
validates_format_of :class_period, :with =>/^[1-9]\d*$/
validates_format_of :time, :with => /^\d{4}$/
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]*$/
validates_length_of :description, :maximum => 10000
before_save :self_validate

View File

@ -61,4 +61,4 @@ class SyllabusesService
end
end
end

View File

@ -28,31 +28,31 @@
<script src="https://dn-demotest.qbox.me/angular.all.min.js"></script>
<!-- <script src="/javascripts/wechat/build/angular.all.min.js"></script> -->
<script src="/javascripts/wechat/build/app.min.js"></script>
<!-- <script src="/javascripts/wechat/app.js"></script> -->
<!-- <script src="/javascripts/wechat/others/factory.js"></script> -->
<!-- <script src="/javascripts/wechat/others/filter.js"></script> -->
<!-- <script src="/javascripts/wechat/directives/alert.js"></script> -->
<!-- <script src="/javascripts/wechat/directives/form_validate.js"></script> -->
<!-- <script src="/javascripts/wechat/directives/input_auto.js"></script> -->
<!-- <script src="/javascripts/wechat/directives/loading_spinner.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/reg.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/invite_code.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/login.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/activity.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/new_class.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/edit_class.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/blog.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/course_notice.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/discussion.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/homework.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/issue.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/journals.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/class.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/class_list.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/myresource.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/send_class_list.js"></script> -->
<!-- <script src="/javascripts/wechat/others/routes.js"></script> -->
<!-- <script src="/javascripts/wechat/build/app.min.js"></script> -->
<script src="/javascripts/wechat/app.js"></script>
<script src="/javascripts/wechat/others/factory.js"></script>
<script src="/javascripts/wechat/others/filter.js"></script>
<script src="/javascripts/wechat/directives/alert.js"></script>
<script src="/javascripts/wechat/directives/form_validate.js"></script>
<script src="/javascripts/wechat/directives/input_auto.js"></script>
<script src="/javascripts/wechat/directives/loading_spinner.js"></script>
<script src="/javascripts/wechat/controllers/reg.js"></script>
<script src="/javascripts/wechat/controllers/invite_code.js"></script>
<script src="/javascripts/wechat/controllers/login.js"></script>
<script src="/javascripts/wechat/controllers/activity.js"></script>
<script src="/javascripts/wechat/controllers/new_class.js"></script>
<script src="/javascripts/wechat/controllers/edit_class.js"></script>
<script src="/javascripts/wechat/controllers/blog.js"></script>
<script src="/javascripts/wechat/controllers/course_notice.js"></script>
<script src="/javascripts/wechat/controllers/discussion.js"></script>
<script src="/javascripts/wechat/controllers/homework.js"></script>
<script src="/javascripts/wechat/controllers/issue.js"></script>
<script src="/javascripts/wechat/controllers/journals.js"></script>
<script src="/javascripts/wechat/controllers/class.js"></script>
<script src="/javascripts/wechat/controllers/class_list.js"></script>
<script src="/javascripts/wechat/controllers/myresource.js"></script>
<script src="/javascripts/wechat/controllers/send_class_list.js"></script>
<script src="/javascripts/wechat/others/routes.js"></script>
</body>
</html>

View File

@ -1,18 +1,11 @@
app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', function($scope, $http, $routeParams, config, auth, alertService,rms){
app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', 'rms', function($scope, $http, $routeParams, config, auth, alertService,rms){
var vm = $scope;
var send_id = $routeParams.id;
vm.alertService = alertService.create();
// vm.courses = [];
vm.syllabuses = [];
var loadClassList = function () {
// $http.get(config.apiUrl + "courses?token=" + auth.token() + "&per_page_count=10&page=1").then(
// function (response) {
// console.log(response.data);
// vm.courses = response.data.data;
// }
// );
$http.get(config.apiUrl + "syllabuses?token=" + auth.token()).then(
function (response) {
console.log(response.data);
@ -59,4 +52,4 @@ app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'co
})
}
}]);
}]);