Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into sphinx_search

  • Loading branch information...
commit c9f1ed80f154907fef59d79d581b7621b927a7e9 2 parents e759da3 + cf88f82
@huacnlee authored
Showing with 468 additions and 75,940 deletions.
  1. +2 −0  .gitignore
  2. +10 −0 app/controllers/application_controller.rb
  3. +75 −0 app/controllers/cpanel/notices_controller.rb
  4. +15 −3 app/controllers/users_controller.rb
  5. +9 −6 app/helpers/application_helper.rb
  6. +2 −0  app/helpers/cpanel/notices_helper.rb
  7. +1 −1  app/mailers/user_mailer.rb
  8. +2 −0  app/models/ask.rb
  9. +8 −0 app/models/notice.rb
  10. +1 −1  app/views/asks/show.html.erb
  11. +15 −0 app/views/cpanel/notices/_base.html.erb
  12. +14 −0 app/views/cpanel/notices/_form.html.erb
  13. +6 −0 app/views/cpanel/notices/edit.html.erb
  14. +23 −0 app/views/cpanel/notices/index.html.erb
  15. +5 −0 app/views/cpanel/notices/new.html.erb
  16. +18 −0 app/views/cpanel/notices/show.html.erb
  17. +14 −2 app/views/layouts/application.html.erb
  18. +1 −0  app/views/layouts/cpanel.html.erb
  19. +3 −1 app/views/logs/_log.html.erb
  20. +2 −2 app/views/logs/index.html.erb
  21. +2 −2 app/views/topics/show.html.erb
  22. +1 −1  app/views/user_mailer/ask_user.html.erb
  23. +3 −3 app/views/users/_follower.html.erb
  24. +2 −0  app/views/users/_head.html.erb
  25. +2 −24 app/views/users/_sidebar.html.erb
  26. +3 −3 app/views/users/_topic.html.erb
  27. +2 −0  config/routes.rb
  28. +0 −75,880 db/dict/thesaurus.txt
  29. +7 −1 public/404.html
  30. +8 −2 public/500.html
  31. +1 −0  public/google0813ea2e8992f7bb.html
  32. +7 −1 public/javascripts/application.js
  33. +1 −0  public/javascripts/asks.js
  34. +97 −0 public/javascripts/jquery.cookie.js
  35. +8 −4 public/javascripts/topics.js
  36. +21 −0 public/javascripts/users.js
  37. +16 −1 public/stylesheets/application.css
  38. +8 −2 public/stylesheets/front.css
  39. +49 −0 test/functional/cpanel/notices_controller_test.rb
  40. +4 −0 test/unit/helpers/cpanel/notices_helper_test.rb
View
2  .gitignore
@@ -7,9 +7,11 @@ tmp/
config/*.yml
public/javascripts/cached_*
public/stylesheets/cached_*
+public/google*.html
public/about.html
db/sphinx
db/dict/*.lib
+db/dict/thesaurus.txt
#以bundle install --path vendor/bundle方式安装,不影响开发者现有gems环境
vendor/bundle
View
10 app/controllers/application_controller.rb
@@ -2,6 +2,16 @@
class ApplicationController < ActionController::Base
protect_from_forgery
helper :all
+ before_filter :load_notice
+
+ def load_notice
+ @notice = Notice.last
+ if !@notice.blank? and !@notice.end_at.blank?
+ if @notice.end_at < Time.now
+ @notice = nil
+ end
+ end
+ end
# 暂时不使用mobile-fu的功能,仅仅使用其is_mobile_device?方法
include ActionController::MobileFu::InstanceMethods
View
75 app/controllers/cpanel/notices_controller.rb
@@ -0,0 +1,75 @@
+# coding: UTF-8
+class Cpanel::NoticesController < CpanelController
+
+ def index
+ @notices = initialize_grid(Notice,
+ :order => 'id',
+ :order_direction => 'desc')
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json
+ end
+ end
+
+ def show
+ @notice = Notice.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json
+ end
+ end
+
+ def new
+ @notice = Notice.new
+ @notice.end_at = Time.now + 1.days
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json
+ end
+ end
+
+ def edit
+ @notice = Notice.find(params[:id])
+ end
+
+ def create
+ @notice = Notice.new(params[:notice])
+
+ respond_to do |format|
+ if @notice.save
+ format.html { redirect_to(cpanel_notices_path, :notice => 'Notice 创建成功。') }
+ format.json
+ else
+ format.html { render :action => "new" }
+ format.json
+ end
+ end
+ end
+
+ def update
+ @notice = Notice.find(params[:id])
+
+ respond_to do |format|
+ if @notice.update_attributes(params[:notice])
+ format.html { redirect_to(cpanel_notices_path, :notice => 'Notice 更新成功。') }
+ format.json
+ else
+ format.html { render :action => "edit" }
+ format.json
+ end
+ end
+ end
+
+ def destroy
+ @notice = Notice.find(params[:id])
+ @notice.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(cpanel_notices_path,:notice => "删除成功。") }
+ format.json
+ end
+ end
+end
View
18 app/controllers/users_controller.rb
@@ -20,6 +20,18 @@ def answered
render "/users/answered_asks.js"
end
end
+
+ def asked_to
+ @per_page = 10
+ @asks = Ask.normal.recent.asked_to(@user.id)
+ .paginate(:page => params[:page], :per_page => @per_page)
+ set_seo_meta("#{@user.name}的问题")
+ if params[:format] == "js"
+ render "/asks/index.js"
+ else
+ render "asked"
+ end
+ end
def show
@per_page = 10
@@ -42,7 +54,7 @@ def asked
end
def following_topics
- @per_page = 10
+ @per_page = 20
@topics = @user.followed_topics.desc("$natural")
.paginate(:page => params[:page], :per_page => @per_page)
@@ -53,7 +65,7 @@ def following_topics
end
def followers
- @per_page = 10
+ @per_page = 20
@followers = @user.followers.desc("$natural")
.paginate(:page => params[:page], :per_page => @per_page)
@@ -64,7 +76,7 @@ def followers
end
def following
- @per_page = 10
+ @per_page = 20
@followers = @user.following.desc("$natural")
.paginate(:page => params[:page], :per_page => @per_page)
View
15 app/helpers/application_helper.rb
@@ -11,8 +11,11 @@ def use_yahei_font?(ua)
return use
end
- def ask_notification_tag(ask_id, log, a, show_ask = true)
+ def ask_notification_tag(ask_id, notify, show_ask = true)
return if ask_id.nil?
+
+ log = notify.log
+ a = notify.action
tag = ""
ask = Ask.find(ask_id)
return "" if ask.nil? or log.user.nil?
@@ -22,16 +25,16 @@ def ask_notification_tag(ask_id, log, a, show_ask = true)
case a
when "AGREE_ANSWER", "NEW_ANSWER_COMMENT"
tag += user_tag + " #{a == "AGREE_ANSWER" ? "赞成" : "评论"}了你在"
- ask_tag = "<a href=\"#{ask_path(ask)}#{a == "AGREE_ANSWER" ? "#answer_" + log.target_id.to_s : "?eawc=yes&awid=" + log.title.to_s + "#answer_" + log.title.to_s}\">#{show_ask ? ask.title : "该问题中的回答。"}</a>" + (show_ask ? " 中的回答。" : "")
+ ask_tag = "<a onclick=\"mark_notifies_as_read(this, '#{notify.id}');\" href=\"#{ask_path(ask)}#{a == "AGREE_ANSWER" ? "#answer_" + log.target_id.to_s : "?eawc=yes&awid=" + log.title.to_s + "#answer_" + log.title.to_s}\">#{show_ask ? ask.title : "该问题中的回答。"}</a>" + (show_ask ? " 中的回答。" : "")
tag += (show_ask ? "问题 " : "") + ask_tag
when "NEW_ANSWER", "NEW_ASK_COMMENT"
tag += user_tag + " #{a == "NEW_ANSWER" ? "回答" : "评论"}"
- ask_tag = "<a href=\"#{ask_path(ask)}#{a == "NEW_ASK_COMMENT" ? "?easc=yes&asid=" + log.target_parent_id.to_s : ""}#answer_#{log.target_id.to_s}\">#{show_ask ? ask.title : "该问题。"}</a>"
+ ask_tag = "<a onclick=\"mark_notifies_as_read(this, '#{notify.id}');\" href=\"#{ask_path(ask)}#{a == "NEW_ASK_COMMENT" ? "?easc=yes&asid=" + log.target_parent_id.to_s : ""}#answer_#{log.target_id.to_s}\">#{show_ask ? ask.title : "该问题。"}</a>"
tag += (show_ask ? "问题 " : "") + ask_tag
when "THANK_ANSWER"
tag += user_tag + "感谢了你"
if show_ask
- ask_tag = "在 <a href=\"#{ask_path(ask)}?nr=1#answer_#{log.target_id.to_s}\">#{ask.title}</a> 的回答。"
+ ask_tag = "在 <a onclick=\"mark_notifies_as_read(this, '#{notify.id}');\" href=\"#{ask_path(ask)}?nr=1#answer_#{log.target_id.to_s}\">#{ask.title}</a> 的回答。"
else
ask_tag = "的回答。"
end
@@ -39,12 +42,12 @@ def ask_notification_tag(ask_id, log, a, show_ask = true)
when "INVITE_TO_ANSWER"
tag += user_tag + "邀请你回答 "
if show_ask
- tag += "<a href=\"#{ask_path(ask)}?nr=1\">#{ask.title}</a>"
+ tag += "<a onclick=\"mark_notifies_as_read(this, '#{notify.id}');\" href=\"#{ask_path(ask)}?nr=1\">#{ask.title}</a>"
end
when "ASK_USER"
tag += user_tag + "向你询问 "
if show_ask
- tag += "<a href=\"#{ask_path(ask)}?nr=1\">#{ask.title}</a>"
+ tag += "<a onclick=\"mark_notifies_as_read(this, '#{notify.id}');\" href=\"#{ask_path(ask)}?nr=1\">#{ask.title}</a>"
end
end
return tag
View
2  app/helpers/cpanel/notices_helper.rb
@@ -0,0 +1,2 @@
+module Cpanel::NoticesHelper
+end
View
2  app/mailers/user_mailer.rb
@@ -57,7 +57,7 @@ def invite_to_answer(ask_id, user_id, invitor_ids)
def ask_user(ask_id)
@ask = Ask.find(ask_id)
@user = @ask.to_user
- @title = "#{@ask.user.name}对向你询问#{@ask.title}"
+ @title = "#{@ask.user.name}向你询问#{@ask.title}"
mail(:to => @user.email, :subject => @title, :from => Setting.email_sender)
end
View
2  app/models/ask.rb
@@ -55,6 +55,8 @@ class Ask
# 除开一些 id,如用到 mute 的问题,传入用户的 muted_ask_ids
scope :exclude_ids, lambda { |id_array| not_in("_id" => (id_array ||= [])) }
scope :only_ids, lambda { |id_array| any_in("_id" => (id_array ||= [])) }
+ # 问我的问题
+ scope :asked_to, lambda { |to_user_id| where(:to_user_id => to_user_id) }
# FullText indexes
search_index(:fields => [:title,:topics],
View
8 app/models/notice.rb
@@ -0,0 +1,8 @@
+class Notice
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ field :body
+ field :end_at, :type => DateTime
+
+end
View
2  app/views/asks/show.html.erb
@@ -71,7 +71,7 @@
<% end %>
• <a href="#new_answer" onclick="return $('#new_answer .qeditor_preview').focus();">添加答案</a>
• <a href="#" onclick="return Asks.report(this);">举报</a>
- • <a class="spam<%= ' spamed' if spamed?(@ask) %>" onclick="return Asks.spamAsk(this,'<%= @ask.id %>');" title="问题被<%= Setting.ask_spam_max %>个网友不感兴趣后,问题将会隐藏。" href="#">不感兴趣</a>
+ • <a class="spam<%= ' spamed' if spamed?(@ask) %>" onclick="return Asks.spamAsk(this,'<%= @ask.id %>');" title="问题被<%= Setting.ask_spam_max %>个网友认为是烂问题以后,问题将会隐藏。" href="#">烂问题</a>
<% if !@ask.spams_count.blank? %>(<span id="spams_count"><%= @ask.spams_count %></span>人认为)<% end %>
• <span class="date"><%= l @ask.created_at.getlocal, :format => :short %></span>
</div>
View
15 app/views/cpanel/notices/_base.html.erb
@@ -0,0 +1,15 @@
+<%= content_for :base_sitemap do %>
+<a href="<%= cpanel_notices_path %>">cpanel_notices</a> »
+<% end %>
+<%= content_for :styles do %>
+<% end %>
+
+<%= spaceless do %>
+<div class="tools">
+ <a href="<%= cpanel_notices_path %>" class="button small left<%= ' checked' if params[:action] == "index" %>">查看所有</a>
+ <% if ["edit","update"].index(params[:action]) %>
+ <a href="#" class="button small checked">编辑</a>
+ <% end %>
+ <a href="<%= new_cpanel_notice_path %>" class="button small right<%= ' checked' if ["new","create"].index(params[:action]) %>">新建</a>
+</div>
+<% end %>
View
14 app/views/cpanel/notices/_form.html.erb
@@ -0,0 +1,14 @@
+<div id="cpanel_notice" class="form">
+<%= simple_form_for(@notice,
+ :url => (@notice.created_at.blank? ? cpanel_notices_path : cpanel_notice_path(@notice.id)) ) do |f| %>
+
+ <div class="inputs">
+ <%= f.input :body, :as => :text %>
+ <%= f.input :end_at, :as => :string %>
+ </div>
+ <div class="actions">
+ <button type="submit">提交</button>
+ 或者 <%= link_to '返回', cpanel_notices_path %>
+ </div>
+<% end %>
+</div>
View
6 app/views/cpanel/notices/edit.html.erb
@@ -0,0 +1,6 @@
+<%= content_for :sitemap do %>
+<span class="current">修改</span>
+<% end %>
+<%= render 'base' %>
+<%= render 'form' %>
+
View
23 app/views/cpanel/notices/index.html.erb
@@ -0,0 +1,23 @@
+<%= content_for :sitemap do %>
+<span class="current">列表</span>
+<% end %>
+<%= render 'base' %>
+
+<div id="cpanel_notices">
+ <%= grid(@notices, :show_filters => :always) do |g|
+ g.column :column_name => '', :attribute_name => '_id'
+ g.column :column_name => 'body', :attribute_name => 'body' do |c|
+ c.body if !c.body.blank?
+ end
+ g.column :column_name => 'end_at', :attribute_name => 'end_at' do |c|
+ c.end_at if !c.end_at.blank?
+ end
+ g.column :column_name => '创建时间', :attribute_name => 'created_at', :td_html_attrs => { :style => "width:120px;" }
+ g.column :td_html_attrs => { :style => "width:50px; text-align:right;" } do |c|
+ raw "#{link_to '修改', edit_cpanel_notice_path(c.id)}
+ #{link_to image_tag("wice_grid/delete.png", :style => "margin-bottom:-4px"), cpanel_notice_path(c.id), :method => :delete, :confirm => '确定要删除吗?'}"
+ end
+ end %>
+</div>
+
+
View
5 app/views/cpanel/notices/new.html.erb
@@ -0,0 +1,5 @@
+<%= content_for :sitemap do %>
+<span class="current">新建</span>
+<% end %>
+<%= render 'base' %>
+<%= render 'form' %>
View
18 app/views/cpanel/notices/show.html.erb
@@ -0,0 +1,18 @@
+<%= content_for :sitemap do %>
+<span class="current">查看</span>
+<% end %>
+<%= render 'base' %>
+<div class="tools">
+ <%= link_to '修改', edit_cpanel_notice_path(@notice) %> |
+ <%= link_to '返回', cpanel_notices_path %>
+</div>
+<div id="cpanel_notice">
+ <p>
+ <b>Body:</b>
+ <%= @notice.body %>
+ </p>
+ <p>
+ <b>End at:</b>
+ <%= @notice.end_at %>
+ </p>
+ </div>
View
16 app/views/layouts/application.html.erb
@@ -16,7 +16,7 @@
<meta name="description" content="<%= @meta_description %>" />
<link rel="shortcut icon" href="/favicon.ico?v=003" />
<%= csrf_meta_tag %>
- <%= javascript_include_tag "jquery.min","rails","facebox","jquery.jdialog","jquery.qeditor","jquery.autocomplete","jcaches","application","asks", :cache => "cached_application" %>
+ <%= javascript_include_tag "jquery.min","rails","facebox","jquery.jdialog","jquery.qeditor","jquery.autocomplete", "jquery.cookie" ,"jcaches","application","asks","topics","users", :cache => "cached_application" %>
<%= yield :scripts %>
<script type="text/javascript">
<% if current_user %>
@@ -57,6 +57,17 @@
<div id="main">
<div class="container">
<div class="left_wrapper">
+ <% if !@notice.blank? %>
+ <% if cookies[:hide_notice] != @notice.id.to_s %>
+ <div id="sys_notice">
+ <%= raw @notice.body %>
+ <div class="info">
+ <span class="date"><%= l @notice.updated_at.getlocal, :format => :long %></span>
+ <a href="#" class="gray_button small" onclick="return App.hideNotice('<%= @notice.id %>');">我知道了</a>
+ </div>
+ </div>
+ <% end %>
+ <% end %>
<% if !notice.blank? %>
<div class="notice_message"><%= notice %></div>
<script type="text/javascript">
@@ -81,6 +92,7 @@
<div class="left_wrapper">
<div class="links">
<a href="/about">关于者也</a> •
+ <a href="/asks/4d95f33bfd503c3bf2000011">每天进步一点</a> •
<a href="http://blog.zheye.org" target="_blank">博客</a> •
<a href="/register">如何注册</a> •
<a href="http://twitter.com/zheyecn" target="_blank">Twitter</a> •
@@ -108,7 +120,7 @@
<div class="logo"></div>
<div class="text">加载中…</div>
</div>
- <div style="width:0px;height;0px;overflow:hidden;">
+ <div style="width:0px;height:0px;overflow:hidden;">
<%= image_tag("loading.gif") %>
<div id="report_page">
<h2>举报内容</h2>
View
1  app/views/layouts/cpanel.html.erb
@@ -16,6 +16,7 @@
控制台 <a href="<%= root_path %>" class="out">回前台</a>
</td>
<td id="nav">
+ <a href="<%= cpanel_notices_path %>">公告</a> |
<a href="<%= cpanel_users_path %>">用户</a> |
<a href="<%= cpanel_asks_path %>">问题</a> |
<a href="<%= cpanel_answers_path %>">回答</a> |
View
4 app/views/logs/_log.html.erb
@@ -76,7 +76,9 @@ when "UserLog"
item = User.first(:conditions => { :id => log.target_id})
elsif ["AGREE"].include?(action)
answer = Answer.first(:conditions => {:id => log.target_id})
- item = answer.ask
+ if !answer.blank?
+ item = answer.ask
+ end
elsif ["THANK_ANSWER"].include?(action)
item = Answer.first(:conditions => {:id => log.target_id})
end
View
4 app/views/logs/index.html.erb
@@ -83,7 +83,7 @@
target_id = ["THANK_ANSWER","INVITE_TO_ANSWER"].include?(item.action) ? item.log.target_parent_id : item.target_id
%>
<li>
- <%= raw ask_notification_tag(target_id, item.log, item.action, false) %>
+ <%= raw ask_notification_tag(target_id, item, false) %>
<span class="time"><%= l item.log.created_at.getlocal, :format => :short %></span>
</li>
<%
@@ -97,7 +97,7 @@
if item and item.log
target_id = ["THANK_ANSWER","INVITE_TO_ANSWER"].include?(item.action) ? item.log.target_parent_id : item.target_id
%>
- <%= raw ask_notification_tag(target_id, item.log, item.action, true) %>
+ <%= raw ask_notification_tag(target_id, item, true) %>
<span class="time"><%= l item.log.created_at.getlocal, :format => :short %></span>
<%
end
View
4 app/views/topics/show.html.erb
@@ -56,9 +56,9 @@
<div class="box">
<div class="inner">
<% if current_user.topic_followed?(@topic) %>
- <a href="#" style="width:80px;" class="gray_button" onclick="return Topics.unfollow(this, '<%= @topic.name %>');">取消关注</a>
+ <a href="#" class="gray_button" onclick="return Topics.unfollow(this, '<%= @topic.name %>','');">取消关注</a>
<% else %>
- <a href="#" style="width:80px;" class="gray_button green_button" onclick="return Topics.follow(this, '<%= @topic.name %>');">关注此话题</a>
+ <a href="#" class="gray_button green_button" onclick="return Topics.follow(this, '<%= @topic.name %>','');">关注</a>
<% end %>
</div>
</div>
View
2  app/views/user_mailer/ask_user.html.erb
@@ -1,5 +1,5 @@
<div style="margin:10px 0;">
- <b><%= user_name_tag(@ask.to_user, :url => true) %></b> 向你询问。
+ <b><%= user_name_tag(@ask.user, :url => true) %></b> 向你询问。
</div>
<div style="font-weight:bold;">你可以点击下面的链接进入这个问题的页面:</div>
<div><a href="<%= ask_url(@ask.id) %>"><%= ask_url(@ask.id) %></a></div>
View
6 app/views/users/_follower.html.erb
@@ -13,10 +13,10 @@
<% if current_user %>
<div class="action">
<% if current_user.followed?(follower) %>
- <a href="#" onclick="return unfollow_user(this, '<%= follower.name %>');">取消关注</a>
+ <a class="flat_button small" href="#" onclick="return Users.unfollow(this, '<%= follower.slug %>','small');">取消关注</a>
<% else %>
- <a href="#" onclick="return follow_user(this, '<%= follower.name %>');">关注</a>
+ <a class="green_button small" href="#" onclick="return Users.follow(this, '<%= follower.slug %>','small');">关注</a>
<% end %>
</div>
<% end %>
-</li>
+</li>
View
2  app/views/users/_head.html.erb
@@ -38,6 +38,7 @@
<div class="tabs">
<a<%= ' class=actived' if params[:action] == "show" %> href="<%= user_path(user.slug) %>">主页</a>
+ <a<%= ' class=actived' if params[:action] == "asked_to" %> href="<%= asked_to_user_path(user.slug) %>">问<%= current_user == user ? "" : (user.girl ? "" : "") %>(<%= Ask.normal.asked_to(user.id).count %>)</a>
<a<%= ' class=actived' if params[:action] == "asked" %> href="<%= asked_user_path(user.slug) %>">问过(<%= user.asks_count %>)</a>
<a<%= ' class=actived' if params[:action] == "answered" %> href="<%= answered_user_path(user.slug) %>">回答过(<%= user.answered_ask_ids.count %>)</a>
<!-- <a<%= ' class=actived' if params[:action] == "following" %> href="<%= following_user_path(user.slug) %>">关注(<%= user.following_ids.count %>)</a>
@@ -66,4 +67,5 @@
</div>
</form>
</div>
+<br>
<% end %>
View
26 app/views/users/_sidebar.html.erb
@@ -1,25 +1,3 @@
-<%= content_for :scripts do %>
- <script type="text/javascript">
- function follow_topic(el, id){
- App.loading();
- $.get("/topics/"+id+"/follow",{}, function(res){
- App.loading(false);
- $(el).replaceWith('<a href="#" onclick="return unfollow_topic(this, \''+id+'\');">取消关注</a>');
- });
- return false;
- }
-
- function unfollow_topic(el, id){
- App.loading();
- $.get("/topics/"+id+"/unfollow",{}, function(res){
- App.loading(false);
- $(el).replaceWith('<a href="#" onclick="return follow_topic(this, \''+id+'\');">关注此话题</a>');
- });
- return false;
- }
- </script>
-<% end %>
-
<% content_for :sidebar do %>
<div class="box">
<div class="inner">
@@ -27,9 +5,9 @@
<div class="box">
<div class="inner">
<% if current_user.followed?(@user) %>
- <a href="#" style="width:80px;" class="gray_button" onclick="return unfollow(this, '<%= @user.slug %>');">取消关注</a>
+ <a href="#" class="flat_button" onclick="return Users.unfollow(this, '<%= @user.slug %>','');">取消关注</a>
<% else %>
- <a href="#" style="width:80px;" class="gray_button green_button" onclick="return follow(this, '<%= @user.slug %>');">关注</a>
+ <a href="#" class="green_button" onclick="return Users.follow(this, '<%= @user.slug %>','');">关注</a>
<!-- <a href="#" class="dropdown" onclick="return dropdownSettings(this);"><%= image_tag("settings.png",:style => "margin-bottom:-5px;") %></a> -->
<% end %>
</div>
View
6 app/views/users/_topic.html.erb
@@ -5,10 +5,10 @@
<% if current_user %>
<div class="action">
<% if current_user.topic_followed?(topic) %>
- <a href="#" onclick="return unfollow_topic(this, '<%= topic.name %>');">取消关注</a>
+ <a class="flat_button small" href="#" onclick="return Topics.unfollow(this, '<%= topic.name %>','small');">取消关注</a>
<% else %>
- <a href="#" onclick="return follow_topic(this, '<%= topic.name %>');">关注</a>
+ <a class="green_button small" href="#" onclick="return Topics.follow(this, '<%= topic.name %>','small');">关注</a>
<% end %>
</div>
<% end %>
-</li>
+</li>
View
2  config/routes.rb
@@ -22,6 +22,7 @@
member do
get "answered"
get "asked"
+ get "asked_to"
get "follow"
get "unfollow"
get "followers"
@@ -80,5 +81,6 @@
resources :topics
resources :comments
resources :report_spams
+ resources :notices
end
end
View
75,880 db/dict/thesaurus.txt
0 additions, 75,880 deletions not shown
View
8 public/404.html
@@ -1,3 +1,9 @@
<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>404错误-者也</title> <link href="/stylesheets/cached_front.css?1301456497" media="screen" rel="stylesheet" type="text/css" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <link rel="shortcut icon" href="/favicon.ico?v=001" /> <meta name="csrf-param" content="authenticity_token"/> <meta name="csrf-token" content="E/I10RKS41FgulQmvSXsGeCJppmZ7/AE4ROp0rT1C3w="/> <script src="/javascripts/cached_application.js?1301456497" type="text/javascript"></script> <script type="text/javascript"> function addAsk(){ $.facebox({ div : "#hidden_new_ask", overlay : false }); return false; } function showSearchComplete(el,type){ el_width = $(el).width(); html = ""; if(type == "click" || $(el).val() == ""){ html = $(el).attr("placeholder"); } else{ html += '<ul class="complete" style="padding:0px 15px;">'; t = $(el).val().toLowerCase(); searchList = []; for(var i=0;i<searchList.length;i++){ curr = searchList[i].toLowerCase(); if(curr.indexOf(t) >= 0){ html += "<li>"+searchList[i]+"</li>"; } } html += "</ul>"; } $(el).jDialog({ content : html, width : el_width + 250, title_visiable : false, top_offset : 1, left_offset : -1 }); return false; } </script> </head> <body> <div id="header"> <div class="container"> <div class="left_wrapper"> <div id="site_name"> <a href="/asks">者也</a> </div> <div id="add_ask"> <input type="text" placeholder="搜索问题, 话题 或 会员" onclick="return showSearchComplete(this,'click');" onkeyup="return showSearchComplete(this,'keyup');" /> <a href="/asks/new" onclick="return addAsk();">我要提问</a> </div> </div> <div class="sidebar"> <div id="user_bar"> <a href="/asks">随便看看</a> <a href="/login">登陆</a> <a href="/register">如何才能注册?</a> </div> </div> </div> </div> <div id="main"> <div class="container"> <div class="left_wrapper"> <h1>404,页面不存在</h1> <p>
非常抱歉,你请求的页面我们无法找到。
-</p> </div> <div class="sidebar"> </div> </div> </div> <div id="footer"> <div class="container"> <div class="left_wrapper"> <p class="copyright"> &copy; 者也 zheye.org - 非营利问答平台, 开源项目,<a href="http://github.com/huacnlee/quora">代码</a>。内测期间,如有问题还请谅解。<br />目前暂时只支持Chrome浏览器,请在 1280 宽度以上的分辨率下面浏览。<br />诚邀有志有能之士参与这个项目,需要1个前端,1个推广。 </p> </div> </div> </div> <div style="display: none;" id="hidden_new_ask"> <form action="/asks" method="post" id="inner_new_ask"> <input name="authenticity_token" type="hidden" value="E/I10RKS41FgulQmvSXsGeCJppmZ7/AE4ROp0rT1C3w=" /> <textarea type="text" name="ask[title]" class="title" placeholder="在这里输入问题"></textarea> <label>可选:</label>添加更多描述 <textarea type="text" name="ask[body]"></textarea> <button type="submit" class="submit">添加问题</button> <a href="#" onclick="$.facebox.close(); return false;">取消</a> </form> </div> <div style="display: none;" id="loading"> <div class="logo"></div> <div class="text">加载中…</div> </div> </body> </html>
+</p> </div> <div class="sidebar"> </div> </div> </div>
+<div id="footer"> <div class="container"> <div class="left_wrapper"> <div class="links"> <a href="/about">关于者也</a> • <a href="/asks/4d95f33bfd503c3bf2000011">每天进步一点</a> • <a href="http://blog.zheye.org" target="_blank">博客</a> • <a href="/register">如何注册</a> • <a href="http://twitter.com/zheyecn" target="_blank">Twitter</a> • <a href="mailto:nowazhu@gmail.com">合作联系</a> • <a href="mailto:huacnlee@gmail.com">反馈</a> </div> <p class="copyright"> © 者也 zheye.org - 非营利问答平台,开源项目,<a href="http://github.com/huacnlee/quora">代码</a>,内测期间,如有问题还请谅解。 </p> </div> </div> </div>
+<div style="display: none;" id="hidden_new_ask"> <h2>创建新问题</h2> <form action="/asks" method="post" id="inner_new_ask"> <input name="authenticity_token" type="hidden" value="WEwX/eeEGbCPkOpsFSzNgdM94cdsrFxAOAoFW34z3u4="> <textarea type="text" name="ask[title]" class="title" placeholder="在这里输入问题"></textarea> <label>可选:</label>添加更多描述 <textarea type="text" name="ask[body]"></textarea> <button type="submit" class="submit">添加问题</button> <a href="#" onclick="$.facebox.close(); return false;">取消</a> </form> </div>
+<div style="display: none;" id="loading"> <div class="logo"></div> <div class="text">加载中…</div> </div>
+<div style="width:0px;height:0px;overflow:hidden;"> <img alt="Loading" src="/images/loading.gif?1301366040"> <div id="report_page"> <h2>举报内容</h2> <form id="report_page_form" action="/report.js" onsubmit="App.loading();" method="post" class="simple_form"> <input name="authenticity_token" type="hidden" value="WEwX/eeEGbCPkOpsFSzNgdM94cdsrFxAOAoFW34z3u4="> <div class="row"> <input type="hidden" name="url" value="http://zheye.org/asks/4da6fdcafd503c7672000007?nr=1"> <label class="string">请填写举报原因:</label> <textarea name="desc" style="width:400px;height:80px;"></textarea> </div> <div class="acitons"> <button type="submit">提交</button> <a href="#" style="margin-left:5px;" onclick="$.facebox.close(); return false;">关闭</a> </div> </form> </div> </div>
+<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-22413508-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>
+</body></html>
View
10 public/500.html
@@ -1,4 +1,10 @@
-<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>500错误-者也</title> <link href="/stylesheets/cached_front.css?1301456497" media="screen" rel="stylesheet" type="text/css" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <link rel="shortcut icon" href="/favicon.ico?v=001" /> <meta name="csrf-param" content="authenticity_token"/> <meta name="csrf-token" content="E/I10RKS41FgulQmvSXsGeCJppmZ7/AE4ROp0rT1C3w="/> <script src="/javascripts/cached_application.js?1301456497" type="text/javascript"></script> <script type="text/javascript"> function addAsk(){ $.facebox({ div : "#hidden_new_ask", overlay : false }); return false; } function showSearchComplete(el,type){ el_width = $(el).width(); html = ""; if(type == "click" || $(el).val() == ""){ html = $(el).attr("placeholder"); } else{ html += '<ul class="complete" style="padding:0px 15px;">'; t = $(el).val().toLowerCase(); searchList = []; for(var i=0;i<searchList.length;i++){ curr = searchList[i].toLowerCase(); if(curr.indexOf(t) >= 0){ html += "<li>"+searchList[i]+"</li>"; } } html += "</ul>"; } $(el).jDialog({ content : html, width : el_width + 250, title_visiable : false, top_offset : 1, left_offset : -1 }); return false; } </script> </head> <body> <div id="header"> <div class="container"> <div class="left_wrapper"> <div id="site_name"> <a href="/asks">者也</a> </div> <div id="add_ask"> <input type="text" placeholder="搜索问题, 话题 或 会员" onclick="return showSearchComplete(this,'click');" onkeyup="return showSearchComplete(this,'keyup');" /> <a href="/asks/new" onclick="return addAsk();">我要提问</a> </div> </div> <div class="sidebar"> <div id="user_bar"> <a href="/asks">随便看看</a> <a href="/login">登陆</a> <a href="/register">如何才能注册?</a> </div> </div> </div> </div> <div id="main"> <div class="container"> <div class="left_wrapper"> <h1>500 程序异常</h1> <p>
+<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>500错误-者也</title> <link href="/stylesheets/cached_front.css?1301456497" media="screen" rel="stylesheet" type="text/css" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <link rel="shortcut icon" href="/favicon.ico?v=001" /> <meta name="csrf-param" content="authenticity_token"/> <meta name="csrf-token" content="E/I10RKS41FgulQmvSXsGeCJppmZ7/AE4ROp0rT1C3w="/> <script src="/javascripts/cached_application.js?1301456497" type="text/javascript"></script> <script type="text/javascript"> function addAsk(){ $.facebox({ div : "#hidden_new_ask", overlay : false }); return false; } function showSearchComplete(el,type){ el_width = $(el).width(); html = ""; if(type == "click" || $(el).val() == ""){ html = $(el).attr("placeholder"); } else{ html += '<ul class="complete" style="padding:0px 15px;">'; t = $(el).val().toLowerCase(); searchList = []; for(var i=0;i<searchList.length;i++){ curr = searchList[i].toLowerCase(); if(curr.indexOf(t) >= 0){ html += "<li>"+searchList[i]+"</li>"; } } html += "</ul>"; } $(el).jDialog({ content : html, width : el_width + 250, title_visiable : false, top_offset : 1, left_offset : -1 }); return false; } </script> </head> <body> <div id="header"> <div class="container"> <div class="left_wrapper"> <div id="site_name"> <a href="/asks">者也</a> </div> <div id="add_ask"> <input type="text" placeholder="搜索问题, 话题 或 会员" onclick="return showSearchComplete(this,'click');" onkeyup="return showSearchComplete(this,'keyup');" /> <a href="/asks/new" onclick="return addAsk();">我要提问</a> </div> </div> <div class="sidebar"> <div id="user_bar"> <a href="/asks">随便看看</a> <a href="/login">登陆</a> <a href="/register">如何才能注册?</a> </div> </div> </div> </div> <div id="main"> <div class="container"> <div class="left_wrapper"> <h1>500, 程序异常</h1> <p>
非常抱歉,目前者也的功能还不是很完善,有些时候有点问题。<br />
你很幸运,遇到了。多多海涵!<br />
-</p> </div> <div class="sidebar"> </div> </div> </div> <div id="footer"> <div class="container"> <div class="left_wrapper"> <p class="copyright"> &copy; 者也 zheye.org - 非营利问答平台, 开源项目,<a href="http://github.com/huacnlee/quora">代码</a>。内测期间,如有问题还请谅解。<br />目前暂时只支持Chrome浏览器,请在 1280 宽度以上的分辨率下面浏览。<br />诚邀有志有能之士参与这个项目,需要1个前端,1个推广。 </p> </div> </div> </div> <div style="display: none;" id="hidden_new_ask"> <form action="/asks" method="post" id="inner_new_ask"> <input name="authenticity_token" type="hidden" value="E/I10RKS41FgulQmvSXsGeCJppmZ7/AE4ROp0rT1C3w=" /> <textarea type="text" name="ask[title]" class="title" placeholder="在这里输入问题"></textarea> <label>可选:</label>添加更多描述 <textarea type="text" name="ask[body]"></textarea> <button type="submit" class="submit">添加问题</button> <a href="#" onclick="$.facebox.close(); return false;">取消</a> </form> </div> <div style="display: none;" id="loading"> <div class="logo"></div> <div class="text">加载中…</div> </div> </body> </html>
+</p> </div> <div class="sidebar"> </div> </div> </div>
+<div id="footer"> <div class="container"> <div class="left_wrapper"> <div class="links"> <a href="/about">关于者也</a> • <a href="/asks/4d95f33bfd503c3bf2000011">每天进步一点</a> • <a href="http://blog.zheye.org" target="_blank">博客</a> • <a href="/register">如何注册</a> • <a href="http://twitter.com/zheyecn" target="_blank">Twitter</a> • <a href="mailto:nowazhu@gmail.com">合作联系</a> • <a href="mailto:huacnlee@gmail.com">反馈</a> </div> <p class="copyright"> © 者也 zheye.org - 非营利问答平台,开源项目,<a href="http://github.com/huacnlee/quora">代码</a>,内测期间,如有问题还请谅解。 </p> </div> </div> </div>
+<div style="display: none;" id="hidden_new_ask"> <h2>创建新问题</h2> <form action="/asks" method="post" id="inner_new_ask"> <input name="authenticity_token" type="hidden" value="WEwX/eeEGbCPkOpsFSzNgdM94cdsrFxAOAoFW34z3u4="> <textarea type="text" name="ask[title]" class="title" placeholder="在这里输入问题"></textarea> <label>可选:</label>添加更多描述 <textarea type="text" name="ask[body]"></textarea> <button type="submit" class="submit">添加问题</button> <a href="#" onclick="$.facebox.close(); return false;">取消</a> </form> </div>
+<div style="display: none;" id="loading"> <div class="logo"></div> <div class="text">加载中…</div> </div>
+<div style="width:0px;height:0px;overflow:hidden;"> <img alt="Loading" src="/images/loading.gif?1301366040"> <div id="report_page"> <h2>举报内容</h2> <form id="report_page_form" action="/report.js" onsubmit="App.loading();" method="post" class="simple_form"> <input name="authenticity_token" type="hidden" value="WEwX/eeEGbCPkOpsFSzNgdM94cdsrFxAOAoFW34z3u4="> <div class="row"> <input type="hidden" name="url" value="http://zheye.org/asks/4da6fdcafd503c7672000007?nr=1"> <label class="string">请填写举报原因:</label> <textarea name="desc" style="width:400px;height:80px;"></textarea> </div> <div class="acitons"> <button type="submit">提交</button> <a href="#" style="margin-left:5px;" onclick="$.facebox.close(); return false;">关闭</a> </div> </form> </div> </div>
+<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-22413508-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>
+</body></html>
View
1  public/google0813ea2e8992f7bb.html
@@ -0,0 +1 @@
+google-site-verification: google0813ea2e8992f7bb.html
View
8 public/javascripts/application.js
@@ -145,6 +145,12 @@ var App = {
});
},
+ hideNotice : function(id){
+ $("#sys_notice").fadeOut('fast');
+ $.cookie("hide_notice",id);
+ return false;
+ },
+
varsion : function(){
return "1.0";
}
@@ -154,4 +160,4 @@ function show_all_answer_body(log_id, answer_id) {
$('#aws_' + log_id + '_' + answer_id).addClass("force-hide");
$('#awb_' + log_id + '_' + answer_id).addClass("force-show");
return false;
-}
+}
View
1  public/javascripts/asks.js
@@ -158,6 +158,7 @@ var Asks = {
$(el).addClass("active");
}
$(el).parent().next().toggle();
+ return false;
},
/* 邀请人回答问题 */
View
97 public/javascripts/jquery.cookie.js
@@ -0,0 +1,97 @@
+/**
+ * Cookie plugin
+ *
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ */
+
+/**
+ * Create a cookie with the given name and value and other optional parameters.
+ *
+ * @example $.cookie('the_cookie', 'the_value');
+ * @desc Set the value of a cookie.
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
+ * @desc Create a cookie with all available options.
+ * @example $.cookie('the_cookie', 'the_value');
+ * @desc Create a session cookie.
+ * @example $.cookie('the_cookie', null);
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
+ * used when the cookie was set.
+ *
+ * @param String name The name of the cookie.
+ * @param String value The value of the cookie.
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
+ * when the the browser exits.
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
+ * require a secure protocol (like HTTPS).
+ * @type undefined
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+
+/**
+ * Get the value of a cookie with the given name.
+ *
+ * @example $.cookie('the_cookie');
+ * @desc Get the value of a cookie.
+ *
+ * @param String name The name of the cookie.
+ * @return The value of the cookie.
+ * @type String
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+jQuery.cookie = function(name, value, options) {
+ if (typeof value != 'undefined') { // name and value given, set cookie
+ options = options || {};
+ if (value === null) {
+ value = '';
+ options.expires = -1;
+ }
+ var expires = '';
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
+ var date;
+ if (typeof options.expires == 'number') {
+ date = new Date();
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
+ } else {
+ date = options.expires;
+ }
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
+ }
+ // CAUTION: Needed to parenthesize options.path and options.domain
+ // in the following expressions, otherwise they evaluate to undefined
+ // in the packed version for some reason...
+ var path = options.path ? '; path=' + (options.path) : '';
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
+ var secure = options.secure ? '; secure' : '';
+ document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
+ } else { // only name given, get cookie
+ var cookieValue = null;
+ if (document.cookie && document.cookie != '') {
+ var cookies = document.cookie.split(';');
+ for (var i = 0; i < cookies.length; i++) {
+ var cookie = jQuery.trim(cookies[i]);
+ // Does this cookie string begin with the name we want?
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+ break;
+ }
+ }
+ }
+ return cookieValue;
+ }
+};
+
View
12 public/javascripts/topics.js
@@ -11,18 +11,22 @@ var Topics = {
});
},
- follow : function(el, id){
+ follow : function(el, id,small){
+ App.loading();
$(el).attr("onclick", "return false;");
$.get("/topics/"+id+"/follow",{}, function(res){
- $(el).replaceWith('<a href="#" style="width:80px;" class="gray_button" onclick="return Topics.unfollow(this, \''+ topic_id +'\');">取消关注</a>');
+ $(el).replaceWith('<a href="#" class="flat_button '+small+'" onclick="return Topics.unfollow(this, \''+ id +'\', \''+ small +'\');">取消关注</a>');
+ App.loading(false);
});
return false;
},
- unfollow : function(el,id){
+ unfollow : function(el,id,small){
+ App.loading();
$(el).attr("onclick", "return false;");
$.get("/topics/"+id+"/unfollow",{}, function(res){
- $(el).replaceWith('<a href="#" style="width:80px;" class="gray_button green_button" onclick="return Topics.follow(this, \''+ topic_id +'\');">关注此话题</a>');
+ $(el).replaceWith('<a href="#" class="green_button '+small+'" onclick="return Topics.follow(this, \''+ id +'\', \''+ small +'\');">关注</a>');
+ App.loading(false);
});
return false;
},
View
21 public/javascripts/users.js
@@ -0,0 +1,21 @@
+var Users = {
+ follow : function(el, id, small){
+ App.loading();
+ $(el).attr("onclick", "return false;");
+ $.get("/users/"+id+"/follow",{}, function(res){
+ $(el).replaceWith('<a href="#" class="flat_button '+small+'" onclick="return Users.unfollow(this, \''+ id +'\',\''+small+'\');">取消关注</a>');
+ App.loading(false);
+ });
+ return false;
+ },
+ unfollow : function(el, id, small){
+ App.loading();
+ $(el).attr("onclick", "return false;");
+ $.get("/users/"+id+"/unfollow",{}, function(res){
+ $(el).replaceWith('<a href="#" class="green_button '+small+'" onclick="return Users.follow(this, \''+ id +'\',\''+small+'\');">关注</a>');
+ App.loading(false);
+ });
+ return false;
+ },
+ varsion : function(){}
+}
View
17 public/stylesheets/application.css
@@ -76,15 +76,30 @@ a.green_button {
background:#dff0b1 url(/images/green_button_bg.gif) bottom left repeat-x;
border:1px solid #8CB332;
border-bottom: 1px solid #648517;
+ display:inline-block;
+ line-height:24px;
+ padding:2px 10px 1px 10px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ text-decoration:none;
color: #406A24;
+ text-align:center;
text-shadow: 0 1px #D4ED95;
font-weight:bold;
}
a.green_button:active {
- background:#c3dd82;
+ background:#8CB332;
border:1px solid #648517;
}
+a.green_button.small,
+button.green_button.small,
+a.flat_button.small,
+button.green_button.small,
+a.gray_button.small,
+button.gray_button.small
+{ padding:2px 10px; line-height:16px; }
+
/* simple_form style */
View
10 public/stylesheets/front.css
@@ -94,6 +94,12 @@ address, blockquote {
.sidebar .sections li a.active { background-color: #DFEAF4; text-decoration: none; }
.sidebar .sections li a.active { background-color:#DDD; color:#333; cursor:default; }
+#sys_notice { margin-left: 0; padding: 10px; overflow: hidden; border-radius: 5px;
+ -moz-border-radius: 5px; -webkit-border-radius: 5px; background-color: #fff6c1;
+ border: 3px solid #dec88e; margin-bottom: 20px; }
+#sys_notice .info { margin-top:8px;}
+#sys_notice .date { float:right; margin-top:6px; text-align:right; color:#999; }
+
#inner_new_ask {}
#inner_new_ask textarea { display:block; width:387px; height:80px; margin-bottom:8px; }
#inner_new_ask textarea.title { font-size:16px; font-weight:bold; }
@@ -347,8 +353,8 @@ a.user img.normal { width:100px; height:100px; }
#omniauth_links li.github a { background-position:0 -113px; }
#omniauth_links li span { color:#999; margin-left:3px; }
-.search_result_dropdown { background:#ddd; }
-.search_result_dropdown .contextual_dialog_content { padding:0; background:#ddd; }
+.search_result_dropdown { background:#ddd; }
+.search_result_dropdown .contextual_dialog_content { padding:0; background:#ddd; border:1px solid #999; border-color: #999999 #999999 #666666; }
.dialog_content .tip { padding:8px 8px; background:#ddd; }
.dialog_content .complete { padding:0; margin:0; background:#FFF; }
.dialog_content .complete li { list-style:none; padding:0px 8px; cursor:pointer;
View
49 test/functional/cpanel/notices_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class Cpanel::NoticesControllerTest < ActionController::TestCase
+ setup do
+ @cpanel_notice = cpanel_notices(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:cpanel_notices)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create cpanel_notice" do
+ assert_difference('Cpanel::Notice.count') do
+ post :create, :cpanel_notice => @cpanel_notice.attributes
+ end
+
+ assert_redirected_to cpanel_notice_path(assigns(:cpanel_notice))
+ end
+
+ test "should show cpanel_notice" do
+ get :show, :id => @cpanel_notice.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, :id => @cpanel_notice.to_param
+ assert_response :success
+ end
+
+ test "should update cpanel_notice" do
+ put :update, :id => @cpanel_notice.to_param, :cpanel_notice => @cpanel_notice.attributes
+ assert_redirected_to cpanel_notice_path(assigns(:cpanel_notice))
+ end
+
+ test "should destroy cpanel_notice" do
+ assert_difference('Cpanel::Notice.count', -1) do
+ delete :destroy, :id => @cpanel_notice.to_param
+ end
+
+ assert_redirected_to cpanel_notices_path
+ end
+end
View
4 test/unit/helpers/cpanel/notices_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class Cpanel::NoticesHelperTest < ActionView::TestCase
+end
Please sign in to comment.
Something went wrong with that request. Please try again.