elabs 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.eslintrc.yml +26 -0
- data/.gitignore +49 -0
- data/.gitlab-ci.yml +93 -0
- data/.haml-lint.yml +4 -0
- data/.node-version +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +59 -0
- data/.ruby-version +1 -0
- data/.simplecov +5 -0
- data/.stylelintrc.yml +218 -0
- data/CHANGELOG.md +273 -0
- data/CODE_OF_CONDUCT.md +78 -0
- data/Gemfile +75 -0
- data/Gemfile.lock +376 -0
- data/LICENSE +21 -0
- data/LICENSES.md +6 -0
- data/README.md +41 -0
- data/ROADMAP.md +61 -0
- data/Rakefile +32 -0
- data/app/assets/config/elabs_manifest.js +3 -0
- data/app/assets/images/elabs/preview_placeholder.png +0 -0
- data/app/assets/images/elabs/preview_placeholder_nsfw.png +0 -0
- data/app/assets/javascripts/elabs/application.js +27 -0
- data/app/assets/javascripts/elabs/helpers-codemirror.js +29 -0
- data/app/assets/javascripts/elabs/helpers-markdown.js +42 -0
- data/app/assets/javascripts/elabs/helpers.js +17 -0
- data/app/assets/javascripts/elabs/modals.js +19 -0
- data/app/assets/javascripts/elabs/tabs.js +32 -0
- data/app/assets/stylesheets/elabs/_colors.scss +345 -0
- data/app/assets/stylesheets/elabs/_icons.scss +9 -0
- data/app/assets/stylesheets/elabs/_variables.scss +13 -0
- data/app/assets/stylesheets/elabs/app/_acts.scss +58 -0
- data/app/assets/stylesheets/elabs/app/_alerts.scss +3 -0
- data/app/assets/stylesheets/elabs/app/_buttons.scss +21 -0
- data/app/assets/stylesheets/elabs/app/_comments.scss +1 -0
- data/app/assets/stylesheets/elabs/app/_content.scss +10 -0
- data/app/assets/stylesheets/elabs/app/_content_uploads.scss +39 -0
- data/app/assets/stylesheets/elabs/app/_empty.scss +19 -0
- data/app/assets/stylesheets/elabs/app/_errors.scss +9 -0
- data/app/assets/stylesheets/elabs/app/_filter_links.scss +27 -0
- data/app/assets/stylesheets/elabs/app/_forms.scss +69 -0
- data/app/assets/stylesheets/elabs/app/_helpers.scss +3 -0
- data/app/assets/stylesheets/elabs/app/_languages.scss +6 -0
- data/app/assets/stylesheets/elabs/app/_layout.scss +194 -0
- data/app/assets/stylesheets/elabs/app/_licenses.scss +6 -0
- data/app/assets/stylesheets/elabs/app/_link-to-top.scss +8 -0
- data/app/assets/stylesheets/elabs/app/_medias.scss +12 -0
- data/app/assets/stylesheets/elabs/app/_modals.scss +53 -0
- data/app/assets/stylesheets/elabs/app/_nsfw.scss +5 -0
- data/app/assets/stylesheets/elabs/app/_pagination.scss +16 -0
- data/app/assets/stylesheets/elabs/app/_tabs.scss +54 -0
- data/app/assets/stylesheets/elabs/app/_tags.scss +6 -0
- data/app/assets/stylesheets/elabs/app/_toolbars.scss +3 -0
- data/app/assets/stylesheets/elabs/app/_users.scss +6 -0
- data/app/assets/stylesheets/elabs/app/admin-members/_forms.scss +6 -0
- data/app/assets/stylesheets/elabs/app/admin-members/_indexes.scss +70 -0
- data/app/assets/stylesheets/elabs/app/admin-members/_layout.scss +17 -0
- data/app/assets/stylesheets/elabs/app/areas/_devise.scss +31 -0
- data/app/assets/stylesheets/elabs/app/components/_cards.scss +16 -0
- data/app/assets/stylesheets/elabs/app/components/_container.scss +4 -0
- data/app/assets/stylesheets/elabs/app/mixins/_classifier-card.scss +16 -0
- data/app/assets/stylesheets/elabs/app/mixins/_content-card.scss +58 -0
- data/app/assets/stylesheets/elabs/app/mixins/_content-full.scss +39 -0
- data/app/assets/stylesheets/elabs/app/mixins/_icon.scss +9 -0
- data/app/assets/stylesheets/elabs/application.css +14 -0
- data/app/assets/stylesheets/elabs/lib/_codemirror.scss +26 -0
- data/app/assets/stylesheets/elabs/lib/fontawesome/_fontawesome.scss +38 -0
- data/app/assets/stylesheets/elabs/lib/fontawesome/_fonts.scss +42 -0
- data/app/assets/stylesheets/elabs/lib/fontawesome/_icons.scss +1118 -0
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss-variables.scss +230 -0
- data/app/assets/stylesheets/elabs/lib/knacss/_knacss.scss +59 -0
- data/app/assets/stylesheets/elabs/style.scss +72 -0
- data/app/controllers/elabs/acts_controller.rb +12 -0
- data/app/controllers/elabs/admin/admin_application_controller.rb +19 -0
- data/app/controllers/elabs/admin/admin_content_application_controller.rb +66 -0
- data/app/controllers/elabs/admin/albums_controller.rb +10 -0
- data/app/controllers/elabs/admin/articles_controller.rb +10 -0
- data/app/controllers/elabs/admin/languages_controller.rb +77 -0
- data/app/controllers/elabs/admin/licenses_controller.rb +77 -0
- data/app/controllers/elabs/admin/notes_controller.rb +10 -0
- data/app/controllers/elabs/admin/projects_controller.rb +10 -0
- data/app/controllers/elabs/admin/reports_controller.rb +34 -0
- data/app/controllers/elabs/admin/tags_controller.rb +56 -0
- data/app/controllers/elabs/admin/uploads_controller.rb +10 -0
- data/app/controllers/elabs/admin/users_controller.rb +43 -0
- data/app/controllers/elabs/albums_controller.rb +26 -0
- data/app/controllers/elabs/articles_controller.rb +25 -0
- data/app/controllers/elabs/auth/callbacks_controller.rb +38 -0
- data/app/controllers/elabs/auth/confirmations_controller.rb +43 -0
- data/app/controllers/elabs/auth/passwords_controller.rb +47 -0
- data/app/controllers/elabs/auth/registrations_controller.rb +70 -0
- data/app/controllers/elabs/auth/sessions_controller.rb +36 -0
- data/app/controllers/elabs/auth/unlocks_controller.rb +38 -0
- data/app/controllers/elabs/concerns/elabs_controller.rb +18 -0
- data/app/controllers/elabs/concerns/localizable.rb +11 -0
- data/app/controllers/elabs/concerns/reportable.rb +17 -0
- data/app/controllers/elabs/content_application_controller.rb +45 -0
- data/app/controllers/elabs/elabs_application_controller.rb +95 -0
- data/app/controllers/elabs/languages_controller.rb +36 -0
- data/app/controllers/elabs/licenses_controller.rb +31 -0
- data/app/controllers/elabs/member/albums_controller.rb +11 -0
- data/app/controllers/elabs/member/articles_controller.rb +11 -0
- data/app/controllers/elabs/member/member_application_controller.rb +12 -0
- data/app/controllers/elabs/member/member_content_application_controller.rb +128 -0
- data/app/controllers/elabs/member/notes_controller.rb +11 -0
- data/app/controllers/elabs/member/preferences_controller.rb +36 -0
- data/app/controllers/elabs/member/projects_controller.rb +11 -0
- data/app/controllers/elabs/member/uploads_controller.rb +11 -0
- data/app/controllers/elabs/member/users_controller.rb +28 -0
- data/app/controllers/elabs/notes_controller.rb +25 -0
- data/app/controllers/elabs/projects_controller.rb +30 -0
- data/app/controllers/elabs/reports_controller.rb +36 -0
- data/app/controllers/elabs/tags_controller.rb +36 -0
- data/app/controllers/elabs/uploads_controller.rb +24 -0
- data/app/controllers/elabs/users_controller.rb +36 -0
- data/app/helpers/elabs/acts_helper.rb +22 -0
- data/app/helpers/elabs/admin_content_helper.rb +54 -0
- data/app/helpers/elabs/application_helper.rb +54 -0
- data/app/helpers/elabs/content_filters_helper.rb +97 -0
- data/app/helpers/elabs/content_renderer_helper.rb +13 -0
- data/app/helpers/elabs/member_content_helper.rb +47 -0
- data/app/helpers/elabs/thumbnails_helper.rb +28 -0
- data/app/helpers/elabs/time_helper.rb +19 -0
- data/app/helpers/elabs/uploads_helper.rb +19 -0
- data/app/jobs/elabs/application_job.rb +4 -0
- data/app/mailers/elabs/application_mailer.rb +6 -0
- data/app/models/elabs/act.rb +7 -0
- data/app/models/elabs/album.rb +24 -0
- data/app/models/elabs/albums_tag.rb +21 -0
- data/app/models/elabs/albums_upload.rb +21 -0
- data/app/models/elabs/application_content_record.rb +10 -0
- data/app/models/elabs/application_record.rb +5 -0
- data/app/models/elabs/article.rb +23 -0
- data/app/models/elabs/articles_tag.rb +21 -0
- data/app/models/elabs/comment.rb +12 -0
- data/app/models/elabs/concerns/actable_entity.rb +52 -0
- data/app/models/elabs/concerns/content_entity.rb +70 -0
- data/app/models/elabs/concerns/countable_entity.rb +81 -0
- data/app/models/elabs/concerns/taggable.rb +33 -0
- data/app/models/elabs/language.rb +17 -0
- data/app/models/elabs/license.rb +15 -0
- data/app/models/elabs/note.rb +21 -0
- data/app/models/elabs/notes_tag.rb +21 -0
- data/app/models/elabs/preference.rb +9 -0
- data/app/models/elabs/project.rb +25 -0
- data/app/models/elabs/projects_album.rb +21 -0
- data/app/models/elabs/projects_article.rb +21 -0
- data/app/models/elabs/projects_note.rb +21 -0
- data/app/models/elabs/projects_tag.rb +21 -0
- data/app/models/elabs/projects_upload.rb +21 -0
- data/app/models/elabs/report.rb +11 -0
- data/app/models/elabs/tag.rb +18 -0
- data/app/models/elabs/upload.rb +28 -0
- data/app/models/elabs/uploads_tag.rb +21 -0
- data/app/models/elabs/user.rb +30 -0
- data/app/validators/elabs/associated_author_validator.rb +11 -0
- data/app/views/elabs/acts/_act.json.jbuilder +2 -0
- data/app/views/elabs/acts/_filters.html.haml +3 -0
- data/app/views/elabs/acts/index.html.haml +27 -0
- data/app/views/elabs/acts/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/albums/_album.json.jbuilder +2 -0
- data/app/views/elabs/admin/albums/index.html.haml +43 -0
- data/app/views/elabs/admin/albums/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/articles/_article.json.jbuilder +2 -0
- data/app/views/elabs/admin/articles/index.html.haml +41 -0
- data/app/views/elabs/admin/articles/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/languages/_form.html.haml +18 -0
- data/app/views/elabs/admin/languages/_language.json.jbuilder +2 -0
- data/app/views/elabs/admin/languages/edit.html.haml +6 -0
- data/app/views/elabs/admin/languages/index.html.haml +34 -0
- data/app/views/elabs/admin/languages/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/languages/new.html.haml +3 -0
- data/app/views/elabs/admin/licenses/_form.html.haml +25 -0
- data/app/views/elabs/admin/licenses/_license.json.jbuilder +2 -0
- data/app/views/elabs/admin/licenses/edit.html.haml +6 -0
- data/app/views/elabs/admin/licenses/index.html.haml +42 -0
- data/app/views/elabs/admin/licenses/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/licenses/new.html.haml +3 -0
- data/app/views/elabs/admin/notes/_note.json.jbuilder +2 -0
- data/app/views/elabs/admin/notes/index.html.haml +40 -0
- data/app/views/elabs/admin/notes/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/projects/_project.json.jbuilder +2 -0
- data/app/views/elabs/admin/projects/index.html.haml +45 -0
- data/app/views/elabs/admin/projects/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/reports/index.html.haml +27 -0
- data/app/views/elabs/admin/reports/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/tags/_form.html.haml +17 -0
- data/app/views/elabs/admin/tags/_tag.json.jbuilder +2 -0
- data/app/views/elabs/admin/tags/edit.html.haml +6 -0
- data/app/views/elabs/admin/tags/index.html.haml +27 -0
- data/app/views/elabs/admin/tags/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/uploads/_upload.json.jbuilder +2 -0
- data/app/views/elabs/admin/uploads/index.html.haml +45 -0
- data/app/views/elabs/admin/uploads/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/users/_admin_user.json.jbuilder +2 -0
- data/app/views/elabs/admin/users/index.html.haml +33 -0
- data/app/views/elabs/admin/users/index.json.jbuilder +1 -0
- data/app/views/elabs/admin/users/show.html.haml +26 -0
- data/app/views/elabs/admin/users/show.json.jbuilder +1 -0
- data/app/views/elabs/albums/_album.html.haml +38 -0
- data/app/views/elabs/albums/_album.json.jbuilder +2 -0
- data/app/views/elabs/albums/_filters.html.haml +8 -0
- data/app/views/elabs/albums/index.html.haml +9 -0
- data/app/views/elabs/albums/index.json.jbuilder +1 -0
- data/app/views/elabs/albums/show.html.haml +60 -0
- data/app/views/elabs/albums/show.json.jbuilder +1 -0
- data/app/views/elabs/articles/_article.html.haml +30 -0
- data/app/views/elabs/articles/_article.json.jbuilder +2 -0
- data/app/views/elabs/articles/_filters.html.haml +8 -0
- data/app/views/elabs/articles/index.html.haml +9 -0
- data/app/views/elabs/articles/index.json.jbuilder +1 -0
- data/app/views/elabs/articles/show.html.haml +45 -0
- data/app/views/elabs/articles/show.json.jbuilder +1 -0
- data/app/views/elabs/auth/confirmations/new.html.haml +26 -0
- data/app/views/elabs/auth/passwords/edit.html.haml +31 -0
- data/app/views/elabs/auth/passwords/new.html.haml +23 -0
- data/app/views/elabs/auth/registrations/edit.html.haml +48 -0
- data/app/views/elabs/auth/registrations/new.html.haml +34 -0
- data/app/views/elabs/auth/sessions/_new.html.haml +15 -0
- data/app/views/elabs/auth/sessions/new.html.haml +8 -0
- data/app/views/elabs/auth/shared/_links.html.haml +16 -0
- data/app/views/elabs/auth/unlocks/new.html.haml +23 -0
- data/app/views/elabs/comments/_comment.json.jbuilder +2 -0
- data/app/views/elabs/comments/_comments.html.haml +21 -0
- data/app/views/elabs/comments/_form.html.haml +31 -0
- data/app/views/elabs/languages/_associations.html.haml +51 -0
- data/app/views/elabs/languages/_filters.html.haml +6 -0
- data/app/views/elabs/languages/_language.json.jbuilder +2 -0
- data/app/views/elabs/languages/index.html.haml +33 -0
- data/app/views/elabs/languages/index.json.jbuilder +1 -0
- data/app/views/elabs/languages/show.html.haml +38 -0
- data/app/views/elabs/languages/show.json.jbuilder +1 -0
- data/app/views/elabs/layouts/_empty.html.haml +3 -0
- data/app/views/elabs/layouts/_footer.html.haml +6 -0
- data/app/views/elabs/layouts/_hidden_entry.html.haml +6 -0
- data/app/views/elabs/layouts/_hidden_entry_full.html.haml +6 -0
- data/app/views/elabs/layouts/_language_menu.html.haml +2 -0
- data/app/views/elabs/layouts/_menu.html.haml +72 -0
- data/app/views/elabs/layouts/admin_application.html.haml +21 -0
- data/app/views/elabs/layouts/application.html.haml +37 -0
- data/app/views/elabs/layouts/lists/_albums.html.haml +10 -0
- data/app/views/elabs/layouts/lists/_projects.html.haml +10 -0
- data/app/views/elabs/layouts/lists/_tags.html.haml +9 -0
- data/app/views/elabs/layouts/mailer.html.haml +8 -0
- data/app/views/elabs/layouts/mailer.text.haml +1 -0
- data/app/views/elabs/layouts/member_application.html.haml +21 -0
- data/app/views/elabs/licenses/_associations.html.haml +51 -0
- data/app/views/elabs/licenses/_filters.html.haml +3 -0
- data/app/views/elabs/licenses/_license.json.jbuilder +2 -0
- data/app/views/elabs/licenses/index.html.haml +27 -0
- data/app/views/elabs/licenses/index.json.jbuilder +1 -0
- data/app/views/elabs/licenses/show.html.haml +44 -0
- data/app/views/elabs/licenses/show.json.jbuilder +1 -0
- data/app/views/elabs/member/albums/_album.json.jbuilder +2 -0
- data/app/views/elabs/member/albums/_form.html.haml +64 -0
- data/app/views/elabs/member/albums/edit.html.haml +6 -0
- data/app/views/elabs/member/albums/index.html.haml +49 -0
- data/app/views/elabs/member/albums/index.json.jbuilder +1 -0
- data/app/views/elabs/member/albums/new.html.haml +3 -0
- data/app/views/elabs/member/articles/_article.json.jbuilder +2 -0
- data/app/views/elabs/member/articles/_form.html.haml +70 -0
- data/app/views/elabs/member/articles/edit.html.haml +6 -0
- data/app/views/elabs/member/articles/index.html.haml +47 -0
- data/app/views/elabs/member/articles/index.json.jbuilder +1 -0
- data/app/views/elabs/member/articles/new.html.haml +3 -0
- data/app/views/elabs/member/layouts/_empty.html.haml +4 -0
- data/app/views/elabs/member/layouts/_markdown-preview.html.haml +8 -0
- data/app/views/elabs/member/notes/_form.html.haml +54 -0
- data/app/views/elabs/member/notes/_note.json.jbuilder +2 -0
- data/app/views/elabs/member/notes/edit.html.haml +6 -0
- data/app/views/elabs/member/notes/index.html.haml +47 -0
- data/app/views/elabs/member/notes/index.json.jbuilder +1 -0
- data/app/views/elabs/member/notes/new.html.haml +3 -0
- data/app/views/elabs/member/preferences/_form.html.haml +20 -0
- data/app/views/elabs/member/preferences/edit.html.haml +3 -0
- data/app/views/elabs/member/projects/_form.html.haml +71 -0
- data/app/views/elabs/member/projects/_project.json.jbuilder +2 -0
- data/app/views/elabs/member/projects/edit.html.haml +6 -0
- data/app/views/elabs/member/projects/index.html.haml +53 -0
- data/app/views/elabs/member/projects/index.json.jbuilder +1 -0
- data/app/views/elabs/member/projects/new.html.haml +3 -0
- data/app/views/elabs/member/uploads/_form.html.haml +67 -0
- data/app/views/elabs/member/uploads/_upload.json.jbuilder +2 -0
- data/app/views/elabs/member/uploads/edit.html.haml +6 -0
- data/app/views/elabs/member/uploads/index.html.haml +61 -0
- data/app/views/elabs/member/uploads/index.json.jbuilder +1 -0
- data/app/views/elabs/member/uploads/new.html.haml +3 -0
- data/app/views/elabs/member/users/_form.html.haml +38 -0
- data/app/views/elabs/notes/_filters.html.haml +7 -0
- data/app/views/elabs/notes/_note.html.haml +31 -0
- data/app/views/elabs/notes/_note.json.jbuilder +2 -0
- data/app/views/elabs/notes/index.html.haml +9 -0
- data/app/views/elabs/notes/index.json.jbuilder +1 -0
- data/app/views/elabs/notes/show.html.haml +44 -0
- data/app/views/elabs/notes/show.json.jbuilder +1 -0
- data/app/views/elabs/projects/_associations.html.haml +46 -0
- data/app/views/elabs/projects/_filters.html.haml +8 -0
- data/app/views/elabs/projects/_project.html.haml +29 -0
- data/app/views/elabs/projects/index.html.haml +9 -0
- data/app/views/elabs/projects/index.json.jbuilder +1 -0
- data/app/views/elabs/projects/show.html.haml +71 -0
- data/app/views/elabs/projects/show.json.jbuilder +1 -0
- data/app/views/elabs/reports/_form.html.haml +29 -0
- data/app/views/elabs/tags/_associations.html.haml +51 -0
- data/app/views/elabs/tags/_filters.html.haml +3 -0
- data/app/views/elabs/tags/_tag.json.jbuilder +2 -0
- data/app/views/elabs/tags/index.html.haml +26 -0
- data/app/views/elabs/tags/index.json.jbuilder +1 -0
- data/app/views/elabs/tags/show.html.haml +34 -0
- data/app/views/elabs/tags/show.json.jbuilder +1 -0
- data/app/views/elabs/uploads/_filters.html.haml +7 -0
- data/app/views/elabs/uploads/_player.html.haml +10 -0
- data/app/views/elabs/uploads/_preview.html.haml +17 -0
- data/app/views/elabs/uploads/_upload.html.haml +41 -0
- data/app/views/elabs/uploads/_upload.json.jbuilder +2 -0
- data/app/views/elabs/uploads/index.html.haml +9 -0
- data/app/views/elabs/uploads/index.json.jbuilder +1 -0
- data/app/views/elabs/uploads/show.html.haml +58 -0
- data/app/views/elabs/uploads/show.json.jbuilder +1 -0
- data/app/views/elabs/users/_associations.html.haml +51 -0
- data/app/views/elabs/users/_filters.html.haml +4 -0
- data/app/views/elabs/users/_user.html.haml +31 -0
- data/app/views/elabs/users/_user.json.jbuilder +2 -0
- data/app/views/elabs/users/index.html.haml +7 -0
- data/app/views/elabs/users/index.json.jbuilder +1 -0
- data/app/views/elabs/users/show.html.haml +48 -0
- data/app/views/elabs/users/show.json.jbuilder +1 -0
- data/bin/rails +14 -0
- data/config.ru +5 -0
- data/config/brakeman.ignore +124 -0
- data/config/brakeman.yml +3 -0
- data/config/cucumber.yml +9 -0
- data/config/routes.rb +116 -0
- data/db/migrate/20180813000000_devise_update_users.rb +15 -0
- data/db/migrate/20180813000001_create_languages.rb +16 -0
- data/db/migrate/20180813000002_create_tags.rb +14 -0
- data/db/migrate/20180813000004_create_licenses.rb +17 -0
- data/db/migrate/20180813000005_create_reports.rb +15 -0
- data/db/migrate/20180813000006_create_comments.rb +15 -0
- data/db/migrate/20180813000007_create_acts.rb +10 -0
- data/db/migrate/20180813000008_create_preferences.rb +13 -0
- data/db/migrate/20180813000009_create_active_storage_tables.active_storage.rb +26 -0
- data/db/migrate/20180813000010_create_albums.rb +23 -0
- data/db/migrate/20180813000011_create_articles.rb +23 -0
- data/db/migrate/20180813000012_create_notes.rb +21 -0
- data/db/migrate/20180813000013_create_uploads.rb +26 -0
- data/db/migrate/20180813000014_create_projects.rb +44 -0
- data/db/seeds.rb +10 -0
- data/db/seeds_development.rb +21 -0
- data/db/seeds_production.rb +0 -0
- data/docs/contributing.md +52 -0
- data/docs/cucumber_terms.md +9 -0
- data/docs/migrating.md +4 -0
- data/docs/overriding.md +20 -0
- data/docs/setup.md +136 -0
- data/docs/tips.md +13 -0
- data/elabs.gemspec +25 -0
- data/lib/assets/javascripts/README-highlight.js.md +39 -0
- data/lib/assets/javascripts/codemirror-5.39.2/addon/mode/overlay.js +90 -0
- data/lib/assets/javascripts/codemirror-5.39.2/lib/codemirror.js +9684 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/clike/clike.js +834 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/css/css.js +832 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/gfm/gfm.js +129 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/htmlmixed/htmlmixed.js +152 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/javascript/javascript.js +896 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/markdown/markdown.js +882 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/meta.js +217 -0
- data/lib/assets/javascripts/codemirror-5.39.2/mode/xml/xml.js +402 -0
- data/lib/assets/javascripts/highlight.js-9.12.0/highlight.pack.js +2 -0
- data/lib/assets/javascripts/markdown-it-8.4.2.min.js +1 -0
- data/lib/assets/stylesheets/codemirror-5.39.2/lib/codemirror.css +346 -0
- data/lib/assets/stylesheets/codemirror-5.39.2/theme/base16-dark.css +38 -0
- data/lib/assets/stylesheets/codemirror-5.39.2/theme/base16-light.css +38 -0
- data/lib/assets/stylesheets/highlight.js-9.12.0/styles/atelier-sulphurpool-light.css +69 -0
- data/lib/elabs.rb +41 -0
- data/lib/elabs/engine.rb +5 -0
- data/lib/elabs/version.rb +3 -0
- data/lib/generators/elabs/assets_generator.rb +36 -0
- data/lib/generators/elabs/devise_views_generator.rb +24 -0
- data/lib/generators/elabs/install_generator.rb +26 -0
- data/lib/generators/elabs/required_assets_generator.rb +26 -0
- data/lib/generators/elabs/views_generator.rb +25 -0
- data/lib/generators/templates/elabs.rb +25 -0
- data/lib/generators/templates/fast_gettext.rb +3 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/cucumber.rake +75 -0
- data/lib/tasks/elabs_tasks.rake +4 -0
- data/lib/tasks/factory_bot.rake +14 -0
- data/lib/tasks/wipe.rake +31 -0
- data/locale/app.pot +1124 -0
- data/locale/devise_strings.rb +88 -0
- data/locale/en/app.edit.po +1123 -0
- data/locale/en/app.po +1123 -0
- data/locale/en/app.po.time_stamp +0 -0
- data/locale/fr/app.edit.po +1126 -0
- data/locale/fr/app.po +1125 -0
- data/locale/fr/app.po.time_stamp +0 -0
- data/locale/model_attributes.rb +85 -0
- data/package.json +22 -0
- data/script/cucumber +10 -0
- data/tmp/pids/.keep +0 -0
- data/yarn.lock +2759 -0
- metadata +463 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateLanguages < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :languages do |t|
|
4
|
+
t.string :iso639_1, size: 2, default: nil, null: false
|
5
|
+
t.string :name, size: 45, default: nil, null: false
|
6
|
+
t.integer :albums_count, default: 0, null: false
|
7
|
+
t.integer :articles_count, default: 0, null: false
|
8
|
+
t.integer :notes_count, default: 0, null: false
|
9
|
+
t.integer :projects_count, default: 0, null: false
|
10
|
+
t.integer :uploads_count, default: 0, null: false
|
11
|
+
|
12
|
+
t.index :iso639_1, unique: true
|
13
|
+
t.index :name, unique: true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateTags < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :tags do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.integer :albums_count, default: 0, null: false
|
6
|
+
t.integer :articles_count, default: 0, null: false
|
7
|
+
t.integer :notes_count, default: 0, null: false
|
8
|
+
t.integer :projects_count, default: 0, null: false
|
9
|
+
t.integer :uploads_count, default: 0, null: false
|
10
|
+
|
11
|
+
t.index :name, unique: true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateLicenses < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :licenses do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.string :url, null: false
|
6
|
+
t.string :tldr_url, null: true
|
7
|
+
t.string :icon, null: false
|
8
|
+
t.integer :albums_count, default: 0, null: false
|
9
|
+
t.integer :articles_count, default: 0, null: false
|
10
|
+
t.integer :notes_count, default: 0, null: false
|
11
|
+
t.integer :projects_count, default: 0, null: false
|
12
|
+
t.integer :uploads_count, default: 0, null: false
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateReports < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :reports do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :email
|
6
|
+
t.string :url, null: false, default: nil
|
7
|
+
t.text :reason, null: false, default: nil
|
8
|
+
t.boolean :allow_contact
|
9
|
+
|
10
|
+
t.references :user, foreign_key: true
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateComments < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :comments do |t|
|
4
|
+
t.references :content, polymorphic: true
|
5
|
+
t.string :name
|
6
|
+
t.string :email
|
7
|
+
t.text :comment
|
8
|
+
t.boolean :allow_contact
|
9
|
+
t.references :user, foreign_key: true
|
10
|
+
t.boolean :deleted
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreatePreferences < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :preferences do |t|
|
4
|
+
t.references :user, foreign_key: true
|
5
|
+
t.boolean :show_nsfw, null: false, default: false
|
6
|
+
t.string :locale, null: true, default: nil
|
7
|
+
end
|
8
|
+
|
9
|
+
Elabs::User.all.each do |user|
|
10
|
+
Preference.create! user: user, show_nsfw: false
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This migration comes from active_storage (originally 20170806125915)
|
2
|
+
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
3
|
+
def change
|
4
|
+
create_table :active_storage_blobs do |t|
|
5
|
+
t.string :key, null: false
|
6
|
+
t.string :filename, null: false
|
7
|
+
t.string :content_type
|
8
|
+
t.text :metadata
|
9
|
+
t.bigint :byte_size, null: false
|
10
|
+
t.string :checksum, null: false
|
11
|
+
t.datetime :created_at, null: false
|
12
|
+
|
13
|
+
t.index [:key], unique: true
|
14
|
+
end
|
15
|
+
|
16
|
+
create_table :active_storage_attachments do |t|
|
17
|
+
t.string :name, null: false
|
18
|
+
t.references :record, null: false, polymorphic: true, index: false
|
19
|
+
t.references :blob, null: false
|
20
|
+
|
21
|
+
t.datetime :created_at, null: false
|
22
|
+
|
23
|
+
t.index %i[record_type record_id name blob_id], name: 'index_active_storage_attachments_uniqueness', unique: true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateAlbums < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :albums do |t|
|
4
|
+
t.string :name, null: false, default: nil
|
5
|
+
t.text :description, null: false, default: nil
|
6
|
+
t.boolean :sfw, null: false, default: false
|
7
|
+
t.boolean :published, null: false, default: false
|
8
|
+
t.boolean :locked, null: false, default: false
|
9
|
+
t.boolean :hidden_in_history, null: false, default: false
|
10
|
+
t.integer :uploads_count, null: false, default: 0
|
11
|
+
|
12
|
+
t.references :user, foreign_key: true
|
13
|
+
t.references :license, foreign_key: true
|
14
|
+
t.references :language, foreign_key: true
|
15
|
+
|
16
|
+
t.datetime :published_at, null: true
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
create_join_table :albums, :tags
|
21
|
+
add_index :albums_tags, %i[album_id tag_id], unique: true
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateArticles < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :articles do |t|
|
4
|
+
t.string :title, null: false, default: nil
|
5
|
+
t.string :excerpt, null: false, default: nil
|
6
|
+
t.text :content, null: false, default: nil
|
7
|
+
t.boolean :sfw, null: false, default: false
|
8
|
+
t.boolean :published, null: false, default: false
|
9
|
+
t.boolean :locked, null: false, default: false
|
10
|
+
t.boolean :hidden_in_history, null: false, default: false
|
11
|
+
|
12
|
+
t.references :user, foreign_key: true
|
13
|
+
t.references :license, foreign_key: true
|
14
|
+
t.references :language, foreign_key: true
|
15
|
+
|
16
|
+
t.datetime :published_at, null: true
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
create_join_table :articles, :tags
|
21
|
+
add_index :articles_tags, %i[article_id tag_id], unique: true
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateNotes < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :notes do |t|
|
4
|
+
t.text :content, null: false, default: nil
|
5
|
+
t.boolean :sfw, null: false, default: false
|
6
|
+
t.boolean :published, null: false, default: false
|
7
|
+
t.boolean :locked, null: false, default: false
|
8
|
+
t.boolean :hidden_in_history, null: false, default: false
|
9
|
+
|
10
|
+
t.references :user, foreign_key: true
|
11
|
+
t.references :license, foreign_key: true
|
12
|
+
t.references :language, foreign_key: true
|
13
|
+
|
14
|
+
t.datetime :published_at, null: true
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
create_join_table :notes, :tags
|
19
|
+
add_index :notes_tags, %i[note_id tag_id], unique: true
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateUploads < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :uploads do |t|
|
4
|
+
t.string :title, null: false, default: nil
|
5
|
+
t.text :description, null: false, default: nil
|
6
|
+
t.boolean :sfw, null: false, default: false
|
7
|
+
t.boolean :published, null: false, default: false
|
8
|
+
t.boolean :locked, null: false, default: false
|
9
|
+
t.boolean :hidden_in_history, null: false, default: false
|
10
|
+
|
11
|
+
t.references :user, foreign_key: true
|
12
|
+
t.references :license, foreign_key: true
|
13
|
+
t.references :language, foreign_key: true
|
14
|
+
|
15
|
+
t.datetime :published_at, null: true
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
|
19
|
+
create_join_table :albums, :uploads
|
20
|
+
add_index :albums_uploads, %i[album_id upload_id], unique: true
|
21
|
+
|
22
|
+
create_join_table :uploads, :tags
|
23
|
+
rename_table :tags_uploads, :uploads_tags
|
24
|
+
add_index :uploads_tags, %i[upload_id tag_id], unique: true
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class CreateProjects < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :projects do |t|
|
4
|
+
t.string :name, null: false, default: nil
|
5
|
+
t.string :short_description, null: false, default: nil
|
6
|
+
t.text :description, null: false, default: nil
|
7
|
+
t.string :main_url
|
8
|
+
t.boolean :sfw, null: false, default: false
|
9
|
+
t.boolean :published, null: false, default: false
|
10
|
+
t.boolean :locked, null: false, default: false
|
11
|
+
t.boolean :hidden_in_history, null: false, default: false
|
12
|
+
|
13
|
+
t.integer :albums_count, null: false, default: 0
|
14
|
+
t.integer :articles_count, null: false, default: 0
|
15
|
+
t.integer :notes_count, null: false, default: 0
|
16
|
+
t.integer :uploads_count, null: false, default: 0
|
17
|
+
|
18
|
+
t.references :user, foreign_key: true
|
19
|
+
t.references :license, foreign_key: true
|
20
|
+
t.references :language, foreign_key: true
|
21
|
+
|
22
|
+
t.datetime :published_at, null: true
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
|
26
|
+
create_join_table :projects, :albums
|
27
|
+
rename_table :albums_projects, :projects_albums
|
28
|
+
add_index :projects_albums, %i[project_id album_id], unique: true
|
29
|
+
|
30
|
+
create_join_table :projects, :articles
|
31
|
+
rename_table :articles_projects, :projects_articles
|
32
|
+
add_index :projects_articles, %i[project_id article_id], unique: true
|
33
|
+
|
34
|
+
create_join_table :projects, :notes
|
35
|
+
rename_table :notes_projects, :projects_notes
|
36
|
+
add_index :projects_notes, %i[project_id note_id], unique: true
|
37
|
+
|
38
|
+
create_join_table :projects, :uploads
|
39
|
+
add_index :projects_uploads, %i[project_id upload_id], unique: true
|
40
|
+
|
41
|
+
create_join_table :projects, :tags
|
42
|
+
add_index :projects_tags, %i[project_id tag_id], unique: true
|
43
|
+
end
|
44
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
7
|
+
# Character.create(name: 'Luke', movie: movies.first)
|
8
|
+
puts "Seeding for #{Rails.env}"
|
9
|
+
require File.join(__dir__, 'seeds_production') if Rails.env.production?
|
10
|
+
require File.join(__dir__, 'seeds_development') if Rails.env.development?
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Users
|
2
|
+
user = FactoryBot.create :user_known_admin
|
3
|
+
|
4
|
+
# Languages
|
5
|
+
language = FactoryBot.create :language, iso639_1: 'fr', name: 'Français'
|
6
|
+
FactoryBot.create :language, iso639_1: 'en', name: 'English'
|
7
|
+
|
8
|
+
# Licenses
|
9
|
+
license = FactoryBot.create :license, name: 'Creative Commons by-nc-sa 4.0', url: 'https://creativecommons.org/licenses/by-nc-sa/4.0/', tldr_url: 'https://tldrlegal.com/license/creative-commons-attribution-noncommercial-sharealike-4.0-international-(cc-by-nc-sa-4.0)'
|
10
|
+
FactoryBot.create :license, name: 'GPL v2', url: 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html', tldr_url: 'https://tldrlegal.com/license/gnu-general-public-license-v2'
|
11
|
+
|
12
|
+
# Few tags
|
13
|
+
tag = FactoryBot.create :tag, name: 'Ruby'
|
14
|
+
|
15
|
+
default_relations = { user: user, language: language, license: license, tags: [tag] }
|
16
|
+
# Content
|
17
|
+
project = FactoryBot.create :project_published, default_relations.merge(name: 'My first project')
|
18
|
+
album = FactoryBot.create :album_published, default_relations.merge(name: 'My first album', projects: [project])
|
19
|
+
FactoryBot.create_list :article_published, 15, default_relations.merge(projects: [project])
|
20
|
+
FactoryBot.create_list :note_published, 15, default_relations.merge(projects: [project])
|
21
|
+
FactoryBot.create_list :upload_published, 15, default_relations.merge(projects: [project], albums: [album])
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# How to contribute ?
|
2
|
+
New ideas and contributions are more than welcome.
|
3
|
+
|
4
|
+
Read the [Code of conduct](../CODE_OF_CONDUCT.md) if you're unsure of
|
5
|
+
how you're doing things.
|
6
|
+
|
7
|
+
The issue tracker is on [gitlab](https://gitlab.com/experimentslabs/engine_elabs/issues). Feel free to open issues here.
|
8
|
+
|
9
|
+
## Translations
|
10
|
+
Translations are made with Gettext, and are located in `/locale`. If you
|
11
|
+
want to create a new translation, execute
|
12
|
+
`LANGUAGE=[XX] rake app:gettext:add_language` and edit the new files. You
|
13
|
+
can use tools like `poedit`, `virtaal` or `Qt 5 Linguist` to help you in the process.
|
14
|
+
|
15
|
+
If you create a new model, use `rake gettext:store_model_attributes` to
|
16
|
+
update the list of model attributes names.
|
17
|
+
|
18
|
+
Use `rake gettext:find` to update the `.po` files
|
19
|
+
|
20
|
+
Rake tasks:
|
21
|
+
```
|
22
|
+
rake app:gettext:add_language[language] # add a new language
|
23
|
+
rake app:gettext:find # Update pot/po files
|
24
|
+
rake app:gettext:pack # Create mo-files
|
25
|
+
rake app:gettext:store_model_attributes # write the model attributes to <locale_path>/model_attributes.rb
|
26
|
+
```
|
27
|
+
|
28
|
+
## Git workflow and code submission
|
29
|
+
- Branches `master` and `develop` are _fast-forward_ only.
|
30
|
+
- Make all the MR against `develop` or a release branch if it exists.
|
31
|
+
- Every MR should pass the test suite.
|
32
|
+
|
33
|
+
## Testing
|
34
|
+
This project uses various tools to enforce code consistency and to run tests:
|
35
|
+
|
36
|
+
- [Rubocop](http://batsov.com/rubocop/) to check the code style. Run
|
37
|
+
`bundle exec rubocop` or `bundle exec rubocop -a` to fix some errors
|
38
|
+
automatically.
|
39
|
+
- [Brakeman](https://brakemanscanner.org/), to check the code against
|
40
|
+
known vulnerabilities and possible security issues. You can launch
|
41
|
+
it locally with `bundle exec brakeman`.
|
42
|
+
- [RSpec](http://rspec.org/) for unit test. You can launch it locally
|
43
|
+
with `bundle exec rspec`.
|
44
|
+
- [Cucumber](https://cucumber.io/) for integration tests. Run
|
45
|
+
`bundle exec cucumber` locally to test the code.
|
46
|
+
- [Eslint](https://eslint.org/) for JS code style. Launch
|
47
|
+
`yarn run lint:js` or `yarn run lint:js-fix` to check locally. It's
|
48
|
+
not perfect, but it helps.
|
49
|
+
- [StyleLint](http://stylelint.io/) for SCSS code style. Run
|
50
|
+
`yarn run lint:sass` or `yarn run lint:sass-fix` locally.
|
51
|
+
- [Haml-lint](https://github.com/brigade/haml-lint) for views
|
52
|
+
consistency. Run `bundle exec haml-lint`.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Feature terms
|
2
|
+
This document lists the different terms used in the features for clarity and reference.
|
3
|
+
|
4
|
+
User-related terms
|
5
|
+
- user: someone visiting the website, registered or not
|
6
|
+
- visitor: unregistered user
|
7
|
+
- member: registered user
|
8
|
+
- maintainer: website owner
|
9
|
+
- administrator: a member with admin rights
|
data/docs/migrating.md
ADDED
data/docs/overriding.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Overriding Elabs engine
|
2
|
+
|
3
|
+
## Views
|
4
|
+
To override views, run `rails g elabs:views` and
|
5
|
+
`rails g elabs:devise_views`. This will copy all the views in
|
6
|
+
`app/views/elabs`. You will be able to edit them.
|
7
|
+
|
8
|
+
If you want to override the style but keep the views, you can run
|
9
|
+
`rails g elabs:assets`. This will copy CSS and JS files in
|
10
|
+
`app/assets/javascripts/elabs` and `app/assets/stylesheets/elabs`.
|
11
|
+
You will need the [Knacss](https://www.knacss.com) framework and other
|
12
|
+
things from node modules. Install them with yarn (`package.json` should
|
13
|
+
have been copied during the [installation](setup.md).
|
14
|
+
|
15
|
+
## Models, controllers
|
16
|
+
Sadly, we have not tested those parts for now. It would require some work
|
17
|
+
to complete the initializer to be able to use custom models; and a work
|
18
|
+
on the routes system, to only include the routes you need.
|
19
|
+
|
20
|
+
Contributions are welcome.
|
data/docs/setup.md
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
# Installation
|
2
|
+
|
3
|
+
## Pre-requisites
|
4
|
+
|
5
|
+
- ruby 2.5
|
6
|
+
- PostgreSQL (not tested with Mysql, not usable with sqlite in the
|
7
|
+
current state)
|
8
|
+
- NodeJS 8 and Yarn **if** you want to use the default views
|
9
|
+
- ImageMagick and ffmpeg **if** you want to use the default views
|
10
|
+
|
11
|
+
Additionally, to compile some native ruby extensions, you will need some
|
12
|
+
development libraries, as, for an ubuntu 18.04: `build-essential`,
|
13
|
+
`libpq-dev`, `libxml2-dev`
|
14
|
+
|
15
|
+
## On a new Rails app
|
16
|
+
Create a new Rails application using the Rails generator:
|
17
|
+
|
18
|
+
```shell
|
19
|
+
rail new myapp -d postgresql
|
20
|
+
cd myapp
|
21
|
+
```
|
22
|
+
|
23
|
+
### Gems
|
24
|
+
|
25
|
+
Add the Elabs required gems to the `Gemfile`:
|
26
|
+
|
27
|
+
```rb
|
28
|
+
# User authentication
|
29
|
+
gem 'devise'
|
30
|
+
# Pagination
|
31
|
+
gem 'kaminari'
|
32
|
+
# Translations
|
33
|
+
gem 'gettext_i18n_rails'
|
34
|
+
# Engine
|
35
|
+
gem 'elabs'
|
36
|
+
|
37
|
+
# If you want to use the default views:
|
38
|
+
gem 'active_link_to'
|
39
|
+
gem 'haml-rails'
|
40
|
+
gem 'mini_magick'
|
41
|
+
```
|
42
|
+
|
43
|
+
Execute `bundle install` to install them.
|
44
|
+
|
45
|
+
### Setup Devise
|
46
|
+
|
47
|
+
Devise is the only authentication solution supported by Elabs for now. The model used for users **have to be `User`**.
|
48
|
+
|
49
|
+
_Following the [Devise documentation](https://github.com/plataformatec/devise#getting-started):_
|
50
|
+
|
51
|
+
- You need to run the generator: `rails generate devise:install`.
|
52
|
+
- At this point, a number of instructions will appear in the console. Among these instructions, you'll need to set up the default URL options for the Devise mailer in each environment. Here is a possible configuration for `config/environments/development.rb`: `config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }`.
|
53
|
+
The generator will install an initializer which describes ALL of Devise's configuration options. It is *imperative* that you take a look at it. When you are done, you are ready to add Devise to any of your models using the generator.
|
54
|
+
- Generate the User model: `rails generate devise User`
|
55
|
+
The generator also configures your `config/routes.rb` file to point to the Devise controller, but we will overwrite it later.
|
56
|
+
- Next, check the User model for any additional configuration options you might want to add, such as confirmable or lockable. If you add an option, be sure to inspect the migration file (created by the generator if your ORM supports them) and uncomment the appropriate section. For example, if you add the confirmable option in the model, you'll need to uncomment the Confirmable section in the migration.
|
57
|
+
|
58
|
+
### Setup Elabs
|
59
|
+
Once Devise is set up, change the `User` model to extend `Elabs::User` instead
|
60
|
+
of `ApplicationRecord`.
|
61
|
+
|
62
|
+
Elabs comes with rake tasks to quickly get ready:
|
63
|
+
|
64
|
+
- Copy migrations: `rails elabs:install:migrations`, will copy all the
|
65
|
+
migrations in `db/migrate`
|
66
|
+
- Copy initializer and other required files: `rails g elabs:install`.
|
67
|
+
Accept to overwrite the `package.json` file **if** you want to use the
|
68
|
+
default views.
|
69
|
+
- Edit `config/database.yml` to suit your needs.
|
70
|
+
- Run `rails db:create` and `rails db:migrate`
|
71
|
+
|
72
|
+
If you want to use the default views, you have to copy some assets from
|
73
|
+
elabs:
|
74
|
+
|
75
|
+
- Copy custom devise mailer views: `rails g elabs:devise_views`
|
76
|
+
- Copy required assets: `rails g elabs:required_assets`
|
77
|
+
|
78
|
+
### Routes
|
79
|
+
|
80
|
+
Update `config/routes.rb` to look like this:
|
81
|
+
|
82
|
+
```rb
|
83
|
+
# config/routes.rb
|
84
|
+
Rails.application.routes.draw do
|
85
|
+
# Elabs routes. Replace '/' by any prefix, depending on what you want.
|
86
|
+
mount Elabs::Engine, at: '/'
|
87
|
+
|
88
|
+
# Home page (or whatever suits your needs. I.e.: 'elabs/projects#index', ...)
|
89
|
+
root 'elabs/acts#index'
|
90
|
+
end
|
91
|
+
```
|
92
|
+
|
93
|
+
### Default views and assets
|
94
|
+
If you want to use the default views, you'll need to install the node
|
95
|
+
dependencies with yarn: `yarn install`
|
96
|
+
|
97
|
+
Update application manifests to use Elabs assets too:
|
98
|
+
|
99
|
+
```rb
|
100
|
+
# app/assets/javascripts/application.js
|
101
|
+
// [...]
|
102
|
+
//= require elabs/application
|
103
|
+
```
|
104
|
+
|
105
|
+
```rb
|
106
|
+
# app/assets/stylesheets/application.css
|
107
|
+
* [...]
|
108
|
+
*= require elabs/application
|
109
|
+
```
|
110
|
+
|
111
|
+
### Create an administrator
|
112
|
+
Admins are people with `admin` role. Open a Rails console and create your
|
113
|
+
first user.
|
114
|
+
```rb
|
115
|
+
User.create username: 'admin', role: 'admin', email: 'admin@yoursite.com', password: 'SomePassword'
|
116
|
+
```
|
117
|
+
|
118
|
+
An other way is to create an account from the web interface and edit it
|
119
|
+
in the rails console:
|
120
|
+
|
121
|
+
```rb
|
122
|
+
User.last.update(role: 'admin')
|
123
|
+
```
|
124
|
+
|
125
|
+
### Done !
|
126
|
+
|
127
|
+
Start to develop your site !
|
128
|
+
|
129
|
+
```rb
|
130
|
+
rails s
|
131
|
+
```
|
132
|
+
|
133
|
+
Now, login with the admin account and create at least a language and a license.
|
134
|
+
|
135
|
+
## On an existing Rails app
|
136
|
+
**This section needs feedback :)**
|