lato_core 1.1.5 → 2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +1 -22
- data/app/assets/config/lato_core_manifest.js +2 -0
- data/app/assets/fonts/lato_core/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/lato_core/fontawesome-webfont.svg +2671 -0
- data/app/assets/fonts/lato_core/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/lato_core/fontawesome-webfont.woff +0 -0
- data/app/assets/fonts/lato_core/fontawesome-webfont.woff2 +0 -0
- data/app/assets/fonts/lato_core/lato-bold-webfont.eot +0 -0
- data/app/assets/fonts/lato_core/lato-bold-webfont.svg +4551 -0
- data/app/assets/fonts/lato_core/lato-bold-webfont.ttf +0 -0
- data/app/assets/fonts/lato_core/lato-bold-webfont.woff +0 -0
- data/app/assets/fonts/lato_core/lato-bold-webfont.woff2 +0 -0
- data/app/assets/fonts/lato_core/lato-regular-webfont.eot +0 -0
- data/app/assets/fonts/lato_core/lato-regular-webfont.svg +4241 -0
- data/app/assets/fonts/lato_core/lato-regular-webfont.ttf +0 -0
- data/app/assets/fonts/lato_core/lato-regular-webfont.woff +0 -0
- data/app/assets/fonts/lato_core/lato-regular-webfont.woff2 +0 -0
- data/app/assets/images/lato_core/editor-icons.svg +1 -0
- data/app/assets/images/lato_core/logo-negative.svg +13 -0
- data/app/assets/images/lato_core/logo.svg +1 -0
- data/app/assets/images/lato_core/user.png +0 -0
- data/app/assets/javascripts/lato_core/application.js +28 -0
- data/app/assets/javascripts/lato_core/initializers/Charts.js +36 -0
- data/app/assets/javascripts/lato_core/initializers/Elements.js +67 -0
- data/app/assets/javascripts/lato_core/initializers/Inputs.js +201 -0
- data/app/assets/javascripts/lato_core/initializers/Layout.js +37 -0
- data/app/assets/javascripts/lato_core/initializers/SortableManager.js +66 -0
- data/app/assets/javascripts/lato_core/interfaces/Modal.js +28 -0
- data/app/assets/javascripts/lato_core/vendors/Sortable.min.js +2 -0
- data/app/assets/javascripts/lato_core/vendors/chart.bundle.js +17220 -0
- data/app/assets/javascripts/lato_core/vendors/dropzone.js +1767 -0
- data/app/assets/javascripts/lato_core/vendors/jquery.datetimepicker.full.js +3243 -0
- data/app/assets/javascripts/lato_core/vendors/jquery.floatThead.js +1106 -0
- data/app/assets/javascripts/lato_core/vendors/jquery.selectize.js +3829 -0
- data/app/assets/javascripts/lato_core/vendors/jquery.trumbowyg.js +1603 -0
- data/app/assets/stylesheets/lato_core/application.scss +23 -0
- data/app/assets/stylesheets/lato_core/base/_base.scss +35 -0
- data/app/assets/stylesheets/lato_core/base/_button.scss +23 -0
- data/app/assets/stylesheets/lato_core/base/_grid.scss +258 -0
- data/app/assets/stylesheets/lato_core/base/_helpers.scss +29 -0
- data/app/assets/stylesheets/lato_core/base/_mixin.scss +37 -0
- data/app/assets/stylesheets/lato_core/base/_normalize.scss +424 -0
- data/app/assets/stylesheets/lato_core/base/_table.scss +47 -0
- data/app/assets/stylesheets/lato_core/base/_typography.scss +23 -0
- data/app/assets/stylesheets/lato_core/cells/_cells.scss +4 -0
- data/app/assets/stylesheets/lato_core/cells/charts/_bar.scss +3 -0
- data/app/assets/stylesheets/lato_core/cells/charts/_charts.scss +2 -0
- data/app/assets/stylesheets/lato_core/cells/charts/_general.scss +7 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_block.scss +12 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_button.scss +132 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_buttongroup.scss +25 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_code.scss +8 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_elements.scss +10 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_flash.scss +74 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_modal.scss +76 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_pagination.scss +64 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_row.scss +3 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_table.scss +57 -0
- data/app/assets/stylesheets/lato_core/cells/elements/_title.scss +32 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_checkbox.scss +42 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_datetime.scss +23 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_dropzone.scss +12 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_editor.scss +3 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_email.scss +3 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_form.scss +3 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_general.scss +51 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_geolocalization.scss +12 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_inputs.scss +14 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_number.scss +3 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_password.scss +3 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_select.scss +47 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_sortableblock.scss +51 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_text.scss +3 -0
- data/app/assets/stylesheets/lato_core/cells/inputs/_textarea.scss +25 -0
- data/app/assets/stylesheets/lato_core/cells/widgets/_index.scss +74 -0
- data/app/assets/stylesheets/lato_core/cells/widgets/_widgets.scss +1 -0
- data/app/assets/stylesheets/lato_core/layouts/_admin.scss +352 -0
- data/app/assets/stylesheets/lato_core/layouts/_authentication.scss +10 -0
- data/app/assets/stylesheets/lato_core/layouts/_layouts.scss +2 -0
- data/app/assets/stylesheets/lato_core/pages/_dashboard.scss +35 -0
- data/app/assets/stylesheets/lato_core/pages/_login.scss +7 -0
- data/app/assets/stylesheets/lato_core/pages/_pages.scss +2 -0
- data/app/assets/stylesheets/lato_core/partials/_dynamic_data_to_js.scss +3 -0
- data/app/assets/stylesheets/lato_core/partials/_partials.scss +1 -0
- data/app/assets/stylesheets/lato_core/theme.scss.erb +127 -0
- data/app/assets/stylesheets/lato_core/vendors/_datetimepicker.css +568 -0
- data/app/assets/stylesheets/lato_core/vendors/_dropzone.css +388 -0
- data/app/assets/stylesheets/lato_core/vendors/_fontawesome.css +2341 -0
- data/app/assets/stylesheets/lato_core/vendors/_scrollbar.css +904 -0
- data/app/assets/stylesheets/lato_core/vendors/_selectize.css +324 -0
- data/app/assets/stylesheets/lato_core/vendors/_trumbowyg.css +584 -0
- data/app/assets/stylesheets/lato_core/vendors/_vendors.scss +6 -0
- data/app/assets/stylesheets/lato_core/widgets/_systeminfo.scss +21 -0
- data/app/assets/stylesheets/lato_core/widgets/_widgets.scss +1 -0
- data/app/cells/lato_core/charts/bar/vertical/cell.rb +57 -0
- data/app/cells/lato_core/charts/bar/vertical/views/show.html.erb +7 -0
- data/app/cells/lato_core/elements/block/cell.rb +39 -0
- data/app/cells/lato_core/elements/block/views/close.html.erb +1 -0
- data/app/cells/lato_core/elements/block/views/open.html.erb +4 -0
- data/app/cells/lato_core/elements/button/cell.rb +59 -0
- data/app/cells/lato_core/elements/button/views/button.html.erb +27 -0
- data/app/cells/lato_core/elements/button/views/link.html.erb +65 -0
- data/app/cells/lato_core/elements/buttongroup/cell.rb +33 -0
- data/app/cells/lato_core/elements/buttongroup/views/show.html.erb +7 -0
- data/app/cells/lato_core/elements/code/cell.rb +36 -0
- data/app/cells/lato_core/elements/code/views/close.html.erb +2 -0
- data/app/cells/lato_core/elements/code/views/open.html.erb +2 -0
- data/app/cells/lato_core/elements/flash/cell.rb +35 -0
- data/app/cells/lato_core/elements/flash/views/show.html.erb +11 -0
- data/app/cells/lato_core/elements/icon/cell.rb +31 -0
- data/app/cells/lato_core/elements/icon/views/show.html.erb +1 -0
- data/app/cells/lato_core/elements/modal/cell.rb +31 -0
- data/app/cells/lato_core/elements/modal/views/show.html.erb +21 -0
- data/app/cells/lato_core/elements/pagination/cell.rb +68 -0
- data/app/cells/lato_core/elements/pagination/views/show.html.erb +59 -0
- data/app/cells/lato_core/elements/row/cell.rb +37 -0
- data/app/cells/lato_core/elements/row/views/close.html.erb +1 -0
- data/app/cells/lato_core/elements/row/views/open.html.erb +3 -0
- data/app/cells/lato_core/elements/table/body/cell.rb +37 -0
- data/app/cells/lato_core/elements/table/body/views/close.html.erb +1 -0
- data/app/cells/lato_core/elements/table/body/views/open.html.erb +3 -0
- data/app/cells/lato_core/elements/table/container/cell.rb +41 -0
- data/app/cells/lato_core/elements/table/container/views/close.html.erb +2 -0
- data/app/cells/lato_core/elements/table/container/views/open.html.erb +7 -0
- data/app/cells/lato_core/elements/table/head/cell.rb +33 -0
- data/app/cells/lato_core/elements/table/head/views/show.html.erb +7 -0
- data/app/cells/lato_core/elements/table/row/cell.rb +49 -0
- data/app/cells/lato_core/elements/table/row/views/show.html.erb +35 -0
- data/app/cells/lato_core/elements/title/cell.rb +52 -0
- data/app/cells/lato_core/elements/title/views/show.html.erb +4 -0
- data/app/cells/lato_core/inputs/checkbox/cell.rb +38 -0
- data/app/cells/lato_core/inputs/checkbox/views/show.html.erb +20 -0
- data/app/cells/lato_core/inputs/datetime/cell.rb +53 -0
- data/app/cells/lato_core/inputs/datetime/views/show.html.erb +19 -0
- data/app/cells/lato_core/inputs/dropzone/cell.rb +37 -0
- data/app/cells/lato_core/inputs/dropzone/views/show.html.erb +24 -0
- data/app/cells/lato_core/inputs/editor/cell.rb +37 -0
- data/app/cells/lato_core/inputs/editor/views/show.html.erb +12 -0
- data/app/cells/lato_core/inputs/email/cell.rb +40 -0
- data/app/cells/lato_core/inputs/email/views/show.html.erb +19 -0
- data/app/cells/lato_core/inputs/form/cell.rb +39 -0
- data/app/cells/lato_core/inputs/form/views/close.html.erb +1 -0
- data/app/cells/lato_core/inputs/form/views/open.html.erb +12 -0
- data/app/cells/lato_core/inputs/geolocalization/cell.rb +51 -0
- data/app/cells/lato_core/inputs/geolocalization/views/show.html.erb +26 -0
- data/app/cells/lato_core/inputs/number/cell.rb +44 -0
- data/app/cells/lato_core/inputs/number/views/show.html.erb +25 -0
- data/app/cells/lato_core/inputs/password/cell.rb +42 -0
- data/app/cells/lato_core/inputs/password/views/show.html.erb +21 -0
- data/app/cells/lato_core/inputs/select/cell.rb +56 -0
- data/app/cells/lato_core/inputs/select/views/show.html.erb +25 -0
- data/app/cells/lato_core/inputs/shared/help.html.erb +7 -0
- data/app/cells/lato_core/inputs/shared/label.html.erb +11 -0
- data/app/cells/lato_core/inputs/sortableblock/cell.rb +39 -0
- data/app/cells/lato_core/inputs/sortableblock/views/show.html.erb +40 -0
- data/app/cells/lato_core/inputs/text/cell.rb +42 -0
- data/app/cells/lato_core/inputs/text/views/show.html.erb +21 -0
- data/app/cells/lato_core/inputs/textarea/cell.rb +41 -0
- data/app/cells/lato_core/inputs/textarea/views/show.html.erb +16 -0
- data/app/cells/lato_core/widgets/index/cell.rb +215 -0
- data/app/cells/lato_core/widgets/index/views/partials/new.html.erb +3 -0
- data/app/cells/lato_core/widgets/index/views/partials/pagination.html.erb +3 -0
- data/app/cells/lato_core/widgets/index/views/partials/search.html.erb +17 -0
- data/app/cells/lato_core/widgets/index/views/show.html.erb +45 -0
- data/app/controllers/lato_core/api/api_controller.rb +5 -0
- data/app/controllers/lato_core/application_controller.rb +9 -1
- data/app/controllers/lato_core/back/authentication_controller.rb +33 -99
- data/app/controllers/lato_core/back/back_controller.rb +5 -14
- data/app/controllers/lato_core/back/dashboard_controller.rb +13 -0
- data/app/controllers/lato_core/back/superusers_controller.rb +97 -113
- data/app/controllers/lato_core/doc/cells_charts_controller.rb +7 -0
- data/app/controllers/lato_core/doc/cells_elements_controller.rb +31 -0
- data/app/controllers/lato_core/doc/cells_inputs_controller.rb +33 -0
- data/app/controllers/lato_core/doc/cells_widgets_controller.rb +10 -0
- data/app/controllers/lato_core/doc/doc_controller.rb +17 -0
- data/app/controllers/lato_core/doc/general_controller.rb +13 -0
- data/app/helpers/lato_core/application_helper.rb +4 -0
- data/app/jobs/lato_core/application_job.rb +4 -0
- data/app/mailers/lato_core/application_mailer.rb +2 -5
- data/app/models/lato_core/application_record.rb +5 -0
- data/app/models/lato_core/superuser.rb +11 -16
- data/app/models/lato_core/superuser/entity_helpers.rb +29 -0
- data/app/views/lato_core/back/authentication/index.html.erb +25 -0
- data/app/views/lato_core/back/dashboard/index.html.erb +29 -0
- data/app/views/lato_core/back/superusers/edit.html.erb +10 -15
- data/app/views/lato_core/back/superusers/index.html.erb +16 -27
- data/app/views/lato_core/back/superusers/new.html.erb +8 -13
- data/app/views/lato_core/back/superusers/shared/_form.html.erb +47 -55
- data/app/views/lato_core/back/superusers/show.html.erb +65 -1
- data/app/views/lato_core/doc/cells_charts/bar_vertical.erb +64 -0
- data/app/views/lato_core/doc/cells_elements/block.html.erb +172 -0
- data/app/views/lato_core/doc/cells_elements/button.html.erb +375 -0
- data/app/views/lato_core/doc/cells_elements/buttongroup.html.erb +101 -0
- data/app/views/lato_core/doc/cells_elements/flash_messages.html.erb +123 -0
- data/app/views/lato_core/doc/cells_elements/icon.html.erb +58 -0
- data/app/views/lato_core/doc/cells_elements/modal.html.erb +89 -0
- data/app/views/lato_core/doc/cells_elements/pagination.html.erb +149 -0
- data/app/views/lato_core/doc/cells_elements/row.html.erb +62 -0
- data/app/views/lato_core/doc/cells_elements/table.html.erb +272 -0
- data/app/views/lato_core/doc/cells_elements/table_body.html.erb +118 -0
- data/app/views/lato_core/doc/cells_elements/table_head.html.erb +110 -0
- data/app/views/lato_core/doc/cells_elements/table_row.html.erb +212 -0
- data/app/views/lato_core/doc/cells_elements/title.html.erb +70 -0
- data/app/views/lato_core/doc/cells_inputs/checkbox.html.erb +101 -0
- data/app/views/lato_core/doc/cells_inputs/datetime.html.erb +178 -0
- data/app/views/lato_core/doc/cells_inputs/dropzone.html.erb +114 -0
- data/app/views/lato_core/doc/cells_inputs/editor.html.erb +59 -0
- data/app/views/lato_core/doc/cells_inputs/email.html.erb +79 -0
- data/app/views/lato_core/doc/cells_inputs/form.html.erb +242 -0
- data/app/views/lato_core/doc/cells_inputs/geolocalization.html.erb +157 -0
- data/app/views/lato_core/doc/cells_inputs/number.html.erb +100 -0
- data/app/views/lato_core/doc/cells_inputs/password.html.erb +79 -0
- data/app/views/lato_core/doc/cells_inputs/select.html.erb +124 -0
- data/app/views/lato_core/doc/cells_inputs/sortableblock.html.erb +72 -0
- data/app/views/lato_core/doc/cells_inputs/text.html.erb +204 -0
- data/app/views/lato_core/doc/cells_inputs/textarea.html.erb +104 -0
- data/app/views/lato_core/doc/cells_widgets/index.html.erb +163 -0
- data/app/views/lato_core/doc/doc/index.html.erb +95 -0
- data/app/views/lato_core/doc/general/generators.html.erb +60 -0
- data/app/views/lato_core/doc/general/installation.html.erb +49 -0
- data/app/views/lato_core/doc/general/languages.html.erb +67 -0
- data/app/views/lato_core/doc/general/personalization.html.erb +177 -0
- data/app/views/lato_core/doc/shared/_modal_content.html.erb +4 -0
- data/app/views/lato_core/doc/shared/_sortableblock_partial.html.erb +1 -0
- data/app/views/lato_core/partials/_dynamic_data_to_js.html.erb +3 -0
- data/app/views/lato_core/partials/_gmaps.html.erb +5 -0
- data/app/views/lato_core/widgets/_systeminfo.html.erb +15 -0
- data/app/views/layouts/lato_core/admin.html.erb +44 -0
- data/app/views/layouts/lato_core/authentication.html.erb +22 -0
- data/app/views/layouts/lato_core/partials/_back.html.erb +5 -0
- data/app/views/layouts/lato_core/partials/_load_javascript.html.erb +4 -0
- data/app/views/layouts/lato_core/partials/_load_partials.html.erb +5 -0
- data/app/views/layouts/lato_core/partials/_load_stylesheet.html.erb +4 -0
- data/app/views/layouts/lato_core/partials/_logo.html.erb +9 -0
- data/app/views/layouts/lato_core/partials/_menu.html.erb +67 -0
- data/app/views/layouts/lato_core/partials/_profile.html.erb +19 -0
- data/app/views/layouts/lato_core/partials/_title.html.erb +3 -0
- data/app/views/layouts/lato_core/partials/_widgets.html.erb +13 -0
- data/config/configs.yml +102 -0
- data/config/initializers/assets.rb +9 -0
- data/config/initializers/init_system.rb +39 -0
- data/config/languages/default.yml +63 -0
- data/config/languages/it.yml +63 -0
- data/config/routes.rb +10 -13
- data/config/routes/api.rb +3 -0
- data/config/routes/back.rb +10 -0
- data/config/routes/doc.rb +48 -0
- data/db/migrate/20160224181217_create_lato_core_superusers.rb +8 -2
- data/lib/generators/lato_core/crud_generator.rb +26 -0
- data/lib/generators/lato_core/initializer_generator.rb +46 -0
- data/lib/generators/lato_core/templates/assets/images/logo.svg +13 -0
- data/{config/initializers/lists.rb → lib/generators/lato_core/templates/assets/javascripts/application.js} +0 -0
- data/lib/generators/lato_core/templates/assets/stylesheets/application.scss +2 -0
- data/lib/generators/lato_core/templates/assets/stylesheets/theme.scss.erb +13 -0
- data/lib/generators/lato_core/templates/controllers/application_controller.rb +13 -0
- data/lib/generators/lato_core/templates/controllers/crud_controller.rb +87 -0
- data/lib/generators/lato_core/templates/views/application/index.html.erb +16 -0
- data/lib/generators/lato_core/templates/views/crud/edit.html.erb +18 -0
- data/lib/generators/lato_core/templates/views/crud/index.html.erb +29 -0
- data/lib/generators/lato_core/templates/views/crud/new.html.erb +18 -0
- data/lib/generators/lato_core/templates/views/crud/shared/_form.html.erb +25 -0
- data/lib/generators/lato_core/templates/views/crud/show.html.erb +16 -0
- data/lib/lato_core.rb +6 -5
- data/lib/lato_core/cell.rb +28 -0
- data/lib/lato_core/engine.rb +16 -13
- data/lib/lato_core/helper.rb +11 -0
- data/lib/lato_core/helpers/cells.rb +20 -0
- data/lib/lato_core/helpers/general.rb +16 -0
- data/lib/lato_core/interface.rb +17 -14
- data/lib/lato_core/interfaces/apihelpers.rb +39 -0
- data/lib/lato_core/interfaces/application.rb +65 -0
- data/lib/lato_core/interfaces/authentication.rb +41 -0
- data/lib/lato_core/interfaces/cells.rb +41 -0
- data/lib/lato_core/interfaces/general.rb +39 -0
- data/lib/lato_core/interfaces/layout.rb +213 -0
- data/lib/lato_core/interfaces/modules.rb +110 -0
- data/lib/lato_core/interfaces/token.rb +25 -0
- data/lib/lato_core/version.rb +3 -0
- data/lib/tasks/lato_core_tasks.rake +4 -8
- data/lib/tasks/lato_tasks.rake +83 -0
- metadata +407 -33
- data/app/controllers/lato_core/api/v1/api_controller.rb +0 -8
- data/app/mailers/lato_core/superusers_mailer.rb +0 -27
- data/app/views/lato_core/back/authentication/login.html.erb +0 -45
- data/app/views/lato_core/back/authentication/password_edit.html.erb +0 -45
- data/app/views/lato_core/back/authentication/password_forget.html.erb +0 -36
- data/app/views/lato_core/back/back/home.html.erb +0 -20
- data/app/views/lato_core/mailers/layouts/mailer.html.erb +0 -9
- data/app/views/lato_core/mailers/layouts/mailer.text.erb +0 -1
- data/app/views/lato_core/mailers/superusers/notify.html.erb +0 -2
- data/app/views/lato_core/mailers/superusers/recover_password.html.erb +0 -4
- data/config/config.yml +0 -8
- data/config/example.yml +0 -66
- data/config/initializers/init.rb +0 -15
- data/config/initializers/ram.rb +0 -14
- data/lang/default.yml +0 -61
- data/lang/en.yml +0 -61
- data/lib/lato_core/interface/authentication.rb +0 -26
- data/lib/lato_core/interface/cache.rb +0 -23
- data/lib/lato_core/interface/communication.rb +0 -87
- data/lib/lato_core/interface/languages.rb +0 -51
- data/lib/lato_core/interface/navigation.rb +0 -95
- data/lib/lato_core/interface/session.rb +0 -57
- data/lib/lato_core/interface/superusers.rb +0 -134
@@ -0,0 +1,213 @@
|
|
1
|
+
module LatoCore
|
2
|
+
|
3
|
+
# This module contains a list of functions used to mange the admin layout.
|
4
|
+
module Interface::Layout
|
5
|
+
|
6
|
+
# Helpers:
|
7
|
+
|
8
|
+
# This function set the current active page title on the header.
|
9
|
+
def core__set_header_active_page_title(title)
|
10
|
+
@core__header_active_page_title = title
|
11
|
+
end
|
12
|
+
|
13
|
+
# This function set the current active page on the menu.
|
14
|
+
def core__set_menu_active_item(item_key)
|
15
|
+
@core__menu_active_item = item_key
|
16
|
+
end
|
17
|
+
|
18
|
+
# Partials:
|
19
|
+
|
20
|
+
# This function returns a list of partials for the page.
|
21
|
+
def core__get_partials
|
22
|
+
lato_modules = core__get_modules_list
|
23
|
+
# create list of widgets
|
24
|
+
partials = []
|
25
|
+
lato_modules.each do |lato_module_name|
|
26
|
+
module_partials = core__get_partials_for_module(lato_module_name)
|
27
|
+
partials += module_partials if module_partials
|
28
|
+
end
|
29
|
+
# sort items and return them
|
30
|
+
partials = partials.sort_by {|partial| partial[:position]}
|
31
|
+
partials.reverse
|
32
|
+
end
|
33
|
+
|
34
|
+
# This function return the list of partials for a specific module.
|
35
|
+
def core__get_partials_for_module(module_name)
|
36
|
+
module_configs = core__get_module_configs(module_name)
|
37
|
+
return [] unless module_configs
|
38
|
+
# load module items
|
39
|
+
module_partials = []
|
40
|
+
if module_configs[:partials]
|
41
|
+
module_configs[:partials].each do |key, value|
|
42
|
+
module_partials.push(core__generate_partial(key, value, module_name))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
# return module items
|
46
|
+
module_partials
|
47
|
+
end
|
48
|
+
|
49
|
+
# This function create a correct partial object for the header.
|
50
|
+
def core__generate_partial(key, values, module_name)
|
51
|
+
partial = {}
|
52
|
+
partial[:key] = key
|
53
|
+
partial[:path] = values[:path] ? values[:path] : ''
|
54
|
+
partial[:position] = values[:position] ? values[:position] : 999
|
55
|
+
partial
|
56
|
+
end
|
57
|
+
|
58
|
+
# Widgets:
|
59
|
+
|
60
|
+
# This function return a list of widgets for the header of the layout.
|
61
|
+
def core__get_widgets
|
62
|
+
lato_modules = core__get_modules_list
|
63
|
+
# create list of widgets
|
64
|
+
widgets = []
|
65
|
+
lato_modules.each do |lato_module_name|
|
66
|
+
module_widgets = core__get_widgets_for_module(lato_module_name)
|
67
|
+
widgets = widgets + module_widgets if module_widgets
|
68
|
+
end
|
69
|
+
# sort items and return them
|
70
|
+
widgets = widgets.sort_by {|widget| widget[:position]}
|
71
|
+
return widgets.reverse
|
72
|
+
end
|
73
|
+
|
74
|
+
# This function return the list of widgets for a specific module.
|
75
|
+
def core__get_widgets_for_module module_name
|
76
|
+
module_configs = core__get_module_configs(module_name)
|
77
|
+
return [] unless module_configs
|
78
|
+
# load module items
|
79
|
+
module_widgets = []
|
80
|
+
if module_configs[:widgets]
|
81
|
+
module_configs[:widgets].each do |key, value|
|
82
|
+
module_widgets.push(core__generate_widget(key, value, module_name))
|
83
|
+
end
|
84
|
+
end
|
85
|
+
# return module items
|
86
|
+
return module_widgets
|
87
|
+
end
|
88
|
+
|
89
|
+
# This function create a correct widget object for the header.
|
90
|
+
def core__generate_widget key, values, module_name
|
91
|
+
widget = {}
|
92
|
+
widget[:key] = key
|
93
|
+
widget[:icon] = values[:icon] ? values[:icon] : 'check-circle'
|
94
|
+
widget[:path] = values[:path] ? values[:path] : ''
|
95
|
+
widget[:position] = values[:position] ? values[:position] : 999
|
96
|
+
widget[:title] = values[:title] ? values[:title] : ''
|
97
|
+
return widget
|
98
|
+
end
|
99
|
+
|
100
|
+
# Menu:
|
101
|
+
|
102
|
+
# This function returns the list of the items for the menu.
|
103
|
+
def core__get_menu
|
104
|
+
lato_modules = core__get_modules_list
|
105
|
+
# create list of menu items
|
106
|
+
menu = []
|
107
|
+
lato_modules.each do |lato_module_name|
|
108
|
+
module_menu = core__get_menu_for_module(lato_module_name)
|
109
|
+
menu = menu + module_menu if module_menu
|
110
|
+
end
|
111
|
+
# sort items and return them
|
112
|
+
menu = menu.sort_by {|menu_item| [menu_item[:position], menu_item[:title]]}
|
113
|
+
return menu
|
114
|
+
end
|
115
|
+
|
116
|
+
# This function returns the list of the items for the menu for a specific module.
|
117
|
+
def core__get_menu_for_module module_name
|
118
|
+
module_configs = core__get_module_configs(module_name)
|
119
|
+
return [] unless module_configs
|
120
|
+
# load module items
|
121
|
+
module_menu = []
|
122
|
+
if module_configs[:menu]
|
123
|
+
module_configs[:menu].each do |key, value|
|
124
|
+
module_menu.push(core__generate_menu_item(key, value, module_name))
|
125
|
+
end
|
126
|
+
end
|
127
|
+
# return module items
|
128
|
+
return module_menu
|
129
|
+
end
|
130
|
+
|
131
|
+
# This function create a correct menu item object for the menu.
|
132
|
+
def core__generate_menu_item key, values, module_name
|
133
|
+
menu_item = {}
|
134
|
+
menu_item[:key] = key
|
135
|
+
menu_item[:title] = values[:title] ? core__get_menu_title_translation(values[:title], module_name) : 'Undefined'
|
136
|
+
menu_item[:icon] = values[:icon] ? values[:icon] : 'check-circle'
|
137
|
+
menu_item[:url] = values[:url] ? values[:url] : ''
|
138
|
+
menu_item[:position] = values[:position] ? values[:position] : 999
|
139
|
+
menu_item[:permission_min] = values[:permission_min] ? values[:permission_min] : 0
|
140
|
+
menu_item[:permission_max] = values[:permission_max] ? values[:permission_max] : 999
|
141
|
+
menu_item[:sub_items] = []
|
142
|
+
|
143
|
+
if values[:sub_items]
|
144
|
+
values[:sub_items].each do |key, value|
|
145
|
+
menu_item[:sub_items].push(core__generate_menu_sub_item(key, value, module_name))
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
return menu_item
|
150
|
+
end
|
151
|
+
|
152
|
+
# This function create a correct menu sub itam object for the menu.
|
153
|
+
def core__generate_menu_sub_item key, values, module_name
|
154
|
+
menu_sub_item = {}
|
155
|
+
menu_sub_item[:key] = key
|
156
|
+
menu_sub_item[:title] = values[:title] ? core__get_menu_title_translation(values[:title], module_name) : 'Undefined'
|
157
|
+
menu_sub_item[:url] = values[:url] ? values[:url] : ''
|
158
|
+
menu_sub_item[:permission_min] = values[:permission_min] ? values[:permission_min] : 0
|
159
|
+
menu_sub_item[:permission_max] = values[:permission_max] ? values[:permission_max] : 999
|
160
|
+
return menu_sub_item
|
161
|
+
end
|
162
|
+
|
163
|
+
# This function check the title name and, if it need a translaction, it return the value.
|
164
|
+
def core__get_menu_title_translation title, module_name
|
165
|
+
return title if (!title.start_with?('translate'))
|
166
|
+
|
167
|
+
title_key = core__get_string_inside_strings(title, '[', ']')
|
168
|
+
module_languages = core__get_module_languages(module_name)
|
169
|
+
return title if !module_languages || !module_languages[:menu] || !module_languages[:menu][title_key]
|
170
|
+
|
171
|
+
return module_languages[:menu][title_key]
|
172
|
+
end
|
173
|
+
|
174
|
+
# Assets:
|
175
|
+
|
176
|
+
# This function return an array with the list of assets for lato modules.
|
177
|
+
def core__get_assets
|
178
|
+
lato_modules = core__get_modules_list
|
179
|
+
# create list of menu assets
|
180
|
+
assets = []
|
181
|
+
lato_modules.each do |lato_module_name|
|
182
|
+
module_assets = core__get_assets_for_module(lato_module_name)
|
183
|
+
assets = assets + module_assets if module_assets
|
184
|
+
end
|
185
|
+
# return assets
|
186
|
+
return assets
|
187
|
+
end
|
188
|
+
|
189
|
+
# This function return the lists of assets for a specific module.
|
190
|
+
def core__get_assets_for_module module_name
|
191
|
+
module_configs = core__get_module_configs(module_name)
|
192
|
+
return [] unless module_configs
|
193
|
+
# load module assets
|
194
|
+
module_assets = []
|
195
|
+
if module_configs[:assets]
|
196
|
+
module_configs[:assets].each do |key, value|
|
197
|
+
module_assets.push(value)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
# return module assets
|
201
|
+
return module_assets
|
202
|
+
end
|
203
|
+
|
204
|
+
# Colors:
|
205
|
+
|
206
|
+
# This function return the list of colors set for the tamplate.
|
207
|
+
def core__get_colors
|
208
|
+
core_configs = core__get_module_configs('lato_core')
|
209
|
+
return core_configs[:colors]
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
module LatoCore
|
2
|
+
# This module contains a list of functions used to work and manage other
|
3
|
+
# lato modules.
|
4
|
+
module Interface::Modules
|
5
|
+
|
6
|
+
# Helpers:
|
7
|
+
############################################################################
|
8
|
+
|
9
|
+
# This function return the root path of a specific module.
|
10
|
+
def core__get_module_root_path(module_name)
|
11
|
+
Gem.loaded_specs[module_name].full_gem_path
|
12
|
+
end
|
13
|
+
|
14
|
+
# This function returns the list of lato modules installed on main application.
|
15
|
+
def core__get_modules_list
|
16
|
+
all_gems = core__get_application_gems.keys
|
17
|
+
lato_gems = []
|
18
|
+
# check every gem
|
19
|
+
all_gems.each do |name|
|
20
|
+
lato_gems.push(name) if name.start_with? 'lato'
|
21
|
+
end
|
22
|
+
# return result
|
23
|
+
lato_gems
|
24
|
+
end
|
25
|
+
|
26
|
+
# Languages:
|
27
|
+
############################################################################
|
28
|
+
|
29
|
+
# This function returns an object with languages for every module.
|
30
|
+
def core__get_modules_languages
|
31
|
+
lato_modules = core__get_modules_list
|
32
|
+
languages = {}
|
33
|
+
lato_modules.each do |lato_module_name|
|
34
|
+
languages[lato_module_name.to_sym] = core__get_module_languages(lato_module_name)
|
35
|
+
end
|
36
|
+
languages
|
37
|
+
end
|
38
|
+
|
39
|
+
# This function load languages for a specific module.
|
40
|
+
# This config are generated from the merge of application languages
|
41
|
+
# for the module and default languages of the module.
|
42
|
+
def core__get_module_languages(module_name)
|
43
|
+
default_languages = core__get_module_default_languages(module_name)
|
44
|
+
application_languages = core__get_module_application_languages(module_name)
|
45
|
+
return default_languages unless application_languages
|
46
|
+
|
47
|
+
default_languages.each do |key, value|
|
48
|
+
application_languages[key] = value unless application_languages[key]
|
49
|
+
end
|
50
|
+
|
51
|
+
application_languages
|
52
|
+
end
|
53
|
+
|
54
|
+
# This function load default languages for a specific module.
|
55
|
+
def core__get_module_default_languages(module_name)
|
56
|
+
module_root_path = core__get_module_root_path(module_name)
|
57
|
+
core__read_yaml("#{module_root_path}/config/languages/default.yml")
|
58
|
+
end
|
59
|
+
|
60
|
+
# This function load application languages for a specific module.
|
61
|
+
def core__get_module_application_languages(module_name)
|
62
|
+
application_config_path = core__get_application_lato_configs_path
|
63
|
+
absolute_path = "#{application_config_path}/#{module_name}_locale.yml"
|
64
|
+
core__read_yaml(absolute_path)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Configs:
|
68
|
+
############################################################################
|
69
|
+
|
70
|
+
# This function returns an object with configs for every module.
|
71
|
+
def core__get_modules_configs
|
72
|
+
lato_modules = core__get_modules_list
|
73
|
+
configs = {}
|
74
|
+
lato_modules.each do |lato_module_name|
|
75
|
+
configs[lato_module_name.to_sym] = core__get_module_configs(lato_module_name)
|
76
|
+
end
|
77
|
+
configs
|
78
|
+
end
|
79
|
+
|
80
|
+
# This function load configs for a specific module.
|
81
|
+
# This configs are generated from the merge of application configs for the module
|
82
|
+
# and default configs of the module.
|
83
|
+
def core__get_module_configs module_name
|
84
|
+
default_config = core__get_module_default_configs(module_name)
|
85
|
+
application_config = core__get_module_application_configs(module_name)
|
86
|
+
return default_config unless application_config
|
87
|
+
|
88
|
+
default_config.each do |key, value|
|
89
|
+
application_config[key] = value unless application_config[key]
|
90
|
+
end
|
91
|
+
|
92
|
+
return application_config
|
93
|
+
end
|
94
|
+
|
95
|
+
# This function load application configs for a specific module.
|
96
|
+
def core__get_module_application_configs module_name
|
97
|
+
application_config_path = core__get_application_lato_configs_path
|
98
|
+
absolute_path = "#{application_config_path}/#{module_name}.yml"
|
99
|
+
return core__read_yaml(absolute_path)
|
100
|
+
end
|
101
|
+
|
102
|
+
# This function load default configs for a specific module.
|
103
|
+
def core__get_module_default_configs module_name
|
104
|
+
module_root_path = core__get_module_root_path(module_name)
|
105
|
+
absolute_path = "#{module_root_path}/config/configs.yml"
|
106
|
+
return core__read_yaml(absolute_path)
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module LatoCore
|
2
|
+
|
3
|
+
# This module contains a list of functions used to manage tokens.
|
4
|
+
# All functions on the module depends on 'jwt' gem.
|
5
|
+
module Interface::Token
|
6
|
+
|
7
|
+
# This functon return a token with encrypted payload information.
|
8
|
+
def core__encode_token exp, payload
|
9
|
+
exp = 1.day.from_now unless exp
|
10
|
+
payload[:exp] = exp.to_i
|
11
|
+
return JWT.encode(payload, Rails.application.secrets.secret_key_base)
|
12
|
+
end
|
13
|
+
|
14
|
+
# This function return the payload of a token.
|
15
|
+
def core__decode_token token
|
16
|
+
begin
|
17
|
+
body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]
|
18
|
+
return HashWithIndifferentAccess.new body
|
19
|
+
rescue => exception
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
|
5
|
-
task :lato_core_initialize do
|
6
|
-
directory = core_getCacheDirectory
|
7
|
-
FileUtils.cp "#{LatoCore::Engine.root}/config/example.yml", "#{Rails.root}/config/lato/config.yml"
|
8
|
-
end
|
1
|
+
# desc "Explaining what the task does"
|
2
|
+
# task :lato_core do
|
3
|
+
# # Task goes here
|
4
|
+
# end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
include LatoCore::Interface
|
4
|
+
|
5
|
+
desc 'Lato general tasks'
|
6
|
+
namespace :lato do
|
7
|
+
desc 'Load lato modules configs on main application if they are not present'
|
8
|
+
task :load_configs do
|
9
|
+
generate_modules_application_configs(false)
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Load lato modules configs on main application or rewrite them'
|
13
|
+
task :load_configs_forced do
|
14
|
+
generate_modules_application_configs(true)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Load lato modules languages on main application if they are not present'
|
18
|
+
task :load_languages do
|
19
|
+
generate_modules_application_languages('default', false)
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Load lato modules languages on main application or rewrite them'
|
23
|
+
task :load_languages_forced do
|
24
|
+
generate_modules_application_languages('default', true)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Load configs:
|
29
|
+
##############################################################################
|
30
|
+
|
31
|
+
# This function generates on the main application the configs files for
|
32
|
+
# every lato module.
|
33
|
+
def generate_modules_application_configs(forced = false)
|
34
|
+
lato_modules = core__get_modules_list
|
35
|
+
lato_modules.each do |lato_module_name|
|
36
|
+
generate_module_application_configs(lato_module_name, forced)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# This function generates on the main application the configs files for
|
41
|
+
# a specific lato module.
|
42
|
+
def generate_module_application_configs(module_name, forced = false)
|
43
|
+
# find directories path
|
44
|
+
application_config_path = core__get_application_lato_configs_path
|
45
|
+
module_root_path = core__get_module_root_path(module_name)
|
46
|
+
# find configs files path
|
47
|
+
configs_from_file_path = "#{module_root_path}/config/configs.yml"
|
48
|
+
config_to_file_path = "#{application_config_path}/#{module_name}.yml"
|
49
|
+
# copy file from module to main application (if it's possible)
|
50
|
+
if !forced && File.exist?(config_to_file_path)
|
51
|
+
puts "Already exist: #{config_to_file_path}"
|
52
|
+
return
|
53
|
+
end
|
54
|
+
FileUtils.cp configs_from_file_path, config_to_file_path
|
55
|
+
puts "Generated: #{config_to_file_path}"
|
56
|
+
end
|
57
|
+
|
58
|
+
# Load languages:
|
59
|
+
##############################################################################
|
60
|
+
|
61
|
+
def generate_modules_application_languages(language = 'default', forced = false)
|
62
|
+
lato_modules = core__get_modules_list
|
63
|
+
lato_modules.each do |lato_module_name|
|
64
|
+
generate_module_application_languages(lato_module_name, language, forced)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def generate_module_application_languages(module_name, language = 'default', forced = false)
|
69
|
+
# find directories path
|
70
|
+
application_config_path = core__get_application_lato_configs_path
|
71
|
+
module_root_path = core__get_module_root_path(module_name)
|
72
|
+
# find languages files path
|
73
|
+
lang_from_file_path = "#{module_root_path}/config/languages/#{language}.yml"
|
74
|
+
lang_from_file_path = "#{module_root_path}/config/languages/default.yml" unless File.exist?(lang_from_file_path)
|
75
|
+
lang_to_file_path = "#{application_config_path}/#{module_name}_locale.yml"
|
76
|
+
# copy file from module to main application (if it's possible)
|
77
|
+
if !forced && File.exist?(lang_to_file_path)
|
78
|
+
puts "Already exist: #{lang_to_file_path}"
|
79
|
+
return
|
80
|
+
end
|
81
|
+
FileUtils.cp lang_from_file_path, lang_to_file_path
|
82
|
+
puts "Generated: #{lang_to_file_path}"
|
83
|
+
end
|