Merge with master

This commit is contained in:
Yuki 2015-05-08 18:58:50 +05:30
commit b2a57da4b2
151 changed files with 3565 additions and 921 deletions

View File

@ -1 +0,0 @@
full

24
Capfile
View File

@ -1,24 +0,0 @@
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/console'
# Load custom tasks from `lib/capistrano/tasks' if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

20
Gemfile
View File

@ -1,7 +1,7 @@
source 'https://rubygems.org'
source 'https://rails-assets.org'
gem 'rails', '4.1.8'
gem 'rails', '4.2.1'
gem 'pg', group: :postgres
gem 'mysql2', group: :mysql
@ -29,10 +29,12 @@ gem 'devise-async'
gem 'bootstrap_form'
gem 'font-kit-rails'
gem 'nprogress-rails'
gem 'font-awesome-rails', '~> 4.2.0.0'
gem 'font-awesome-rails', '~> 4.3.0.0'
gem 'rails-assets-growl'
gem "paperclip", "~> 4.2"
gem 'delayed_paperclip'
gem 'momentjs-rails', '>= 2.9.0'
gem 'bootstrap3-datetimepicker-rails', '~> 4.7.14'
gem 'ruby-progressbar'
@ -41,7 +43,7 @@ gem 'rails_admin'
gem 'sidekiq'
gem 'sinatra', require: false
gem 'questiongenerator', git: 'https://github.com/justask/questiongenerator.git'
gem 'questiongenerator', git: 'https://github.com/retrospring/questiongenerator.git'
gem 'sanitize'
gem 'redcarpet'
@ -60,11 +62,6 @@ gem 'redis'
group :development do
gem 'spring'
# Capistrano for deployment
gem 'capistrano', '~> 3.1'
gem 'capistrano-rvm', group: :rvm
gem 'capistrano-rails', '~> 1.1'
end
group :production do
@ -74,11 +71,12 @@ end
group :development, :test do
gem 'thin'
gem 'rspec-rails', '~> 3.0.0'
gem 'factory_girl_rails'
gem 'factory_girl_rails', require: false
gem 'faker'
gem 'capybara'
gem 'poltergeist'
gem 'simplecov'
gem 'simplecov', require: false
gem 'simplecov-json', require: false
gem 'simplecov-rcov', require: false
gem 'database_cleaner'
end

View File

@ -1,64 +1,60 @@
GIT
remote: https://github.com/justask/questiongenerator.git
revision: 99f2469bbe59f50a0cf3df60d7e82b2b5f7aab9b
remote: https://github.com/retrospring/questiongenerator.git
revision: 902de3d7f930a4f67bbbbc414cc3556cc7114839
specs:
questiongenerator (0.0.2)
questiongenerator (0.1.0)
GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
actionmailer (4.1.8)
actionpack (= 4.1.8)
actionview (= 4.1.8)
actionmailer (4.2.1)
actionpack (= 4.2.1)
actionview (= 4.2.1)
activejob (= 4.2.1)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.8)
actionview (= 4.1.8)
activesupport (= 4.1.8)
rack (~> 1.5.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.1)
actionview (= 4.2.1)
activesupport (= 4.2.1)
rack (~> 1.6)
rack-test (~> 0.6.2)
actionview (4.1.8)
activesupport (= 4.1.8)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.1)
activesupport (= 4.2.1)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.8)
activesupport (= 4.1.8)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.1)
activesupport (= 4.2.1)
globalid (>= 0.3.0)
activemodel (4.2.1)
activesupport (= 4.2.1)
builder (~> 3.1)
activerecord (4.1.8)
activemodel (= 4.1.8)
activesupport (= 4.1.8)
arel (~> 5.0.0)
activesupport (4.1.8)
i18n (~> 0.6, >= 0.6.9)
activerecord (4.2.1)
activemodel (= 4.2.1)
activesupport (= 4.2.1)
arel (~> 6.0)
activesupport (4.2.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.6)
arel (5.0.1.20140414130214)
bcrypt (3.1.9)
addressable (2.3.8)
arel (6.0.0)
bcrypt (3.1.10)
bootstrap-sass (3.2.0.2)
sass (~> 3.2)
bootstrap_form (2.2.0)
bootstrap3-datetimepicker-rails (4.7.14)
momentjs-rails (>= 2.8.1)
bootstrap_form (2.3.0)
bootswatch-rails (3.2.4)
railties (>= 3.1)
buftok (0.2.0)
builder (3.2.2)
capistrano (3.3.5)
capistrano-stats (~> 1.1.0)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-bundler (1.1.3)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-rails (1.1.2)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capistrano-stats (1.1.1)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@ -70,21 +66,20 @@ GEM
climate_control (0.0.3)
activesupport (>= 3.0)
cliver (0.3.2)
cocaine (0.5.5)
cocaine (0.5.7)
climate_control (>= 0.0.3, < 1.0)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.8.0)
colorize (0.7.5)
connection_pool (2.1.0)
crass (1.0.1)
daemons (1.1.9)
database_cleaner (1.3.0)
delayed_paperclip (2.9.0)
coffee-script-source (1.9.1.1)
connection_pool (2.2.0)
crass (1.0.2)
daemons (1.2.2)
database_cleaner (1.4.1)
delayed_paperclip (2.9.1)
paperclip (>= 3.3)
devise (3.4.1)
bcrypt (~> 3.0)
@ -97,11 +92,10 @@ GEM
devise (~> 3.2)
diff-lcs (1.2.5)
docile (1.1.5)
dotenv (1.0.2)
equalizer (0.0.9)
equalizer (0.0.11)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (2.2.2)
eventmachine (1.0.7)
execjs (2.5.2)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.5.0)
@ -109,63 +103,66 @@ GEM
railties (>= 3.0.0)
faker (1.4.3)
i18n (~> 0.5)
faraday (0.9.0)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.9.1)
faraday (>= 0.7.4, < 0.10)
font-awesome-rails (4.2.0.0)
font-awesome-rails (4.3.0.0)
railties (>= 3.2, < 5.0)
font-kit-rails (1.1.0)
rails
foreman (0.76.0)
dotenv (~> 1.0.2)
foreman (0.78.0)
thor (~> 0.19.1)
globalid (0.3.5)
activesupport (>= 4.1.0)
haml (4.0.6)
tilt
hashie (3.3.2)
hashie (3.4.1)
hike (1.2.3)
hitimes (1.2.2)
http (0.6.3)
http (0.6.4)
http_parser.rb (~> 0.6.0)
http_accept_language (2.0.2)
http_accept_language (2.0.5)
http_parser.rb (0.6.0)
i18n (0.6.11)
jbuilder (2.2.5)
i18n (0.7.0)
jbuilder (2.2.13)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
jquery-rails (4.0.3)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-turbolinks (2.1.0)
railties (>= 3.1.0)
turbolinks
jquery-ui-rails (5.0.3)
railties (>= 3.2.16)
json (1.8.1)
kaminari (0.16.1)
json (1.8.2)
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.2)
kgio (2.9.3)
loofah (2.0.1)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
mime-types (2.4.3)
mini_portile (0.6.1)
minitest (5.4.3)
multi_json (1.10.1)
mini_portile (0.6.2)
minitest (5.6.0)
momentjs-rails (2.9.0)
railties (>= 3.1)
multi_json (1.11.0)
multipart-post (2.0.0)
mysql2 (0.3.17)
mysql2 (0.3.18)
naught (1.0.0)
nested_form (0.3.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
nokogiri (1.6.5)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nokogumbo (1.2.0)
nokogiri
nprogress-rails (0.1.6.3)
nprogress-rails (0.1.6.6)
oauth (0.4.7)
omniauth (1.2.2)
hashie (>= 1.2, < 4)
@ -184,39 +181,48 @@ GEM
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
pg (0.17.1)
poltergeist (1.5.1)
pg (0.18.1)
poltergeist (1.6.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
rack (1.5.2)
rack (1.6.0)
rack-pjax (0.8.0)
nokogiri (~> 1.5)
rack (~> 1.1)
rack-protection (1.5.3)
rack
rack-test (0.6.2)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.8)
actionmailer (= 4.1.8)
actionpack (= 4.1.8)
actionview (= 4.1.8)
activemodel (= 4.1.8)
activerecord (= 4.1.8)
activesupport (= 4.1.8)
rails (4.2.1)
actionmailer (= 4.2.1)
actionpack (= 4.2.1)
actionview (= 4.2.1)
activejob (= 4.2.1)
activemodel (= 4.2.1)
activerecord (= 4.2.1)
activesupport (= 4.2.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.8)
sprockets-rails (~> 2.0)
rails-assets-growl (1.2.4)
railties (= 4.2.1)
sprockets-rails
rails-assets-growl (1.2.5)
rails-assets-jquery
rails-assets-jquery (2.1.1)
rails_admin (0.6.5)
rails-assets-jquery (2.1.3)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
rails_admin (0.6.7)
builder (~> 3.1)
coffee-rails (~> 4.0)
font-awesome-rails (>= 3.0, < 5)
haml (~> 4.0)
jquery-rails (~> 3.0)
jquery-rails (>= 3.0, < 5)
jquery-ui-rails (~> 5.0)
kaminari (~> 0.14)
nested_form (~> 0.3)
@ -224,23 +230,23 @@ GEM
rails (~> 4.0)
remotipart (~> 1.0)
safe_yaml (~> 1.0)
sass-rails (~> 4.0)
railties (4.1.8)
actionpack (= 4.1.8)
activesupport (= 4.1.8)
sass-rails (>= 4.0, < 6)
railties (4.2.1)
actionpack (= 4.2.1)
activesupport (= 4.2.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.4.2)
rdoc (4.2.0)
json (~> 1.4)
redcarpet (3.2.2)
redis (3.2.0)
redis-namespace (1.5.1)
redcarpet (3.2.3)
redis (3.2.1)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
remotipart (1.2.1)
responders (1.1.2)
railties (>= 3.2, < 4.2)
responders (2.1.0)
railties (>= 4.2.0, < 5)
rspec-core (3.0.4)
rspec-support (~> 3.0.0)
rspec-expectations (3.0.4)
@ -257,9 +263,9 @@ GEM
rspec-mocks (~> 3.0.0)
rspec-support (~> 3.0.0)
rspec-support (3.0.4)
ruby-progressbar (1.7.0)
ruby-progressbar (1.7.5)
safe_yaml (1.0.4)
sanitize (3.1.0)
sanitize (3.1.2)
crass (~> 1.0.1)
nokogiri (>= 1.4.4)
nokogumbo (= 1.2.0)
@ -272,44 +278,45 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sidekiq (3.3.0)
sidekiq (3.3.3)
celluloid (>= 0.16.0)
connection_pool (>= 2.0.0)
connection_pool (>= 2.1.1)
json
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
simple_oauth (0.3.0)
simplecov (0.9.1)
simple_oauth (0.3.1)
simplecov (0.10.0)
docile (~> 1.1.0)
multi_json (~> 1.0)
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
sinatra (1.4.5)
json (~> 1.8)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
simplecov-json (0.2)
json
simplecov
simplecov-rcov (0.2.3)
simplecov (>= 0.4.1)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
spring (1.2.0)
tilt (>= 1.3, < 3)
spring (1.3.4)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.2)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sshkit (1.6.1)
colorize (>= 0.7.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
sweetalert-rails (0.3.3)
sweetalert-rails (0.5.0)
railties (>= 3.1.0)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
rack (~> 1.0)
thor (0.19.1)
thread_safe (0.3.4)
thread_safe (0.3.5)
tilt (1.4.1)
timers (4.0.1)
hitimes
@ -322,7 +329,7 @@ GEM
simple_oauth
turbolinks (2.5.3)
coffee-rails
twitter (5.13.0)
twitter (5.14.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
equalizer (~> 0.0.9)
@ -335,7 +342,7 @@ GEM
simple_oauth (~> 0.3.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.5.3)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
unicorn (4.8.3)
@ -344,7 +351,9 @@ GEM
raindrops (~> 0.7)
warden (1.2.3)
rack (>= 1.0)
websocket-driver (0.4.0)
websocket-driver (0.5.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
will_paginate (3.0.7)
will_paginate-bootstrap (1.0.1)
will_paginate (>= 3.0.3)
@ -357,11 +366,9 @@ PLATFORMS
DEPENDENCIES
bcrypt (~> 3.1.7)
bootstrap-sass (~> 3.2.0.1)
bootstrap3-datetimepicker-rails (~> 4.7.14)
bootstrap_form
bootswatch-rails
capistrano (~> 3.1)
capistrano-rails (~> 1.1)
capistrano-rvm
capybara
coffee-rails (~> 4.1.0)
database_cleaner
@ -370,7 +377,7 @@ DEPENDENCIES
devise-async
factory_girl_rails
faker
font-awesome-rails (~> 4.2.0.0)
font-awesome-rails (~> 4.3.0.0)
font-kit-rails
foreman
haml
@ -378,6 +385,7 @@ DEPENDENCIES
jbuilder (~> 2.2.4)
jquery-rails
jquery-turbolinks
momentjs-rails (>= 2.9.0)
mysql2
nprogress-rails
omniauth
@ -387,7 +395,7 @@ DEPENDENCIES
pg
poltergeist
questiongenerator!
rails (= 4.1.8)
rails (= 4.2.1)
rails-assets-growl
rails_admin
redcarpet
@ -399,6 +407,8 @@ DEPENDENCIES
sdoc (~> 0.4.1)
sidekiq
simplecov
simplecov-json
simplecov-rcov
sinatra
spring
sweetalert-rails

662
LICENSE Normal file
View File

@ -0,0 +1,662 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

View File

@ -1,17 +1,40 @@
# justask [![build status](https://ci.rrerr.net/projects/9/status.png?ref=master)](https://ci.rrerr.net/projects/9?ref=master)
# justask (aka. the software behind Retrospring)
This is the source code that powers Retrospring. Yep, all of it. Including
all the branches where we left off.
<!--
Except for the memes that happened 4 hours before the shutdown. I've edited
it right on the server, without a special branch or something. If you want
to, I can make a branch with all the modifications we made.
-->
## Requirements
- UNIX-like system (Linux, *BSD, ...)
- UNIX-like system (Linux, FreeBSD, ...)
- Ruby 2.0.0+
- Bundler
- PostgreSQL
- Redis
- Redis (for Sidekiq)
- ImageMagick (for image processing)
## Installation (production)
We've installed justask on FreeBSD 10 using rvm. What we also did was
creating a new, seperate user just for justask to run in. On FreeBSD, this
is done with:
# pw user add justask
### Database
At Retrospring, we were using PostgreSQL as the database backend. The
software might work on MySQL too, but that was not tested.
Installation from Ports (using `portmaster`):
# portmaster databases/postgresql93-server
#### PostgreSQL
$ sudo -u postgres psql -d template1
@ -23,11 +46,16 @@ Try connecting to the database:
$ psql -U justask -d justask_production
### nginx
See [docs/nginx.conf](https://github.com/nilsding/justask/blob/master/docs/nginx.conf)
for the configuration we use on Retrospring.
### justask
#### Clone the Source
$ git clone https://git.rrerr.net/nilsding/justask.git justask
$ git clone https://github.com/nilsding/justask.git justask
#### Configure It
@ -72,7 +100,7 @@ Try connecting to the database:
# Development mode:
$ bundle exec rails server
Create an account on your justask installation.
Now, create an account on your justask installation.
To make yourself an admin, just execute:
@ -82,12 +110,30 @@ If you want to remove admin status from a certain user, you can do this:
$ bundle exec rake 'justask:deadmin[get_rekt]' RAILS_ENV=production
Add/remove moderators:
Add/remove moderators (this can also be done via the web interface by visiting an user as an admin):
$ bundle exec rake 'justask:mod[someone_else]' RAILS_ENV=production
$ bundle exec rake 'justask:demod[someone_else]' RAILS_ENV=production
Add/remove supporters:
Add/remove supporters (this can also be done via the web interface by visiting an user as an admin/mod):
$ bundle exec rake 'justask:sup[someone_else]' RAILS_ENV=production
$ bundle exec rake 'justask:desup[someone_else]' RAILS_ENV=production
$ bundle exec rake 'justask:desup[someone_else]' RAILS_ENV=production
Export user data:
$ bundle exec rake 'justask:export[jdoe@example.tld]' RAILS_ENV=production
Find the user(s) with the most self-asked anonymous questions:
$ bundle exec rake justask:loners
## The Official Retrospring Closedown Soundtrack™ (now redundant)
* [Scooter - Can't Stop The Hardcore](https://www.youtube.com/watch?v=nJ3bet-Y79w)
* [Darude - Sandstorm](https://www.youtube.com/watch?v=y6120QOlsfU)
* [Max Raabe - Oops I Did It Again](https://www.youtube.com/watch?v=qYr9kIyambE)
## License
AGPLv3.

318
Rakefile
View File

@ -70,7 +70,7 @@ namespace :justask do
fail "user #{args[:screen_name]} not found" if user.nil?
user.admin = false
user.save!
puts "#{user.screen_name} no longer an admin."
puts "#{user.screen_name} is no longer an admin."
end
desc "Gives moderator status to an user."
@ -94,11 +94,67 @@ namespace :justask do
end
desc "Hits an user with the banhammer."
task :ban, [:screen_name] => :environment do |t, args|
task :permanently_ban, [:screen_name, :reason] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
fail "user #{args[:screen_name]} not found" if user.nil?
user.banned = true
user.permanently_banned = true
user.ban_reason = args[:reason]
user.save!
puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!"
end
desc "Hits an user with the banhammer for one day."
task :ban, [:screen_name, :reason] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
user.permanently_banned = false
user.banned_until = DateTime.current + 1
user.ban_reason = args[:reason]
user.save!
puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!"
end
desc "Hits an user with the banhammer for one week."
task :week_ban, [:screen_name, :reason] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
user.permanently_banned = false
user.banned_until = DateTime.current + 7
user.ban_reason = args[:reason]
user.save!
puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!"
end
desc "Hits an user with the banhammer for one month."
task :month_ban, [:screen_name, :reason] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
user.permanently_banned = false
user.banned_until = DateTime.current + 30
user.ban_reason = args[:reason]
user.save!
puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!"
end
desc "Hits an user with the banhammer for one year."
task :year_ban, [:screen_name, :reason] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
user.permanently_banned = false
user.banned_until = DateTime.current + 365
user.ban_reason = args[:reason]
user.save!
puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!"
end
desc "Hits an user with the banhammer for one aeon."
task :aeon_ban, [:screen_name, :reason] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
user.permanently_banned = false
user.banned_until = DateTime.current + 365_000_000_000
user.ban_reason = args[:reason]
user.save!
puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!"
end
@ -108,11 +164,33 @@ namespace :justask do
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
fail "user #{args[:screen_name]} not found" if user.nil?
user.banned = false
user.permanently_banned = false
user.banned_until = nil
user.ban_reason = nil
user.save!
puts "#{user.screen_name} is no longer banned."
end
desc "Gives blogger status to an user."
task :blog, [:screen_name] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
fail "user #{args[:screen_name]} not found" if user.nil?
user.blogger = true
user.save!
puts "#{user.screen_name} is now a blogger."
end
desc "Removes blogger status from an user."
task :unblog, [:screen_name] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
fail "user #{args[:screen_name]} not found" if user.nil?
user.blogger = false
user.save!
puts "#{user.screen_name} is no longer a blogger."
end
desc "Gives supporter status to an user."
task :sup, [:screen_name] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
@ -130,7 +208,27 @@ namespace :justask do
fail "user #{args[:screen_name]} not found" if user.nil?
user.supporter = false
user.save!
puts "#{user.screen_name} no longer an supporter."
puts "#{user.screen_name} is no longer an supporter."
end
desc "Gives contributor status to an user."
task :contrib, [:screen_name] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
fail "user #{args[:screen_name]} not found" if user.nil?
user.contributor = true
user.save!
puts "#{user.screen_name} is now a contributor."
end
desc "Removes contributor status from an user."
task :decontrib, [:screen_name] => :environment do |t, args|
fail "screen name required" if args[:screen_name].nil?
user = User.find_by_screen_name(args[:screen_name])
fail "user #{args[:screen_name]} not found" if user.nil?
user.contributor = false
user.save!
puts "#{user.screen_name} is no longer a contributor."
end
desc "Lists all users."
@ -158,6 +256,67 @@ namespace :justask do
puts "Purged #{destroyed_count} dead notifications."
end
desc "Subscribes everyone to their answers"
task fix_submarines: :environment do
format = '%t (%c/%C) [%b>%i] %e'
total = Answer.count
progress = ProgressBar.create title: 'Processing answers', format: format, starting_at: 0, total: total
subscribed = 0
Answer.all.each do |a|
if not a.user.nil?
Subscription.subscribe a.user, a
subscribed += 1
end
progress.increment
end
puts "Subscribed to #{subscribed} posts."
end
desc "Destroy lost subscriptions"
task fix_torpedoes: :environment do
format = '%t (%c/%C) [%b>%i] %e'
total = Subscription.count
progress = ProgressBar.create title: 'Processing subscriptions', format: format, starting_at: 0, total: total
destroyed = 0
Subscription.all.each do |s|
if s.user.nil? or s.answer.nil?
s.destroy
destroyed += 1
end
progress.increment
end
puts "Put #{destroyed} subscriptions up for adoption."
end
desc "Fixes reports"
task fix_reports: :environment do
format = '%t (%c/%C) [%b>%i] %e'
total = Report.count
progress = ProgressBar.create title: 'Processing reports', format: format, starting_at: 0, total: total
destroyed = 0
Report.all.each do |r|
if r.target.nil? and not r.deleted?
r.deleted = true
r.save
destroyed += 1
elsif r.user.nil?
r.destroy
destroyed += 1
end
progress.increment
end
puts "Marked #{destroyed} reports as deleted."
end
desc "Fixes everything else"
task fix_db: :environment do
format = '%t (%c/%C) [%b>%i] %e'
@ -166,7 +325,9 @@ namespace :justask do
question: 0,
answer: 0,
smile: 0,
comment: 0
comment: 0,
subscription: 0,
report: 0
}
total = Inbox.count
@ -210,10 +371,38 @@ namespace :justask do
progress.increment
end
total = Subscription.count
progress = ProgressBar.create title: 'Processing subscriptions', format: format, starting_at: 0, total: total
Subscription.all.each do |s|
if s.user.nil? or s.answer.nil?
s.destroy
destroyed_count[:subscription] += 1
end
progress.increment
end
total = Report.count
progress = ProgressBar.create title: 'Processing reports', format: format, starting_at: 0, total: total
Report.all.each do |r|
if r.target.nil? and not r.deleted?
r.deleted = true
r.save
destroyed_count[:report] += 1
elsif r.user.nil?
r.destroy
destroyed_count[:report] += 1
end
progress.increment
end
puts "Put #{destroyed_count[:subscription]} subscriptions up for adoption."
puts "Purged #{destroyed_count[:inbox]} dead inbox entries."
puts "Marked #{destroyed_count[:question]} questions as anonymous."
puts "Purged #{destroyed_count[:answer]} dead answers."
puts "Purged #{destroyed_count[:answer]} dead comments."
puts "Purged #{destroyed_count[:comment]} dead comments."
puts "Purged #{destroyed_count[:subscription]} dead subscriptions."
puts "Marked #{destroyed_count[:report]} reports as deleted."
end
desc "Prints lonely people."
@ -244,4 +433,119 @@ namespace :justask do
print "\033[0m"
end
end
desc "Export data for an user"
task :export, [:email] => :environment do |t, args|
require 'json'
require 'yaml'
return if args[:email].nil?
obj = {}
format = '%t (%c/%C) [%b>%i] %e'
u = User.where("LOWER(email) = ?", args[:email].downcase).first!
export_dirname = "export_#{u.screen_name}_#{Time.now.to_i}"
export_filename = u.screen_name
%i(id screen_name display_name created_at sign_in_count last_sign_in_at friend_count follower_count asked_count answered_count commented_count smiled_count motivation_header bio website location moderator admin supporter banned blogger).each do |f|
obj[f] = u.send f
end
total = u.questions.count
progress = ProgressBar.create title: 'Processing questions', format: format, starting_at: 0, total: total
obj[:questions] = []
u.questions.each do |q|
qobj = {}
%i(id content author_is_anonymous created_at answer_count).each do |f|
qobj[f] = q.send f
end
obj[:questions] << qobj
progress.increment
end
total = u.answers.count
progress = ProgressBar.create title: 'Processing answers', format: format, starting_at: 0, total: total
obj[:answers] = []
u.answers.each do |a|
aobj = {}
%i(id content comment_count smile_count created_at).each do |f|
aobj[f] = a.send f
end
aobj[:question] = {}
%i(id content author_is_anonymous created_at answer_count).each do |f|
aobj[:question][f] = a.question.send f
end
aobj[:question][:user] = a.question.user.screen_name unless a.question.author_is_anonymous
aobj[:comments] = []
a.comments.each do |c|
cobj = {}
%i(id content created_at).each do |f|
cobj[f] = c.send f
end
cobj[:user] = c.user.screen_name
aobj[:comments] << cobj
end
obj[:answers] << aobj
progress.increment
end
total = u.comments.count
progress = ProgressBar.create title: 'Processing comments', format: format, starting_at: 0, total: total
obj[:comments] = []
u.comments.each do |c|
cobj = {}
%i(id content created_at).each do |f|
cobj[f] = c.send f
end
cobj[:answer] = {}
%i(id content comment_count smile_count created_at).each do |f|
cobj[:answer][f] = c.answer.send f
end
cobj[:answer][:question] = {}
%i(id content author_is_anonymous created_at answer_count).each do |f|
cobj[:answer][:question][f] = c.answer.question.send f
end
cobj[:answer][:question][:user] = c.answer.question.user.screen_name unless c.answer.question.author_is_anonymous
obj[:comments] << cobj
progress.increment
end
total = u.smiles.count
progress = ProgressBar.create title: 'Processing smiles', format: format, starting_at: 0, total: total
obj[:smiles] = []
u.smiles.each do |s|
sobj = {}
%i(id created_at).each do |f|
sobj[f] = s.send f
end
sobj[:answer] = {}
%i(id content comment_count smile_count created_at).each do |f|
sobj[:answer][f] = s.answer.send f
end
sobj[:answer][:question] = {}
%i(id content author_is_anonymous created_at answer_count).each do |f|
sobj[:answer][:question][f] = s.answer.question.send f
end
sobj[:answer][:question][:user] = s.answer.question.user.screen_name unless s.answer.question.author_is_anonymous
obj[:smiles] << sobj
progress.increment
end
`mkdir -p /usr/home/justask/justask/public/export`
`mkdir -p /tmp/rs_export/#{export_dirname}/picture`
if u.profile_picture
%i(large medium small original).each do |s|
x = u.profile_picture.path(s).gsub('"', '\\"')
`cp "#{x}" "/tmp/rs_export/#{export_dirname}/picture/#{s}_#{File.basename x}"`
end
end
File.open "/tmp/rs_export/#{export_dirname}/#{export_filename}.json", 'w' do |f|
f.puts obj.to_json
end
File.open "/tmp/rs_export/#{export_dirname}/#{export_filename}.yml", 'w' do |f|
f.puts obj.to_yaml
end
`tar czvf public/export/#{export_dirname}.tar.gz -C /tmp/rs_export #{export_dirname}`
puts "\033[1mhttps://retrospring.net/export/#{export_dirname}.tar.gz\033[0m"
end
end

12
TODO
View File

@ -1,12 +1,11 @@
Not done:
[001| 0%] user blocking (prohibits blocked user from asking question to that person and seeing their answers)
[007| 0%] (?) keyboard shortcuts
[007| 20%] (?) keyboard shortcuts
|----- Open "Ask your followers" with Ctrl/Meta+M
[010| 0%] locales (these can wait for now)
[012| 0%] (?) open source the entire thing in late 2015 or 2016 maybe, after we got bought by fakelook.
|----- (somewhat) working in justask/feature-semantic
[015| 0%] make a public accessible API (maybe even as an oauth provider?)
[016| 5%] WRYYYYte more specs
[017| 0%] write "terms of service" and a privacy policy.
[018| 0%] that annoying "we use cookies" thing every website in the EU must? add
[020| 0%] helper function for profile headings to resize on certain string length
[022| 0%] recommended follows
[023| 0%] disabling group-questions
@ -31,6 +30,9 @@ Finished:
[009|100%] a notification view or something
[013|100%] restructure questions (has_many :answers) for less redundancy in the DB when implementing #002
[014|100%] generate questions if there are none in the inbox (probably make it as a gem)
[018|100%] that annoying "we use cookies" thing every website in the EU must? add
[019|100%] omniAuth (twatter, fakelook, goggles plus) for social networking elitists
[021|100%] deleting comments
|----- restructure comment design
|----- restructure comment design
[012|100%] (?) open source the entire thing in late 2015 or 2016 maybe, after we got bought by fakelook.
[017|100%] write "terms of service" and a privacy policy.

View File

@ -39,6 +39,9 @@ $(document).on "keyup", "input[name=ab-comment-new]", (evt) ->
input.val ''
ctr.html 160
$("span#ab-comment-count-#{aid}").html data.count
subs = $("a[data-action=ab-submarine][data-a-id=#{aid}]")[0]
subs.dataset.torpedo = "no"
subs.children[0].nextSibling.textContent = "Unsubscribe"
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error

View File

@ -2,25 +2,4 @@ $(document).on "click", "a[data-action=ab-comment-report]", (ev) ->
ev.preventDefault()
btn = $(this)
cid = btn[0].dataset.cId
swal
title: "Really report?"
text: "A moderator will review this comment and decide what happens."
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Report"
closeOnConfirm: true
, ->
$.ajax
url: '/ajax/report'
type: 'POST'
data:
id: cid
type: 'comment'
success: (data, status, jqxhr) ->
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->
btn.button "reset"
reportDialog "comment", cid, -> btn.button "reset"

View File

@ -0,0 +1,41 @@
$(document).on "click", "button[name=ab-smile-comment]", ->
btn = $(this)
cid = btn[0].dataset.cId
action = btn[0].dataset.action
count = Number $("span#ab-comment-smile-count-#{cid}").html()
btn[0].dataset.loadingText = "<i class=\"fa fa-meh-o fa-spin\"></i> <span id=\"ab-smile-count-#{cid}\">#{count}</span>"
btn.button "loading"
target_url = switch action
when 'smile'
count++
'/ajax/create_comment_smile'
when 'unsmile'
count--
'/ajax/destroy_comment_smile'
success = false
$.ajax
url: target_url
type: 'POST'
data:
id: cid
success: (data, status, jqxhr) ->
success = data.success
if success
$("span#ab-comment-smile-count-#{cid}").html(count)
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->
btn.button "reset"
if success
switch action
when 'smile'
btn[0].dataset.action = 'unsmile'
btn.html "<i class=\"fa fa-frown-o\"></i> <span id=\"ab-comment-smile-count-#{cid}\">#{count}</span>"
when 'unsmile'
btn[0].dataset.action = 'smile'
btn.html "<i class=\"fa fa-smile-o\"></i> <span id=\"ab-comment-smile-count-#{cid}\">#{count}</span>"

View File

@ -3,12 +3,13 @@ $(document).on "click", "a[data-action=ab-destroy]", (ev) ->
btn = $(this)
aid = btn[0].dataset.aId
swal
title: "Really delete?"
text: "The question will be moved back to your inbox."
title: "Are you sure?"
text: "The question will be moved back to your inbox, but it won't delete any posts to social media."
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Delete"
confirmButtonText: "Yes"
cancelButtonText: "No"
closeOnConfirm: true
, ->
$.ajax
@ -23,4 +24,4 @@ $(document).on "click", "a[data-action=ab-destroy]", (ev) ->
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->
complete: (jqxhr, status) ->

View File

@ -2,25 +2,4 @@ $(document).on "click", "a[data-action=ab-report]", (ev) ->
ev.preventDefault()
btn = $(this)
aid = btn[0].dataset.aId
swal
title: "Really report?"
text: "A moderator will review this answer and decide what happens."
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Report"
closeOnConfirm: true
, ->
$.ajax
url: '/ajax/report' # TODO: find a way to use rake routes instead of hardcoding them here
type: 'POST'
data:
id: aid
type: 'answer'
success: (data, status, jqxhr) ->
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->
btn.button "reset"
reportDialog "answer", aid, -> btn.button "reset"

View File

@ -38,4 +38,4 @@ $(document).on "click", "button[name=ab-smile]", ->
btn.html "<i class=\"fa fa-frown-o\"></i> <span id=\"ab-smile-count-#{aid}\">#{count}</span>"
when 'unsmile'
btn[0].dataset.action = 'smile'
btn.html "<i class=\"fa fa-smile-o\"></i> <span id=\"ab-smile-count-#{aid}\">#{count}</span>"
btn.html "<i class=\"fa fa-smile-o\"></i> <span id=\"ab-smile-count-#{aid}\">#{count}</span>"

View File

@ -0,0 +1,27 @@
# the laziest coding known to man
$(document).on "click", "a[data-action=ab-submarine]", (ev) ->
ev.preventDefault()
btn = $(this)
aid = btn[0].dataset.aId
torpedo = 0
if btn[0].dataset.torpedo == "yes"
torpedo = 1
endpoint = "subscribe"
if torpedo == 0
endpoint = "un" + endpoint
$.ajax
url: '/ajax/' + endpoint # TODO: find a way to use rake routes instead of hardcoding them here
type: 'POST'
data:
answer: aid
success: (data, status, jqxhr) ->
if data.success
btn[0].dataset.torpedo = ["yes", "no"][torpedo]
btn[0].children[0].nextSibling.textContent = ["Subscribe", "Unsubscribe"][torpedo]
showNotification "Successfully " + endpoint + "d.", true
else
showNotification "Couldn't unsubscribe from the answer.", false
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->

View File

@ -9,7 +9,21 @@
#= require cheet
#= require jquery.guillotine
#= require sweet-alert
#= require_tree .
# local requires to be seen by everyone:
#= require_tree ./answerbox
#= require_tree ./questionbox
#= require groups
#= require inbox
#= require memes
#= require notifications
#= require pagination
#= require piwik
#= require question
#= require settings
#= require user
#= require report
# not required:
# _tree ./moderation
NProgress.configure
showSpinner: false
@ -27,7 +41,8 @@ $(document).on "click", "button#create-account", ->
Turbolinks.visit "/sign_up"
_ready = ->
sweetAlertInitialize()
if typeof sweetAlertInitialize != "undefined"
sweetAlertInitialize()
$(document).ready _ready
$(document).on 'page:load', _ready

View File

@ -40,6 +40,7 @@
success: (data, status, jqxhr) ->
if data.success
succ = yes
($ "div#pagination, button#load-more-btn").slideUp()
entries = ($ "div#entries")
entries.slideUp 400, ->
entries.html("Nothing to see here.")
@ -121,3 +122,19 @@ $(document).on "click", "button[name=ib-destroy]", ->
complete: (jqxhr, status) ->
btn.button "reset"
$("textarea[name=ib-answer][data-id=#{iid}]").removeAttr "readonly"
# Toggle button
$(document).on "click", "button[name=ib-options]", ->
btn = $(this)
ibid = btn[0].dataset.ibId
state = btn[0].dataset.state
optionBox = $("#ib-options-#{ibid}")
switch state
when 'hidden'
optionBox.slideDown()
btn[0].dataset.state = 'shown'
when 'shown'
optionBox.slideUp()
btn[0].dataset.state = 'hidden'

View File

@ -0,0 +1,3 @@
#= require moment
#= require bootstrap-datetimepicker
#= require_tree ./moderation

View File

@ -0,0 +1,58 @@
$(document).on "DOMContentLoaded", ->
parent = $ "#ban-control-super"
parent.find('#_ban').on "change", (event) ->
$t = $ this
if $t.is(":checked")
$("#ban-controls").show()
else
$("#ban-controls").hide()
parent.find('#_permaban').on "change", (event) ->
$t = $ this
if $t.is(":checked")
$("#ban-controls-time").hide()
else
$("#ban-controls-time").show()
parent.find("#until").datetimepicker
defaultDate: parent.find("#until").val()
sideBySide: true
icons:
time: "fa fa-clock-o"
date: "fa fa-calendar"
up: "fa fa-chevron-up"
down: "fa fa-chevron-down"
previous: "fa fa-chevron-left"
next: "fa fa-chevron-right"
today: "fa fa-home"
clear: "fa fa-trash-o"
close: "fa fa-times"
parent.parent()[0].addEventListener "submit", (event) ->
event.preventDefault();
$("#modal-ban").modal "hide"
checktostr = (selector) ->
if $(selector)[0].checked
"1"
else
"0"
data = {
ban: checktostr "#_ban"
permaban: checktostr "#_permaban"
until: $("#until")[0].value.trim()
reason: $("#reason")[0].value.trim()
user: $("#_user")[0].value
}
$.ajax
url: '/ajax/mod/ban'
type: 'POST'
data: data
success: (data, status, jqxhr) ->
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->

View File

@ -0,0 +1,24 @@
($ document).on "click", "input[type=checkbox][name=check-your-privileges]", ->
box = $(this)
box.attr 'disabled', 'disabled'
privType = box[0].dataset.type
boxChecked = box[0].checked
$.ajax
url: '/ajax/mod/privilege'
type: 'POST'
data:
user: box[0].dataset.user
type: privType
status: boxChecked
success: (data, status, jqxhr) ->
if data.success
box[0].checked = if data.checked? then data.checked else !boxChecked
showNotification data.message, data.success
error: (jqxhr, status, error) ->
box[0].checked = false
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->
box.removeAttr "disabled"

View File

@ -13,6 +13,6 @@ _paq.push(['setDocumentTitle', document.title]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
<% else %>
<% elsif !Rails.env.test? %>
console.log("i track'd ur bich");
<% end %>

View File

@ -0,0 +1,30 @@
$(document).on "click", "a[data-action=ab-question-destroy]", (ev) ->
ev.preventDefault()
btn = $(this)
qid = btn[0].dataset.qId
swal
title: "Are you sure?"
text: "The question will be removed."
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes"
cancelButtonText: "No"
closeOnConfirm: true
, ->
$.ajax
url: '/ajax/destroy_question' # TODO: find a way to use rake routes instead of hardcoding them here
type: 'POST'
data:
question: qid
success: (data, status, jqxhr) ->
if data.success
if btn[0].dataset.redirect != undefined
window.location.pathname = btn[0].dataset.redirect
else
$("div.answerbox[data-q-id=#{qid}], div.questionbox[data-id=#{qid}]").slideUp()
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->

View File

@ -0,0 +1,5 @@
$(document).on "click", "a[data-action=ab-question-report]", (ev) ->
ev.preventDefault()
btn = $(this)
qId = btn[0].dataset.qId
reportDialog "question", qId, -> btn.button "reset"

View File

@ -0,0 +1,28 @@
window.reportDialog = (type, target, callback) ->
swal
title: "Really report this #{type}?"
text: "A moderator will review your report and decide what happens.\nIf you'd like, you can also specify a reason."
type: "input"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Report"
closeOnConfirm: true
inputPlaceholder: "Specify a reason..."
, (value) ->
if typeof value == "boolean" && value == false
return false
$.ajax
url: '/ajax/report'
type: 'POST'
data:
id: target
type: type
reason: value
success: (data, status, jqxhr) ->
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->
callback type, target, jqxhr, status

View File

@ -50,26 +50,4 @@ $(document).on "click", "a[data-action=report-user]", (ev) ->
ev.preventDefault()
btn = $(this)
target = btn[0].dataset.target
swal
title: "Really report #{target}?"
text: "A moderator will review this user and decide what happens."
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Report"
closeOnConfirm: true
, ->
$.ajax
url: '/ajax/report'
type: 'POST'
data:
id: target
type: 'user'
success: (data, status, jqxhr) ->
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) ->
btn.button "reset"
reportDialog "user", target, -> btn.button "reset"

View File

@ -6,9 +6,9 @@
*= require_self
*/
@import url(https://fonts.googleapis.com/css?family=Exo+2:400,700);
@import url(https://fonts.googleapis.com/css?family=Lato:400,700);
$font-family-sans-serif: "Exo 2","Open Sans", "Helvetica Neue", Helvetica, "DejaVu Sans", Arial, sans-serif;
$font-family-sans-serif: "Lato","Open Sans", "Helvetica Neue", Helvetica, "DejaVu Sans", Arial, sans-serif;
$font-family-serif: Georgia, "DejaVu Serif", "Times New Roman", Times, serif;
//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.
$font-family-monospace: "PragmataPro", Monaco, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace;
@ -28,10 +28,11 @@ $font-size-h6: ceil(($font-size-base * 0.85)); // ~12px
$brand-primary: #5e35b1;
$navbar-inverse-bg: #5e35b1;
$navbar-inverse-link-color: #ffffff;
$navbar-inverse-link-hover-color: #bfbfbf;
$navbar-inverse-link-hover-color: #ffffff;
$navbar-inverse-link-hover-bg: transparent;
$navbar-inverse-link-active-color: #bfbfbf;
$navbar-inverse-link-active-bg: darken($navbar-inverse-bg, 6.5%);
$navbar-inverse-link-active-color: #ffffff;
$navbar-inverse-link-active-bg: transparent;
$navbar-inverse-link-active-bg-mobile: darken(#5e35b1, 7%);
$navbar-inverse-link-disabled-color: darken(#fff, 12.5%);
$navbar-inverse-link-disabled-bg: transparent;
$navbar-inverse-brand-color: $navbar-inverse-link-color;
@ -41,16 +42,23 @@ $navbar-inverse-toggle-hover-bg: #512da8;
$navbar-inverse-toggle-icon-bar-bg: #7e57c2;
$navbar-inverse-toggle-border-color: #512da8;
@import "bootswatch/paper/variables";
@import "bootswatch/cosmo/variables";
@import "bootstrap";
body { padding-top: $navbar-height; }
@import "bootswatch/paper/bootswatch";
@import 'bootstrap-datetimepicker';
.remove-native-picker::-webkit-calendar-picker-indicator{
display: none
}
@import "bootswatch/cosmo/bootswatch";
@import "base";
@import "font-awesome";
$nprogress-color: darken($navbar-inverse-bg, 15%);
$nprogress-color: lighten($navbar-inverse-bg, 25%);
@import 'nprogress';
@import 'nprogress-bootstrap';

View File

@ -6,6 +6,7 @@ body {
background-color: #fafafa;
}
@import "scss/generic";
@import "scss/answerbox";
@import "scss/comments";
@import "scss/entry";
@ -19,6 +20,16 @@ body {
padding-top: 30px;
}
.question-page {
padding-top: 100px;
}
@media(max-width: $screen-xs-max) {
.question-page {
padding-top: 130px;
}
}
.centre {
text-align: center;
}
@ -68,6 +79,14 @@ body {
list-style: none;
}
.about--moderator a {
text-decoration: none;
}
.about--moderator a:hover {
text-decoration: none;
}
.j2-up {
text-transform: uppercase;
}
@ -96,4 +115,35 @@ body {
.j2-delete {
color: $brand-danger;
text-decoration: none;
}
}
.j2-navbar {
margin-bottom: 0px;
}
@media (max-width: $screen-xs-max) {
.j2-col-reset {
padding-left: 0px;
padding-right: 0px;
}
}
#growls.default{
top:64px;
right:10px
}
.links {
padding-bottom: 10px;
}
.panel {
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.25);
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.25);
-webkit-background-clip: padding-box;
background-clip: padding-box;
}
.panel-default {
border-color: transparent;
}

View File

@ -17,7 +17,7 @@
width: 20px;
}
.answerbox--question-text, .answerbox--question-user {
.answerbox--question-text, .answerbox--question-user, .answerbox--answer-user, .answerbox--answer-date {
margin-bottom: 0px;
overflow: hidden;
}
@ -30,4 +30,30 @@
font-size: 16px;
color: #000;
line-height: 1.3em;
}
}
.answerbox--question-text {
line-height: 1.3em;
overflow: hidden;
}
.answerbox--answer-date {
font-size: 12px;
line-height: 1.3em;
}
.answerbox [name="ab-smile"], .answerbox [name="ab-smile-comment"] {
padding: 6px 11px;
padding-left: 21px;
position: relative;
overflow: hidden;
border: none;
i.fa.fa-smile-o, i.fa.fa-frown-o, i.fa.fa-meh-o {
position: absolute;
font-size: 3em;
left: -13px;
top: -10px;
display: block;
}
}

View File

@ -0,0 +1,26 @@
.user-list {
margin: 0;
padding: 0;
}
.user-list-entry-smiles {
* {
display: inline-block;
vertical-align: middle;
}
img {
height: 64px
}
span {
margin-left: 5px;
}
a:hover {
text-decoration: none;
span {
text-decoration: underline;
}
}
}

View File

@ -1,11 +1,13 @@
.navbar .nav .badge {
padding: 3px 6px 3px;
background-color: $navbar-inverse-link-active-bg;
color: #fff;
}
.navbar .nav .active .badge {
.navbar .nav .active .badge, li.dropdown.open a.dropdown-toggle span.badge {
padding: 3px 6px 3px;
background-color: $navbar-inverse-bg;
color: #fff;
}
.navbar--inbox-animation {
@ -84,4 +86,101 @@
margin-right: 7px;
margin-bottom: 7px;
z-index: 99;
}
}
.profile--dropdown {
min-width: 220px;
margin-top: 0px !important;
}
.profile--dropdown-media {
padding: 3px 15px;
}
.profile--dropdown-img {
min-height: 45px;
min-width: 45px;
height: 45px;
width: 45px;
}
.profile--dropdown-username {
font-weight: 700;
font-size: 1.2em;
line-height: 1.33em;
margin-top: 10px;
}
.profile--dropdown-displayname {
font-weight: 700;
font-size: 1.2em;
line-height: 1.33em;
margin-top: 2px;
}
.profile--image-dropdown > a {
padding: 0px !important;
}
.profile--image-avatar {
min-height: 50px;
min-width: 50px;
height: 50px;
width: 50px;
}
.navbar-inverse {
border: none;
}
@media (min-width: 768px) {
nav.navbar .nav > li:not(.profile--image-dropdown) {
-moz-osx-font-smoothing: grayscale;
position: relative;
&:before {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 0;
background: $navbar-inverse-link-color;
height: 0px;
-webkit-transition-property: height;
transition-property: height;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
&:hover, &:focus, &:active {
&:before {
height: 4px
}
}
&.active:before {
height: 4px;
}
}
}
@media (max-width: 768px) {
nav.navbar .nav {
margin-bottom: 0;
margin-top: 0;
& > li {
&.active a {
background-color: $navbar-inverse-link-active-bg-mobile !important;
}
&.dropdown.profile--image-dropdown a .visible-xs {
padding-left: 15px;
line-height: 40px;
margin: 0;
}
}
}
}

View File

@ -19,4 +19,30 @@
color: $gray;
opacity: 0.4;
z-index: 0;
}
.notification--dropdown {
min-width: 370px;
margin-top: 0px !important;
}
.notification--dropdown-media {
padding: 3px 5px;
}
.notification--dropdown-user, .notification--dropdown-text {
margin-bottom: 0px;
overflow: hidden;
line-height: 1.3em;
}
.notification--dropdown-user {
margin-top: 0px;
}
.notification--dropdown-img {
min-height: 32px;
min-width: 32px;
height: 32px;
width: 32px;
}

View File

@ -11,4 +11,22 @@
.panel-primary .answerbox--question-text {
color: #fff;
}
}
#questions .panel-body .media {
&, .media-body {
overflow: visible;
}
}
.panel-question {
position: fixed;
border-top: 1px solid #fff;
width: 100%;
z-index: 999;
border-color: #fff;
}
.answerbox--question-media, .question-media, .question-body {
overflow: visible !important;
}

View File

@ -22,27 +22,6 @@
margin: 0px 0px 0.2em;
}
.profile--admin {
color: $brand-danger;
text-transform: uppercase;
font-weight: bold;
font-size: 80%;
}
.profile--moderator {
color: $brand-success;
text-transform: uppercase;
font-weight: bold;
font-size: 80%;
}
.profile--supporter {
color: $brand-warning;
text-transform: uppercase;
font-weight: bold;
font-size: 80%;
}
.profile--text {
margin-bottom: 2px;
line-height: 1.5em;
@ -88,8 +67,6 @@
}
.profile--avatar {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
width: 100%;
height: auto;
border: medium none;
@ -98,28 +75,25 @@
.profile--panel-badge {
width: 100%;
text-align: center;
padding-top: 0.05em;
padding-bottom: 0.05em;
padding-top: 0.15em;
padding-bottom: 0.15em;
text-transform: uppercase;
font-weight: bold;
margin: 0;
color: #fff;
}
.panel-badge-danger {
background-color: #E51C23;
}
$colours: danger $brand-danger,
default #BBB,
success $brand-success,
warning $brand-warning,
primary $brand-primary,
info #2980b9;
.panel-badge-default {
background-color: #BBB;
}
.panel-badge-success {
background-color: #4CAF50;
}
.panel-badge-warning {
background-color: #FF9800;
@each $colour in $colours {
.panel-badge-#{nth($colour, 1)} {
background-color: nth($colour, 2);
}
}
.user--banned {

View File

@ -0,0 +1,2 @@
$main-color: #5e35b1;
$black: #000;

View File

@ -104,4 +104,76 @@ class Ajax::ModerationController < ApplicationController
@message = "Successfully deleted comment."
@success = true
end
def ban
@status = :err
@message = "Weird..."
@success = false
params.require :user
params.require :ban
params.require :permaban
reason = params[:reason]
target = User.find_by_screen_name(params[:user])
unban = params[:ban] == "0"
perma = params[:permaban] == "1"
buntil = DateTime.strptime params[:until], "%m/%d/%Y %I:%M %p" unless unban or perma
if not unban and target.admin?
@status = :nopriv
@message = "You cannot ban an administrator!"
@success = false
return
end
if unban
target.unban
@message = "Unbanned user."
@success = true
elsif perma
target.ban nil, reason
@message = "Permanently banned user."
else
target.ban buntil, reason
@message = "Banned user until #{buntil.to_s}"
end
target.save!
@status = :okay
@success = target.banned? == !unban
end
def privilege
@status = :err
@success = false
params.require :user
params.require :type
params.require :status
status = params[:status] == 'true'
target_user = User.find_by_screen_name(params[:user])
@message = "nope!"
return unless %w(blogger supporter moderator admin contributor).include? params[:type].downcase
if %w(supporter moderator admin).include?(params[:type].downcase) and !current_user.admin?
@status = :nopriv
@message = "You'd better check YOUR privileges first!"
@success = false
return
end
@checked = status
target_user.send("#{params[:type]}=", status)
target_user.save!
@message = "Successfully checked this user's #{params[:type]} privilege."
@status = :okay
@success = true
end
end

View File

@ -1,4 +1,31 @@
class Ajax::QuestionController < ApplicationController
include MarkdownHelper
def destroy
params.require :question
question = Question.find params[:question]
if question.nil?
@status = :not_found
@message = "Question does not exist"
@success = false
return
end
if not (current_user.mod? or question.user == current_user)
@status = :not_authorized
@message = "You are not allowed to delete this question"
@success = false
return
end
question.destroy!
@status = :okay
@message = "Successfully deleted question."
@success = true
end
def create
params.require :question
params.require :anonymousQuestion
@ -46,4 +73,20 @@ class Ajax::QuestionController < ApplicationController
@message = "Question asked successfully."
@success = true
end
def preview
params.require :md
@message = "Failed to render markdown."
begin
@markdown = markdown(params[:md], Time.new)
@message = "Successfully rendered markdown."
rescue
@status = :fail
@success = false
return
end
@status = :okay
@success = true
end
end

View File

@ -22,13 +22,12 @@ class Ajax::ReportController < ApplicationController
params[:type].strip.capitalize.constantize.find params[:id]
end
if object.nil?
@message = "Could not find #{params[:type]}"
return
end
current_user.report object
current_user.report object, params[:reason]
@status = :okay
@message = "#{params[:type].capitalize} reported. A moderator will decide what happens with the #{params[:type]}."

View File

@ -36,4 +36,42 @@ class Ajax::SmileController < ApplicationController
@message = "Successfully unsmiled answer."
@success = true
end
def create_comment
params.require :id
comment = Comment.find(params[:id])
begin
current_user.smile_comment comment
rescue
@status = :fail
@message = "You have already smiled that comment."
@success = false
return
end
@status = :okay
@message = "Successfully smiled comment."
@success = true
end
def destroy_comment
params.require :id
comment = Comment.find(params[:id])
begin
current_user.unsmile_comment comment
rescue
@status = :fail
@message = "You have not smiled that comment."
@success = false
return
end
@status = :okay
@message = "Successfully unsmiled comment."
@success = true
end
end

View File

@ -0,0 +1,19 @@
class Ajax::SubscriptionController < ApplicationController
before_filter :authenticate_user!
def subscribe
params.require :answer
@status = 418
@message = "418 I'm a torpedo"
state = Subscription.subscribe(current_user, Answer.find(params[:answer])).nil?
@success = state == false
end
def unsubscribe
params.require :answer
@status = 418
@message = "418 I'm a torpedo"
state = Subscription.unsubscribe(current_user, Answer.find(params[:answer])).nil?
@success = state == false
end
end

View File

@ -2,5 +2,20 @@ class AnswerController < ApplicationController
def show
@answer = Answer.find(params[:id])
@display_all = true
if user_signed_in?
notif = Notification.where(target_type: "Answer", target_id: @answer.id, recipient_id: current_user.id, new: true).first
unless notif.nil?
notif.new = false
notif.save
end
notif = Notification.where(target_type: "Comment", target_id: @answer.comments.pluck(:id), recipient_id: current_user.id, new: true)
notif.update_all(new: false) unless notif.empty?
notif = Notification.where(target_type: "Smile", target_id: @answer.smiles.pluck(:id), recipient_id: current_user.id, new: true)
notif.update_all(new: false) unless notif.empty?
# @answer.comments.smiles throws
notif = Notification.where(target_type: "CommentSmile", target_id: @answer.comment_smiles.pluck(:id), recipient_id: current_user.id, new: true)
notif.update_all(new: false) unless notif.empty?
end
end
end

View File

@ -2,7 +2,7 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
before_filter :banned?
@ -12,6 +12,13 @@ class ApplicationController < ActionController::Base
name = current_user.screen_name
# obligatory '2001: A Space Odyssey' reference
flash[:notice] = "I'm sorry, #{name}, I'm afraid I can't do that."
unless current_user.ban_reason.nil?
flash[:notice] += "\nBan reason: #{current_user.ban_reason}"
end
if not current_user.permanently_banned?
# TODO format banned_until
flash[:notice] += "\nBanned until: #{current_user.banned_until}"
end
sign_out current_user
redirect_to new_user_session_path
end

View File

@ -2,6 +2,10 @@ class InboxController < ApplicationController
before_filter :authenticate_user!
def show
@inbox = Inbox.where(user: current_user).order(:created_at).reverse_order
@inbox = Inbox.where(user: current_user).order(:created_at).reverse_order.paginate(page: params[:page])
respond_to do |format|
format.html
format.js
end
end
end

View File

@ -16,4 +16,12 @@ class StaticController < ApplicationController
def faq
end
def privacy_policy
end
def terms
end
end

View File

@ -4,6 +4,15 @@ class UserController < ApplicationController
def show
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first!
@answers = @user.answers.reverse_order.paginate(page: params[:page])
if user_signed_in?
notif = Notification.where(target_type: "Relationship", target_id: @user.active_relationships.where(target_id: current_user.id).pluck(:id), recipient_id: current_user.id, new: true).first
unless notif.nil?
notif.new = false
notif.save
end
end
respond_to do |format|
format.html
format.js

View File

@ -20,6 +20,24 @@ module ApplicationHelper
content_tag(:li, link_to(body.html_safe, path), class: ("#{'active ' if current_page? path}#{options[:class]}"))
end
def list_group_item(body, path, options = {})
options = {
badge: nil,
badge_color: nil,
class: ''
}.merge(options)
unless options[:badge].nil? or options[:badge] == 0
# TODO: make this prettier?
body << " #{
content_tag(:span, options[:badge], class: ("badge#{
" badge-#{options[:badge_color]}" unless options[:badge_color].nil?
}"))}"
end
content_tag(:a, body.html_safe, href: path, class: ("list-group-item #{'active ' if current_page? path}#{options[:class]}"))
end
##
#

View File

@ -9,4 +9,9 @@ module MarkdownHelper
md = Redcarpet::Markdown.new(Redcarpet::Render::StripDown, MARKDOWN_OPTS)
CGI.unescape_html(Sanitize.fragment(md.render(content), EVIL_TAGS)).strip
end
def twitter_markdown(content)
md = Redcarpet::Markdown.new(TwitteredMarkdown, MARKDOWN_OPTS)
CGI.unescape_html(Sanitize.fragment(md.render(content), EVIL_TAGS)).strip
end
end

View File

@ -0,0 +1,2 @@
module SubscribeHelper
end

View File

@ -3,21 +3,27 @@ class Answer < ActiveRecord::Base
belongs_to :question
has_many :comments, dependent: :destroy
has_many :smiles, dependent: :destroy
has_many :subscriptions, dependent: :destroy
has_many :comment_smiles, through: :comments, source: :smiles
after_create do
Inbox.where(user: self.user, question: self.question).destroy_all
Notification.notify self.question.user, self unless self.question.author_is_anonymous
Notification.notify self.question.user, self unless self.question.user == self.user or self.question.user.nil?
Subscription.subscribe self.user, self
Subscription.subscribe self.question.user, self unless self.question.author_is_anonymous
self.user.increment! :answered_count
self.question.increment! :answer_count
end
before_destroy do
# mark a report as deleted if it exists
rep = Report.where(target_id: self.id).first
unless rep.nil?
rep.deleted = true
rep.save
rep = Report.where(target_id: self.id, type: 'Reports::Answer')
rep.each do |r|
unless r.nil?
r.deleted = true
r.save
end
end
self.user.decrement! :answered_count
@ -27,9 +33,10 @@ class Answer < ActiveRecord::Base
end
self.comments.each do |comment|
comment.user.decrement! :commented_count
Notification.denotify self.user, comment
Subscription.denotify comment, self
end
Notification.denotify self.question.user, self
Subscription.destruct self
end
def notification_type(*_args)

View File

@ -3,18 +3,28 @@ class Comment < ActiveRecord::Base
belongs_to :answer
validates :user_id, presence: true
validates :answer_id, presence: true
has_many :smiles, class_name: "CommentSmile", foreign_key: :comment_id, dependent: :destroy
validates :content, length: { maximum: 160 }
after_create do
Notification.notify answer.user, self unless answer.user == self.user
Subscription.subscribe self.user, answer, false
Subscription.notify self, answer
user.increment! :commented_count
answer.increment! :comment_count
end
before_destroy do
Notification.denotify answer.user, self unless answer.user == self.user
user.decrement! :commented_count
rep = Report.where(target_id: self.id, type: 'Reports::Comment')
rep.each do |r|
unless r.nil?
r.deleted = true
r.save
end
end
Subscription.denotify self, answer
user.decrement! :commented_count
answer.decrement! :comment_count
end

View File

@ -0,0 +1,22 @@
class CommentSmile < ActiveRecord::Base
belongs_to :user
belongs_to :comment
validates :user_id, presence: true, uniqueness: { scope: :comment_id, message: "already smiled comment" }
validates :comment_id, presence: true
after_create do
Notification.notify comment.user, self unless comment.user == user
user.increment! :comment_smiled_count
comment.increment! :smile_count
end
before_destroy do
Notification.denotify comment.user, self unless comment.user == user
user.decrement! :comment_smiled_count
comment.decrement! :smile_count
end
def notification_type(*_args)
Notifications::CommentSmiled
end
end

View File

@ -3,7 +3,7 @@ class Inbox < ActiveRecord::Base
belongs_to :question
before_create do
raise "User does not want to receive anonymous questions" if self.question.author_is_anonymous and !self.user.privacy_allow_anonymous_questions?
raise "User does not want to receive anonymous questions" if self.question.author_is_anonymous and self.question.author_name != 'justask' and !self.user.privacy_allow_anonymous_questions?
end
def answer(answer_content, user)

View File

@ -4,7 +4,7 @@ class Notification < ActiveRecord::Base
class << self
def for(recipient, options={})
self.where(options.merge!(recipient: recipient)).order(:updated_at).reverse_order
self.where(options.merge!(recipient: recipient)).order(:created_at).reverse_order
end
def notify(recipient, target)

View File

@ -0,0 +1,2 @@
class Notifications::CommentSmiled < Notification
end

View File

@ -6,6 +6,14 @@ class Question < ActiveRecord::Base
validates :content, length: { maximum: 255 }
before_destroy do
rep = Report.where(target_id: self.id, type: 'Reports::Question')
rep.each do |r|
unless r.nil?
r.deleted = true
r.save
end
end
user.decrement! :asked_count unless self.author_is_anonymous
end

View File

@ -28,8 +28,8 @@ class Services::Twitter < Service
def prepare_tweet(answer)
# TODO: improve this.
question_content = strip_markdown answer.question.content
answer_content = strip_markdown answer.content
question_content = twitter_markdown answer.question.content.gsub(/\@(\w+)/, '\1')
answer_content = twitter_markdown answer.content
answer_url = show_user_answer_url(
id: answer.id,
username: answer.user.screen_name,
@ -39,4 +39,4 @@ class Services::Twitter < Service
"#{question_content[0..54]}#{'…' if question_content.length > 55}" \
"#{answer_content[0..55]}#{'…' if answer_content.length > 56} #{answer_url}"
end
end
end

View File

@ -0,0 +1,73 @@
class Subscription < ActiveRecord::Base
belongs_to :user
belongs_to :answer
class << self
def for(target)
Subscription.where(answer: target)
end
def is_subscribed(recipient, target)
existing = Subscription.find_by(user: recipient, answer: target)
if existing.nil?
false
else
existing.is_active
end
end
def subscribe(recipient, target, force = true)
existing = Subscription.find_by(user: recipient, answer: target)
if existing.nil?
Subscription.new(user: recipient, answer: target).save!
elsif force
existing.update(is_active: true)
end
end
def unsubscribe(recipient, target)
if recipient.nil? or target.nil?
return nil
end
subs = Subscription.find_by(user: recipient, answer: target)
subs.update(is_active: false) unless subs.nil?
end
def destruct(target)
if target.nil?
return nil
end
Subscription.where(answer: target).destroy_all
end
def destruct_by(recipient, target)
if recipient.nil? or target.nil?
return nil
end
subs = Subscription.find_by(user: recipient, answer: target)
subs.destroy unless subs.nil?
end
def notify(source, target)
if source.nil? or target.nil?
return nil
end
Subscription.where(answer: target, is_active: true).each do |subs|
next unless not subs.user == source.user
Notification.notify subs.user, source
end
end
def denotify(source, target)
if source.nil? or target.nil?
return nil
end
Subscription.where(answer: target).each do |subs|
Notification.denotify subs.user, source
end
end
end
end

View File

@ -20,6 +20,7 @@ class User < ActiveRecord::Base
has_many :friends, through: :active_relationships, source: :target
has_many :followers, through: :passive_relationships, source: :source
has_many :smiles, dependent: :destroy
has_many :comment_smiles, dependent: :destroy
has_many :services, dependent: :destroy
has_many :notifications, foreign_key: :recipient_id, dependent: :destroy
has_many :reports, dependent: :destroy
@ -28,6 +29,8 @@ class User < ActiveRecord::Base
has_many :groups, dependent: :destroy
has_many :group_memberships, class_name: "GroupMember", foreign_key: 'user_id', dependent: :destroy
has_many :subscriptions, dependent: :destroy
SCREEN_NAME_REGEX = /\A[a-zA-Z0-9_]{1,16}\z/
WEBSITE_REGEX = /https?:\/\/([A-Za-z.\-]+)\/?(?:.*)/i
@ -57,6 +60,17 @@ class User < ActiveRecord::Base
end unless website.blank?
end
# when a user deleted himself, all reports relating to the user are invalid
before_destroy do
rep = Report.where(target_id: self.id, type: 'Reports::User')
rep.each do |r|
unless r.nil?
r.deleted = true
r.save
end
end
end
def login=(login)
@login = login
end
@ -66,7 +80,7 @@ class User < ActiveRecord::Base
end
def self.find_first_by_auth_conditions(warden_conditions)
conditions = warden_conditions.dup.to_h
conditions = warden_conditions.dup
if login = conditions.delete(:login)
where(conditions).where(["lower(screen_name) = :value OR lower(email) = :value", { :value => login.downcase }]).first
else
@ -127,10 +141,26 @@ class User < ActiveRecord::Base
Smile.find_by(user: self, answer: answer).destroy
end
# smiles a comment
# @param comment [Comment] the comment to smile
def smile_comment(comment)
CommentSmile.create!(user: self, comment: comment)
end
# unsmile an comment
# @param comment [Comment] the comment to unsmile
def unsmile_comment(comment)
CommentSmile.find_by(user: self, comment: comment).destroy
end
def smiled?(answer)
answer.smiles.pluck(:user_id).include? self.id
end
def smiled_comment?(comment)
comment.smiles.pluck(:user_id).include? self.id
end
def display_website
website.match(/https?:\/\/([A-Za-z.\-0-9]+)\/?(?:.*)/i)[1]
rescue NoMethodError
@ -147,8 +177,19 @@ class User < ActiveRecord::Base
end
# region stuff used for reporting/moderation
def report(object)
Report.create(type: "Reports::#{object.class}", target_id: object.id, user_id: self.id)
def report(object, reason = nil)
existing = Report.find_by(type: "Reports::#{object.class}", target_id: object.id, user_id: self.id, deleted: false)
if existing.nil?
Report.create(type: "Reports::#{object.class}", target_id: object.id, user_id: self.id, reason: reason)
elsif not reason.nil? and reason.length > 0
if existing.reason.nil?
existing.update(reason: reason)
else
existing.update(reason: [existing.reason || "", reason].join("\n"))
end
else
existing
end
end
# @param upvote [Boolean]
@ -183,4 +224,21 @@ class User < ActiveRecord::Base
def cropping?
!crop_x.blank? && !crop_y.blank? && !crop_w.blank? && !crop_h.blank?
end
# forwards fill
def banned?
self.permanently_banned? or ((not self.banned_until.nil?) and self.banned_until >= DateTime.current)
end
def unban
self.update(permanently_banned: false, ban_reason: nil, banned_until: nil)
end
def ban(buntil=nil, reason=nil)
if buntil == nil
self.update(permanently_banned: true, ban_reason: reason)
else
self.update(permanently_banned: false, banned_until: buntil, ban_reason: reason)
end
end
end

View File

@ -0,0 +1,23 @@
class TwitteredMarkdown < Redcarpet::Render::StripDown
def preprocess(text)
wrap_mentions(text)
end
def wrap_mentions(text)
text.gsub! /(^|\s)@([a-zA-Z0-9_]{1,16})/ do
local_user = User.find_by_screen_name($2)
if local_user.nil?
"#{$1}#{$2}"
else
service = local_user.services.where(type: "Services::Twitter").first
if service.nil?
"#{$1}#{$2}"
else
"#{$1}@#{service.nickname}"
end
end
end
text
end
end

View File

@ -1,12 +1,12 @@
class ScreenNameValidator < ActiveModel::EachValidator
FORBIDDEN_SCREEN_NAMES = %w(justask_admin retrospring_admin admin justask retrospring support about public
FORBIDDEN_SCREEN_NAMES = %w(justask_admin retrospring_admin admin justask retrospring about public
notifications inbox sign_in sign_up sidekiq moderation moderator mod administrator
siteadmin site_admin help retro_spring retroospring retrosprlng niisding nllsding
group settings)
siteadmin site_admin help retro_spring retroospring retrosprlng niisding nllsding
pixeidesu plxeldesu plxeidesu terms privacy)
def validate_each(record, attribute, value)
if FORBIDDEN_SCREEN_NAMES.include? value.downcase
record.errors[attribute] << "Thou shalt not use this username! Please choose another one."
end
end
end
end

View File

@ -0,0 +1 @@
json.partial! 'ajax/shared/status'

View File

@ -0,0 +1,2 @@
json.partial! 'ajax/shared/status'
json.checked @checked

View File

@ -0,0 +1 @@
json.partial! 'ajax/shared/status'

View File

@ -0,0 +1,2 @@
json.partial! 'ajax/shared/status'
json.markdown @markdown if @markdown

View File

@ -0,0 +1 @@
json.partial! 'ajax/shared/status'

View File

@ -0,0 +1 @@
json.partial! 'ajax/shared/status'

View File

@ -0,0 +1 @@
json.partial! 'ajax/shared/status'

View File

@ -0,0 +1 @@
json.partial! 'ajax/shared/status'

View File

@ -3,7 +3,7 @@
= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
= devise_error_messages!
= f.text_field :screen_name, autofocus: true, label: "User name"
= f.text_field :login, autofocus: true, label: "User name"
= f.submit "Send me password reset instructions"
= render "devise/shared/links"

View File

@ -10,6 +10,9 @@
= f.password_field :password, autocomplete: "off", label: "Password"
= f.password_field :password_confirmation, autocomplete: "off", label: "Confirm password"
%p
With signing up you accept our
= link_to "Terms of Service", terms_path
= f.submit "Sign up"
= render "devise/shared/links"

View File

@ -1,7 +1,8 @@
= render 'static/mobile_nav'
.container.j2-page
.col-md-3.col-sm-3
= render 'shared/sidebar'
.col-md-9.col-xs-12.col-sm-9
.col-md-9.col-xs-12.col-sm-9.j2-col-reset
= render 'layouts/messages'
#timeline

View File

@ -8,7 +8,8 @@
%h6.text-muted.media-heading.answerbox--question-user
= user_screen_name i.question.user, i.question.author_is_anonymous
asked
= time_ago_in_words(i.question.created_at)
%span{title: i.question.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words(i.question.created_at)
ago
- unless i.question.author_is_anonymous
- if i.question.answer_count > 0
@ -23,8 +24,21 @@
Answer
%button.btn.btn-danger{name: 'ib-destroy', data: { ib_id: i.id }}
Delete
- current_user.services.each do |service|
%label
%input{type: 'checkbox', name: 'ib-share', checked: :checked, data: { ib_id: i.id, service: service.provider }}
Post to
= service.provider.capitalize
%button.btn.btn-default{name: 'ib-options', data: { ib_id: i.id, state: :hidden }}
%i.fa.fa-cog
%span.sr-only Options
.panel-footer{id: "ib-options-#{i.id}", style: 'display: none'}
%h4 Sharing
- if current_user.services.count > 0
.row
- current_user.services.each do |service|
.col-md-3.col-sm-4.col-xs-6
%label
%input{type: 'checkbox', name: 'ib-share', checked: :checked, data: { ib_id: i.id, service: service.provider }}
Post to
= service.provider.capitalize
- else
%p
You have not connected any services yet. Visit your
= link_to "service settings", services_path
to connect one.

View File

@ -0,0 +1,20 @@
.panel.panel-default.inbox--panel
.panel-heading
%h3.panel-title Out of questions?
.panel-body
%button.btn.btn-block.btn-info{type: :button, id: 'ib-generate-question'} Get new question
.panel.panel-default.inbox--panel
.panel-heading
%h3.panel-title Share
.panel-body
%a.btn.btn-block.btn-primary{target: '_blank', href: "https://twitter.com/intent/tweet?text=Ask%20me%20anything%21&url=#{show_user_profile_url(current_user.screen_name)}"}
%i.fa.fa-twitter
Share on Twitter
%a.btn.btn-block.btn-primary{target: '_blank', href: "http://www.tumblr.com/share/link?url=#{show_user_profile_url(current_user.screen_name)}&name=Ask%20me%20anything%21"}
%i.fa.fa-tumblr
Share on Tumblr
.panel.panel-default.warning--panel
.panel-heading
%h3.panel-title Actions
.panel-body
%button.btn.btn-block.btn-danger{type: :button, id: 'ib-delete-all', disabled: (Inbox.where(user: current_user).empty? ? 'disabled' : nil), data: { ib_count: Inbox.where(user: current_user).count }} Delete all questions

View File

@ -1,26 +1,7 @@
.container.j2-page
.row
.col-md-3.col-xs-12.col-sm-3
.panel.panel-default.inbox--panel
.panel-heading
%h3.panel-title Out of questions?
.panel-body
%button.btn.btn-block.btn-info{type: :button, id: 'ib-generate-question'} Get new question
.panel.panel-default.inbox--panel
.panel-heading
%h3.panel-title Share
.panel-body
%a.btn.btn-block.btn-primary{target: '_blank', href: "https://twitter.com/intent/tweet?text=Ask%20me%20anything%21&url=#{show_user_profile_url(current_user.screen_name)}"}
%i.fa.fa-twitter
Share on Twitter
%a.btn.btn-block.btn-primary{target: '_blank', href: "http://www.tumblr.com/share/link?url=#{show_user_profile_url(current_user.screen_name)}&name=Ask%20me%20anything%21"}
%i.fa.fa-tumblr
Share on Tumblr
.panel.panel-default.warning--panel
.panel-heading
%h3.panel-title Actions
.panel-body
%button.btn.btn-block.btn-danger{type: :button, id: 'ib-delete-all', disabled: (@inbox.empty? ? 'disabled' : nil), data: { ib_count: @inbox.count }} Delete all questions
.col-md-3.col-xs-12.col-sm-3.hidden-xs
= render 'inbox/sidebar'
.col-md-9.col-xs-12.col-sm-9
= render 'layouts/messages'
#entries
@ -28,8 +9,16 @@
= render 'inbox/entry', i: i
- if @inbox.empty?
Nothing to see here.
#pagination= will_paginate @inbox, renderer: BootstrapPagination::Rails, page_links: false
- if @inbox.next_page
%button#load-more-btn.btn.btn-default{type: :button, data: { current_page: @inbox.current_page }}
Load more
.col-md-9.col-xs-12.col-sm-9.visible-xs
= render 'inbox/sidebar'
= render "shared/links"
- @inbox.update_all(new: false)

View File

@ -0,0 +1,9 @@
$('#entries').append('<% @inbox.each do |i|
%><%= j render 'inbox/entry', i: i
%><% end %>');
<% if @inbox.next_page %>
$('#pagination').html('<%= j will_paginate @inbox, renderer: BootstrapPagination::Rails, page_links: false %>');
<% else %>
$('#pagination, #load-more-btn').remove();
<% end %>
<% Inbox.where(id: @inbox.pluck(:id)).update_all(new: false) %>

View File

@ -22,26 +22,12 @@
%ul.nav.navbar-nav
= nav_entry "Timeline", root_path
= nav_entry "Inbox", "/inbox", badge: inbox_count
= render "layouts/notifications"
%ul.nav.navbar-nav.navbar-right
%li
.btn.btn-primary.navbar-btn.btn-sm.hidden-xs{name: "toggle-all-ask", "data-target" => "#modal-ask-followers", "data-toggle" => "modal", :type => "button"}
= render "layouts/notifications"
%li.hidden-xs{"data-toggle" => "tooltip", "data-placement" => "bottom", title: "Ask a question"}
.btn.btn-link.navbar-btn{name: "toggle-all-ask", "data-target" => "#modal-ask-followers", "data-toggle" => "modal", :type => "button"}
%i.fa.fa-pencil-square-o
%li.dropdown
%a.dropdown-toggle{href: "#", "data-toggle" => "dropdown"}
= current_user.screen_name
%b.caret
%ul.dropdown-menu
%li= link_to "View profile", show_user_profile_path(current_user.screen_name)
%li= link_to "Settings", edit_user_registration_path
%li.divider
- if current_user.admin?
%li= link_to "Kontrollzentrum", rails_admin_path
%li= link_to "Sidekiq", sidekiq_web_path
- if current_user.mod?
%li= link_to "Moderation panel", moderation_path
%li.divider
%li= link_to "Logout", destroy_user_session_path, method: :delete
= render "layouts/profile"
- else
%ul.nav.navbar-nav.navbar-right
= nav_entry "Sign in", new_user_session_path

View File

@ -1 +1,83 @@
= nav_entry "Notifications", notifications_path, badge: notification_count
= nav_entry "Notifications", notifications_path, badge: notification_count, class: 'visible-xs'
- notifications = Notification.for(current_user).limit(4)
%li.dropdown.hidden-xs
%a.dropdown-toggle{href: "#", "data-toggle" => "dropdown"}
- if notification_count.nil?
%i.fa.fa-bell-o
- else
%i.fa.fa-bell
%span.sr-only Notifications
%span.badge= notification_count
%ul.dropdown-menu.notification--dropdown
- if notifications.count == 0
%li.centre.text-muted New notifications will appear here.
- else
- notifications.each do |notification|
%li{class: (notification.new? ? 'list-group-item-warning' : '')}
.media.notification--dropdown-media
- case notification.target_type
- when "Answer"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
.media-body
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.user
.notification--dropdown-text
answered
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id), title: "#{notification.target.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your question
= time_ago_in_words notification.target.created_at
ago
- when "Relationship"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.source)}
.media-body
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.source
.notification--dropdown-text
followed you
= time_ago_in_words notification.target.created_at
ago
- when "Smile"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
.media-body
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.user
.notification--dropdown-text
smiled at
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your answer
= time_ago_in_words notification.target.created_at
ago
- when "CommentSmile"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
.media-body
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.user
.notification--dropdown-text
smiled at
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.comment.answer.id), title: "#{notification.target.comment.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your comment
= time_ago_in_words notification.target.created_at
ago
- when "Comment"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
.media-body
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.user
.notification--dropdown-text
commented on
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
- if notification.target.answer.user == current_user
your
- elsif notification.target.user == notification.target.answer.user
their
- else
= user_screen_name(notification.target.answer.user, false, false) + "'s"
answer
= time_ago_in_words notification.target.created_at
ago
%li= link_to "Show all notifications#{" and mark them as read" if notifications.pluck(:new).any?}", notifications_path

View File

@ -0,0 +1,36 @@
%li.dropdown.profile--image-dropdown
%a.dropdown-toggle{href: "#", "data-toggle" => "dropdown"}
%img.profile--image-avatar.hidden-xs{src: current_user.profile_picture.url(:small)}
%span.visible-xs
= current_user.screen_name
%b.caret
%ul.dropdown-menu
%li.dropdown-header.hidden-xs= current_user.screen_name
%li
%a{href: show_user_profile_path(current_user.screen_name)}
%i.fa.fa-fw.fa-user
View profile
%li
%a{href: edit_user_registration_path}
%i.fa.fa-fw.fa-cog
Settings
%li.divider
- if current_user.admin?
%li
%a{href: rails_admin_path}
%i.fa.fa-fw.fa-cogs
Kontrollzentrum
%li
%a{href: sidekiq_web_path}
%i.fa.fa-fw.fa-bar-chart
Sidekiq
- if current_user.mod?
%li
%a{href: moderation_path}
%i.fa.fa-fw.fa-gavel
Moderation Panel
%li.divider
%li
%a{href: destroy_user_session_path, data: {method: :delete} }
%i.fa.fa-fw.fa-sign-out
Logout

View File

@ -15,6 +15,9 @@
%title= APP_CONFIG['site_name']
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'application', 'data-turbolinks-track' => true
- if user_signed_in?
- if current_user.mod?
= javascript_include_tag 'moderation', 'data-turbolinks-track' => true
= csrf_meta_tags
%body
= render 'layouts/header'

View File

@ -2,7 +2,7 @@
There are no comments yet.
- else
%ul.comments
- report.moderation_comments.all.each do |comment|
- report.moderation_comments.order(:created_at).each do |comment|
%li{data: { comment_id: comment.id }}
.media.comments--media
.pull-left
@ -22,4 +22,4 @@
%p.comments--content= comment.content
.form-group.has-feedback{name: 'mod-comment-new-group', data: { id: report.id }}
%input.form-control.comments--box{type: :text, placeholder: 'Comment...', name: 'mod-comment-new', data: { id: report.id }}
%span.text-muted.form-control-feedback.comments--count{id: "mod-comment-charcount-#{report.id}"} 160
%span.text-muted.form-control-feedback.comments--count{id: "mod-comment-charcount-#{report.id}"} 160

View File

@ -0,0 +1,16 @@
%nav.navbar.navbar-default.navbar-static-top.j2-navbar.visible-xs{role: "navigation"}
.container
.navbar-header
%button.navbar-toggle{"data-target" => "#j2-tl-navbar-collapse", "data-toggle" => "collapse", type: "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand{href: "/"} Moderation
#j2-tl-navbar-collapse.collapse.navbar-collapse
%ul.nav.navbar-nav
= nav_entry "All reports", moderation_path
= nav_entry "Answers", moderation_path('answer')
= nav_entry "Comments", moderation_path('comment')
= nav_entry "Users", moderation_path('user')
= nav_entry "Questions", moderation_path('question')

View File

@ -1,9 +1,8 @@
.col-md-3.col-sm-3.col-xs-12
.panel.panel-default
.panel-body
%ul.nav.nav-pills.nav-stacked
= nav_entry "All reports", moderation_path
= nav_entry "Answers", moderation_path('answer')
= nav_entry "Comments", moderation_path('comment')
= nav_entry "Users", moderation_path('user')
= nav_entry "Questions", moderation_path('question')
.panel.panel-default.hidden-xs
%ul.nav.nav-pills.nav-stacked
= list_group_item "All reports", moderation_path
= list_group_item "Answers", moderation_path('answer')
= list_group_item "Comments", moderation_path('comment')
= list_group_item "Users", moderation_path('user')
= list_group_item "Questions", moderation_path('question')

View File

@ -1,34 +1,47 @@
.panel.panel-default.moderationbox{data: { id: report.id }}
.panel-heading
%img.img-rounded.answerbox--img{src: gravatar_url(report.user)}
= user_screen_name report.user
reported a
= report.type.sub('Reports::', '')
= time_ago_in_words(report.created_at)
ago
.panel-body
%p
- if report.type == 'Reports::User'
= user_screen_name report.target
- else
= report.target.content
.row
.col-md-6.col-sm-4.col-xs-6.text-left
%a.btn.btn-primary{href: content_url(report)}
View reported
= report.type.sub('Reports::', '')
.col-md-6.col-sm-8.col-xs-6.text-right
%span.mod-count{id: "mod-count-#{report.id}"}
= report.votes
.btn-group
%button.btn.btn-success.btn-sm{type: :button, name: "mod-vote", disabled: current_user.report_x_voted?(report, true) ? 'disabled' : nil, data: { id: report.id, action: current_user.report_voted?(report) ? 'unvote' : 'vote', vote_type: 'upvote' }}
%i.fa.fa-thumbs-up
%button.btn.btn-danger.btn-sm{type: :button, name: "mod-vote", disabled: current_user.report_x_voted?(report, false) ? 'disabled' : nil, data: { id: report.id, action: current_user.report_voted?(report) ? 'unvote' : 'vote', vote_type: 'downvote' }}
%i.fa.fa-thumbs-down
%button.btn.btn-primary.btn-sm{type: :button, name: 'mod-comments', data: { id: report.id, state: :hidden }}
%i.fa.fa-comments
%span{id: "mod-comment-count-#{report.id}"}= report.moderation_comments.all.count
%button.btn.btn-default.btn-sm{type: :button, name: "mod-delete-report", data: { id: report.id }}
%i.fa.fa-trash-o
.panel-footer{id: "mod-comments-section-#{report.id}", style: 'display: none'}
%div{id: "mod-comments-#{report.id}"}= render 'moderation/discussion', report: report
- unless report.nil? or report.target.nil? or report.user.nil? or report.type.nil?
.panel.panel-default.moderationbox{data: { id: report.id }}
.panel-heading
%img.img-rounded.answerbox--img{src: gravatar_url(report.user)}
= user_screen_name report.user
reported a
= report.type.sub('Reports::', '')
%span{title: report.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words(report.created_at)
ago
.panel-body
%p
- if report.type == 'Reports::User'
= user_screen_name report.target
- else
= report.target.content
%p
%b
Reason:
%br
- (report.reason || "No reason provided.").lines.each do |reason|
- next unless reason.strip.length > 0
= reason.strip
%br
.row
.col-md-6.col-sm-4.col-xs-6.text-left
%a.btn.btn-primary{href: content_url(report)}
View reported
= report.type.sub('Reports::', '')
- if report.target.respond_to? :user and not report.target.user.nil?
%a.btn.btn-primary{href: show_user_profile_path(report.target.user.screen_name)}
View reported User
.col-md-6.col-sm-8.col-xs-6.text-right
%span.mod-count{id: "mod-count-#{report.id}"}
= report.votes
.btn-group
%button.btn.btn-success.btn-sm{type: :button, name: "mod-vote", disabled: current_user.report_x_voted?(report, true) ? 'disabled' : nil, data: { id: report.id, action: current_user.report_voted?(report) ? 'unvote' : 'vote', vote_type: 'upvote' }}
%i.fa.fa-thumbs-up
%button.btn.btn-danger.btn-sm{type: :button, name: "mod-vote", disabled: current_user.report_x_voted?(report, false) ? 'disabled' : nil, data: { id: report.id, action: current_user.report_voted?(report) ? 'unvote' : 'vote', vote_type: 'downvote' }}
%i.fa.fa-thumbs-down
%button.btn.btn-primary.btn-sm{type: :button, name: 'mod-comments', data: { id: report.id, state: :hidden }}
%i.fa.fa-comments
%span{id: "mod-comment-count-#{report.id}"}= report.moderation_comments.all.count
%button.btn.btn-default.btn-sm{type: :button, name: "mod-delete-report", data: { id: report.id }}
%i.fa.fa-trash-o
.panel-footer{id: "mod-comments-section-#{report.id}", style: 'display: none'}
%div{id: "mod-comments-#{report.id}"}= render 'moderation/discussion', report: report

View File

@ -1,6 +1,7 @@
= render 'moderation/moderation_nav'
.container.j2-page
.row
= render 'moderation/moderation_tabs'
.col-md-9.col-sm-9.col-xs-12
- @reports.each do |r|
= render 'moderation/moderationbox', report: r
= render 'moderation/moderationbox', report: r

View File

@ -11,7 +11,8 @@
answered
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id), title: "#{notification.target.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your question
= time_ago_in_words notification.target.created_at
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
.notification--icon
%i.fa.fa-exclamation
@ -23,7 +24,8 @@
= user_screen_name notification.target.source
%p.notification--text
followed you
= time_ago_in_words notification.target.created_at
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
.notification--icon
%i.fa.fa-users
@ -37,7 +39,23 @@
smiled at
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your answer
= time_ago_in_words notification.target.created_at
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
.notification--icon
%i.fa.fa-smile-o
- when "CommentSmile"
.pull-left
%img.img-rounded.notification--img{src: gravatar_url(notification.target.user)}
.media-body
%h6.media-heading.notification--user
= user_screen_name notification.target.user
%p.notification--text
smiled at
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.comment.answer.id), title: "#{notification.target.comment.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your comment
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
.notification--icon
%i.fa.fa-smile-o
@ -50,8 +68,15 @@
%p.notification--text
commented on
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your answer
= time_ago_in_words notification.target.created_at
- if notification.target.answer.user == current_user
your
- elsif notification.target.user == notification.target.answer.user
their
- else
= user_screen_name(notification.target.answer.user, false, false) + "'s"
answer
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
.notification--icon
%i.fa.fa-comments
%i.fa.fa-comments

View File

@ -0,0 +1,17 @@
%nav.navbar.navbar-default.navbar-static-top.j2-navbar.visible-xs{role: "navigation"}
.container
.navbar-header
%button.navbar-toggle{"data-target" => "#j2-tl-navbar-collapse", "data-toggle" => "collapse", type: "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand{href: "/"} Notifications
#j2-tl-navbar-collapse.collapse.navbar-collapse
%ul.nav.navbar-nav
= nav_entry "All notifications", notifications_path
= nav_entry "Answers", notifications_path('answer')
= nav_entry "Smiles", notifications_path('smile')
= nav_entry "Comments", notifications_path('comment')
= nav_entry "Comment Smiles", notifications_path('commentsmile')
= nav_entry "Followers", notifications_path('relationship')

View File

@ -1,9 +1,9 @@
.col-md-3.col-xs-12.col-sm-3
.panel.panel-default
.panel-body
%ul.nav.nav-pills.nav-stacked
= nav_entry "All notifications", notifications_path
= nav_entry "Answers", notifications_path('answer')
= nav_entry "Smiles", notifications_path('smile')
= nav_entry "Comments", notifications_path('comment')
= nav_entry "Followers", notifications_path('relationship')
.panel.panel-default.hidden-xs
.list-group
= list_group_item "All notifications", notifications_path, badge: Notification.for(current_user).where(new: true).count
= list_group_item "Answers", notifications_path('answer'), badge: Notification.for(current_user).where(target_type: "Answer", new: true).count
= list_group_item "Smiles", notifications_path('smile'), badge: Notification.for(current_user).where(target_type: "Smile", new: true).count
= list_group_item "Comments", notifications_path('comment'), badge: Notification.for(current_user).where(target_type: "Comment", new: true).count
= list_group_item "Comment Smiles", notifications_path('commentsmile'), badge: Notification.for(current_user).where(target_type: "CommentSmile", new: true).count
= list_group_item "Followers", notifications_path('relationship'), badge: Notification.for(current_user).where(target_type: "Relationship", new: true).count

View File

@ -1,3 +1,4 @@
= render 'notifications/notification_nav'
.container.j2-page
= render 'notification_tabs'
.col-md-9.col-xs-12.col-sm-9

View File

@ -1,3 +1,4 @@
= render 'static/mobile_nav'
.container.j2-page
.col-md-3.col-sm-3
= render 'shared/sidebar'

View File

@ -1,18 +1,36 @@
.container.j2-page
/ TODO: make this pretty (it's currently C-c'd straight from shared/_answerbox)
.panel.panel-default
.panel.panel-question
.container
.panel-body
.media
.media.question-media
- unless @question.author_is_anonymous
%a.pull-left{href: show_user_profile_path(@question.user.screen_name)}
%img.img-rounded.answerbox--img{src: gravatar_url(@question.user)}
.media-body
.media-body.question-body
- if user_signed_in?
.pull-right
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }}
%span.caret
%ul.dropdown-menu.dropdown-menu-right{role: :menu}
- if current_user.mod? or @question.user == current_user
%li.text-danger
%a{href: '#', data: { action: 'ab-question-destroy', q_id: @question.id, redirect: if @question.author_is_anonymous? then "/" else show_user_questions_path(@question.user.screen_name) end }}
%i.fa.fa-trash-o
Delete Question
- unless @question.user == current_user
%li
%a{href: '#', data: { action: 'ab-question-report', q_id: @question.id }}
%i.fa.fa-exclamation-triangle
Report
%h6.text-muted.media-heading.answerbox--question-user
= user_screen_name @question.user, @question.author_is_anonymous
asked
= time_ago_in_words(@question.created_at)
%span{title: @question.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words(@question.created_at)
ago
%p.answerbox--question-text= @question.content
.container.question-page
/ TODO: make this pretty (it's currently C-c'd straight from shared/_answerbox)
#answers
- @answers.each do |a|
@ -37,4 +55,4 @@
%label
%input{type: 'checkbox', name: 'share', checked: :checked, data: { q_id: @question.id, service: service.provider }}
Post to
= service.provider.capitalize
= service.provider.capitalize

View File

@ -1,19 +1,37 @@
.panel.panel-default.answerbox{data: { id: a.id }}
.panel.panel-default.answerbox{data: { id: a.id, q_id: a.question.id }}
- if @question.nil?
.panel-heading
.media
.media.question-media
- unless a.question.author_is_anonymous
%a.pull-left{href: show_user_profile_path(a.question.user.screen_name)}
%img.img-rounded.answerbox--img{src: gravatar_url(a.question.user)}
.media-body
.media-body.question-body
- if user_signed_in?
.pull-right
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }}
%span.caret
%ul.dropdown-menu.dropdown-menu-right{role: :menu}
- if current_user.mod? or a.question.user == current_user
%li.text-danger
%a{href: '#', data: { action: 'ab-question-destroy', q_id: a.question.id }}
%i.fa.fa-trash-o
Delete Question
- unless a.question.user == current_user
%li
%a{href: '#', data: { action: 'ab-question-report', q_id: a.question.id }}
%i.fa.fa-exclamation-triangle
Report
%h6.text-muted.media-heading.answerbox--question-user
= user_screen_name a.question.user, a.question.author_is_anonymous
asked
- if @user.nil? or a.question.author_is_anonymous
= time_ago_in_words(a.question.created_at)
%span{title: a.question.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words(a.question.created_at)
- else
%a{href: show_user_question_path(a.question.user.screen_name, a.question.id)}
= time_ago_in_words(a.question.created_at)
%span{title: a.question.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words(a.question.created_at)
ago
- unless a.question.author_is_anonymous
- if a.question.answer_count > 1
@ -36,20 +54,33 @@
= markdown a.content
- if @user.nil?
.row
.col-md-6.col-sm-4.col-xs-7.text-left.text-muted
Answered by
%a{href: show_user_profile_path(a.user.screen_name)}
%img.img-rounded.answerbox--img-small{src: gravatar_url(a.user)}
%span= a.user.screen_name
%a{href: show_user_answer_path(a.user.screen_name, a.id)}
%span= time_ago_in_words(a.created_at)
ago
.col-md-6.col-sm-8.col-xs-5.text-right
.col-md-6.col-sm-4.col-xs-6.text-left.text-muted
.media
.pull-left
%a{href: show_user_profile_path(a.user.screen_name)}
%img.img-rounded.answerbox--img{src: gravatar_url(a.user)}
.media-body
%h6.media-heading.answerbox--answer-user
%span.hidden-xs
Answered by
= user_screen_name a.user
.answerbox--answer-date
%a{href: show_user_answer_path(a.user.screen_name, a.id)}
%span{title: a.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words(a.created_at)
ago
.col-md-6.col-sm-8.col-xs-6.text-right
= render 'shared/answerbox_buttons', a: a
- else
.row
.col-md-6.col-md-offset-6.col-sm-8.col-sm-offset-4.col-xs-6.col-xs-offset-6.text-right
.col-md-6.col-sm-4.col-xs-6.text-left.text-muted
%i.fa.fa-clock-o
%a{href: show_user_answer_path(a.user.screen_name, a.id)}
%span{title: a.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words(a.created_at)
ago
.col-md-6.col-sm-8.col-xs-6.text-right
= render 'shared/answerbox_buttons', a: a
.panel-footer{id: "ab-comments-section-#{a.id}", style: @display_all.nil? ? 'display: none' : nil }
%div{id: "ab-smiles-#{a.id}"}= render 'shared/smiles', a: a
%div{id: "ab-comments-#{a.id}"}= render 'shared/comments', a: a
%div{id: "ab-comments-#{a.id}"}= render 'shared/comments', a: a

View File

@ -1,8 +1,9 @@
%span.hidden-xs.text-muted
- unless user_signed_in?
- if a.smile_count > 0
%span{id: "ab-smile-count-#{a.id}"}= a.smile_count
users smiled this
%button.btn.btn-info.btn-sm{name: 'ab-smile', disabled: true}
%i.fa.fa-smile-o
%span{id: "ab-smile-count-#{a.id}"}= a.smile_count
- if user_signed_in?
- if current_user.smiled? a
%button.btn.btn-info.btn-sm{type: :button, name: 'ab-smile', data: { a_id: a.id, action: :unsmile }}
@ -21,13 +22,24 @@
%button.btn.btn-default.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }}
%span.caret
%ul.dropdown-menu.dropdown-menu-right{role: :menu}
- if Subscription.is_subscribed(current_user, a)
%li
-# fun joke should subscribe?
%a{href: '#', data: { a_id: a.id, action: 'ab-submarine', torpedo: "no" }}
%i.fa.fa-anchor
Unsubscribe
- else
%li
%a{href: '#', data: { a_id: a.id, action: 'ab-submarine', torpedo: "yes" }}
%i.fa.fa-anchor
Subscribe
- if privileged? a.user
%li.text-danger
%a{href: '#', data: { a_id: a.id, action: 'ab-destroy' }}
%i.fa.fa-trash-o
Delete
Return to Inbox
- unless a.user == current_user
%li
%a{href: '#', data: { a_id: a.id, action: 'ab-report' }}
%i.fa.fa-exclamation-triangle
Report
Report

View File

@ -0,0 +1,18 @@
.modal.fade{"id" => "modal-view-comment#{comment.id}-smiles","aria-hidden" => "true", "aria-labelledby" => "modal-view-comment#{comment.id}-smiles-label", :role => "dialog", :tabindex => "-1"}
.modal-dialog
.modal-content
.modal-header
%button.close{"data-dismiss" => "modal", :type => "button"}
%span{"aria-hidden" => "true"} ×
%span.sr-only Close
%h4#modal-ask-followers-label.modal-title People who smiled this comment
.modal-body
- if comment.smiles.all.count == 0
No one smiled this, yet.
- else
%ul.user-list.user-list-smiles
- comment.smiles.all.each do |smile|
%li.user-list-entry.user-list-entry-smiles
%a{href: show_user_profile_path(smile.user.screen_name)}
%img.img-rounded{src: gravatar_url(smile.user), alt: user_screen_name(smile.user, false, false)}
%span= user_screen_name(smile.user, false, false)

View File

@ -2,19 +2,38 @@
There are no comments yet.
- else
%ul.comments
- a.comments.all.each do |comment|
- a.comments.order(:created_at).each do |comment|
%li{data: { comment_id: comment.id }}
%div{class: "ab-comment-smile-list", style: "height: 0; width: 0"}= render "shared/comment_smiles", comment: comment
.media.comments--media
.pull-left
%img.img-rounded.answerbox--img{src: gravatar_url(comment.user)}
.media-body.comments--body
%h6.media-heading.answerbox--question-user= user_screen_name comment.user
- if user_signed_in?
.pull-right
.pull-right
%span.hidden-xs.text-muted
- unless user_signed_in?
- if comment.smile_count > 0
%button.btn.btn-info.btn-sm{name: 'ab-smile-comment', disabled: true}
%i.fa.fa-smile-o
%span{id: "ab-comment-smile-count-#{comment.id}"}= comment.smile_count
- if user_signed_in?
- if current_user.smiled_comment? comment
%button.btn.btn-info.btn-sm{type: :button, name: 'ab-smile-comment', data: { c_id: comment.id, action: :unsmile }}
%i.fa.fa-frown-o
%span{id: "ab-comment-smile-count-#{comment.id}"}= comment.smile_count
- else
%button.btn.btn-info.btn-sm{type: :button, name: 'ab-smile-comment', data: { c_id: comment.id, action: :smile }}
%i.fa.fa-smile-o
%span{id: "ab-comment-smile-count-#{comment.id}"}= comment.smile_count
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }}
%span.caret
%ul.dropdown-menu.dropdown-menu-right{role: :menu}
%li
%a{href: '#', type: :button, data: { target: "#modal-view-comment#{comment.id}-smiles", toggle: :modal}}
%i.fa.fa-smile-o
View comment smiles
- if privileged?(comment.user) or privileged?(a.user)
%li.text-danger
%a{href: '#', data: { action: 'ab-comment-destroy', c_id: comment.id }}
@ -30,4 +49,4 @@
- if user_signed_in?
.form-group.has-feedback{name: 'ab-comment-new-group', data: { a_id: a.id }}
%input.form-control.comments--box{type: :text, placeholder: 'Comment...', name: 'ab-comment-new', data: {a_id: a.id }}
%span.text-muted.form-control-feedback.comments--count{id: "ab-comment-charcount-#{a.id}"} 160
%span.text-muted.form-control-feedback.comments--count{id: "ab-comment-charcount-#{a.id}"} 160

View File

@ -1,8 +1,12 @@
.centre.text-muted
.centre.text-muted.links
&copy;
= Date.today.year
= APP_CONFIG['site_name']
·
= link_to "About", about_path
·
= link_to "Bugs", 'https://github.com/retrospring/bugs/issues'
= link_to "Github", 'https://github.com/retrospring/retrospring'
·
= link_to "Terms of Service", terms_path
·
= link_to "Privacy Policy", privacy_policy_path

View File

@ -1,11 +1,28 @@
.panel.panel-default
.panel.panel-default.questionbox{data: { id: q.id }}
.panel-body
.media
.media-body
- if user_signed_in?
.pull-right
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }}
%span.caret
%ul.dropdown-menu.dropdown-menu-right{role: :menu}
- if current_user.mod? or q.user == current_user
%li.text-danger
%a{href: '#', data: { action: 'ab-question-destroy', q_id: q.id }}
%i.fa.fa-trash-o
Delete Question
- unless q.user == current_user
%li
%a{href: '#', data: { action: 'ab-question-report', q_id: q.id }}
%i.fa.fa-exclamation-triangle
Report
%h6.media-heading.text-muted.answerbox--question-user
= user_screen_name q.user
asked
%a{href: show_user_question_path(q.user.screen_name, q.id)}
%span{title: q.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words(q.created_at)
ago
- if q.answer_count > 1
@ -13,4 +30,4 @@
%a{href: show_user_question_path(q.user.screen_name, q.id)}
#{q.answer_count} answers
%p.answerbox--question-text
= q.content
= q.content

View File

@ -1,14 +1,18 @@
.panel.panel-default.hidden-xs
%img.profile--avatar{src: current_user.profile_picture.url(:large)}
- unless inbox_count.nil?
.profile--panel-badge.panel-badge-info
%i.fa.fa-envelope
= pluralize(inbox_count, 'new question')
.panel-body
%p
Welcome,
= current_user.screen_name
- unless inbox_count.nil?
%p
%strong
You have
= pluralize(inbox_count, 'new question')
in your inbox!
- if current_user.display_name.blank?
.profile--displayname
= current_user.screen_name
- else
.profile--displayname
= current_user.display_name
.profile--username
= current_user.screen_name
.row
%a{href: show_user_followers_path(current_user.screen_name)}
.col-md-6.col-sm-6.col-xs-6
@ -18,27 +22,12 @@
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#friend-count= current_user.friend_count
%h6.entry-subtext Following
.row
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#asked-count= current_user.asked_count
%h6.entry-subtext Questions
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#answered-count= current_user.answered_count
%h6.entry-subtext Answers
.row
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#asked-count= current_user.commented_count
%h6.entry-subtext Comments
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#answered-count= current_user.smiled_count
%h6.entry-subtext Smiles
.panel.panel-default
.panel-body
%ul.nav.nav-pills.nav-stacked
= nav_entry "Timeline", root_path
= nav_entry "Public", public_timeline_path
- current_user.groups.each do |group|
= nav_entry group.display_name, group_timeline_path(group.name)
.panel.panel-default.hidden-xs
%ul.nav.nav-pills.nav-stacked
= list_group_item "Timeline", root_path
= list_group_item "Public", public_timeline_path
- current_user.groups.each do |group|
= list_group_item group.display_name, group_timeline_path(group.name)
- unless @group.nil?
.panel.panel-default.profile--panel.hidden-xs
.panel-heading

View File

@ -0,0 +1,14 @@
%nav.navbar.navbar-default.navbar-static-top.j2-navbar.visible-xs{role: "navigation"}
.container
.navbar-header
%button.navbar-toggle{"data-target" => "#j2-tl-navbar-collapse", "data-toggle" => "collapse", type: "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand{href: "/"} Timelines
#j2-tl-navbar-collapse.collapse.navbar-collapse
%ul.nav.navbar-nav
= nav_entry "Public", public_timeline_path
- current_user.groups.each do |group|
= nav_entry group.display_name, group_timeline_path(group.name)

View File

@ -7,54 +7,59 @@
.row
.col-sm-4
.panel.panel-default
.panel-heading
%h3.panel-title The Team
.panel-body
%h3 The Team
The people behind
= succeed '!' do
= APP_CONFIG['site_name']
%br/
.media
.pull-left
%a{href: show_user_profile_path('nilsding')}
%img.img-rounded.answerbox--img{src: User.find_by_screen_name('nilsding').profile_picture.url(:medium)}
.media-body
%h4.entry-text.entry-about nilsding
%h6.entry-subtext Backend, Server & Code
.media
.pull-left
%a{href: show_user_profile_path('pixeldesu')}
%img.img-rounded.answerbox--img{src: User.find_by_screen_name('pixeldesu').profile_picture.url(:medium)}
.media-body
%h4.entry-text.entry-about pixeldesu
%h6.entry-subtext Frontend Design & Layout
- APP_CONFIG['admins'].each do |adm|
.media
.pull-left
%a{href: show_user_profile_path(adm['screen_name'])}
%img.img-rounded.answerbox--img{src: User.find_by_screen_name(adm['screen_name']).profile_picture.url(:medium)}
.media-body
%h4.entry-text.entry-about= adm['about_text']
%h6.entry-subtext= adm['subtext']
.panel.panel-default
.panel-heading
%h3.panel-title Moderators
.panel-body
%h3 Moderators
The people on
= APP_CONFIG['site_name']
that look after you!
%p
The people on
= APP_CONFIG['site_name']
that look after you!
%ul.about--moderator
- User.where(moderator: true).each do |mod|
%li
%a{href: show_user_profile_path(mod.screen_name)}
%img.answerbox--img-small{src: User.find_by_screen_name(mod.screen_name).profile_picture.url(:medium)}
= mod.screen_name
%a{href: show_user_profile_path(mod.screen_name), title: mod.screen_name, data: { toggle: :tooltip, placement: :top }}
%img.img-rounded.answerbox--img-small{src: mod.profile_picture.url(:small)}
.col-sm-4
.panel.panel-default
.panel-heading
%h3.panel-title Unfinished Project
.panel-body
%h3 Alpha version
%p This is an alpha version, full of bugs. Caveat emptor.
%p
Found a bug? Have an idea for a must-have feature? Please
= link_to "report them!", 'https://github.com/retrospring/bugs/issues'
= APP_CONFIG['site_name']
is running on unfinished code, full of bugs. Caveat emptor.
%p
Want to contribute? If you are a Ruby developer, CoffeeScript coder or frontend designer, you can now help
= APP_CONFIG['site_name']
to get the features everyone wanted by forking our
= succeed '.' do
= link_to "GitHub repository", 'https://github.com/retrospring/retrospring'
If that's not the case, you can still report bugs and request features at our
= succeed '.' do
= link_to "bug tracker", 'https://github.com/retrospring/bugs'
%p
Still have some questions? Check our
= link_to "FAQ!", help_faq_path
.panel.panel-default
.panel-heading
%h3.panel-title Statistics
.panel-body
There are lies, damned lies, and then there are...
%h3 Statistics
%p All-time statistics for #{APP_CONFIG['site_name']}
.row
.col-xs-6
%h4.entry-text#asked-count= Question.count
@ -67,7 +72,7 @@
%h4.entry-text#asked-count= Comment.count
%h6.entry-subtext Comments
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#answered-count= Smile.count
%h4.entry-text#answered-count= Smile.count + CommentSmile.count
%h6.entry-subtext Smiles
.row
.col-xs-6
@ -75,26 +80,26 @@
%h6.entry-subtext Users
.col-sm-4
.panel.panel-default
.panel-heading
%h3.panel-title Funding
.panel-body
%h3 Donate
We are not backed by any company, but we need some money to keep
our server infrastructure running.
%form{:action => "https://www.paypal.com/cgi-bin/webscr", :method => "post", :target => "_top"}
%input{:name => "cmd", :type => "hidden", :value => "_s-xclick"}/
%input{:name => "hosted_button_id", :type => "hidden", :value => "6ZT5MS6UGU6HC"}/
%input{:alt => "PayPal - The safer, easier way to pay online!", :border => "0", :name => "submit", :src => "https://www.paypalobjects.com/en_US/AT/i/btn/btn_donateCC_LG.gif", :type => "image"}/
%img{:alt => "", :border => "0", :height => "1", :src => "https://www.paypalobjects.com/de_DE/i/scr/pixel.gif", :width => "1"}/
Want to support us over a longer timespan? We also have a Patreon campaign!
%a.btn.btn-primary.btn-block{href: "https://patreon.com/retrospring"} Patreon
.panel.panel-default
.panel-body
%h3 Patrons
People that believe in our vision, and that's why we love them <3
%p Currently Retrospring is running of the developers funds and will be able to sustain at the current needs of servers. Hereby we want to thank the people who previously donated to our project and helped it grow. Everyone shown at the bottom of this panel has contributed to the project with donations or great input.
%ul.about--moderator
- User.where(supporter: true).each do |sup|
%a{href: show_user_profile_path(sup.screen_name), title: sup.screen_name, data: { toggle: :tooltip, placement: :top }}
%img.img-rounded.answerbox--img-small{src: sup.profile_picture.url(:medium)}
.panel.panel-default
.panel-heading
%h3.panel-title Contributors
.panel-body
%p These people have contributed to #{APP_CONFIG['site_name']}'s source code.
%p
Want to get listed here?
= link_to "Fork this repo", 'https://github.com/retrospring/retrospring'
and create a new pull request with your changes.
%ul.about--moderator
- User.where(contributor: true).each do |sup|
%a{href: show_user_profile_path(sup.screen_name), title: sup.screen_name, data: { toggle: :tooltip, placement: :top }}
%img.img-rounded.answerbox--img-small{src: sup.profile_picture.url(:medium)}
= render "shared/links"

View File

@ -119,5 +119,10 @@
8. Is this open-source software?
.panel-collapse.collapse{id: "collapseNine", role: "tabpanel", aria: {labelledby: "faqNine"}}
.panel-body
Currently not. We haven't decided if we want to publish the underlying software stack at some point.
Yep! #{APP_CONFIG['site_name']} runs
= succeed ',' do
%a{href: 'https://github.com/nilsding/justask'} justask
an open source (AGPLv3) question and answer platform. If you want to contribute or report bugs you find in #{APP_CONFIG['site_name']}, please look at our
= link_to "Github repository!", "https://github.com/retrospring/retrospring"

View File

@ -1,10 +1,10 @@
- if user_signed_in?
= render 'static/mobile_nav'
.container.j2-page
.col-md-3.col-sm-3
= render 'shared/sidebar'
.col-md-9.col-xs-12.col-sm-9
.col-md-9.col-xs-12.col-sm-9.j2-col-reset
= render 'layouts/messages'
#timeline
- @timeline.each do |answer|
= render 'shared/answerbox', a: answer
@ -16,4 +16,4 @@
Load more
.visible-xs= render 'shared/links'
- else
= render 'static/front'
= render 'static/front'

Some files were not shown because too many files have changed in this diff Show More