kkt_shoppe 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c5cfcba449d6f6034038dd1d0d1104fc0381a10
4
- data.tar.gz: 28e3701135c64020af85a4bf2717f39c69ad5d04
3
+ metadata.gz: 77f73aae190d929e1b27577771dd3144d27a2964
4
+ data.tar.gz: 9f09682d22e387fa69ff05277c0f177d6530e07f
5
5
  SHA512:
6
- metadata.gz: 80ac368443aac2d2c3477521c6d5a12883dbcc499aab321ed62e952e61b3d662aa22d0e6bac53f02988178140628d87ed1ce57afcc3881e2c43eb366aa58f69a
7
- data.tar.gz: c417f1d156158991fd39dbcb380cddb3ad09cc4244e9a136c484a63178d281e7e987b17982e9687eaee0b414efcc4de99dbe110287752ec2e7e5bf8ead9d3fce
6
+ metadata.gz: bf8e65bf71de2e49f0275e427ab2b1da0b9ea17f4ed33a532ae3d975f3ed3243adb80bfa3d2ffb21b51fe07b4b54e061479d48febbfb90705dde8edf520f71c3
7
+ data.tar.gz: 4800eb03becbab1d4cc981746084f0d6c6a2e7e2ac32ebc5289610c7a0cfbe56fe79c48918ea16f5038cdc6b46443fe4b7e9a4c177f11471324226c9de8b9801
data/README.md CHANGED
@@ -5,7 +5,6 @@ catalogue-based store into your Rails 4 applications.
5
5
 
6
6
  ![GemVersion](https://badge.fury.io/rb/kkt_shoppe.png)
7
7
  [![Code Climate](https://codeclimate.com/github/trykkt_shoppe/core/badges/gpa.svg)](https://codeclimate.com/github/trykkt_shoppe/core)
8
- [![Build Status](https://travis-ci.org/trykkt_shoppe/kkt_shoppe.svg?branch=master)](https://travis-ci.org/trykkt_shoppe/kkt_shoppe)
9
8
 
10
9
  * [Check out the website](http://trykkt_shoppe.com)
11
10
  * [View the demo site](http://demo.trykkt_shoppe.com)
@@ -36,7 +35,7 @@ instructions below and you'll be up and running in minutes.
36
35
 
37
36
  rails new my_store
38
37
  cd my_store
39
- echo "gem 'kkt_shoppe', '~> 1.0'" >> Gemfile
38
+ echo "gem 'kkt_shoppe'" >> Gemfile
40
39
  bundle
41
40
  rails generate kkt_shoppe:setup
42
41
  rails generate nifty:key_value_store:migration
@@ -40,7 +40,8 @@ module KktShoppe
40
40
  private
41
41
 
42
42
  def safe_params
43
- params[:product_category].permit(:name, :permalink, :description, :image_file, :parent_id, :permalink_includes_ancestors)
43
+ file_params = [:file, :parent_id, :role, :parent_type, :file => []]
44
+ params[:product_category].permit(:name, :permalink, :description, :parent_id, :permalink_includes_ancestors, :attachments => [:image => file_params])
44
45
  end
45
46
 
46
47
  end
@@ -29,13 +29,17 @@ module KktShoppe
29
29
  # No descendents
30
30
  scope :except_descendants, ->(record) { where.not(id: (Array.new(record.descendants) << record).flatten) }
31
31
 
32
- translates :name, :permalink, :description, :short_description
32
+ translates :name, :permalink, :description
33
33
  scope :ordered, -> { includes(:translations).order(:name) }
34
34
 
35
35
  # Set the permalink on callback
36
36
  before_validation :set_permalink, :set_ancestral_permalink
37
37
  after_save :set_child_permalinks
38
38
 
39
+ def attachments=(attrs)
40
+ if attrs["image"]["file"].present? then self.attachments.build(attrs["image"]) end
41
+ end
42
+
39
43
  def combined_permalink
40
44
  if self.permalink_includes_ancestors && self.ancestral_permalink.present?
41
45
  "#{self.ancestral_permalink}/#{self.permalink}"
@@ -39,10 +39,12 @@
39
39
 
40
40
  = field_set_tag t('kkt_shoppe.product_category.attachments') do
41
41
  %dl
42
- %dt= f.label :image_file, t('kkt_shoppe.product_category.image')
42
+ %dt= f.label "attachments[image][file]", t('kkt_shoppe.product_category.image')
43
43
  %dd
44
44
  = attachment_preview @product_category.image
45
- %p= f.file_field :image_file
45
+ %p= f.file_field "attachments[image][file]"
46
+ = f.hidden_field "attachments[image][role]", value: "image"
47
+ = f.hidden_field "attachments[image][parent_id]", value: @product_category.id
46
48
 
47
49
  %p.submit
48
50
  - unless @product_category.new_record?
@@ -2,8 +2,8 @@ class RemoveDefaultOnOrderItemWeight < ActiveRecord::Migration
2
2
  def up
3
3
  change_column_default :kkt_shoppe_order_items, :weight, nil
4
4
  end
5
-
5
+
6
6
  def down
7
7
  change_column_default :kkt_shoppe_order_items, :weight, 0.0
8
8
  end
9
- end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module KktShoppe
2
- VERSION = "1.3.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kkt_shoppe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Thompson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-02 00:00:00.000000000 Z
13
+ date: 2015-07-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -665,7 +665,7 @@ files:
665
665
  - lib/kkt_shoppe/version.rb
666
666
  - lib/kkt_shoppe/view_helpers.rb
667
667
  - lib/tasks/kkt_shoppe.rake
668
- homepage: http://www.kylekthompson.com
668
+ homepage: https://www.kylekthompson.com/
669
669
  licenses:
670
670
  - MIT
671
671
  metadata: {}