From c5a3a5bac3073294d734afcd9a817084ccb9fda9 Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 21 May 2014 18:21:57 +0800 Subject: [PATCH] user_courses.html --- app/controllers/users_controller.rb | 8 -- .../users/_course_list_have_entity.html.erb | 40 ++++++ app/views/users/_my_course.html.erb | 50 ++----- public/stylesheets/application.css | 1 - public/stylesheets/nyan.css | 133 +++++++++++++++--- 5 files changed, 169 insertions(+), 63 deletions(-) create mode 100644 app/views/users/_course_list_have_entity.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7365e4048..6174e2124 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -209,8 +209,6 @@ class UsersController < ApplicationController ## 判断课程是否过期 [需封装] @memberships_doing = [] @memberships_done = [] - @OwningCouses =[] - @JoinCouses=[] now_time = Time.now.year @memberships.map { |e| end_time = e.project.course_extra.get_time.year @@ -220,12 +218,6 @@ class UsersController < ApplicationController else @memberships_doing.push e end - - if e.project.course_extra.tea_id == User.current.id - @OwningCouses.push e - else - @JoinCouses.push e - end } # respond_to do |format| # format.html diff --git a/app/views/users/_course_list_have_entity.html.erb b/app/views/users/_course_list_have_entity.html.erb new file mode 100644 index 000000000..6b5725a1f --- /dev/null +++ b/app/views/users/_course_list_have_entity.html.erb @@ -0,0 +1,40 @@ +
+ + +
+
+ <%= render :partial => 'course_form', :locals => {:memberships => @memberships_doing} %> +
+
+ + +
+ + \ No newline at end of file diff --git a/app/views/users/_my_course.html.erb b/app/views/users/_my_course.html.erb index 8feb0ecca..26cfd48e0 100644 --- a/app/views/users/_my_course.html.erb +++ b/app/views/users/_my_course.html.erb @@ -1,38 +1,16 @@
-<% if @memberships.empty? %> - <% if @user != User.current %> -

- <%= l(:label_project_course_un) %> -

- <% else %> -

- - <%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' %> -

- <% end %> -<% else %> -

- <%=l(:label_course_doing)%>(<%=@memberships_doing.count%>) - <%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' if @user == User.current %> -

-

- <%= l(:label_created_course) %> -

<%= render :partial => 'course_form', :locals => {:memberships => @OwningCouses}%> -

-
-

<%= l(:label_joined_course) %> -

<%= render :partial => 'course_form', :locals => {:memberships => @JoinCouses}%> -

- -
- -

- <%= link_to l(:label_course_done)+"("+@memberships_done.count.to_s+")", 'javascript:void(0);', :onclick => '$("#courses_history_block").slideToggle(400);' , style:"color:#666666" if User.current.logged? %> -

- - - -<% end %> + <% if @memberships.empty? %> + <% if @user != User.current %> +

+ <%= l(:label_project_course_un) %> +

+ <% else %> +

+ + <%= l(:label_project_course_unadd) %><%= link_to "#{l(:label_course_new)}", {:controller => 'projects', :action => 'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' %> +

+ <% end %> + <% else %> + <%= render partial: 'course_list_have_entity' %> + <% end %>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 8e0a81cf6..977aef8fe 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -493,7 +493,6 @@ a.bids_user { } .line{ - width: 905px; height: 1px; margin: 0px; background-color: #cacaca; diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 0135b1e46..42d196734 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -1,14 +1,17 @@ /* TODO: base/common/page 准备封装一些基本样式组合调用 参考YUI *******************************************************************************/ -span[id^=valid_user]{ - padding-left: 10px; +span[id^=valid_user] { + padding-left: 10px; } -.red{ - color: red; + +.red { + color: red; } -.green{ - color: green; + +.green { + color: green; } + .border_box { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; @@ -1007,7 +1010,7 @@ div.issue { } #ver-zebra1 td { - padding: 8px ; + padding: 8px; border-right: 1px solid #fff; border-left: 1px solid #fff; color: #669; @@ -1133,11 +1136,13 @@ div.pagination { -o-transition: 1s width; transition: 1s width; } -.all_browse_div table .description{ - border-bottom: 1px solid #efffff; + +.all_browse_div table .description { + border-bottom: 1px solid #efffff; } -.all_browse_div table td{ - vertical-align: middle; + +.all_browse_div table td { + vertical-align: middle; } /* softapplication show @@ -1146,6 +1151,7 @@ div.pagination { margin: 0; padding: 0; } + .softapplication-img { margin: 5px auto; width: 860px; @@ -1154,25 +1160,29 @@ div.pagination { box-shadow: 5px 5px 20px 5px #ccc; border-radius: 5px; } + .soft-application { width: 326px; height: 580px; } -.softapplication-img .title{ + +.softapplication-img .title { width: 326px; position: absolute; left: 0; bottom: 0; } -.softapplication-img .title a{ + +.softapplication-img .title a { display: block; text-decoration: none; color: #fff; font-size: 20px; padding: 20px; - background: rgba(0,0,0,0.5); + background: rgba(0, 0, 0, 0.5); } -.softapplication-img li{ + +.softapplication-img li { list-style-type: none; position: relative; float: left; @@ -1182,11 +1192,98 @@ div.pagination { -ms-transition: all 0.5s; -o-transition: all 0.5s; transition: all 0.5s; - box-shadow: -1px 0 3px 1px rgba(0,0,0,0.3); + box-shadow: -1px 0 3px 1px rgba(0, 0, 0, 0.3); } -.softapplication-img ul:hover li{ + +.softapplication-img ul:hover li { width: 160px; } -.softapplication-img ul li:hover{ + +.softapplication-img ul li:hover { width: 326px; } + +/* user_courses +*******************************************************************************/ +.user_course_list { + margin: 0; + padding: 0; + position: relative; + margin-top: -15px; +} + +.user_course_list .menu{ + display: block; + background-color: #f9f9f9; + border-radius: 2px 2px 0 0; + position: relative; + height: 40px; + line-height: 40px; + border-bottom: 1px solid #ddd; + text-align: left; + margin-left: -10px; + padding-left: 15px; +} + +.user_course_list .menu:after { + content: "."; + visibility: hidden; + display: block; + height: 0; + clear: both; +} + +.user_course_list .menu ul { + margin: 0; + padding: 0; + float: right; + margin-right: 30px; +} +.user_course_list .menu ul { +} + +.user_course_list .menu li { + display: inline-block; + position: relative; + width: 40px; + height: 40px; + line-height: 40px; + cursor: pointer; +} + +.user_course_list .menu li:hover { + color: #00a1d6; +} + +.user_course_list .menu li.on { + color: #00a1d6; + font-weight: bold; +} + + +.user_course_list .list_top { + margin: 20px auto 0px; +} + +.user_course_list .created_course { + position: relative; + display: block; + padding-top: 20px; +} + +.user_course_list .created_course:after { + content: "."; + visibility: hidden; + display: block; + height: 0; + clear: both; +} + +.user_course_list .created_course .field { + position: absolute; + display: inline-block; + color: rgb(213, 213, 213); + top: 0; + right: 5%; +} +