c80_catoffers 0.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/CODE_OF_CONDUCT.md +49 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +44 -0
  7. data/Rakefile +2 -0
  8. data/app/admin/c80_catoffers/categories.rb +49 -0
  9. data/app/admin/c80_catoffers/offers.rb +69 -0
  10. data/app/admin/c80_catoffers/props.rb +44 -0
  11. data/app/assets/javascripts/c80_catoffers/offer_full_desc.js +53 -0
  12. data/app/assets/javascripts/c80_catoffers.js.coffee +1 -0
  13. data/app/assets/stylesheets/c80_catoffers/offer_full_desc.scss +24 -0
  14. data/app/assets/stylesheets/c80_catoffers/offer_full_desc_slick_custom.scss +112 -0
  15. data/app/assets/stylesheets/c80_catoffers/offer_list_grouped.scss +3 -0
  16. data/app/assets/stylesheets/c80_catoffers/offer_list_iconed.scss +80 -0
  17. data/app/assets/stylesheets/c80_catoffers.scss +1 -0
  18. data/app/assets/stylesheets/c80_catoffers_backend/page_admin_props.scss +19 -0
  19. data/app/assets/stylesheets/c80_catoffers_backend.scss +1 -0
  20. data/app/helpers/c80_catoffers/app_helper.rb +93 -0
  21. data/app/helpers/c80_catoffers/urls_helper.rb +22 -0
  22. data/app/models/c80_catoffers/category.rb +21 -0
  23. data/app/models/c80_catoffers/offer.rb +62 -0
  24. data/app/models/c80_catoffers/ophoto.rb +8 -0
  25. data/app/models/c80_catoffers/prop.rb +5 -0
  26. data/app/uploaders/c80_catoffers/ophoto_uploader.rb +29 -0
  27. data/app/views/c80_catoffers/_offer_full_desc.html.erb +61 -0
  28. data/app/views/c80_catoffers/_offers_list_by_cat.html.erb +14 -0
  29. data/app/views/c80_catoffers/_offers_list_grouped.html.erb +28 -0
  30. data/app/views/c80_catoffers/_offers_list_iconed.html.erb +23 -0
  31. data/bin/console +14 -0
  32. data/bin/setup +8 -0
  33. data/c80_catoffers.gemspec +26 -0
  34. data/config/routes.rb +13 -0
  35. data/db/migrate/201609221321_c80_catoffers_create_props.rb +19 -0
  36. data/db/migrate/201609221322_c80_catoffers_create_categories.rb +13 -0
  37. data/db/migrate/201609221333_c80_catoffers_create_offers.rb +14 -0
  38. data/db/migrate/201609221334_c80_catoffers_create_ophotos.rb +10 -0
  39. data/db/migrate/20160922152020_c80_catoffers_add_join_table_categories_offers.rb +11 -0
  40. data/db/migrate/20161008123434_c80_catoffers_add_thumb_sm_to_props.rb +6 -0
  41. data/db/migrate/20161008134848_c80_catoffers_add_join_table_offers_props.rb +11 -0
  42. data/db/migrate/20161008151414_c80_catoffers_add_positions_count_to_props.rb +5 -0
  43. data/db/seeds/c80_catoffers_01_fill_props.rb +13 -0
  44. data/db/seeds/x02_fill_categories.rb +42 -0
  45. data/db/seeds/x03_fill_offers.rb +20 -0
  46. data/lib/c80_catoffers/engine.rb +23 -0
  47. data/lib/c80_catoffers/version.rb +3 -0
  48. data/lib/c80_catoffers.rb +8 -0
  49. metadata +133 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2904023e8ffae22e7fba1cbc7d31001a3a9971dd
4
+ data.tar.gz: 9b89351c5229c814fed16378f0a3fb10f43a5acf
5
+ SHA512:
6
+ metadata.gz: 97125706ab687f010331a72de5f662c5a004f62d0212fbfec1d46679576705e474d887a3e9f1f12d8365ca6bf189c383fef3f06599988967b0cb54e5d711bf6a
7
+ data.tar.gz: fc6ee5387a778ba10505f547b6585d8e0ffdf109c7bd077e8d7d868a57468c90f337f21117dee7a6f65620d0b9c405acde0f8e49852b07462494dce0cef10053
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.idea/
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at c080609a@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in c80_catoffers.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 C80609A
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # C80Catoffers
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/c80_catoffers`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'c80_catoffers'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install c80_catoffers
22
+
23
+ ## Usage
24
+
25
+ ```scss
26
+ @import "c80_catoffers";
27
+ @import "c80_catoffers_backend";
28
+ ```
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/c80_catoffers. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
+
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
44
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,49 @@
1
+ ActiveAdmin.register C80Catoffers::Category, as: 'Category' do
2
+
3
+ menu :label => 'Категории', # TODO_MY:: название пункта меню перенесести в параметры в базу
4
+ priority: 1,
5
+ parent: 'Услуги'# TODO_MY:: название пункта меню перенесести в параметры в базу
6
+
7
+ permit_params :title,
8
+ :slug,
9
+ :parent_category_id
10
+
11
+ config.per_page = 100
12
+ batch_action :destroy, false
13
+ config.sort_order = 'ord_asc'
14
+ before_filter :skip_sidebar!, :only => :index
15
+
16
+ index do
17
+ selectable_column
18
+ column :title
19
+ column :parent_category
20
+ column :child_categories do |cat|
21
+ res = ""
22
+ if cat.child_categories.count > 0
23
+ cat.child_categories.map do |subcat|
24
+ res += "#{subcat.title}<br>"
25
+ end
26
+ end
27
+ res.html_safe
28
+ end
29
+ actions
30
+ end
31
+
32
+ form(:html => {:multipart => true}) do |f|
33
+
34
+ f.inputs 'Свойства' do
35
+ f.input :title
36
+ f.input :parent_category,
37
+ :as => :select,
38
+ :input_html => {
39
+ :class => 'selectpicker',
40
+ 'data-size' => "10",
41
+ 'data-width' => '400px',
42
+ :multiple => false
43
+ }
44
+ end
45
+
46
+ f.actions
47
+ end
48
+
49
+ end
@@ -0,0 +1,69 @@
1
+ ActiveAdmin.register C80Catoffers::Offer, as: 'Offer' do
2
+
3
+ config.per_page = 100
4
+
5
+ menu :label => 'Список услуг', # TODO_MY:: название пункта меню перенесести в параметры в базу
6
+ priority: 2,
7
+ parent: 'Услуги'# TODO_MY:: название пункта меню перенесести в параметры в базу
8
+
9
+ permit_params :title,
10
+ :price,
11
+ :short_desc,
12
+ :desc,
13
+ :ophotos_attributes => [:id, :image, :_destroy],
14
+ :prop_ids => [],
15
+ :category_ids => []
16
+
17
+ batch_action :destroy, false
18
+
19
+ config.sort_order = 'id_asc'
20
+
21
+ # before_filter :skip_sidebar!, :only => :index
22
+
23
+ index do
24
+ selectable_column
25
+ column :title
26
+ column :price
27
+ column :short_desc
28
+ column :ophoto do |offer|
29
+ if offer.ophotos.count > 0
30
+ link_to image_tag(offer.ophotos.first.image.thumb_preview, style: 'width:150px;'), offer.ophotos.first.image.url, target: '_blank'
31
+ end
32
+ end
33
+ # column :desc do |offer|
34
+ # offer.desc.html_safe if offer.desc.present?
35
+ # end
36
+ actions
37
+ end
38
+
39
+ form(:html => {:multipart => true}) do |f|
40
+
41
+ f.inputs 'Свойства' do
42
+
43
+ f.input :title
44
+ f.input :categories,
45
+ :as => :select,
46
+ :include_blank => true,
47
+ :input_html => {
48
+ :class => 'selectpicker',
49
+ 'data-size' => "10",
50
+ 'data-width' => '400px',
51
+ :multiple => false
52
+ }
53
+
54
+ f.input :price
55
+ f.input :short_desc
56
+ f.input :desc, :as => :ckeditor, input_html: {:ckeditor => {:height => 410}}
57
+
58
+ f.has_many :ophotos, :allow_destroy => true do |gp|
59
+ gp.input :image,
60
+ :as => :file,
61
+ :hint => image_tag(gp.object.image.thumb_preview)
62
+ end
63
+
64
+ end
65
+
66
+ f.actions
67
+ end
68
+
69
+ end
@@ -0,0 +1,44 @@
1
+ ActiveAdmin.register C80Catoffers::Prop, as: 'Prop' do
2
+
3
+ config.per_page = 100
4
+
5
+ menu :label => 'Настройки', # TODO_MY:: название пункта меню перенесести в параметры в базу
6
+ priority: 3,
7
+ parent: 'Услуги' # TODO_MY:: название пункта меню перенесести в параметры в базу
8
+
9
+ permit_params :positions_count,
10
+ :offer_ids => []
11
+
12
+ batch_action :destroy, false
13
+
14
+ config.sort_order = 'id_asc'
15
+
16
+ before_filter :skip_sidebar!, :only => :index
17
+
18
+ index do
19
+ # selectable_column
20
+ column 'Список который выводится в виджете' do |prop|
21
+ res = ''
22
+ prop.offers.map do |offer|
23
+ res += "<li>#{offer.title}</li>"
24
+ end
25
+ "<ul>#{res}</ul>".html_safe
26
+ end
27
+ column :positions_count
28
+ actions
29
+ end
30
+
31
+ form(:html => {:multipart => true}) do |f|
32
+
33
+ f.inputs 'Свойства' do
34
+
35
+ f.input :offers,
36
+ :as => :check_boxes
37
+ f.input :positions_count
38
+
39
+ end
40
+
41
+ f.actions
42
+ end
43
+
44
+ end
@@ -0,0 +1,53 @@
1
+ $(document).ready(function() {
2
+
3
+ var $c = $('.offer_full_desc');
4
+ var $w = $c.find("div.big_gallery_wrapper");
5
+ var $nav = $c.find('div.nav_gallery_wrapper');
6
+
7
+ $w.magnificPopup({
8
+ delegate: 'a',
9
+ fixedContentPos: false,
10
+ removalDelay: 300,
11
+ mainClass: 'mfp-fade',
12
+ type: 'image',
13
+ gallery: {enabled:true}
14
+ });
15
+
16
+ $w.slick({
17
+ slidesToShow: 1,
18
+ slidesToScroll: 1,
19
+ autoplay: false,
20
+ fade:true,
21
+ arrows:true,
22
+ speed: 200,
23
+ dots:false,
24
+ infinite: true,
25
+ asNavFor: '#offer_gallery'// TODO:: это негибкий хардкод, а что если на странице будет несколько галерей такого типа?
26
+ });
27
+
28
+ $nav.slick({
29
+ slidesToShow: 3,
30
+ slidesToScroll: 1,
31
+ asNavFor: '#offer_gallery', // TODO:: это негибкий хардкод, а что если на странице будет несколько галерей такого типа?
32
+ dots: false,
33
+ speed: 200,
34
+ //centerMode: true,
35
+ arrows:false,
36
+ focusOnSelect: true
37
+ });
38
+
39
+ /*setTimeout(function() {
40
+ var $b = $("#gallery3_nav").find(".img-holder");
41
+ //console.log($b);
42
+ $b.bind({
43
+ mouseenter: function() {
44
+ $(this).addClass("plusOpacity");
45
+ },
46
+ mouseleave: function() {
47
+ $(this).removeClass("plusOpacity");
48
+ }
49
+ })
50
+ },100);*/
51
+
52
+
53
+ });
@@ -0,0 +1 @@
1
+ #= require_tree ./c80_catoffers
@@ -0,0 +1,24 @@
1
+ /* layout */
2
+
3
+ .offer_full_desc.skin_default {
4
+
5
+ div.left {
6
+ float: left;
7
+ /* ширина и высота задаётся с помощью custom css в хост приложении */
8
+
9
+ /* скроем навигационную галерею, если в ней один элемент */
10
+ div.bottom {
11
+ &.count_1 {
12
+ height: 0 !important;
13
+ overflow: hidden;
14
+ }
15
+ }
16
+
17
+ }
18
+
19
+ div.right {
20
+ float: left;
21
+ /* ширина и высота задаётся с помощью custom css в хост приложении */
22
+ }
23
+
24
+ }
@@ -0,0 +1,112 @@
1
+ .big_gallery_wrapper {
2
+ padding: 0;
3
+ overflow: hidden;
4
+
5
+ img {
6
+ max-width: 100%;
7
+ }
8
+
9
+ button {
10
+ z-index: 999;
11
+ }
12
+
13
+
14
+ }
15
+
16
+ .nav_gallery_wrapper {
17
+
18
+ img {
19
+ max-width: 100%;
20
+ }
21
+
22
+ }
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ /*
31
+ .slick-prev,
32
+ .slick-next {
33
+
34
+ &:before {
35
+ font-size: 60px;
36
+ color: #FECC00;
37
+ content: '';
38
+ }
39
+
40
+ width: 50px !important;
41
+ height: 51px !important;
42
+ cursor: pointer;
43
+ position: absolute;
44
+
45
+ &.slick-prev {
46
+ background: image-url("arrows.png") no-repeat top left ;
47
+ top: 105px;
48
+ left: -53px;
49
+ &:hover {
50
+ background: image-url("arrows.png") no-repeat bottom left;
51
+ }
52
+ }
53
+
54
+ &.slick-next {
55
+ background: image-url("arrows.png") no-repeat top right;
56
+ top: 105px;
57
+ right: -49px;
58
+ &:hover {
59
+ background: image-url("arrows.png") no-repeat bottom right;
60
+ }
61
+ }
62
+
63
+ }
64
+
65
+ .slick-dots {
66
+ float: left;
67
+ position: relative;
68
+ top: 16px;
69
+ width: 100%;
70
+ z-index: 999;
71
+ }
72
+
73
+ .slick-dots li {
74
+ margin: 0;
75
+ }
76
+
77
+ .slick-dots li button {
78
+
79
+ background: transparent image-url("slide.png") no-repeat top center;
80
+
81
+ width: 12px;
82
+ height: 14px;
83
+ border-radius: 999px;
84
+ cursor: pointer;
85
+ overflow: hidden;
86
+ display: block;
87
+
88
+
89
+ &:before {
90
+ content:"";
91
+ width: 0;
92
+ position: absolute;
93
+ */
94
+ /* font-size: 6px;
95
+ line-height: 20px;
96
+ position: absolute;
97
+ top: 0px;
98
+ left: 0px;
99
+ width: 20px;
100
+ height: 20px;
101
+ text-align: center;
102
+ opacity: 0.25;
103
+ color: #000;*//*
104
+
105
+ }
106
+
107
+ }
108
+
109
+ .slick-active button {
110
+ background: image-url("slide-hower.png") no-repeat top center !important;
111
+ }
112
+ */
@@ -0,0 +1,3 @@
1
+ div.offer_list_grouped {
2
+
3
+ }
@@ -0,0 +1,80 @@
1
+ div.offer_list_iconed {
2
+
3
+ ul {
4
+ margin:0;
5
+ padding:0;
6
+ list-style: none;
7
+
8
+ li {
9
+
10
+ /* иконка категории в ссылке */
11
+ a.lazy-image-wrapper {
12
+ overflow: hidden;
13
+ float: left;
14
+ clear: left;
15
+
16
+ img {
17
+ max-width: 100%;
18
+ width: 100%;
19
+ }
20
+
21
+ }
22
+
23
+ /* название категории */
24
+ a.title {
25
+ display: inline-block;
26
+ float: left;
27
+ clear: right;
28
+ }
29
+
30
+ }
31
+
32
+ }
33
+
34
+ &.style_photostudio {
35
+
36
+ ul {
37
+
38
+
39
+ li {
40
+ margin-bottom: 13px;
41
+
42
+ /* иконка категории в ссылке */
43
+ a.lazy-image-wrapper {
44
+
45
+ img {
46
+
47
+ }
48
+
49
+ }
50
+
51
+ /* название категории */
52
+ a.title {
53
+ padding-left: 15px;
54
+ width: calc(100% - 80px);
55
+ }
56
+
57
+ }
58
+
59
+ }
60
+
61
+ }
62
+
63
+ &.list_count_0 {
64
+
65
+ ul {
66
+
67
+ li {
68
+ background-color: #dfffe4;
69
+
70
+ a.lazy-image-wrapper {
71
+ background-color: #e2dfff !important;
72
+ }
73
+
74
+ }
75
+
76
+ }
77
+
78
+ }
79
+
80
+ }
@@ -0,0 +1 @@
1
+ @import "c80_catoffers/**/*";
@@ -0,0 +1,19 @@
1
+ body.admin_props {
2
+
3
+ &.index {
4
+ .action_items {
5
+ display: none !important;
6
+ }
7
+ a.delete_link {
8
+ display: none !important;
9
+ }
10
+ a.view_link {
11
+ display: none !important;
12
+ }
13
+ }
14
+
15
+ &.edit {
16
+
17
+ }
18
+
19
+ }
@@ -0,0 +1 @@
1
+ @import "c80_catoffers_backend/**/*";