alchemy_kono_mailup 0.0.1

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 (125) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +26 -0
  5. data/app/assets/images/alchemy_kono_mailup/.keep +0 -0
  6. data/app/assets/javascripts/alchemy_kono_mailup/application.js +13 -0
  7. data/app/assets/stylesheets/alchemy_kono_mailup/application.css +15 -0
  8. data/app/controllers/alchemy/admin/essence_mailup_lists_controller.rb +22 -0
  9. data/app/controllers/alchemy_kono_mailup/admin/base_controller.rb +5 -0
  10. data/app/controllers/alchemy_kono_mailup/admin/mailup_configs_controller.rb +13 -0
  11. data/app/controllers/alchemy_kono_mailup/admin/tokens_controller.rb +16 -0
  12. data/app/helpers/alchemy_kono_mailup/application_helper.rb +22 -0
  13. data/app/models/alchemy/essence_mailup_list.rb +4 -0
  14. data/app/models/alchemy_kono_mailup/base_subscription_form.rb +11 -0
  15. data/app/models/alchemy_kono_mailup/mailup_config.rb +6 -0
  16. data/app/views/alchemy/essences/_essence_mailup_list_editor.html.erb +11 -0
  17. data/app/views/alchemy/essences/_essence_mailup_list_view.html.erb +3 -0
  18. data/app/views/alchemy_kono_mailup/admin/mailup_configs/main.html.erb +19 -0
  19. data/app/views/layouts/alchemy_kono_mailup/application.html.erb +14 -0
  20. data/config/initializers/alchemy.rb +26 -0
  21. data/config/initializers/kono_mailup.rb +9 -0
  22. data/config/routes.rb +21 -0
  23. data/db/migrate/20171127105007_create_alchemy_kono_mailup_alchemy_essence_mailup_lists.rb +13 -0
  24. data/lib/alchemy_kono_mailup.rb +21 -0
  25. data/lib/alchemy_kono_mailup/ability.rb +58 -0
  26. data/lib/alchemy_kono_mailup/engine.rb +22 -0
  27. data/lib/alchemy_kono_mailup/version.rb +3 -0
  28. data/lib/generators/alchemy_kono_mailup/install/USAGE +9 -0
  29. data/lib/generators/alchemy_kono_mailup/install/install_generator.rb +20 -0
  30. data/lib/generators/alchemy_kono_mailup/install/templates/initializers.rb +4 -0
  31. data/lib/generators/alchemy_kono_mailup/subscription_form/USAGE +7 -0
  32. data/lib/generators/alchemy_kono_mailup/subscription_form/subscription_form_generator.rb +75 -0
  33. data/lib/generators/alchemy_kono_mailup/subscription_form/templates/form_controller.rb.erb +70 -0
  34. data/lib/generators/alchemy_kono_mailup/subscription_form/templates/form_model.rb.erb +5 -0
  35. data/lib/generators/alchemy_kono_mailup/subscription_form/templates/form_view.html.erb +29 -0
  36. data/lib/tasks/alchemy_kono_mailup_tasks.rake +4 -0
  37. data/spec/dummy/README.rdoc +28 -0
  38. data/spec/dummy/Rakefile +6 -0
  39. data/spec/dummy/app/assets/images/.keep +0 -0
  40. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  41. data/spec/dummy/app/assets/stylesheets/alchemy/elements/article.scss +30 -0
  42. data/spec/dummy/app/assets/stylesheets/application.css +16 -0
  43. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  44. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  45. data/spec/dummy/app/controllers/mailup_subscription_forms_controller.rb +73 -0
  46. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  47. data/spec/dummy/app/mailers/.keep +0 -0
  48. data/spec/dummy/app/models/.keep +0 -0
  49. data/spec/dummy/app/models/concerns/.keep +0 -0
  50. data/spec/dummy/app/models/mailup_subscription_form.rb +7 -0
  51. data/spec/dummy/app/views/alchemy/elements/_article_editor.html.erb +5 -0
  52. data/spec/dummy/app/views/alchemy/elements/_article_view.html.erb +7 -0
  53. data/spec/dummy/app/views/alchemy/elements/_mailup_subscription_editor.html.erb +3 -0
  54. data/spec/dummy/app/views/alchemy/elements/_mailup_subscription_view.html.erb +27 -0
  55. data/spec/dummy/app/views/alchemy/page_layouts/_standard.html.erb +1 -0
  56. data/spec/dummy/app/views/layouts/application.html.erb +16 -0
  57. data/spec/dummy/bin/bundle +3 -0
  58. data/spec/dummy/bin/rails +4 -0
  59. data/spec/dummy/bin/rake +4 -0
  60. data/spec/dummy/bin/setup +29 -0
  61. data/spec/dummy/config.ru +4 -0
  62. data/spec/dummy/config/alchemy/config.yml +194 -0
  63. data/spec/dummy/config/alchemy/elements.yml +27 -0
  64. data/spec/dummy/config/alchemy/page_layouts.yml +8 -0
  65. data/spec/dummy/config/application.rb +32 -0
  66. data/spec/dummy/config/boot.rb +5 -0
  67. data/spec/dummy/config/database.yml +25 -0
  68. data/spec/dummy/config/environment.rb +5 -0
  69. data/spec/dummy/config/environments/development.rb +41 -0
  70. data/spec/dummy/config/environments/production.rb +79 -0
  71. data/spec/dummy/config/environments/test.rb +42 -0
  72. data/spec/dummy/config/initializers/assets.rb +11 -0
  73. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  74. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  75. data/spec/dummy/config/initializers/devise.rb +265 -0
  76. data/spec/dummy/config/initializers/dragonfly.rb +35 -0
  77. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  78. data/spec/dummy/config/initializers/inflections.rb +16 -0
  79. data/spec/dummy/config/initializers/kono_mailup.rb +13 -0
  80. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  81. data/spec/dummy/config/initializers/session_store.rb +3 -0
  82. data/spec/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
  83. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  84. data/spec/dummy/config/locales/alchemy.de.yml +31 -0
  85. data/spec/dummy/config/locales/alchemy.en.yml +31 -0
  86. data/spec/dummy/config/locales/alchemy.es.yml +31 -0
  87. data/spec/dummy/config/locales/en.yml +23 -0
  88. data/spec/dummy/config/routes.rb +9 -0
  89. data/spec/dummy/config/secrets_example.yml +24 -0
  90. data/spec/dummy/db/migrate/20171124145455_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +36 -0
  91. data/spec/dummy/db/migrate/20171124145456_add_missing_unique_indices.acts_as_taggable_on_engine.rb +26 -0
  92. data/spec/dummy/db/migrate/20171124145457_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +20 -0
  93. data/spec/dummy/db/migrate/20171124145458_add_missing_taggable_index.acts_as_taggable_on_engine.rb +15 -0
  94. data/spec/dummy/db/migrate/20171124145459_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +15 -0
  95. data/spec/dummy/db/migrate/20171124145460_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +23 -0
  96. data/spec/dummy/db/migrate/20171124145461_alchemy_two_point_six.alchemy.rb +379 -0
  97. data/spec/dummy/db/migrate/20171124145462_remove_do_not_index_from_alchemy_essence_texts.alchemy.rb +6 -0
  98. data/spec/dummy/db/migrate/20171124145463_remove_do_not_index_from_alchemy_essence_richtexts.alchemy.rb +6 -0
  99. data/spec/dummy/db/migrate/20171124145464_add_published_at_to_alchemy_pages.alchemy.rb +6 -0
  100. data/spec/dummy/db/migrate/20171124145465_add_parent_element_id_to_alchemy_elements.alchemy.rb +7 -0
  101. data/spec/dummy/db/migrate/20171124145466_add_link_text_to_alchemy_essence_files.alchemy.rb +6 -0
  102. data/spec/dummy/db/migrate/20171124145467_add_locale_to_alchemy_languages.alchemy.rb +8 -0
  103. data/spec/dummy/db/migrate/20171124145468_add_timebased_publishing_columns_to_pages.alchemy.rb +33 -0
  104. data/spec/dummy/db/migrate/20171124145469_add_image_file_format_to_alchemy_pictures.alchemy.rb +10 -0
  105. data/spec/dummy/db/migrate/20171124145470_change_alchemy_pages_locked_to_locked_at.alchemy.rb +23 -0
  106. data/spec/dummy/db/migrate/20171124145471_add_index_to_alchemy_pages_rgt.alchemy.rb +10 -0
  107. data/spec/dummy/db/migrate/20171124145472_add_foreign_key_indices_and_null_constraints.alchemy.rb +21 -0
  108. data/spec/dummy/db/migrate/20171124145473_add_foreign_keys.alchemy.rb +28 -0
  109. data/spec/dummy/db/migrate/20171124145474_create_alchemy_users.alchemy_devise.rb +34 -0
  110. data/spec/dummy/db/migrate/20171124145475_add_alchemy_roles_to_alchemy_users.alchemy_devise.rb +23 -0
  111. data/spec/dummy/db/migrate/20171124145476_add_indexes_to_alchemy_users.alchemy_devise.rb +12 -0
  112. data/spec/dummy/db/migrate/20171124145629_create_settings.kono_mailup.rb +18 -0
  113. data/spec/dummy/db/migrate/20171127115017_create_alchemy_kono_mailup_alchemy_essence_mailup_lists.alchemy_kono_mailup.rb +14 -0
  114. data/spec/dummy/db/schema.rb +351 -0
  115. data/spec/dummy/db/seeds.rb +1 -0
  116. data/spec/dummy/lib/assets/.keep +0 -0
  117. data/spec/dummy/log/.keep +0 -0
  118. data/spec/dummy/public/404.html +67 -0
  119. data/spec/dummy/public/422.html +67 -0
  120. data/spec/dummy/public/500.html +66 -0
  121. data/spec/dummy/public/favicon.ico +0 -0
  122. data/spec/dummy/vendor/assets/javascripts/alchemy/admin/all.js +11 -0
  123. data/spec/dummy/vendor/assets/stylesheets/alchemy/admin/all.css +12 -0
  124. data/spec/models/alchemy_kono_mailup/alchemy/essence_mailup_list_spec.rb +7 -0
  125. metadata +393 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7121d7cf0f5ff3ae9292128276f8c23cff276722
4
+ data.tar.gz: ba92eb6c974e6610197af700ec184999d2872c38
5
+ SHA512:
6
+ metadata.gz: 768110969d7dfe1db7665bcb6e63fff81ff479bd379db221fc16cb078dc4dc199819fb3d0f0fe01c6e023c26fb8acd7baa7bf5c5e41cab0cee2a855969133b37
7
+ data.tar.gz: f2acb49d739b7c273cf0f66c0499c2493c250da7013f1c319f343313b17d8280d8800c7542e0edef717469a653d91511fda75600f1385091aac288570c0a7834
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Marino Bonetti
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = AlchemyKonoMailup
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,26 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'AlchemyKonoMailup'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,22 @@
1
+ module Alchemy
2
+ class Admin::EssenceMailupListsController < Alchemy::Admin::BaseController
3
+ authorize_resource class: Alchemy::EssenceMailupList
4
+ before_action :load_essence
5
+
6
+ def update
7
+ @essence.update(essence_audio_params)
8
+ end
9
+
10
+ private
11
+
12
+ def load_essence
13
+ @essence = EssenceMailupList.find(params[:id])
14
+ end
15
+
16
+ def essence_audio_params
17
+ params.require(:essence_mailup_list).permit(
18
+ :list_id
19
+ )
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ module AlchemyKonoMailup::Admin
2
+ class BaseController < Alchemy::Admin::BaseController
3
+
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ module AlchemyKonoMailup::Admin
2
+ class MailupConfigsController < BaseController
3
+
4
+
5
+ def main
6
+ authorize! :main, :alchemy_kono_mailup_admin_mailup_configs
7
+
8
+
9
+
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ class AlchemyKonoMailup::Admin::TokensController < ::KonoMailup::TokensController
2
+ authorize_resource :class => AlchemyKonoMailup::Admin::TokensController
3
+
4
+ before_action :authorize_create, only: [:create]
5
+
6
+
7
+ private
8
+ def authorize_create
9
+ authorize! :create, :alchemy_kono_mailup_admin_tokens
10
+ end
11
+
12
+ def action_after_create
13
+ redirect_to main_admin_mailup_configs_path, notice: 'Successfully token configuration'
14
+ end
15
+
16
+ end
@@ -0,0 +1,22 @@
1
+ module AlchemyKonoMailup
2
+ module ApplicationHelper
3
+
4
+ def client
5
+ if KonoMailup::API.client_ready?
6
+ KonoMailup::API.new
7
+ else
8
+ false
9
+ end
10
+ end
11
+
12
+ def mailup_lists
13
+ if client
14
+ client.console.user.lists.deep_symbolize_keys[:Items]
15
+ else
16
+ []
17
+ end
18
+ end
19
+
20
+
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ class Alchemy::EssenceMailupList < ActiveRecord::Base
2
+ acts_as_essence ingredient_column: 'list_id',
3
+ preview_text_method: 'name'
4
+ end
@@ -0,0 +1,11 @@
1
+ module AlchemyKonoMailup
2
+ class BaseSubscriptionForm
3
+ include ActiveModel::Model
4
+
5
+ attr_accessor :newsletter_list, :email, :element_id
6
+
7
+ validates :newsletter_list, :email, :element_id, :presence => true
8
+ validates :email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
9
+
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ module AlchemyKonoMailup
2
+ class MailupConfig
3
+ include ActiveModel::Model
4
+
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ <% cache(content) do %>
2
+ <div class="essence_headline content_editor" id="<%= content.dom_id %>">
3
+ <%= label_tag(:mailup_list) %>
4
+
5
+ <%= select_tag(content.form_field_name,
6
+ options_for_select(mailup_lists.collect { |e| [e[:Name], e[:idList]] }, content.ingredient),
7
+ prompt: "Select Nesletter list",
8
+ :id => content.form_field_id
9
+ ) %>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <!--< % if content.ingredient %>-->
2
+ <!--< %= content.ingredient %>-->
3
+ <!--< % end %>-->
@@ -0,0 +1,19 @@
1
+ <%= link_to t('.request_tokens'), '/auth/mailup' %>
2
+
3
+ <% if KonoMailup::API.client_ready? %>
4
+ <div>
5
+ <h3>Mailup Lists</h3>
6
+
7
+ <dl>
8
+ <% mailup_lists.each do |i| %>
9
+
10
+ <dt><%= i[:Name] %></dt>
11
+ <dl><%= i[:Description] %></dl>
12
+
13
+
14
+ <% end %>
15
+ </dl>
16
+
17
+
18
+ </div>
19
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>AlchemyKonoMailup</title>
5
+ <%= stylesheet_link_tag "alchemy_kono_mailup/application", media: "all" %>
6
+ <%= javascript_include_tag "alchemy_kono_mailup/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,26 @@
1
+ require 'alchemy_kono_mailup/ability'
2
+
3
+ Alchemy::Modules.register_module({
4
+ name: 'alchemy_kono_mailup',
5
+ engine_name: 'alchemy_kono_mailup',
6
+ order: 4, # The position in main navigation, if you have more than 1 module.
7
+ navigation: {
8
+ name: 'modules.kono_mailup', # The name in the main navigation (translated via I18n).
9
+ controller: 'alchemy_kono_mailup/admin/mailup_configs', # The controller that will be used.
10
+ action: 'main', # The controller action that will be used.
11
+ icon: 'module_icon', # Class of icon that will be rendered as navigation icon.
12
+ # sub_navigation: [
13
+ # {
14
+ # name: 'modules.kono_mailup.configuration', # The name for the subnavigation tab (translated via I18n).
15
+ # controller: '/admin/products', # Controller that will be used.
16
+ # action: 'index' # Controller action that will be used.
17
+ # }
18
+ # ]
19
+ }
20
+ })
21
+
22
+ # Register the module ability
23
+ # Alchemy.register_ability MyModuleAbility
24
+ Alchemy.register_ability(AlchemyKonoMailup::Ability)
25
+
26
+ Alchemy::Admin::BaseController.helper AlchemyKonoMailup::ApplicationHelper
@@ -0,0 +1,9 @@
1
+ # Utilizza questo file per configurare l'engine
2
+ KonoMailup.setup do |config|
3
+
4
+ ##
5
+ # Controller from where the engine inherit
6
+ config.base_controller = Proc.new { AlchemyKonoMailup::Admin::BaseController }
7
+
8
+
9
+ end
@@ -0,0 +1,21 @@
1
+ AlchemyKonoMailup::Engine.routes.draw do
2
+
3
+
4
+ namespace :admin, { path: Alchemy.admin_path, constraints: Alchemy.admin_constraints } do
5
+ resources :mailup_configs, only: [:main] do
6
+ collection do
7
+ get :main
8
+ end
9
+ end
10
+
11
+ mount KonoMailup::Engine => "/kono_mailup"
12
+
13
+ end
14
+
15
+ get '/auth/mailup/callback', to: 'admin/tokens#create'
16
+
17
+
18
+
19
+ mount Alchemy::Engine => '/'
20
+
21
+ end
@@ -0,0 +1,13 @@
1
+ class CreateAlchemyKonoMailupAlchemyEssenceMailupLists < ActiveRecord::Migration[5.1]
2
+ def change
3
+
4
+ create_table :alchemy_essence_mailup_lists do |t|
5
+ t.integer "list_id"
6
+
7
+ t.integer "creator_id"
8
+ t.integer "updater_id"
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require "alchemy_kono_mailup/engine"
2
+
3
+ module AlchemyKonoMailup
4
+
5
+ extend ActiveSupport::Autoload
6
+
7
+ autoload :Engine
8
+ autoload :Ability
9
+
10
+ eager_autoload do
11
+
12
+ end
13
+
14
+
15
+ # Default way to setup AlchemyKonoMailup. Run "rails generate tikal_dish_core_install" to create
16
+ # a fresh initializer with all configuration values.
17
+ def self.setup
18
+ yield self
19
+ end
20
+
21
+ end
@@ -0,0 +1,58 @@
1
+ module AlchemyKonoMailup
2
+ class Ability
3
+ include CanCan::Ability
4
+
5
+ def initialize(user)
6
+
7
+ if user
8
+
9
+ if !user.blank? && user.is_admin?
10
+ can :main, :alchemy_kono_mailup_admin_mailup_configs
11
+
12
+ can :create, :alchemy_kono_mailup_admin_tokens
13
+ can :create, AlchemyKonoMailup::Admin::TokensController
14
+ end
15
+
16
+
17
+ if user.has_role?(:author) || user.has_role?(:editor) || user.has_role?(:admin)
18
+ can :manage, Alchemy::EssenceMailupList
19
+ end
20
+
21
+ end
22
+
23
+ # can :signup, Alchemy::User
24
+ # can :create, Alchemy::User if Alchemy::User.count == 0
25
+
26
+ # if member? || author? || editor?
27
+ # can [:show, :update], Alchemy.user_class, id: user.id
28
+ # end
29
+ #
30
+ # if editor? || admin?
31
+ # can :index, :alchemy_admin_users
32
+ # can :read, Alchemy.user_class
33
+ # end
34
+ #
35
+ # if admin?
36
+ # can :manage, Alchemy.user_class
37
+ # end
38
+ end
39
+
40
+ # private
41
+ #
42
+ # def member?
43
+ # @user.try(:has_role?, :member)
44
+ # end
45
+ #
46
+ # def author?
47
+ # @user.try(:has_role?, :author)
48
+ # end
49
+ #
50
+ # def editor?
51
+ # @user.try(:has_role?, :editor)
52
+ # end
53
+ #
54
+ # def admin?
55
+ # @user.try(:has_role?, :admin)
56
+ # end
57
+ end
58
+ end
@@ -0,0 +1,22 @@
1
+ module AlchemyKonoMailup
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace AlchemyKonoMailup
4
+
5
+ require 'kono_mailup'
6
+ require 'alchemy_cms'
7
+
8
+
9
+ config.eager_load_namespaces << AlchemyKonoMailup
10
+
11
+ config.generators do |g|
12
+ g.test_framework :rspec
13
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
14
+ end
15
+
16
+ initializer 'alchemy_kono_mailup.add_locales' do |app|
17
+ I18n.load_path += Dir[::AlchemyKonoMailup::Engine.root.join('config', 'locales', '**', '*.{rb,yml}')]
18
+ end
19
+
20
+
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module AlchemyKonoMailup
2
+ VERSION = "0.0.1"
3
+ end