add button css, fix js bug, add create project to push homework.

This commit is contained in:
yanxd 2013-10-14 21:45:10 +08:00
parent 0238001721
commit 20883b92a5
6 changed files with 68 additions and 7 deletions

View File

@ -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

View File

@ -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| %>
<table id="bidding_table" border="0" width="400" style="margin-left: 40px;">
<table id="bidding_table" border="0" width="100%" style="margin-left: 40px;">
<tr>
<td><%= select_tag 'bid', options_for_select(@option), :name => 'bid', :class => 'grayline' %></td>
<div id="prompt_create_pro"><!-- nyan -->
<td>
<p>
<div class="font_lighter" style="font-size: 13px;">
<%= link_to '创建项目', new_project_path, :target=>'_blank'%>,以提交作业。
</div>
</p>
</td>
</div>
</tr>
<% if @bid.reward_type == 3 %>
<tr>

View File

@ -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("加入成功")

View File

@ -33,6 +33,7 @@
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%=render :partial => 'layouts/base_footer'%>
<%= debug(params) if Rails.env.development? %>
</div>
</div>

View File

@ -87,6 +87,7 @@
</div>
<!-- added by liuping -->
<% unless User.current.member_of?(@project) %>
<!-- del by nyan -->
<%= watcher_link(@project, User.current) %>
<% end %>
<span style="float: right; margin-right: 100px">

View File

@ -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;
}