diff --git a/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568175961.jpeg b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568175961.jpeg new file mode 100644 index 000000000..c4b2991f0 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568175961.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568181723.jpeg b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568181723.jpeg new file mode 100644 index 000000000..c4b2991f0 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568181723.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568182403.jpeg b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568182403.jpeg new file mode 100644 index 000000000..c4b2991f0 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568182403.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568184157.jpeg b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568184157.jpeg new file mode 100644 index 000000000..c4b2991f0 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568184157.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568184419.jpeg b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568184419.jpeg new file mode 100644 index 000000000..c4b2991f0 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/103206716ec0ff5857d88c56a0f60bb2_1568184419.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/7026b63b2b6ee82d106bbe09606aa5c3_1568189156.jpeg b/ /Users/hs/edu/educoder/files/2019/09/7026b63b2b6ee82d106bbe09606aa5c3_1568189156.jpeg new file mode 100644 index 000000000..1d74a32eb Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/7026b63b2b6ee82d106bbe09606aa5c3_1568189156.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568182459.jpeg b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568182459.jpeg new file mode 100644 index 000000000..4b9cb6335 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568182459.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568182888.jpeg b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568182888.jpeg new file mode 100644 index 000000000..4b9cb6335 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568182888.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568183020.jpeg b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568183020.jpeg new file mode 100644 index 000000000..4b9cb6335 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568183020.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568184308.jpeg b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568184308.jpeg new file mode 100644 index 000000000..4b9cb6335 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568184308.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568186092.jpeg b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568186092.jpeg new file mode 100644 index 000000000..4b9cb6335 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568186092.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568189102.jpeg b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568189102.jpeg new file mode 100644 index 000000000..4b9cb6335 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/8eac8f9edc564e87a06d67ee4c576aeb_1568189102.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568180549.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568180549.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568180549.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181216.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181216.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181216.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181231.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181231.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181231.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181282.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181282.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181282.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181676.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181676.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181676.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181695.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181695.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568181695.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188007.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188007.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188007.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188087.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188087.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188087.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188134.xlsx b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188134.xlsx new file mode 100644 index 000000000..7bb53cf93 Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/dedb5d5cabe8cc761d05645a30100db7_1568188134.xlsx differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568181847.jpeg b/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568181847.jpeg new file mode 100644 index 000000000..05b40a91e Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568181847.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568181868.jpeg b/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568181868.jpeg new file mode 100644 index 000000000..05b40a91e Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568181868.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568182522.jpeg b/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568182522.jpeg new file mode 100644 index 000000000..05b40a91e Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568182522.jpeg differ diff --git a/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568184059.jpeg b/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568184059.jpeg new file mode 100644 index 000000000..05b40a91e Binary files /dev/null and b/ /Users/hs/edu/educoder/files/2019/09/f3dee181779c5f52b5389e44c8affe0c_1568184059.jpeg differ diff --git a/Gemfile.lock b/Gemfile.lock index 3e5945c70..6a4a7e08f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,8 +54,8 @@ GEM tzinfo (~> 1.1) acts-as-taggable-on (6.0.0) activerecord (~> 5.0) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) archive-zip (0.11.0) io-like (~> 0.3.0) arel (9.0.0) @@ -180,7 +180,7 @@ GEM rack (>= 1.2, < 3) pdfkit (0.8.4.1) popper_js (1.14.5) - public_suffix (3.0.2) + public_suffix (4.0.1) puma (3.12.0) rack (2.0.5) rack-cors (1.0.2) diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index 2dcd7cd17..f882a9b36 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -44,6 +44,14 @@ $.notifyDefaults({ delay: 2000 }); +function show_success_flash(){ + $.notify({ + message: '操作成功' + },{ + type: 'success' + }); +} + $(document).on('turbolinks:load', function(){ $('[data-toggle="tooltip"]').tooltip({ trigger : 'hover' }); $('[data-toggle="popover"]').popover(); diff --git a/app/assets/javascripts/admins/ec_templates/index.js b/app/assets/javascripts/admins/ec_templates/index.js new file mode 100644 index 000000000..88ac29f58 --- /dev/null +++ b/app/assets/javascripts/admins/ec_templates/index.js @@ -0,0 +1,70 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-ec-templates-index-page').length > 0) { + var add_modal = $(".ec-templates-new-add"); + var template_file_name = add_modal.find(".template-file-upload"); + var attachment_id_input = add_modal.find(".template_attachment_id"); + var template_container = $(".ec-templates-list-container"); + + //编辑附件 + template_container.on("click", ".edit-template-content", function () { + var t_id = $(this).attr("data-id"); + var t_name = $(this).attr("data-name"); + var template_name = $(this).attr("data-template-name"); + var t_msg = $(this).attr("data-msg"); + var template_id = $(this).attr("data-template-id"); + add_modal.modal("show"); + add_modal.find(".template_add_title").html(t_msg); + attachment_id_input.val(template_id); + add_modal.find(".template_show_id").val(t_id); + add_modal.find("input[name='name']").val(t_name); + add_modal.find("i.delete-template-icon").attr("data-id", template_id); + if(template_id !== "-1"){ + template_file_name.find("span.template-file-input").hide(); + template_file_name.find("span.template_file_show").show(); + template_file_name.find("span.template_file_show_title").html(template_name); + } + }); + + + //删除附件 + add_modal.on("click",".delete-template-icon",function () { + var attachment_id = $(this).attr("data-id"); + $.ajax({ + url: "/api/attachments/" + attachment_id, + type: "delete", + contentType:"application/json", + dataType:"json", + success: function (data) { + template_file_name.find("span.template-file-input").show(); + template_file_name.find("span.template_file_show").hide(); + attachment_id_input.attr("value","-1") + } + }) + }); + + //上传附件 + add_modal.on("change", "#upload_template_file",function () { + + var template = document.getElementById('upload_template_file').files[0]; + + var file_content = new FormData(); + + file_content.append("file", template); + + $.ajax({ + type: "POST", + url: "/api/attachments", + data:file_content, + contentType: false, + processData: false, + success: function (data) { + template_file_name.find("span.template-file-input").hide(); + template_file_name.find("span.template_file_show").show(); + template_file_name.find("span.template_file_show_title").html(template.name); + template_file_name.find("i.delete-template-icon").attr("data-id",data.id); + attachment_id_input.val(data.id) + } + }) + }) + } +}); diff --git a/app/assets/javascripts/admins/graduation_standards/index.js b/app/assets/javascripts/admins/graduation_standards/index.js new file mode 100644 index 000000000..c5b1c2da5 --- /dev/null +++ b/app/assets/javascripts/admins/graduation_standards/index.js @@ -0,0 +1,13 @@ +$(document).on('turbolinks:load', function() { + if($(".admins-graduation-standards-index-page").length > 0){ + $(".admin-body-container").on("click", ".standard-create-modal", function () { + var content = $(this).attr("data-content"); + var g_id = $(this).attr("data-id"); + var g_msg = $(this).attr("data-msg"); + + $("#graduation-modal-type").html(g_msg); + $("#graduation_standard_id").val(g_id); + $("textarea[name='content']").val(content); + }) + } +}); \ No newline at end of file diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index c70f7a572..ac2e58216 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -50,6 +50,4 @@ input.form-control { right:20px; position: absolute; } -.position-r{position:relative;} -.color-grey-c{color:#ccc} -.inline-block{display:inline-block;} + diff --git a/app/assets/stylesheets/admins/ec_tempaltes.scss b/app/assets/stylesheets/admins/ec_tempaltes.scss new file mode 100644 index 000000000..ba824b9b2 --- /dev/null +++ b/app/assets/stylesheets/admins/ec_tempaltes.scss @@ -0,0 +1,22 @@ +.admins-ec-templates-index-page{ + .template-file-upload{ + padding: 10px; + background: #fafafa; + border: 1px dashed #ccc; + text-align: center; + color: #999; + position: relative; + width: 100%; + + } + input[name='file']{ + opacity: 0; + position: absolute; + display: inline-block; + left: 0; + height: 43px; + top: 0; + width:100%; + cursor: pointer; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 06b5c6643..bb40e7950 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -38,3 +38,12 @@ input.form-control { .width100 { width: 100%;} .mb10 { margin-bottom: 10px ;} .mt10 { margin-top: 10px ;} +.mr10{ margin-right: 10px; } +.textarea-width-100{width:100%; resize: none; border: 1px solid #ccc;} +.padding10{padding: 10px;} +.padding5-10{padding: 5px 10px;} +.position-r{position:relative;} +.color-grey-c{color:#ccc} +.inline-block{display:inline-block;} +.hide{display: none;} +.show{display: block;} diff --git a/app/controllers/admins/auth_schools_controller.rb b/app/controllers/admins/auth_schools_controller.rb index 3534188da..e7c0253b6 100644 --- a/app/controllers/admins/auth_schools_controller.rb +++ b/app/controllers/admins/auth_schools_controller.rb @@ -10,6 +10,7 @@ class Admins::AuthSchoolsController < Admins::BaseController ActiveRecord::Base.transaction do school = School.where(id: params[:id]).first school.destroy + render_success_js end end diff --git a/app/controllers/admins/ec_templates_controller.rb b/app/controllers/admins/ec_templates_controller.rb new file mode 100644 index 000000000..39216b014 --- /dev/null +++ b/app/controllers/admins/ec_templates_controller.rb @@ -0,0 +1,41 @@ +class Admins::EcTemplatesController < Admins::BaseController + + def index + @params_page = params[:page] || 1 + templates = EcTemplate.where(nil).includes(:attachments).order("updated_at desc") + @templates = paginate templates + end + + def create_template + ActiveRecord::Base.transaction do + if params[:template_id] == "-1" + ec_template = EcTemplate.new(name: params[:name]) + ec_template.save + else + ec_template = EcTemplate.find_by(id: params[:template_id]) + end + + if params[:attachment_id] != "-1" + attachment_id = params[:attachment_id] + attachment_tem = Attachment.find_by(id: attachment_id) + + unless attachment_tem.container_id.present? && attachment_tem.container_id == ec_template&.id + attachment_tem.update_attributes(container_id: ec_template&.id, container_type: "EcTemplate") + end + end + + @params_page = params[:page] || 1 + templates = EcTemplate.where(nil).includes(:attachments).order("updated_at desc") + @templates = paginate templates + end + end + + def destroy + ActiveRecord::Base.transaction do + template = EcTemplate.find_by(id: params[:id]) + template.destroy + render_success_js + end + end + +end diff --git a/app/controllers/admins/graduation_standards_controller.rb b/app/controllers/admins/graduation_standards_controller.rb new file mode 100644 index 000000000..7fbd8924f --- /dev/null +++ b/app/controllers/admins/graduation_standards_controller.rb @@ -0,0 +1,33 @@ +class Admins::GraduationStandardsController < Admins::BaseController + + def index + standards = EcGraduationStandard.all.order("updated_at desc") + @params_page = params[:page] || 1 + @standards = paginate standards + end + + def create_standard + ActiveRecord::Base.transaction do + if params[:graduation_id] == "-1" + content = params[:content] + EcGraduationStandard.create(:content => content) + else + graduation = EcGraduationStandard.find_by(id: params[:graduation_id]) + graduation.update_attribute(:content, params[:content]) + end + + standards = EcGraduationStandard.all.order("updated_at desc") + @params_page = params[:page] || 1 + @standards = paginate standards + end + end + + def destroy + ActiveRecord::Base.transaction do + @graduation = EcGraduationStandard.find_by(id: params[:id]) + @graduation.destroy + render_success_js + end + end + +end \ No newline at end of file diff --git a/app/models/ec_template.rb b/app/models/ec_template.rb new file mode 100644 index 000000000..36f5ae305 --- /dev/null +++ b/app/models/ec_template.rb @@ -0,0 +1,6 @@ +class EcTemplate < ActiveRecord::Base + # attr_accessible :title, :body + # acts_as_attachable + has_many :attachments, as: :container + +end diff --git a/app/views/admins/auth_schools/add_manager.js.erb b/app/views/admins/auth_schools/add_manager.js.erb index d0abab3ac..e5992f9b3 100644 --- a/app/views/admins/auth_schools/add_manager.js.erb +++ b/app/views/admins/auth_schools/add_manager.js.erb @@ -4,3 +4,5 @@ if($(".auth-schools-user-add").length > 0){ <% if @school_users.size > 0 %> $("#table-school-<%= @school_id %>").find(".school_user_list").html("<%= j render partial: "admins/auth_schools/shared/school_user_list", locals: {users: @school_users, school_id: @school_id} %> ") <% end %> + +show_success_flash() \ No newline at end of file diff --git a/app/views/admins/auth_schools/add_school.js.erb b/app/views/admins/auth_schools/add_school.js.erb index c4de6e795..1c7db0ace 100644 --- a/app/views/admins/auth_schools/add_school.js.erb +++ b/app/views/admins/auth_schools/add_school.js.erb @@ -1,2 +1,4 @@ $(".auth-schools-list-container").html("<%= j render partial: "admins/auth_schools/shared/list", locals: {schools: @schools} %>") $(".auth-schools-new-add").modal("hide") + +show_success_flash() \ No newline at end of file diff --git a/app/views/admins/auth_schools/remove_manager.js.erb b/app/views/admins/auth_schools/remove_manager.js.erb index c2ebddb89..b9a5761aa 100644 --- a/app/views/admins/auth_schools/remove_manager.js.erb +++ b/app/views/admins/auth_schools/remove_manager.js.erb @@ -1,2 +1,3 @@ -$("#table-school-<%= params[:school_id] %>").find("#manager-<%= params[:user_id] %>").remove() \ No newline at end of file +$("#table-school-<%= params[:school_id] %>").find("#manager-<%= params[:user_id] %>").remove() +show_success_flash() \ No newline at end of file diff --git a/app/views/admins/ec_templates/create_template.js.erb b/app/views/admins/ec_templates/create_template.js.erb new file mode 100644 index 000000000..fccd8cf20 --- /dev/null +++ b/app/views/admins/ec_templates/create_template.js.erb @@ -0,0 +1,3 @@ +$(".ec-templates-new-add").modal("hide") +$(".ec-templates-list-container").html("<%= j render partial: "admins/ec_templates/shared/list", locals: {templates: @templates} %>") +show_success_flash() \ No newline at end of file diff --git a/app/views/admins/ec_templates/index.html.erb b/app/views/admins/ec_templates/index.html.erb new file mode 100644 index 000000000..f4d4cce15 --- /dev/null +++ b/app/views/admins/ec_templates/index.html.erb @@ -0,0 +1,15 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('导入模板管理') %> +<% end %> + +
+ <%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.ec-templates-new-add' } %> +
+ + +
+ <%= render(partial: 'admins/ec_templates/shared/list', locals: { templates: @templates }) %> +
+ +<%= render partial: "admins/ec_templates/shared/templates_add_modal" %> +<%#= render partial: "admins/auth_schools/shared/user_add_modal" %> \ No newline at end of file diff --git a/app/views/admins/ec_templates/index.js.erb b/app/views/admins/ec_templates/index.js.erb new file mode 100644 index 000000000..1897fad3d --- /dev/null +++ b/app/views/admins/ec_templates/index.js.erb @@ -0,0 +1 @@ +$(".ec-templates-list-container").html("<%= j render partial: "admins/ec_templates/shared/list", locals: {templates: @templates} %>") \ No newline at end of file diff --git a/app/views/admins/ec_templates/shared/_list.html.erb b/app/views/admins/ec_templates/shared/_list.html.erb new file mode 100644 index 000000000..3c47896ae --- /dev/null +++ b/app/views/admins/ec_templates/shared/_list.html.erb @@ -0,0 +1,35 @@ + + + + + + + + + <% if templates.size > 0 %> + <% templates.each_with_index do |t, index| %> + <% attachment = t.attachments.first %> + + + + + + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
序号模板名称上传模板操作
<%= list_index_no(@params_page.to_i, index) %><%= t.name %> + <% if attachment.present? %> + <%= link_to "#{attachment.try(:filename)}",attachment_path(attachment), target: "_blank" %> + <% end %> + + <%= link_to "".html_safe, + "javascript:void(0)", data: {"id": "#{t.id}", "template-id": "#{attachment.present? ? attachment.id : "-1"}", + msg: "编辑", name: "#{t.name}", "template_name": "#{attachment.try(:filename)}"}, class: "edit-template-content" %> + + <%= link_to "".html_safe, admins_ec_template_path(t.id), method: :delete, data: {confirm: "确认删除吗?"}, remote: true, title: "删除" %> +
+ +<%= render partial: 'admins/shared/paginate', locals: { objects: templates } %> \ No newline at end of file diff --git a/app/views/admins/ec_templates/shared/_templates_add_modal.html.erb b/app/views/admins/ec_templates/shared/_templates_add_modal.html.erb new file mode 100644 index 000000000..c27767655 --- /dev/null +++ b/app/views/admins/ec_templates/shared/_templates_add_modal.html.erb @@ -0,0 +1,44 @@ + diff --git a/app/views/admins/graduation_standards/create_standard.js.erb b/app/views/admins/graduation_standards/create_standard.js.erb new file mode 100644 index 000000000..45ca1ee0c --- /dev/null +++ b/app/views/admins/graduation_standards/create_standard.js.erb @@ -0,0 +1,3 @@ +$(".graduation-standards-add").removeClass("show").modal("hide") +$(".graduation-standards-list-container").html("<%= j render partial: "admins/graduation_standards/shared/list", locals: { standards: @standards } %>") +show_success_flash() \ No newline at end of file diff --git a/app/views/admins/graduation_standards/index.html.erb b/app/views/admins/graduation_standards/index.html.erb new file mode 100644 index 000000000..8d0dee758 --- /dev/null +++ b/app/views/admins/graduation_standards/index.html.erb @@ -0,0 +1,14 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('毕业要求通用标准') %> +<% end %> + +
+ <%= javascript_void_link '新增', class: 'btn btn-primary standard-create-modal', data: { toggle: 'modal', target: '.graduation-standards-add', + id: "-1", content: "", msg: "添加" } %> +
+ +
+ <%= render(partial: 'admins/graduation_standards/shared/list', locals: { standards: @standards }) %> +
+ +<%= render partial: "admins/graduation_standards/shared/add_standard_modal" %> \ No newline at end of file diff --git a/app/views/admins/graduation_standards/index.js.erb b/app/views/admins/graduation_standards/index.js.erb new file mode 100644 index 000000000..1a83aaad3 --- /dev/null +++ b/app/views/admins/graduation_standards/index.js.erb @@ -0,0 +1 @@ +$(".graduation-standards-list-container").html("<%= j render partial: "admins/graduation_standards/shared/list", locals: { standards: @standards } %>") \ No newline at end of file diff --git a/app/views/admins/graduation_standards/shared/_add_standard_modal.html.erb b/app/views/admins/graduation_standards/shared/_add_standard_modal.html.erb new file mode 100644 index 000000000..9b339bf56 --- /dev/null +++ b/app/views/admins/graduation_standards/shared/_add_standard_modal.html.erb @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/app/views/admins/graduation_standards/shared/_list.html.erb b/app/views/admins/graduation_standards/shared/_list.html.erb new file mode 100644 index 000000000..55106c290 --- /dev/null +++ b/app/views/admins/graduation_standards/shared/_list.html.erb @@ -0,0 +1,27 @@ + + + + + + + + <% if standards.size > 0 %> + <% standards.each_with_index do |standard, index| %> + + + + + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
序号通用标准操作
<%= list_index_no(@params_page.to_i, index) %><%= standard.content %> + <%= javascript_void_link "".html_safe, class: 'standard-create-modal', + data: { toggle: 'modal', target: '.graduation-standards-add', id: "#{standard.id}", content: "#{standard.content}", msg: "编辑" }, title: "编辑" %> + + <%= link_to "".html_safe, admins_graduation_standard_path(standard), method: :delete, data: {confirm: "确认删除吗?"}, remote: true, title: "删除" %> +
+ +<%= render partial: 'admins/shared/paginate', locals: { objects: standards } %> \ No newline at end of file diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index 7164a673f..da65099ca 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -70,6 +70,8 @@ <%= sidebar_item_group('#major-identification-submenu', '工程认证', icon: 'anchor') do %>
  • <%= sidebar_item(admins_major_informations_path, '本科专业目录', icon: 'outdent', controller: 'admins-major_informations') %>
  • <%= sidebar_item(admins_auth_schools_path, '认证单位列表', icon: 'th', controller: 'admins-auth_schools') %>
  • +
  • <%= sidebar_item(admins_graduation_standards_path, '毕业要求通用标准', icon: 'file-word-o', controller: 'admins-graduation_standards') %>
  • +
  • <%= sidebar_item(admins_ec_templates_path, '导入模板管理', icon: 'file-excel-o', controller: 'admins-ec_templates') %>
  • <% end %> diff --git a/config/routes.rb b/config/routes.rb index b650939dc..e47c28fe6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -811,6 +811,16 @@ Rails.application.routes.draw do namespace :admins do get '/', to: 'dashboards#index' resources :major_informations, only: [:index] + resources :ec_templates, only: [:index, :destroy] do + collection do + post :create_template + end + end + resources :graduation_standards, only: [:index, :destroy] do + collection do + post :create_standard + end + end resources :auth_schools, only: [:index, :destroy] do collection do get :search_school