shoppe 1.0.9 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dcacefeadc890f3dc35dabd24f7287284cc479f
4
- data.tar.gz: 7db5436aac835634aa2f6cd135f6035a7e219da6
3
+ metadata.gz: c012b24bf7d34a02496487c0c0df907c4f70f59e
4
+ data.tar.gz: 686496219cad3da880f86b89a94b52fc8ca7c552
5
5
  SHA512:
6
- metadata.gz: 94959c589693f5a70d4fd2a838cee7ef2e3106ef4426775155b612f061ce4276df19de0c2d9ff7e8e823cdc06e357e1787e444930ee024a102260df32dff77c8
7
- data.tar.gz: 9cd175fe855bcb9234dbd7c519c2fb86edf133ba76094d4fd12f6c993adcc5006f1eb6d9a6fd90eb047e5dc2af77b2fa85b06a5372ee955a1f49c15144ab8003
6
+ metadata.gz: 9aa31f104d4b05d855e3efeaa79ef5cf446697627ee72f498863b4a1ee96063025a1223238318f4768c0d598e38ad14af12d67a2adad926f47bf185b1dd6def9
7
+ data.tar.gz: 6f3be3df3f66cf26e0f5b6dba2a0d754f22c476eaa56b0735c1ba2fdb56fa77e013d404e3595ecc06f0ea2f526ed509d5e1264538c88544301aa7bb6c329e0a8
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/shoppe.png)
7
7
  [![Code Climate](https://codeclimate.com/github/tryshoppe/core/badges/gpa.svg)](https://codeclimate.com/github/tryshoppe/core)
8
- [![Build Status](https://travis-ci.org/tryshoppe/shoppe.svg?branch=master)](https://travis-ci.org/tryshoppe/shoppe)
9
8
 
10
9
  * [Check out the website](http://tryshoppe.com)
11
10
  * [View the demo site](http://demo.tryshoppe.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 'shoppe', '~> 1.0'" >> Gemfile
38
+ echo "gem 'shoppe'" >> Gemfile
40
39
  bundle
41
40
  rails generate shoppe:setup
42
41
  rails generate nifty:key_value_store:migration
@@ -40,7 +40,8 @@ module Shoppe
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 Shoppe
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('shoppe.product_category.attachments') do
41
41
  %dl
42
- %dt= f.label :image_file, t('shoppe.product_category.image')
42
+ %dt= f.label "attachments[image][file]", t('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?
@@ -1,3 +1,3 @@
1
1
  module Shoppe
2
- VERSION = "1.0.9"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoppe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-01 00:00:00.000000000 Z
12
+ date: 2015-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails