family_gallery 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +41 -0
- data/Rakefile +22 -0
- data/app/assets/javascripts/family_gallery/application.js.coffee +5 -0
- data/app/assets/javascripts/family_gallery/locales.js.coffee +7 -0
- data/app/assets/javascripts/family_gallery/pictures.js.coffee +16 -0
- data/app/assets/javascripts/family_gallery/user_taggings.js.coffee +30 -0
- data/app/assets/stylesheets/family_gallery/application.css.scss +6 -0
- data/app/assets/stylesheets/family_gallery/groups.css.scss +0 -0
- data/app/assets/stylesheets/family_gallery/layout.css.scss +116 -0
- data/app/assets/stylesheets/family_gallery/pictures.css.scss +32 -0
- data/app/assets/stylesheets/family_gallery/user_taggings.css.scss +19 -0
- data/app/controllers/family_gallery/base_controller.rb +14 -0
- data/app/controllers/family_gallery/groups_controller.rb +17 -0
- data/app/controllers/family_gallery/locales_controller.rb +8 -0
- data/app/controllers/family_gallery/pictures_controller.rb +29 -0
- data/app/controllers/family_gallery/resources_controller.rb +87 -0
- data/app/controllers/family_gallery/sessions_controller.rb +4 -0
- data/app/controllers/family_gallery/user_taggings_controller.rb +41 -0
- data/app/controllers/family_gallery/users_controller.rb +4 -0
- data/app/controllers/family_gallery/welcome_controller.rb +5 -0
- data/app/helpers/family_gallery/groups_helper.rb +8 -0
- data/app/helpers/family_gallery/layout_helper.rb +5 -0
- data/app/helpers/family_gallery/pictures_helper.rb +13 -0
- data/app/helpers/family_gallery/users_helper.rb +5 -0
- data/app/models/family_gallery/ability.rb +22 -0
- data/app/models/family_gallery/group.rb +8 -0
- data/app/models/family_gallery/group_picture_link.rb +8 -0
- data/app/models/family_gallery/picture.rb +76 -0
- data/app/models/family_gallery/user.rb +24 -0
- data/app/models/family_gallery/user_role.rb +7 -0
- data/app/models/family_gallery/user_tagging.rb +18 -0
- data/app/views/family_gallery/devise/shared/_links.html.haml +0 -0
- data/app/views/family_gallery/groups/_form.html.haml +4 -0
- data/app/views/family_gallery/groups/edit.html.haml +3 -0
- data/app/views/family_gallery/groups/index.html.haml +15 -0
- data/app/views/family_gallery/groups/new.html.haml +3 -0
- data/app/views/family_gallery/groups/show.html.haml +25 -0
- data/app/views/family_gallery/pictures/_form.html.haml +8 -0
- data/app/views/family_gallery/pictures/edit.html.haml +3 -0
- data/app/views/family_gallery/pictures/new.html.haml +3 -0
- data/app/views/family_gallery/pictures/show.html.haml +47 -0
- data/app/views/family_gallery/sessions/new.html.erb +26 -0
- data/app/views/family_gallery/user_taggings/_form.html.haml +9 -0
- data/app/views/family_gallery/user_taggings/new.html.haml +3 -0
- data/app/views/family_gallery/users/show.html.haml +12 -0
- data/app/views/family_gallery/welcome/index.html.haml +10 -0
- data/app/views/layouts/family_gallery/application.html.haml +41 -0
- data/config/initializers/devise.rb +259 -0
- data/config/initializers/omniauth.rb +7 -0
- data/config/locales/awesome_translations/app/views/family_gallery/groups/da.yml +10 -0
- data/config/locales/awesome_translations/app/views/family_gallery/groups/en.yml +10 -0
- data/config/locales/awesome_translations/app/views/family_gallery/pictures/da.yml +12 -0
- data/config/locales/awesome_translations/app/views/family_gallery/pictures/en.yml +12 -0
- data/config/locales/awesome_translations/app/views/family_gallery/user_taggings/da.yml +6 -0
- data/config/locales/awesome_translations/app/views/family_gallery/user_taggings/en.yml +6 -0
- data/config/locales/awesome_translations/app/views/family_gallery/users/da.yml +10 -0
- data/config/locales/awesome_translations/app/views/family_gallery/users/en.yml +10 -0
- data/config/locales/awesome_translations/app/views/family_gallery/welcome/da.yml +7 -0
- data/config/locales/awesome_translations/app/views/family_gallery/welcome/en.yml +7 -0
- data/config/locales/awesome_translations/controllers/family_gallery/da.yml +9 -0
- data/config/locales/awesome_translations/controllers/family_gallery/en.yml +9 -0
- data/config/locales/awesome_translations/da.yml +9 -0
- data/config/locales/awesome_translations/en.yml +9 -0
- data/config/locales/awesome_translations/models/family_gallery__group/da.yml +26 -0
- data/config/locales/awesome_translations/models/family_gallery__group/en.yml +26 -0
- data/config/locales/awesome_translations/models/family_gallery__picture/da.yml +13 -0
- data/config/locales/awesome_translations/models/family_gallery__picture/en.yml +13 -0
- data/config/locales/awesome_translations/models/family_gallery__user_tagging/da.yml +14 -0
- data/config/locales/awesome_translations/models/family_gallery__user_tagging/en.yml +14 -0
- data/config/locales/awesome_translations/views/family_gallery/groups/da.yml +12 -0
- data/config/locales/awesome_translations/views/family_gallery/groups/en.yml +9 -0
- data/config/locales/awesome_translations/views/family_gallery/pictures/da.yml +13 -0
- data/config/locales/awesome_translations/views/family_gallery/pictures/en.yml +13 -0
- data/config/locales/awesome_translations/views/layouts/family_gallery/da.yml +9 -0
- data/config/locales/awesome_translations/views/layouts/family_gallery/en.yml +9 -0
- data/config/locales/devise.en.yml +60 -0
- data/config/routes.rb +19 -0
- data/db/plugin_migrate/20150224155212_create_family_gallery_users.rb +46 -0
- data/db/plugin_migrate/20150224155422_create_family_gallery_groups.rb +14 -0
- data/db/plugin_migrate/20150224155704_create_family_gallery_pictures.rb +29 -0
- data/db/plugin_migrate/20150224180931_create_family_gallery_user_roles.rb +12 -0
- data/db/plugin_migrate/20150224184005_create_family_gallery_group_picture_links.rb +13 -0
- data/db/plugin_migrate/20150301144620_create_family_gallery_user_taggings.rb +16 -0
- data/db/plugin_migrate/20150301144620_create_user_taggings.rb +16 -0
- data/lib/family_gallery/base_family_gallery_controller.rb +9 -0
- data/lib/family_gallery/engine.rb +5 -0
- data/lib/family_gallery/version.rb +3 -0
- data/lib/family_gallery.rb +20 -0
- data/lib/tasks/family_gallery/db.rake +3 -0
- data/lib/tasks/family_gallery/seed.rake +14 -0
- data/lib/tasks/family_gallery_tasks.rake +4 -0
- data/spec/controllers/family_gallery/pictures_controller_spec.rb +20 -0
- data/spec/dummy/README.md +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.example.yml +39 -0
- data/spec/dummy/config/database.shippable.yml +5 -0
- data/spec/dummy/config/database.yml +13 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +32 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +41 -0
- data/spec/dummy/config/family_gallery.yml +3 -0
- data/spec/dummy/config/initializers/awesome_translations.rb +3 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/schema.rb +131 -0
- data/spec/dummy/log/test.log +3457 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/system/family_gallery/pictures/images/000/000/016/original/Profile.jpeg +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/application.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/groups.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/layout.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/bc24de95c506de07c6571950d49f3258660a5d78/application.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/bc24de95c506de07c6571950d49f3258660a5d78/groups.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/bc24de95c506de07c6571950d49f3258660a5d78/layout.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/bc24de95c506de07c6571950d49f3258660a5d78/pictures.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sass/bc24de95c506de07c6571950d49f3258660a5d78/user_taggings.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0cc5658eb161251c8bd64e1cf25e2191 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/119923dc816dfafda90919183ba1581d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1442902bef094cd5f3d9fa021ab30bad +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1575b3a4a178623381cdd55596cd8bc7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1aab57c1924cdaa9ba148c9e3d5bbb85 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1dfc909a73e53e47b341f67cfd8a3fc3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/20d23fa5ea743ace10d6a5494fce8ddb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2128d293dc8ef13115c1f5d64b5acfc9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/21ce280aacf67faf44041900539d5470 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/235a5e7d077adf3448617346dc10129f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3bd5629974bb1919d009bcb1da7a7e49 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/41e4d54853d3193e68b50b72db515857 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/44b768d3351f06e343edc95634297681 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/50b9bcf05a8718d9cb5b99276f154ea9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5270ab363f9384ff7f43ff83bdaf3f82 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5316fc0620afefc2ba81b690c8e2c34d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/538966109f3bbd58bfb717ad57a37096 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/58b9ed99ad62ba462ca6a9272b96bef3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5fdd6c2e7777e739bd4e3400982c1bbf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/673ce11f5cb7033b29ccc99310e62b93 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/697d977cf9fc7e54534f5e29b0832836 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/69944efcc9ea99d47389db34b0e05add +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6aab60b365535cc305f37a738e75868b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6db8498274efddac6691248cc9afe855 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6e266734185d58588bcfaf0e33aa4162 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/81ab882fef1228d654a7c697f2324309 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/908bf508cc68079cab720d6b9c36cb95 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/91090eda0f104056144ac17a4fcae91c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a316bc0d459b308530ee6b622235d103 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a3c8104e5830cd7047c6a3a1c1e2ba32 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/adaf29eda594015193030af46474be58 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b349b574327b896b7a321351b14fe1d8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b34e86a2845f7901154358882afdeaa4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b446ef62b37b9bf3a8e24608d9f95634 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b512f2b016bd3aef8c28fa661e01308c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bd49bb0a6f5dfd284a750fb9cab40d85 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c39fce5fa19b758734af29527d4185ca +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c8ecba0dbc7774cd6db79cb7fbe1ef3e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c9b79d7ebc7ef5550a14749b52427cef +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c9c612c8259a6af5c4c02201dd2df161 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cb595904fcf7acdedf2b95571442fc59 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cfb60287b7af861000187e7ba72e39c1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d8de240bbb697f46b26a6ef75d522aa5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e4ec6c7c682836f272efa386cc68223d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/eb9ed717a7ef467bf260b11dfc8451eb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ebdbddd03e404d3fa30adfae674cb9ea +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/efd7a36b3d6d057aa5229aa6d21cbebb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fe3c3cb0cdabd1bbcc88520fc768a6e9 +0 -0
- data/spec/dummy/views/family_gallery/groups/da.yml +9 -0
- data/spec/dummy/views/family_gallery/groups/en.yml +8 -0
- data/spec/dummy/views/family_gallery/pictures/da.yml +9 -0
- data/spec/dummy/views/family_gallery/pictures/en.yml +9 -0
- data/spec/dummy/views/layouts/family_gallery/da.yml +6 -0
- data/spec/dummy/views/layouts/family_gallery/en.yml +6 -0
- data/spec/factories/family_gallery/group.rb +6 -0
- data/spec/factories/family_gallery/picture.rb +10 -0
- data/spec/factories/family_gallery/user.rb +12 -0
- data/spec/models/family_gallery/picture_spec.rb +14 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/test_files/0/family_gallery/pictures/000/000/039/original.jpg +0 -0
- data/spec/test_files/0/family_gallery/pictures/000/000/040/original.jpg +0 -0
- data/spec/test_files/0/family_gallery/pictures/000/000/041/original.jpg +0 -0
- data/spec/test_files/0/family_gallery/pictures/000/000/042/original.jpg +0 -0
- data/spec/test_files/0/family_gallery/pictures/000/000/043/original.jpg +0 -0
- data/spec/test_files/0/family_gallery/pictures/000/000/044/original.jpg +0 -0
- data/spec/test_files/0/family_gallery/pictures/000/000/045/original.jpg +0 -0
- data/spec/test_files/0/family_gallery/pictures/000/000/046/original.jpg +0 -0
- data/spec/test_pictures/christina.jpg +0 -0
- data/spec/test_pictures/sigrid.jpg +0 -0
- metadata +741 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eb9bd8ff1742a50b87118c7e4e74860eb201cba9
|
4
|
+
data.tar.gz: b399079ff4188128638193efa402cc3e1251317e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5346864ec274e6f5e562f7c493fa7453d8bfdc741c712c2b75232cd2b720cd00f2fa56ec2dbab0c7d723a7fa7907f1438916c0439349e0c4e4b25cf08b517ed7
|
7
|
+
data.tar.gz: cf4be9ec70467a24e688e9469cbbf895538e33f25371f8c6015d853561b21355adf48ea0162badfedf3fc5bb853772355e6bf79cd3c9c53e9138e779e2f89086
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
[![Build Status](https://api.shippable.com/projects/54ed69135ab6cc13528db117/badge?branchName=master)](https://app.shippable.com/projects/54ed69135ab6cc13528db117/builds/latest)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/kaspernj/family_gallery/badges/gpa.svg)](https://codeclimate.com/github/kaspernj/family_gallery)
|
3
|
+
[![Test Coverage](https://codeclimate.com/github/kaspernj/family_gallery/badges/coverage.svg)](https://codeclimate.com/github/kaspernj/family_gallery)
|
4
|
+
|
5
|
+
# FamilyGallery
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
Add to your Gemfile and bundle:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem "family_gallery"
|
13
|
+
```
|
14
|
+
|
15
|
+
Then add something like this to your Rails-app's "routes.rb":
|
16
|
+
```ruby
|
17
|
+
mount FamilyGallery::Engine => "/family_gallery"
|
18
|
+
```
|
19
|
+
|
20
|
+
Create a config-file under "#{Rails.root}/config/family_gallery.yml" and insert this:
|
21
|
+
```yaml
|
22
|
+
facebook:
|
23
|
+
app_id: 123
|
24
|
+
app_secret: 321
|
25
|
+
```
|
26
|
+
|
27
|
+
In order to use the existing translations, you should add this line to your "application.rb":
|
28
|
+
```ruby
|
29
|
+
config.i18n.load_path += Dir[FamilyGallery::Engine.root.join("config", "locales", "**", "*.yml").to_s]
|
30
|
+
```
|
31
|
+
|
32
|
+
To create an admin-user with a password of "password", you can run the seed script like this:
|
33
|
+
```bash
|
34
|
+
bundle exec rake family_gallery:seed
|
35
|
+
```
|
36
|
+
|
37
|
+
You should now be able to access it on "http://localhost:3000/family_gallery".
|
38
|
+
|
39
|
+
## License
|
40
|
+
|
41
|
+
This project rocks and uses MIT-LICENSE.
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'FamilyGallery'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
task default: :test
|
@@ -0,0 +1,7 @@
|
|
1
|
+
$ ->
|
2
|
+
$("select#locale").change ->
|
3
|
+
locale_select = $(this)
|
4
|
+
|
5
|
+
$.ajax method: "POST", url: locale_select.data("url"), data: {locale: locale_select.val()}, cache: false, async: false, complete: (data) ->
|
6
|
+
response = $.parseJSON(data.responseText)
|
7
|
+
location.reload() if response.success
|
@@ -0,0 +1,16 @@
|
|
1
|
+
$ ->
|
2
|
+
return if $("body.controller_pictures").length == 0
|
3
|
+
|
4
|
+
if $("body.action_show").length > 0
|
5
|
+
$(".tagged-users-list .link-to-user").hover ->
|
6
|
+
user_link = $(this)
|
7
|
+
user_id = user_link.data("user-id")
|
8
|
+
|
9
|
+
tagged_user = $(".tagged-user-" + user_id)
|
10
|
+
tagged_user.fadeIn("fast")
|
11
|
+
, ->
|
12
|
+
user_link = $(this)
|
13
|
+
user_id = user_link.data("user-id")
|
14
|
+
|
15
|
+
tagged_user = $(".tagged-user-" + user_id)
|
16
|
+
tagged_user.fadeOut("fast")
|
@@ -0,0 +1,30 @@
|
|
1
|
+
$ ->
|
2
|
+
return unless $("body.controller_user_taggings").length > 0
|
3
|
+
|
4
|
+
if $("body.controller_user_taggings.action_new, body.controller_user_taggings.action_edit").length > 0
|
5
|
+
$(".picture").mousemove (event) ->
|
6
|
+
position = $(this)[0].getBoundingClientRect()
|
7
|
+
picture = $(this)
|
8
|
+
|
9
|
+
picture.data("pos-left", event.clientX - parseInt(position.left))
|
10
|
+
picture.data("pos-top", event.clientY - parseInt(position.top))
|
11
|
+
|
12
|
+
$(".picture").click ->
|
13
|
+
picture = $(this)
|
14
|
+
|
15
|
+
width = parseInt(picture.data("width"))
|
16
|
+
height = parseInt(picture.data("height"))
|
17
|
+
|
18
|
+
left = parseInt(picture.data("pos-left"))
|
19
|
+
top = parseInt(picture.data("pos-top"))
|
20
|
+
|
21
|
+
left_percentage = (left / width) * 100
|
22
|
+
top_percentage = (top / height) * 100
|
23
|
+
|
24
|
+
$("#user_tagging_position_left").val(left_percentage)
|
25
|
+
$("#user_tagging_position_top").val(top_percentage)
|
26
|
+
|
27
|
+
marker = $(".tagging-marker")
|
28
|
+
marker_left = left - 50
|
29
|
+
marker_top = top - 50
|
30
|
+
marker.css({left: marker_left, top: marker_top})
|
File without changes
|
@@ -0,0 +1,116 @@
|
|
1
|
+
html, body, body > center {
|
2
|
+
width: 100%;
|
3
|
+
height: 100%;
|
4
|
+
margin: 0px;
|
5
|
+
padding: 0px;
|
6
|
+
}
|
7
|
+
|
8
|
+
body {
|
9
|
+
background-color: #0c1219;
|
10
|
+
color: #ffffff;
|
11
|
+
font-family: "Open Sans";
|
12
|
+
font-size: 12px;
|
13
|
+
}
|
14
|
+
|
15
|
+
h1 {
|
16
|
+
font-family: "Raleway";
|
17
|
+
}
|
18
|
+
|
19
|
+
a:link, a:visited {
|
20
|
+
color: #a7f4ff;
|
21
|
+
}
|
22
|
+
|
23
|
+
a:hover, a:active {
|
24
|
+
color: #ffffff;
|
25
|
+
}
|
26
|
+
|
27
|
+
.actions {
|
28
|
+
margin-bottom: 25px;
|
29
|
+
}
|
30
|
+
|
31
|
+
.button {
|
32
|
+
background-color: lightgrey;
|
33
|
+
color: black;
|
34
|
+
border: 1px solid black;
|
35
|
+
border-radius: 3px;
|
36
|
+
padding: 4px 12px 4px 12px;
|
37
|
+
|
38
|
+
&:link, &:visited {
|
39
|
+
text-decoration: none;
|
40
|
+
color: black;
|
41
|
+
cursor: default;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
.button-danger {
|
46
|
+
@extend .button;
|
47
|
+
|
48
|
+
background-color: darkred;
|
49
|
+
}
|
50
|
+
|
51
|
+
table > thead > tr > th {
|
52
|
+
text-align: left;
|
53
|
+
}
|
54
|
+
|
55
|
+
.flash-message {
|
56
|
+
border: 1px solid black;
|
57
|
+
border-radius: 3px;
|
58
|
+
padding: 12px;
|
59
|
+
margin-bottom: 25px;
|
60
|
+
|
61
|
+
&.flash-error {
|
62
|
+
background-color: #5a0b0b;
|
63
|
+
}
|
64
|
+
|
65
|
+
&.flash-notice {
|
66
|
+
background-color: #0b5a16;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
table.main {
|
71
|
+
width: 1000px;
|
72
|
+
height: 100%;
|
73
|
+
border-collapse: separate;
|
74
|
+
border-spacing: 0px;
|
75
|
+
border-left: 1px solid black;
|
76
|
+
border-right: 1px solid black;
|
77
|
+
|
78
|
+
td.main-logo {
|
79
|
+
background: linear-gradient(#384a54, #23313a);
|
80
|
+
color: #ffffff;
|
81
|
+
font-size: 36px;
|
82
|
+
padding: 22px;
|
83
|
+
font-family: "Raleway";
|
84
|
+
}
|
85
|
+
|
86
|
+
td.main-menu {
|
87
|
+
background: linear-gradient(#1c2836, #0d141c);
|
88
|
+
padding: 12px;
|
89
|
+
border-top: 1px solid black;
|
90
|
+
border-bottom: 1px solid black;
|
91
|
+
|
92
|
+
a:link, a:visited {
|
93
|
+
color: #ffffff;
|
94
|
+
text-decoration: none;
|
95
|
+
margin-right: 16px;
|
96
|
+
}
|
97
|
+
|
98
|
+
a:hover, a:active {
|
99
|
+
color: steelblue;
|
100
|
+
text-decoration: none;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
td.main-content {
|
105
|
+
padding: 12px;
|
106
|
+
height: 100%;
|
107
|
+
vertical-align: top;
|
108
|
+
background-color: #293740;
|
109
|
+
}
|
110
|
+
|
111
|
+
td.main-bottom {
|
112
|
+
background: linear-gradient(#1c2836, #0d141c);
|
113
|
+
padding: 12px;
|
114
|
+
text-align: center;
|
115
|
+
}
|
116
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
body.controller_pictures {
|
2
|
+
&.action_show {
|
3
|
+
.picture-container {
|
4
|
+
position: relative;
|
5
|
+
border: 1px solid black;
|
6
|
+
border-radius: 2%;
|
7
|
+
}
|
8
|
+
|
9
|
+
.tagged-user {
|
10
|
+
position: absolute;
|
11
|
+
display: none;
|
12
|
+
border: 4px solid white;
|
13
|
+
width: 100px;
|
14
|
+
height: 100px;
|
15
|
+
}
|
16
|
+
|
17
|
+
.navigation-links {
|
18
|
+
.previous {
|
19
|
+
text-align: left;
|
20
|
+
}
|
21
|
+
|
22
|
+
.next {
|
23
|
+
text-align: right;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
.picture-image {
|
30
|
+
border: 1px solid black;
|
31
|
+
border-radius: 8%;
|
32
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
body.controller_user_taggings {
|
2
|
+
&.action_new, &.action_edit {
|
3
|
+
.picture-container {
|
4
|
+
position: relative;
|
5
|
+
|
6
|
+
.tagging-marker {
|
7
|
+
position: absolute;
|
8
|
+
display: hidden;
|
9
|
+
width: 100px;
|
10
|
+
height: 100px;
|
11
|
+
border: 4px solid white;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
.picture {
|
16
|
+
margin-top: 25px;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class FamilyGallery::BaseController < ActionController::Base
|
2
|
+
layout "family_gallery/application"
|
3
|
+
include FamilyGallery::BaseFamilyGalleryController
|
4
|
+
|
5
|
+
before_filter :set_locale
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def set_locale
|
10
|
+
if session[:locale]
|
11
|
+
I18n.locale = session[:locale]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class FamilyGallery::GroupsController < FamilyGallery::ResourcesController
|
2
|
+
def show
|
3
|
+
end
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def resource_params
|
8
|
+
params.require(:group).permit(:name, :description)
|
9
|
+
end
|
10
|
+
|
11
|
+
helper_method :groups_of_pictures
|
12
|
+
def groups_of_pictures
|
13
|
+
@group.pictures.find_in_batches(batch_size: 6) do |pictures|
|
14
|
+
yield pictures
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class FamilyGallery::PicturesController < FamilyGallery::ResourcesController
|
2
|
+
before_filter :set_group
|
3
|
+
|
4
|
+
def show
|
5
|
+
@width = 800
|
6
|
+
@height = @picture.height_for_width(@width)
|
7
|
+
|
8
|
+
if @group
|
9
|
+
@previous_picture = @picture.previous_picture_in_group(@group)
|
10
|
+
@next_picture = @picture.next_picture_in_group(@group)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def set_group
|
17
|
+
@group = FamilyGallery::Group.find(params[:group_id]) if params[:group_id]
|
18
|
+
end
|
19
|
+
|
20
|
+
def after_assign
|
21
|
+
resource_instance.user_uploaded = current_user
|
22
|
+
resource_instance.user_owner = current_user
|
23
|
+
resource_instance.groups << FamilyGallery::Group.find(params[:group_id]) if params[:group_id].present?
|
24
|
+
end
|
25
|
+
|
26
|
+
def resource_params
|
27
|
+
params.require(:picture).permit(:title, :description, :image)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
class FamilyGallery::ResourcesController < FamilyGallery::BaseController
|
2
|
+
# Set load_and_authorize for classes that extend this one.
|
3
|
+
def self.inherited(subclass)
|
4
|
+
name_match = subclass.name.match(/\AFamilyGallery::(.+)sController\Z/)
|
5
|
+
class_name = "FamilyGallery::#{name_match[1]}"
|
6
|
+
subclass.load_and_authorize_resource class_name: class_name
|
7
|
+
|
8
|
+
subclass.__send__(:define_method, :resource_name) do
|
9
|
+
name_match[1]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def index
|
14
|
+
@ransack = resource_class.ransack(params[:q])
|
15
|
+
end
|
16
|
+
|
17
|
+
def new
|
18
|
+
assign_params_to_resource_instance
|
19
|
+
end
|
20
|
+
|
21
|
+
def create
|
22
|
+
assign_params_to_resource_instance
|
23
|
+
|
24
|
+
if resource_instance.save
|
25
|
+
flash[:notice] = t(".resource_was_saved")
|
26
|
+
redirect_to resource_instance
|
27
|
+
else
|
28
|
+
render :new
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def show
|
33
|
+
end
|
34
|
+
|
35
|
+
def edit
|
36
|
+
assign_params_to_resource_instance
|
37
|
+
end
|
38
|
+
|
39
|
+
def update
|
40
|
+
assign_params_to_resource_instance
|
41
|
+
|
42
|
+
if resource_instance.save
|
43
|
+
flash[:notice] = t(".resource_was_updated")
|
44
|
+
redirect_to resource_instance
|
45
|
+
else
|
46
|
+
render :edit
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def destroy
|
51
|
+
if resource_instance.destroy
|
52
|
+
flash[:notice] = t(".resource_was_deleted")
|
53
|
+
redirect_to root_url
|
54
|
+
else
|
55
|
+
flash[:error] = resource_instance.errors.full_messages.join(". ")
|
56
|
+
redirect_to resource_instance
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def resource_class
|
63
|
+
FamilyGallery.const_get(resource_name)
|
64
|
+
end
|
65
|
+
|
66
|
+
def resource_instance
|
67
|
+
unless @resource_instance
|
68
|
+
@resource_instance = instance_variable_get("@#{StringCases.camel_to_snake(resource_name)}")
|
69
|
+
end
|
70
|
+
|
71
|
+
@resource_instance
|
72
|
+
end
|
73
|
+
|
74
|
+
def resource_extracted_params
|
75
|
+
key_name = StringCases.camel_to_snake(resource_name)
|
76
|
+
return params[key_name]
|
77
|
+
end
|
78
|
+
|
79
|
+
def assign_params_to_resource_instance
|
80
|
+
resource_instance.assign_attributes(resource_params) if resource_extracted_params
|
81
|
+
|
82
|
+
begin
|
83
|
+
after_assign
|
84
|
+
rescue NameError
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class FamilyGallery::UserTaggingsController < FamilyGallery::ResourcesController
|
2
|
+
load_and_authorize_resource
|
3
|
+
|
4
|
+
before_filter :set_picture
|
5
|
+
|
6
|
+
def create
|
7
|
+
@user_tagging.picture = @picture
|
8
|
+
@user_tagging.tagged_by = current_user
|
9
|
+
@user_tagging.assign_attributes(resource_params)
|
10
|
+
|
11
|
+
if @user_tagging.save
|
12
|
+
flash[:notice] = t(".tagging_was_saved")
|
13
|
+
redirect_to @picture
|
14
|
+
else
|
15
|
+
flash[:error] = @user_tagging.errors.full_messages.join(". ")
|
16
|
+
render :new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
unless @user_tagging.destroy
|
22
|
+
flash[:error] = @user_tagging.errors.full_messages.join(". ")
|
23
|
+
end
|
24
|
+
|
25
|
+
redirect_to @picture
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def set_picture
|
31
|
+
@picture = FamilyGallery::Picture.find(params[:picture_id])
|
32
|
+
@width = 1000
|
33
|
+
@height = @picture.height_for_width(1000)
|
34
|
+
|
35
|
+
authorize! :edit, @picture
|
36
|
+
end
|
37
|
+
|
38
|
+
def resource_params
|
39
|
+
params.require(:user_tagging).permit(:user_id, :position_top, :position_left)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module FamilyGallery::PicturesHelper
|
2
|
+
def picture_image_tag(picture, args = {})
|
3
|
+
image_args = {alt: picture.title, class: "picture-image"}.merge(args)
|
4
|
+
|
5
|
+
if args[:group]
|
6
|
+
link_object = [args[:group], picture]
|
7
|
+
else
|
8
|
+
link_object = picture
|
9
|
+
end
|
10
|
+
|
11
|
+
link_to(image_tag(picture.image.url, image_args), link_object)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class FamilyGallery::Ability
|
2
|
+
include CanCan::Ability
|
3
|
+
|
4
|
+
def initialize(user)
|
5
|
+
@user = user
|
6
|
+
|
7
|
+
if @user
|
8
|
+
@user.user_roles.each do |user_role|
|
9
|
+
__send__(user_role.role)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def administrator
|
17
|
+
can :manage, FamilyGallery::Group
|
18
|
+
can :manage, FamilyGallery::Picture
|
19
|
+
can :manage, FamilyGallery::User
|
20
|
+
can :manage, FamilyGallery::UserTagging
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class FamilyGallery::Group < ActiveRecord::Base
|
2
|
+
translates :name, :description
|
3
|
+
|
4
|
+
has_many :group_picture_links, dependent: :destroy
|
5
|
+
has_many :pictures, through: :group_picture_links
|
6
|
+
|
7
|
+
scope :ordered_by_latest_update, -> { joins(:pictures).order("family_gallery_pictures.updated_at DESC").group("family_gallery_groups.id") }
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class FamilyGallery::GroupPictureLink < ActiveRecord::Base
|
2
|
+
belongs_to :group
|
3
|
+
belongs_to :picture
|
4
|
+
|
5
|
+
validates_presence_of :group
|
6
|
+
validates_presence_of :picture, unless: :new_record? # If created as a nested resource.
|
7
|
+
validates_uniqueness_of :picture_id, scope: :group_id
|
8
|
+
end
|