├── log └── .gitkeep ├── lib ├── tasks │ └── .gitkeep ├── assets │ └── .gitkeep ├── templates │ └── slim │ │ └── scaffold │ │ └── _form.html.slim ├── active_support │ └── cache │ │ └── null_store.rb └── rabel │ └── captcha.rb ├── tmp ├── pids │ └── .gitkeep └── sockets │ └── .gitkeep ├── .ruby-version ├── app ├── mailers │ └── .gitkeep ├── models │ ├── .gitkeep │ ├── channel.rb │ ├── following.rb │ ├── bookmark.rb │ ├── plane.rb │ ├── page.rb │ ├── cloud_file.rb │ ├── notifiable.rb │ ├── account.rb │ ├── qiniu_image.rb │ ├── upyun_image.rb │ ├── sortable.rb │ ├── node.rb │ ├── advertisement.rb │ ├── notification.rb │ └── siteconf.rb ├── helpers │ ├── qiniu_images_helper.rb │ └── bootstrap_helper.rb ├── views │ ├── admin │ │ ├── planes │ │ │ ├── destroy.js.haml │ │ │ ├── _sort_plane.html.haml │ │ │ ├── show_form.js.haml │ │ │ ├── create.js.haml │ │ │ ├── sort.js.haml │ │ │ ├── _form.html.haml │ │ │ ├── _sort_planes.html.haml │ │ │ ├── _plane.html.haml │ │ │ └── index.html.haml │ │ ├── nodes │ │ │ ├── move_to.js.haml │ │ │ ├── move.js.haml │ │ │ ├── show_form.js.haml │ │ │ ├── create.js.haml │ │ │ ├── destroy.js.haml │ │ │ ├── update.js.haml │ │ │ ├── _move_form.js.haml │ │ │ ├── _node.html.haml │ │ │ └── _form.html.haml │ │ ├── rewards │ │ │ ├── new.js.haml │ │ │ ├── create.js.haml │ │ │ ├── index.html.haml │ │ │ ├── _reward.html.haml │ │ │ └── _form.html.haml │ │ ├── cloud_files │ │ │ ├── new.html.haml │ │ │ ├── _form.html.haml │ │ │ ├── _cloud_file.html.haml │ │ │ └── index.html.haml │ │ ├── users │ │ │ ├── toggle_admin.js.haml │ │ │ ├── toggle_blocked.js.haml │ │ │ ├── edit.html.haml │ │ │ ├── index.html.haml │ │ │ └── _user.html.haml │ │ ├── pages │ │ │ ├── action.html.haml │ │ │ ├── _page.html.haml │ │ │ ├── index.html.haml │ │ │ └── _form.html.haml │ │ ├── advertisements │ │ │ ├── edit.html.haml │ │ │ ├── new.html.haml │ │ │ ├── index.html.haml │ │ │ ├── _form.html.haml │ │ │ └── _advertisement.html.haml │ │ ├── topics │ │ │ ├── index.html.haml │ │ │ └── _table_view.html.haml │ │ ├── comments │ │ │ └── _comment.html.haml │ │ └── site_settings │ │ │ └── appearance.html.haml │ ├── pages │ │ ├── _nav_ruler.html.haml │ │ ├── _nav.html.haml │ │ └── show.html.haml │ ├── shared │ │ ├── _box_tip.html.haml │ │ ├── _content.html.haml │ │ ├── _rss.html.haml │ │ ├── _alert.html.haml │ │ ├── _preview_widget.html.haml │ │ ├── _head.html.haml │ │ ├── _community_stats.html.haml │ │ ├── _my_fav.html.haml │ │ ├── _meta.html.haml │ │ ├── _footer.html.haml │ │ ├── _google_analytics.html.haml │ │ ├── _ad.html.haml │ │ ├── _top.html.haml │ │ ├── _notification.html.haml │ │ └── _sidebar_box.html.haml │ ├── topics │ │ ├── move.js.haml │ │ ├── edit_title.js.haml │ │ ├── preview.text.haml │ │ ├── update_title.js.haml │ │ ├── _back_to_node.html.haml │ │ ├── index.html.haml │ │ ├── new.html.haml │ │ ├── show │ │ │ ├── _bookmarked_users.html.haml │ │ │ ├── _bookmark_button.html.haml │ │ │ ├── _comments.html.haml │ │ │ ├── _comment_form.html.haml │ │ │ └── _manage.html.haml │ │ ├── _move_form.js.haml │ │ ├── _title_form.html.haml │ │ ├── index.atom.builder │ │ ├── _form.html.haml │ │ ├── _topic.html.haml │ │ ├── new_from_home.html.slim │ │ ├── _profile_topic.html.haml │ │ ├── edit.html.haml │ │ └── _table_view.html.haml │ ├── users │ │ ├── _followed_ruler.html.haml │ │ ├── my_topics.html.haml │ │ ├── _followed_user.html.haml │ │ ├── topics.html.haml │ │ ├── _account_form.html.haml │ │ ├── my_following.html.haml │ │ ├── _password_form.html.haml │ │ ├── _account_detail_form.html.haml │ │ └── edit.html.haml │ ├── nodes │ │ ├── _item_node.html.haml │ │ ├── _node.html.haml │ │ ├── _bookmark_node.html.haml │ │ ├── _custom_fields.html.haml │ │ ├── _paginator.html.haml │ │ └── show.html.haml │ ├── comments │ │ ├── edit.js.haml │ │ ├── destroy.js.haml │ │ ├── update.js.haml │ │ ├── _form.js.haml │ │ └── _profile_comment.html.haml │ ├── welcome │ │ ├── _home_planes.html.haml │ │ ├── _rightbar_plane.html.haml │ │ ├── _rightbar_planes.html.haml │ │ ├── goodbye.html.haml │ │ ├── exception.html.haml │ │ ├── index.html.haml │ │ ├── _home_topics.html.haml │ │ └── sitemap.xml.builder │ ├── notifications │ │ └── index.html.haml │ ├── devise │ │ ├── registrations │ │ │ ├── new.html.haml │ │ │ ├── _form.html.haml │ │ │ └── edit.html.erb │ │ ├── mailer │ │ │ ├── confirmation_instructions.html.erb │ │ │ ├── reset_password_instructions.html.haml │ │ │ └── unlock_instructions.html.erb │ │ ├── unlocks │ │ │ └── new.html.erb │ │ ├── confirmations │ │ │ └── new.html.erb │ │ ├── passwords │ │ │ ├── new.html.haml │ │ │ └── edit.html.haml │ │ └── shared │ │ │ └── _links.erb │ ├── planes │ │ └── _plane.html.haml │ ├── kaminari │ │ ├── _gap.html.haml │ │ ├── _last_page.html.haml │ │ ├── _first_page.html.haml │ │ ├── _next_page.html.haml │ │ ├── _prev_page.html.haml │ │ ├── _page.html.haml │ │ └── _paginator.html.haml │ ├── layouts │ │ ├── application.html.haml │ │ └── admin.html.haml │ └── sessions │ │ └── new.html.haml ├── assets │ ├── images │ │ ├── bg.png │ │ ├── qbar.png │ │ ├── rss.png │ │ ├── star.png │ │ ├── ghost.png │ │ ├── heart.png │ │ ├── rails.png │ │ ├── admin │ │ │ ├── ads.png │ │ │ ├── bg.png │ │ │ ├── cloud.png │ │ │ ├── nodes.png │ │ │ ├── pages.png │ │ │ ├── users.png │ │ │ ├── member.png │ │ │ ├── palette.png │ │ │ ├── settings.png │ │ │ ├── topics.png │ │ │ ├── dashboard.png │ │ │ └── reward_history.png │ │ ├── loading.gif │ │ ├── bg_blended.png │ │ ├── dot_orange.png │ │ ├── heart-gray.png │ │ ├── mobile │ │ │ ├── gear.png │ │ │ ├── eject.png │ │ │ ├── eject48.png │ │ │ ├── gear48.png │ │ │ └── bg_section.png │ │ ├── bg_top_light.png │ │ ├── icon │ │ │ ├── location.png │ │ │ ├── mobileme.png │ │ │ ├── twitter.png │ │ │ ├── tx_weibo.png │ │ │ └── sina_weibo.png │ │ ├── reply_button.png │ │ ├── shadow_light.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png │ ├── javascripts │ │ ├── i_fileupload.js │ │ └── application.js │ └── stylesheets │ │ ├── global.css.scss │ │ └── application.css.scss ├── uploaders │ ├── picture_extension_white_list.rb │ ├── qiniu_image_uploader.rb │ └── uploader_helper.rb └── controllers │ ├── admin │ ├── welcome_admin_controller.rb │ ├── notifications_controller.rb │ ├── topics_controller.rb │ ├── site_settings_controller.rb │ ├── base_controller.rb │ ├── cloud_files_controller.rb │ ├── rewards_controller.rb │ ├── advertisements_controller.rb │ └── pages_controller.rb │ ├── pages_controller.rb │ ├── sessions_controller.rb │ ├── bookmarks_controller.rb │ ├── notifications_controller.rb │ ├── qiniu_images_controller.rb │ ├── upyun_images_controller.rb │ ├── nodes_controller.rb │ └── registrations_controller.rb ├── vendor ├── plugins │ └── .gitkeep └── assets │ └── stylesheets │ └── .gitkeep ├── .rspec ├── deploy ├── install_bundle.sh ├── migrate_database.sh ├── setup_database_once.sh ├── precompile_assets.sh ├── set_heroku_env.rb ├── shared.sh ├── stop_unicorn_manually.sh ├── kill_old_unicorn.sh ├── start_unicorn_manually.sh ├── reload_unicorn.sh ├── auto_start_unicorn.sh └── centos_6.4_install.sh ├── public ├── favicon.ico ├── avatar │ ├── default.png │ ├── mini_default.png │ └── medium_default.png ├── banner │ └── default.gif ├── apple-touch-icon.png ├── robots.txt ├── 422.html ├── 404.html └── 500.html ├── spec ├── models │ ├── reward_spec.rb │ ├── upyun_image_spec.rb │ ├── following_spec.rb │ ├── account_spec.rb │ ├── cloud_file_spec.rb │ ├── notification_spec.rb │ ├── page_spec.rb │ ├── plane_spec.rb │ ├── bookmark_spec.rb │ ├── advertisement_spec.rb │ ├── node_spec.rb │ ├── topic_spec.rb │ └── comment_spec.rb ├── controllers │ ├── upyun_images_controller_spec.rb │ ├── admin │ │ ├── rewards_controller_spec.rb │ │ ├── cloud_files_controller_spec.rb │ │ ├── notifications_controller_spec.rb │ │ ├── topics_controller_spec.rb │ │ ├── site_settings_controller_spec.rb │ │ ├── users_controller_spec.rb │ │ ├── advertisements_controller_spec.rb │ │ └── welcome_admin_controller_spec.rb │ ├── registrations_controller_spec.rb │ ├── nodes_controller_spec.rb │ ├── sessions_controller_spec.rb │ ├── welcome_controller_spec.rb │ ├── pages_controller_spec.rb │ └── notifications_controller_spec.rb ├── features │ └── users_spec.rb └── support │ ├── controller_matchers.rb │ └── controller_macros.rb ├── config ├── initializers │ ├── carrierwave.rb │ ├── cookies_serializer.rb │ ├── session_store.rb │ ├── mime_types.rb │ ├── i18n.rb │ ├── kaminari.rb │ ├── filter_parameter_logging.rb │ ├── monkey_patch.rb │ ├── version.rb │ ├── form_error.rb │ ├── backtrace_silencers.rb │ ├── assets.rb │ ├── wrap_parameters.rb │ ├── inflections.rb │ └── siteconf.rb ├── locales │ ├── views │ │ └── layout.zh.yml │ ├── en.yml │ ├── simple_form.zh.yml │ └── simple_form.en.yml ├── environment.rb ├── boot.rb ├── redis.conf ├── cucumber.yml ├── secrets.yml ├── database.yml.mysql └── database.yml.pg ├── .env-example ├── Procfile ├── test ├── support │ └── ads │ │ └── linode.png └── factories │ ├── planes.rb │ ├── bookmarks.rb │ ├── comments.rb │ ├── pages.rb │ ├── accounts.rb │ ├── notifications.rb │ ├── nodes.rb │ ├── advertisements.rb │ ├── topics.rb │ └── users.rb ├── bin ├── rake ├── bundle ├── rails ├── rspec └── cucumber ├── db └── migrate │ ├── 20111224111225_add_index_to_pages.rb │ ├── 20111208134052_add_index_to_accounts.rb │ ├── 20111209053640_add_index_to_nodes.rb │ ├── 20111224055101_add_avatar_to_users.rb │ ├── 20120404101032_add_updated_at_index_to_nodes.rb │ ├── 20120627194105_add_custom_css_to_nodes.rb │ ├── 20120316074203_add_updated_at_index_to_topics.rb │ ├── 20120404100838_add_updated_at_index_to_planes.rb │ ├── 20120626085113_add_reward_to_users.rb │ ├── 20150227153845_add_asset_to_qiniu_images.rb │ ├── 20120217131718_add_blocked_to_users.rb │ ├── 20120331142416_add_created_at_index_to_comments.rb │ ├── 20120404070333_add_updated_at_index_to_comments.rb │ ├── 20111209054959_add_index_to_topics.rb │ ├── 20120622053738_add_created_at_index_to_followings.rb │ ├── 20111209080432_add_plane_id_to_nodes.rb │ ├── 20120205011606_add_position_to_pages.rb │ ├── 20120206084156_add_position_to_nodes.rb │ ├── 20120427122531_add_position_to_planes.rb │ ├── 20150227151203_create_qiniu_images.rb │ ├── 20111224111624_add_admin_to_users.rb │ ├── 20120405071656_add_topics_count_to_nodes.rb │ ├── 20111209080245_create_planes.rb │ ├── 20120405045224_add_comments_count_to_topics.rb │ ├── 20120623133345_add_posting_device_to_comments.rb │ ├── 20120625011328_add_sticky_to_topics.rb │ ├── 20111207115533_add_nickname_to_users.rb │ ├── 20120106055211_add_role_to_users.rb │ ├── 20120624064847_add_comments_closed_to_topics.rb │ ├── 20120624124831_add_quiet_to_nodes.rb │ ├── 20111209061125_add_index_to_comments.rb │ ├── 20120104115917_add_published_to_pages.rb │ ├── 20121204031612_add_user_id_to_upyun_images.rb │ ├── 20111230121950_add_index_to_notifications.rb │ ├── 20121203081304_create_upyun_images.rb │ ├── 20111230165404_add_more_index_to_notifications.rb │ ├── 20120107134636_add_index_to_advertisements.rb │ ├── 20111217061017_add_index_to_bookmarks.rb │ ├── 20111224105955_create_pages.rb │ ├── 20111220135343_create_followings.rb │ ├── 20111220135535_add_index_to_followings.rb │ ├── 20111209053551_create_nodes.rb │ ├── 20111217060752_create_bookmarks.rb │ ├── 20120428141950_create_cloud_files.rb │ ├── 20111209054915_create_topics.rb │ ├── 20111209060937_create_comments.rb │ ├── 20121204032057_add_size_and_filename_and_content_type_to_upyun_images.rb │ ├── 20120405064209_set_comments_count_on_topics.rb │ ├── 20120405072538_set_topics_count_on_nodes.rb │ ├── 20111208133931_create_accounts.rb │ ├── 20120727092241_add_last_replied_at_to_topics.rb │ ├── 20150227152429_add_size_and_filename_and_content_type_to_qiniu_images.rb │ ├── 20120627121746_create_rewards.rb │ ├── 20120107134203_create_advertisements.rb │ ├── 20120722021548_add_last_replied_by_to_topics.rb │ ├── 20111230121459_create_notifications.rb │ ├── 20120304140424_create_settings.rb │ ├── 20120316134205_add_involved_at_to_topics.rb │ └── 20120722031529_add_weibo_link_to_accounts.rb ├── config.ru ├── doc └── README_FOR_APP ├── features ├── step_definitions │ ├── password.rb │ ├── ad.rb │ ├── comments.rb │ ├── session.rb │ ├── plane.rb │ ├── mobile.rb │ ├── page.rb │ ├── bookmark.rb │ └── node.rb ├── passwords.feature ├── support │ └── named_routes_fix.rb ├── admin │ ├── topics.feature │ ├── base.feature │ ├── users.feature │ ├── ads.feature │ └── nodes.feature ├── session.feature ├── bookmarks.feature ├── pages.feature ├── homepage.feature └── comments.feature ├── Rakefile ├── README.md └── .gitignore /log/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/pids/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.2.0 2 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/sockets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /app/models/channel.rb: -------------------------------------------------------------------------------- 1 | class Channel < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/qiniu_images_helper.rb: -------------------------------------------------------------------------------- 1 | module QiniuImagesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/views/admin/planes/destroy.js.haml: -------------------------------------------------------------------------------- 1 | $("##{@plane.html_id}").hide() 2 | -------------------------------------------------------------------------------- /deploy/install_bundle.sh: -------------------------------------------------------------------------------- 1 | bundle install --without development test 2 | -------------------------------------------------------------------------------- /app/views/pages/_nav_ruler.html.haml: -------------------------------------------------------------------------------- 1 |   2 | %span.snow · 3 |   4 | -------------------------------------------------------------------------------- /app/views/shared/_box_tip.html.haml: -------------------------------------------------------------------------------- 1 | .glass 2 | .inner.center 3 | = tip 4 | -------------------------------------------------------------------------------- /deploy/migrate_database.sh: -------------------------------------------------------------------------------- 1 | RAILS_ENV=production bundle exec rake db:migrate 2 | -------------------------------------------------------------------------------- /deploy/setup_database_once.sh: -------------------------------------------------------------------------------- 1 | RAILS_ENV=production bundle exec rake db:setup 2 | -------------------------------------------------------------------------------- /app/views/admin/nodes/move_to.js.haml: -------------------------------------------------------------------------------- 1 | window.location.href = "#{admin_planes_path}" 2 | -------------------------------------------------------------------------------- /app/views/topics/move.js.haml: -------------------------------------------------------------------------------- 1 | $.facebox("#{escape_javascript(render('move_form'))}") 2 | -------------------------------------------------------------------------------- /deploy/precompile_assets.sh: -------------------------------------------------------------------------------- 1 | RAILS_ENV=production bundle exec rake assets:precompile 2 | -------------------------------------------------------------------------------- /app/views/admin/nodes/move.js.haml: -------------------------------------------------------------------------------- 1 | $.facebox("#{escape_javascript(render 'move_form')}") 2 | -------------------------------------------------------------------------------- /app/views/admin/planes/_sort_plane.html.haml: -------------------------------------------------------------------------------- 1 | .sort_item{:id => plane.html_id}= plane.name 2 | -------------------------------------------------------------------------------- /app/views/admin/rewards/new.js.haml: -------------------------------------------------------------------------------- 1 | $.facebox('#{escape_javascript render('form')}'); 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/public/favicon.ico -------------------------------------------------------------------------------- /spec/models/reward_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Reward do 4 | end 5 | -------------------------------------------------------------------------------- /app/views/topics/edit_title.js.haml: -------------------------------------------------------------------------------- 1 | $.facebox("#{escape_javascript(render('title_form'))}") 2 | -------------------------------------------------------------------------------- /app/views/users/_followed_ruler.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td.ruler{:colspan => 2} 3 | .ruler 4 | -------------------------------------------------------------------------------- /spec/models/upyun_image_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe UpyunImage do 4 | end 5 | -------------------------------------------------------------------------------- /config/initializers/carrierwave.rb: -------------------------------------------------------------------------------- 1 | CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:]\.\-\+]/ 2 | -------------------------------------------------------------------------------- /.env-example: -------------------------------------------------------------------------------- 1 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin: 2 | RAILS_ENV= 3 | REDIS_CONFIG_PATH= 4 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec thin start -p $PORT -e $RAILS_ENV 2 | redis: redis-server $REDIS_CONFIG_PATH 3 | -------------------------------------------------------------------------------- /app/assets/images/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/bg.png -------------------------------------------------------------------------------- /app/assets/images/qbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/qbar.png -------------------------------------------------------------------------------- /app/assets/images/rss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/rss.png -------------------------------------------------------------------------------- /app/assets/images/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/star.png -------------------------------------------------------------------------------- /public/avatar/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/public/avatar/default.png -------------------------------------------------------------------------------- /public/banner/default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/public/banner/default.gif -------------------------------------------------------------------------------- /app/assets/images/ghost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ghost.png -------------------------------------------------------------------------------- /app/assets/images/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/heart.png -------------------------------------------------------------------------------- /app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/rails.png -------------------------------------------------------------------------------- /app/views/admin/planes/show_form.js.haml: -------------------------------------------------------------------------------- 1 | $.facebox("#{escape_javascript(render('form', :plane => @plane))}"); 2 | -------------------------------------------------------------------------------- /app/views/nodes/_item_node.html.haml: -------------------------------------------------------------------------------- 1 | = link_to item_node.name, go_path(item_node.key), :class => :item_node 2 | -------------------------------------------------------------------------------- /app/views/topics/preview.text.haml: -------------------------------------------------------------------------------- 1 | - format_method = "format_#{@type}" 2 | = send(format_method, @content) 3 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/public/apple-touch-icon.png -------------------------------------------------------------------------------- /test/support/ads/linode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/test/support/ads/linode.png -------------------------------------------------------------------------------- /app/assets/images/admin/ads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/ads.png -------------------------------------------------------------------------------- /app/assets/images/admin/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/bg.png -------------------------------------------------------------------------------- /app/assets/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/loading.gif -------------------------------------------------------------------------------- /app/views/comments/edit.js.haml: -------------------------------------------------------------------------------- 1 | $.facebox("#{escape_javascript(render('form'))}"); 2 | $("textarea").elastic() 3 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /public/avatar/mini_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/public/avatar/mini_default.png -------------------------------------------------------------------------------- /app/assets/images/admin/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/cloud.png -------------------------------------------------------------------------------- /app/assets/images/admin/nodes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/nodes.png -------------------------------------------------------------------------------- /app/assets/images/admin/pages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/pages.png -------------------------------------------------------------------------------- /app/assets/images/admin/users.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/users.png -------------------------------------------------------------------------------- /app/assets/images/bg_blended.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/bg_blended.png -------------------------------------------------------------------------------- /app/assets/images/dot_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/dot_orange.png -------------------------------------------------------------------------------- /app/assets/images/heart-gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/heart-gray.png -------------------------------------------------------------------------------- /app/assets/images/mobile/gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/mobile/gear.png -------------------------------------------------------------------------------- /app/views/admin/planes/create.js.haml: -------------------------------------------------------------------------------- 1 | $("#planes").append("#{escape_javascript render(@plane)}") 2 | $.facebox.close() 3 | -------------------------------------------------------------------------------- /app/views/nodes/_node.html.haml: -------------------------------------------------------------------------------- 1 | = link_to node.name, go_path(node.key), :class => "rabel item_node node_#{node.key}" 2 | -------------------------------------------------------------------------------- /public/avatar/medium_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/public/avatar/medium_default.png -------------------------------------------------------------------------------- /app/assets/images/admin/member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/member.png -------------------------------------------------------------------------------- /app/assets/images/admin/palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/palette.png -------------------------------------------------------------------------------- /app/assets/images/admin/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/settings.png -------------------------------------------------------------------------------- /app/assets/images/admin/topics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/topics.png -------------------------------------------------------------------------------- /app/assets/images/bg_top_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/bg_top_light.png -------------------------------------------------------------------------------- /app/assets/images/icon/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/icon/location.png -------------------------------------------------------------------------------- /app/assets/images/icon/mobileme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/icon/mobileme.png -------------------------------------------------------------------------------- /app/assets/images/icon/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/icon/twitter.png -------------------------------------------------------------------------------- /app/assets/images/icon/tx_weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/icon/tx_weibo.png -------------------------------------------------------------------------------- /app/assets/images/mobile/eject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/mobile/eject.png -------------------------------------------------------------------------------- /app/assets/images/mobile/eject48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/mobile/eject48.png -------------------------------------------------------------------------------- /app/assets/images/mobile/gear48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/mobile/gear48.png -------------------------------------------------------------------------------- /app/assets/images/reply_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/reply_button.png -------------------------------------------------------------------------------- /app/assets/images/shadow_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/shadow_light.png -------------------------------------------------------------------------------- /app/views/comments/destroy.js.haml: -------------------------------------------------------------------------------- 1 | $("##{@comment.html_id}").effect('highlight'); 2 | $("##{@comment.html_id}").slideUp(); 3 | -------------------------------------------------------------------------------- /app/views/topics/update_title.js.haml: -------------------------------------------------------------------------------- 1 | $("#topic_title").html("#{escape_javascript(@topic.title)}"); 2 | $.facebox.close(); 3 | -------------------------------------------------------------------------------- /app/assets/images/admin/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/dashboard.png -------------------------------------------------------------------------------- /app/assets/images/icon/sina_weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/icon/sina_weibo.png -------------------------------------------------------------------------------- /app/views/users/my_topics.html.haml: -------------------------------------------------------------------------------- 1 | .box.fix_cell 2 | .cell= build_navigation([@title]) 3 | = render @my_topics 4 | .inner 5 | -------------------------------------------------------------------------------- /spec/controllers/upyun_images_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe UpyunImagesController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /app/assets/images/mobile/bg_section.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/mobile/bg_section.png -------------------------------------------------------------------------------- /app/views/topics/_back_to_node.html.haml: -------------------------------------------------------------------------------- 1 | %span.fade 2 | %span.chevron ‹  3 | 返回 4 | = link_to node.name, go_path(node.key) 5 | -------------------------------------------------------------------------------- /app/assets/images/admin/reward_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/admin/reward_history.png -------------------------------------------------------------------------------- /app/views/shared/_content.html.haml: -------------------------------------------------------------------------------- 1 | - if flash_messages.any? 2 | .box 3 | .inner 4 | = show_flash_messages 5 | = yield 6 | 7 | -------------------------------------------------------------------------------- /app/assets/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /app/assets/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /app/assets/javascripts/i_fileupload.js: -------------------------------------------------------------------------------- 1 | //= require jquery-ui/widget 2 | //= require jquery.iframe-transport 3 | //= require jquery.fileupload 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/global.css.scss: -------------------------------------------------------------------------------- 1 | $container-desktop: 960px; 2 | $container-large-desktop: $container-desktop; 3 | $grid-gutter-width: 15px; 4 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /app/assets/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /app/assets/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /app/assets/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /app/views/admin/nodes/show_form.js.haml: -------------------------------------------------------------------------------- 1 | $.facebox("#{escape_javascript(render('form', :plane => @plane, :node => @node))}"); 2 | $("textarea").elastic() 3 | -------------------------------------------------------------------------------- /app/views/shared/_rss.html.haml: -------------------------------------------------------------------------------- 1 | = image_tag 'rss.png', :align => :absmiddle 2 | = link_to 'RSS', topics_path(:atom), :target => '_blank', :class => :dark 3 | -------------------------------------------------------------------------------- /app/uploaders/picture_extension_white_list.rb: -------------------------------------------------------------------------------- 1 | module PictureExtensionWhiteList 2 | def extension_white_list 3 | %w(jpg jpeg gif png) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/views/topics/index.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell= build_navigation([@title]) 3 | = render @topics 4 | .inner{:align => :center} 5 | = paginate @topics 6 | -------------------------------------------------------------------------------- /app/views/welcome/_home_planes.html.haml: -------------------------------------------------------------------------------- 1 | .box.fix_cell#planes 2 | .box-header 3 | %Strong= Siteconf.site_name 4 | \/ 节点导航 5 | = render Plane.all 6 | -------------------------------------------------------------------------------- /app/views/welcome/_rightbar_plane.html.haml: -------------------------------------------------------------------------------- 1 | .cell 2 | %span.gray= plane.name 3 | .sep5 4 | = render plane.nodes.order(Node.default_order_str).limit(20) 5 | -------------------------------------------------------------------------------- /db/migrate/20111224111225_add_index_to_pages.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToPages < ActiveRecord::Migration 2 | def change 3 | add_index :pages, :key 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiajian/rabel/v1.5-stable/app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css.scss: -------------------------------------------------------------------------------- 1 | 2 | @import "global"; 3 | @import "bootstrap"; 4 | @import "jquery.facebox"; 5 | @import "core"; 6 | @import "rabel_theme"; 7 | -------------------------------------------------------------------------------- /app/views/comments/update.js.haml: -------------------------------------------------------------------------------- 1 | $("##{@comment.html_id}").find('.reply_content').html('#{escape_javascript(parse_markdown(@comment.content))}'); 2 | $.facebox.close(); 3 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /config/locales/views/layout.zh.yml: -------------------------------------------------------------------------------- 1 | zh: 2 | homepage: '首页' 3 | sign_in: '登入' 4 | sign_up: '注册' 5 | sign_out: '退出' 6 | search: '搜索话题' 7 | dashboard: '管理后台' 8 | -------------------------------------------------------------------------------- /db/migrate/20111208134052_add_index_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToAccounts < ActiveRecord::Migration 2 | def change 3 | add_index :accounts, :user_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/views/admin/cloud_files/new.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_admin_navigation([link_to('文件上传', admin_cloud_files_path), @title]) 4 | .inner 5 | = render 'form' 6 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /db/migrate/20111209053640_add_index_to_nodes.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToNodes < ActiveRecord::Migration 2 | def change 3 | add_index :nodes, :key, :unique => true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20111224055101_add_avatar_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAvatarToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :avatar, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/following_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Following do 4 | it { should belong_to(:follower) } 5 | it { should belong_to(:followed_user) } 6 | end 7 | -------------------------------------------------------------------------------- /app/views/admin/users/toggle_admin.js.haml: -------------------------------------------------------------------------------- 1 | $("##{@user.html_id}").replaceWith("#{escape_javascript(render('user', :user => @user))}"); 2 | $("##{@user.html_id}").effect('highlight'); 3 | -------------------------------------------------------------------------------- /app/views/admin/users/toggle_blocked.js.haml: -------------------------------------------------------------------------------- 1 | $("##{@user.html_id}").replaceWith("#{escape_javascript(render('user', :user => @user))}"); 2 | $("##{@user.html_id}").effect('highlight'); 3 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | 5 | -------------------------------------------------------------------------------- /app/views/admin/pages/action.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_admin_navigation([link_to('页面管理', admin_pages_path), @title]) 4 | .inner 5 | = render 'form', :page => @page 6 | -------------------------------------------------------------------------------- /app/views/notifications/index.html.haml: -------------------------------------------------------------------------------- 1 | .box.notifications 2 | .cell 3 | = build_navigation([@title]) 4 | = render :partial => 'shared/notification', :collection => @notifications 5 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /db/migrate/20120404101032_add_updated_at_index_to_nodes.rb: -------------------------------------------------------------------------------- 1 | class AddUpdatedAtIndexToNodes < ActiveRecord::Migration 2 | def change 3 | add_index :nodes, :updated_at 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120627194105_add_custom_css_to_nodes.rb: -------------------------------------------------------------------------------- 1 | class AddCustomCssToNodes < ActiveRecord::Migration 2 | def change 3 | add_column :nodes, :custom_css, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/views/admin/nodes/create.js.haml: -------------------------------------------------------------------------------- 1 | $("##{@plane.html_id}").append("#{escape_javascript render(@node) }") 2 | $("##{@plane.html_id} .cell:first .fr a.btn-danger").hide() 3 | $.facebox.close() 4 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: Figaro.env.RABEL_SESSION_KEY 4 | -------------------------------------------------------------------------------- /db/migrate/20120316074203_add_updated_at_index_to_topics.rb: -------------------------------------------------------------------------------- 1 | class AddUpdatedAtIndexToTopics < ActiveRecord::Migration 2 | def change 3 | add_index :topics, :updated_at 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120404100838_add_updated_at_index_to_planes.rb: -------------------------------------------------------------------------------- 1 | class AddUpdatedAtIndexToPlanes < ActiveRecord::Migration 2 | def change 3 | add_index :planes, :updated_at 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120626085113_add_reward_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddRewardToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :reward, :integer, :default => 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150227153845_add_asset_to_qiniu_images.rb: -------------------------------------------------------------------------------- 1 | class AddAssetToQiniuImages < ActiveRecord::Migration 2 | def change 3 | add_column :qiniu_images, :asset, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/admin/rewards_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Admin::RewardsController do 4 | it { should extend_the_controller(Admin::BaseController) } 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/account_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Account do 4 | it { should belong_to(:user) } 5 | it { should validate_length_of(:signature).is_at_most(20) } 6 | end 7 | -------------------------------------------------------------------------------- /spec/models/cloud_file_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe CloudFile do 4 | 5 | it { should validate_presence_of(:name) } 6 | it { should validate_presence_of(:asset) } 7 | end 8 | -------------------------------------------------------------------------------- /app/views/admin/advertisements/edit.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_admin_navigation([link_to('广告位', admin_advertisements_path), @title]) 4 | .inner 5 | = render 'form', :ad => @ad 6 | -------------------------------------------------------------------------------- /app/views/admin/advertisements/new.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_admin_navigation([link_to('广告位', admin_advertisements_path), @title]) 4 | .inner 5 | = render 'form', :ad => @ad 6 | -------------------------------------------------------------------------------- /app/views/admin/nodes/destroy.js.haml: -------------------------------------------------------------------------------- 1 | $("##{@node.html_id}").hide() 2 | - if @node.plane.can_delete? 3 | $("##{@node.plane.html_id}").replaceWith("#{escape_javascript render(@node.plane)}") 4 | 5 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /db/migrate/20120217131718_add_blocked_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddBlockedToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :blocked, :boolean, :default => false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120331142416_add_created_at_index_to_comments.rb: -------------------------------------------------------------------------------- 1 | class AddCreatedAtIndexToComments < ActiveRecord::Migration 2 | def change 3 | add_index :comments, :created_at 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120404070333_add_updated_at_index_to_comments.rb: -------------------------------------------------------------------------------- 1 | class AddUpdatedAtIndexToComments < ActiveRecord::Migration 2 | def change 3 | add_index :comments, :updated_at 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/admin/cloud_files_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Admin::CloudFilesController do 4 | it { should extend_the_controller(Admin::BaseController) } 5 | end 6 | -------------------------------------------------------------------------------- /app/models/following.rb: -------------------------------------------------------------------------------- 1 | class Following < ActiveRecord::Base 2 | belongs_to :follower, :class_name => 'User', :foreign_key => 'user_id' 3 | belongs_to :followed_user, :class_name => 'User' 4 | end 5 | -------------------------------------------------------------------------------- /app/views/admin/planes/sort.js.haml: -------------------------------------------------------------------------------- 1 | $.facebox("#{escape_javascript render('sort_planes', :planes => @planes, :formats => :html)}"); 2 | rabel.sortable("#facebox .content", "#{sort_admin_planes_path}") 3 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /db/migrate/20111209054959_add_index_to_topics.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToTopics < ActiveRecord::Migration 2 | def change 3 | add_index :topics, :node_id 4 | add_index :topics, :user_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120622053738_add_created_at_index_to_followings.rb: -------------------------------------------------------------------------------- 1 | class AddCreatedAtIndexToFollowings < ActiveRecord::Migration 2 | def change 3 | add_index :followings, :created_at 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /deploy/set_heroku_env.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'yaml' 3 | 4 | envs = YAML.load_file('./config/application.yml') 5 | kv = envs.map {|k, v| "#{k}=\"#{v}\""} 6 | `heroku config:add #{kv.join(' ')}` 7 | -------------------------------------------------------------------------------- /spec/controllers/admin/notifications_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Admin::NotificationsController do 4 | it { should extend_the_controller(Admin::BaseController) } 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/registrations_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe RegistrationsController do 4 | it { should extend_the_controller(Devise::RegistrationsController) } 5 | end 6 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.haml: -------------------------------------------------------------------------------- 1 | - @title = '注册' 2 | - @seo_description = @title 3 | .box 4 | .cell 5 | = build_navigation([@title]) 6 | .inner 7 | = render 'devise/registrations/form' 8 | -------------------------------------------------------------------------------- /app/views/welcome/_rightbar_planes.html.haml: -------------------------------------------------------------------------------- 1 | .box.fix_cell 2 | .box-header 3 | 节点导航 4 | = render :partial => 'rightbar_plane', :collection => Plane.all.order(Plane.default_order_str), :as => :plane 5 | 6 | -------------------------------------------------------------------------------- /test/factories/planes.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at http://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :plane do 5 | sequence(:name) { |n| "Plane - #{n}" } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20111209080432_add_plane_id_to_nodes.rb: -------------------------------------------------------------------------------- 1 | class AddPlaneIdToNodes < ActiveRecord::Migration 2 | def change 3 | add_column :nodes, :plane_id, :integer 4 | add_index :nodes, :plane_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120205011606_add_position_to_pages.rb: -------------------------------------------------------------------------------- 1 | class AddPositionToPages < ActiveRecord::Migration 2 | def change 3 | add_column :pages, :position, :integer 4 | add_index :pages, :position 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120206084156_add_position_to_nodes.rb: -------------------------------------------------------------------------------- 1 | class AddPositionToNodes < ActiveRecord::Migration 2 | def change 3 | add_column :nodes, :position, :integer 4 | add_index :nodes, :position 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120427122531_add_position_to_planes.rb: -------------------------------------------------------------------------------- 1 | class AddPositionToPlanes < ActiveRecord::Migration 2 | def change 3 | add_column :planes, :position, :integer, :null => false, :default => 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150227151203_create_qiniu_images.rb: -------------------------------------------------------------------------------- 1 | class CreateQiniuImages < ActiveRecord::Migration 2 | def change 3 | create_table :qiniu_images do |t| 4 | 5 | t.timestamps 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/views/admin/topics/index.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_admin_navigation([@title]) 4 | .cell 5 | = render 'table_view', :topics => @topics 6 | .inner{:align => :center} 7 | = paginate @topics 8 | 9 | -------------------------------------------------------------------------------- /app/models/bookmark.rb: -------------------------------------------------------------------------------- 1 | class Bookmark < ActiveRecord::Base 2 | validates :user_id, :bookmarkable_type, :bookmarkable_id, :presence => true 3 | 4 | belongs_to :user 5 | belongs_to :bookmarkable, :polymorphic => true 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20111224111624_add_admin_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAdminToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :admin, :boolean, :default => false 4 | add_index :users, :admin 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120405071656_add_topics_count_to_nodes.rb: -------------------------------------------------------------------------------- 1 | class AddTopicsCountToNodes < ActiveRecord::Migration 2 | def change 3 | add_column :nodes, :topics_count, :integer, :null => false, :default => 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/notification_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Notification do 4 | it { should belong_to(:user) } 5 | it { should belong_to(:action_user) } 6 | it { should belong_to(:notifiable) } 7 | 8 | end 9 | -------------------------------------------------------------------------------- /spec/models/page_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Page do 4 | it { should validate_presence_of(:key) } 5 | it { should validate_presence_of(:title) } 6 | it { should validate_presence_of(:content) } 7 | end 8 | -------------------------------------------------------------------------------- /app/views/topics/new.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_navigation [link_to(@node.name, go_path(@node.key))] 4 | .inner 5 | %h2 创建新话题 6 | = render 'form', :node => @node, :topic => @topic, :comments_closed => false 7 | -------------------------------------------------------------------------------- /db/migrate/20111209080245_create_planes.rb: -------------------------------------------------------------------------------- 1 | class CreatePlanes < ActiveRecord::Migration 2 | def change 3 | create_table :planes do |t| 4 | t.string :name 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20120405045224_add_comments_count_to_topics.rb: -------------------------------------------------------------------------------- 1 | class AddCommentsCountToTopics < ActiveRecord::Migration 2 | def change 3 | add_column :topics, :comments_count, :integer, :null => false, :default => 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120623133345_add_posting_device_to_comments.rb: -------------------------------------------------------------------------------- 1 | class AddPostingDeviceToComments < ActiveRecord::Migration 2 | def change 3 | add_column :comments, :posting_device, :string, null: false, default: '' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120625011328_add_sticky_to_topics.rb: -------------------------------------------------------------------------------- 1 | class AddStickyToTopics < ActiveRecord::Migration 2 | def change 3 | add_column :topics, :sticky, :boolean, default: false 4 | add_index :topics, :sticky 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /config/initializers/i18n.rb: -------------------------------------------------------------------------------- 1 | module I18n 2 | def self.custom_handler(exception, key, locale, options) 3 | # custom error handling logic 4 | locale.to_s.humanize 5 | end 6 | end 7 | 8 | I18n.exception_handler = :custom_handler 9 | -------------------------------------------------------------------------------- /db/migrate/20111207115533_add_nickname_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddNicknameToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :nickname, :string 4 | add_index :users, :nickname, :unique => true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120106055211_add_role_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddRoleToUsers < ActiveRecord::Migration 2 | def change 3 | remove_column :users, :admin 4 | add_column :users, :role, :string 5 | add_index :users, :role 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20120624064847_add_comments_closed_to_topics.rb: -------------------------------------------------------------------------------- 1 | class AddCommentsClosedToTopics < ActiveRecord::Migration 2 | def change 3 | add_column :topics, :comments_closed, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120624124831_add_quiet_to_nodes.rb: -------------------------------------------------------------------------------- 1 | class AddQuietToNodes < ActiveRecord::Migration 2 | def change 3 | add_column :nodes, :quiet, :boolean, null: false, default: false 4 | add_index :nodes, :quiet 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/models/plane_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Plane do 4 | it { should validate_presence_of(:name) } 5 | it { should have_many(:nodes) } 6 | it { should_not have_many(:nodes).dependent(:destroy) } 7 | 8 | end 9 | -------------------------------------------------------------------------------- /test/factories/bookmarks.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at http://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :bookmark do 5 | user 6 | association :bookmarkable, :factory => :topic 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/views/admin/rewards/create.js.haml: -------------------------------------------------------------------------------- 1 | :plain 2 | var balance = $("#reward_balance") 3 | if (balance.length > 0) { 4 | balance.html("#{@user.reward}"); 5 | $.facebox.close(); 6 | } else { 7 | window.location.reload(); 8 | } 9 | -------------------------------------------------------------------------------- /app/views/nodes/_bookmark_node.html.haml: -------------------------------------------------------------------------------- 1 | %tr 2 | %td{:width => '50', :align => :right, :valign => :middle} 3 | .howmany= node.topics.count 4 | %td{:width => :auto, :align => :left} 5 | %h3= link_to node.name, go_path(node.key) 6 | 7 | -------------------------------------------------------------------------------- /config/initializers/kaminari.rb: -------------------------------------------------------------------------------- 1 | module Kaminari 2 | module Helpers 3 | class Tag 4 | def page_url_for(page) 5 | @template.url_for @params.merge(@param_name => (page < 1 ? nil : page)) 6 | end 7 | end 8 | end 9 | end -------------------------------------------------------------------------------- /config/redis.conf: -------------------------------------------------------------------------------- 1 | daemonize no 2 | bind 127.0.0.1 3 | port 6379 4 | timeout 0 5 | databases 16 6 | 7 | save 900 1 8 | save 300 10 9 | save 60 10000 10 | 11 | dir /usr/local/var/db/redis 12 | appendonly no 13 | appendfsync everysec 14 | -------------------------------------------------------------------------------- /db/migrate/20111209061125_add_index_to_comments.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToComments < ActiveRecord::Migration 2 | def change 3 | add_index :comments, :user_id 4 | add_index :comments, [:commentable_id, :commentable_type] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120104115917_add_published_to_pages.rb: -------------------------------------------------------------------------------- 1 | class AddPublishedToPages < ActiveRecord::Migration 2 | def change 3 | add_column :pages, :published, :boolean, :default => false 4 | add_index :pages, :published 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20121204031612_add_user_id_to_upyun_images.rb: -------------------------------------------------------------------------------- 1 | class AddUserIdToUpyunImages < ActiveRecord::Migration 2 | def change 3 | add_column :upyun_images, :user_id, :integer 4 | add_index :upyun_images, :user_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /deploy/shared.sh: -------------------------------------------------------------------------------- 1 | # shared library 2 | log_error() { 3 | echo -e "\033[1;31m$1\033[0m" 4 | } 5 | 6 | log_info() { 7 | echo -e "\033[1;32m$1\033[0m" 8 | } 9 | 10 | log_warning() { 11 | echo -e "\033[1;41m$1\033[0m" 12 | } 13 | 14 | -------------------------------------------------------------------------------- /app/views/admin/nodes/update.js.haml: -------------------------------------------------------------------------------- 1 | - target_id = '#' + @node.html_id 2 | $.facebox.close() 3 | $("#{target_id}").replaceWith("#{escape_javascript(render @node)}"); 4 | setTimeout(function() { 5 | $("#{target_id}").effect('highlight') 6 | }, 500) 7 | -------------------------------------------------------------------------------- /app/views/shared/_alert.html.haml: -------------------------------------------------------------------------------- 1 | - if flash[:notice].present? 2 | %p.alert.alert-info= notice 3 | - if flash[:success].present? 4 | %p.alert.alert-success= flash[:success] 5 | - if flash[:alert].present? 6 | %p.alert.alert-error= flash[:alert] 7 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /db/migrate/20111230121950_add_index_to_notifications.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToNotifications < ActiveRecord::Migration 2 | def change 3 | change_table :notifications do |t| 4 | t.index :user_id 5 | t.index :unread 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20121203081304_create_upyun_images.rb: -------------------------------------------------------------------------------- 1 | class CreateUpyunImages < ActiveRecord::Migration 2 | def change 3 | create_table :upyun_images do |t| 4 | t.string :asset 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/views/users/_followed_user.html.haml: -------------------------------------------------------------------------------- 1 | - nickname = followed_user.nickname 2 | %li 3 | .thumbnail 4 | = link_to member_path(nickname), :title => nickname do 5 | = large_avatar(followed_user) 6 | .sep5 7 | .caption.center 8 | = nickname 9 | -------------------------------------------------------------------------------- /db/migrate/20111230165404_add_more_index_to_notifications.rb: -------------------------------------------------------------------------------- 1 | class AddMoreIndexToNotifications < ActiveRecord::Migration 2 | def change 3 | change_table :notifications do |t| 4 | t.index [:notifiable_id, :notifiable_type] 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /features/step_definitions/password.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | When /^I fill in the password reset form$/ do 3 | u = User.first 4 | fill_in "user[nickname]", :with => u.nickname 5 | fill_in "user[email]", :with => u.email 6 | click_button '重新设置密码' 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/admin/welcome_admin_controller.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | class Admin::WelcomeAdminController < Admin::BaseController 3 | def index 4 | @title = '运行状态' 5 | @notifications_to_clear = Notification.where(:unread => false).count 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/models/plane.rb: -------------------------------------------------------------------------------- 1 | class Plane < ActiveRecord::Base 2 | include Sortable 3 | 4 | validates :name, :presence => true 5 | has_many :nodes, -> { order(Node.default_order_str) } 6 | 7 | def can_delete? 8 | self.nodes.count == 0 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/admin/cloud_files/_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for [:admin, @file], :multipart => true do |f| 2 | = f.input :asset, :label => '选择要上传的文件' 3 | = f.input :name, :label => '简要描述' 4 | .form-actions 5 | = f.submit '上传', :class => 'btn btn-sm btn-primary' 6 | -------------------------------------------------------------------------------- /db/migrate/20120107134636_add_index_to_advertisements.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToAdvertisements < ActiveRecord::Migration 2 | def change 3 | change_table :advertisements do |t| 4 | t.index :start_date 5 | t.index :expire_date 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/views/users/topics.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_navigation([@title]) 4 | .cell 5 | = render :partial => 'topics/profile_topic', :collection => @topics, :as => :topic, :locals => {:topic_user => @user} 6 | = paginate @topics if @topics.any? 7 | 8 | -------------------------------------------------------------------------------- /db/migrate/20111217061017_add_index_to_bookmarks.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToBookmarks < ActiveRecord::Migration 2 | def change 3 | change_table :bookmarks do |t| 4 | t.index :user_id 5 | t.index [:bookmarkable_id, :bookmarkable_type] 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/factories/comments.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at http://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :comment do 5 | user 6 | association :commentable, :factory => :topic 7 | content 'great!' 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/views/admin/advertisements/index.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .inner 3 | .fr 4 | = admin_create_button('添加新广告', :advertisement) 5 | = build_admin_navigation([@title]) 6 | 7 | .row 8 | = render @ads, :today => Time.zone.today 9 | 10 | = paginate @ads 11 | 12 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password, :password_confirmation] 5 | -------------------------------------------------------------------------------- /app/controllers/admin/notifications_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::NotificationsController < Admin::BaseController 2 | # only delete read notifications 3 | def clear 4 | Notification.where(:unread => false).delete_all 5 | 6 | redirect_to admin_root_path 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/models/page.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | class Page < ActiveRecord::Base 3 | include Sortable 4 | 5 | acts_as_list 6 | 7 | validates :key, :title, :content, :presence => true 8 | 9 | def self.only_published 10 | where(:published => true) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/admin/planes/_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for [:admin, plane], :remote => true do |f| 2 | %legend= @title 3 | = f.input :name, :label => '名称', :input_html => {:autofocus => true} 4 | .form-actions 5 | = f.submit '保存', :class => 'btn btn-small btn-primary' 6 | 7 | -------------------------------------------------------------------------------- /app/views/admin/planes/_sort_planes.html.haml: -------------------------------------------------------------------------------- 1 | %strong 位面拖动排序 2 | = render :partial => 'sort_plane', :collection => planes, :as => :plane, :formats => :html 3 | .sort_actions.center 4 | = link_to '完成排序', 'javascript:window.location.reload()', :class => 'btn btn-small btn-primary' 5 | -------------------------------------------------------------------------------- /app/views/topics/show/_bookmarked_users.html.haml: -------------------------------------------------------------------------------- 1 | - if @total_bookmarks > 0 2 | - content_for :rightbar do 3 | .box 4 | .box-header 5 | 收藏此话题的成员 6 | .inner 7 | - @topic.bookmarks.each do |b| 8 | = user_profile_avatar_link(b.user, :mini) 9 | -------------------------------------------------------------------------------- /db/migrate/20111224105955_create_pages.rb: -------------------------------------------------------------------------------- 1 | class CreatePages < ActiveRecord::Migration 2 | def change 3 | create_table :pages do |t| 4 | t.string :key 5 | t.string :title 6 | t.text :content 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20111220135343_create_followings.rb: -------------------------------------------------------------------------------- 1 | class CreateFollowings < ActiveRecord::Migration 2 | def change 3 | create_table :followings do |t| 4 | t.integer :user_id 5 | t.integer :followed_user_id 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Rabel 2 | 3 | 基于 Ruby on Rails 框架开发的开源论坛系统。 4 | 5 | ## 理念 6 | 7 | 去掉一切繁杂功能,让论坛回归交流本质。 8 | 9 | ## 授权协议 10 | 11 | 采用[MIT](http://opensource.org/licenses/MIT)开源协议授权。 12 | 13 | ## 致谢 14 | 15 | Rabel 论坛系统受到[Project Babel 2](https://github.com/livid/v2ex)启发,特此感谢。 16 | 17 | -------------------------------------------------------------------------------- /app/views/comments/_form.js.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for @comment, :remote => true do |f| 2 | %legend 修改回复 3 | = f.input :content, :input_html => {:autofocus => true, :rows => 3, :class => :span5}, :label => false 4 | .form-actions 5 | = f.submit '保存', :class => 'btn btn-small btn-primary' 6 | -------------------------------------------------------------------------------- /app/views/welcome/goodbye.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_navigation([@title]) 4 | .inner 5 | = "你已经成功从 #{Siteconf.site_name} 退出。没有任何个人信息留在这台设备上。" 6 | .sep10 7 | .sep5 8 | = link_to '重新登入', new_user_session_path, :class => 'btn btn-small' 9 | .sep5 10 | 11 | -------------------------------------------------------------------------------- /app/views/devise/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome <%= @resource.email %>!

2 | 3 |

You can confirm your account through the link below:

4 | 5 |

<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

6 | -------------------------------------------------------------------------------- /app/views/devise/mailer/reset_password_instructions.html.haml: -------------------------------------------------------------------------------- 1 | - reset_url = edit_password_url(@resource, :reset_password_token => @token) 2 | Hi #{@resource.nickname}: 3 | %br/ 4 | %p 请点击下面的链接重新设置你的密码: 5 | %p=link_to reset_url, reset_url 6 | %p= Siteconf.site_name 7 | %p 如果本次密码重设请求不是由你发起,你可以安全地忽略本邮件。 8 | -------------------------------------------------------------------------------- /config/initializers/monkey_patch.rb: -------------------------------------------------------------------------------- 1 | # configure custom format 2 | #ActionController::Responder.class_eval do 3 | # alias :to_mobile :to_html 4 | #end 5 | 6 | ActiveRecord::Base.class_eval <<-CODE 7 | def html_id 8 | self.class.name.downcase + "_" + self.id.to_s 9 | end 10 | CODE 11 | 12 | -------------------------------------------------------------------------------- /db/migrate/20111220135535_add_index_to_followings.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToFollowings < ActiveRecord::Migration 2 | def change 3 | add_index :followings, :user_id 4 | add_index :followings, :followed_user_id 5 | add_index :followings, [:user_id, :followed_user_id], :unique => true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/controllers/nodes_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe NodesController do 4 | before(:each) do 5 | @node = create(:node) 6 | end 7 | 8 | it "should display node" do 9 | get :show, :key => @node.key 10 | should respond_with(:success) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/factories/pages.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at http://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :page do 5 | sequence(:key) { |n| "key_#{n}" } 6 | title 'Default page' 7 | content 'This is a default page' 8 | published true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/shared/_preview_widget.html.haml: -------------------------------------------------------------------------------- 1 | #preview-widget 2 | = link_to '编辑', 'javascript:void(0);', :class => 'action_label cancel_preview current_label', :data => {:ref => ref} 3 | = link_to '预览', 'javascript:void(0);', :class => 'action_label preview', :data => {:ref => ref, :type => type} 4 | #preview 5 | -------------------------------------------------------------------------------- /config/initializers/version.rb: -------------------------------------------------------------------------------- 1 | module Rabel 2 | module VERSION #:nodoc: 3 | MAJOR = 1 4 | MINOR = 5 5 | TINY = 4 6 | PRE = 6 7 | 8 | STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') 9 | end 10 | 11 | def self.version 12 | self::VERSION::STRING 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/views/pages/_nav.html.haml: -------------------------------------------------------------------------------- 1 | - if nav.content.start_with?('http') 2 | = link_to nav.title, nav.content, :class => 'dark', :target => :_blank 3 | - elsif nav.content.start_with?('/') 4 | = link_to nav.title, nav.content, :class => 'dark' 5 | - else 6 | = link_to nav.title, page_path(nav.key), :class => 'dark' 7 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | 7 | # Add sitemap here: 8 | # Sitemap: http://www.example.com/sitemap.xml 9 | -------------------------------------------------------------------------------- /db/migrate/20111209053551_create_nodes.rb: -------------------------------------------------------------------------------- 1 | class CreateNodes < ActiveRecord::Migration 2 | def change 3 | create_table :nodes do |t| 4 | t.string :name 5 | t.string :key 6 | t.string :introduction 7 | t.text :custom_html 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20111217060752_create_bookmarks.rb: -------------------------------------------------------------------------------- 1 | class CreateBookmarks < ActiveRecord::Migration 2 | def change 3 | create_table :bookmarks do |t| 4 | t.integer :user_id 5 | t.string :bookmarkable_type 6 | t.integer :bookmarkable_id 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/views/topics/_move_form.js.haml: -------------------------------------------------------------------------------- 1 | = form_for [@node, @topic], :remote => :true do |f| 2 | = label_tag '移动到新节点' 3 | %br 4 | = select_tag "new_node_id", option_groups_from_collection_for_select(Plane.default_order.all, :nodes, :name, :id, :name, f.object.node.id) 5 | %br 6 | = f.submit '开始移动', :class => 'btn btn-small' 7 | -------------------------------------------------------------------------------- /features/step_definitions/ad.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | Given /^an advertisement exists with title: (.*)$/ do |title| 3 | FactoryGirl.create(:advertisement, :title => title) 4 | end 5 | 6 | When /^I provide new ad title$/ do 7 | fill_in "advertisement[title]", :with => 'Rabel 1.0 Preview' 8 | click_button '保存' 9 | end 10 | -------------------------------------------------------------------------------- /spec/controllers/sessions_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe SessionsController do 4 | before(:each) do 5 | @request.env["devise.mapping"] = Devise.mappings[:user] 6 | end 7 | 8 | it "should GET #new" do 9 | get :new 10 | 11 | should respond_with(:success) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20120428141950_create_cloud_files.rb: -------------------------------------------------------------------------------- 1 | class CreateCloudFiles < ActiveRecord::Migration 2 | def change 3 | create_table :cloud_files do |t| 4 | t.string :content_type 5 | t.integer :file_size 6 | t.string :asset 7 | t.string :name 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/nodes/_custom_fields.html.haml: -------------------------------------------------------------------------------- 1 | - if node.custom_css.present? 2 | - content_for :final_head do 3 | %style{:type => 'text/css'} 4 | = node.custom_css.html_safe 5 | 6 | - if node.custom_html.present? 7 | - content_for :rightbar do 8 | .box 9 | .inner 10 | = node.custom_html.html_safe 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/views/planes/_plane.html.haml: -------------------------------------------------------------------------------- 1 | .cell 2 | %table{:cellpadding => 0, :cellspacing => 0, :border => 0, :width => '100%'} 3 | %tr 4 | %td{:align => :right, :width => 100} 5 | = plane.name 6 | %td{:style => 'line-height: 200%; padding-left: 15px;'} 7 | = render plane.nodes.order(Node.default_order_str).limit(20) 8 | -------------------------------------------------------------------------------- /app/views/users/_account_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for @user, :url => update_account_path do |f| 2 | = f.input :nickname, :disabled => true 3 | = f.input :email 4 | = render :partial => 'account_detail_form', :locals => {:f => f}, :formats => :html 5 | 6 | .form-actions 7 | = f.submit '保存设置', :class => 'btn btn-small btn-primary' 8 | -------------------------------------------------------------------------------- /db/migrate/20111209054915_create_topics.rb: -------------------------------------------------------------------------------- 1 | class CreateTopics < ActiveRecord::Migration 2 | def change 3 | create_table :topics do |t| 4 | t.integer :node_id 5 | t.integer :user_id 6 | t.string :title 7 | t.text :content 8 | t.integer :hit 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20111209060937_create_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateComments < ActiveRecord::Migration 2 | def change 3 | create_table :comments do |t| 4 | t.text :content 5 | t.integer :user_id 6 | t.string :commentable_type 7 | t.integer :commentable_id 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/factories/accounts.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at http://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :account do 5 | user 6 | introduction 'hi' 7 | signature 'Rails is cool' 8 | personal_website 'xdaqing.com' 9 | weibo_link 'http://twitter.com/daqing' 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /spec/models/bookmark_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Bookmark do 4 | it { should validate_presence_of(:user_id) } 5 | it { should validate_presence_of(:bookmarkable_type) } 6 | it { should validate_presence_of(:bookmarkable_id) } 7 | it { should belong_to(:user) } 8 | it { should belong_to(:bookmarkable) } 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20121204032057_add_size_and_filename_and_content_type_to_upyun_images.rb: -------------------------------------------------------------------------------- 1 | class AddSizeAndFilenameAndContentTypeToUpyunImages < ActiveRecord::Migration 2 | def change 3 | add_column :upyun_images, :size, :integer 4 | add_column :upyun_images, :filename, :string 5 | add_column :upyun_images, :content_type, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/templates/slim/scaffold/_form.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for(@<%= singular_table_name %>) do |f| 2 | = f.error_notification 3 | 4 | .form-inputs 5 | <%- attributes.each do |attribute| -%> 6 | = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> 7 | <%- end -%> 8 | 9 | .form-actions 10 | = f.button :submit 11 | -------------------------------------------------------------------------------- /app/views/users/my_following.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | = build_navigation(['我的特别关注']) 4 | = render @followed_topic_timeline 5 | .box 6 | .box-header 7 | 我关注的社区成员 8 | .inner 9 | %ul.thumbnails 10 | = render :partial => 'users/followed_user', :collection => @my_followed_users, :spacer_template => 'users/followed_ruler' 11 | 12 | -------------------------------------------------------------------------------- /app/models/cloud_file.rb: -------------------------------------------------------------------------------- 1 | class CloudFile < ActiveRecord::Base 2 | mount_uploader :asset, CloudFileUploader 3 | 4 | validates :name, :asset, :presence => true 5 | 6 | before_create :save_metadata 7 | private 8 | def save_metadata 9 | self.content_type = asset.file.content_type 10 | self.file_size = asset.file.size 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/admin/nodes/_move_form.js.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for [:admin, @node], :url => move_to_admin_node_path(@node), :remote => true do |f| 2 | %legend 移动到新位面 3 | = f.select :plane_id, options_from_collection_for_select(Plane.all - [@node.plane], :id, :name), :class => 'form-control' 4 | .form-actions 5 | = f.submit '开始移动', :class => 'btn btn-sm btn-primary' 6 | 7 | -------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

4 | 5 |

Click the link below to unlock your account:

6 | 7 |

<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

8 | -------------------------------------------------------------------------------- /db/migrate/20120405064209_set_comments_count_on_topics.rb: -------------------------------------------------------------------------------- 1 | class SetCommentsCountOnTopics < ActiveRecord::Migration 2 | def up 3 | Topic.find_each do |t| 4 | Topic.reset_counters(t.id, :comments) 5 | end 6 | end 7 | 8 | def down 9 | Topic.find_each do |t| 10 | t.update_attribute(:comments_count, 0) 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20120405072538_set_topics_count_on_nodes.rb: -------------------------------------------------------------------------------- 1 | class SetTopicsCountOnNodes < ActiveRecord::Migration 2 | def up 3 | Node.find_each do |node| 4 | Node.reset_counters(node.id, :topics) 5 | end 6 | end 7 | 8 | def down 9 | Node.find_each do |node| 10 | node.update_attribute(:topics_count, 0) 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/factories/notifications.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at http://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :notification do 5 | user 6 | association :action_user, :factory => :user 7 | association :notifiable, :factory => :topic 8 | action Notification::ACTION_REPLY 9 | content 'hello' 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /features/passwords.feature: -------------------------------------------------------------------------------- 1 | Feature: Passwords 2 | Scenario: reset password 3 | Given an user exists 4 | And I am on the password reset page 5 | Then I should see 重新设置密码 6 | And I should see 用户名 7 | And I should see 注册邮箱 8 | When I fill in the password reset form 9 | Then I should see 现在请去查看你的注册邮箱,其中有帮助你重新设置密码的链接 10 | -------------------------------------------------------------------------------- /app/helpers/bootstrap_helper.rb: -------------------------------------------------------------------------------- 1 | module BootstrapHelper 2 | def current_nav(item) 3 | @current_nav_item = item 4 | end 5 | 6 | def nav_item(title, path, options={}) 7 | css_class = (title == @current_nav_item) ? 'active' : '' 8 | options[:class] ||= 'top' 9 | content_tag(:li, link_to(title, path, options), :class => css_class) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/controllers/admin/topics_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Admin::TopicsController do 4 | it { should extend_the_controller(Admin::BaseController) } 5 | context "admins" do 6 | login_admin :devin 7 | 8 | it "should show all topics" do 9 | get :index 10 | should respond_with(:success) 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/models/notifiable.rb: -------------------------------------------------------------------------------- 1 | module Notifiable 2 | MENTION_REGEXP = /@([a-zA-Z0-9_\-\p{han}]+)/u 3 | 4 | def notifiable_title 5 | default_implementation 6 | end 7 | 8 | def notifiable_path 9 | default_implementation 10 | end 11 | 12 | private 13 | def default_implementation 14 | raise "Notifiable callback was not implemented." 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/views/shared/_head.html.haml: -------------------------------------------------------------------------------- 1 | = render 'shared/meta' 2 | = stylesheet_link_tag "application" 3 | = yield :head 4 | - if Siteconf.theme != 'default' 5 | = stylesheet_link_tag "#{Siteconf.theme}/i_theme" 6 | - if Siteconf.custom_css.present? 7 | %style{:type => 'text/css'}= Siteconf.custom_css.html_safe 8 | = javascript_include_tag "application" 9 | = yield :final_head 10 | -------------------------------------------------------------------------------- /app/views/topics/show/_bookmark_button.html.haml: -------------------------------------------------------------------------------- 1 | - if user_signed_in? 2 | .inner 3 | .fr{:align => :right} 4 | - if current_user.bookmarked?(@topic) 5 | = link_to '取消收藏', current_user.bookmark_of(@topic), :method => :delete, :class => 'op cancel' 6 | - else 7 | = link_to '加入收藏', topic_bookmarks_path(@topic), :method => :post, :class => :op 8 |    9 | -------------------------------------------------------------------------------- /test/factories/nodes.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at http://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :node do 5 | sequence(:name) { |n| "Node - #{n}" } 6 | sequence(:key) { |n| "key_#{n}" } 7 | introduction('this is a small node') 8 | custom_html(%(hi)) 9 | quiet false 10 | plane 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/topics/_title_form.html.haml: -------------------------------------------------------------------------------- 1 | = form_for [@node, @topic], :url => update_title_node_topic_path(@node, @topic), :remote => true do |f| 2 | %a{:name => 'new_topic'} 3 | = f.label :title, '标题' 4 | .sep5 5 | = f.text_area :title, :class => :span4, :rows => 2, :autofocus => true 6 | .sep5 7 | = f.submit '提交修改', :class => 'btn btn-small', :data => {:disable_with => t('tips.submitting')} 8 | -------------------------------------------------------------------------------- /deploy/stop_unicorn_manually.sh: -------------------------------------------------------------------------------- 1 | # send QUIT signal to unicorn master process 2 | DIR=$( cd "$( dirname "$0" )" && pwd ) 3 | source $DIR/shared.sh 4 | 5 | if [[ -f "./tmp/pids/unicorn.pid" ]]; then 6 | pid=`cat ./tmp/pids/unicorn.pid` 7 | log_info "send QUIT signal to pid=$pid" 8 | sudo kill -s QUIT $pid 9 | else 10 | log_error "ERROR: unicorn master process not found" 11 | fi 12 | 13 | -------------------------------------------------------------------------------- /spec/controllers/admin/site_settings_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Admin::SiteSettingsController do 4 | it { should extend_the_controller(Admin::BaseController) } 5 | 6 | context "admin" do 7 | login_admin :devin 8 | 9 | it "should show settings form" do 10 | get :show 11 | should respond_with(:success) 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/views/users/_password_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for @user, :url => update_password_path do |f| 2 | %strong.fade 如果你不想更改密码,请留空以下输入框。 3 | .sep5 4 | = f.input :current_password, :label => '当前密码' 5 | = f.input :password, :label => '新密码' 6 | = f.input :password_confirmation, :label => '新密码确认' 7 | .form-actions 8 | = f.submit '修改密码', :class => 'btn btn-small btn-primary' 9 | 10 | -------------------------------------------------------------------------------- /db/migrate/20111208133931_create_accounts.rb: -------------------------------------------------------------------------------- 1 | class CreateAccounts < ActiveRecord::Migration 2 | def change 3 | create_table :accounts do |t| 4 | t.integer :user_id 5 | t.string :personal_website 6 | t.string :location 7 | t.string :signature 8 | t.text :introduction 9 | t.string :twitter_id 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20120727092241_add_last_replied_at_to_topics.rb: -------------------------------------------------------------------------------- 1 | class AddLastRepliedAtToTopics < ActiveRecord::Migration 2 | def change 3 | add_column :topics, :last_replied_at, :datetime 4 | Topic.find_each do |topic| 5 | if topic.comments_count > 0 6 | topic.last_replied_at = topic.last_comment.created_at 7 | topic.save 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150227152429_add_size_and_filename_and_content_type_to_qiniu_images.rb: -------------------------------------------------------------------------------- 1 | class AddSizeAndFilenameAndContentTypeToQiniuImages < ActiveRecord::Migration 2 | def change 3 | add_column :qiniu_images, :size, :integer 4 | add_column :qiniu_images, :filename, :string 5 | add_column :qiniu_images, :content_type, :string 6 | add_column :qiniu_images, :user_id, :integer 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/models/account.rb: -------------------------------------------------------------------------------- 1 | class Account < ActiveRecord::Base 2 | belongs_to :user 3 | 4 | validates :signature, :length => {:maximum => 20} 5 | 6 | before_create :set_default_value 7 | 8 | private 9 | def set_default_value 10 | self.personal_website ||= '' 11 | self.location ||= '' 12 | self.signature ||= '' 13 | self.introduction ||= '' 14 | end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /app/views/pages/show.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .inner 3 | - if current_user && current_user.can_manage_site? 4 | .fr 5 | = link_to '修改', edit_admin_page_path(@page), :class => 'btn btn-small' 6 | .page 7 | %article 8 | %h1.page-header 9 | = @title 10 | - unless @page.published 11 | %small (草稿) 12 | = format_page @page.content 13 | 14 | -------------------------------------------------------------------------------- /app/views/kaminari/_gap.html.haml: -------------------------------------------------------------------------------- 1 | -# Non-link tag that stands for skipped pages... 2 | -# available local variables 3 | -# current_page: a page object for the currently displayed page 4 | -# num_pages: total number of pages 5 | -# per_page: number of items to fetch per page 6 | -# remote: data-remote 7 | %li 8 | %span.page.gap 9 | = raw(t 'views.pagination.truncate') 10 | -------------------------------------------------------------------------------- /db/migrate/20120627121746_create_rewards.rb: -------------------------------------------------------------------------------- 1 | class CreateRewards < ActiveRecord::Migration 2 | def change 3 | create_table :rewards do |t| 4 | t.integer :admin_user_id, default: 0 5 | t.integer :user_id, default: 0 6 | t.integer :amount, default: 0 7 | t.integer :balance, default: 0 8 | 9 | t.text :reason 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /deploy/kill_old_unicorn.sh: -------------------------------------------------------------------------------- 1 | # send QUIT signal to old unicorn master 2 | DIR=$( cd "$( dirname "$0" )" && pwd ) 3 | source $DIR/shared.sh 4 | 5 | if [[ -f "./tmp/pids/unicorn.pid.oldbin" ]]; then 6 | oldpid=`cat ./tmp/pids/unicorn.pid.oldbin` 7 | log_info "send QUIT signal to pid=$oldpid" 8 | sudo kill -s QUIT $oldpid 9 | else 10 | log_error "ERROR: unicorn master(old) not found." 11 | fi 12 | 13 | -------------------------------------------------------------------------------- /deploy/start_unicorn_manually.sh: -------------------------------------------------------------------------------- 1 | # start unicorn master process manually 2 | DIR=$( cd "$( dirname "$0" )" && pwd ) 3 | source $DIR/shared.sh 4 | 5 | bundle exec unicorn -c `pwd`/config/unicorn.rb -E production -D 6 | 7 | if [[ "$?" == 0 ]]; then 8 | log_info "unicorn master started." 9 | else 10 | log_error "master failed to start." 11 | tail -n 60 ./log/unicorn.stderr.log | less 12 | fi 13 | 14 | -------------------------------------------------------------------------------- /app/views/admin/cloud_files/_cloud_file.html.haml: -------------------------------------------------------------------------------- 1 | %tr.highlight 2 | %td= cloud_file.name 3 | %td 4 | .input-append 5 | = text_field_tag '', cloud_file.asset.url, :class => :span4 6 | = link_to '查看', cloud_file.asset.url, :target => :_blank, :class => :btn 7 | %td= number_to_human_size(cloud_file.file_size) 8 | %td= cloud_file.content_type 9 | %td 10 | = admin_delete_button(cloud_file) 11 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | //= require jquery 2 | //= require jquery_ujs 3 | //= require jquery-ui/sortable 4 | //= require jquery-ui/datepicker 5 | //= require jquery-ui/datepicker-zh-CN 6 | //= require bootstrap 7 | //= require jquery-ui/effect-highlight 8 | //= require jquery_elastic 9 | //= require jquery.facebox 10 | //= require jquery_at_caret 11 | //= require jquery_smooth_scroll 12 | //= require rabel 13 | -------------------------------------------------------------------------------- /db/migrate/20120107134203_create_advertisements.rb: -------------------------------------------------------------------------------- 1 | class CreateAdvertisements < ActiveRecord::Migration 2 | def change 3 | create_table :advertisements do |t| 4 | t.string :link 5 | t.string :banner 6 | t.string :title 7 | t.string :words 8 | t.date :start_date 9 | t.date :expire_date 10 | t.integer :duration 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/views/admin/pages/_page.html.haml: -------------------------------------------------------------------------------- 1 | %tr{:id => page.html_id} 2 | %td{:align => :right, :width => 200} 3 | = link_to page_real_url(page), page_real_url(page) 4 | %td{:align => :center, :width => :auto} 5 | = page.title 6 | %td{:align => :center, :width => :auto} 7 | = page_publish_status(page) 8 | %td{:align => :left} 9 | = admin_edit_button('修改页面', page) 10 | = admin_delete_button(page) 11 | 12 | -------------------------------------------------------------------------------- /features/support/named_routes_fix.rb: -------------------------------------------------------------------------------- 1 | World(ApplicationHelper) 2 | 3 | module RoutingFixHelper 4 | def member_path(nickname) 5 | "/member/#{nickname}" 6 | end 7 | 8 | def go_path(key) 9 | "/go/#{key}" 10 | end 11 | 12 | def t_path(id) 13 | "/t/#{id}" 14 | end 15 | 16 | def my_following_path 17 | '/my/following' 18 | end 19 | 20 | def page_path(key) 21 | "/page/#{key}" 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/views/admin/cloud_files/index.html.haml: -------------------------------------------------------------------------------- 1 | .box 2 | .cell 3 | .fr 4 | = admin_create_button('上传文件', :cloud_file) 5 | = build_admin_navigation([@title]) 6 | .cell 7 | %table.table 8 | %thead 9 | %tr 10 | %th 简要描述 11 | %th 访问路径 12 | %th 大小 13 | %th 文件类型 14 | %th 操作 15 | %tbody 16 | = render @files 17 | .inner 18 | = paginate @files 19 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.haml: -------------------------------------------------------------------------------- 1 | - content_for :content do 2 | .col-md-8.col-lg-8.col-sm-8 3 | = render 'shared/alert' 4 | = yield 5 | 6 | - content_for :sidebar do 7 | .col-md-4.col-lg-4.col-sm-4#Rightbar 8 | = render 'shared/sidebar_box' 9 | = yield :rightbar 10 | = render :partial => 'shared/ad', :collection => Advertisement.available, :as => :ad 11 | 12 | = render :template => 'layouts/base' 13 | 14 | -------------------------------------------------------------------------------- /bin/rspec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'rspec' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('rspec-core', 'rspec') 17 | -------------------------------------------------------------------------------- /features/admin/topics.feature: -------------------------------------------------------------------------------- 1 | Feature: Manage Topics 2 | Scenario: show all topics 3 | Given a topic exists 4 | And as an admin, I have logged in as devin 5 | When I am on the admin topics page 6 | Then page title should contain 讨论话题 7 | And I should see 节点 8 | And I should see 标题 9 | And I should see 作者 10 | And it should display link 编辑 11 | And it should display link 删除 12 | 13 | -------------------------------------------------------------------------------- /app/views/users/_account_detail_form.html.haml: -------------------------------------------------------------------------------- 1 | = f.fields_for :account do |fields| 2 | = fields.input :personal_website, :label => '个人网站' 3 | = fields.input :location, :label => '所在地' 4 | = fields.input :weibo_link, :label => '微博地址', :input_html => {:class => :span4} 5 | = fields.input :signature, :label => '签名', :input_html => {:class => :span4} 6 | = fields.input :introduction, :label => '个人简介', :input_html => {:rows => 5, :class => :span4} 7 | 8 | -------------------------------------------------------------------------------- /config/initializers/form_error.rb: -------------------------------------------------------------------------------- 1 | ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| 2 | if html_tag =~ /