还原冲突,增加项目配置切换js

This commit is contained in:
sw 2015-04-11 14:19:52 +08:00
parent 633a53d1d4
commit 837fe88545
2 changed files with 65 additions and 147 deletions

View File

@ -1,157 +1,69 @@
<%
btn_tips = l(:label_news_new)
label_tips = l(:label_news)
%>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_news) %></h2>
<h2 class="project_h2"><%= label_tips %></h2>
</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;
}
}
<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>
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>
<div class="contextual">
<%= watcher_link(@news, User.current) %>
<%= link_to(l(:button_edit),
edit_news_path(@news),
:class => 'icon icon-edit',
:accesskey => accesskey(:edit),
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %>
<%= delete_link news_path(@news) if User.current.allowed_to?(:manage_news, @project) %>
<% end %>
<div class="cl"></div>
</div>
<h3><strong><%=h @news.title %></strong></h3>
<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-->
<% 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 => 'form', :locals => { :f => f } %>
<%#= submit_tag l(:button_save) %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'ButtonColor m3p10' %>
<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'ButtonColor m3p10'%>
<% end %>
<div id="preview" class="wiki"></div>
</div>
<% 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} %>
<% end %>
<div id="comments" style="margin-bottom:16px;">
<% 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 %>
<div style="margin:15px">
<span class="font_description">
<%= textilizable(@news, :description) %>
</span>
<br/>
<%= link_to_attachments @news %>
<br/>
<!--add comment-->
<% if @news.commentable? %>
<p>
<%= 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", :style => "display:none;") do %>
<div class="box">
<%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= wikitoolbar_for 'comment_comments' %>
</div>
<p>
<%= submit_tag l(:button_add) %>
</p>
<% end %>
<% end %>
<% html_title(l(:label_news_plural)) -%>
<% html_title @news.title -%>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<!--dispaly comments-->
<div class="line_heng"></div>
</div>
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
<% comments = @comments.reverse %>
<% comments.each do |comment| %>
<% next if comment.new_record? %>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" >
<%= image_tag(url_to_avatar(comment.author), :class => "avatar")%>
</td>
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top">
<strong><%= link_to_user(comment.author) if comment.respond_to?(:author) %> </strong>
<span class="font_lighter"><%= l(:label_project_newadd) %></span>
<%= l(:label_comment_plural) %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" >
<span class="font_description">
<%= textilizable(comment.comments) %>
</span>
</td>
</tr>
<tr>
<td align="left">
<span class="font_lighter"> <%= format_time(comment.created_on) %></span>
</td>
<td width="200" align="right" class="a">
<%= 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) %>
</td>
</tr>
</table></td>
</tr>
</table>
<% end if @comments.any? %>
</div>
<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>

View File

@ -159,4 +159,10 @@ function close_window(type){
$("#" + type).attr("checked","checked");
}
//弹框l
//弹框l
/////////////////////////////////////////////
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=8;i++){g('pro_st_tb_'+i).className='pro_st_normaltab';g('pro_st_tbc_0'+i).className='pro_st_undis';}g('pro_st_tbc_0'+n).className='pro_st_dis';g('pro_st_tb_'+n).className='pro_st_hovertab';
}