Merge branch 'dev_tieba' of https://git.trustie.net/jacknudt/trustieforge into dev_tieba

This commit is contained in:
huang 2016-12-30 13:55:10 +08:00
commit 48645e1d43
7 changed files with 124 additions and 11 deletions

View File

@ -1,8 +1,10 @@
<% forum.reload.tag_list.each do |tag|%>
<span class="postlabel mr10">
<a title="双击可编辑" ondblclick="rename_tag($(this),'<%= tag %>',<%= forum.id%>,5);" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
<%if forum.creator.id == User.current.id%>
<a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a>
<% if forum.creator.id == User.current.id %>
<a title="双击可编辑" ondblclick="rename_tag($(this),'<%= tag %>', <%= forum.id %>, 5);" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
<a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a>
<% else %>
<a href="javacript:void(0)" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
<% end %>
</span>
<% end %>

View File

@ -5,16 +5,16 @@
$(function(){
showNormalImage('postDetailDes_<%= topic.id %>');
autoUrl('postDetailDes_<%= topic.id %>');
if($("#intro_content_<%= topic.id %>").height() > 810) {
if($("#intro_content_<%= topic.id %>").height() > 300) {
$("#intro_content_show_<%= topic.id %>").show();
}
$("#intro_content_show_<%= topic.id %>").click(function(){
$("#postDetailDes_<%= topic.id %>").toggleClass("maxh360");
$("#postDetailDes_<%= topic.id %>").toggleClass("maxh300");
$("#intro_content_show_<%= topic.id %>").hide();
$("#intro_content_hide_<%= topic.id %>").show();
});
$("#intro_content_hide_<%= topic.id %>").click(function(){
$("#postDetailDes_<%= topic.id %>").toggleClass("maxh360");
$("#postDetailDes_<%= topic.id %>").toggleClass("maxh300");
$("#intro_content_hide_<%= topic.id %>").hide();
$("#intro_content_show_<%= topic.id %>").show();
});
@ -36,7 +36,7 @@
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
</div>
<div class="postDetailDes maxh360" id = "postDetailDes_<%= topic.id %>">
<div class="postDetailDes maxh300" id = "postDetailDes_<%= topic.id %>">
<div id="intro_content_<%= topic.id %>">
<%= topic.content.html_safe%>
</div>

View File

@ -1,5 +1,5 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'forums/new') %>";
pop_box_new(htmlvalue,460,190);
pop_box_new(htmlvalue,560,390);

View File

@ -23,7 +23,7 @@
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr30">
<%= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10", :target => "_blank" %>
<%= link_to "贴吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
</li>
<% end %>
<% else %>

View File

@ -41,6 +41,9 @@
</div>
<script>
$(document).ready(function(){
$("#forums_question_"+<%= params[:forum_id] %>).addClass("wenba-tiwen-tag-active");
});
function add_forum(id){
$("#memo_classify_tips").attr('style','color: #333;');
$('a').removeClass("wenba-tiwen-tag-active");

View File

@ -43,3 +43,110 @@
</div>
<% end %>
</div>
<script>
var desc;
function edit_desc(){
if(<%= @forum.creator.id == User.current.id %>) {
desc = $("#forum_desc_span").html();
$("#forum_desc_span").html("<textarea id='forum_desc_input' onblur='change_forum_desc();' style='width: 200px;height: 80px; max-width: 207px; max-height: 80px; border: 1px solid #d9d9d9;outline: none;margin: 0px 0px 12px 0px;'>" + desc + "</textarea>");
$("#forum_desc_input").focus();
}
}
function change_forum_desc(){
$.ajax({
url: '<%= forums_path + '/'+@forum.id.to_s+".js" %>',
type: 'PUT',
dataType: 'json',
data:{"forum[description]":$("#forum_desc_input").val().trim()},
success:function(data){
if(data == true){
$("#forum_desc_span").html($("#forum_desc_input").val().trim());
}else{
$("#forum_desc_span").html(desc);
}
}
});
}
function delete_forum_tag(doc){
tag_name = doc.parent().children().eq(0).html().trim();
$.ajax(
"<%= delete_forum_tag_forum_path(@forum)+ '.js?tag_name='%>"+tag_name,
{},
function(data){
alert(data == true)
if(data == true){
doc.parent().remove();
}else{
}
}
);
}
function addTag(){
if(<%=@forum.creator.id == User.current.id%>) {
if ($("input[name='addTag']").val().trim() != "" ) {
if($("input[name='addTag']").val().trim().length <= 120) {
$.get(
'<%= add_forum_tag_forum_path(@forum)%>' + "?tag_str=" + $("input[name='addTag']").val(),
{}
);
$("input[name='addTag']").val('');
}else{
alert("标签名字长度不能超过120个字符");
}
}
}
}
var tagNameHtml; //当前双击的链接的父节点的html
var tagName; //标签的值
var parentCssBorder; //当前双击的链接的父节点
var ele; //当前双击的链接
var taggableId; //标签的id
var taggableType; //被标签的类型
//这里renameTag有两种情况一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id就是第一种情况。如果没有id。就是第二种情况
function rename_tag(domEle,name,id,type){
if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动
return;
}
tagNameHtml = domEle.parent().html();
tagName = name;
parentCssBorder = domEle.parent().css("border");
ele = domEle;
taggableId = id;
taggableType = type;
width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100;
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:'+width+'px;" value="'+name+'"/>');
domEle.parent().css("border","1px solid #ffffff");
$("#renameTagName").focus();
}
$("#renameTagName").live('blur',function(){
if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
ele.parent().css("border","");
ele.parent().html(tagNameHtml);
}else{ //否则就要更新tag名称了
if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){
$.post(
'<%= update_tag_name_path %>',
{"taggableId": taggableId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim()}
)
}else{
ele.parent().css("border","");
ele.parent().html(tagNameHtml);
}
}
}
});
function del_forum_confirm(){
if(confirm('您确定要删除么?')){
$("#del_link").click();
}
}
</script>

View File

@ -365,6 +365,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.lh23{line-height: 23px;}
/*该高度会写入配置文件*/
.maxh360 {max-height: 810px;}
.maxh300 { max-height: 300px; }
.lh18 { line-height: 18px;}
/* Font & background Color */