From 3fad5abb5cb8ebaadab354f9d3138f6c49d5789f Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 8 Apr 2014 16:56:53 +0800 Subject: [PATCH] modal init --- app/views/bids/_bid_homework_show.html.erb | 2 +- app/views/layouts/base_courses.html.erb | 1 + app/views/projects/homework.html.erb | 42 +++++++++ public/images/showmodal/good.png | Bin 0 -> 188 bytes public/images/showmodal/hd-bg.png | Bin 0 -> 1484 bytes public/images/showmodal/modal_close.png | Bin 0 -> 425 bytes public/javascripts/jquery.leanModal.min.js | 5 + public/stylesheets/nyan.css | 104 +++++++++++++++++++++ 8 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 public/images/showmodal/good.png create mode 100644 public/images/showmodal/hd-bg.png create mode 100644 public/images/showmodal/modal_close.png create mode 100644 public/javascripts/jquery.leanModal.min.js diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 69f65e488..b0f62bc96 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -4,7 +4,6 @@ 暂无作业! <% else %> <% bids.each do |bid|%> -
<%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %> @@ -15,6 +14,7 @@ <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %> <%# 提交作业按钮,上传文件的作业直接显示上传框,关联项目的作业跳转到新页面 %> + <%= link_to "模态窗口", '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id});" if Rails.env.development? %> <%= link_to l(:label_commit_homework), 'javascript:void(0);', onclick: "$('#bid-submit-homework-#{bid.id}').toggle();" if bid.homework_type==Bid::HomeworkFile %> <%= link_to(l(:label_commit_homework), respond_path(bid), :class => 'bid_path', target: "_blank") if bid.homework_type==Bid::HomeworkProject %> <% if (User.current.admin?||User.current.id==bid.author_id) %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 91c58a0c6..c9f6e8525 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -11,6 +11,7 @@ <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> + <%= javascript_include_tag "jquery.leanModal.min" %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/projects/homework.html.erb b/app/views/projects/homework.html.erb index 17c8b9efa..de608dbd4 100644 --- a/app/views/projects/homework.html.erb +++ b/app/views/projects/homework.html.erb @@ -9,4 +9,46 @@ <%= render :partial => 'bids/bid_homework_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %> + 打开窗口 +
+
+
+

上传作业

+

+ It's simple, and free.

+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+ diff --git a/public/images/showmodal/good.png b/public/images/showmodal/good.png new file mode 100644 index 0000000000000000000000000000000000000000..9bf7ca7a948530270d4202cc5d6db55d54abb1a5 GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^JV4CF!3-p~fAT*8q*&4&eH|GXuHCreA7KRKOP07s zlmzFem6RtIr7}3CgTe~DWM4fT#Yw` literal 0 HcmV?d00001 diff --git a/public/images/showmodal/hd-bg.png b/public/images/showmodal/hd-bg.png new file mode 100644 index 0000000000000000000000000000000000000000..cfaa67a6bcbf1a233f0d4964c592396736017b84 GIT binary patch literal 1484 zcmV;-1vC1IP)@00004XF*Lt007q5 z)K6G40000PbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUy5>QN3Mcv)q z+S=OO+}zmM*xTFN+1c5(9wg`h00lrvL_t(|+N_v~a$7kJ1VMoO|6kterczr@oYg>*H)jH>_$>Oea>U7na99yjH>^u=rJ)LcA zFIG?OQZA1wDzg13sB<7IrNSKTJvDh>`EX{}EYzHi4c&QCduMN!rdJgzdwF_LH~YlE zis+5ty*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(function(e){var modal_id=$(this).attr("href");$("#lean_overlay").click(function(){close_modal(modal_id)});$(o.closeButton).click(function(){close_modal(modal_id)});var modal_height=$(modal_id).outerHeight();var modal_width=$(modal_id).outerWidth(); +$("#lean_overlay").css({"display":"block",opacity:0});$("#lean_overlay").fadeTo(200,o.overlay);$(modal_id).css({"display":"block","position":"fixed","opacity":0,"z-index":11000,"left":50+"%","margin-left":-(modal_width/2)+"px","top":o.top+"px"});$(modal_id).fadeTo(200,1);e.preventDefault()})});function close_modal(modal_id){$("#lean_overlay").fadeOut(200);$(modal_id).css({"display":"none"})}}})})(jQuery); diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 7c1110c36..ec25a5238 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -66,6 +66,110 @@ font-family: Helvetica, Tahoma, Arial, "Microsoft YaHei", "微软雅黑", SimSun, "宋体", STXihei, "华文细黑", Heiti, "黑体", sans-serif; } +/* 模态窗口 +*******************************************************************************/ + +#lean_overlay{ + position: fixed; + z-index: 100; + top: 0; + left: 0; + height: 100%; + width: 100%; + background: #000; + display: none; +} +#OpenWindow{ + background: none repeat scroll 0 0 #ffffff; + border-radius: 5px; + box-shadow: 0 0 4px rgba(0,0,0,0.7); + display: none; + padding-bottom: 2px; + width: 404px; + z-index: 11000; + left: 50%; + margin-left: -202px; + opacity: 1; + position: fixed; + top: 200px; +} +#OpenWindow { + background: none repeat scroll 0 0 #FFFFFF; + border-radius: 5px 5px 5px 5px; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.7); + display: none; + padding-bottom: 2px; + width: 404px; + z-index: 11000; + left: 50%; + margin-left: -202px; + opacity: 1; + position: fixed; + top: 200px; +} +#OpenWindow-header { + background: url("/images/showmodal/hd-bg.png") repeat scroll 0 0 transparent; + border-bottom: 1px solid #CCCCCC; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + padding: 18px 18px 14px; +} +.modal_close { + background: url("/images/showmodal/modal_close.png") repeat scroll 0 0 transparent; + display: block; + height: 14px; + position: absolute; + right: 12px; + top: 12px; + width: 14px; + z-index: 2; +} +body { + /*font-size: 13px;*/ +} +#OpenWindow .txt-fld { + border-bottom: 1px solid #EEEEEE; + padding: 14px 20px; + position: relative; + text-align: right; + width: 364px; +} +#OpenWindow .txt-fld input { + background: none repeat scroll 0 0 #F7F7F7; + border-color: #CCCCCC #E7E6E6 #E7E6E6 #CCCCCC; + border-radius: 4px 4px 4px 4px; + border-style: solid; + border-width: 1px; + color: #222222; + font-family: "Helvetica Neue"; + font-size: 1.2em; + outline: medium none; + padding: 8px; + width: 244px; +} +#OpenWindow .txt-fld input.good_input { + background: url("/images/showmodal/good.png") no-repeat scroll 236px center #DEF5E1; +} +#OpenWindow .btn-fld { + overflow: hidden; + padding: 12px 20px 12px 130px; + width: 254px; +} +button { + background: none repeat scroll 0 0 #3F9D4A; + border: medium none; + border-radius: 4px 4px 4px 4px; + color: #FFFFFF; + float: right; + font-family: Verdana; + font-size: 13px; + font-weight: bold; + overflow: visible; + padding: 7px 10px; + text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); + width: auto; +} + /* 按钮 *******************************************************************************/