active_admin_pro 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +5 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/active_admin_pro.js +41 -0
- data/app/assets/javascripts/active_admin_pro/actions/new.js +8 -0
- data/app/assets/javascripts/active_admin_pro/actions/show.js +12 -0
- data/app/assets/javascripts/active_admin_pro/components/codemirror_input.js +92 -0
- data/app/assets/javascripts/active_admin_pro/components/flashes.js +9 -0
- data/app/assets/javascripts/active_admin_pro/components/link.js +23 -0
- data/app/assets/javascripts/active_admin_pro/components/phone_input.js +52 -0
- data/app/assets/javascripts/active_admin_pro/components/select_input.js +31 -0
- data/app/assets/javascripts/active_admin_pro/components/sortable_handle.js +8 -0
- data/app/assets/javascripts/active_admin_pro/components/summernote_input.js +132 -0
- data/app/assets/javascripts/active_admin_pro/components/text_input.js +47 -0
- data/app/assets/javascripts/active_admin_pro/components/time_zone_input.js +51 -0
- data/app/assets/javascripts/active_admin_pro/components/title_to_slug.js +16 -0
- data/app/assets/stylesheets/active_admin_pro.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/breakpoints.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/components/_input_variables.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/components/actions.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/components/boolean_input.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/components/button.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/components/check_boxes_input.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/components/codemirror_input.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/components/comments.scss +17 -0
- data/app/assets/stylesheets/active_admin_pro/components/datepicker.scss +108 -0
- data/app/assets/stylesheets/active_admin_pro/components/dialog.scss +66 -0
- data/app/assets/stylesheets/active_admin_pro/components/dropdown_menu_button.scss +40 -0
- data/app/assets/stylesheets/active_admin_pro/components/fieldset.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/components/file_input.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/components/has_many_fields.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/components/inline_errors.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/components/link.scss +16 -0
- data/app/assets/stylesheets/active_admin_pro/components/panel.scss +62 -0
- data/app/assets/stylesheets/active_admin_pro/components/phone_input.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/components/radio_input.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/components/segmented_control.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/components/select_input.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/components/sortable_handle.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/components/string_input.scss +85 -0
- data/app/assets/stylesheets/active_admin_pro/components/summernote_input.scss +190 -0
- data/app/assets/stylesheets/active_admin_pro/components/table.scss +100 -0
- data/app/assets/stylesheets/active_admin_pro/components/text_input.scss +55 -0
- data/app/assets/stylesheets/active_admin_pro/functions/color.scss +130 -0
- data/app/assets/stylesheets/active_admin_pro/functions/text-color.scss +35 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/comments.scss +14 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/index.scss +88 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/show.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/layout/body.scss +60 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/action_items.scss +32 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/actions/comments.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/active_admin_content.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/breadcrumbs.scss +57 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/navigation.scss +197 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/sidebar.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/title_bar.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/wrapper.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/filters.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/layout/flashes.scss +52 -0
- data/app/assets/stylesheets/active_admin_pro/layout/footer.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/layout/mobile/actions/index.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/dashboard.scss +105 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/index.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/show.scss +78 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/active_admin_content.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/flashes.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/navigation.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/title_bar.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/mixins/button.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/variables.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon.scss +87 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/_bourbon-deprecated-upcoming.scss +411 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-color.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-radius.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-style.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-width.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_buttons.scss +64 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_clearfix.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_ellipsis.scss +30 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_font-stacks.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_hide-text.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_margin.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_padding.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_position.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_prefixer.scss +66 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_retina-image.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_size.scss +51 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_text-inputs.scss +113 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_timing-functions.scss +34 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_triangle.scss +63 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_word-wrap.scss +29 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_animation.scss +43 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_appearance.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_backface-visibility.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background-image.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background.scss +55 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_border-image.scss +59 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_calc.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_columns.scss +47 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_filter.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_flex-box.scss +287 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-face.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-feature-settings.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hidpi-media-query.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hyphens.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_image-rendering.scss +14 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_keyframes.scss +36 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_linear-gradient.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_perspective.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_placeholder.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_radial-gradient.scss +39 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_selection.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_text-decoration.scss +19 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transform.scss +15 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transition.scss +71 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_user-select.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_assign-inputs.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains-falsy.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-length.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-light.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-number.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-size.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_modular-scale.scss +69 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-em.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-rem.scss +15 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_shade.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_strip-units.scss +17 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_tint.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_transition-property-name.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_unpack.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_convert-units.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_directional-values.scss +96 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_font-source-declaration.scss +43 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_gradient-positions-parser.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-angle-parser.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-gradient-parser.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-positions-parser.scss +61 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-side-corner-parser.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-arg-parser.scss +69 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-gradient-parser.scss +50 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-positions-parser.scss +18 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_render-gradients.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_shape-size-stripper.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_str-to-num.scss +50 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_asset-pipeline.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_prefixer.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_px-to-em.scss +1 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/_neat-helpers.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_new-breakpoint.scss +49 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_private.scss +108 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_box-sizing.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_direction-context.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_display-context.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_fill-parent.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_media.scss +92 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_omega.scss +91 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_outer-container.scss +36 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_pad.scss +23 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_private.scss +35 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_row.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_span-columns.scss +90 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_to-deprecate.scss +105 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_visual-grid.scss +40 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_disable-warnings.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_grid.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_visual-grid.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/normalize.css +423 -0
- data/app/assets/stylesheets/codemirror/themes/activeadmin_pro.scss +117 -0
- data/app/inputs/codemirror_input.rb +27 -0
- data/app/inputs/datepicker_input.rb +16 -0
- data/app/inputs/phone_input.rb +5 -0
- data/app/inputs/summernote_input.rb +5 -0
- data/app/inputs/time_zone_input.rb +43 -0
- data/app/models/activeadmin_pro/summernote_image.rb +5 -0
- data/config/initializers/active_admin.rb +50 -0
- data/config/locales/en.yml +55 -0
- data/lib/active_admin_pro/admin_user/admin_user.rb +52 -0
- data/lib/active_admin_pro/engine.rb +8 -0
- data/lib/active_admin_pro/summernote_image/summernote_image.rb +61 -0
- data/lib/active_admin_pro/user/user.rb +53 -0
- data/lib/active_admin_pro/version.rb +3 -0
- data/lib/activeadmin_pro.rb +9 -0
- data/lib/generators/activeadmin_pro/install_generator.rb +14 -0
- data/lib/tasks/activeadmin_pro_tasks.rake +4 -0
- data/spec/spec_helper.rb +34 -0
- data/vendor/assets/javascripts/bootstrap.js +1243 -0
- data/vendor/assets/javascripts/codemirror.js +8887 -0
- data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +183 -0
- data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.css +32 -0
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/codemirror/addons/display/autorefresh.js +47 -0
- data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.css +6 -0
- data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/display/panel.js +112 -0
- data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +60 -0
- data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +63 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +195 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +57 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +149 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.css +20 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.css +38 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +386 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +254 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/html-lint.js +46 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.css +73 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +231 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.css +112 -0
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +775 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex_test.js +33 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/simple.js +213 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +178 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js +115 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +46 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +147 -0
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +128 -0
- data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +228 -0
- data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +71 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.css +87 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +700 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +44 -0
- data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +366 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +823 -0
- data/vendor/assets/javascripts/codemirror/modes/diff.js +47 -0
- data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +79 -0
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +130 -0
- data/vendor/assets/javascripts/codemirror/modes/go.js +185 -0
- data/vendor/assets/javascripts/codemirror/modes/haml.js +159 -0
- data/vendor/assets/javascripts/codemirror/modes/handlebars.js +53 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +150 -0
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +708 -0
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +792 -0
- data/vendor/assets/javascripts/codemirror/modes/nginx.js +178 -0
- data/vendor/assets/javascripts/codemirror/modes/php.js +234 -0
- data/vendor/assets/javascripts/codemirror/modes/python.js +358 -0
- data/vendor/assets/javascripts/codemirror/modes/ruby.js +285 -0
- data/vendor/assets/javascripts/codemirror/modes/rust.js +58 -0
- data/vendor/assets/javascripts/codemirror/modes/sass.js +414 -0
- data/vendor/assets/javascripts/codemirror/modes/shell.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/xml.js +385 -0
- data/vendor/assets/javascripts/codemirror/modes/yaml.js +117 -0
- data/vendor/assets/javascripts/intl-tel-input.js +963 -0
- data/vendor/assets/javascripts/intl-tel-utils.js +480 -0
- data/vendor/assets/javascripts/slug.js +212 -0
- data/vendor/assets/javascripts/summernote.js +6939 -0
- data/vendor/assets/stylesheets/codemirror.css +334 -0
- data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/dracula.css +41 -0
- data/vendor/assets/stylesheets/codemirror/themes/material.css +53 -0
- data/vendor/assets/stylesheets/codemirror/themes/monokai.css +35 -0
- data/vendor/assets/stylesheets/codemirror/themes/solarized.css +163 -0
- data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +34 -0
- data/vendor/assets/stylesheets/intl-tel-input.scss +1054 -0
- data/vendor/assets/stylesheets/summernote-bs3.css +5425 -0
- data/vendor/assets/stylesheets/summernote.css +1 -0
- metadata +604 -0
@@ -0,0 +1,117 @@
|
|
1
|
+
// Pretty good CodeMirror theme that matches the Google Material Design colors
|
2
|
+
.cm-s-activeadmin_pro.CodeMirror {
|
3
|
+
background: color($blue-grey, 50);
|
4
|
+
color: color($grey, 800);
|
5
|
+
}
|
6
|
+
|
7
|
+
.cm-s-activeadmin_pro div.CodeMirror-selected {
|
8
|
+
background: color($blue-grey, 100);
|
9
|
+
}
|
10
|
+
|
11
|
+
.cm-s-activeadmin_pro .CodeMirror-line::selection,
|
12
|
+
.cm-s-activeadmin_pro .CodeMirror-line > span::selection,
|
13
|
+
.cm-s-activeadmin_pro .CodeMirror-line > span > span::selection {
|
14
|
+
background: rgba(color($blue-grey, 50), 0.99);
|
15
|
+
}
|
16
|
+
|
17
|
+
.cm-s-activeadmin_pro .CodeMirror-line::-moz-selection,
|
18
|
+
.cm-s-activeadmin_pro .CodeMirror-line > span::-moz-selection,
|
19
|
+
.cm-s-activeadmin_pro .CodeMirror-line > span > span::-moz-selection {
|
20
|
+
background: rgba(color($blue-grey, 50), 0.99);
|
21
|
+
}
|
22
|
+
|
23
|
+
.cm-s-activeadmin_pro .CodeMirror-gutters {
|
24
|
+
background: color($blue-grey, 100);
|
25
|
+
color: color($blue-grey, 800);
|
26
|
+
border-right: 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
.cm-s-activeadmin_pro .CodeMirror-guttermarker {
|
30
|
+
color: $white;
|
31
|
+
}
|
32
|
+
|
33
|
+
.cm-s-activeadmin_pro .CodeMirror-guttermarker-subtle {
|
34
|
+
color: color($blue-grey, 800);
|
35
|
+
}
|
36
|
+
|
37
|
+
.cm-s-activeadmin_pro .CodeMirror-linenumber {
|
38
|
+
color: color($blue-grey, 800);
|
39
|
+
}
|
40
|
+
|
41
|
+
.cm-s-activeadmin_pro .CodeMirror-cursor {
|
42
|
+
border-left: 1px solid $black;
|
43
|
+
}
|
44
|
+
|
45
|
+
.cm-s-activeadmin_pro span.cm-comment {
|
46
|
+
color: $grey;
|
47
|
+
}
|
48
|
+
|
49
|
+
.cm-s-activeadmin_pro span.cm-atom {
|
50
|
+
color: $deep-purple;
|
51
|
+
}
|
52
|
+
|
53
|
+
.cm-s-activeadmin_pro span.cm-number {
|
54
|
+
color: color($cyan, 700);
|
55
|
+
}
|
56
|
+
|
57
|
+
.cm-s-activeadmin_pro span.cm-property {
|
58
|
+
color: color($amber, 700);
|
59
|
+
}
|
60
|
+
|
61
|
+
.cm-s-activeadmin_pro span.cm-attribute {
|
62
|
+
color: $deep-purple;
|
63
|
+
}
|
64
|
+
|
65
|
+
.cm-s-activeadmin_pro span.cm-keyword {
|
66
|
+
color: $pink;
|
67
|
+
}
|
68
|
+
|
69
|
+
.cm-s-activeadmin_pro span.cm-string {
|
70
|
+
color: $blue;
|
71
|
+
}
|
72
|
+
|
73
|
+
.cm-s-activeadmin_pro span.cm-variable {
|
74
|
+
color: color($grey, 800);
|
75
|
+
}
|
76
|
+
|
77
|
+
.cm-s-activeadmin_pro span.cm-variable-2 {
|
78
|
+
color: color($grey, 800);
|
79
|
+
}
|
80
|
+
|
81
|
+
.cm-s-activeadmin_pro span.cm-variable-3 {
|
82
|
+
color: color($grey, 800);
|
83
|
+
}
|
84
|
+
|
85
|
+
.cm-s-activeadmin_pro span.cm-def {
|
86
|
+
color: $indigo;
|
87
|
+
}
|
88
|
+
|
89
|
+
.cm-s-activeadmin_pro span.cm-bracket {
|
90
|
+
color: $green;
|
91
|
+
}
|
92
|
+
|
93
|
+
.cm-s-activeadmin_pro span.cm-tag {
|
94
|
+
color: $deep-purple;
|
95
|
+
}
|
96
|
+
|
97
|
+
.cm-s-activeadmin_pro span.cm-header {
|
98
|
+
color: color($blue, 700);
|
99
|
+
}
|
100
|
+
|
101
|
+
.cm-s-activeadmin_pro span.cm-link {
|
102
|
+
color: $cyan;
|
103
|
+
}
|
104
|
+
|
105
|
+
.cm-s-activeadmin_pro span.cm-error {
|
106
|
+
background: $red;
|
107
|
+
color: $white;
|
108
|
+
}
|
109
|
+
|
110
|
+
.cm-s-activeadmin_pro .CodeMirror-activeline-background {
|
111
|
+
background: $amber;
|
112
|
+
}
|
113
|
+
|
114
|
+
.cm-s-activeadmin_pro .CodeMirror-matchingbracket {
|
115
|
+
background: color($blue-grey, 100);
|
116
|
+
color: $black !important;
|
117
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class CodemirrorInput < Formtastic::Inputs::TextInput
|
2
|
+
def input_html_options
|
3
|
+
codemirror_options = options[:codemirror] || {}
|
4
|
+
|
5
|
+
# Convert any underscored option keys to camel case
|
6
|
+
codemirror_options.keys.each do |key|
|
7
|
+
codemirror_options[key.to_s.camelize(:lower).to_sym] = codemirror_options.delete(key)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Set any default options for addons if they aren't already set
|
11
|
+
codemirror_options[:autoCloseBrackets] = true unless codemirror_options[:autoCloseBrackets] == false
|
12
|
+
codemirror_options[:lineNumbers] = true unless codemirror_options[:lineNumbers] == false
|
13
|
+
codemirror_options[:matchBrackets] = true unless codemirror_options[:matchBrackets] == false
|
14
|
+
codemirror_options[:matchTags] = true unless codemirror_options[:matchTags] == false
|
15
|
+
|
16
|
+
# Additional default options that don't need to check for a false value
|
17
|
+
codemirror_options[:extraKeys] ||= {}
|
18
|
+
codemirror_options[:extraKeys][:Enter] ||= "newlineAndIndentContinueMarkdownList"
|
19
|
+
codemirror_options[:tabSize] ||= 2
|
20
|
+
|
21
|
+
# Set the default theme to the matching Active Admin Pro theme
|
22
|
+
codemirror_options[:theme] ||= "activeadmin_pro"
|
23
|
+
|
24
|
+
# Pass the CodeMirror options as a data attribute to the input element
|
25
|
+
super.merge(class: "codemirror", data: { codemirror: codemirror_options })
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class DatepickerInput < ActiveAdmin::Inputs::DatepickerInput
|
2
|
+
# Override the HTML options to better work with the date picker and nil values.
|
3
|
+
def input_html_options
|
4
|
+
super.merge(value: (object.send(method) || Time.zone.now).strftime("%B %e, %Y").gsub(/\s\s/, " "))
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
# Override the datepicker options to set the date format.
|
10
|
+
def datepicker_options
|
11
|
+
datepicker_options = super
|
12
|
+
datepicker_options[:datepicker_options] ||= {}
|
13
|
+
datepicker_options[:datepicker_options][:dateFormat] = "MM d, yy"
|
14
|
+
datepicker_options
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class TimeZoneInput < Formtastic::Inputs::SelectInput
|
2
|
+
TIME_ZONES = [
|
3
|
+
["(GMT -12:00) Marshall Is.", "Marshall Is.", { class: "time-zone--12" }],
|
4
|
+
["(GMT -11:00) Midway Island", "Midway Island", { class: "time-zone-11" }],
|
5
|
+
["(GMT -10:00) Hawaii", "Hawaii", { class: "time-zone-10" }],
|
6
|
+
["(GMT -9:00) Alaska", "Alaska", { class: "time-zone-9" }],
|
7
|
+
["(GMT -8:00) Pacific Time (US & Canada)", "Pacific Time (US & Canada)", { class: "time-zone-8" }],
|
8
|
+
["(GMT -7:00) Mountain Time (US & Canada)", "Mountain Time (US & Canada)", { class: "time-zone-7" }],
|
9
|
+
["(GMT -6:00) Central Time (US & Canada)", "Central Time (US & Canada)", { class: "time-zone-6" }],
|
10
|
+
["(GMT -5:00) Eastern Time (US & Canada)", "Eastern Time (US & Canada)", { class: "time-zone-5" }],
|
11
|
+
["(GMT -4:00) Atlantic Time (Canada)", "Atlantic Time (Canada)", { class: "time-zone-4" }],
|
12
|
+
["(GMT -3:30) Newfoundland", "Newfoundland", { class: "time-zone-3.5" }],
|
13
|
+
["(GMT -3:00) Buenos Aires", "Buenos Aires", { class: "time-zone-3" }],
|
14
|
+
["(GMT -2:00) Mid-Atlantic", "Mid-Atlantic", { class: "time-zone-2" }],
|
15
|
+
["(GMT -9:00) Azores", "Azores", { class: "time-zone-1" }],
|
16
|
+
["(GMT) London", "London", { class: "time-zone0" }],
|
17
|
+
["(GMT +1:00) Brussels", "Brussels", { class: "time-zone1" }],
|
18
|
+
["(GMT +2:00) South Africa", "South Africa", { class: "time-zone2" }],
|
19
|
+
["(GMT +3:00) Baghdad", "Baghdad", { class: "time-zone3" }],
|
20
|
+
["(GMT +3:30) Tehran", "Tehran", { class: "time-zone3.5" }],
|
21
|
+
["(GMT +4:00) Abu Dhabi", "Abu Dhabi", { class: "time-zone4" }],
|
22
|
+
["(GMT +4:30) Kabul", "Kabul", { class: "time-zone4.5" }],
|
23
|
+
["(GMT +5:00) Ekaterinburg", "Ekaterinburg", { class: "time-zone5" }],
|
24
|
+
["(GMT +5:30) New Delhi", "New Delhi", { class: "time-zone5.5" }],
|
25
|
+
["(GMT +5:45) Kathmandu", "Kathmandu", { class: "time-zone5.75" }],
|
26
|
+
["(GMT +6:00) Almaty", "Almaty", { class: "time-zone6" }],
|
27
|
+
["(GMT +7:00) Bangkok", "Bangkok", { class: "time-zone7" }],
|
28
|
+
["(GMT +8:00) Beijing", "Beijing", { class: "time-zone8" }],
|
29
|
+
["(GMT +9:00) Tokyo", "Tokyo", { class: "time-zone9" }],
|
30
|
+
["(GMT +9:30) Adelaide", "Adelaide", { class: "time-zone9.5" }],
|
31
|
+
["(GMT +10:00) Guam", "Guam", { class: "time-zone10" }],
|
32
|
+
["(GMT +11:00) Magadan", "Magadan", { class: "time-zone11" }],
|
33
|
+
["(GMT +12:00) Auckland", "Auckland", { class: "time-zone12" }]
|
34
|
+
]
|
35
|
+
|
36
|
+
def collection
|
37
|
+
TIME_ZONES
|
38
|
+
end
|
39
|
+
|
40
|
+
def wrapper_html_options
|
41
|
+
super.merge(class: "select input time_zone")
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
ActiveAdmin.application.tap do |config|
|
2
|
+
# Set the default configuration for authenticating with admin users
|
3
|
+
config.authentication_method = :authenticate_admin_user!
|
4
|
+
config.current_user_method = :current_admin_user
|
5
|
+
config.logout_link_method = :delete
|
6
|
+
config.logout_link_path = :destroy_admin_user_session_path
|
7
|
+
|
8
|
+
# Prefer short date and time format
|
9
|
+
config.localize_format = :short
|
10
|
+
|
11
|
+
# Include Font Awesome in ActiveAdmin
|
12
|
+
config.register_stylesheet "//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"
|
13
|
+
|
14
|
+
# Add Apple web application icons
|
15
|
+
base_url = "//s3.amazonaws.com/codelation.activeadmin/apple-touch-icon"
|
16
|
+
sizes = [76, 120, 152, 167, 180]
|
17
|
+
config.register_stylesheet "#{base_url}.png", media: nil, rel: "apple-touch-icon"
|
18
|
+
sizes.each do |size|
|
19
|
+
config.register_stylesheet(
|
20
|
+
"#{base_url}-#{size}x#{size}.png",
|
21
|
+
media: nil,
|
22
|
+
rel: "apple-touch-icon",
|
23
|
+
sizes: "#{size}x#{size}"
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Add the meta tags to enable Active Admin as an iOS home screen app
|
28
|
+
config.meta_tags ||= {}
|
29
|
+
config.meta_tags["apple-mobile-web-app-capable"] ||= "yes"
|
30
|
+
config.meta_tags["apple-mobile-web-app-title"] ||= "Admin"
|
31
|
+
config.meta_tags["viewport"] ||= "initial-scale=1, maximum-scale=1, width=device-width"
|
32
|
+
|
33
|
+
# Add default interfaces for AdminUser and User models in Active Admin if the models exist.
|
34
|
+
admin_user_exists = File.exist?(File.join(Rails.root, "app", "models", "admin_user.rb"))
|
35
|
+
admin_user_registration_exists = File.exist?(File.join(Rails.root, "app", "admin", "admin_user.rb"))
|
36
|
+
|
37
|
+
if admin_user_exists && !admin_user_registration_exists
|
38
|
+
config.load_paths.unshift File.join(File.expand_path("../../..", __FILE__), "lib", "activeadmin_pro", "admin_user")
|
39
|
+
end
|
40
|
+
|
41
|
+
user_exists = File.exist?(File.join(Rails.root, "app", "models", "user.rb"))
|
42
|
+
user_registration_exists = File.exist?(File.join(Rails.root, "app", "admin", "user.rb"))
|
43
|
+
|
44
|
+
if user_exists && !user_registration_exists
|
45
|
+
config.load_paths.unshift File.join(File.expand_path("../../..", __FILE__), "lib", "activeadmin_pro", "user")
|
46
|
+
end
|
47
|
+
|
48
|
+
# Add route and controller for Summernote's image uploads
|
49
|
+
config.load_paths.unshift File.join(File.expand_path("../../..", __FILE__), "lib", "activeadmin_pro", "summernote_image")
|
50
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
activerecord:
|
24
|
+
attributes:
|
25
|
+
admin_user:
|
26
|
+
created_at: Created
|
27
|
+
current_sign_in_at: Current Session
|
28
|
+
current_sign_in_ip: Current IP Address
|
29
|
+
email: Email Address
|
30
|
+
last_sign_in_at: Last Session
|
31
|
+
last_sign_in_ip: Last IP Address
|
32
|
+
name: Full Name
|
33
|
+
sign_in_count: Number of Sessions
|
34
|
+
updated_at: Updated
|
35
|
+
user:
|
36
|
+
created_at: Created
|
37
|
+
current_sign_in_at: Current Session
|
38
|
+
current_sign_in_ip: Current IP Address
|
39
|
+
email: Email Address
|
40
|
+
last_sign_in_at: Last Session
|
41
|
+
last_sign_in_ip: Last IP Address
|
42
|
+
name: Full Name
|
43
|
+
sign_in_count: Number of Sessions
|
44
|
+
updated_at: Updated
|
45
|
+
models:
|
46
|
+
admin_user:
|
47
|
+
one: Admin User
|
48
|
+
other: Admin Users
|
49
|
+
user:
|
50
|
+
one: User
|
51
|
+
other: Users
|
52
|
+
|
53
|
+
time:
|
54
|
+
formats:
|
55
|
+
short: "%h %e, %Y %l:%M %p"
|
@@ -0,0 +1,52 @@
|
|
1
|
+
ActiveAdmin.register AdminUser do
|
2
|
+
permit_params :name, :email, :password
|
3
|
+
|
4
|
+
filter :name
|
5
|
+
filter :email
|
6
|
+
|
7
|
+
index do
|
8
|
+
selectable_column
|
9
|
+
id_column
|
10
|
+
column :name
|
11
|
+
column :email
|
12
|
+
actions
|
13
|
+
end
|
14
|
+
|
15
|
+
form do |f|
|
16
|
+
inputs "#{t('activerecord.models.admin_user', count: 1)} Details" do
|
17
|
+
input :name
|
18
|
+
input :email
|
19
|
+
input :password if f.object.new_record?
|
20
|
+
end
|
21
|
+
actions
|
22
|
+
end
|
23
|
+
|
24
|
+
show do
|
25
|
+
attributes_table do
|
26
|
+
row :name
|
27
|
+
row :email
|
28
|
+
row :sign_in_count
|
29
|
+
row :current_sign_in_at
|
30
|
+
row :last_sign_in_at
|
31
|
+
row :current_sign_in_ip
|
32
|
+
row :last_sign_in_ip
|
33
|
+
row :created_at
|
34
|
+
row :updated_at
|
35
|
+
end
|
36
|
+
active_admin_comments
|
37
|
+
end
|
38
|
+
|
39
|
+
member_action :sign_in_as, method: :get do
|
40
|
+
sign_in(resource, bypass: true)
|
41
|
+
redirect_to "/"
|
42
|
+
end
|
43
|
+
|
44
|
+
action_item :become_user, only: :show do
|
45
|
+
# The path `sign_in_as_admin_admin_user_path` looks confusing as hell.
|
46
|
+
# Here's what's up:
|
47
|
+
# The member action is: `sign_in_as`
|
48
|
+
# The namespace is: `admin`
|
49
|
+
# The controller is: `admin_user`
|
50
|
+
link_to("Become User", sign_in_as_admin_admin_user_path(admin_user))
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
ActiveAdmin.register ActiveAdminPro::SummernoteImage do
|
2
|
+
actions :create
|
3
|
+
menu false
|
4
|
+
|
5
|
+
controller do
|
6
|
+
def create
|
7
|
+
@file = params[:file]
|
8
|
+
if ENV["AWS_BUCKET"]
|
9
|
+
@bucket = s3_bucket
|
10
|
+
elsif ENV["GOOGLE_STORAGE_BUCKET"]
|
11
|
+
@bucket = google_storage_bucket
|
12
|
+
end
|
13
|
+
if @bucket
|
14
|
+
render text: upload_file
|
15
|
+
else
|
16
|
+
render json: { error: "No AWS or Google cloud storage bucket setup. Please set the AWS_BUCKET or GOOGLE_STORAGE_BUCKET." }, status: :unprocessable_entity
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# The storage object key used for saving the image uploaded from the Summernote editor.
|
23
|
+
# @return [String]
|
24
|
+
def storage_object_key
|
25
|
+
file_ext = File.extname(@file.original_filename)
|
26
|
+
file_base = File.basename(@file.original_filename, file_ext)
|
27
|
+
time = Time.now.to_i
|
28
|
+
"aap/si/#{file_base}_#{time}#{file_ext}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def google_storage_bucket
|
32
|
+
connection = Fog::Storage.new(
|
33
|
+
provider: "Google",
|
34
|
+
google_storage_access_key_id: ENV.fetch("GOOGLE_STORAGE_ACCESS_KEY_ID"),
|
35
|
+
google_storage_secret_access_key: ENV.fetch("GOOGLE_STORAGE_SECRET_ACCESS_KEY")
|
36
|
+
)
|
37
|
+
connection.directories.get(ENV.fetch("GOOGLE_STORAGE_BUCKET"))
|
38
|
+
end
|
39
|
+
|
40
|
+
def s3_bucket
|
41
|
+
connection = Fog::Storage.new(
|
42
|
+
provider: "AWS",
|
43
|
+
aws_access_key_id: ENV.fetch("AWS_ACCESS_KEY_ID"),
|
44
|
+
aws_secret_access_key: ENV.fetch("AWS_SECRET_ACCESS_KEY")
|
45
|
+
)
|
46
|
+
connection.directories.get(ENV.fetch("AWS_BUCKET"))
|
47
|
+
end
|
48
|
+
|
49
|
+
# Upload the image to the Amazon S3 bucket or Google Storage bucket.
|
50
|
+
# @return [String] The public URL of the image
|
51
|
+
def upload_file
|
52
|
+
file = @bucket.files.create(
|
53
|
+
key: storage_object_key,
|
54
|
+
body: @file.tempfile,
|
55
|
+
public: true
|
56
|
+
)
|
57
|
+
file.save
|
58
|
+
file.public_url
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|