refinerycms-registrations 0.1.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.
Files changed (107) hide show
  1. data/app/assets/images/refinery/race_registrations/admin/chosen-sprite.png +0 -0
  2. data/app/assets/images/refinery/race_registrations/down_arrow.png +0 -0
  3. data/app/assets/images/refinery/race_registrations/up_arrow.png +0 -0
  4. data/app/assets/javascripts/refinery/race_registrations/admin/jquery.chosen.min.js +10 -0
  5. data/app/assets/javascripts/refinery/race_registrations/admin/race_registrations.js +53 -0
  6. data/app/assets/javascripts/refinery/race_registrations/race_registrations.js +41 -0
  7. data/app/assets/stylesheets/refinery/race_registrations/admin/chosen.css.scss +396 -0
  8. data/app/assets/stylesheets/refinery/race_registrations/admin/race_registrations.css.scss +13 -0
  9. data/app/assets/stylesheets/refinery/race_registrations/admin/sortable_table.css.scss +40 -0
  10. data/app/assets/stylesheets/refinery/race_registrations/race_registrations.css.scss +74 -0
  11. data/app/controllers/refinery/race_registrations/admin/categories_controller.rb +33 -0
  12. data/app/controllers/refinery/race_registrations/admin/groups_controller.rb +13 -0
  13. data/app/controllers/refinery/race_registrations/admin/people_controller.rb +89 -0
  14. data/app/controllers/refinery/race_registrations/admin/registrations_controller.rb +13 -0
  15. data/app/controllers/refinery/race_registrations/categories_controller.rb +17 -0
  16. data/app/controllers/refinery/race_registrations/people_controller.rb +36 -0
  17. data/app/controllers/refinery/race_registrations/registrations_controller.rb +40 -0
  18. data/app/helpers/refinery/race_registrations/admin/people_helper.rb +23 -0
  19. data/app/helpers/refinery/race_registrations/registrations_helper.rb +23 -0
  20. data/app/models/refinery/race_registrations/category.rb +17 -0
  21. data/app/models/refinery/race_registrations/group.rb +20 -0
  22. data/app/models/refinery/race_registrations/group_category.rb +8 -0
  23. data/app/models/refinery/race_registrations/person.rb +53 -0
  24. data/app/models/refinery/race_registrations/registration.rb +37 -0
  25. data/app/views/layouts/print.html.erb +14 -0
  26. data/app/views/refinery/pages/registration_list.html.erb +15 -0
  27. data/app/views/refinery/race_registrations/admin/_submenu.html.erb +77 -0
  28. data/app/views/refinery/race_registrations/admin/categories/_categories.html.erb +2 -0
  29. data/app/views/refinery/race_registrations/admin/categories/_category.html.erb +20 -0
  30. data/app/views/refinery/race_registrations/admin/categories/_form.html.erb +17 -0
  31. data/app/views/refinery/race_registrations/admin/categories/_records.html.erb +18 -0
  32. data/app/views/refinery/race_registrations/admin/categories/_sortable_list.html.erb +5 -0
  33. data/app/views/refinery/race_registrations/admin/categories/edit.html.erb +1 -0
  34. data/app/views/refinery/race_registrations/admin/categories/index.html.erb +5 -0
  35. data/app/views/refinery/race_registrations/admin/categories/new.html.erb +1 -0
  36. data/app/views/refinery/race_registrations/admin/groups/_form.html.erb +23 -0
  37. data/app/views/refinery/race_registrations/admin/groups/_group.html.erb +20 -0
  38. data/app/views/refinery/race_registrations/admin/groups/_groups.html.erb +2 -0
  39. data/app/views/refinery/race_registrations/admin/groups/_records.html.erb +18 -0
  40. data/app/views/refinery/race_registrations/admin/groups/_sortable_list.html.erb +5 -0
  41. data/app/views/refinery/race_registrations/admin/groups/edit.html.erb +1 -0
  42. data/app/views/refinery/race_registrations/admin/groups/index.html.erb +5 -0
  43. data/app/views/refinery/race_registrations/admin/groups/new.html.erb +1 -0
  44. data/app/views/refinery/race_registrations/admin/people/_form.html.erb +82 -0
  45. data/app/views/refinery/race_registrations/admin/people/_people.html.erb +14 -0
  46. data/app/views/refinery/race_registrations/admin/people/_person.html.erb +21 -0
  47. data/app/views/refinery/race_registrations/admin/people/_records.html.erb +11 -0
  48. data/app/views/refinery/race_registrations/admin/people/edit.html.erb +1 -0
  49. data/app/views/refinery/race_registrations/admin/people/index.html.erb +27 -0
  50. data/app/views/refinery/race_registrations/admin/people/index.js.erb +3 -0
  51. data/app/views/refinery/race_registrations/admin/people/new.html.erb +1 -0
  52. data/app/views/refinery/race_registrations/admin/registrations/_form.html.erb +54 -0
  53. data/app/views/refinery/race_registrations/admin/registrations/_records.html.erb +18 -0
  54. data/app/views/refinery/race_registrations/admin/registrations/_registration.html.erb +20 -0
  55. data/app/views/refinery/race_registrations/admin/registrations/_registrations.html.erb +2 -0
  56. data/app/views/refinery/race_registrations/admin/registrations/_sortable_list.html.erb +5 -0
  57. data/app/views/refinery/race_registrations/admin/registrations/edit.html.erb +1 -0
  58. data/app/views/refinery/race_registrations/admin/registrations/index.html.erb +5 -0
  59. data/app/views/refinery/race_registrations/admin/registrations/new.html.erb +1 -0
  60. data/app/views/refinery/race_registrations/categories/index.html.erb +11 -0
  61. data/app/views/refinery/race_registrations/categories/show.html.erb +27 -0
  62. data/app/views/refinery/race_registrations/groups/index.html.erb +11 -0
  63. data/app/views/refinery/race_registrations/groups/show.html.erb +27 -0
  64. data/app/views/refinery/race_registrations/people/_form.html.erb +81 -0
  65. data/app/views/refinery/race_registrations/people/_form_header.html.erb +8 -0
  66. data/app/views/refinery/race_registrations/people/new.html.erb +28 -0
  67. data/app/views/refinery/race_registrations/registrations/_registration.html.erb +47 -0
  68. data/app/views/refinery/race_registrations/registrations/_registration_chooser.html.erb +7 -0
  69. data/app/views/refinery/race_registrations/registrations/show.html.erb +21 -0
  70. data/config/initializers/refinery/core.rb +8 -0
  71. data/config/locales/en.yml +136 -0
  72. data/config/locales/es.yml +141 -0
  73. data/config/locales/fr.yml +139 -0
  74. data/config/locales/humanizer.de.yml +43 -0
  75. data/config/locales/humanizer.en.yml +43 -0
  76. data/config/locales/humanizer.es.yml +43 -0
  77. data/config/locales/humanizer.fi.yml +43 -0
  78. data/config/locales/humanizer.fr.yml +43 -0
  79. data/config/locales/humanizer.it.yml +43 -0
  80. data/config/locales/humanizer.nl.yml +43 -0
  81. data/config/locales/humanizer.pl.yml +43 -0
  82. data/config/locales/humanizer.pt-BR.yml +43 -0
  83. data/config/locales/humanizer.pt-PT.yml +43 -0
  84. data/config/locales/humanizer.ru.yml +43 -0
  85. data/config/locales/humanizer.sk.yml +9 -0
  86. data/config/locales/humanizer.zh-CN.yml +43 -0
  87. data/config/locales/nb.yml +141 -0
  88. data/config/locales/nl.yml +141 -0
  89. data/config/locales/sk.yml +138 -0
  90. data/config/routes.rb +44 -0
  91. data/db/migrate/1_create_race_registrations_registrations.rb +31 -0
  92. data/db/migrate/2_create_race_registrations_people.rb +33 -0
  93. data/db/migrate/3_create_race_registrations_categories.rb +26 -0
  94. data/db/migrate/4_create_race_registrations_groups.rb +26 -0
  95. data/db/migrate/5_create_race_registrations_group_categories.rb +18 -0
  96. data/db/migrate/6_add_registration_id_to_people.rb +20 -0
  97. data/db/migrate/7_add_group_id_to_registrations.rb +13 -0
  98. data/db/seeds.rb +51 -0
  99. data/lib/generators/refinery/registrations_generator.rb +18 -0
  100. data/lib/refinery/registrations.rb +22 -0
  101. data/lib/refinery/registrations/configuration.rb +11 -0
  102. data/lib/refinery/registrations/engine.rb +31 -0
  103. data/lib/refinery/registrations/extensions/pages_controller_extension.rb +18 -0
  104. data/lib/refinerycms-registrations.rb +1 -0
  105. data/lib/tasks/refinery/registrations.rake +13 -0
  106. data/readme.md +95 -0
  107. metadata +182 -0
data/config/routes.rb ADDED
@@ -0,0 +1,44 @@
1
+ Refinery::Core::Engine.routes.append do
2
+
3
+ # Frontend routes
4
+ namespace :race_registrations do
5
+ resources :registrations, :only => [:index,:show, :create] do
6
+ collection do
7
+ post :redirect
8
+ end
9
+ resources :categories, :only => :index
10
+ end
11
+
12
+
13
+ resources :people, :only => [:index, :new, :create, :show]
14
+ resources :categories, :only => [:index, :show]
15
+ resources :groups, :only => [:index, :show]
16
+ end
17
+
18
+ # Admin routes
19
+ namespace :race_registrations, :path => '' do
20
+ namespace :admin, :path => 'refinery/race_registrations' do
21
+ resources :registrations, :except => :show do
22
+ collection do
23
+ post :update_positions
24
+ end
25
+ resources :categories, :only => :index
26
+ end
27
+
28
+ resources :people, :except => :show
29
+
30
+ resources :categories, :except => :show do
31
+ collection do
32
+ post :update_positions
33
+ end
34
+ end
35
+
36
+ resources :groups, :except => :show do
37
+ collection do
38
+ post :update_positions
39
+ end
40
+ end
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,31 @@
1
+ class CreateRaceRegistrationsRegistrations < ActiveRecord::Migration
2
+
3
+ def up
4
+ create_table :refinery_race_registrations_registrations do |t|
5
+ t.string :title
6
+ t.string :locality
7
+ t.date :race_date
8
+ t.boolean :is_active
9
+ t.datetime :start_date
10
+ t.datetime :end_date
11
+ t.integer :position
12
+
13
+ t.timestamps
14
+ end
15
+
16
+ end
17
+
18
+ def down
19
+ if defined?(::Refinery::UserPlugin)
20
+ ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-race_registrations"})
21
+ end
22
+
23
+ if defined?(::Refinery::Page)
24
+ ::Refinery::Page.delete_all({:link_url => "/race_registrations/registrations"})
25
+ end
26
+
27
+ drop_table :refinery_race_registrations_registrations
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,33 @@
1
+ class CreateRaceRegistrationsPeople < ActiveRecord::Migration
2
+
3
+ def up
4
+ create_table :refinery_race_registrations_people do |t|
5
+ t.string :name
6
+ t.string :surname
7
+ t.string :country
8
+ t.date :birth_date
9
+ t.string :email
10
+ t.string :club
11
+ t.string :city
12
+ t.text :notice
13
+ t.integer :position
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ end
19
+
20
+ def down
21
+ if defined?(::Refinery::UserPlugin)
22
+ ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-race_registrations"})
23
+ end
24
+
25
+ if defined?(::Refinery::Page)
26
+ ::Refinery::Page.delete_all({:link_url => "/race_registrations/people"})
27
+ end
28
+
29
+ drop_table :refinery_race_registrations_people
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,26 @@
1
+ class CreateRaceRegistrationsCategories < ActiveRecord::Migration
2
+
3
+ def up
4
+ create_table :refinery_race_registrations_categories do |t|
5
+ t.string :title
6
+ t.integer :position
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ end
12
+
13
+ def down
14
+ if defined?(::Refinery::UserPlugin)
15
+ ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-race_registrations"})
16
+ end
17
+
18
+ if defined?(::Refinery::Page)
19
+ ::Refinery::Page.delete_all({:link_url => "/race_registrations/categories"})
20
+ end
21
+
22
+ drop_table :refinery_race_registrations_categories
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,26 @@
1
+ class CreateRaceRegistrationsGroups < ActiveRecord::Migration
2
+
3
+ def up
4
+ create_table :refinery_race_registrations_groups do |t|
5
+ t.string :title
6
+ t.integer :position
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ end
12
+
13
+ def down
14
+ if defined?(::Refinery::UserPlugin)
15
+ ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-race_registrations"})
16
+ end
17
+
18
+ if defined?(::Refinery::Page)
19
+ ::Refinery::Page.delete_all({:link_url => "/race_registrations/groups"})
20
+ end
21
+
22
+ drop_table :refinery_race_registrations_groups
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,18 @@
1
+ class CreateRaceRegistrationsGroupCategories < ActiveRecord::Migration
2
+
3
+ def up
4
+ create_table :refinery_race_registrations_group_categories do |t|
5
+ t.integer :group_id
6
+ t.integer :category_id
7
+ end
8
+
9
+ add_index :refinery_race_registrations_group_categories, :group_id , :name=> "refinery_race_registrations_group_categories_on_group_id"
10
+ add_index :refinery_race_registrations_group_categories, :category_id, :name=> "refinery_race_registrations_group_categories_on_category_id"
11
+
12
+ end
13
+
14
+ def down
15
+ drop_table :refinery_race_registrations_group_categories
16
+ end
17
+
18
+ end
@@ -0,0 +1,20 @@
1
+ class AddRegistrationIdToPeople < ActiveRecord::Migration
2
+
3
+ def up
4
+ add_column :refinery_race_registrations_people, :registration_id, :integer
5
+ add_column :refinery_race_registrations_people, :category_id, :integer
6
+
7
+ add_index :refinery_race_registrations_people, :registration_id
8
+ add_index :refinery_race_registrations_people, :category_id
9
+ end
10
+
11
+ def down
12
+ remove_column :refinery_race_registrations_people, :registration_id
13
+ remove_column :refinery_race_registrations_people, :category_id
14
+
15
+
16
+ remove_index :refinery_race_registrations_people, :registration_id
17
+ remove_index :refinery_race_registrations_people, :category_id
18
+ end
19
+
20
+ end
@@ -0,0 +1,13 @@
1
+ class AddGroupIdToRegistrations < ActiveRecord::Migration
2
+
3
+ def up
4
+ add_column :refinery_race_registrations_registrations, :group_id, :integer
5
+ add_index :refinery_race_registrations_registrations, :group_id
6
+ end
7
+
8
+ def down
9
+ remove_column :refinery_race_registrations_registrations, :group_id
10
+ remove_index :refinery_race_registrations_registrations, :group_id
11
+ end
12
+
13
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,51 @@
1
+ (Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
2
+ I18n.locale = lang
3
+
4
+ if defined?(Refinery::User)
5
+ Refinery::User.all.each do |user|
6
+ if user.plugins.where(:name => 'refinerycms-race_registrations').blank?
7
+ user.plugins.create(:name => 'refinerycms-race_registrations',
8
+ :position => (user.plugins.maximum(:position) || -1) +1)
9
+ end
10
+ end
11
+ end
12
+
13
+ url = "/race_registrations/registrations"
14
+ if defined?(Refinery::Page) && Refinery::Page.where(:link_url => url).empty?
15
+ page = Refinery::Page.create(
16
+ :title => 'Registrations',
17
+ :link_url => url,
18
+ :deletable => false,
19
+ :menu_match => "^#{url}(\/|\/.+?|)$"
20
+ )
21
+ Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
22
+ page.parts.create(:title => default_page_part, :body => nil, :position => index)
23
+ end
24
+ end
25
+ end
26
+
27
+ (Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
28
+ I18n.locale = lang
29
+
30
+ if defined?(Refinery::User)
31
+ Refinery::User.all.each do |user|
32
+ if user.plugins.where(:name => 'refinerycms-race_registrations').blank?
33
+ user.plugins.create(:name => 'refinerycms-race_registrations',
34
+ :position => (user.plugins.maximum(:position) || -1) +1)
35
+ end
36
+ end
37
+ end
38
+
39
+ url = "/race_registrations/people/new"
40
+ if defined?(Refinery::Page) && Refinery::Page.where(:link_url => url).empty?
41
+ page = Refinery::Page.create(
42
+ :title => 'People',
43
+ :link_url => url,
44
+ :deletable => false,
45
+ :menu_match => "^#{url}(\/|\/.+?|)$"
46
+ )
47
+ Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
48
+ page.parts.create(:title => default_page_part, :body => nil, :position => index)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,18 @@
1
+ module Refinery
2
+ class RegistrationsGenerator < Rails::Generators::Base
3
+ def rake_db
4
+ rake("refinery_registrations:install:migrations")
5
+ end
6
+
7
+ def append_load_seed_data
8
+ create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
9
+ append_file 'db/seeds.rb', :verbose => true do
10
+ <<-EOH
11
+
12
+ # Added by Refinery CMS Registrations extension
13
+ Refinery::RaceRegistrations::Engine.load_seed
14
+ EOH
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ require 'refinerycms-core'
2
+
3
+ module Refinery
4
+ autoload :RegistrationsGenerator, 'generators/refinery/registrations_generator'
5
+
6
+ module Registrations
7
+ require 'refinery/registrations/engine'
8
+ require 'refinery/registrations/extensions/pages_controller_extension'
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
@@ -0,0 +1,11 @@
1
+ module Refinery
2
+ module RaceRegistrations
3
+ include ActiveSupport::Configurable
4
+
5
+ config_accessor :include_chosen
6
+
7
+
8
+ self.include_chosen = true
9
+ end
10
+ end
11
+
@@ -0,0 +1,31 @@
1
+ module Refinery
2
+ module RaceRegistrations
3
+ class Engine < Rails::Engine
4
+ include Refinery::Engine
5
+ isolate_namespace Refinery::RaceRegistrations
6
+
7
+ engine_name :refinery_registrations
8
+
9
+ initializer "register refinerycms_registrations plugin" do
10
+ Refinery::Plugin.register do |plugin|
11
+ plugin.name = "registrations"
12
+ plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.race_registrations_admin_registrations_path }
13
+ plugin.pathname = root
14
+ plugin.activity = {
15
+ :class_name => :'refinery/race_registrations/registration'
16
+ }
17
+ plugin.menu_match = %r{refinery/race_registrations(/.+)?$}
18
+ end
19
+ end
20
+
21
+ config.to_prepare do
22
+ require 'refinerycms-pages'
23
+ Refinery::PagesController.send :include, Refinery::RaceRegistrations::Extensions::PagesController
24
+ end
25
+
26
+ config.after_initialize do
27
+ Refinery.register_extension(Refinery::Registrations)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,18 @@
1
+ module Refinery
2
+ module RaceRegistrations
3
+ module Extensions
4
+ module PagesController
5
+
6
+ def self.included(base)
7
+ base.class_eval do
8
+
9
+ include Refinery::RaceRegistrations::RegistrationsHelper
10
+ helper :'refinery/race_registrations/registrations'
11
+
12
+
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1 @@
1
+ require 'refinery/registrations'
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :registrations do
4
+
5
+ # call this task by running: rake refinery:registrations: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
data/readme.md ADDED
@@ -0,0 +1,95 @@
1
+ # Refinery CMS Registrations
2
+
3
+ __Registrations engine for Refinery CMS.__
4
+
5
+ Developed for bike race registration, but you can override and modify for your needs
6
+
7
+ ## Requirements
8
+
9
+ This version of refinerycms-registrations supports Rails 3.2.x and Refinery CMS ~> 2.0.8. Works with PostgreSQL, MySQL and Sqlite
10
+
11
+ ## Features
12
+
13
+ * start date and end date of registrations
14
+ * multiple published registrations
15
+ * grouping categories to group of categories
16
+ * live search in registered people
17
+ * live list of registered people on frontend
18
+ * humanizer antispam in registration
19
+
20
+ ## Screenshots
21
+
22
+ All screenshots are in folder screenshots
23
+
24
+ ![Edit registration](https://raw.github.com/Matho/refinerycms-registrations/master/screenshots/02_edit_registration.png)
25
+ ![Live search people](https://raw.github.com/Matho/refinerycms-registrations/master/screenshots/05_live_search_people.png)
26
+ ![List of people](https://raw.github.com/Matho/refinerycms-registrations/master/screenshots/12_list_of_registered_people.png)
27
+
28
+ ## Language
29
+
30
+ Gem is fully translated to slovak and english. There is scaffolded support for es, fr, nb, nl with a mix of english words.
31
+ Antispam - humanizer is translated to 13 languages.
32
+
33
+
34
+ ## Installation
35
+
36
+ Open up your ``Gemfile`` and add at the bottom this line:
37
+
38
+ ```ruby
39
+ gem 'refinerycms-registrations', '~> 0.1.0'
40
+ gem 'humanizer'
41
+ ```
42
+
43
+ Now, run
44
+
45
+ ```ruby
46
+ bundle install
47
+ ```
48
+
49
+ Next, to install run:
50
+
51
+ ```ruby
52
+ rails g refinery:registrations
53
+ ```
54
+
55
+ Run database migrations:
56
+
57
+ ```ruby
58
+ rake db:migrate
59
+ ```
60
+
61
+ Seed your database:
62
+
63
+ ```ruby
64
+ rake db:seed
65
+ ```
66
+ If you don't have Chosen JS included in your backend yet, append this code to your_app/config/initializers/refinery/core.rb
67
+
68
+ ```ruby
69
+ config.register_javascript "refinery/race_registrations/admin/jquery.chosen.min.js"
70
+ config.register_stylesheet "refinery/race_registrations/admin/chosen.css"
71
+ ```
72
+
73
+ Before production, don't forget to precompile assets by:
74
+
75
+ ```ruby
76
+ rake assets:precompile
77
+ ```
78
+
79
+ ## Todo list
80
+
81
+ * autocomplete in Club
82
+ * tests
83
+
84
+
85
+ ## Known bugs
86
+
87
+ * Humanizer don't work as engine dependency, you must include gem 'humanizer' in your app gemfile
88
+
89
+ ## Testing
90
+
91
+ TODO
92
+
93
+ ## License
94
+
95
+ Refinery CMS Photo Gallery engine is released under the MIT license. Created by Martin Markech.