“个人主页列表"变细体、编辑时也可设为主页
This commit is contained in:
parent
6109a1602b
commit
bebff7b24a
|
@ -46,6 +46,13 @@ class ArticleHomepagesController < ApplicationController
|
|||
if User.current.logged?
|
||||
@article.title = params[:article_homepage][:title]
|
||||
@article.content = params[:article_homepage][:content]
|
||||
if params[:set_homepage]
|
||||
User.current.homepage.update_attribute(:article_id, @article.id)
|
||||
else
|
||||
if User.current.homepage.article_id == @article.id
|
||||
User.current.homepage.update_attribute(:article_id, nil)
|
||||
end
|
||||
end
|
||||
if @article.save
|
||||
redirect_to user_homepages_path(:user_id => User.current.id)
|
||||
end
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
<p id="e_tip" class="c_grey"></p>
|
||||
<p id="e_tips" class="c_grey"></p>
|
||||
</div>
|
||||
<% unless is_edit %>
|
||||
<div class="mt10">
|
||||
<input type="checkbox" value="1" id="set_homepage" name="set_homepage"/>
|
||||
<label for="set_homepage">设为主页</label>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_article();">确定</a>
|
||||
|
@ -47,4 +45,9 @@
|
|||
function reset_article(){
|
||||
window.location.href = "<%=user_homepages_path(:user_id => User.current.id) %>";
|
||||
}
|
||||
$(function() {
|
||||
<% if is_edit && @article.homepage.article_id == @article.id %>
|
||||
$("#set_homepage").attr('checked',true);
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
|
@ -1,7 +1,7 @@
|
|||
<div class="cl"> </div>
|
||||
<div id="blog-list">
|
||||
<div class="listbox mt10">
|
||||
<h2 class="list-h2 fl">个人主页列表</h2>
|
||||
<div class="list-h2 fl" style="font-weight: normal">个人主页列表</div>
|
||||
<div class="fr">
|
||||
<%=link_to '新 建', new_article_homepage_path(), :target => "_blank", :class => 'BlueCirBtn' %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue