From 20883b92a5b1c194a122b2dda79449c8dd947773 Mon Sep 17 00:00:00 2001 From: yanxd Date: Mon, 14 Oct 2013 21:45:10 +0800 Subject: [PATCH] add button css, fix js bug, add create project to push homework. --- app/helpers/watchers_helper.rb | 10 +++--- app/views/bids/show_project.html.erb | 11 +++++- app/views/courses/_set_join.js.erb | 2 +- app/views/layouts/base.html.erb | 1 + app/views/projects/_project.html.erb | 1 + public/stylesheets/application.css | 50 ++++++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 7 deletions(-) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 38e91712..b21b2584 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -31,8 +31,8 @@ module WatchersHelper watched = objects.any? {|object| object.watched_by?(user)} @watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid))) - css = @watch_flag ? ([watcher_css(objects), watched ? 'icon' : 'icon'].join(' ')) : - ([watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ')) + css = @watch_flag ? ([watcher_css(objects), watched ? 'icon joinButton' : 'icon joinButton'].join(' ')) : + ([watcher_css(objects), watched ? 'icon icon-fav joinButton' : 'icon icon-fav-off joinButton'].join(' ')) text = @watch_flag ? (watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch)) @@ -46,7 +46,7 @@ module WatchersHelper link_to text, url, :remote => true, :method => method, :class => css end - # added by fq + # added by fq, modify nyan def join_in_course(course, user) return '' unless user && user.logged? joined = user.member_of?(course) @@ -55,9 +55,9 @@ module WatchersHelper url_f = try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined - link_to text, url_t, :remote => true, :method => method, :id => 'join', :confirm => l(:text_are_you_sure) + link_to text, url_t, :remote => true, :method => method, :id => 'join', :confirm => l(:text_are_you_sure), :class => 'joinButton' else - link_to text, url_f, :remote => true, :method => method, :id => 'join' + link_to text, url_f, :remote => true, :method => method, :id => 'join', :class => 'joinButton' end end diff --git a/app/views/bids/show_project.html.erb b/app/views/bids/show_project.html.erb index 20e03d70..5e002501 100644 --- a/app/views/bids/show_project.html.erb +++ b/app/views/bids/show_project.html.erb @@ -68,9 +68,18 @@ <%= form_for "bid_for_save", :remote=>true, :url => {:controller => 'bids', :action => 'add'}, :update => "bidding_project_list", :complete => '$("#put-bid-form").hide();' do |f| %> - +
+
+
+ <% if @bid.reward_type == 3 %> diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index 50bb692d..05120a41 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -1,4 +1,4 @@ -$('#join').html('<%= escape_javascript join_in_course(course, user) %>'); +$('#join').replaceWith('<%= escape_javascript join_in_course(course, user) %>'); <% if @state %> <% if @state == 0 %> alert("加入成功") diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 411cb9f9..721665d8 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -33,6 +33,7 @@ <%= call_hook :view_layouts_base_content %>
<%=render :partial => 'layouts/base_footer'%> + <%= debug(params) if Rails.env.development? %> diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index 405d945e..ae0a397f 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -87,6 +87,7 @@ <% unless User.current.member_of?(@project) %> + <%= watcher_link(@project, User.current) %> <% end %> diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index bf8d3988..dc39a90e 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2172,3 +2172,53 @@ h2 img { vertical-align:middle; } text-decoration: none; cursor: pointer; } +/*add by nyan*/ +.joinButton { + + -moz-box-shadow:inset 0px 1px 0px 0px #ffffff; + -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff; + box-shadow:inset 0px 1px 0px 0px #ffffff; + + background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffffff), color-stop(1, #f6f6f6)); + background:-moz-linear-gradient(top, #ffffff 5%, #f6f6f6 100%); + background:-webkit-linear-gradient(top, #ffffff 5%, #f6f6f6 100%); + background:-o-linear-gradient(top, #ffffff 5%, #f6f6f6 100%); + background:-ms-linear-gradient(top, #ffffff 5%, #f6f6f6 100%); + background:linear-gradient(to bottom, #ffffff 5%, #f6f6f6 100%); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f6f6f6',GradientType=0); + + background-color:#ffffff; + + -moz-border-radius:6px; + -webkit-border-radius:6px; + border-radius:6px; + + border:1px solid #dcdcdc; + + display:inline-block; + color:#666666; + font-family:arial; + font-size:15px; + font-weight:bold; + padding:6px 24px; + text-decoration:none; + + text-shadow:0px 1px 0px #ffffff; + +} +.joinButton:hover { + + background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f6f6f6), color-stop(1, #ffffff)); + background:-moz-linear-gradient(top, #f6f6f6 5%, #ffffff 100%); + background:-webkit-linear-gradient(top, #f6f6f6 5%, #ffffff 100%); + background:-o-linear-gradient(top, #f6f6f6 5%, #ffffff 100%); + background:-ms-linear-gradient(top, #f6f6f6 5%, #ffffff 100%); + background:linear-gradient(to bottom, #f6f6f6 5%, #ffffff 100%); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f6f6f6', endColorstr='#ffffff',GradientType=0); + + background-color:#f6f6f6; +} +.joinButton:active { + position:relative; + top:1px; +}
<%= select_tag 'bid', options_for_select(@option), :name => 'bid', :class => 'grayline' %> +

+

+ <%= link_to '创建项目', new_project_path, :target=>'_blank'%>,以提交作业。 +
+

+