From 58d05689eccf177dee5310e0080bab0bf8080901 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 26 Mar 2015 15:00:50 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E4=B8=8E=E9=80=80?=
=?UTF-8?q?=E5=87=BA=E5=88=86=E7=8F=AD=E6=98=AFjs=E8=B7=B3=E8=BD=AC?=
=?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/join_group.js.erb | 2 +-
app/views/courses/unjoin_group.js.erb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/courses/join_group.js.erb b/app/views/courses/join_group.js.erb
index 7bdefdb9f..e0db2b440 100644
--- a/app/views/courses/join_group.js.erb
+++ b/app/views/courses/join_group.js.erb
@@ -1,2 +1,2 @@
-$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
+$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");
\ No newline at end of file
diff --git a/app/views/courses/unjoin_group.js.erb b/app/views/courses/unjoin_group.js.erb
index 7bdefdb9f..e0db2b440 100644
--- a/app/views/courses/unjoin_group.js.erb
+++ b/app/views/courses/unjoin_group.js.erb
@@ -1,2 +1,2 @@
-$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
+$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");
\ No newline at end of file
From 53eef164c9d9f80d75087aa01c4f4275ebfec10a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 26 Mar 2015 15:12:14 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E6=97=B6layout=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 2 +-
app/views/layouts/new_base.html.erb | 115 ++++++++++++++++++++++++++
2 files changed, 116 insertions(+), 1 deletion(-)
create mode 100644 app/views/layouts/new_base.html.erb
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 0b3f88d68..595ed9476 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -500,7 +500,7 @@ class CoursesController < ApplicationController
@course = Course.new
@course.safe_attributes = params[:course]
month = Time.now.month
- render :layout => 'base'
+ render :layout => 'new_base'
end
def desc_sort_course_by_avtivity(activity_count, courses)
diff --git a/app/views/layouts/new_base.html.erb b/app/views/layouts/new_base.html.erb
new file mode 100644
index 000000000..378e20ab0
--- /dev/null
+++ b/app/views/layouts/new_base.html.erb
@@ -0,0 +1,115 @@
+<% course_model %>
+
+
+
+
+
+ <%= h html_title %>
+
+
+
+ <%= csrf_meta_tag %>
+ <%= favicon %>
+ <%= javascript_heads %>
+ <%= heads_for_theme %>
+ <%= call_hook :view_layouts_base_html_head %>
+ <%= stylesheet_link_tag 'public', 'leftside', 'courses'%>
+ <%= javascript_include_tag "course","header" %>
+
+ <%= yield :header_tags -%>
+
+
+
+
+ <%= render :partial => 'layouts/new_header' %>
+
+
+
+
+
+
+ <%= render :partial => 'layouts/new_footer' %>
+
+
+<%= render :partial => 'layouts/new_feedback' %>
+
+ <%= l(:label_loading) %>
+
+
+<%= call_hook :view_layouts_base_body_bottom %>
+
+
+
\ No newline at end of file
From 8f90fed8bea007b17b664aaa696088f9992803c3 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 26 Mar 2015 16:01:25 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/new.html.erb | 72 +++++++++++++++++++++------
app/views/layouts/new_base.html.erb | 76 ++---------------------------
public/javascripts/course.js | 49 +++++++++++++++++++
3 files changed, 108 insertions(+), 89 deletions(-)
diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb
index b9422ba64..3d1a3f6a4 100644
--- a/app/views/courses/new.html.erb
+++ b/app/views/courses/new.html.erb
@@ -1,16 +1,56 @@
-<% @nav_dispaly_course_all_label = 1
- @nav_dispaly_forum_label = 1
- @nav_dispaly_course_label = nil
- @nav_dispaly_store_all_label = 1 %>
- <%=l(:label_course_new)%>
-<%= labelled_form_for @course do |f| %>
-
- <%= render :partial => 'course_form', :locals => { :f => f } %>
-
- <%= submit_tag l(:button_create), :class => "enterprise"%>
-
-
- <%= javascript_tag "$('#course_name').focus();" %>
-
-<% end %>
-<% html_title(l(:label_course_new)) -%>
\ No newline at end of file
+
+
<%= l(:permission_new_course)%>
+
+
+
\ No newline at end of file
diff --git a/app/views/layouts/new_base.html.erb b/app/views/layouts/new_base.html.erb
index 378e20ab0..a270243b6 100644
--- a/app/views/layouts/new_base.html.erb
+++ b/app/views/layouts/new_base.html.erb
@@ -25,80 +25,10 @@
-
-
配置课程
-
-
-
+ <%= render_flash_messages %>
+ <%= yield %>
+ <%= call_hook :view_layouts_base_content %>
-
<%= render :partial => 'layouts/new_footer' %>
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 18aa965ca..65f45ea62 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -41,6 +41,55 @@ function edit_group(id,url,course_id,group_id)
}
);
}
+///////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////新建课程相关
+//验证课程名称
+function regex_course_name()
+{
+ var name = $.trim($("#course_name").val());
+ if(name.length == 0)
+ {
+ $("#course_name_notice").show();
+ return false;
+ }
+ else
+ {
+ $("#course_name_notice").hide();
+ return true;
+ }
+}
+//验证课程学时
+function regex_course_class_period()
+{
+ var class_period = $.trim($("#class_period").val());
+ var regex = /^\d*$/;
+ if(class_period.length == 0)
+ {
+ $("#course_class_period_notice").html("学时总数不能为空");
+ $("#course_class_period_notice").show();
+ return false;
+ }
+ else if (regex.test(class_period)) {
+ $("#course_class_period_notice").html("");
+ $("#course_class_period_notice").hide();
+ return true;
+ }
+ else
+ {
+ $("#course_class_period_notice").html("学时总数必须为数字");
+ $("#course_class_period_notice").show();
+ return false;
+ }
+}
+//提交新建课程
+function submit_new_course()
+{
+ if(regex_course_name()&®ex_course_class_period())
+ {
+ $("#new_course").submit();
+ }
+}
+
///////////////////////////////////////////////////////////////
//验证搜索时输入名字
From cb1fce32fe85148cea57401505699c34ea9b51e5 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 26 Mar 2015 17:17:31 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=AF=BE=E7=A8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/services/courses_service.rb | 2 +
app/views/avatar/_new_avatar_form.html.erb | 26 +++++++++
app/views/courses/settings.html.erb | 63 ++++++++++++++++++++--
public/javascripts/course.js | 8 +++
4 files changed, 96 insertions(+), 3 deletions(-)
create mode 100644 app/views/avatar/_new_avatar_form.html.erb
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 1ec8a0ef0..2010c8252 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -239,6 +239,8 @@ class CoursesService
course.time = params[:time]
course.term = params[:term]
course.class_period = params[:class_period]
+ params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0
+ params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0
if course.save
if params[:course][:is_public] == '0'
course_status = CourseStatus.find_by_course_id(course.id)
diff --git a/app/views/avatar/_new_avatar_form.html.erb b/app/views/avatar/_new_avatar_form.html.erb
new file mode 100644
index 000000000..415ec09af
--- /dev/null
+++ b/app/views/avatar/_new_avatar_form.html.erb
@@ -0,0 +1,26 @@
+
+ <%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
+
+<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %>
+<%= file_field_tag 'avatar[image]',
+ :id => nil,
+ :class => 'upbtn fl',
+ :size => "1",
+ :multiple => false,
+ :onchange => 'addInputAvatar(this);',
+ :data => {
+ :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
+ :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
+ :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
+ :file_type => Redmine::Configuration['pic_types'].to_s,
+ :type_support_message => l(:error_pic_type),
+ :upload_path => upload_avatar_path(:format => 'js'),
+ :description_placeholder => nil ,# l(:label_optional_description)
+ :source_type => source.class.to_s,
+ :source_id => source.id.to_s
+ } %>
+
+<% content_for :header_tags do %>
+ <%= javascript_include_tag 'avatars' %>
+<% end %>
+
\ No newline at end of file
diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb
index c2030ffec..74c82cf09 100644
--- a/app/views/courses/settings.html.erb
+++ b/app/views/courses/settings.html.erb
@@ -1,3 +1,60 @@
-<%=l(:label_settings)%>
-<%= render_tabs course_settings_tabs %>
-<% html_title(l(:label_settings)) -%>
+
+
<%= l(:label_course_modify_settings)%>
+
+
+
\ No newline at end of file
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 65f45ea62..5e1e138bb 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -90,6 +90,14 @@ function submit_new_course()
}
}
+function submit_edit_course(id)
+{
+ if(regex_course_name()&®ex_course_class_period())
+ {
+ $("#edit_course_"+id).submit();
+ }
+}
+
///////////////////////////////////////////////////////////////
//验证搜索时输入名字