keppler 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +6 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/bin/console +15 -0
- data/bin/keppler +5 -0
- data/bin/setup +7 -0
- data/installer/core/Gemfile +113 -0
- data/installer/core/Guardfile +18 -0
- data/installer/core/README.md +87 -0
- data/installer/core/Rakefile +6 -0
- data/installer/core/_config.yml +1 -0
- data/installer/core/app/assets/images/admin/favicon.png +0 -0
- data/installer/core/app/assets/images/admin/logo.png +0 -0
- data/installer/core/app/assets/images/admin/logo2.png +0 -0
- data/installer/core/app/assets/images/admin/profile-menu.jpg +0 -0
- data/installer/core/app/assets/images/admin/search.png +0 -0
- data/installer/core/app/assets/images/admin/slice-icon-orange.png +0 -0
- data/installer/core/app/assets/images/admin/slice-icon.png +0 -0
- data/installer/core/app/assets/images/admin/slice.png +0 -0
- data/installer/core/app/assets/images/admin/slice_white.png +0 -0
- data/installer/core/app/assets/images/admin/space.png +0 -0
- data/installer/core/app/assets/images/app/Home_Keppler.png +0 -0
- data/installer/core/app/assets/images/app/Home_Keppler2.png +0 -0
- data/installer/core/app/assets/images/app/keppler-front.png +0 -0
- data/installer/core/app/assets/images/app/slice-front.png +0 -0
- data/installer/core/app/assets/javascripts/admin/application.coffee +15 -0
- data/installer/core/app/assets/javascripts/admin/dropdown_top.js +7 -0
- data/installer/core/app/assets/javascripts/admin/file_upload.coffee +21 -0
- data/installer/core/app/assets/javascripts/admin/img_preview.js +18 -0
- data/installer/core/app/assets/javascripts/admin/main.coffee +42 -0
- data/installer/core/app/assets/javascripts/admin/notification.js +11 -0
- data/installer/core/app/assets/javascripts/admin/preview_template.js +21 -0
- data/installer/core/app/assets/javascripts/admin/sidebar.js +20 -0
- data/installer/core/app/assets/javascripts/admin/sort.coffee +8 -0
- data/installer/core/app/assets/javascripts/app/application.js.coffee +5 -0
- data/installer/core/app/assets/javascripts/app/front.js +129 -0
- data/installer/core/app/assets/javascripts/app/google_analytics.js.coffee +5 -0
- data/installer/core/app/assets/javascripts/ckeditor/config.js +130 -0
- data/installer/core/app/assets/javascripts/keppler_ga_dashboard/view-selector2.js +196 -0
- data/installer/core/app/assets/javascripts/vue_admin/index.js +87 -0
- data/installer/core/app/assets/stylesheets/admin/application.scss +43 -0
- data/installer/core/app/assets/stylesheets/admin/components/layouts/_footer.scss +5 -0
- data/installer/core/app/assets/stylesheets/admin/components/layouts/_settings.scss +35 -0
- data/installer/core/app/assets/stylesheets/admin/components/module/_show.scss +0 -0
- data/installer/core/app/assets/stylesheets/admin/components/navigation/_navbar.scss +79 -0
- data/installer/core/app/assets/stylesheets/admin/components/navigation/_sidebar.scss +91 -0
- data/installer/core/app/assets/stylesheets/admin/components/paginator/_paginator.scss +53 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_devise.scss +162 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_files.scss +83 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_form.scss +163 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_header.scss +34 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_index.scss +331 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_listing.scss +29 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_navbar.scss +36 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_pageslide.scss +125 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_preloader.scss +283 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_search.scss +220 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_show.scss +17 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_sidebar.scss +64 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_switchs.scss +47 -0
- data/installer/core/app/assets/stylesheets/admin/pages/_themes.scss +74 -0
- data/installer/core/app/assets/stylesheets/admin/utils/_base.scss +66 -0
- data/installer/core/app/assets/stylesheets/admin/utils/_mixins.scss +26 -0
- data/installer/core/app/assets/stylesheets/admin/utils/_theme.scss +94 -0
- data/installer/core/app/assets/stylesheets/admin/utils/_variables.scss +79 -0
- data/installer/core/app/assets/stylesheets/app/application.scss +29 -0
- data/installer/core/app/assets/stylesheets/app/base/_base_project.scss +17 -0
- data/installer/core/app/assets/stylesheets/app/base/_typography.scss +1 -0
- data/installer/core/app/assets/stylesheets/app/components/_buttons.scss +0 -0
- data/installer/core/app/assets/stylesheets/app/components/_inputs.scss +0 -0
- data/installer/core/app/assets/stylesheets/app/components/_navbar.scss +21 -0
- data/installer/core/app/assets/stylesheets/app/layout/_container.scss +0 -0
- data/installer/core/app/assets/stylesheets/app/layout/_footer.scss +15 -0
- data/installer/core/app/assets/stylesheets/app/layout/_header.scss +0 -0
- data/installer/core/app/assets/stylesheets/app/pages/_front.sass +58 -0
- data/installer/core/app/assets/stylesheets/app/plugins/_bootstrap_override.scss +37 -0
- data/installer/core/app/assets/stylesheets/app/plugins/_font_awesome.scss +2 -0
- data/installer/core/app/assets/stylesheets/app/plugins/_keppler.scss +54 -0
- data/installer/core/app/assets/stylesheets/app/plugins/_npogress.scss +2 -0
- data/installer/core/app/assets/stylesheets/app/utils/_mixins.scss +18 -0
- data/installer/core/app/assets/stylesheets/app/utils/_variables.scss +28 -0
- data/installer/core/app/assets/stylesheets/errors/application.scss +3 -0
- data/installer/core/app/assets/stylesheets/errors/errors.scss +120 -0
- data/installer/core/app/assets/stylesheets/vendor/admin-lte/_skin-blue.scss +141 -0
- data/installer/core/app/controllers/admin/admin_controller.rb +72 -0
- data/installer/core/app/controllers/admin/customizes_controller.rb +109 -0
- data/installer/core/app/controllers/admin/meta_tags_controller.rb +124 -0
- data/installer/core/app/controllers/admin/scripts_controller.rb +131 -0
- data/installer/core/app/controllers/admin/settings_controller.rb +111 -0
- data/installer/core/app/controllers/admin/users_controller.rb +119 -0
- data/installer/core/app/controllers/app/app_controller.rb +23 -0
- data/installer/core/app/controllers/app/front_controller.rb +10 -0
- data/installer/core/app/controllers/application_controller.rb +96 -0
- data/installer/core/app/controllers/devise/sessions_controller.rb +104 -0
- data/installer/core/app/controllers/errors_controller.rb +28 -0
- data/installer/core/app/helpers/admin_helper.rb +117 -0
- data/installer/core/app/helpers/application_helper.rb +21 -0
- data/installer/core/app/helpers/customizes_helper.rb +2 -0
- data/installer/core/app/helpers/fronts_helper.rb +2 -0
- data/installer/core/app/helpers/scaffolds_helper.rb +2 -0
- data/installer/core/app/inputs/checkbox_material_input.rb +75 -0
- data/installer/core/app/inputs/file_material_input.rb +33 -0
- data/installer/core/app/mailers/application_mailer.rb +28 -0
- data/installer/core/app/models/appearance.rb +5 -0
- data/installer/core/app/models/application_record.rb +3 -0
- data/installer/core/app/models/concerns/activity_history.rb +9 -0
- data/installer/core/app/models/concerns/clone_record.rb +12 -0
- data/installer/core/app/models/customize.rb +154 -0
- data/installer/core/app/models/front.rb +2 -0
- data/installer/core/app/models/google_analytics_setting.rb +4 -0
- data/installer/core/app/models/meta_tag.rb +41 -0
- data/installer/core/app/models/role.rb +11 -0
- data/installer/core/app/models/script.rb +30 -0
- data/installer/core/app/models/setting.rb +17 -0
- data/installer/core/app/models/smtp_setting.rb +5 -0
- data/installer/core/app/models/social_account.rb +4 -0
- data/installer/core/app/models/user.rb +44 -0
- data/installer/core/app/policies/application_policy.rb +16 -0
- data/installer/core/app/policies/controller_policy.rb +53 -0
- data/installer/core/app/policies/customize_policy.rb +9 -0
- data/installer/core/app/policies/meta_tag_policy.rb +9 -0
- data/installer/core/app/policies/script_policy.rb +9 -0
- data/installer/core/app/policies/setting_policy.rb +9 -0
- data/installer/core/app/policies/user_policy.rb +17 -0
- data/installer/core/app/uploaders/attachment_uploader.rb +44 -0
- data/installer/core/app/uploaders/ckeditor_attachment_file_uploader.rb +36 -0
- data/installer/core/app/uploaders/ckeditor_picture_uploader.rb +47 -0
- data/installer/core/app/uploaders/template_uploader.rb +44 -0
- data/installer/core/app/views/admin/customizes/_description.html.haml +13 -0
- data/installer/core/app/views/admin/customizes/_form.html.haml +33 -0
- data/installer/core/app/views/admin/customizes/_listing.html.haml +15 -0
- data/installer/core/app/views/admin/customizes/_switch_default_template.html.haml +16 -0
- data/installer/core/app/views/admin/customizes/_switch_template.html.haml +22 -0
- data/installer/core/app/views/admin/customizes/index.html.haml +38 -0
- data/installer/core/app/views/admin/customizes/new.html.haml +4 -0
- data/installer/core/app/views/admin/layouts/_footer.html.haml +8 -0
- data/installer/core/app/views/admin/layouts/_head.html.haml +8 -0
- data/installer/core/app/views/admin/layouts/_header.html.haml +7 -0
- data/installer/core/app/views/admin/layouts/_listing_preloader.haml +5 -0
- data/installer/core/app/views/admin/layouts/_messages.html.haml +4 -0
- data/installer/core/app/views/admin/layouts/_navigation.html.haml +46 -0
- data/installer/core/app/views/admin/layouts/_preloader.html.haml +9 -0
- data/installer/core/app/views/admin/layouts/_search.html.haml +8 -0
- data/installer/core/app/views/admin/layouts/_sidebar.html.haml +63 -0
- data/installer/core/app/views/admin/layouts/application.html.haml +23 -0
- data/installer/core/app/views/admin/layouts/index/remote_messages.js.haml +9 -0
- data/installer/core/app/views/admin/meta_tags/_description.html.haml +13 -0
- data/installer/core/app/views/admin/meta_tags/_form.html.haml +57 -0
- data/installer/core/app/views/admin/meta_tags/_index_show.html.haml +26 -0
- data/installer/core/app/views/admin/meta_tags/_listing.html.haml +39 -0
- data/installer/core/app/views/admin/meta_tags/edit.html.haml +2 -0
- data/installer/core/app/views/admin/meta_tags/index.html.haml +80 -0
- data/installer/core/app/views/admin/meta_tags/new.html.haml +2 -0
- data/installer/core/app/views/admin/meta_tags/reload.js.haml +5 -0
- data/installer/core/app/views/admin/meta_tags/show.html.haml +29 -0
- data/installer/core/app/views/admin/meta_tags/show.js.haml +4 -0
- data/installer/core/app/views/admin/scripts/_description.html.haml +13 -0
- data/installer/core/app/views/admin/scripts/_form.html.haml +31 -0
- data/installer/core/app/views/admin/scripts/_index_show.html.haml +26 -0
- data/installer/core/app/views/admin/scripts/_listing.html.haml +42 -0
- data/installer/core/app/views/admin/scripts/edit.html.haml +1 -0
- data/installer/core/app/views/admin/scripts/index.html.haml +82 -0
- data/installer/core/app/views/admin/scripts/new.html.haml +1 -0
- data/installer/core/app/views/admin/scripts/reload.js.haml +5 -0
- data/installer/core/app/views/admin/scripts/show.html.haml +29 -0
- data/installer/core/app/views/admin/scripts/show.js.haml +4 -0
- data/installer/core/app/views/admin/settings/_form.html.haml +9 -0
- data/installer/core/app/views/admin/settings/components/_preview.html.haml +30 -0
- data/installer/core/app/views/admin/settings/edit.html.haml +4 -0
- data/installer/core/app/views/admin/settings/fields/_appearance.html.haml +62 -0
- data/installer/core/app/views/admin/settings/fields/_basic_information.html.haml +48 -0
- data/installer/core/app/views/admin/settings/fields/_email_setting.html.haml +17 -0
- data/installer/core/app/views/admin/settings/fields/_google_analytics_setting.html.haml +28 -0
- data/installer/core/app/views/admin/settings/fields/_social_accounts.html.haml +42 -0
- data/installer/core/app/views/admin/users/_description.html.haml +13 -0
- data/installer/core/app/views/admin/users/_form.html.haml +59 -0
- data/installer/core/app/views/admin/users/_index_show.html.haml +24 -0
- data/installer/core/app/views/admin/users/_listing.html.haml +49 -0
- data/installer/core/app/views/admin/users/edit.html.haml +1 -0
- data/installer/core/app/views/admin/users/index.html.haml +72 -0
- data/installer/core/app/views/admin/users/new.html.haml +1 -0
- data/installer/core/app/views/admin/users/reload.js.haml +5 -0
- data/installer/core/app/views/admin/users/show.html.haml +36 -0
- data/installer/core/app/views/admin/users/show.js.haml +4 -0
- data/installer/core/app/views/app/front/index.html.haml +180 -0
- data/installer/core/app/views/app/layouts/_footer.html.haml +3 -0
- data/installer/core/app/views/app/layouts/_google_analytics.html.haml +14 -0
- data/installer/core/app/views/app/layouts/_head.html.haml +22 -0
- data/installer/core/app/views/app/layouts/_messages.html.haml +6 -0
- data/installer/core/app/views/app/layouts/_meta_tags.html.haml +9 -0
- data/installer/core/app/views/app/layouts/_navigation.html.haml +13 -0
- data/installer/core/app/views/app/layouts/_navigation_links.html.haml +6 -0
- data/installer/core/app/views/app/layouts/application.html.haml +10 -0
- data/installer/core/app/views/application_mailer/testing.html.haml +1 -0
- data/installer/core/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/installer/core/app/views/devise/passwords/edit.html.haml +27 -0
- data/installer/core/app/views/devise/passwords/new.html.haml +22 -0
- data/installer/core/app/views/devise/registrations/edit.html.erb +48 -0
- data/installer/core/app/views/devise/registrations/new.html.erb +19 -0
- data/installer/core/app/views/devise/sessions/new.html.haml +30 -0
- data/installer/core/app/views/errors/internal_server_error.html.haml +7 -0
- data/installer/core/app/views/errors/not_authorized.html.haml +7 -0
- data/installer/core/app/views/errors/not_found.html.haml +7 -0
- data/installer/core/app/views/errors/unprocessable.html.haml +7 -0
- data/installer/core/app/views/kaminari/_first_page.html.haml +11 -0
- data/installer/core/app/views/kaminari/_gap.html.haml +8 -0
- data/installer/core/app/views/kaminari/_last_page.html.haml +11 -0
- data/installer/core/app/views/kaminari/_next_page.html.haml +11 -0
- data/installer/core/app/views/kaminari/_page.html.haml +10 -0
- data/installer/core/app/views/kaminari/_paginator.html.haml +18 -0
- data/installer/core/app/views/kaminari/_prev_page.html.haml +11 -0
- data/installer/core/app/views/keppler_ga_dashboard/dashboard/analytics.html.haml +600 -0
- data/installer/core/app/views/layouts/errors/_head.html.haml +3 -0
- data/installer/core/app/views/layouts/errors/application.html.haml +11 -0
- data/installer/core/app/views/layouts/mailers/mailer.html.haml +3 -0
- data/installer/core/app/views/layouts/mailers/mailer.text.haml +1 -0
- data/installer/core/app/views/layouts/templates/application.html.haml +1 -0
- data/installer/core/app/views/public_activity/layout/_create.html.haml +45 -0
- data/installer/core/app/views/public_activity/layout/_destroy.html.haml +15 -0
- data/installer/core/app/views/public_activity/layout/_update.html.haml +45 -0
- data/installer/core/app/views/public_activity/session/_create.html.haml +13 -0
- data/installer/core/app/views/public_activity/session/_destroy.html.haml +13 -0
- data/installer/core/app/views/templates/kaminari/_first_page.html.haml +9 -0
- data/installer/core/app/views/templates/kaminari/_gap.html.haml +8 -0
- data/installer/core/app/views/templates/kaminari/_last_page.html.haml +9 -0
- data/installer/core/app/views/templates/kaminari/_next_page.html.haml +9 -0
- data/installer/core/app/views/templates/kaminari/_page.html.haml +10 -0
- data/installer/core/app/views/templates/kaminari/_paginator.html.haml +18 -0
- data/installer/core/app/views/templates/kaminari/_prev_page.html.haml +9 -0
- data/installer/core/bin/bundle +3 -0
- data/installer/core/bin/rails +4 -0
- data/installer/core/bin/rake +4 -0
- data/installer/core/bin/setup +29 -0
- data/installer/core/bin/spring +15 -0
- data/installer/core/config.ru +4 -0
- data/installer/core/config/application.rb +46 -0
- data/installer/core/config/boot.rb +7 -0
- data/installer/core/config/database.yml +25 -0
- data/installer/core/config/environment.rb +10 -0
- data/installer/core/config/environments/development.rb +57 -0
- data/installer/core/config/environments/production.rb +105 -0
- data/installer/core/config/environments/test.rb +44 -0
- data/installer/core/config/gaAuth/gauth_key.p12 +0 -0
- data/installer/core/config/initializers/assets.rb +14 -0
- data/installer/core/config/initializers/cookies_serializer.rb +3 -0
- data/installer/core/config/initializers/date_formats.rb +2 -0
- data/installer/core/config/initializers/devise.rb +259 -0
- data/installer/core/config/initializers/filter_parameter_logging.rb +5 -0
- data/installer/core/config/initializers/inflections.rb +16 -0
- data/installer/core/config/initializers/keppler_configuration.rb +9 -0
- data/installer/core/config/initializers/mime_types.rb +6 -0
- data/installer/core/config/initializers/paginate_kaminari_configuration.rb +12 -0
- data/installer/core/config/initializers/rolify.rb +10 -0
- data/installer/core/config/initializers/route_traslator.rb +3 -0
- data/installer/core/config/initializers/session_store.rb +5 -0
- data/installer/core/config/initializers/simple_form.rb +170 -0
- data/installer/core/config/initializers/simple_form_bootstrap.rb +155 -0
- data/installer/core/config/initializers/time_formats.rb +2 -0
- data/installer/core/config/initializers/wrap_parameters.rb +15 -0
- data/installer/core/config/locales/devise.en.yml +61 -0
- data/installer/core/config/locales/devise.es.yml +62 -0
- data/installer/core/config/locales/en.yml +380 -0
- data/installer/core/config/locales/es.yml +420 -0
- data/installer/core/config/locales/routes.en.yml +4 -0
- data/installer/core/config/locales/routes.es.yml +5 -0
- data/installer/core/config/locales/simple_form.en.yml +45 -0
- data/installer/core/config/locales/simple_form.es.yml +95 -0
- data/installer/core/config/locales/social_share_button.es.yml +10 -0
- data/installer/core/config/menu.yml +53 -0
- data/installer/core/config/puma.rb +56 -0
- data/installer/core/config/routes.rb +94 -0
- data/installer/core/config/sitemap.rb +27 -0
- data/installer/core/config/spring.rb +6 -0
- data/installer/core/db/migrate/20140812203549_devise_create_users.rb +50 -0
- data/installer/core/db/migrate/20140812210925_rolify_create_roles.rb +19 -0
- data/installer/core/db/migrate/20151221173228_create_activities.rb +23 -0
- data/installer/core/db/migrate/20160122201215_create_settings.rb +15 -0
- data/installer/core/db/migrate/20160126141856_create_smtp_settings.rb +14 -0
- data/installer/core/db/migrate/20160128131802_create_scripts.rb +11 -0
- data/installer/core/db/migrate/20160128151351_create_google_analytics_settings.rb +12 -0
- data/installer/core/db/migrate/20160128193740_create_social_accounts.rb +25 -0
- data/installer/core/db/migrate/20160201134918_create_meta_tags.rb +13 -0
- data/installer/core/db/migrate/20160201210520_create_appearances.rb +11 -0
- data/installer/core/db/migrate/20170603145521_create_customizes.rb +10 -0
- data/installer/core/db/migrate/20171225023933_create_scaffolds.rb +10 -0
- data/installer/core/db/schema.rb +172 -0
- data/installer/core/db/seeds.rb +45 -0
- data/installer/core/lib/generators/keppler_front/keppler_front_generator.rb +139 -0
- data/installer/core/lib/generators/keppler_front/templates/controllers/controller.rb +17 -0
- data/installer/core/lib/generators/keppler_front/templates/views/template.html.haml +180 -0
- data/installer/core/lib/generators/keppler_relation/keppler_relation_generator.rb +219 -0
- data/installer/core/lib/generators/keppler_scaffold/keppler_scaffold_generator.rb +240 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/controllers/controller.rb +143 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/models/model.rb +41 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/policies/policy.rb +9 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/_description.html.haml +13 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/_form.html.haml +60 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/_index_show.html.haml +24 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/_listing.html.haml +64 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/edit.html.haml +1 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/index.html.haml +97 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/new.html.haml +1 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/reload.js.haml +5 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/show.html.haml +65 -0
- data/installer/core/lib/generators/keppler_scaffold/templates/views/show.js.haml +4 -0
- data/installer/core/lib/keppler_configuration.rb +12 -0
- data/installer/core/lib/templates/haml/scaffold/_form.html.haml +10 -0
- data/installer/core/plugins/keppler_ga_dashboard/Gemfile +15 -0
- data/installer/core/plugins/keppler_ga_dashboard/MIT-LICENSE +20 -0
- data/installer/core/plugins/keppler_ga_dashboard/README.md +51 -0
- data/installer/core/plugins/keppler_ga_dashboard/Rakefile +37 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/assets/javascripts/keppler_ga_dashboard/active-users.js +64 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/assets/javascripts/keppler_ga_dashboard/active-users.js.map +1 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/assets/javascripts/keppler_ga_dashboard/dashboard.coffee +13 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/assets/javascripts/keppler_ga_dashboard/date-range-selector.js +2 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/assets/javascripts/keppler_ga_dashboard/date-range-selector.js.map +1 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/assets/javascripts/keppler_ga_dashboard/view-selector2.js +196 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/assets/javascripts/keppler_ga_dashboard/view-selector2.js.map +1 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/assets/stylesheets/dashboard.scss +83 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/controllers/keppler_ga_dashboard/dashboard_controller.rb +48 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/helpers/keppler_ga_dashboard/application_helper.rb +4 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/helpers/keppler_ga_dashboard/dashboard_helper.rb +14 -0
- data/installer/core/plugins/keppler_ga_dashboard/app/views/keppler_ga_dashboard/dashboard/analytics.html.haml +359 -0
- data/installer/core/plugins/keppler_ga_dashboard/bin/rails +12 -0
- data/installer/core/plugins/keppler_ga_dashboard/config/menu.yml +6 -0
- data/installer/core/plugins/keppler_ga_dashboard/config/routes.rb +3 -0
- data/installer/core/plugins/keppler_ga_dashboard/keppler_ga_dashboard.gemspec +22 -0
- data/installer/core/plugins/keppler_ga_dashboard/lib/keppler_ga_dashboard.rb +10 -0
- data/installer/core/plugins/keppler_ga_dashboard/lib/keppler_ga_dashboard/engine.rb +5 -0
- data/installer/core/plugins/keppler_ga_dashboard/lib/keppler_ga_dashboard/tasks/install.rb +58 -0
- data/installer/core/plugins/keppler_ga_dashboard/lib/keppler_ga_dashboard/version.rb +3 -0
- data/installer/core/plugins/keppler_ga_dashboard/lib/tasks/keppler_ga_dashboard_tasks.rake +13 -0
- data/installer/core/public/favicon.ico +0 -0
- data/installer/core/public/humans.txt +20 -0
- data/installer/core/public/robots.txt +5 -0
- data/installer/core/test/controllers/admin_controller_test.rb +11 -0
- data/installer/core/test/controllers/errors_controller_test.rb +24 -0
- data/installer/core/test/controllers/frontend_controller_test.rb +9 -0
- data/installer/core/test/controllers/fronts_controller_test.rb +49 -0
- data/installer/core/test/controllers/meta_tags_controller_test.rb +49 -0
- data/installer/core/test/controllers/scaffolds_controller_test.rb +49 -0
- data/installer/core/test/controllers/scripts_controller_test.rb +49 -0
- data/installer/core/test/controllers/settings_controller_test.rb +49 -0
- data/installer/core/test/controllers/users_controller_test.rb +18 -0
- data/installer/core/test/fixtures/appearances.yml +11 -0
- data/installer/core/test/fixtures/caches.yml +7 -0
- data/installer/core/test/fixtures/fronts.yml +7 -0
- data/installer/core/test/fixtures/google_adwords.yml +13 -0
- data/installer/core/test/fixtures/google_analytics_settings.yml +13 -0
- data/installer/core/test/fixtures/meta_tags.yml +13 -0
- data/installer/core/test/fixtures/roles.yml +11 -0
- data/installer/core/test/fixtures/scaffolds.yml +9 -0
- data/installer/core/test/fixtures/scripts.yml +11 -0
- data/installer/core/test/fixtures/settings.yml +13 -0
- data/installer/core/test/fixtures/smtp_settings.yml +17 -0
- data/installer/core/test/fixtures/social_accounts.yml +39 -0
- data/installer/core/test/fixtures/users.yml +10 -0
- data/installer/core/test/helpers/admin_helper_test.rb +4 -0
- data/installer/core/test/helpers/frontend_helper_test.rb +4 -0
- data/installer/core/test/mailers/application_mailer_test.rb +7 -0
- data/installer/core/test/mailers/previews/application_mailer_preview.rb +4 -0
- data/installer/core/test/models/apparence_test.rb +7 -0
- data/installer/core/test/models/cache_test.rb +7 -0
- data/installer/core/test/models/front_test.rb +7 -0
- data/installer/core/test/models/google_analytics_setting_test.rb +7 -0
- data/installer/core/test/models/meta_tag_test.rb +7 -0
- data/installer/core/test/models/role_test.rb +7 -0
- data/installer/core/test/models/scaffold_test.rb +7 -0
- data/installer/core/test/models/script_test.rb +7 -0
- data/installer/core/test/models/setting_test.rb +7 -0
- data/installer/core/test/models/smtp_setting_test.rb +7 -0
- data/installer/core/test/models/social_account_test.rb +7 -0
- data/installer/core/test/models/user_test.rb +7 -0
- data/installer/core/test/test_helper.rb +16 -0
- data/installer/core/vendor/assets/javascripts/bounce.min.js +5 -0
- data/installer/db_conf/conf.yml +50 -0
- data/installer/lib/conf.rb +31 -0
- data/installer/lib/scaffold.rb +10 -0
- data/installer/run.sh +19 -0
- data/installer/scripts/bin.sh +61 -0
- data/lib/keppler.rb +7 -0
- data/lib/keppler/cli.rb +12 -0
- data/lib/keppler/cli/generate.rb +19 -0
- data/lib/keppler/version.rb +3 -0
- metadata +497 -0
@@ -0,0 +1 @@
|
|
1
|
+
= render 'form'
|
@@ -0,0 +1,5 @@
|
|
1
|
+
$('#objects-container').html("#{j render 'listing', objects: @objects}");
|
2
|
+
$('#objects-container').css('opacity', '0');
|
3
|
+
$('#spinner2').css('display', 'block');
|
4
|
+
var request = $.ajax({url: "/admin/<%= plural_table_name %>", method: "get", dataType: "html"});
|
5
|
+
request.done(function(msg){$('#spinner2').css('display', 'none');$('#objects-container').css('opacity', '1');});
|
@@ -0,0 +1,65 @@
|
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
.col-lg-2
|
4
|
+
= link_to admin_<%= plural_table_name %>_path, class: "", "data-position" => "bottom", "data-tooltip" => t("keppler.actions.back") do
|
5
|
+
.arrow-back.btn.btn-default
|
6
|
+
%i.fa.fa-angle-left
|
7
|
+
= t('keppler.actions.back')
|
8
|
+
|
9
|
+
.show-section
|
10
|
+
.row
|
11
|
+
<%- if attributes.select{|attribute| @attachments.include?(attribute.name)}.size <= 0 -%>
|
12
|
+
.col-lg-12
|
13
|
+
.box.slice-box
|
14
|
+
.box-header.with-border
|
15
|
+
%h3.box-title= t("keppler.modules.#{controller_path.underscore}")
|
16
|
+
.box-tools.pull-right
|
17
|
+
- if Pundit.policy(current_user, <%= singular_table_name.camelcase %>).update?
|
18
|
+
= link_to edit_admin_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: "btn btn-box-tool", title: "#{t('keppler.actions.edit') }" do
|
19
|
+
%i.icon-pencil
|
20
|
+
- if Pundit.policy(current_user, <%= singular_table_name.camelcase %>).destroy?
|
21
|
+
= link_to admin_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: "btn btn-box-tool", title: "#{t('keppler.actions.delete')}", method: :delete, data: { confirm: t("keppler.messages.data_confirm") } do
|
22
|
+
%i.icon-trash
|
23
|
+
.box-body.box-body-no-padding
|
24
|
+
%table.table.table-striped
|
25
|
+
%tbody
|
26
|
+
- @<%= singular_table_name %>.as_json(only: <%= attributes.map{|attr| attr.name} %>).each do |attribute, value|
|
27
|
+
%tr.list-row
|
28
|
+
%th.display-label= t("activerecord.attributes.#{attribute}")
|
29
|
+
%td.display-value.fs-body-1.tc-black-2
|
30
|
+
- if @attachments.include?(attribute)
|
31
|
+
= image_tag value
|
32
|
+
- else
|
33
|
+
= value
|
34
|
+
<%- else -%>
|
35
|
+
<%- @attr = attributes.map{|attr| attr.name}.select{|attr| @attachments.include?(attr)} %>
|
36
|
+
.col-lg-5
|
37
|
+
- @<%= singular_table_name %>.as_json(only: <%= @attr %>).each do |attribute, value|
|
38
|
+
.box.slice-box
|
39
|
+
.box-header.with-border
|
40
|
+
%h3.box-title= attribute.capitalize
|
41
|
+
.box-tools.pull-right
|
42
|
+
%a.btn.btn-box-tool{"data-widget" => "collapse", type: "button"}
|
43
|
+
%i.fa.fa-minus
|
44
|
+
.box-body.box-body-no-padding
|
45
|
+
= image_tag value, class: 'img-show'
|
46
|
+
.col-lg-7
|
47
|
+
.box.slice-box
|
48
|
+
.box-header.with-border
|
49
|
+
%h3.box-title= t("keppler.modules.#{controller_path.underscore}")
|
50
|
+
.box-tools.pull-right
|
51
|
+
= link_to edit_admin_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: "btn btn-box-tool", title: "#{t('keppler.actions.edit') }" do
|
52
|
+
%i.icon-pencil
|
53
|
+
= link_to admin_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: "btn btn-box-tool", title: "#{t('keppler.actions.delete')}", method: :delete, data: { confirm: t("keppler.messages.data_confirm") } do
|
54
|
+
%i.icon-trash
|
55
|
+
%a.btn.btn-box-tool{"data-widget" => "collapse", type: "button"}
|
56
|
+
%i.fa.fa-minus
|
57
|
+
.box-body.box-body-no-padding
|
58
|
+
%table.table.table-striped
|
59
|
+
%tbody
|
60
|
+
- @<%= singular_table_name %>.as_json(only: <%= attributes.map{|attr| attr.name}.select{|attr| !@attachments.include?(attr)} %>).each do |attribute, value|
|
61
|
+
%tr.list-row
|
62
|
+
%th.display-label= t("activerecord.attributes.#{attribute}")
|
63
|
+
%td.display-value.fs-body-1.tc-black-2
|
64
|
+
= value
|
65
|
+
<%- end -%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# KepplerConfiguration Config
|
2
|
+
module KepplerConfiguration
|
3
|
+
# KepplerConfiguration
|
4
|
+
class << self
|
5
|
+
mattr_accessor :skip_module_devise, :default_per_page, :visible_models
|
6
|
+
end
|
7
|
+
|
8
|
+
# this function maps the vars from your app into your engine
|
9
|
+
def self.setup
|
10
|
+
yield self
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
= simple_form_for(@<%= singular_table_name %>) do |f|
|
2
|
+
= f.error_notification
|
3
|
+
|
4
|
+
.form-inputs
|
5
|
+
<%- attributes.each do |attribute| -%>
|
6
|
+
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
|
7
|
+
<%- end -%>
|
8
|
+
|
9
|
+
.form-actions
|
10
|
+
= f.button :submit
|
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in keppler_ga_dashboard.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use a debugger
|
14
|
+
# gem 'byebug', group: [:development, :test]
|
15
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 Keppler Admin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,51 @@
|
|
1
|
+
### Keppler google analytics dashboard v1.0.0
|
2
|
+
|
3
|
+
Engine integrado con google analytics que proporiciona un dashboard agradable, presentando algunas metricas sobre las visitas.
|
4
|
+
|
5
|
+
## Requerimientos
|
6
|
+
|
7
|
+
* keppler-admin >= 1.0
|
8
|
+
|
9
|
+
### Instalación
|
10
|
+
|
11
|
+
Añadir a su Gemfile
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'keppler_ga_dashboard', git: 'https://github.com/SliceDevelopers/keppler_ga_dashboard.git', tag: "1.0.0"
|
15
|
+
gem 'google-api-client'
|
16
|
+
```
|
17
|
+
|
18
|
+
Añadir la siguiente linea a su manifesto stylesheets `application.scss`
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
@import 'dashboard'
|
22
|
+
```
|
23
|
+
|
24
|
+
Añadir la siguiente ruta a su archivo `routes.rb`
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
mount KepplerGaDashboard::Engine, :at => '', as: 'dashboard'
|
28
|
+
```
|
29
|
+
|
30
|
+
### Configuración
|
31
|
+
|
32
|
+
El engine necesita que el usuario cree una api para google analitycs, esto lo puedes conseguir desde (https://console.developers.google.com), debes crear un proyecto, luego crear un cliente y selecionar la opción **cuenta de servicio**, una vez creado hay que generar una calve p12 y guardar el archivo en el directorio `config/gaAuth` de su app.
|
33
|
+
|
34
|
+
Luego de haber realizado esto debe agregar los datos de configuración en `secrets.yml` bajo la siguiente configuracion:
|
35
|
+
|
36
|
+
```yml
|
37
|
+
ga_auth:
|
38
|
+
:service_account_email_address: "dirección de correo electronico generada por la api"
|
39
|
+
:file_key_name: "nombre del archio p12 generado por la api"
|
40
|
+
:account_id: "id de la cuenta de google analytics"
|
41
|
+
```
|
42
|
+
|
43
|
+
**Nota:** *Asegurese de darle permisos a la api desde su cuenta de google analitycs*
|
44
|
+
|
45
|
+
### Vista
|
46
|
+
|
47
|
+
Para copiar las vista a tu proyecto y asi personalizarlas para adaptarlas y agregar nuevos reportes, debe ejecutar
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
rake dashboard:copy_views
|
51
|
+
```
|
@@ -0,0 +1,37 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'KepplerGaDashboard'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
@@ -0,0 +1,64 @@
|
|
1
|
+
! function(t) {
|
2
|
+
function e(s) {
|
3
|
+
if (i[s]) return i[s].exports;
|
4
|
+
var r = i[s] = {
|
5
|
+
exports: {},
|
6
|
+
id: s,
|
7
|
+
loaded: !1
|
8
|
+
};
|
9
|
+
return t[s].call(r.exports, r, r.exports, e), r.loaded = !0, r.exports
|
10
|
+
}
|
11
|
+
var i = {};
|
12
|
+
return e.m = t, e.c = i, e.p = "", e(0)
|
13
|
+
}([function(t, e, i) {
|
14
|
+
"use strict";
|
15
|
+
gapi.analytics.ready(function() {
|
16
|
+
gapi.analytics.createComponent("ActiveUsers", {
|
17
|
+
initialize: function() {
|
18
|
+
this.activeUsers = 0
|
19
|
+
},
|
20
|
+
execute: function() {
|
21
|
+
this.polling_ && this.stop(), this.render_(), gapi.analytics.auth.isAuthorized() ? this.getActiveUsers_() : gapi.analytics.auth.once("success", this.getActiveUsers_.bind(this))
|
22
|
+
},
|
23
|
+
stop: function() {
|
24
|
+
clearTimeout(this.timeout_), this.polling_ = !1, this.emit("stop", {
|
25
|
+
activeUsers: this.activeUsers
|
26
|
+
})
|
27
|
+
},
|
28
|
+
render_: function() {
|
29
|
+
var t = this.get();
|
30
|
+
this.container = "string" == typeof t.container ? document.getElementById(t.container) : t.container, this.container.innerHTML = t.template || this.template, this.container.querySelector("b").innerHTML = this.activeUsers
|
31
|
+
},
|
32
|
+
getActiveUsers_: function() {
|
33
|
+
var t = this.get(),
|
34
|
+
e = 1e3 * (t.pollingInterval || 5);
|
35
|
+
if (isNaN(e) || 5e3 > e) throw new Error("Frequency must be 5 seconds or more.");
|
36
|
+
this.polling_ = !0, gapi.client.analytics.data.realtime.get({
|
37
|
+
ids: t.ids,
|
38
|
+
metrics: "rt:activeUsers"
|
39
|
+
}).execute(function(t) {
|
40
|
+
var i = t.totalResults ? +t.rows[0][0] : 0,
|
41
|
+
s = this.activeUsers;
|
42
|
+
this.emit("success", {
|
43
|
+
activeUsers: this.activeUsers
|
44
|
+
}), i != s && (this.activeUsers = i, this.onChange_(i - s)), (this.polling_ = !0) && (this.timeout_ = setTimeout(this.getActiveUsers_.bind(this), e))
|
45
|
+
}.bind(this))
|
46
|
+
},
|
47
|
+
onChange_: function(t) {
|
48
|
+
var e = this.container.querySelector("b");
|
49
|
+
e && (e.innerHTML = this.activeUsers), this.emit("change", {
|
50
|
+
activeUsers: this.activeUsers,
|
51
|
+
delta: t
|
52
|
+
}), t > 0 ? this.emit("increase", {
|
53
|
+
activeUsers: this.activeUsers,
|
54
|
+
delta: t
|
55
|
+
}) : this.emit("decrease", {
|
56
|
+
activeUsers: this.activeUsers,
|
57
|
+
delta: t
|
58
|
+
})
|
59
|
+
},
|
60
|
+
template: '<div class="ActiveUsers">Usuarios activos: <b class="ActiveUsers-value"></b></div>'
|
61
|
+
})
|
62
|
+
})
|
63
|
+
}]);
|
64
|
+
//# sourceMappingURL=active-users.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["webpack:///active-users.js","webpack:///webpack/bootstrap 0853746ae09c5b7c1eb6","webpack:///./src/javascript/embed-api/components/active-users.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","gapi","analytics","ready","createComponent","initialize","this","activeUsers","execute","polling_","stop","render_","auth","isAuthorized","getActiveUsers_","once","bind","clearTimeout","timeout_","emit","opts","get","container","document","getElementById","innerHTML","template","querySelector","options","pollingInterval","isNaN","Error","client","data","realtime","ids","metrics","response","newValue","totalResults","rows","oldValue","onChange_","setTimeout","delta","valueContainer"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,QAAA,EAGAF,EAAAD,QAvBA,GAAAD,KAqCA,OATAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,GAGAV,EAAA,KDMM,SAASI,EAAQD,EAASH,GAkB/B,YE7CDW,MAAKC,UAAUC,MAAM,WAEnBF,KAAKC,UAAUE,gBAAgB,eAE7BC,WAAY,WACVC,KAAKC,YAAc,GAGrBC,QAAS,WAEHF,KAAKG,UACPH,KAAKI,OAGPJ,KAAKK,UAGDV,KAAKC,UAAUU,KAAKC,eACtBP,KAAKQ,kBAGLb,KAAKC,UAAUU,KAAKG,KAAK,UAAWT,KAAKQ,gBAAgBE,KAAKV,QAIlEI,KAAM,WACJO,aAAaX,KAAKY,UAClBZ,KAAKG,UAAW,EAChBH,KAAKa,KAAK,QAASZ,YAAaD,KAAKC,eAGvCI,QAAS,WACP,GAAIS,GAAOd,KAAKe,KAGhBf,MAAKgB,UAAqC,gBAAlBF,GAAKE,UACzBC,SAASC,eAAeJ,EAAKE,WAAaF,EAAKE,UAEnDhB,KAAKgB,UAAUG,UAAYL,EAAKM,UAAYpB,KAAKoB,SACjDpB,KAAKgB,UAAUK,cAAc,KAAKF,UAAYnB,KAAKC,aAGrDO,gBAAiB,WACf,GAAIc,GAAUtB,KAAKe,MACfQ,EAAmD,KAAhCD,EAAQC,iBAAmB,EAElD,IAAIC,MAAMD,IAAsC,IAAlBA,EAC5B,KAAM,IAAIE,OAAM,uCAGlBzB,MAAKG,UAAW,EAChBR,KAAK+B,OAAO9B,UAAU+B,KAAKC,SACxBb,KAAKc,IAAIP,EAAQO,IAAKC,QAAQ,mBAC9B5B,QAAQ,SAAS6B,GAEhB,GAAIC,GAAWD,EAASE,cAAgBF,EAASG,KAAK,GAAG,GAAK,EAC1DC,EAAWnC,KAAKC,WAEpBD,MAAKa,KAAK,WAAYZ,YAAaD,KAAKC,cAEpC+B,GAAYG,IACdnC,KAAKC,YAAc+B,EACnBhC,KAAKoC,UAAUJ,EAAWG,KAGxBnC,KAAKG,UAAW,KAClBH,KAAKY,SAAWyB,WAAWrC,KAAKQ,gBAAgBE,KAAKV,MACjDuB,KAENb,KAAKV,QAGXoC,UAAW,SAASE,GAClB,GAAIC,GAAiBvC,KAAKgB,UAAUK,cAAc,IAC9CkB,KAAgBA,EAAepB,UAAYnB,KAAKC,aAEpDD,KAAKa,KAAK,UAAWZ,YAAaD,KAAKC,YAAaqC,MAAOA,IACvDA,EAAQ,EACVtC,KAAKa,KAAK,YAAaZ,YAAaD,KAAKC,YAAaqC,MAAOA,IAG7DtC,KAAKa,KAAK,YAAaZ,YAAaD,KAAKC,YAAaqC,MAAOA,KAIjElB,SACE","file":"active-users.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t// Copyright 2014 Google Inc. All rights reserved.\n\t//\n\t// Licensed under the Apache License, Version 2.0 (the \"License\");\n\t// you may not use this file except in compliance with the License.\n\t// You may obtain a copy of the License at\n\t//\n\t// http://www.apache.org/licenses/LICENSE-2.0\n\t//\n\t// Unless required by applicable law or agreed to in writing, software\n\t// distributed under the License is distributed on an \"AS IS\" BASIS,\n\t// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\t// See the License for the specific language governing permissions and\n\t// limitations under the License.\n\t\n\t/* global gapi */\n\t\n\t'use strict';\n\t\n\tgapi.analytics.ready(function () {\n\t\n\t gapi.analytics.createComponent('ActiveUsers', {\n\t\n\t initialize: function initialize() {\n\t this.activeUsers = 0;\n\t },\n\t\n\t execute: function execute() {\n\t // Stop any polling currently going on.\n\t if (this.polling_) {\n\t this.stop();\n\t }\n\t\n\t this.render_();\n\t\n\t // Wait until the user is authorized.\n\t if (gapi.analytics.auth.isAuthorized()) {\n\t this.getActiveUsers_();\n\t } else {\n\t gapi.analytics.auth.once('success', this.getActiveUsers_.bind(this));\n\t }\n\t },\n\t\n\t stop: function stop() {\n\t clearTimeout(this.timeout_);\n\t this.polling_ = false;\n\t this.emit('stop', { activeUsers: this.activeUsers });\n\t },\n\t\n\t render_: function render_() {\n\t var opts = this.get();\n\t\n\t // Render the component inside the container.\n\t this.container = typeof opts.container == 'string' ? document.getElementById(opts.container) : opts.container;\n\t\n\t this.container.innerHTML = opts.template || this.template;\n\t this.container.querySelector('b').innerHTML = this.activeUsers;\n\t },\n\t\n\t getActiveUsers_: function getActiveUsers_() {\n\t var options = this.get();\n\t var pollingInterval = (options.pollingInterval || 5) * 1000;\n\t\n\t if (isNaN(pollingInterval) || pollingInterval < 5000) {\n\t throw new Error('Frequency must be 5 seconds or more.');\n\t }\n\t\n\t this.polling_ = true;\n\t gapi.client.analytics.data.realtime.get({ ids: options.ids, metrics: 'rt:activeUsers' }).execute((function (response) {\n\t\n\t var newValue = response.totalResults ? +response.rows[0][0] : 0;\n\t var oldValue = this.activeUsers;\n\t\n\t this.emit('success', { activeUsers: this.activeUsers });\n\t\n\t if (newValue != oldValue) {\n\t this.activeUsers = newValue;\n\t this.onChange_(newValue - oldValue);\n\t }\n\t\n\t if (this.polling_ = true) {\n\t this.timeout_ = setTimeout(this.getActiveUsers_.bind(this), pollingInterval);\n\t }\n\t }).bind(this));\n\t },\n\t\n\t onChange_: function onChange_(delta) {\n\t var valueContainer = this.container.querySelector('b');\n\t if (valueContainer) valueContainer.innerHTML = this.activeUsers;\n\t\n\t this.emit('change', { activeUsers: this.activeUsers, delta: delta });\n\t if (delta > 0) {\n\t this.emit('increase', { activeUsers: this.activeUsers, delta: delta });\n\t } else {\n\t this.emit('decrease', { activeUsers: this.activeUsers, delta: delta });\n\t }\n\t },\n\t\n\t template: '<div class=\"ActiveUsers\">' + 'Active Users: <b class=\"ActiveUsers-value\"></b>' + '</div>'\n\t\n\t });\n\t});\n\n/***/ }\n/******/ ]);\n\n\n/** WEBPACK FOOTER **\n ** active-users.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 0853746ae09c5b7c1eb6\n **/","// Copyright 2014 Google Inc. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n/* global gapi */\n\ngapi.analytics.ready(function() {\n\n gapi.analytics.createComponent('ActiveUsers', {\n\n initialize: function() {\n this.activeUsers = 0;\n },\n\n execute: function() {\n // Stop any polling currently going on.\n if (this.polling_) {\n this.stop();\n }\n\n this.render_();\n\n // Wait until the user is authorized.\n if (gapi.analytics.auth.isAuthorized()) {\n this.getActiveUsers_();\n }\n else {\n gapi.analytics.auth.once('success', this.getActiveUsers_.bind(this));\n }\n },\n\n stop: function() {\n clearTimeout(this.timeout_);\n this.polling_ = false;\n this.emit('stop', {activeUsers: this.activeUsers});\n },\n\n render_: function() {\n var opts = this.get();\n\n // Render the component inside the container.\n this.container = typeof opts.container == 'string' ?\n document.getElementById(opts.container) : opts.container;\n\n this.container.innerHTML = opts.template || this.template;\n this.container.querySelector('b').innerHTML = this.activeUsers;\n },\n\n getActiveUsers_: function() {\n var options = this.get();\n var pollingInterval = (options.pollingInterval || 5) * 1000;\n\n if (isNaN(pollingInterval) || pollingInterval < 5000) {\n throw new Error('Frequency must be 5 seconds or more.');\n }\n\n this.polling_ = true;\n gapi.client.analytics.data.realtime\n .get({ids:options.ids, metrics:'rt:activeUsers'})\n .execute(function(response) {\n\n var newValue = response.totalResults ? +response.rows[0][0] : 0;\n var oldValue = this.activeUsers;\n\n this.emit('success', {activeUsers: this.activeUsers});\n\n if (newValue != oldValue) {\n this.activeUsers = newValue;\n this.onChange_(newValue - oldValue);\n }\n\n if (this.polling_ = true) {\n this.timeout_ = setTimeout(this.getActiveUsers_.bind(this),\n pollingInterval);\n }\n }.bind(this));\n },\n\n onChange_: function(delta) {\n var valueContainer = this.container.querySelector('b');\n if (valueContainer) valueContainer.innerHTML = this.activeUsers;\n\n this.emit('change', {activeUsers: this.activeUsers, delta: delta});\n if (delta > 0) {\n this.emit('increase', {activeUsers: this.activeUsers, delta: delta});\n }\n else {\n this.emit('decrease', {activeUsers: this.activeUsers, delta: delta});\n }\n },\n\n template:\n '<div class=\"ActiveUsers\">' +\n 'Active Users: <b class=\"ActiveUsers-value\"></b>' +\n '</div>'\n\n });\n\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/javascript/embed-api/components/active-users.js\n **/"],"sourceRoot":""}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(t){function e(s){if(i[s])return i[s].exports;var a=i[s]={exports:{},id:s,loaded:!1};return t[s].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";gapi.analytics.ready(function(){function t(t){if(s.test(t))return t;var a=i.exec(t);if(a)return e(+a[1]);if("today"==t)return e(0);if("yesterday"==t)return e(1);throw new Error("Cannot convert date "+t)}function e(t){var e=new Date;e.setDate(e.getDate()-t);var i=String(e.getMonth()+1);i=1==i.length?"0"+i:i;var s=String(e.getDate());return s=1==s.length?"0"+s:s,e.getFullYear()+"-"+i+"-"+s}var i=/(\d+)daysAgo/,s=/\d{4}\-\d{2}\-\d{2}/;gapi.analytics.createComponent("DateRangeSelector",{execute:function(){var e=this.get();e["start-date"]=e["start-date"]||"7daysAgo",e["end-date"]=e["end-date"]||"yesterday",this.container="string"==typeof e.container?document.getElementById(e.container):e.container,e.template&&(this.template=e.template),this.container.innerHTML=this.template;var i=this.container.querySelectorAll("input");return this.startDateInput=i[0],this.startDateInput.value=t(e["start-date"]),this.endDateInput=i[1],this.endDateInput.value=t(e["end-date"]),this.setValues(),this.setMinMax(),this.container.onchange=this.onChange.bind(this),this},onChange:function(){this.setValues(),this.setMinMax(),this.emit("change",{"start-date":this["start-date"],"end-date":this["end-date"]})},setValues:function(){this["start-date"]=this.startDateInput.value,this["end-date"]=this.endDateInput.value},setMinMax:function(){this.startDateInput.max=this.endDateInput.value,this.endDateInput.min=this.startDateInput.value},template:'<div class="DateRangeSelector"> <div class="DateRangeSelector-item"> <label>Start Date</label> <input type="date"> </div> <div class="DateRangeSelector-item"> <label>End Date</label> <input type="date"> </div></div>'})})}]);
|
2
|
+
//# sourceMappingURL=date-range-selector.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["webpack:///date-range-selector.js","webpack:///webpack/bootstrap 0853746ae09c5b7c1eb6?7fc4","webpack:///./src/javascript/embed-api/components/date-range-selector.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","gapi","analytics","ready","convertDate","str","dateFormat","test","match","nDaysAgo","exec","daysAgo","Error","numDays","date","Date","setDate","getDate","month","String","getMonth","length","day","getFullYear","createComponent","execute","options","this","get","container","document","getElementById","template","innerHTML","dateInputs","querySelectorAll","startDateInput","value","endDateInput","setValues","setMinMax","onchange","onChange","bind","emit","start-date","end-date","max","min"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,QAAA,EAGAF,EAAAD,QAvBA,GAAAD,KAqCA,OATAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,GAGAV,EAAA,KDMM,SAASI,EAAQD,EAASH,GAqB/B,YE7CDW,MAAKC,UAAUC,MAAM,WAWnB,QAASC,GAAYC,GAEnB,GAAIC,EAAWC,KAAKF,GAAM,MAAOA,EAEjC,IAAIG,GAAQC,EAASC,KAAKL,EAC1B,IAAIG,EACF,MAAOG,IAASH,EAAM,GACjB,IAAW,SAAPH,EACT,MAAOM,GAAQ,EACV,IAAW,aAAPN,EACT,MAAOM,GAAQ,EAEf,MAAM,IAAIC,OAAM,uBAAyBP,GAS7C,QAASM,GAAQE,GACf,GAAIC,GAAO,GAAIC,KACfD,GAAKE,QAAQF,EAAKG,UAAYJ,EAC9B,IAAIK,GAAQC,OAAOL,EAAKM,WAAa,EACrCF,GAAwB,GAAhBA,EAAMG,OAAc,IAAMH,EAAOA,CACzC,IAAII,GAAMH,OAAOL,EAAKG,UAEtB,OADAK,GAAoB,GAAdA,EAAID,OAAc,IAAMC,EAAKA,EAC5BR,EAAKS,cAAgB,IAAML,EAAQ,IAAMI,EArClD,GAAIb,GAAW,eACXH,EAAa,qBAuCjBL,MAAKC,UAAUsB,gBAAgB,qBAM7BC,QAAS,WACP,GAAIC,GAAUC,KAAKC,KACnBF,GAAQ,cAAgBA,EAAQ,eAAiB,WACjDA,EAAQ,YAAcA,EAAQ,aAAe,YAG7CC,KAAKE,UAAwC,gBAArBH,GAAQG,UAC9BC,SAASC,eAAeL,EAAQG,WAAaH,EAAQG,UAGnDH,EAAQM,WAAUL,KAAKK,SAAWN,EAAQM,UAE9CL,KAAKE,UAAUI,UAAYN,KAAKK,QAChC,IAAIE,GAAaP,KAAKE,UAAUM,iBAAiB,QAWjD,OATAR,MAAKS,eAAiBF,EAAW,GACjCP,KAAKS,eAAeC,MAAQjC,EAAYsB,EAAQ,eAChDC,KAAKW,aAAeJ,EAAW,GAC/BP,KAAKW,aAAaD,MAAQjC,EAAYsB,EAAQ,aAE9CC,KAAKY,YACLZ,KAAKa,YAELb,KAAKE,UAAUY,SAAWd,KAAKe,SAASC,KAAKhB,MACtCA,MAOTe,SAAU,WACRf,KAAKY,YACLZ,KAAKa,YACLb,KAAKiB,KAAK,UACRC,aAAclB,KAAK,cACnBmB,WAAYnB,KAAK,eAOrBY,UAAW,WACTZ,KAAK,cAAgBA,KAAKS,eAAeC,MACzCV,KAAK,YAAcA,KAAKW,aAAaD,OAMvCG,UAAW,WACTb,KAAKS,eAAeW,IAAMpB,KAAKW,aAAaD,MAC5CV,KAAKW,aAAaU,IAAMrB,KAAKS,eAAeC,OAS9CL,SACE","file":"date-range-selector.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t// Copyright 2014 Google Inc. All rights reserved.\n\t//\n\t// Licensed under the Apache License, Version 2.0 (the \"License\");\n\t// you may not use this file except in compliance with the License.\n\t// You may obtain a copy of the License at\n\t//\n\t// http://www.apache.org/licenses/LICENSE-2.0\n\t//\n\t// Unless required by applicable law or agreed to in writing, software\n\t// distributed under the License is distributed on an \"AS IS\" BASIS,\n\t// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\t// See the License for the specific language governing permissions and\n\t// limitations under the License.\n\t\n\t/* global gapi */\n\t\n\t/**\n\t * A DateRangeSelector component for the Embed API.\n\t */\n\t'use strict';\n\t\n\tgapi.analytics.ready(function () {\n\t\n\t var nDaysAgo = /(\\d+)daysAgo/;\n\t var dateFormat = /\\d{4}\\-\\d{2}\\-\\d{2}/;\n\t\n\t /**\n\t * Convert a date acceptable to the Core Reporting API (e.g. `today`,\n\t * `yesterday` or `NdaysAgo`) into the format YYYY-MM-DD. Dates\n\t * already in that format are simply returned.\n\t * @return {string} The formatted date.\n\t */\n\t function convertDate(str) {\n\t // If str is in the proper format, do nothing.\n\t if (dateFormat.test(str)) return str;\n\t\n\t var match = nDaysAgo.exec(str);\n\t if (match) {\n\t return daysAgo(+match[1]);\n\t } else if (str == 'today') {\n\t return daysAgo(0);\n\t } else if (str == 'yesterday') {\n\t return daysAgo(1);\n\t } else {\n\t throw new Error('Cannot convert date ' + str);\n\t }\n\t }\n\t\n\t /**\n\t * Accept a number and return a date formatted as YYYY-MM-DD that\n\t * represents that many days ago.\n\t * @return {string} The formatted date.\n\t */\n\t function daysAgo(numDays) {\n\t var date = new Date();\n\t date.setDate(date.getDate() - numDays);\n\t var month = String(date.getMonth() + 1);\n\t month = month.length == 1 ? '0' + month : month;\n\t var day = String(date.getDate());\n\t day = day.length == 1 ? '0' + day : day;\n\t return date.getFullYear() + '-' + month + '-' + day;\n\t }\n\t\n\t gapi.analytics.createComponent('DateRangeSelector', {\n\t\n\t /**\n\t * Initialize the DateRangeSelector instance and render it to the page.\n\t * @return {DateRangeSelector} The instance.\n\t */\n\t execute: function execute() {\n\t var options = this.get();\n\t options['start-date'] = options['start-date'] || '7daysAgo';\n\t options['end-date'] = options['end-date'] || 'yesterday';\n\t\n\t // Allow container to be a string ID or an HTMLElement.\n\t this.container = typeof options.container == 'string' ? document.getElementById(options.container) : options.container;\n\t\n\t // Allow the template to be overridden.\n\t if (options.template) this.template = options.template;\n\t\n\t this.container.innerHTML = this.template;\n\t var dateInputs = this.container.querySelectorAll('input');\n\t\n\t this.startDateInput = dateInputs[0];\n\t this.startDateInput.value = convertDate(options['start-date']);\n\t this.endDateInput = dateInputs[1];\n\t this.endDateInput.value = convertDate(options['end-date']);\n\t\n\t this.setValues();\n\t this.setMinMax();\n\t\n\t this.container.onchange = this.onChange.bind(this);\n\t return this;\n\t },\n\t\n\t /**\n\t * Emit a change event based on the currently selected dates.\n\t * Pass an object containing the start date and end date.\n\t */\n\t onChange: function onChange() {\n\t this.setValues();\n\t this.setMinMax();\n\t this.emit('change', {\n\t 'start-date': this['start-date'],\n\t 'end-date': this['end-date']\n\t });\n\t },\n\t\n\t /**\n\t * Updates the instance properties based on the input values.\n\t */\n\t setValues: function setValues() {\n\t this['start-date'] = this.startDateInput.value;\n\t this['end-date'] = this.endDateInput.value;\n\t },\n\t\n\t /**\n\t * Updates the input min and max attributes so there's no overlap.\n\t */\n\t setMinMax: function setMinMax() {\n\t this.startDateInput.max = this.endDateInput.value;\n\t this.endDateInput.min = this.startDateInput.value;\n\t },\n\t\n\t /**\n\t * The html structure used to build the component. Developers can\n\t * override this by passing it to the component constructor.\n\t * The only requirement is that the structure contain two inputs, the\n\t * first will be the start date and the second will be the end date.\n\t */\n\t template: '<div class=\"DateRangeSelector\">' + ' <div class=\"DateRangeSelector-item\">' + ' <label>Start Date</label> ' + ' <input type=\"date\">' + ' </div>' + ' <div class=\"DateRangeSelector-item\">' + ' <label>End Date</label> ' + ' <input type=\"date\">' + ' </div>' + '</div>'\n\t });\n\t});\n\n/***/ }\n/******/ ]);\n\n\n/** WEBPACK FOOTER **\n ** date-range-selector.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 0853746ae09c5b7c1eb6\n **/","// Copyright 2014 Google Inc. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n/* global gapi */\n\n/**\n * A DateRangeSelector component for the Embed API.\n */\ngapi.analytics.ready(function() {\n\n var nDaysAgo = /(\\d+)daysAgo/;\n var dateFormat = /\\d{4}\\-\\d{2}\\-\\d{2}/;\n\n /**\n * Convert a date acceptable to the Core Reporting API (e.g. `today`,\n * `yesterday` or `NdaysAgo`) into the format YYYY-MM-DD. Dates\n * already in that format are simply returned.\n * @return {string} The formatted date.\n */\n function convertDate(str) {\n // If str is in the proper format, do nothing.\n if (dateFormat.test(str)) return str;\n\n var match = nDaysAgo.exec(str);\n if (match) {\n return daysAgo(+match[1]);\n } else if (str == 'today') {\n return daysAgo(0);\n } else if (str == 'yesterday') {\n return daysAgo(1);\n } else {\n throw new Error('Cannot convert date ' + str);\n }\n }\n\n /**\n * Accept a number and return a date formatted as YYYY-MM-DD that\n * represents that many days ago.\n * @return {string} The formatted date.\n */\n function daysAgo(numDays) {\n var date = new Date();\n date.setDate(date.getDate() - numDays);\n var month = String(date.getMonth() + 1);\n month = month.length == 1 ? '0' + month: month;\n var day = String(date.getDate());\n day = day.length == 1 ? '0' + day: day;\n return date.getFullYear() + '-' + month + '-' + day;\n }\n\n gapi.analytics.createComponent('DateRangeSelector', {\n\n /**\n * Initialize the DateRangeSelector instance and render it to the page.\n * @return {DateRangeSelector} The instance.\n */\n execute: function() {\n var options = this.get();\n options['start-date'] = options['start-date'] || '7daysAgo';\n options['end-date'] = options['end-date'] || 'yesterday';\n\n // Allow container to be a string ID or an HTMLElement.\n this.container = typeof options.container == 'string' ?\n document.getElementById(options.container) : options.container;\n\n // Allow the template to be overridden.\n if (options.template) this.template = options.template;\n\n this.container.innerHTML = this.template;\n var dateInputs = this.container.querySelectorAll('input');\n\n this.startDateInput = dateInputs[0];\n this.startDateInput.value = convertDate(options['start-date']);\n this.endDateInput = dateInputs[1];\n this.endDateInput.value = convertDate(options['end-date']);\n\n this.setValues();\n this.setMinMax();\n\n this.container.onchange = this.onChange.bind(this);\n return this;\n },\n\n /**\n * Emit a change event based on the currently selected dates.\n * Pass an object containing the start date and end date.\n */\n onChange: function() {\n this.setValues();\n this.setMinMax();\n this.emit('change', {\n 'start-date': this['start-date'],\n 'end-date': this['end-date']\n });\n },\n\n /**\n * Updates the instance properties based on the input values.\n */\n setValues: function() {\n this['start-date'] = this.startDateInput.value;\n this['end-date'] = this.endDateInput.value;\n },\n\n /**\n * Updates the input min and max attributes so there's no overlap.\n */\n setMinMax: function() {\n this.startDateInput.max = this.endDateInput.value;\n this.endDateInput.min = this.startDateInput.value;\n },\n\n /**\n * The html structure used to build the component. Developers can\n * override this by passing it to the component constructor.\n * The only requirement is that the structure contain two inputs, the\n * first will be the start date and the second will be the end date.\n */\n template:\n '<div class=\"DateRangeSelector\">' +\n ' <div class=\"DateRangeSelector-item\">' +\n ' <label>Start Date</label> ' +\n ' <input type=\"date\">' +\n ' </div>' +\n ' <div class=\"DateRangeSelector-item\">' +\n ' <label>End Date</label> ' +\n ' <input type=\"date\">' +\n ' </div>' +\n '</div>'\n });\n\n});\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/javascript/embed-api/components/date-range-selector.js\n **/"],"sourceRoot":""}
|
@@ -0,0 +1,196 @@
|
|
1
|
+
! function(t) {
|
2
|
+
function e(r) {
|
3
|
+
if (i[r]) return i[r].exports;
|
4
|
+
var s = i[r] = {
|
5
|
+
exports: {},
|
6
|
+
id: r,
|
7
|
+
loaded: !1
|
8
|
+
};
|
9
|
+
return t[r].call(s.exports, s, s.exports, e), s.loaded = !0, s.exports
|
10
|
+
}
|
11
|
+
var i = {};
|
12
|
+
return e.m = t, e.c = i, e.p = "", e(0)
|
13
|
+
}([function(t, e, i) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
function r(t) {
|
17
|
+
return t && t.__esModule ? t : {
|
18
|
+
"default": t
|
19
|
+
}
|
20
|
+
}
|
21
|
+
var s = i(1),
|
22
|
+
n = r(s);
|
23
|
+
gapi.analytics.ready(function() {
|
24
|
+
function t(t, e, i) {
|
25
|
+
t.innerHTML = e.map(function(t) {
|
26
|
+
var e = t.id == i ? "selected " : " ";
|
27
|
+
return "<option " + e + 'value="' + t.id + '">' + t.name + "</option>"
|
28
|
+
}).join("")
|
29
|
+
}
|
30
|
+
|
31
|
+
function e(t) {
|
32
|
+
return t.ids || t.viewId ? {
|
33
|
+
prop: "viewId",
|
34
|
+
value: t.viewId || t.ids && t.ids.replace(/^ga:/, "")
|
35
|
+
} : t.propertyId ? {
|
36
|
+
prop: "propertyId",
|
37
|
+
value: t.propertyId
|
38
|
+
} : t.accountId ? {
|
39
|
+
prop: "accountId",
|
40
|
+
value: t.accountId
|
41
|
+
} : void 0
|
42
|
+
}
|
43
|
+
gapi.analytics.createComponent("ViewSelector2", {
|
44
|
+
execute: function() {
|
45
|
+
return this.setup_(function() {
|
46
|
+
this.updateAccounts_(), this.changed_ && (this.render_(), this.onChange_())
|
47
|
+
}.bind(this)), this
|
48
|
+
},
|
49
|
+
set: function(t) {
|
50
|
+
if (!!t.ids + !!t.viewId + !!t.propertyId + !!t.accountId > 1) throw new Error('You cannot specify more than one of the following options: "ids", "viewId", "accountId", "propertyId"');
|
51
|
+
if (t.container && this.container) throw new Error("You cannot change containers once a view selector has been rendered on the page.");
|
52
|
+
var e = this.get();
|
53
|
+
return (e.ids != t.ids || e.viewId != t.viewId || e.propertyId != t.propertyId || e.accountId != t.accountId) && (e.ids = null, e.viewId = null, e.propertyId = null, e.accountId = null), gapi.analytics.Component.prototype.set.call(this, t)
|
54
|
+
},
|
55
|
+
setup_: function(t) {
|
56
|
+
function e() {
|
57
|
+
n["default"].get().then(function(e) {
|
58
|
+
i.summaries = e, i.accounts = i.summaries.all(), t()
|
59
|
+
}, function(t) {
|
60
|
+
i.emit("error", t)
|
61
|
+
})
|
62
|
+
}
|
63
|
+
var i = this;
|
64
|
+
gapi.analytics.auth.isAuthorized() ? e() : gapi.analytics.auth.on("success", e)
|
65
|
+
},
|
66
|
+
updateAccounts_: function() {
|
67
|
+
var t, i, r, s = this.get(),
|
68
|
+
n = e(s);
|
69
|
+
if (n) switch (n.prop) {
|
70
|
+
case "viewId":
|
71
|
+
t = this.summaries.getProfile(n.value), i = this.summaries.getAccountByProfileId(n.value), r = this.summaries.getWebPropertyByProfileId(n.value);
|
72
|
+
break;
|
73
|
+
case "propertyId":
|
74
|
+
r = this.summaries.getWebProperty(n.value), i = this.summaries.getAccountByWebPropertyId(n.value), t = r && r.views && r.views[0];
|
75
|
+
break;
|
76
|
+
case "accountId":
|
77
|
+
i = this.summaries.getAccount(n.value), r = i && i.properties && i.properties[0], t = r && r.views && r.views[0]
|
78
|
+
} else i = this.accounts[0], r = i && i.properties && i.properties[0], t = r && r.views && r.views[0];
|
79
|
+
i || r || t ? (i != this.account || r != this.property || t != this.view) && (this.changed_ = {
|
80
|
+
account: i && i != this.account,
|
81
|
+
property: r && r != this.property,
|
82
|
+
view: t && t != this.view
|
83
|
+
}, this.account = i, this.properties = i.properties, this.property = r, this.views = r && r.views, this.view = t, this.ids = t && "ga:" + t.id) : this.emit("error", new Error("You do not have access to " + n.prop.slice(0, -2) + " : " + n.value))
|
84
|
+
},
|
85
|
+
render_: function() {
|
86
|
+
var e = this.get();
|
87
|
+
this.container = "string" == typeof e.container ? document.getElementById(e.container) : e.container, this.container.innerHTML = e.template || this.template;
|
88
|
+
var i = this.container.querySelectorAll("select"),
|
89
|
+
r = this.accounts,
|
90
|
+
s = this.properties || [{
|
91
|
+
name: "(Empty)",
|
92
|
+
id: ""
|
93
|
+
}],
|
94
|
+
n = this.views || [{
|
95
|
+
name: "(Empty)",
|
96
|
+
id: ""
|
97
|
+
}];
|
98
|
+
t(i[0], r, this.account.id), t(i[1], s, this.property && this.property.id), t(i[2], n, this.view && this.view.id), i[0].onchange = this.onUserSelect_.bind(this, i[0], "accountId"), i[1].onchange = this.onUserSelect_.bind(this, i[1], "propertyId"), i[2].onchange = this.onUserSelect_.bind(this, i[2], "viewId")
|
99
|
+
},
|
100
|
+
onChange_: function() {
|
101
|
+
var t = {
|
102
|
+
account: this.account,
|
103
|
+
property: this.property,
|
104
|
+
view: this.view,
|
105
|
+
ids: this.view && "ga:" + this.view.id
|
106
|
+
};
|
107
|
+
this.changed_ && (this.changed_.account && this.emit("accountChange", t), this.changed_.property && this.emit("propertyChange", t), this.changed_.view && (this.emit("viewChange", t), this.emit("idsChange", t), this.emit("change", t.ids))), this.changed_ = null
|
108
|
+
},
|
109
|
+
onUserSelect_: function(t, e) {
|
110
|
+
var i = {};
|
111
|
+
i[e] = t.value, this.set(i), this.execute()
|
112
|
+
},
|
113
|
+
template: '<div class="ViewSelector2 row"> <div class="ViewSelector2-item col s4" style="display:none;"> <label>Cuenta</label> <select class="FormField"></select> </div> <div class="ViewSelector2-item col s6"> <label>Propiedad</label> <select class="FormField"></select> </div> <div class="ViewSelector2-item col s6"> <label>Vista</label> <select class="FormField"></select> </div></div>'
|
114
|
+
})
|
115
|
+
})
|
116
|
+
}, function(t, e, i) {
|
117
|
+
function r() {
|
118
|
+
var t = gapi.client.request({
|
119
|
+
path: o
|
120
|
+
}).then(function(t) {
|
121
|
+
return t
|
122
|
+
});
|
123
|
+
return new t.constructor(function(e, i) {
|
124
|
+
var r = [];
|
125
|
+
t.then(function s(t) {
|
126
|
+
var a = t.result;
|
127
|
+
a.items ? r = r.concat(a.items) : i(new Error("You do not have any Google Analytics accounts. Go to http://google.com/analytics to sign up.")), a.startIndex + a.itemsPerPage <= a.totalResults ? gapi.client.request({
|
128
|
+
path: o,
|
129
|
+
params: {
|
130
|
+
"start-index": a.startIndex + a.itemsPerPage
|
131
|
+
}
|
132
|
+
}).then(s) : e(new n(r))
|
133
|
+
}).then(null, i)
|
134
|
+
})
|
135
|
+
}
|
136
|
+
var s, n = i(2),
|
137
|
+
o = "/analytics/v3/management/accountSummaries";
|
138
|
+
t.exports = {
|
139
|
+
get: function(t) {
|
140
|
+
return t && (s = null), s || (s = r())
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}, function(t, e, i) {
|
144
|
+
function r(t) {
|
145
|
+
this.accounts_ = t, this.webProperties_ = [], this.profiles_ = [], this.accountsById_ = {}, this.webPropertiesById_ = this.propertiesById_ = {}, this.profilesById_ = this.viewsById_ = {};
|
146
|
+
for (var e, i = 0; e = this.accounts_[i]; i++)
|
147
|
+
if (this.accountsById_[e.id] = {
|
148
|
+
self: e
|
149
|
+
}, e.webProperties) {
|
150
|
+
s(e, "webProperties", "properties");
|
151
|
+
for (var r, n = 0; r = e.webProperties[n]; n++)
|
152
|
+
if (this.webProperties_.push(r), this.webPropertiesById_[r.id] = {
|
153
|
+
self: r,
|
154
|
+
parent: e
|
155
|
+
}, r.profiles) {
|
156
|
+
s(r, "profiles", "views");
|
157
|
+
for (var o, a = 0; o = r.profiles[a]; a++) this.profiles_.push(o), this.profilesById_[o.id] = {
|
158
|
+
self: o,
|
159
|
+
parent: r,
|
160
|
+
grandParent: e
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
function s(t, e, i) {
|
167
|
+
Object.defineProperty ? Object.defineProperty(t, i, {
|
168
|
+
get: function() {
|
169
|
+
return t[e]
|
170
|
+
}
|
171
|
+
}) : t[i] = t[e]
|
172
|
+
}
|
173
|
+
r.prototype.all = function() {
|
174
|
+
return this.accounts_
|
175
|
+
}, s(r.prototype, "all", "allAccounts"), r.prototype.allWebProperties = function() {
|
176
|
+
return this.webProperties_
|
177
|
+
}, s(r.prototype, "allWebProperties", "allProperties"), r.prototype.allProfiles = function() {
|
178
|
+
return this.profiles_
|
179
|
+
}, s(r.prototype, "allProfiles", "allViews"), r.prototype.get = function(t) {
|
180
|
+
if (!!t.accountId + !!t.webPropertyId + !!t.propertyId + !!t.profileId + !!t.viewId > 1) throw new Error('get() only accepts an object with a single property: either "accountId", "webPropertyId", "propertyId", "profileId" or "viewId"');
|
181
|
+
return this.getProfile(t.profileId || t.viewId) || this.getWebProperty(t.webPropertyId || t.propertyId) || this.getAccount(t.accountId)
|
182
|
+
}, r.prototype.getAccount = function(t) {
|
183
|
+
return this.accountsById_[t] && this.accountsById_[t].self
|
184
|
+
}, r.prototype.getWebProperty = function(t) {
|
185
|
+
return this.webPropertiesById_[t] && this.webPropertiesById_[t].self
|
186
|
+
}, s(r.prototype, "getWebProperty", "getProperty"), r.prototype.getProfile = function(t) {
|
187
|
+
return this.profilesById_[t] && this.profilesById_[t].self
|
188
|
+
}, s(r.prototype, "getProfile", "getView"), r.prototype.getAccountByProfileId = function(t) {
|
189
|
+
return this.profilesById_[t] && this.profilesById_[t].grandParent
|
190
|
+
}, s(r.prototype, "getAccountByProfileId", "getAccountByViewId"), r.prototype.getWebPropertyByProfileId = function(t) {
|
191
|
+
return this.profilesById_[t] && this.profilesById_[t].parent
|
192
|
+
}, s(r.prototype, "getWebPropertyByProfileId", "getPropertyByViewId"), r.prototype.getAccountByWebPropertyId = function(t) {
|
193
|
+
return this.webPropertiesById_[t] && this.webPropertiesById_[t].parent
|
194
|
+
}, s(r.prototype, "getAccountByWebPropertyId", "getAccountByPropertyId"), t.exports = r
|
195
|
+
}]);
|
196
|
+
//# sourceMappingURL=view-selector2.js.map
|