解决样式冲突

添加新闻展示页面
This commit is contained in:
huang 2015-04-11 14:49:26 +08:00
parent e3d815b51d
commit 4adfec5640
2 changed files with 124 additions and 70 deletions

View File

@ -1,69 +1,129 @@
<%
btn_tips = l(:label_news_new)
label_tips = l(:label_news)
%>
<div class="project_r_h">
<h2 class="project_h2"><%= label_tips %></h2>
<h2 class="project_h2"><%= l(:label_news) %></h2>
</div>
<div class="talk_top">
<p class="fl"><%= l(:label_total_news) %><span><%= @news_count %></span><%= l(:label_project_new_list) %></p>
<% if @project && User.current.allowed_to?(:manage_news, @project) %>
<%= link_to(btn_tips, new_project_news_path(@project),
:class => 'problem_new_btn fl c_dorange') %>
<div class="cl"></div>
<script type="text/javascript">
function regexTitle()
{
var name = $("#news_title").val();
if(name.length ==0)
{
$("#title_notice_span").text("标题不能为空");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
else if(name.length <= 60)
{
$("#title_notice_span").text("填写正确");
$("#title_notice_span").css('color','#008000');
return true;
}
else
{
$("#title_notice_span").text("标题超过60个字符");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
}
<% end %>
<div class="cl"></div>
</div>
function submitComment()
{
$("#add_comment_form").submit();
}
<div>
<% if @newss.empty? %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% else %>
<% @newss.each do |news| %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl"> <%= l(:label_release_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
<div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="news_description mt5"><%= news.description %><br /> <%= l(:label_create_time) %> <%= format_time(news.created_on) %></p>
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
</div>
<div class="cl"></div>
</div><!--problem_main end-->
function regexDescription()
{
var name = $("#news_description").val();
if(name.length ==0)
{
$("#description_notice_span").text("描述不能为空");
$("#description_notice_span").css('color','#ff0000');
$("#description_notice_span").focus();
return false;
}
else
{
$("#description_notice_span").text("填写正确");
$("#description_notice_span").css('color','#008000');
return true;
}
}
function submitNews()
{
if(regexTitle() && regexDescription())
{
$("#news-form").submit();
}
}
</script>
<% if authorize_for('news', 'edit') %>
<div id="edit-news" style="display:none;">
<%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'project_form', :locals => { :f => f, :is_new => false } %>
<% end %>
<% end %>
</div>
<!--end-->
<ul class="wlist">
<%= pagination_links_full @news_pages, @news_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<h4 class="r_txt_tit mb5"> <%=h @news.title %></h4>
<%#= watcher_link(@news, User.current) %>
<%= link_to(l(:button_edit),
edit_news_path(@news),
:class => 'talk_edit fr',
:accesskey => accesskey(:edit),
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %>
<%= delete_link news_path(@news),:class => 'talk_edit fr' if User.current.allowed_to?(:manage_news, @project) %>
<div class="cl"></div>
<div class="mb5"><%= textAreailizable(@news, :description) %><br /> <%= l(:label_create_time) %> <%= format_time(@news.created_on) %></div>
<%= link_to_attachments_course @news %>
<!--<a href="#" class=" link_file">附件爱覅俄方if.zip(27.5kB)</a> -->
</div>
<div class="cl"></div>
</div>
<!--add comment-->
<% if @news.commentable? %>
<div class="msg_box">
<%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %>
</p>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
<div class="box">
<%= text_area 'comment', 'comments', :rows => 5, :style => "width:98%" %>
</div>
<a onclick="submitComment();" class="blue_btn fr" href="javascript:void(0)" ><%= l(:label_comment_add) %></a>
<% end %>
<% end %>
</div>
<% comments = @comments.reverse %>
<% comments.each do |comment| %>
<% next if comment.new_record? %>
<div class="ping_C mb10">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author), :class => "ping_dispic" %></div>
<div class="ping_discon">
<div class="ping_distop">
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><span class="c_grey fr"><%= format_time(comment.created_on) %></span>
<div class="cl"></div>
<p><%= textAreailizable(comment.comments) %></p>
</div>
<div class="ping_disfoot"><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:button_delete) %>
</div>
</div>
<div class="cl"></div>
</div>
<% end if @comments.any? %>
</div>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title(l(:label_news_plural)) -%>
<script type='text/javascript'>
$(document).ready(function ($) {
$('.content-text-list').each(function () {
$(this).find('.delete_icon').hide();
$(this).mouseenter(function (event) {
$(this).find('.delete_icon').show();
});
$(this).mouseleave(function (event) {
$(this).find('.delete_icon').hide();
});
});
});
</script>
<% html_title @news.title -%>

View File

@ -106,12 +106,6 @@ a.talk_edit{ color:#426e9a; margin-right:5px;}
a:hover.talk_edit{ color:#ff5722;}
.talk_reply { background:#eeeeee; padding:10px; margin-bottom:10px;}
.talkpage_text{ border:1px solid #64bdd9; width:600px; color:#7d7d7d; padding:5px; margin:10px 0 10px 50px; background:#fff;}
.ping_dispic a{ display:block; height:46px; width:46px; border:1px solid #CCC; padding:1px; float:left;}
.ping_dispic a:hover{border:1px solid #15bccf;}
.ping_discon{ float:left; width:610px; margin-left:10px; }
.ping_distop p{ color:#5f5f5f;}
.ping_disfoot a{ float:right; color: #6883b6; margin-left:5px; margin-bottom:5px;}
.ping_distop span a{ float:right; width:20px; height:20px; background:url(images/star.png) -24px 0 no-repeat; margin-right:3px;}
.recall{ border-top:1px solid #CCC; padding:5px 0;}
.recall_head{ float:left;}
.recall_head a{ display:block; width:30px; height:30px; border:1px solid #CCC; padding:1px;}
@ -333,11 +327,7 @@ a:hover.st_add{ color:#ff8e15;}
.newpro_box input{ height:26px; float:left; margin-bottom:10px;}
.newpro_box textarea{ height:150px; float:left; margin-bottom:10px;}
.newpro_box select{ height:26px; float:left; margin-bottom:10px;}
.label{ width:80px; text-align:right; font-size:14px; display:block; float:left;}
.label02{ width:110px; text-align:right; font-size:14px; display:block; float:left;}
.collapsible{ border-left:none;border-right:none;border-bottom:none; border-top:1px solid #e4e4e4; padding-top:10px; }
/*问题查询*/
.icon-checked { background-image: url(../images/true.png); }
.label{ width:80px; text-align:right; font-size:14 background-image: url(../images/true.png); }
.icon-reload { background-image: url(../images/reload.png); }
.icon {
background-position: 0% 50%;
@ -407,4 +397,8 @@ a:hover.member_btn{ background:#329cbd;}
.pro_st_edit_ban ul li{ margin-bottom:10px;}
.pro_st_edit_ku{display:none; margin-top:20px;}
.pro_st_edit_ku ul li{margin-bottom:10px;}
/*end*/
/*end*/
/*用户反馈*/
.msg_box{ width:670px; height:173px; border-bottom:1px dashed #CCC; padding-top:10px;}
.msg_box h4{ }
.msg_box textarea{width:658px;height:90px;padding:5px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 0px; color:#666; font-size:12px; }