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
@@ -0,0 +1,76 @@
|
|
1
|
+
class FamilyGallery::Picture < ActiveRecord::Base
|
2
|
+
translates :title, :description
|
3
|
+
|
4
|
+
has_many :group_picture_links, dependent: :destroy
|
5
|
+
has_many :groups, through: :group_picture_links
|
6
|
+
has_many :user_taggings, dependent: :destroy
|
7
|
+
has_many :tagged_users, through: :user_taggings, source: :user
|
8
|
+
|
9
|
+
belongs_to :user_owner, class_name: "User"
|
10
|
+
belongs_to :user_uploaded, class_name: "User"
|
11
|
+
|
12
|
+
has_attached_file :image, style: {medium: "900x900", thumb: "120x120"}
|
13
|
+
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
|
14
|
+
|
15
|
+
after_create :parse_exif
|
16
|
+
|
17
|
+
def width_for_height(new_height)
|
18
|
+
return (width.to_f / (height.to_f / new_height.to_f)).to_i
|
19
|
+
end
|
20
|
+
|
21
|
+
def height_for_width(new_width)
|
22
|
+
return (height.to_f / (width.to_f / new_width.to_f)).to_i
|
23
|
+
end
|
24
|
+
|
25
|
+
def smartsize(size)
|
26
|
+
if height > width
|
27
|
+
return {width: width_for_height(size), height: size}
|
28
|
+
else
|
29
|
+
return {width: size, height: height_for_width(size)}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def next_picture_in_group(group)
|
34
|
+
group.pictures
|
35
|
+
.where("family_gallery_pictures.id > ?", id)
|
36
|
+
.order(:id)
|
37
|
+
.first
|
38
|
+
end
|
39
|
+
|
40
|
+
def previous_picture_in_group(group)
|
41
|
+
group.pictures
|
42
|
+
.where("family_gallery_pictures.id < ?", id)
|
43
|
+
.order(:id)
|
44
|
+
.reverse_order
|
45
|
+
.first
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def parse_exif
|
51
|
+
raise "No image was given" unless image.present?
|
52
|
+
|
53
|
+
require "exifr"
|
54
|
+
exif = EXIFR::JPEG.new(image.queued_for_write[:original].path)
|
55
|
+
|
56
|
+
updates = {
|
57
|
+
width: exif.width,
|
58
|
+
height: exif.height
|
59
|
+
}
|
60
|
+
|
61
|
+
if exif.date_time
|
62
|
+
updates[:taken_at] = exif.date_time
|
63
|
+
elsif exif.date_time_digitized
|
64
|
+
updates[:taken_at] = exif.date_time_digitized
|
65
|
+
elsif exif.date_time_original
|
66
|
+
updates[:taken_at] = exif.date_time_original
|
67
|
+
end
|
68
|
+
|
69
|
+
if exif.gps
|
70
|
+
updates[:latitude] = exif.gps.latitude if exif.gps.latitude.present?
|
71
|
+
updates[:longitude] = exif.gps.longitude if exif.gps.longitude.present?
|
72
|
+
end
|
73
|
+
|
74
|
+
update_attributes!(updates)
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class FamilyGallery::User < ActiveRecord::Base
|
2
|
+
devise :database_authenticatable, :recoverable, :rememberable, :trackable
|
3
|
+
|
4
|
+
validates_presence_of :email
|
5
|
+
validates_uniqueness_of :email
|
6
|
+
|
7
|
+
has_many :owned_pictures, class_name: "Picture", foreign_key: "user_owner_id", dependent: :restrict_with_error
|
8
|
+
has_many :pictures_tagged_on, through: :user_taggings, source: :picture
|
9
|
+
has_many :user_roles, dependent: :destroy
|
10
|
+
has_many :user_taggings, dependent: :destroy
|
11
|
+
has_many :user_taggings_created, class_name: "UserTagging"
|
12
|
+
has_many :uploaded_pictures, class_name: "Picture", foreign_key: "user_uploaded_id", dependent: :restrict_with_error
|
13
|
+
|
14
|
+
scope :ordered, -> { order("family_gallery_users.first_name, family_gallery_users.last_name, family_gallery_users.email") }
|
15
|
+
|
16
|
+
def name
|
17
|
+
name = "#{first_name}" # Needs to be a new string.
|
18
|
+
name << " #{last_name}" if last_name?
|
19
|
+
|
20
|
+
name = email unless name.present?
|
21
|
+
|
22
|
+
return name
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class FamilyGallery::UserTagging < ActiveRecord::Base
|
2
|
+
belongs_to :picture
|
3
|
+
belongs_to :tagged_by, class_name: "User"
|
4
|
+
belongs_to :user
|
5
|
+
|
6
|
+
validates_presence_of :picture, :user, :tagged_by, :position_left, :position_top
|
7
|
+
validates_uniqueness_of :user, scope: :picture
|
8
|
+
|
9
|
+
scope :ordered, -> { joins(:user).order("family_gallery_users.first_name, family_gallery_users.last_name, family_gallery_users.email") }
|
10
|
+
|
11
|
+
def left_for_width(width)
|
12
|
+
return (width * (position_left.to_f / 100)).to_i
|
13
|
+
end
|
14
|
+
|
15
|
+
def top_for_height(height)
|
16
|
+
return (height * (position_top.to_f / 100)).to_i
|
17
|
+
end
|
18
|
+
end
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
- content_for(:header_title) { FamilyGallery::Group.model_name.human(count: 2) }
|
2
|
+
|
3
|
+
= link_to t("add_new"), new_group_path
|
4
|
+
|
5
|
+
%table.list
|
6
|
+
%thead
|
7
|
+
%tr
|
8
|
+
%th= sort_link @ransack, :name
|
9
|
+
%tbody
|
10
|
+
- @groups.each do |group|
|
11
|
+
%tr
|
12
|
+
%td= link_to_group group
|
13
|
+
- unless @groups.any?
|
14
|
+
%tr
|
15
|
+
%td{colspan: 1}= t("no_results")
|
@@ -0,0 +1,25 @@
|
|
1
|
+
- content_for(:header_title) { t(".show_group", name: @group.name) }
|
2
|
+
|
3
|
+
.actions
|
4
|
+
= link_to t(".edit_group"), edit_group_path(@group), class: "button" if can? :edit, @group
|
5
|
+
= link_to t(".new_picture"), new_picture_path(group_id: @group.id), class: "button" if can? :new, FamilyGallery::Picture
|
6
|
+
|
7
|
+
%table.form
|
8
|
+
%tbody
|
9
|
+
%tr
|
10
|
+
%td= FamilyGallery::Group.human_attribute_name(:name)
|
11
|
+
%td= @group.name
|
12
|
+
%tr
|
13
|
+
%td= FamilyGallery::Group.human_attribute_name(:description)
|
14
|
+
%td= simple_format @group.description, nil, wrapper_tag: "div"
|
15
|
+
|
16
|
+
%h2= FamilyGallery::Picture.model_name.human(count: 2)
|
17
|
+
%table.list
|
18
|
+
%tbody
|
19
|
+
- groups_of_pictures do |pictures|
|
20
|
+
%tr
|
21
|
+
- pictures.each do |picture|
|
22
|
+
%td= picture_image_tag(picture, width: 100)
|
23
|
+
- unless @group.pictures.any?
|
24
|
+
%tr
|
25
|
+
%td{colspan: 1}= t("no_results")
|
@@ -0,0 +1,8 @@
|
|
1
|
+
= simple_form_for picture do |f|
|
2
|
+
= hidden_field_tag :group_id, params[:group_id] if params[:group_id].present?
|
3
|
+
= f.input :title, autofocus: true
|
4
|
+
= f.input :description
|
5
|
+
= f.input :image
|
6
|
+
= f.submit t("save"), class: "button"
|
7
|
+
|
8
|
+
= link_to t("delete"), picture, class: "button-danger", method: :delete, data: {confirm: t("are_you_sure")} unless picture.new_record?
|
@@ -0,0 +1,47 @@
|
|
1
|
+
- content_for(:header_title) { t(".show_picture", title: @picture.title) }
|
2
|
+
|
3
|
+
.actions
|
4
|
+
= link_to t(".edit_picture"), edit_picture_path(@picture), class: "button" if can? :edit, @picture
|
5
|
+
= link_to t(".add_tagging"), new_picture_user_tagging_path(@picture), class: "button" if can? :new, FamilyGallery::UserTagging
|
6
|
+
|
7
|
+
- if @picture.groups.any?
|
8
|
+
%table.list
|
9
|
+
%tbody
|
10
|
+
%tr
|
11
|
+
%td= FamilyGallery::Picture.human_attribute_name(:user_owner)
|
12
|
+
%td= link_to_user @picture.user_owner
|
13
|
+
%tr
|
14
|
+
%td= FamilyGallery::Picture.human_attribute_name(:user_uploaded)
|
15
|
+
%td= link_to_user @picture.user_uploaded
|
16
|
+
- @picture.groups.each do |group|
|
17
|
+
%tr
|
18
|
+
%td= FamilyGallery::Group.model_name.human
|
19
|
+
%td= link_to_group group
|
20
|
+
|
21
|
+
%center
|
22
|
+
%table.navigation-links{width: "#{@width}px;"}
|
23
|
+
%tbody
|
24
|
+
%tr
|
25
|
+
%td.previous= link_to t(".previous"), [@group, @previous_picture] if @previous_picture
|
26
|
+
%td.next= link_to t(".next"), [@group, @next_picture] if @next_picture
|
27
|
+
.picture-container{style: "width: #{@width}px; height: #{@height}px; background-size: #{@width}px #{@picture.height_for_width(@width)}px; background-image: url('#{@picture.image.url}');"}
|
28
|
+
- @picture.user_taggings.joins(:user).each do |user_tagging|
|
29
|
+
.tagged-user{class: "tagged-user-#{user_tagging.user.id}", style: "left: #{user_tagging.left_for_width(@width) - 50}px; top: #{user_tagging.top_for_height(@height) - 50}px;"}
|
30
|
+
|
31
|
+
%h2= t(".tagged_users")
|
32
|
+
.tagged-users-list
|
33
|
+
%table
|
34
|
+
%thead
|
35
|
+
%tr
|
36
|
+
%th= FamilyGallery::UserTagging.human_attribute_name(:user)
|
37
|
+
%th= t("actions")
|
38
|
+
%tbody
|
39
|
+
- @picture.user_taggings.joins(:user).ordered.each do |user_tagging|
|
40
|
+
%tr
|
41
|
+
%td= link_to_user user_tagging.user
|
42
|
+
%td
|
43
|
+
= link_to t("remove"), picture_user_tagging_path(@picture, user_tagging), method: :delete, data: {confirm: t("are_you_sure")} if can? :destroy, user_tagging
|
44
|
+
|
45
|
+
- unless @picture.tagged_users.any?
|
46
|
+
%tr
|
47
|
+
%td{colspan: 2}= t(".no_users_was_tagged")
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<h2>Log in</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: family_gallery_user_session_path) do |f| %>
|
4
|
+
<div class="field">
|
5
|
+
<%= f.label :email %><br />
|
6
|
+
<%= f.email_field :email, autofocus: true %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="field">
|
10
|
+
<%= f.label :password %><br />
|
11
|
+
<%= f.password_field :password, autocomplete: "off" %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<% if devise_mapping.rememberable? -%>
|
15
|
+
<div class="field">
|
16
|
+
<%= f.check_box :remember_me %>
|
17
|
+
<%= f.label :remember_me %>
|
18
|
+
</div>
|
19
|
+
<% end -%>
|
20
|
+
|
21
|
+
<div class="actions">
|
22
|
+
<%= f.submit "Log in" %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<%= render "family_gallery/devise/shared/links" %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= simple_form_for [@picture, @user_tagging] do |f|
|
2
|
+
= f.association :user, collection: FamilyGallery::User.order(:email)
|
3
|
+
= f.input :position_top, as: :hidden
|
4
|
+
= f.input :position_left, as: :hidden
|
5
|
+
= f.submit t("save"), class: "button"
|
6
|
+
|
7
|
+
.picture-container
|
8
|
+
.tagging-marker
|
9
|
+
.picture{style: "background-image: url('#{@picture.image.url}'); width: #{@width}px; height: #{@height}px; background-size: #{@width}px #{@height}px;", data: {width: @width, height: @height}}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
- content_for(:header_title) { t(".show_user", user_name: @user.name) }
|
2
|
+
|
3
|
+
%h2= t(".tagged_on")
|
4
|
+
- @user.pictures_tagged_on.each do |picture|
|
5
|
+
= picture_image_tag picture
|
6
|
+
|
7
|
+
- unless @user.pictures_tagged_on.any?
|
8
|
+
= t(".user_hasnt_been_tagged_on_any_pictures")
|
9
|
+
|
10
|
+
%h2= t(".uploaded_pictures")
|
11
|
+
- @user.uploaded_pictures.each do |picture|
|
12
|
+
= picture_image_tag picture
|
@@ -0,0 +1,10 @@
|
|
1
|
+
- content_for(:header_title) { t(".welcome") }
|
2
|
+
|
3
|
+
- if @groups.any?
|
4
|
+
%h2= t(".latest_updated_groups")
|
5
|
+
- @groups.each do |group|
|
6
|
+
%h3= link_to_group group
|
7
|
+
- group.pictures.order(:updated_at).reverse_order.each do |picture|
|
8
|
+
= picture_image_tag picture, group: group, width: 100
|
9
|
+
- else
|
10
|
+
= t(".no_groups_has_been_created_yet")
|
@@ -0,0 +1,41 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title= try(:header_title) || "FamilyGallery"
|
5
|
+
|
6
|
+
= stylesheet_link_tag "family_gallery/application", media: "all"
|
7
|
+
= stylesheet_link_tag "http://fonts.googleapis.com/css?family=Open+Sans:400"
|
8
|
+
= stylesheet_link_tag "http://fonts.googleapis.com/css?family=Raleway:400"
|
9
|
+
|
10
|
+
= javascript_include_tag "family_gallery/application"
|
11
|
+
|
12
|
+
= csrf_meta_tags
|
13
|
+
%body{class: ["controller_#{controller_name}", "action_#{action_name}"]}
|
14
|
+
%center
|
15
|
+
%table.main
|
16
|
+
%tbody
|
17
|
+
%tr
|
18
|
+
%td.main-logo FamilyGallery
|
19
|
+
%tr
|
20
|
+
%td.main-menu
|
21
|
+
= link_to t(".frontpage"), root_path
|
22
|
+
= link_to FamilyGallery::Group.model_name.human(count: 2), groups_path if can? :index, FamilyGallery::Group
|
23
|
+
= link_to t(".translations"), awesome_translations_path if Rails.env.development?
|
24
|
+
|
25
|
+
- if signed_in?
|
26
|
+
= link_to t(".sign_out"), destroy_family_gallery_user_session_path, method: :delete
|
27
|
+
- else
|
28
|
+
= link_to t(".sign_in"), new_family_gallery_user_session_path
|
29
|
+
%tr
|
30
|
+
%td.main-content
|
31
|
+
- flash.each do |flash_type, flash_message|
|
32
|
+
.flash-message{class: "flash-#{flash_type}"}
|
33
|
+
= flash_message
|
34
|
+
|
35
|
+
- if try(:header_title).present?
|
36
|
+
%h1= header_title
|
37
|
+
|
38
|
+
= yield
|
39
|
+
%tr
|
40
|
+
%td.main-bottom
|
41
|
+
= select_tag "locale", options_for_select(I18n.available_locales.to_a, I18n.locale), data: {url: locales_path}
|
@@ -0,0 +1,259 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
|
+
# Many of these configuration options can be set straight in your model.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# The secret key used by Devise. Devise uses this key to generate
|
5
|
+
# random tokens. Changing this key will render invalid all existing
|
6
|
+
# confirmation, reset password and unlock tokens in the database.
|
7
|
+
# config.secret_key = '72310b2a3ceccb83b1551223c8e348add4b5ed85a4769c6a757aa6d1709c62e6253a3b964c8945dc35d26041600ae5ad9ad506e97ad9835826b1ebee7d6b191c'
|
8
|
+
|
9
|
+
# ==> Mailer Configuration
|
10
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
11
|
+
# note that it will be overwritten if you use your own mailer class
|
12
|
+
# with default "from" parameter.
|
13
|
+
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
14
|
+
|
15
|
+
# Configure the class responsible to send e-mails.
|
16
|
+
# config.mailer = 'Devise::Mailer'
|
17
|
+
|
18
|
+
# ==> ORM configuration
|
19
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
20
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
21
|
+
# available as additional gems.
|
22
|
+
require 'devise/orm/active_record'
|
23
|
+
|
24
|
+
# ==> Configuration for any authentication mechanism
|
25
|
+
# Configure which keys are used when authenticating a user. The default is
|
26
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
27
|
+
# authenticating a user, both parameters are required. Remember that those
|
28
|
+
# parameters are used only when authenticating and not when retrieving from
|
29
|
+
# session. If you need permissions, you should implement that in a before filter.
|
30
|
+
# You can also supply a hash where the value is a boolean determining whether
|
31
|
+
# or not authentication should be aborted when the value is not present.
|
32
|
+
# config.authentication_keys = [ :email ]
|
33
|
+
|
34
|
+
# Configure parameters from the request object used for authentication. Each entry
|
35
|
+
# given should be a request method and it will automatically be passed to the
|
36
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
37
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
38
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
39
|
+
# config.request_keys = []
|
40
|
+
|
41
|
+
# Configure which authentication keys should be case-insensitive.
|
42
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
43
|
+
# to authenticate or find a user. Default is :email.
|
44
|
+
config.case_insensitive_keys = [:email]
|
45
|
+
|
46
|
+
# Configure which authentication keys should have whitespace stripped.
|
47
|
+
# These keys will have whitespace before and after removed upon creating or
|
48
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
49
|
+
config.strip_whitespace_keys = [:email]
|
50
|
+
|
51
|
+
# Tell if authentication through request.params is enabled. True by default.
|
52
|
+
# It can be set to an array that will enable params authentication only for the
|
53
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
54
|
+
# enable it only for database (email + password) authentication.
|
55
|
+
# config.params_authenticatable = true
|
56
|
+
|
57
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
58
|
+
# It can be set to an array that will enable http authentication only for the
|
59
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
60
|
+
# enable it only for database authentication. The supported strategies are:
|
61
|
+
# :database = Support basic authentication with authentication key + password
|
62
|
+
# config.http_authenticatable = false
|
63
|
+
|
64
|
+
# If http headers should be returned for AJAX requests. True by default.
|
65
|
+
# config.http_authenticatable_on_xhr = true
|
66
|
+
|
67
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
68
|
+
# config.http_authentication_realm = 'Application'
|
69
|
+
|
70
|
+
# It will change confirmation, password recovery and other workflows
|
71
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
72
|
+
# Does not affect registerable.
|
73
|
+
# config.paranoid = true
|
74
|
+
|
75
|
+
# By default Devise will store the user in session. You can skip storage for
|
76
|
+
# particular strategies by setting this option.
|
77
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
78
|
+
# may want to disable generating routes to Devise's sessions controller by
|
79
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
80
|
+
config.skip_session_storage = [:http_auth]
|
81
|
+
|
82
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
83
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
84
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
85
|
+
# from the server. You can disable this option at your own risk.
|
86
|
+
# config.clean_up_csrf_token_on_authentication = true
|
87
|
+
|
88
|
+
# ==> Configuration for :database_authenticatable
|
89
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
90
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
91
|
+
#
|
92
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
93
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
94
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
95
|
+
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
96
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
97
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
98
|
+
|
99
|
+
# Setup a pepper to generate the encrypted password.
|
100
|
+
# config.pepper = 'e6d02ddbf80585a8af52521912c37e55609a1f1e51bc6588a6d042957816cb2553163b965560d1e72a5e558e6d398df37936519b877190649f601659869f9503'
|
101
|
+
|
102
|
+
# ==> Configuration for :confirmable
|
103
|
+
# A period that the user is allowed to access the website even without
|
104
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
105
|
+
# able to access the website for two days without confirming their account,
|
106
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
107
|
+
# the user cannot access the website without confirming their account.
|
108
|
+
# config.allow_unconfirmed_access_for = 2.days
|
109
|
+
|
110
|
+
# A period that the user is allowed to confirm their account before their
|
111
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
112
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
113
|
+
# their account can't be confirmed with the token any more.
|
114
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
115
|
+
# before confirming their account.
|
116
|
+
# config.confirm_within = 3.days
|
117
|
+
|
118
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
119
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
120
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
121
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
122
|
+
config.reconfirmable = true
|
123
|
+
|
124
|
+
# Defines which key will be used when confirming an account
|
125
|
+
# config.confirmation_keys = [ :email ]
|
126
|
+
|
127
|
+
# ==> Configuration for :rememberable
|
128
|
+
# The time the user will be remembered without asking for credentials again.
|
129
|
+
# config.remember_for = 2.weeks
|
130
|
+
|
131
|
+
# Invalidates all the remember me tokens when the user signs out.
|
132
|
+
config.expire_all_remember_me_on_sign_out = true
|
133
|
+
|
134
|
+
# If true, extends the user's remember period when remembered via cookie.
|
135
|
+
# config.extend_remember_period = false
|
136
|
+
|
137
|
+
# Options to be passed to the created cookie. For instance, you can set
|
138
|
+
# secure: true in order to force SSL only cookies.
|
139
|
+
# config.rememberable_options = {}
|
140
|
+
|
141
|
+
# ==> Configuration for :validatable
|
142
|
+
# Range for password length.
|
143
|
+
config.password_length = 8..128
|
144
|
+
|
145
|
+
# Email regex used to validate email formats. It simply asserts that
|
146
|
+
# one (and only one) @ exists in the given string. This is mainly
|
147
|
+
# to give user feedback and not to assert the e-mail validity.
|
148
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
149
|
+
|
150
|
+
# ==> Configuration for :timeoutable
|
151
|
+
# The time you want to timeout the user session without activity. After this
|
152
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
153
|
+
# config.timeout_in = 30.minutes
|
154
|
+
|
155
|
+
# If true, expires auth token on session timeout.
|
156
|
+
# config.expire_auth_token_on_timeout = false
|
157
|
+
|
158
|
+
# ==> Configuration for :lockable
|
159
|
+
# Defines which strategy will be used to lock an account.
|
160
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
161
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
162
|
+
# config.lock_strategy = :failed_attempts
|
163
|
+
|
164
|
+
# Defines which key will be used when locking and unlocking an account
|
165
|
+
# config.unlock_keys = [:email]
|
166
|
+
|
167
|
+
# Defines which strategy will be used to unlock an account.
|
168
|
+
# :email = Sends an unlock link to the user email
|
169
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
170
|
+
# :both = Enables both strategies
|
171
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
172
|
+
# config.unlock_strategy = :both
|
173
|
+
|
174
|
+
# Number of authentication tries before locking an account if lock_strategy
|
175
|
+
# is failed attempts.
|
176
|
+
# config.maximum_attempts = 20
|
177
|
+
|
178
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
179
|
+
# config.unlock_in = 1.hour
|
180
|
+
|
181
|
+
# Warn on the last attempt before the account is locked.
|
182
|
+
# config.last_attempt_warning = false
|
183
|
+
|
184
|
+
# ==> Configuration for :recoverable
|
185
|
+
#
|
186
|
+
# Defines which key will be used when recovering the password for an account
|
187
|
+
# config.reset_password_keys = [ :email ]
|
188
|
+
|
189
|
+
# Time interval you can reset your password with a reset password key.
|
190
|
+
# Don't put a too small interval or your users won't have the time to
|
191
|
+
# change their passwords.
|
192
|
+
config.reset_password_within = 6.hours
|
193
|
+
|
194
|
+
# ==> Configuration for :encryptable
|
195
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
196
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
197
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
198
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
199
|
+
# REST_AUTH_SITE_KEY to pepper).
|
200
|
+
#
|
201
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
202
|
+
# config.encryptor = :sha512
|
203
|
+
|
204
|
+
# ==> Scopes configuration
|
205
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
206
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
207
|
+
# are using only default views.
|
208
|
+
# config.scoped_views = false
|
209
|
+
|
210
|
+
# Configure the default scope given to Warden. By default it's the first
|
211
|
+
# devise role declared in your routes (usually :user).
|
212
|
+
# config.default_scope = :user
|
213
|
+
|
214
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
215
|
+
# only the current scope. By default, Devise signs out all scopes.
|
216
|
+
# config.sign_out_all_scopes = true
|
217
|
+
|
218
|
+
# ==> Navigation configuration
|
219
|
+
# Lists the formats that should be treated as navigational. Formats like
|
220
|
+
# :html, should redirect to the sign in page when the user does not have
|
221
|
+
# access, but formats like :xml or :json, should return 401.
|
222
|
+
#
|
223
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
224
|
+
# should add them to the navigational formats lists.
|
225
|
+
#
|
226
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
227
|
+
# config.navigational_formats = ['*/*', :html]
|
228
|
+
|
229
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
230
|
+
config.sign_out_via = :delete
|
231
|
+
|
232
|
+
# ==> OmniAuth
|
233
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
234
|
+
# up on your models and hooks.
|
235
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
236
|
+
|
237
|
+
# ==> Warden configuration
|
238
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
239
|
+
# change the failure app, you can configure them inside the config.warden block.
|
240
|
+
#
|
241
|
+
# config.warden do |manager|
|
242
|
+
# manager.intercept_401 = false
|
243
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
244
|
+
# end
|
245
|
+
|
246
|
+
# ==> Mountable engine configurations
|
247
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
248
|
+
# is mountable, there are some extra configurations to be taken into account.
|
249
|
+
# The following options are available, assuming the engine is mounted as:
|
250
|
+
#
|
251
|
+
# mount MyEngine, at: '/my_engine'
|
252
|
+
#
|
253
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
254
|
+
# config.router_name = :my_engine
|
255
|
+
#
|
256
|
+
# When using omniauth, Devise cannot automatically set Omniauth path,
|
257
|
+
# so you need to do it manually. For the users scope, it would be:
|
258
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
259
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
OmniAuth.config.logger = Rails.logger
|
2
|
+
|
3
|
+
config = YAML.load(File.read(File.join(Rails.root, "config", "family_gallery.yml")))
|
4
|
+
|
5
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
6
|
+
provider :facebook, config["facebook"]["app_id"], config["facebook"]["app_secret"]
|
7
|
+
end
|