Merge branch 'szzh' into develop
This commit is contained in:
commit
f101037b26
|
@ -13,6 +13,44 @@ class ForumsController < ApplicationController
|
||||||
include SortHelper
|
include SortHelper
|
||||||
|
|
||||||
PageLimit = 20
|
PageLimit = 20
|
||||||
|
def create_feedback
|
||||||
|
if User.current.logged?
|
||||||
|
@memo = Memo.new(params[:memo])
|
||||||
|
@memo.forum_id = "1"
|
||||||
|
@memo.author_id = User.current.id
|
||||||
|
#@forum = @memo.forum
|
||||||
|
respond_to do |format|
|
||||||
|
if @memo.save
|
||||||
|
format.html { redirect_to forum_path(@memo.forum) }
|
||||||
|
else
|
||||||
|
sort_init 'updated_at', 'desc'
|
||||||
|
sort_update 'created_at' => "#{Memo.table_name}.created_at",
|
||||||
|
'replies' => "#{Memo.table_name}.replies_count",
|
||||||
|
'updated_at' => "COALESCE (last_replies_memos.created_at, #{Memo.table_name}.created_at)"
|
||||||
|
|
||||||
|
@topic_count = @forum.topics.count
|
||||||
|
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
|
||||||
|
@memos = @forum.topics.
|
||||||
|
reorder("#{Memo.table_name}.sticky DESC").
|
||||||
|
includes(:last_reply).
|
||||||
|
limit(@topic_pages.per_page).
|
||||||
|
offset(@topic_pages.offset).
|
||||||
|
order(sort_clause).
|
||||||
|
preload(:author, {:last_reply => :author}).
|
||||||
|
all
|
||||||
|
|
||||||
|
flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
|
||||||
|
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
|
||||||
|
format.html { render action: :show, layout: 'base_forums' }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||||
|
format.json { render json: @memo.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to signin_path }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def create_memo
|
def create_memo
|
||||||
@memo = Memo.new(params[:memo])
|
@memo = Memo.new(params[:memo])
|
||||||
|
@ -56,7 +94,6 @@ class ForumsController < ApplicationController
|
||||||
@forums_count = @forums_all.count
|
@forums_count = @forums_all.count
|
||||||
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||||
|
|
||||||
|
|
||||||
@offset ||= @forums_pages.offset
|
@offset ||= @forums_pages.offset
|
||||||
@forums = @forums_all.offset(@offset).limit(@limit).all
|
@forums = @forums_all.offset(@offset).limit(@limit).all
|
||||||
#@forums = Forum.all
|
#@forums = Forum.all
|
||||||
|
@ -86,8 +123,6 @@ class ForumsController < ApplicationController
|
||||||
preload(:author, {:last_reply => :author}).
|
preload(:author, {:last_reply => :author}).
|
||||||
all
|
all
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# @offset, @limit = api_offset_and_limit({:limit => 10})
|
# @offset, @limit = api_offset_and_limit({:limit => 10})
|
||||||
# @forum = Forum.find(params[:id])
|
# @forum = Forum.find(params[:id])
|
||||||
# @memos_all = @forum.topics
|
# @memos_all = @forum.topics
|
||||||
|
@ -176,7 +211,6 @@ class ForumsController < ApplicationController
|
||||||
@forums_count = @forums_all.count
|
@forums_count = @forums_all.count
|
||||||
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||||
|
|
||||||
|
|
||||||
@offset ||= @forums_pages.offset
|
@offset ||= @forums_pages.offset
|
||||||
@forums = @forums_all.offset(@offset).limit(@limit).all
|
@forums = @forums_all.offset(@offset).limit(@limit).all
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -208,11 +242,8 @@ class ForumsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
||||||
def find_forum_if_available
|
def find_forum_if_available
|
||||||
@forum = Forum.find(params[:id]) if params[:id]
|
@forum = Forum.find(params[:id]) if params[:id]
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
|
|
@ -1594,6 +1594,12 @@ module ApplicationHelper
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_memo
|
||||||
|
@new_memo = Memo.new
|
||||||
|
#@new_memo.subject = "有什么想说的,尽管来咆哮吧~~"
|
||||||
|
@public_forum = Forum.find(1)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def wiki_helper
|
def wiki_helper
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
$(function(){
|
||||||
|
$("#button1").click(function(){
|
||||||
|
myTips("您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!","success");
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
|
@ -0,0 +1,150 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>意见反馈浮窗</title>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function mypostion(o){
|
||||||
|
var width=$(window).width();
|
||||||
|
var height=$(window).height();
|
||||||
|
var divW=$(o).outerWidth();
|
||||||
|
var divH=$(o).outerHeight();
|
||||||
|
var left=(width-divW)/2+$(window).scrollLeft();
|
||||||
|
var top=(height-divH)/2+$(window).scrollTop();
|
||||||
|
return {"left":left,"top":top};
|
||||||
|
};
|
||||||
|
|
||||||
|
function myTips(msg,status){
|
||||||
|
if(status!="success" && status!="error"){status="error";};
|
||||||
|
if (status=="success") {
|
||||||
|
$("body").append('<div class="ui-mask" id="ui-mask"></div><div class="change_success" id="change_success"><!--span class="send_close" onclick="$(this).parent().remove();$("#ui-mask").remove();"></span--><i></i>'+msg+'</div>');
|
||||||
|
var my=mypostion("#change_success");
|
||||||
|
$("#change_success").css({"position":"absolute","z-index":"9999999","top":my.top+"px","left":my.left+"px"});
|
||||||
|
$("#ui-mask").show();
|
||||||
|
$("#change_success").show();
|
||||||
|
setTimeout(function(){
|
||||||
|
$("#change_success,#ui-mask").fadeOut("slow",function(){
|
||||||
|
$("#ui-mask").remove();
|
||||||
|
$("#change_success").remove();
|
||||||
|
});
|
||||||
|
},2500);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("body").append('<div class="ui-mask" id="ui-mask"></div><div class="change_error" id="change_error"><!--span class="send_close" onclick="$(this).parent().remove();$("#ui-mask").remove();"></span--><i></i>'+msg+'</div>');
|
||||||
|
var my=mypostion("#change_error");
|
||||||
|
$("#change_error").css({"position":"absolute","z-index":"9999999","top":my.top+"px","left":my.left+"px"});
|
||||||
|
$("#ui-mask").show();
|
||||||
|
$("#change_error").show();
|
||||||
|
setTimeout(function(){
|
||||||
|
$("#change_error,#ui-mask").fadeOut("slow",function(){
|
||||||
|
$("#ui-mask").remove();
|
||||||
|
$("#change_error").remove();
|
||||||
|
});
|
||||||
|
},1000);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
$("#button1").click(function(){
|
||||||
|
myTips("您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!","success");
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
function f_submit()
|
||||||
|
{
|
||||||
|
$("#new_memo").submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/*浮窗*/
|
||||||
|
body{ height:3000px; font-family:'微软雅黑';}
|
||||||
|
div,ul,li,body,h3,p{margin:0; padding:0;}
|
||||||
|
a{ text-decoration:none;}
|
||||||
|
#roll{ background:url(/images/f_opnion.jpg) 0 0 no-repeat;width:157px; height:332px; position:absolute;}
|
||||||
|
.opnionBox{ width: 130px; height:146px; margin:76px auto 20px; }
|
||||||
|
.opnionText{ width: 120px !important; height:130px; outline:none; border:none !important;padding: 0 5px !important; color: #03a8bb;line-height:1.5; font-size:12px; }
|
||||||
|
a.opnionButton{ width:40px; height:20px; display:block; margin:0 auto;font-size:14px; color:#fd6e2a; font-weight: bold; }
|
||||||
|
a:hover.opnionButton{ text-decoration:underline;}
|
||||||
|
.opnionCall{ color:#03a8bb; font-size:12px; width:105px; margin:0 auto;}
|
||||||
|
.opnionCall .tectitle{ font-size:14px; alignment-adjust: central; color:#03a8bb; margin-bottom:8px,}
|
||||||
|
/*提示框*/
|
||||||
|
.ui-mask{background-color:#000;opacity:0.5;filter:alpha(opacity=50);width:100%;height:100%;position:fixed;_position:absolute;left:0;top:0;z-index:9999998;display:none;}
|
||||||
|
.change_success{
|
||||||
|
display:block;
|
||||||
|
height:60px;
|
||||||
|
width:300px;
|
||||||
|
line-height:1.9;
|
||||||
|
font-size:14px;
|
||||||
|
font-weight:500;
|
||||||
|
background:#fff;
|
||||||
|
color:#1395a4;
|
||||||
|
border:5px solid #1395a4;
|
||||||
|
font-size:14px;
|
||||||
|
padding:30px 20px;
|
||||||
|
position: absolute;
|
||||||
|
_position: absolute;
|
||||||
|
left:0;
|
||||||
|
top:0;
|
||||||
|
z-index:9999999;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="roll">
|
||||||
|
<div class="opnionBox">
|
||||||
|
|
||||||
|
<% get_memo %>
|
||||||
|
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
|
||||||
|
<div class="actions" style="max-width:680px">
|
||||||
|
<p>
|
||||||
|
<%= f.text_area :subject, :class => "opnionText",:placeholder => "有什么想说的,尽管来咆哮吧~~"%>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.hidden_field :content, :required => true ,:value=>'该贴来自用户反馈!'%>
|
||||||
|
</p>
|
||||||
|
<%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %>
|
||||||
|
<a href="javascript:void(0);" class="opnionButton" id="" onclick="f_submit();">提 交</a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opnionCall">
|
||||||
|
<div class="tectitle">技术支持:</div>
|
||||||
|
<p ><%= l(:label_course_adcolick) %><a href="http://user.trustie.net/users/12/user_newfeedback">黄井泉</a><br>
|
||||||
|
<%= l(:label_course_adcolick) %><a href="http://user.trustie.net/users/34/user_newfeedback">白羽</a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<script>
|
||||||
|
var roll=document.getElementById('roll'),
|
||||||
|
initX=0,
|
||||||
|
initY,
|
||||||
|
compY,
|
||||||
|
sp=15,
|
||||||
|
//可调整时间间隔,步进值不宜过大,不然IE下有点闪屏;
|
||||||
|
timeGap=5,
|
||||||
|
doc=document.documentElement,
|
||||||
|
docBody=document.body;
|
||||||
|
compY=initY=100;
|
||||||
|
roll.style.right=initX+"px";
|
||||||
|
;(function(){
|
||||||
|
var curScrollTop=(doc.scrollTop||docBody.scrollTop||0)-(doc.clientTop||docBody.clientTop||0);
|
||||||
|
//每次comP的值都不一样;直到roll.style.top===doc.scrollTop+initY;
|
||||||
|
compY+=(curScrollTop+initY-compY)/sp;
|
||||||
|
roll.style.top=Math.ceil(compY)+"px";
|
||||||
|
setTimeout(arguments.callee,timeGap);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#@nav_dispaly_user_label = 1
|
#@nav_dispaly_user_label = 1
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
|
<%= render :partial => "layouts/base_feedback" %>
|
||||||
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
|
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
|
||||||
<div class="welcome_logo">
|
<div class="welcome_logo">
|
||||||
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px")%>
|
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px")%>
|
||||||
|
|
|
@ -168,6 +168,7 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
member do
|
member do
|
||||||
post 'create_memo'
|
post 'create_memo'
|
||||||
|
post 'create_feedback'
|
||||||
match 'search_memo', :via => [:get, :post]
|
match 'search_memo', :via => [:get, :post]
|
||||||
end
|
end
|
||||||
resources :memos do
|
resources :memos do
|
||||||
|
@ -177,6 +178,7 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
resources :shares
|
resources :shares
|
||||||
|
|
||||||
#added by william
|
#added by william
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue