refinerycms-retailers 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/javascripts/refinery/subregion-select.js.coffee.erb +10 -0
  3. data/app/controllers/refinery/retailers/admin/retailers_controller.rb +32 -0
  4. data/app/controllers/refinery/retailers/retailers_controller.rb +14 -0
  5. data/app/helpers/refinery/retailers/controller_helper.rb +14 -0
  6. data/app/helpers/refinery/retailers/retailers_helper.rb +19 -0
  7. data/app/models/refinery/retailers/retailer.rb +27 -0
  8. data/app/views/refinery/retailers/admin/retailers/_actions.html.erb +25 -0
  9. data/app/views/refinery/retailers/admin/retailers/_form.html.erb +83 -0
  10. data/app/views/refinery/retailers/admin/retailers/_records.html.erb +16 -0
  11. data/app/views/refinery/retailers/admin/retailers/_retailer.html.erb +48 -0
  12. data/app/views/refinery/retailers/admin/retailers/_retailers.html.erb +2 -0
  13. data/app/views/refinery/retailers/admin/retailers/_sortable_list.html.erb +5 -0
  14. data/app/views/refinery/retailers/admin/retailers/_subregion_select.html.erb +12 -0
  15. data/app/views/refinery/retailers/admin/retailers/edit.html.erb +1 -0
  16. data/app/views/refinery/retailers/admin/retailers/index.html.erb +7 -0
  17. data/app/views/refinery/retailers/admin/retailers/new.html.erb +1 -0
  18. data/app/views/refinery/retailers/retailers/_retailer.html.erb +82 -0
  19. data/app/views/refinery/retailers/retailers/index.html.erb +29 -0
  20. data/config/locales/cs.yml +35 -0
  21. data/config/locales/en.yml +49 -0
  22. data/config/locales/es.yml +36 -0
  23. data/config/locales/fr.yml +49 -0
  24. data/config/locales/it.yml +35 -0
  25. data/config/locales/nb.yml +35 -0
  26. data/config/locales/nl.yml +35 -0
  27. data/config/locales/sk.yml +35 -0
  28. data/config/locales/tr.yml +35 -0
  29. data/config/locales/zh-CN.yml +37 -0
  30. data/config/routes.rb +20 -0
  31. data/db/migrate/1_create_retailers_retailers.rb +36 -0
  32. data/db/migrate/2_add_body_to_retailers.rb +5 -0
  33. data/db/migrate/3_translate_retailers.rb +26 -0
  34. data/db/seeds.rb +18 -0
  35. data/lib/generators/refinery/retailers/retailers_generator.rb +24 -0
  36. data/lib/generators/refinery/retailers/templates/config/initializers/refinery/retailers.rb.erb +7 -0
  37. data/lib/refinery/retailers.rb +27 -0
  38. data/lib/refinery/retailers/configuration.rb +10 -0
  39. data/lib/refinery/retailers/engine.rb +24 -0
  40. data/lib/refinerycms-retailers.rb +1 -0
  41. data/lib/tasks/refinery/retailers.rake +13 -0
  42. data/readme.md +60 -0
  43. metadata +166 -0
@@ -0,0 +1,5 @@
1
+ class AddBodyToRetailers < ActiveRecord::Migration
2
+ def change
3
+ add_column :refinery_retailers, :body, :text
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ class TranslateRetailers < ActiveRecord::Migration
2
+ def self.up
3
+ begin
4
+ ::Refinery::Retailers::Retailer.create_translation_table!({
5
+ title: :string,
6
+ body: :text,
7
+ contact: :string,
8
+ website: :string,
9
+ address: :string,
10
+ city: :string
11
+ }, {
12
+ migrate_data: true
13
+ })
14
+ rescue NameError
15
+ warn "Refinery::Retailers was not defined!"
16
+ end
17
+ end
18
+
19
+ def self.down
20
+ begin
21
+ ::Refinery::Retailers::Retailer.drop_translation_table! migrate_data: true
22
+ rescue NameError
23
+ warn "Refinery::Retailers was not defined!"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ Refinery::User.find_each do |user|
2
+ user.plugins.where(name: 'refinerycms-retailers').first_or_create!(
3
+ position: (user.plugins.maximum(:position) || -1) +1
4
+ )
5
+ end if defined?(Refinery::User)
6
+
7
+ if defined?(::Refinery::Page)
8
+ retailers_index_page = Refinery::Page.find_by(link_url: Refinery::Retailers.page_path_index)
9
+
10
+ unless retailers_index_page
11
+ retailers_index_page = ::Refinery::Page.create({
12
+ title: "Retailers",
13
+ link_url: Refinery::Retailers.page_path_index,
14
+ menu_match: "^(/retailers.*)|#{Refinery::Retailers.page_path_index}$",
15
+ deletable: false
16
+ })
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ module Refinery
2
+ class RetailersGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def generate_retailers_initializer
6
+ template 'config/initializers/refinery/retailers.rb.erb', File.join(destination_root, 'config', 'initializers', 'refinery', 'retailers.rb')
7
+ end
8
+
9
+ def rake_db
10
+ rake "refinery_retailers:install:migrations"
11
+ end
12
+
13
+ def append_load_seed_data
14
+ create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
15
+ append_file 'db/seeds.rb', verbose: true do
16
+ <<-EOH
17
+
18
+ # Added by Refinery CMS Retailers extension
19
+ Refinery::Retailers::Engine.load_seed
20
+ EOH
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ Refinery::Retailers.configure do |config|
2
+ # Configure country priority in select
3
+ # config.country_priority = <%= Refinery::Retailers.country_priority.inspect %>
4
+
5
+ # Configure the URLs to use for the retailer functionality.
6
+ # config.page_path_index = <%= Refinery::Retailers.page_path_index.inspect %>
7
+ end
@@ -0,0 +1,27 @@
1
+ require 'refinerycms-core'
2
+
3
+ module Refinery
4
+ autoload :RetailersGenerator, 'generators/refinery/retailers/retailers_generator'
5
+
6
+ module Retailers
7
+ require 'refinery/retailers/engine'
8
+ require 'refinery/retailers/configuration'
9
+
10
+ class << self
11
+ attr_writer :root
12
+
13
+ def root
14
+ @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
15
+ end
16
+
17
+ def factory_paths
18
+ @factory_paths ||= [ root.join('spec', 'factories').to_s ]
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ ActiveSupport.on_load(:active_record) do
25
+ require 'carmen-rails'
26
+ require 'globalize'
27
+ end
@@ -0,0 +1,10 @@
1
+ module Refinery
2
+ module Retailers
3
+ include ActiveSupport::Configurable
4
+
5
+ config_accessor :country_priority, :page_path_index
6
+
7
+ self.country_priority = %w(US CA)
8
+ self.page_path_index = "/retailers"
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ module Refinery
2
+ module Retailers
3
+ class Engine < Rails::Engine
4
+ extend Refinery::Engine
5
+ isolate_namespace Refinery::Retailers
6
+
7
+ engine_name :refinery_retailers
8
+
9
+ before_inclusion do
10
+ Refinery::Plugin.register do |plugin|
11
+ plugin.name = "refinery_retailers"
12
+ plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.retailers_admin_retailers_path }
13
+ plugin.menu_match = %r{refinery/(retailers)(/.+?)?$}
14
+ plugin.pathname = root
15
+
16
+ end
17
+ end
18
+
19
+ config.after_initialize do
20
+ Refinery.register_extension(Refinery::Retailers)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ require 'refinery/retailers'
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :retailers do
4
+
5
+ # call this task by running: rake refinery:retailers:my_task
6
+ # desc "Description of my task below"
7
+ # task :my_task => :environment do
8
+ # # add your logic here
9
+ # end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,60 @@
1
+ # Refinery CMS Retailers
2
+
3
+ [![Build Status](https://travis-ci.org/bisscomm/refinerycms-retailers.svg?branch=master)](https://travis-ci.org/bisscomm/refinerycms-retailers) [![Code Climate](https://codeclimate.com/github/bisscomm/refinerycms-retailers/badges/gpa.svg)](https://codeclimate.com/github/bisscomm/refinerycms-retailers) [![Test Coverage](https://codeclimate.com/github/bisscomm/refinerycms-retailers/badges/coverage.svg)](https://codeclimate.com/github/bisscomm/refinerycms-retailers/coverage)
4
+
5
+
6
+ Retailers engine for [Refinery CMS](http://refinerycms.com) allows you to display retailers.
7
+
8
+ ### In summary you can:
9
+ * Manage retailers
10
+
11
+ ## Requirements
12
+
13
+ * [Refinery CMS](http://refinerycms.com) version 3.0.0 or above.
14
+
15
+ ## Install
16
+
17
+ Open up your `Gemfile` and add at the bottom this line:
18
+
19
+ ```ruby
20
+ gem 'refinerycms-retailers', github: 'bisscomm/refinerycms-retailers', branch: 'master'
21
+ ```
22
+
23
+ Now, run `bundle install`
24
+
25
+ Next, to install the retailers plugin run:
26
+
27
+ rails generate refinery:retailers
28
+
29
+ Run database migrations:
30
+
31
+ rake db:migrate
32
+
33
+ Finally seed your database and you're done.
34
+
35
+ rake db:seed
36
+
37
+ ## Developing & Contributing
38
+
39
+ The version of Refinery to develop this engine against is defined in the gemspec. To override the version of refinery to develop against, edit the project Gemfile to point to a local path containing a clone of refinerycms.
40
+
41
+ ### Testing
42
+
43
+ Generate the dummy application to test against
44
+
45
+ $ bundle exec rake refinery:testing:dummy_app
46
+
47
+ Run the test suite with [Guard](https://github.com/guard/guard)
48
+
49
+ $ bundle exec guard start
50
+
51
+ Or just with rake spec
52
+
53
+ $ bundle exec rake spec
54
+
55
+
56
+ ## More Information
57
+ * Check out our [Website](http://refinerycms.com/)
58
+ * Documentation is available in the [guides](http://refinerycms.com/guides)
59
+ * Questions can be asked on our [Google Group](http://group.refinerycms.org)
60
+ * Questions can also be asked in our IRC room, [#refinerycms on freenode](irc://irc.freenode.net/refinerycms)
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refinerycms-retailers
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brice Sanchez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: refinerycms-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: globalize
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 4.0.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '5.2'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 4.0.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '5.2'
53
+ - !ruby/object:Gem::Dependency
54
+ name: acts_as_indexed
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.8.0
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 0.8.0
67
+ - !ruby/object:Gem::Dependency
68
+ name: carmen-rails
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: 1.0.1
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: 1.0.1
81
+ - !ruby/object:Gem::Dependency
82
+ name: actionview-encoded_mail_to
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: 1.0.5
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: 1.0.5
95
+ description: Ruby on Rails Retailers extension for Refinery CMS
96
+ email: info@bisscomm.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - app/assets/javascripts/refinery/subregion-select.js.coffee.erb
102
+ - app/controllers/refinery/retailers/admin/retailers_controller.rb
103
+ - app/controllers/refinery/retailers/retailers_controller.rb
104
+ - app/helpers/refinery/retailers/controller_helper.rb
105
+ - app/helpers/refinery/retailers/retailers_helper.rb
106
+ - app/models/refinery/retailers/retailer.rb
107
+ - app/views/refinery/retailers/admin/retailers/_actions.html.erb
108
+ - app/views/refinery/retailers/admin/retailers/_form.html.erb
109
+ - app/views/refinery/retailers/admin/retailers/_records.html.erb
110
+ - app/views/refinery/retailers/admin/retailers/_retailer.html.erb
111
+ - app/views/refinery/retailers/admin/retailers/_retailers.html.erb
112
+ - app/views/refinery/retailers/admin/retailers/_sortable_list.html.erb
113
+ - app/views/refinery/retailers/admin/retailers/_subregion_select.html.erb
114
+ - app/views/refinery/retailers/admin/retailers/edit.html.erb
115
+ - app/views/refinery/retailers/admin/retailers/index.html.erb
116
+ - app/views/refinery/retailers/admin/retailers/new.html.erb
117
+ - app/views/refinery/retailers/retailers/_retailer.html.erb
118
+ - app/views/refinery/retailers/retailers/index.html.erb
119
+ - config/locales/cs.yml
120
+ - config/locales/en.yml
121
+ - config/locales/es.yml
122
+ - config/locales/fr.yml
123
+ - config/locales/it.yml
124
+ - config/locales/nb.yml
125
+ - config/locales/nl.yml
126
+ - config/locales/sk.yml
127
+ - config/locales/tr.yml
128
+ - config/locales/zh-CN.yml
129
+ - config/routes.rb
130
+ - db/migrate/1_create_retailers_retailers.rb
131
+ - db/migrate/2_add_body_to_retailers.rb
132
+ - db/migrate/3_translate_retailers.rb
133
+ - db/seeds.rb
134
+ - lib/generators/refinery/retailers/retailers_generator.rb
135
+ - lib/generators/refinery/retailers/templates/config/initializers/refinery/retailers.rb.erb
136
+ - lib/refinery/retailers.rb
137
+ - lib/refinery/retailers/configuration.rb
138
+ - lib/refinery/retailers/engine.rb
139
+ - lib/refinerycms-retailers.rb
140
+ - lib/tasks/refinery/retailers.rake
141
+ - readme.md
142
+ homepage: http://www.bisscomm.com
143
+ licenses:
144
+ - MIT
145
+ metadata: {}
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.5.1
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: Retailers extension for Refinery CMS
166
+ test_files: []