rails_marketplace 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/rails_marketplace/application.js +46 -0
- data/app/assets/javascripts/rails_marketplace/catalog.coffee +3 -0
- data/app/assets/javascripts/rails_marketplace/flash.js +6 -0
- data/app/assets/javascripts/rails_marketplace/footermanifest.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/autocomplete/countries.js +267 -0
- data/app/assets/javascripts/rails_marketplace/js/autocomplete/jquery.autocomplete.js +986 -0
- data/app/assets/javascripts/rails_marketplace/js/bootstrap.min.js +7 -0
- data/app/assets/javascripts/rails_marketplace/js/calendar/fullcalendar.min.js +9 -0
- data/app/assets/javascripts/rails_marketplace/js/chartjs/chart.min.js +14 -0
- data/app/assets/javascripts/rails_marketplace/js/colorpicker/bootstrap-colorpicker.min.js +1087 -0
- data/app/assets/javascripts/rails_marketplace/js/colorpicker/docs.js +17 -0
- data/app/assets/javascripts/rails_marketplace/js/cropping/cropper.min.js +10 -0
- data/app/assets/javascripts/rails_marketplace/js/cropping/main.js +321 -0
- data/app/assets/javascripts/rails_marketplace/js/cropping/main2.js +160 -0
- data/app/assets/javascripts/rails_marketplace/js/custom.js +380 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.bootstrap.min.css +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.bootstrap.min.js +6 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.html5.min.js +22 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.print.min.js +4 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.bootstrap.js +8 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.buttons.min.js +36 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.fixedHeader.min.js +17 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.keyTable.min.js +18 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.responsive.min.js +25 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.scroller.min.js +26 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/fixedHeader.bootstrap.min.css +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/jquery.dataTables.min.css +333 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/jquery.dataTables.min.js +166 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/json/scroller-demo.json +2502 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/jszip.min.js +14 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/pdfmake.min.js +22 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/responsive.bootstrap.min.css +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/responsive.bootstrap.min.js +7 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/scroller.bootstrap.min.css +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/vfs_fonts.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datepicker/daterangepicker.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/dropzone/dropzone.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/easypie/jquery.easypiechart.min.js +9 -0
- data/app/assets/javascripts/rails_marketplace/js/echart/echarts-all.js +35 -0
- data/app/assets/javascripts/rails_marketplace/js/echart/green.js +212 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/bootstrap-wysiwyg.js +200 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-apollo.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-basic.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-clj.js +18 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-css.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-dart.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-erlang.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-go.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-hs.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-lisp.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-llvm.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-lua.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-matlab.js +6 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-ml.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-mumps.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-n.js +4 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-pascal.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-proto.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-r.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-rd.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-scala.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-sql.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-tcl.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-tex.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-vb.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-vhdl.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-wiki.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-xq.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-yaml.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/prettify.js +30 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/run_prettify.js +34 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/jquery.hotkeys.js +100 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/curvedLines.js +483 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/date.js +104 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.orderBars.js +201 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.pie.js +820 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.resize.js +57 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.spline.js +212 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.stack.js +188 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.time.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.tooltip.min.js +12 -0
- data/app/assets/javascripts/rails_marketplace/js/gauge/gauge.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/gauge/gauge_demo.js +21 -0
- data/app/assets/javascripts/rails_marketplace/js/icheck/icheck.min.js +11 -0
- data/app/assets/javascripts/rails_marketplace/js/input_mask/jquery.inputmask.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/ion_range/ion.rangeSlider.min.js +66 -0
- data/app/assets/javascripts/rails_marketplace/js/jquery.min.js +5 -0
- data/app/assets/javascripts/rails_marketplace/js/knob/jquery.knob.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/gdp-data.js +185 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-2.0.3.min.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-us-aea-en.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-world-mill-en.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/us-unemployment.json +1 -0
- data/app/assets/javascripts/rails_marketplace/js/moment/moment.min.js +7 -0
- data/app/assets/javascripts/rails_marketplace/js/moris/example.js +127 -0
- data/app/assets/javascripts/rails_marketplace/js/moris/morris.min.js +7 -0
- data/app/assets/javascripts/rails_marketplace/js/moris/raphael-min.js +11 -0
- data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.buttons.js +132 -0
- data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.core.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.nonblock.js +151 -0
- data/app/assets/javascripts/rails_marketplace/js/nprogress.js +476 -0
- data/app/assets/javascripts/rails_marketplace/js/pace/pace.min.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/parsley/parsley.min.js +9 -0
- data/app/assets/javascripts/rails_marketplace/js/progressbar/bootstrap-progressbar.min.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/select/select2.full.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/sidebar/classie.js +80 -0
- data/app/assets/javascripts/rails_marketplace/js/sidebar/component.css +569 -0
- data/app/assets/javascripts/rails_marketplace/js/sidebar/modernizr.custom.js +4 -0
- data/app/assets/javascripts/rails_marketplace/js/sidebar/sidebarEffects.js +63 -0
- data/app/assets/javascripts/rails_marketplace/js/skycons/skycons.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/sparkline/jquery.sparkline.min.js +5 -0
- data/app/assets/javascripts/rails_marketplace/js/switchery/switchery.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/tags/jquery.tagsinput.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/textarea/autosize.min.js +6 -0
- data/app/assets/javascripts/rails_marketplace/js/validator/validator.js +411 -0
- data/app/assets/javascripts/rails_marketplace/js/wizard/jquery.smartWizard.js +489 -0
- data/app/assets/javascripts/rails_marketplace/less/custom.css +6355 -0
- data/app/assets/javascripts/rails_marketplace/marketplace.js +17 -0
- data/app/assets/javascripts/rails_marketplace/welcome.coffee +3 -0
- data/app/assets/stylesheets/rails_marketplace/application.scss +31 -0
- data/app/assets/stylesheets/rails_marketplace/catalog.scss +132 -0
- data/app/assets/stylesheets/rails_marketplace/css/animate.min.css +11 -0
- data/app/assets/stylesheets/rails_marketplace/css/bootstrap.min.css +6 -0
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.css +1116 -0
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.min.css +5 -0
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.print.css +208 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/bootstrap-colorpicker.min.css +9 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/alpha.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/hue-horizontal.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/hue.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/saturation.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/custom.css +5347 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_page.css +103 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_table.css +258 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_table_jui.css +501 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/jquery.dataTables.css +221 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/jquery.dataTables_themeroller.css +244 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/Sorting icons.psd +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_enabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_enabled_hover.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/favicon.ico +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_enabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_enabled_hover.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_asc.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_asc_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_both.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_desc.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_desc_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/tools/css/dataTables.tableTools.css +336 -0
- data/app/assets/stylesheets/rails_marketplace/css/editor/external/google-code-prettify/prettify.css +1 -0
- data/app/assets/stylesheets/rails_marketplace/css/editor/index.css +42 -0
- data/app/assets/stylesheets/rails_marketplace/css/floatexamples.css +22 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/_all.css +530 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/ion.rangeSlider.css +146 -0
- data/app/assets/stylesheets/rails_marketplace/css/ion.rangeSlider.skinFlat.css +106 -0
- data/app/assets/stylesheets/rails_marketplace/css/maps/jquery-jvectormap-2.0.3.css +135 -0
- data/app/assets/stylesheets/rails_marketplace/css/normalize.css +421 -0
- data/app/assets/stylesheets/rails_marketplace/css/nprogress.css +74 -0
- data/app/assets/stylesheets/rails_marketplace/css/progressbar/bootstrap-progressbar-3.3.0.css +161 -0
- data/app/assets/stylesheets/rails_marketplace/css/select/select2.min.css +404 -0
- data/app/assets/stylesheets/rails_marketplace/css/switchery/switchery.min.css +1 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/css/font-awesome.css +2086 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/css/font-awesome.min.css +4 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/FontAwesome.otf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.svg +655 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.woff2 +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/animated.less +34 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/bordered-pulled.less +25 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/core.less +12 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/fixed-width.less +6 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/font-awesome.less +17 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/icons.less +697 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/larger.less +13 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/list.less +19 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/mixins.less +26 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/path.less +15 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/rotated-flipped.less +20 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/spinning.less +29 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/stacked.less +20 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/variables.less +708 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_animated.scss +34 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_bordered-pulled.scss +25 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_core.scss +12 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_fixed-width.scss +6 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_icons.scss +697 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_larger.scss +13 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_list.scss +19 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_mixins.scss +26 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_path.scss +15 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_rotated-flipped.scss +20 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_spinning.scss +29 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_stacked.scss +20 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_variables.scss +708 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/font-awesome.scss +17 -0
- data/app/assets/stylesheets/rails_marketplace/images/1.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/4.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/american-express.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/back_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/back_enabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/back_enabled_hover.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/alpha-horizontal.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/alpha.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/hue-horizontal.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/hue.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/saturation.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/data.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/favicon.ico +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/forward_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/forward_enabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/forward_enabled_hover.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/icons.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/img.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/loading.gif +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/mastercard.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/paypal2.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/picture-2.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/picture.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/picture2.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod1.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod2.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod3.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod4.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod5.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-flat.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-modern.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-nice.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-simple.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/user.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/visa.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/marketplace.scss +20 -0
- data/app/assets/stylesheets/rails_marketplace/pace.css +76 -0
- data/app/assets/stylesheets/rails_marketplace/welcome.scss +3 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/rails_marketplace/admin_controller.rb +151 -0
- data/app/controllers/rails_marketplace/application_controller.rb +4 -0
- data/app/controllers/rails_marketplace/catalog_controller.rb +172 -0
- data/app/controllers/rails_marketplace/seller_controller.rb +181 -0
- data/app/helpers/rails_marketplace/admin_helper.rb +16 -0
- data/app/helpers/rails_marketplace/application_helper.rb +4 -0
- data/app/helpers/rails_marketplace/catalog_helper.rb +4 -0
- data/app/helpers/rails_marketplace/plainpage_helper.rb +4 -0
- data/app/helpers/rails_marketplace/seller_helper.rb +16 -0
- data/app/models/rails_marketplace/admin.rb +10 -0
- data/app/models/rails_marketplace/admin_setting.rb +13 -0
- data/app/models/rails_marketplace/cart.rb +49 -0
- data/app/models/rails_marketplace/cart_product.rb +7 -0
- data/app/models/rails_marketplace/category.rb +22 -0
- data/app/models/rails_marketplace/category_product.rb +6 -0
- data/app/models/rails_marketplace/customer.rb +6 -0
- data/app/models/rails_marketplace/order.rb +22 -0
- data/app/models/rails_marketplace/order_product.rb +7 -0
- data/app/models/rails_marketplace/product.rb +34 -0
- data/app/models/rails_marketplace/seller.rb +13 -0
- data/app/models/rails_marketplace/seller_setting.rb +5 -0
- data/app/views/layouts/rails_marketplace/application.html.erb +37 -0
- data/app/views/layouts/rails_marketplace/seller_central.html.erb +58 -0
- data/app/views/layouts/rails_marketplace/super_admin.html.erb +58 -0
- data/app/views/rails_marketplace/admin/add_category.html.erb +63 -0
- data/app/views/rails_marketplace/admin/categories.html.erb +50 -0
- data/app/views/rails_marketplace/admin/category_products.html.erb +54 -0
- data/app/views/rails_marketplace/admin/dashboard.html.erb +50 -0
- data/app/views/rails_marketplace/admin/edit_category.html.erb +63 -0
- data/app/views/rails_marketplace/admin/login_form.html.erb +20 -0
- data/app/views/rails_marketplace/admin/products.html.erb +54 -0
- data/app/views/rails_marketplace/admin/seller_products.html.erb +54 -0
- data/app/views/rails_marketplace/admin/sellers.html.erb +48 -0
- data/app/views/rails_marketplace/admin/settings_form.html.erb +39 -0
- data/app/views/rails_marketplace/admin/signup_form.html.erb +25 -0
- data/app/views/rails_marketplace/catalog/cart.html.erb +80 -0
- data/app/views/rails_marketplace/catalog/category_products.html.erb +52 -0
- data/app/views/rails_marketplace/catalog/checkout.html.erb +207 -0
- data/app/views/rails_marketplace/catalog/checkout_success.html.erb +15 -0
- data/app/views/rails_marketplace/catalog/index.html.erb +1 -0
- data/app/views/rails_marketplace/catalog/product_detail.html.erb +88 -0
- data/app/views/rails_marketplace/partials/_admin_sidenav.html.erb +80 -0
- data/app/views/rails_marketplace/partials/_admin_topnav.html.erb +111 -0
- data/app/views/rails_marketplace/partials/_footer.html.erb +19 -0
- data/app/views/rails_marketplace/partials/_menu.html.erb +42 -0
- data/app/views/rails_marketplace/partials/_sidenav.html.erb +77 -0
- data/app/views/rails_marketplace/partials/_topnav.html.erb +105 -0
- data/app/views/rails_marketplace/seller/add_bulk_products.html.erb +0 -0
- data/app/views/rails_marketplace/seller/add_product.html.erb +67 -0
- data/app/views/rails_marketplace/seller/dashboard.html.erb +50 -0
- data/app/views/rails_marketplace/seller/edit_product.html.erb +69 -0
- data/app/views/rails_marketplace/seller/login_form.html.erb +36 -0
- data/app/views/rails_marketplace/seller/order_details.html.erb +69 -0
- data/app/views/rails_marketplace/seller/orders.html.erb +68 -0
- data/app/views/rails_marketplace/seller/products.html.erb +55 -0
- data/app/views/rails_marketplace/seller/settings_general.html.erb +64 -0
- data/app/views/rails_marketplace/seller/settings_payment.html.erb +34 -0
- data/app/views/rails_marketplace/seller/settings_shipping.html.erb +34 -0
- data/app/views/rails_marketplace/seller/settings_tax.html.erb +34 -0
- data/app/views/rails_marketplace/seller/signup_form.html.erb +28 -0
- data/app/views/rails_marketplace/seller/step_two.html.erb +17 -0
- data/app/views/rails_marketplace/shared/_admin_error_messages.html.erb +12 -0
- data/app/views/rails_marketplace/shared/_product_error_messages.html.erb +12 -0
- data/app/views/rails_marketplace/shared/_seller_error_messages.html.erb +12 -0
- data/config/routes.rb +58 -0
- data/db/migrate/20161013194852_create_sellers.rb +13 -0
- data/db/migrate/20161013195006_create_customers.rb +13 -0
- data/db/migrate/20161013195758_create_orders.rb +8 -0
- data/db/migrate/20161014013032_create_category_products.rb +10 -0
- data/db/migrate/20161014013058_create_order_products.rb +13 -0
- data/db/migrate/20161017185755_create_admins.rb +12 -0
- data/db/migrate/20161017232347_create_products.rb +14 -0
- data/db/migrate/20161019012043_add_reference_product_seller.rb +5 -0
- data/db/migrate/20161019013502_change_data_type_images_files.rb +6 -0
- data/db/migrate/20161019022020_add_reference_order_customers.rb +5 -0
- data/db/migrate/20161109191644_create_categories.rb +15 -0
- data/db/migrate/20161110021043_create_friendly_id_slugs.rb +15 -0
- data/db/migrate/20161110021131_add_slug_to_category.rb +6 -0
- data/db/migrate/20161110024118_add_slug_to_product.rb +6 -0
- data/db/migrate/20161111001446_create_carts.rb +8 -0
- data/db/migrate/20161111004451_create_cart_products.rb +12 -0
- data/db/migrate/20161115013956_add_currency_format_to_price.rb +6 -0
- data/db/migrate/20161115015227_monetize_product.rb +5 -0
- data/db/migrate/20161115032905_add_stripe_key_to_admin.rb +6 -0
- data/db/migrate/20161124015608_add_order_fields.rb +16 -0
- data/db/migrate/20161207193917_add_seller_to_orders.rb +6 -0
- data/db/migrate/20161208012601_add_price_to_cart_products.rb +6 -0
- data/db/migrate/20161208013402_add_money_to_cart_products.rb +6 -0
- data/db/migrate/20170217183953_create_seller_settings.rb +29 -0
- data/db/migrate/20170218003202_create_admin_settings.rb +24 -0
- data/db/migrate/20170224230449_create_stripe_managed_accounts.rb +9 -0
- data/db/migrate/20170224233736_add_stripe_to_admin_settings.rb +9 -0
- data/db/migrate/20170224235259_add_id_to_settings.rb +6 -0
- data/db/migrate/20170225002939_delete_stripe_accounts.rb +8 -0
- data/db/migrate/20170225003252_add_stripe_account_id_to_seller_settings.rb +5 -0
- data/lib/rails_marketplace.rb +4 -0
- data/lib/rails_marketplace/engine.rb +9 -0
- data/lib/rails_marketplace/version.rb +3 -0
- data/lib/tasks/rails_marketplace_tasks.rake +4 -0
- data/spec/controllers/rails_marketplace/catalog_controller_spec.rb +75 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +32 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/schema.rb +194 -0
- data/spec/dummy/log/development.log +889 -0
- data/spec/dummy/log/test.log +1229 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/rails_marketplace/catalog_helper_spec.rb +17 -0
- data/spec/routing/rails_marketplace/catalog_routing_spec.rb +44 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/views/rails_marketplace/catalog/edit.html.erb_spec.rb +15 -0
- data/spec/views/rails_marketplace/catalog/index.html.erb_spec.rb +15 -0
- data/spec/views/rails_marketplace/catalog/new.html.erb_spec.rb +15 -0
- data/spec/views/rails_marketplace/catalog/show.html.erb_spec.rb +12 -0
- metadata +595 -0
@@ -0,0 +1,181 @@
|
|
1
|
+
require_dependency "rails_marketplace/application_controller"
|
2
|
+
|
3
|
+
module RailsMarketplace
|
4
|
+
class SellerController < ApplicationController
|
5
|
+
layout 'rails_marketplace/seller_central'
|
6
|
+
include SellerHelper
|
7
|
+
|
8
|
+
before_action :require_login, :except => [:login_form, :login, :signup_form, :signup]
|
9
|
+
before_action :set_current_seller
|
10
|
+
before_action :set_current_product, :only => [:edit_product, :update_product, :delete_product]
|
11
|
+
|
12
|
+
def login_form
|
13
|
+
if seller_logged_in?
|
14
|
+
redirect_to seller_dashboard_path
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def login
|
19
|
+
seller = Seller.find_by(email: params[:seller][:email].downcase)
|
20
|
+
if seller && seller.authenticate(params[:seller][:password])
|
21
|
+
seller_log_in seller
|
22
|
+
redirect_to seller_dashboard_path
|
23
|
+
else
|
24
|
+
flash[:error] = 'Invalid email/password combination'
|
25
|
+
render 'login_form'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def signup_form
|
30
|
+
@seller = Seller.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def signup
|
34
|
+
@seller = Seller.new(seller_params)
|
35
|
+
if @seller.save
|
36
|
+
if @seller.seller_setting.nil?
|
37
|
+
SellerSetting.create seller_id: @seller.id
|
38
|
+
|
39
|
+
Stripe.api_key = AdminSetting.stripe_secret_key
|
40
|
+
|
41
|
+
managed_account = Stripe::Account.create(
|
42
|
+
:managed => true,
|
43
|
+
:country => 'US',
|
44
|
+
:email => @seller.email
|
45
|
+
)
|
46
|
+
|
47
|
+
seller_setting = SellerSetting.find_by_seller_id(@seller.id)
|
48
|
+
seller_setting.update_attributes({:stripe_account_id => managed_account.id, :stripe_secret_key => managed_account.keys.secret, :stripe_publishable_key => managed_account.keys.publishable})
|
49
|
+
end
|
50
|
+
seller_log_in @seller
|
51
|
+
redirect_to seller_dashboard_path
|
52
|
+
else
|
53
|
+
render 'signup_form'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def logout
|
58
|
+
seller_log_out
|
59
|
+
redirect_to seller_login_path
|
60
|
+
end
|
61
|
+
|
62
|
+
def dashboard
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
def products
|
67
|
+
@products = Product.where(seller: @current_seller)
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_product
|
71
|
+
@product = Product.new
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_product
|
75
|
+
@product = Product.new(product_params)
|
76
|
+
@product.seller = @current_seller
|
77
|
+
if @product.save
|
78
|
+
flash[:notice] = 'New product was successfully added!'
|
79
|
+
redirect_to seller_products_path
|
80
|
+
else
|
81
|
+
render 'add_product'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def edit_product
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
def update_product
|
90
|
+
if @product.update_attributes(product_params)
|
91
|
+
flash[:notice] = 'Product was successfully updated!'
|
92
|
+
redirect_to seller_products_path
|
93
|
+
else
|
94
|
+
render 'update_product'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def delete_product
|
99
|
+
@product.destroy
|
100
|
+
redirect_to seller_products_path
|
101
|
+
end
|
102
|
+
|
103
|
+
def add_bulk_products
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
def orders
|
108
|
+
@orders = Order.where(seller_id: @current_seller.id)
|
109
|
+
# @order_products = OrderProduct.where(seller: @current_seller)
|
110
|
+
end
|
111
|
+
|
112
|
+
def order_details
|
113
|
+
order_id = params[:order_id]
|
114
|
+
@order = Order.find(order_id)
|
115
|
+
if @order.seller_id != @current_seller.id
|
116
|
+
flash[:error] = "The page you’re looking for could not be found. Please make sure the web address is correct."
|
117
|
+
redirect_to seller_orders_path
|
118
|
+
end
|
119
|
+
|
120
|
+
@order_products = @order.order_products
|
121
|
+
end
|
122
|
+
|
123
|
+
def settings_general
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
def settings_general_update
|
128
|
+
@current_seller.update_attributes(seller_params)
|
129
|
+
redirect_to seller_dashboard_path
|
130
|
+
end
|
131
|
+
|
132
|
+
def settings_shipping
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
def settings_shipping_update
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
def settings_payment
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
def settings_payment_update
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
def settings_tax
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
def seller_params
|
156
|
+
params.require(:seller).permit(:first_name, :last_name, :email, :password,
|
157
|
+
:password_confirmation)
|
158
|
+
end
|
159
|
+
|
160
|
+
def set_current_seller
|
161
|
+
return unless session[:seller_id]
|
162
|
+
@current_seller ||= Seller.find(session[:seller_id])
|
163
|
+
end
|
164
|
+
|
165
|
+
def require_login
|
166
|
+
unless seller_logged_in?
|
167
|
+
flash[:error] = "You must be logged in to access this section"
|
168
|
+
redirect_to seller_login_path # halts request cycle
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def product_params
|
173
|
+
params.require(:product).permit(:title, :description, :price, :quantity, {images: []}, {files: []}, {category_ids: []})
|
174
|
+
end
|
175
|
+
|
176
|
+
def set_current_product
|
177
|
+
return unless params[:id]
|
178
|
+
@product ||= Product.find(params[:id])
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module RailsMarketplace
|
2
|
+
module AdminHelper
|
3
|
+
# Logs in the given seller.
|
4
|
+
def admin_log_in(admin)
|
5
|
+
session[:admin_id] = admin.id
|
6
|
+
end
|
7
|
+
|
8
|
+
def admin_logged_in?
|
9
|
+
!session[:admin_id].nil?
|
10
|
+
end
|
11
|
+
|
12
|
+
def admin_log_out
|
13
|
+
session.delete(:admin_id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module RailsMarketplace
|
2
|
+
module SellerHelper
|
3
|
+
# Logs in the given seller.
|
4
|
+
def seller_log_in(seller)
|
5
|
+
session[:seller_id] = seller.id
|
6
|
+
end
|
7
|
+
|
8
|
+
def seller_logged_in?
|
9
|
+
!session[:seller_id].nil?
|
10
|
+
end
|
11
|
+
|
12
|
+
def seller_log_out
|
13
|
+
session.delete(:seller_id)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module RailsMarketplace
|
2
|
+
class Cart < ActiveRecord::Base
|
3
|
+
has_many :cart_products, :dependent => :destroy
|
4
|
+
has_many :products, :through => :cart_products
|
5
|
+
# belongs_to :customer
|
6
|
+
|
7
|
+
def add_product(product_id, quantity)
|
8
|
+
cart_product = cart_products.where('product_id = ?', product_id).first
|
9
|
+
if cart_product
|
10
|
+
# increase the quantity of product in cart
|
11
|
+
cart_product.quantity = cart_product.quantity + quantity.to_i
|
12
|
+
cart_product.save
|
13
|
+
else
|
14
|
+
# product does not exist in cart
|
15
|
+
cart_products << CartProduct.new(product_id: product_id, quantity: quantity, price: Product.find(product_id).price)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete_product(product_id)
|
20
|
+
cart_products.delete(CartProduct.find_by(product_id: product_id))
|
21
|
+
end
|
22
|
+
|
23
|
+
def cart_quantity
|
24
|
+
total = 0
|
25
|
+
cart_products.each do |cart_product|
|
26
|
+
total += cart_product.quantity
|
27
|
+
end
|
28
|
+
total
|
29
|
+
end
|
30
|
+
|
31
|
+
def cart_subtotal
|
32
|
+
subtotal = 0
|
33
|
+
cart_products.each do |cart_product|
|
34
|
+
subtotal += cart_product.quantity * cart_product.price
|
35
|
+
end
|
36
|
+
subtotal
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_product_groups
|
40
|
+
product_groups = {}
|
41
|
+
cart_products.each do |cart_product|
|
42
|
+
seller_id = Product.find(cart_product.product_id).seller.id
|
43
|
+
(product_groups[seller_id] ||= []) << cart_product
|
44
|
+
end
|
45
|
+
product_groups
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RailsMarketplace
|
2
|
+
class Category < ActiveRecord::Base
|
3
|
+
extend ActsAsTree::TreeWalker
|
4
|
+
include FriendlyId
|
5
|
+
friendly_id :name, :use => :slugged
|
6
|
+
|
7
|
+
has_many :category_products, :dependent => :destroy, :autosave => true , :inverse_of => :category
|
8
|
+
accepts_nested_attributes_for :category_products, :allow_destroy => true, :reject_if => :all_blank
|
9
|
+
has_many :products, :through => :category_products
|
10
|
+
|
11
|
+
acts_as_tree order: 'parent_id'
|
12
|
+
|
13
|
+
def should_generate_new_friendly_id?
|
14
|
+
name_changed?
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.root_categories
|
18
|
+
where(parent_id: nil).order('id asc')
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RailsMarketplace
|
2
|
+
class Order < ActiveRecord::Base
|
3
|
+
has_many :order_products
|
4
|
+
has_many :products, :through => :order_products
|
5
|
+
belongs_to :customer
|
6
|
+
belongs_to :seller
|
7
|
+
|
8
|
+
def save_products(cart_products)
|
9
|
+
cart_products.each do |cart_product|
|
10
|
+
order_products << OrderProduct.new(product_id: cart_product.product_id, quantity: cart_product.quantity, price: cart_product.price)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def order_subtotal
|
15
|
+
subtotal = 0
|
16
|
+
order_products.each do |order_product|
|
17
|
+
subtotal += order_product.quantity * order_product.price
|
18
|
+
end
|
19
|
+
subtotal
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module RailsMarketplace
|
2
|
+
class Product < ActiveRecord::Base
|
3
|
+
include FriendlyId
|
4
|
+
friendly_id :title, :use => :slugged
|
5
|
+
monetize :price_cents, :allow_nil => true
|
6
|
+
|
7
|
+
has_many :category_products, :dependent => :destroy, :autosave => true , :inverse_of => :product
|
8
|
+
accepts_nested_attributes_for :category_products, :allow_destroy => true, :reject_if => :all_blank
|
9
|
+
has_many :categories, :through => :category_products
|
10
|
+
|
11
|
+
belongs_to :seller
|
12
|
+
|
13
|
+
has_many :cart_products
|
14
|
+
has_many :carts, :through => :cart_products
|
15
|
+
|
16
|
+
has_many :order_products
|
17
|
+
has_many :orders, :through => :order_products
|
18
|
+
|
19
|
+
serialize :images, JSON
|
20
|
+
serialize :files, JSON
|
21
|
+
mount_uploaders :images, ProductImagesUploader
|
22
|
+
# mount_uploaders :files, ProductFilesUploader
|
23
|
+
|
24
|
+
validates :title, :presence => true
|
25
|
+
validates :images, :presence => true
|
26
|
+
validates :price, :presence => true
|
27
|
+
validates :quantity, :presence => true
|
28
|
+
# validates :files, :presence => true
|
29
|
+
|
30
|
+
def should_generate_new_friendly_id?
|
31
|
+
title_changed?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module RailsMarketplace
|
2
|
+
class Seller < ActiveRecord::Base
|
3
|
+
has_many :products
|
4
|
+
has_many :orders
|
5
|
+
has_one :seller_setting
|
6
|
+
|
7
|
+
validates :first_name, :presence => true
|
8
|
+
validates :last_name, :presence => true
|
9
|
+
validates :email, :presence => true
|
10
|
+
has_secure_password
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|