changed a few things
This commit is contained in:
parent
f4da926a42
commit
ae66877cde
|
@ -1,16 +1,12 @@
|
||||||
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
|
||||||
#
|
|
||||||
# If you find yourself ignoring temporary files generated by your text editor
|
|
||||||
# or operating system, you probably want to add a global ignore instead:
|
|
||||||
# git config --global core.excludesfile '~/.gitignore_global'
|
|
||||||
|
|
||||||
# Ignore bundler config.
|
|
||||||
/.bundle
|
/.bundle
|
||||||
|
|
||||||
# Ignore the default SQLite database.
|
|
||||||
/db/*.sqlite3
|
/db/*.sqlite3
|
||||||
/db/*.sqlite3-journal
|
/db/*.sqlite3-journal
|
||||||
|
|
||||||
# Ignore all logfiles and tempfiles.
|
|
||||||
/log/*.log
|
/log/*.log
|
||||||
/tmp
|
/tmp
|
||||||
|
|
||||||
|
/config/database.yml
|
||||||
|
.sass-cache/
|
||||||
|
coverage/
|
||||||
|
*.swp
|
||||||
|
|
60
Gemfile
60
Gemfile
|
@ -1,49 +1,37 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
gem 'rails', '4.1.6'
|
||||||
|
|
||||||
|
gem 'pg', group: :postgres
|
||||||
|
gem 'mysql2', group: :mysql
|
||||||
|
|
||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
||||||
gem 'rails', '4.1.4'
|
|
||||||
# Use sqlite3 as the database for Active Record
|
|
||||||
gem 'sqlite3'
|
|
||||||
# Use SCSS for stylesheets
|
|
||||||
gem 'sass-rails', '~> 4.0.3'
|
gem 'sass-rails', '~> 4.0.3'
|
||||||
# Use Uglifier as compressor for JavaScript assets
|
|
||||||
gem 'uglifier', '>= 1.3.0'
|
gem 'uglifier', '>= 1.3.0'
|
||||||
# Use CoffeeScript for .js.coffee assets and views
|
gem 'coffee-rails', '~> 4.1.0'
|
||||||
gem 'coffee-rails', '~> 4.0.0'
|
|
||||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
|
||||||
# gem 'therubyracer', platforms: :ruby
|
|
||||||
|
|
||||||
# Use jquery as the JavaScript library
|
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
|
||||||
gem 'turbolinks'
|
gem 'turbolinks'
|
||||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
gem 'jbuilder', '~> 2.2.4'
|
||||||
gem 'jbuilder', '~> 2.0'
|
gem 'sdoc', '~> 0.4.1', group: :doc
|
||||||
# bundle exec rake doc:rails generates the API under doc/api.
|
|
||||||
gem 'sdoc', '~> 0.4.0', group: :doc
|
|
||||||
|
|
||||||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
gem 'bcrypt', '~> 3.1.7'
|
||||||
gem 'spring', group: :development
|
|
||||||
|
|
||||||
# Use ActiveModel has_secure_password
|
|
||||||
# gem 'bcrypt', '~> 3.1.7'
|
|
||||||
|
|
||||||
# Use unicorn as the app server
|
|
||||||
# gem 'unicorn'
|
|
||||||
|
|
||||||
# Use Capistrano for deployment
|
|
||||||
# gem 'capistrano-rails', group: :development
|
|
||||||
|
|
||||||
# Use debugger
|
|
||||||
# gem 'debugger', group: [:development, :test]
|
|
||||||
|
|
||||||
gem 'thin'
|
|
||||||
gem 'bootstrap-sass', '~> 3.2.0.1'
|
|
||||||
gem 'bootswatch-rails', '~> 3.2.0'
|
|
||||||
gem 'haml'
|
gem 'haml'
|
||||||
|
gem 'semantic-ui-sass', '~> 0.19.3.0'
|
||||||
gem 'will_paginate'
|
gem 'will_paginate'
|
||||||
gem 'will_paginate-bootstrap'
|
|
||||||
gem 'http_accept_language'
|
gem 'http_accept_language'
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
gem 'bootstrap_form'
|
gem 'font-kit-rails'
|
||||||
|
gem 'nprogress-rails'
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
gem 'thin'
|
||||||
|
gem 'spring'
|
||||||
|
end
|
||||||
|
|
||||||
|
group :production do
|
||||||
|
gem 'unicorn', group: :production
|
||||||
|
end
|
||||||
|
|
||||||
|
group :test do
|
||||||
|
gem 'simplecov'
|
||||||
|
end
|
||||||
|
|
154
Gemfile.lock
154
Gemfile.lock
|
@ -1,161 +1,173 @@
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (4.1.4)
|
actionmailer (4.1.6)
|
||||||
actionpack (= 4.1.4)
|
actionpack (= 4.1.6)
|
||||||
actionview (= 4.1.4)
|
actionview (= 4.1.6)
|
||||||
mail (~> 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
actionpack (4.1.4)
|
actionpack (4.1.6)
|
||||||
actionview (= 4.1.4)
|
actionview (= 4.1.6)
|
||||||
activesupport (= 4.1.4)
|
activesupport (= 4.1.6)
|
||||||
rack (~> 1.5.2)
|
rack (~> 1.5.2)
|
||||||
rack-test (~> 0.6.2)
|
rack-test (~> 0.6.2)
|
||||||
actionview (4.1.4)
|
actionview (4.1.6)
|
||||||
activesupport (= 4.1.4)
|
activesupport (= 4.1.6)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
activemodel (4.1.4)
|
activemodel (4.1.6)
|
||||||
activesupport (= 4.1.4)
|
activesupport (= 4.1.6)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
activerecord (4.1.4)
|
activerecord (4.1.6)
|
||||||
activemodel (= 4.1.4)
|
activemodel (= 4.1.6)
|
||||||
activesupport (= 4.1.4)
|
activesupport (= 4.1.6)
|
||||||
arel (~> 5.0.0)
|
arel (~> 5.0.0)
|
||||||
activesupport (4.1.4)
|
activesupport (4.1.6)
|
||||||
i18n (~> 0.6, >= 0.6.9)
|
i18n (~> 0.6, >= 0.6.9)
|
||||||
json (~> 1.7, >= 1.7.7)
|
json (~> 1.7, >= 1.7.7)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
arel (5.0.1.20140414130214)
|
arel (5.0.1.20140414130214)
|
||||||
bcrypt (3.1.7)
|
bcrypt (3.1.9)
|
||||||
bootstrap-sass (3.2.0.1)
|
|
||||||
sass (~> 3.2)
|
|
||||||
bootstrap_form (2.1.1)
|
|
||||||
bootswatch-rails (3.2.0)
|
|
||||||
railties (>= 3.1)
|
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
coffee-rails (4.0.1)
|
coffee-rails (4.1.0)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
coffee-script (2.3.0)
|
coffee-script (2.3.0)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.7.1)
|
coffee-script-source (1.8.0)
|
||||||
daemons (1.1.9)
|
daemons (1.1.9)
|
||||||
devise (3.2.4)
|
devise (3.4.0)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 3.2.6, < 5)
|
railties (>= 3.2.6, < 5)
|
||||||
|
responders
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
|
docile (1.1.5)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
eventmachine (1.0.3)
|
eventmachine (1.0.3)
|
||||||
execjs (2.2.1)
|
execjs (2.2.2)
|
||||||
|
font-kit-rails (1.0.2)
|
||||||
|
rails
|
||||||
haml (4.0.5)
|
haml (4.0.5)
|
||||||
tilt
|
tilt
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
http_accept_language (2.0.2)
|
http_accept_language (2.0.2)
|
||||||
i18n (0.6.11)
|
i18n (0.6.11)
|
||||||
jbuilder (2.1.3)
|
jbuilder (2.2.4)
|
||||||
activesupport (>= 3.0.0, < 5)
|
activesupport (>= 3.0.0, < 5)
|
||||||
multi_json (~> 1.2)
|
multi_json (~> 1.2)
|
||||||
jquery-rails (3.1.1)
|
jquery-rails (3.1.2)
|
||||||
railties (>= 3.0, < 5.0)
|
railties (>= 3.0, < 5.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
json (1.8.1)
|
json (1.8.1)
|
||||||
mail (2.5.4)
|
kgio (2.9.2)
|
||||||
mime-types (~> 1.16)
|
mail (2.6.1)
|
||||||
treetop (~> 1.4.8)
|
mime-types (>= 1.16, < 3)
|
||||||
mime-types (1.25.1)
|
mime-types (2.4.3)
|
||||||
minitest (5.4.0)
|
minitest (5.4.2)
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
|
mysql2 (0.3.16)
|
||||||
|
nprogress-rails (0.1.6.3)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
polyglot (0.3.5)
|
pg (0.17.1)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (4.1.4)
|
rails (4.1.6)
|
||||||
actionmailer (= 4.1.4)
|
actionmailer (= 4.1.6)
|
||||||
actionpack (= 4.1.4)
|
actionpack (= 4.1.6)
|
||||||
actionview (= 4.1.4)
|
actionview (= 4.1.6)
|
||||||
activemodel (= 4.1.4)
|
activemodel (= 4.1.6)
|
||||||
activerecord (= 4.1.4)
|
activerecord (= 4.1.6)
|
||||||
activesupport (= 4.1.4)
|
activesupport (= 4.1.6)
|
||||||
bundler (>= 1.3.0, < 2.0)
|
bundler (>= 1.3.0, < 2.0)
|
||||||
railties (= 4.1.4)
|
railties (= 4.1.6)
|
||||||
sprockets-rails (~> 2.0)
|
sprockets-rails (~> 2.0)
|
||||||
railties (4.1.4)
|
railties (4.1.6)
|
||||||
actionpack (= 4.1.4)
|
actionpack (= 4.1.6)
|
||||||
activesupport (= 4.1.4)
|
activesupport (= 4.1.6)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
|
raindrops (0.13.0)
|
||||||
rake (10.3.2)
|
rake (10.3.2)
|
||||||
rdoc (4.1.1)
|
rdoc (4.1.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
|
responders (1.1.1)
|
||||||
|
railties (>= 3.2, < 4.2)
|
||||||
sass (3.2.19)
|
sass (3.2.19)
|
||||||
sass-rails (4.0.3)
|
sass-rails (4.0.3)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
sass (~> 3.2.0)
|
sass (~> 3.2.0)
|
||||||
sprockets (~> 2.8, <= 2.11.0)
|
sprockets (~> 2.8, <= 2.11.0)
|
||||||
sprockets-rails (~> 2.0)
|
sprockets-rails (~> 2.0)
|
||||||
sdoc (0.4.0)
|
sdoc (0.4.1)
|
||||||
json (~> 1.8)
|
json (~> 1.7, >= 1.7.7)
|
||||||
rdoc (~> 4.0, < 5.0)
|
rdoc (~> 4.0)
|
||||||
|
semantic-ui-sass (0.19.3.0)
|
||||||
|
sass (~> 3.2)
|
||||||
|
simplecov (0.9.1)
|
||||||
|
docile (~> 1.1.0)
|
||||||
|
multi_json (~> 1.0)
|
||||||
|
simplecov-html (~> 0.8.0)
|
||||||
|
simplecov-html (0.8.0)
|
||||||
spring (1.1.3)
|
spring (1.1.3)
|
||||||
sprockets (2.11.0)
|
sprockets (2.11.0)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
sprockets-rails (2.1.3)
|
sprockets-rails (2.2.0)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
sprockets (~> 2.8)
|
sprockets (>= 2.8, < 4.0)
|
||||||
sqlite3 (1.3.9)
|
thin (1.6.3)
|
||||||
thin (1.6.2)
|
daemons (~> 1.0, >= 1.0.9)
|
||||||
daemons (>= 1.0.9)
|
eventmachine (~> 1.0)
|
||||||
eventmachine (>= 1.0.0)
|
rack (~> 1.0)
|
||||||
rack (>= 1.0.0)
|
|
||||||
thor (0.19.1)
|
thor (0.19.1)
|
||||||
thread_safe (0.3.4)
|
thread_safe (0.3.4)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
treetop (1.4.15)
|
turbolinks (2.4.0)
|
||||||
polyglot
|
|
||||||
polyglot (>= 0.3.1)
|
|
||||||
turbolinks (2.2.2)
|
|
||||||
coffee-rails
|
coffee-rails
|
||||||
tzinfo (1.2.1)
|
tzinfo (1.2.2)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (2.5.3)
|
uglifier (2.5.3)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
|
unicorn (4.8.3)
|
||||||
|
kgio (~> 2.6)
|
||||||
|
rack
|
||||||
|
raindrops (~> 0.7)
|
||||||
warden (1.2.3)
|
warden (1.2.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
will_paginate (3.0.7)
|
will_paginate (3.0.7)
|
||||||
will_paginate-bootstrap (1.0.1)
|
|
||||||
will_paginate (>= 3.0.3)
|
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootstrap-sass (~> 3.2.0.1)
|
bcrypt (~> 3.1.7)
|
||||||
bootstrap_form
|
coffee-rails (~> 4.1.0)
|
||||||
bootswatch-rails (~> 3.2.0)
|
|
||||||
coffee-rails (~> 4.0.0)
|
|
||||||
devise
|
devise
|
||||||
|
font-kit-rails
|
||||||
haml
|
haml
|
||||||
http_accept_language
|
http_accept_language
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.2.4)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
rails (= 4.1.4)
|
mysql2
|
||||||
|
nprogress-rails
|
||||||
|
pg
|
||||||
|
rails (= 4.1.6)
|
||||||
sass-rails (~> 4.0.3)
|
sass-rails (~> 4.0.3)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.1)
|
||||||
|
semantic-ui-sass (~> 0.19.3.0)
|
||||||
|
simplecov
|
||||||
spring
|
spring
|
||||||
sqlite3
|
|
||||||
thin
|
thin
|
||||||
turbolinks
|
turbolinks
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
|
unicorn
|
||||||
will_paginate
|
will_paginate
|
||||||
will_paginate-bootstrap
|
|
||||||
|
|
115
README.md
115
README.md
|
@ -1,20 +1,105 @@
|
||||||
# README
|
# justask [![build status](https://ci.rrerr.net/projects/9/status.png?ref=master)](https://ci.rrerr.net/projects/9?ref=master)
|
||||||
|
|
||||||
This README would normally document whatever steps are necessary to get the
|
## Requirements
|
||||||
application up and running.
|
|
||||||
|
|
||||||
Things you may want to cover:
|
- UNIX-like system (Linux, *BSD, ...)
|
||||||
|
- ruby 1.9.3+
|
||||||
|
- Bundler
|
||||||
|
- PostgreSQL or MySQL
|
||||||
|
|
||||||
* Ruby version
|
## Installation
|
||||||
* System dependencies
|
|
||||||
* Configuration
|
|
||||||
* Database creation
|
|
||||||
* Database initialization
|
|
||||||
* How to run the test suite
|
|
||||||
* Services (job queues, cache servers, search engines, etc.)
|
|
||||||
* Deployment instructions
|
|
||||||
* ...
|
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
Please feel free to use a different markup language if you do not plan to run
|
#### PostgreSQL
|
||||||
`rake doc:app`.
|
|
||||||
|
```
|
||||||
|
$ sudo -u postgres psql -d template1
|
||||||
|
template1=# CREATE USER justask CREATEDB;
|
||||||
|
template1=# CREATE DATABASE justask_production OWNER justask;
|
||||||
|
template1=# \q
|
||||||
|
```
|
||||||
|
|
||||||
|
Try connecting to the database:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ psql -U justask -d justask_production
|
||||||
|
```
|
||||||
|
|
||||||
|
#### MySQL
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mysql -u root -p
|
||||||
|
# change 'hack me' in the command below to a real password
|
||||||
|
mysql> CREATE USER 'justask'@'localhost' IDENTIFIED BY 'hack me';
|
||||||
|
mysql> SET storage_engine=INNODB;
|
||||||
|
mysql> CREATE DATABASE IF NOT EXISTS `justask_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
|
||||||
|
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `justask_production`.* TO 'justask'@'localhost';
|
||||||
|
mysql> \q
|
||||||
|
```
|
||||||
|
|
||||||
|
Try connecting to the database:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mysql -u justask -p -D justask_production
|
||||||
|
```
|
||||||
|
|
||||||
|
### justask
|
||||||
|
|
||||||
|
#### Clone the Source
|
||||||
|
|
||||||
|
```
|
||||||
|
$ git clone https://git.rrerr.net/nilsding/justask.git justask
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Configure It
|
||||||
|
|
||||||
|
```
|
||||||
|
# Change into the justask directory
|
||||||
|
$ cd justask
|
||||||
|
|
||||||
|
# Copy the example config
|
||||||
|
$ cp config/justask.yml.example config/justask.yml
|
||||||
|
|
||||||
|
# Edit the configuration file
|
||||||
|
$ vi config/justask.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Database Configuration
|
||||||
|
|
||||||
|
```
|
||||||
|
# PostgreSQL only:
|
||||||
|
$ cp config/database.yml.postgres config/database.yml
|
||||||
|
|
||||||
|
# MySQL only:
|
||||||
|
$ cp config/database.yml.mysql config/database.yml
|
||||||
|
|
||||||
|
# MySQL and remote PostgreSQL only:
|
||||||
|
$ vi config/database.yml
|
||||||
|
|
||||||
|
# Both:
|
||||||
|
# Make database.yml readable only for you
|
||||||
|
chmod o-rwx config/database.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Install Gems
|
||||||
|
|
||||||
|
```
|
||||||
|
# For PostgreSQL (note: the option says "without ... mysql")
|
||||||
|
$ bundle install --deployment --without development test mysql
|
||||||
|
|
||||||
|
# Or, if you use MySQL
|
||||||
|
$ bundle install --deployment --without development test postgres
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Initialize Database
|
||||||
|
|
||||||
|
```
|
||||||
|
$ bundle exec rake db:migrate RAILS_ENV=production
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Compile Assets
|
||||||
|
|
||||||
|
```
|
||||||
|
$ bundle exec rake assets:precompile RAILS_ENV=production
|
||||||
|
```
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#= require jquery
|
#= require jquery
|
||||||
#= require jquery_ujs
|
#= require jquery_ujs
|
||||||
#= require turbolinks
|
#= require turbolinks
|
||||||
#= require bootstrap
|
#= require semantic-ui
|
||||||
#= require_tree .
|
#= require_tree .
|
||||||
|
|
||||||
|
$(document).ready ->
|
||||||
|
$('.ui.dropdown').dropdown
|
||||||
|
on: "hover"
|
|
@ -1,9 +1,73 @@
|
||||||
/*
|
/*
|
||||||
*= require rails_bootstrap_forms
|
*= require font-kit-rails/open-sans
|
||||||
*= require_self
|
*= require_self
|
||||||
*/
|
*/
|
||||||
@import "bootswatch/flatly/variables";
|
@import "semantic-ui";
|
||||||
@import "bootstrap";
|
|
||||||
body { padding-top: $navbar-height; }
|
|
||||||
@import "bootswatch/flatly/bootswatch";
|
|
||||||
@import "base";
|
@import "base";
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
font-size: 15px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Open Sans", "Helvetica Neue", "Helvetica", "DejaVu Sans", "Arial", sans-serif;
|
||||||
|
background: #FFFFFF;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
color: #555555;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
min-width: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* mobile only */
|
||||||
|
|
||||||
|
@media only screen and (max-width : 768px) {
|
||||||
|
.ui.page.grid.segment {
|
||||||
|
padding-top: 2rem;
|
||||||
|
padding-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1.ui.header {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masthead.segment {
|
||||||
|
background-size: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masthead.segment .information {
|
||||||
|
margin-left: 190px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masthead.segment .image {
|
||||||
|
bottom: -65px;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masthead.segment .button {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overview .divided.grid .header .icon {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overview .divided.grid .header + p {
|
||||||
|
min-height: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masthead.segment .column {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masthead.segment .column p {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width : 1000px) {
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
def nav_entry(body, path)
|
def nav_entry(body, path, options={})
|
||||||
content_tag(:li, link_to(body, path), class: ('active' if current_page? path))
|
options = {class: "", icon: "", label: "", label_color: "red"}.merge options
|
||||||
|
body = semantic_icon(options[:icon]) + " " + body unless options[:icon].empty?
|
||||||
|
body = body + " " + content_tag(:div, options[:label], class: "ui #{options[:label_color]} label") unless options[:label].empty?
|
||||||
|
link_to(body, path, class: "#{'active' if current_page? path} item #{options[:class]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class Answer < ActiveRecord::Base
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :question
|
||||||
|
has_many :comments
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
class Comment < ActiveRecord::Base
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :answer
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
class Question < ActiveRecord::Base
|
||||||
|
belongs_to :user
|
||||||
|
has_one :answer
|
||||||
|
end
|
|
@ -7,6 +7,10 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
# attr_accessor :login
|
# attr_accessor :login
|
||||||
|
|
||||||
|
has_many :questions, dependent: :destroy
|
||||||
|
has_many :answers, dependent: :destroy
|
||||||
|
has_many :comments, dependent: :destroy
|
||||||
|
|
||||||
SCREEN_NAME_REGEX = /\A[a-zA-Z0-9_]{1,16}\z/
|
SCREEN_NAME_REGEX = /\A[a-zA-Z0-9_]{1,16}\z/
|
||||||
|
|
||||||
validates :screen_name, presence: true, format: { with: SCREEN_NAME_REGEX }, uniqueness: { case_sensitive: false }
|
validates :screen_name, presence: true, format: { with: SCREEN_NAME_REGEX }, uniqueness: { case_sensitive: false }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.container
|
.container
|
||||||
%h1 Resend confirmation instructions
|
%h1 Resend confirmation instructions
|
||||||
= bootstrap_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
|
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
|
||||||
= devise_error_messages!
|
= devise_error_messages!
|
||||||
|
|
||||||
= f.email_field :screen_name, autofocus: true, label: "User name"
|
= f.email_field :screen_name, autofocus: true, label: "User name"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.container
|
.container
|
||||||
%h1 Change your password
|
%h1 Change your password
|
||||||
= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
|
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
|
||||||
= devise_error_messages!
|
= devise_error_messages!
|
||||||
|
|
||||||
= f.hidden_field :reset_password_token
|
= f.hidden_field :reset_password_token
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.container
|
.container
|
||||||
%h1 Forgot your password?
|
%h1 Forgot your password?
|
||||||
= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
|
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
|
||||||
= devise_error_messages!
|
= devise_error_messages!
|
||||||
|
|
||||||
= f.text_field :screen_name, autofocus: true, "User name"
|
= f.text_field :screen_name, autofocus: true, "User name"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.container
|
.container
|
||||||
%h1 Edit #{resource_name.to_s.humanize}
|
%h1 Edit #{resource_name.to_s.humanize}
|
||||||
= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
|
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
|
||||||
= devise_error_messages!
|
= devise_error_messages!
|
||||||
|
|
||||||
= f.text_field :screen_name, autofocus: true, label: "User name"
|
= f.text_field :screen_name, autofocus: true, label: "User name"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.container
|
.container
|
||||||
%h1 Sign up
|
%h1 Sign up
|
||||||
|
|
||||||
= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
||||||
= devise_error_messages!
|
= devise_error_messages!
|
||||||
|
|
||||||
= f.text_field :screen_name, autofocus: true, label: "User name"
|
= f.text_field :screen_name, autofocus: true, label: "User name"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
%h1 Sign in
|
%h1 Sign in
|
||||||
= render 'layouts/messages'
|
= render 'layouts/messages'
|
||||||
|
|
||||||
= bootstrap_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
|
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
|
||||||
|
|
||||||
= f.text_field :login, autofocus: true, label: "User name"
|
= f.text_field :login, autofocus: true, label: "User name"
|
||||||
= f.password_field :password, autocomplete: "off", label: "Password"
|
= f.password_field :password, autocomplete: "off", label: "Password"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
%h1 Resend unlock instructions
|
%h1 Resend unlock instructions
|
||||||
= render 'layouts/messages'
|
= render 'layouts/messages'
|
||||||
|
|
||||||
= bootstrap_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
|
= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
|
||||||
= devise_error_messages!
|
= devise_error_messages!
|
||||||
|
|
||||||
= f.email_field :email, autofocus: true, label: "Email address"
|
= f.email_field :email, autofocus: true, label: "Email address"
|
||||||
|
|
|
@ -1,26 +1,19 @@
|
||||||
%nav.navbar.navbar-default.navbar-fixed-top{role: "navigation"}
|
%nav.ui.fixed.inverted.main.menu
|
||||||
.container
|
%h3.header.item justask
|
||||||
.navbar-header
|
= nav_entry "Home", "/", icon: "home"
|
||||||
%button.navbar-toggle{"data-target" => "#j2-main-navbar-collapse", "data-toggle" => "collapse", type: "button"}
|
- if user_signed_in?
|
||||||
%span.sr-only Toggle navigation
|
= nav_entry "Inbox", "/inbox", icon: "inbox", label: "2"
|
||||||
%span.icon-bar
|
- else
|
||||||
%span.icon-bar
|
= nav_entry "About", "/about", icon: ""
|
||||||
%span.icon-bar
|
.right.menu
|
||||||
%a.navbar-brand{href: "/"} justask2
|
- if user_signed_in?
|
||||||
#j2-main-navbar-collapse.collapse.navbar-collapse
|
.ui.dropdown.item
|
||||||
%ul.nav.navbar-nav
|
= current_user.screen_name
|
||||||
= nav_entry "Front", "/"
|
= semantic_icon "dropdown"
|
||||||
%ul.nav.navbar-nav.navbar-right
|
.menu
|
||||||
- if user_signed_in?
|
= link_to "Profile", edit_user_registration_path, class: "item"
|
||||||
%li.dropdown
|
= link_to "Settings", "#", class: "item"
|
||||||
%a.dropdown-toggle{href: "#", "data-toggle" => "dropdown"}
|
= link_to "Logout", destroy_user_session_path, method: :delete, class: "item"
|
||||||
= current_user.screen_name
|
- else
|
||||||
%b.caret
|
= nav_entry "Sign in", new_user_session_path #, "right floated text"
|
||||||
%ul.dropdown-menu
|
= nav_entry "Sign up", new_user_registration_path #, "right floated text"
|
||||||
%li= link_to "Profile", edit_user_registration_path
|
|
||||||
%li= link_to "Settings", "#"
|
|
||||||
%li.divider
|
|
||||||
%li= link_to "Logout", destroy_user_session_path, method: :delete
|
|
||||||
- else
|
|
||||||
= nav_entry "Sign in", new_user_session_path
|
|
||||||
= nav_entry "Sign up", new_user_registration_path
|
|
|
@ -1,7 +1,7 @@
|
||||||
!!! 5
|
!!! 5
|
||||||
%html
|
%html
|
||||||
%head
|
%head
|
||||||
%title justask2
|
%title justask
|
||||||
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
||||||
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
|
@ -11,5 +11,5 @@
|
||||||
- if Rails.env.development?
|
- if Rails.env.development?
|
||||||
%hr
|
%hr
|
||||||
.container
|
.container
|
||||||
%p.text-danger EVIL DEBUG MODE OF DOOM ENABLED!!!
|
%p.text-danger Debug output:
|
||||||
= debug params
|
= debug params
|
|
@ -6,7 +6,7 @@ require 'rails/all'
|
||||||
# you've limited to :test, :development, or :production.
|
# you've limited to :test, :development, or :production.
|
||||||
Bundler.require(*Rails.groups)
|
Bundler.require(*Rails.groups)
|
||||||
|
|
||||||
module Justask2
|
module Justask
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
# SQLite version 3.x
|
|
||||||
# gem install sqlite3
|
|
||||||
#
|
|
||||||
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
||||||
# gem 'sqlite3'
|
|
||||||
#
|
|
||||||
default: &default
|
|
||||||
adapter: sqlite3
|
|
||||||
pool: 5
|
|
||||||
timeout: 5000
|
|
||||||
|
|
||||||
development:
|
|
||||||
<<: *default
|
|
||||||
database: db/development.sqlite3
|
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
|
||||||
# re-generated from your development database when you run "rake".
|
|
||||||
# Do not set this db to the same as development or production.
|
|
||||||
test:
|
|
||||||
<<: *default
|
|
||||||
database: db/test.sqlite3
|
|
||||||
|
|
||||||
production:
|
|
||||||
<<: *default
|
|
||||||
database: db/production.sqlite3
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#
|
||||||
|
# PRODUCTION
|
||||||
|
#
|
||||||
|
production:
|
||||||
|
adapter: mysql2
|
||||||
|
encoding: utf8
|
||||||
|
collation: utf8_general_ci
|
||||||
|
reconnect: false
|
||||||
|
database: justask_production
|
||||||
|
pool: 10
|
||||||
|
username: justask
|
||||||
|
password: "hack me"
|
||||||
|
# host: localhost
|
||||||
|
# socket: /tmp/mysql.sock
|
||||||
|
|
||||||
|
#
|
||||||
|
# Development specific
|
||||||
|
#
|
||||||
|
development:
|
||||||
|
adapter: mysql2
|
||||||
|
encoding: utf8
|
||||||
|
collation: utf8_general_ci
|
||||||
|
reconnect: false
|
||||||
|
database: justask_development
|
||||||
|
pool: 5
|
||||||
|
username: root
|
||||||
|
password: "hack me twice"
|
||||||
|
# socket: /tmp/mysql.sock
|
||||||
|
|
||||||
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
# re-generated from your development database when you run "rake".
|
||||||
|
# Do not set this db to the same as development or production.
|
||||||
|
test: &test
|
||||||
|
adapter: mysql2
|
||||||
|
encoding: utf8
|
||||||
|
collation: utf8_general_ci
|
||||||
|
reconnect: false
|
||||||
|
database: justask_test
|
||||||
|
pool: 5
|
||||||
|
username: root
|
||||||
|
password: "hack me twice"
|
||||||
|
# socket: /tmp/mysql.sock
|
|
@ -0,0 +1,34 @@
|
||||||
|
#
|
||||||
|
# PRODUCTION
|
||||||
|
#
|
||||||
|
production:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: justask_production
|
||||||
|
pool: 10
|
||||||
|
# username: justask
|
||||||
|
# password:
|
||||||
|
# host: localhost
|
||||||
|
# port: 5432
|
||||||
|
|
||||||
|
#
|
||||||
|
# Development specific
|
||||||
|
#
|
||||||
|
development:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: justask_development
|
||||||
|
pool: 5
|
||||||
|
username: postgres
|
||||||
|
password:
|
||||||
|
|
||||||
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
# re-generated from your development database when you run "rake".
|
||||||
|
# Do not set this db to the same as development or production.
|
||||||
|
test: &test
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: justask_test
|
||||||
|
pool: 5
|
||||||
|
username: postgres
|
||||||
|
password:
|
|
@ -1,3 +1,3 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
Rails.application.config.session_store :cookie_store, key: '_justask2_session'
|
Rails.application.config.session_store :cookie_store, key: '_justask_session'
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateQuestions < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :questions do |t|
|
||||||
|
t.string :content
|
||||||
|
t.boolean :author_is_anonymous
|
||||||
|
t.string :author_name
|
||||||
|
t.string :author_email
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :questions, [:user_id, :created_at]
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
class CreateAnswers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :answers do |t|
|
||||||
|
t.string :content
|
||||||
|
t.integer :question_id
|
||||||
|
t.integer :comments
|
||||||
|
t.integer :likes
|
||||||
|
t.integer :user_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :answers, [:user_id, :created_at]
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateComments < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :comments do |t|
|
||||||
|
t.string :content
|
||||||
|
t.integer :answer_id
|
||||||
|
t.integer :user_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :comments, [:user_id, :created_at]
|
||||||
|
end
|
||||||
|
end
|
45
db/schema.rb
45
db/schema.rb
|
@ -11,7 +11,44 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20140801103309) do
|
ActiveRecord::Schema.define(version: 20140801175137) do
|
||||||
|
|
||||||
|
# These are extensions that must be enabled in order to support this database
|
||||||
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
|
create_table "answers", force: true do |t|
|
||||||
|
t.string "content"
|
||||||
|
t.integer "question_id"
|
||||||
|
t.integer "comments"
|
||||||
|
t.integer "likes"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "answers", ["user_id", "created_at"], name: "index_answers_on_user_id_and_created_at", using: :btree
|
||||||
|
|
||||||
|
create_table "comments", force: true do |t|
|
||||||
|
t.string "content"
|
||||||
|
t.integer "answer_id"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "comments", ["user_id", "created_at"], name: "index_comments_on_user_id_and_created_at", using: :btree
|
||||||
|
|
||||||
|
create_table "questions", force: true do |t|
|
||||||
|
t.string "content"
|
||||||
|
t.boolean "author_is_anonymous"
|
||||||
|
t.string "author_name"
|
||||||
|
t.string "author_email"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "questions", ["user_id", "created_at"], name: "index_questions_on_user_id_and_created_at", using: :btree
|
||||||
|
|
||||||
create_table "users", force: true do |t|
|
create_table "users", force: true do |t|
|
||||||
t.string "email", default: "", null: false
|
t.string "email", default: "", null: false
|
||||||
|
@ -29,8 +66,8 @@ ActiveRecord::Schema.define(version: 20140801103309) do
|
||||||
t.string "screen_name"
|
t.string "screen_name"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
||||||
add_index "users", ["screen_name"], name: "index_users_on_screen_name", unique: true
|
add_index "users", ["screen_name"], name: "index_users_on_screen_name", unique: true, using: :btree
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
require 'simplecov'
|
||||||
|
SimpleCov.start
|
||||||
|
|
||||||
ENV['RAILS_ENV'] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
require 'rails/test_help'
|
require 'rails/test_help'
|
||||||
|
|
Loading…
Reference in New Issue