message_train 0.5.2 → 0.5.3
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 +4 -4
 - data/.rubocop.yml +20 -0
 - data/.ruby-gemset +1 -1
 - data/.scss-lint.yml +7 -0
 - data/.simplecov +1 -1
 - data/.travis.yml +1 -1
 - data/Gemfile +6 -2
 - data/LICENSE.txt +2 -2
 - data/README.rdoc +5 -5
 - data/Rakefile +22 -21
 - data/VERSION +1 -1
 - data/app/assets/javascripts/message_train.js +1 -1
 - data/app/assets/stylesheets/message_train.scss +29 -19
 - data/app/controllers/concerns/message_train_support.rb +41 -37
 - data/app/controllers/message_train/application_controller.rb +1 -0
 - data/app/controllers/message_train/boxes_controller.rb +5 -4
 - data/app/controllers/message_train/conversations_controller.rb +8 -7
 - data/app/controllers/message_train/messages_controller.rb +25 -22
 - data/app/controllers/message_train/participants_controller.rb +27 -23
 - data/app/controllers/message_train/unsubscribes_controller.rb +37 -23
 - data/app/helpers/message_train/application_helper.rb +6 -8
 - data/app/helpers/message_train/attachments_helper.rb +12 -4
 - data/app/helpers/message_train/boxes_helper.rb +38 -11
 - data/app/helpers/message_train/collectives_helper.rb +38 -12
 - data/app/helpers/message_train/conversations_helper.rb +43 -35
 - data/app/helpers/message_train/messages_helper.rb +32 -25
 - data/app/mailers/message_train/application_mailer.rb +7 -4
 - data/app/mailers/message_train/previews/receipt_mailer_preview.rb +2 -3
 - data/app/mailers/message_train/receipt_mailer.rb +14 -4
 - data/app/models/message_train/attachment.rb +41 -25
 - data/app/models/message_train/box.rb +159 -122
 - data/app/models/message_train/conversation.rb +84 -41
 - data/app/models/message_train/ignore.rb +8 -2
 - data/app/models/message_train/message.rb +72 -42
 - data/app/models/message_train/receipt.rb +30 -17
 - data/app/models/message_train/unsubscribe.rb +1 -0
 - data/app/views/application/404.html.haml +1 -1
 - data/app/views/layouts/mailer.html.haml +2 -2
 - data/app/views/layouts/mailer.text.haml +1 -1
 - data/app/views/message_train/application/_attachment_fields.html.haml +1 -1
 - data/app/views/message_train/application/_widget.html.haml +1 -1
 - data/app/views/message_train/application/results.json.jbuilder +1 -1
 - data/app/views/message_train/boxes/_dropdown_list.html.haml +1 -1
 - data/app/views/message_train/boxes/_list_item.html.haml +1 -1
 - data/app/views/message_train/boxes/show.html.haml +1 -1
 - data/app/views/message_train/collectives/_dropdown_list.html.haml +1 -1
 - data/app/views/message_train/collectives/_list_item.html.haml +1 -1
 - data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -1
 - data/app/views/message_train/conversations/_ignored_toggle.html.haml +2 -2
 - data/app/views/message_train/conversations/_read_toggle.html.haml +1 -1
 - data/app/views/message_train/conversations/_toggle.html.haml +1 -1
 - data/app/views/message_train/conversations/_trashed_toggle.html.haml +1 -1
 - data/app/views/message_train/conversations/show.html.haml +2 -2
 - data/app/views/message_train/conversations/show.json.jbuilder +5 -1
 - data/app/views/message_train/messages/_form.html.haml +1 -1
 - data/app/views/message_train/messages/_message.html.haml +6 -6
 - data/app/views/message_train/messages/_toggle.html.haml +1 -1
 - data/app/views/message_train/messages/show.json.jbuilder +5 -1
 - data/app/views/message_train/participants/_participant.json.jbuilder +1 -1
 - data/app/views/message_train/participants/index.json.jbuilder +1 -1
 - data/app/views/message_train/participants/show.json.jbuilder +1 -1
 - data/app/views/message_train/receipt_mailer/notification_email.html.haml +1 -1
 - data/app/views/message_train/receipt_mailer/notification_email.text.haml +1 -1
 - data/app/views/message_train/unsubscribes/index.html.haml +1 -1
 - data/config/environment.rb +1 -1
 - data/config/initializers/date_time.rb +2 -2
 - data/config/locales/en.yml +1 -1
 - data/config/routes.rb +37 -15
 - data/lib/generators/message_train/install/install_generator.rb +26 -11
 - data/lib/generators/message_train/install/templates/initializer.rb +0 -2
 - data/lib/generators/message_train/utils.rb +11 -4
 - data/lib/message_train/configuration.rb +4 -5
 - data/lib/message_train/engine.rb +1 -7
 - data/lib/message_train/localization.rb +14 -18
 - data/lib/message_train/mixin.rb +211 -150
 - data/lib/message_train/version.rb +1 -0
 - data/lib/message_train.rb +7 -6
 - data/message_train.gemspec +24 -11
 - data/spec/controllers/message_train/boxes_controller_spec.rb +63 -15
 - data/spec/controllers/message_train/concerns_spec.rb +17 -13
 - data/spec/controllers/message_train/conversations_controller_spec.rb +44 -12
 - data/spec/controllers/message_train/messages_controller_spec.rb +87 -40
 - data/spec/controllers/message_train/participants_controller_spec.rb +10 -4
 - data/spec/controllers/message_train/unsubscribes_controller_spec.rb +43 -13
 - data/spec/dummy/Rakefile +2 -1
 - data/spec/dummy/app/assets/stylesheets/application.css.scss +7 -23
 - data/spec/dummy/app/controllers/application_controller.rb +7 -7
 - data/spec/dummy/app/models/group.rb +1 -1
 - data/spec/dummy/app/models/role.rb +11 -7
 - data/spec/dummy/app/models/user.rb +6 -5
 - data/spec/dummy/app/views/layouts/_top_navigation.html.haml +1 -1
 - data/spec/dummy/app/views/layouts/application.html.haml +1 -1
 - data/spec/dummy/app/views/pages/index.html.haml +1 -1
 - data/spec/dummy/config/application.rb +23 -17
 - data/spec/dummy/config/environments/development.rb +5 -4
 - data/spec/dummy/config/environments/production.rb +10 -6
 - data/spec/dummy/config/environments/test.rb +4 -3
 - data/spec/dummy/config/initializers/assets.rb +2 -1
 - data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -2
 - data/spec/dummy/config/initializers/bootstrap_leather.rb +1 -1
 - data/spec/dummy/config/initializers/devise.rb +63 -44
 - data/spec/dummy/config/initializers/high_voltage.rb +1 -1
 - data/spec/dummy/config/initializers/message_train.rb +5 -2
 - data/spec/dummy/config/initializers/mime_types.rb +1 -1
 - data/spec/dummy/config/initializers/paperclip.rb +5 -2
 - data/spec/dummy/config/initializers/rolify.rb +3 -2
 - data/spec/dummy/config/initializers/wrap_parameters.rb +2 -1
 - data/spec/dummy/config/routes.rb +1 -3
 - data/spec/dummy/config/settings.yml +1 -1
 - data/spec/dummy/db/schema.rb +98 -98
 - data/spec/dummy/db/seeds/conversations.seeds.rb +160 -160
 - data/spec/dummy/db/seeds/development/conversations.seeds.rb +6 -2
 - data/spec/dummy/db/seeds/groups.seeds.rb +11 -12
 - data/spec/dummy/db/seeds/test/attachments.seeds.rb +13 -3
 - data/spec/dummy/db/seeds/test/conversations.seeds.rb +6 -2
 - data/spec/dummy/db/seeds/unsubscribes.seeds.rb +1 -1
 - data/spec/dummy/db/seeds/users.seeds.rb +47 -42
 - data/spec/dummy/db/test.sqlite3 +0 -0
 - data/spec/factories/attachment.rb +6 -2
 - data/spec/factories/group.rb +1 -4
 - data/spec/factories/message.rb +29 -23
 - data/spec/factories/user.rb +6 -4
 - data/spec/features/boxes_spec.rb +76 -24
 - data/spec/features/conversations_spec.rb +19 -7
 - data/spec/features/messages_spec.rb +24 -5
 - data/spec/features/unsubscribes_spec.rb +36 -9
 - data/spec/helpers/message_train/application_helper_spec.rb +1 -1
 - data/spec/helpers/message_train/attachment_helper_spec.rb +27 -12
 - data/spec/helpers/message_train/boxes_helper_spec.rb +1 -1
 - data/spec/helpers/message_train/collectives_helper_spec.rb +25 -9
 - data/spec/helpers/message_train/conversations_helper_spec.rb +239 -120
 - data/spec/helpers/message_train/messages_helper_spec.rb +137 -81
 - data/spec/message_train_spec.rb +3 -2
 - data/spec/models/group_spec.rb +12 -9
 - data/spec/models/message_train/attachment_spec.rb +33 -30
 - data/spec/models/message_train/box_spec.rb +243 -60
 - data/spec/models/message_train/conversation_spec.rb +16 -12
 - data/spec/models/message_train/ignore_spec.rb +3 -1
 - data/spec/models/message_train/message_spec.rb +22 -7
 - data/spec/models/message_train/receipt_spec.rb +14 -4
 - data/spec/models/role_spec.rb +10 -6
 - data/spec/models/user_spec.rb +74 -22
 - data/spec/rails_helper.rb +9 -4
 - data/spec/spec_helper.rb +6 -54
 - data/spec/support/controller_behaviors.rb +8 -5
 - data/spec/support/controller_macros.rb +2 -2
 - data/spec/support/factory_girl.rb +1 -1
 - data/spec/support/feature_behaviors.rb +42 -13
 - data/spec/support/loaded_site/attachments.rb +8 -0
 - data/spec/support/loaded_site/conversations.rb +73 -0
 - data/spec/support/{groups.rb → loaded_site/groups.rb} +1 -1
 - data/spec/support/{loaded_site.rb → loaded_site/loaded_site.rb} +1 -1
 - data/spec/support/{messages.rb → loaded_site/messages.rb} +13 -5
 - data/spec/support/{roles.rb → loaded_site/roles.rb} +1 -1
 - data/spec/support/{users.rb → loaded_site/users.rb} +1 -1
 - data/spec/support/shared_connection.rb +8 -6
 - data/spec/support/utilities.rb +10 -10
 - metadata +67 -10
 - data/spec/dummy/config/unused/temporary_i18n_debugging.rb +0 -12
 - data/spec/support/attachments.rb +0 -4
 - data/spec/support/conversations.rb +0 -23
 
    
        data/config/routes.rb
    CHANGED
    
    | 
         @@ -1,10 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            MessageTrain::Engine.routes.draw do
         
     | 
| 
       2 
2 
     | 
    
         
             
              concern :boxable do
         
     | 
| 
       3 
     | 
    
         
            -
                resources 
     | 
| 
      
 3 
     | 
    
         
            +
                resources(
         
     | 
| 
      
 4 
     | 
    
         
            +
                  :boxes,
         
     | 
| 
      
 5 
     | 
    
         
            +
                  path: 'box',
         
     | 
| 
      
 6 
     | 
    
         
            +
                  param: :division,
         
     | 
| 
      
 7 
     | 
    
         
            +
                  only: [:show, :update, :destroy]
         
     | 
| 
      
 8 
     | 
    
         
            +
                ) do
         
     | 
| 
       4 
9 
     | 
    
         
             
                  resources :conversations, only: [:show, :update, :destroy]
         
     | 
| 
       5 
10 
     | 
    
         
             
                  resources :messages, except: [:index, :destroy]
         
     | 
| 
       6 
     | 
    
         
            -
                  get 
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
                  get(
         
     | 
| 
      
 12 
     | 
    
         
            +
                    'participants/:model',
         
     | 
| 
      
 13 
     | 
    
         
            +
                    as: :model_participants,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    to: 'participants#index'
         
     | 
| 
      
 15 
     | 
    
         
            +
                  )
         
     | 
| 
      
 16 
     | 
    
         
            +
                  get(
         
     | 
| 
      
 17 
     | 
    
         
            +
                    'participants/:model/:id',
         
     | 
| 
      
 18 
     | 
    
         
            +
                    as: :model_participant,
         
     | 
| 
      
 19 
     | 
    
         
            +
                    to: 'participants#show'
         
     | 
| 
      
 20 
     | 
    
         
            +
                  )
         
     | 
| 
       8 
21 
     | 
    
         
             
                end
         
     | 
| 
       9 
22 
     | 
    
         
             
              end
         
     | 
| 
       10 
23 
     | 
    
         | 
| 
         @@ -16,18 +29,27 @@ MessageTrain::Engine.routes.draw do 
     | 
|
| 
       16 
29 
     | 
    
         
             
                resources :unsubscribes, only: [:index, :create, :destroy]
         
     | 
| 
       17 
30 
     | 
    
         
             
              end
         
     | 
| 
       18 
31 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              match 
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 32 
     | 
    
         
            +
              match(
         
     | 
| 
      
 33 
     | 
    
         
            +
                '/box(/*path)' => redirect do |_p, req|
         
     | 
| 
      
 34 
     | 
    
         
            +
                  req.flash[:error] = :you_must_sign_in_or_sign_up_to_continue.l
         
     | 
| 
      
 35 
     | 
    
         
            +
                  MessageTrain.configuration.user_sign_in_path
         
     | 
| 
      
 36 
     | 
    
         
            +
                end,
         
     | 
| 
      
 37 
     | 
    
         
            +
                via: [:get, :put, :post, :delete]
         
     | 
| 
      
 38 
     | 
    
         
            +
              )
         
     | 
| 
       23 
39 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              match 
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
      
 40 
     | 
    
         
            +
              match(
         
     | 
| 
      
 41 
     | 
    
         
            +
                '/collectives(/*path)' => redirect do |_p, req|
         
     | 
| 
      
 42 
     | 
    
         
            +
                  req.flash[:error] = :you_must_sign_in_or_sign_up_to_continue.l
         
     | 
| 
      
 43 
     | 
    
         
            +
                  MessageTrain.configuration.user_sign_in_path
         
     | 
| 
      
 44 
     | 
    
         
            +
                end,
         
     | 
| 
      
 45 
     | 
    
         
            +
                via: [:get, :put, :post, :delete]
         
     | 
| 
      
 46 
     | 
    
         
            +
              )
         
     | 
| 
       28 
47 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              match 
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
              match(
         
     | 
| 
      
 49 
     | 
    
         
            +
                '/unsubscribes(/*path)' => redirect do |_p, req|
         
     | 
| 
      
 50 
     | 
    
         
            +
                  req.flash[:error] = :you_must_sign_in_or_sign_up_to_continue.l
         
     | 
| 
      
 51 
     | 
    
         
            +
                  MessageTrain.configuration.user_sign_in_path
         
     | 
| 
      
 52 
     | 
    
         
            +
                end,
         
     | 
| 
      
 53 
     | 
    
         
            +
                via: [:get, :put, :post, :delete]
         
     | 
| 
      
 54 
     | 
    
         
            +
              )
         
     | 
| 
       33 
55 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,36 +1,51 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module MessageTrain
         
     | 
| 
      
 2 
     | 
    
         
            +
              # Install Generator
         
     | 
| 
       2 
3 
     | 
    
         
             
              class InstallGenerator < Rails::Generators::Base
         
     | 
| 
       3 
     | 
    
         
            -
                source_root File.expand_path( 
     | 
| 
      
 4 
     | 
    
         
            +
                source_root File.expand_path('../templates', __FILE__)
         
     | 
| 
       4 
5 
     | 
    
         
             
                require File.expand_path('../../utils', __FILE__)
         
     | 
| 
       5 
6 
     | 
    
         
             
                include Generators::Utils
         
     | 
| 
       6 
7 
     | 
    
         
             
                include Rails::Generators::Migration
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
                def hello
         
     | 
| 
       9 
     | 
    
         
            -
                  output  
     | 
| 
      
 10 
     | 
    
         
            +
                  output 'MessageTrain Installer will now install itself', :magenta
         
     | 
| 
       10 
11 
     | 
    
         
             
                end
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
13 
     | 
    
         
             
                # all public methods in here will be run in order
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
                def add_initializer
         
     | 
| 
       15 
     | 
    
         
            -
                  output 
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
                  output(
         
     | 
| 
      
 17 
     | 
    
         
            +
                    "First, you'll need an initializer. "\
         
     | 
| 
      
 18 
     | 
    
         
            +
                      'This is where you put your configuration options.',
         
     | 
| 
      
 19 
     | 
    
         
            +
                    :magenta
         
     | 
| 
      
 20 
     | 
    
         
            +
                  )
         
     | 
| 
      
 21 
     | 
    
         
            +
                  template 'initializer.rb', 'config/initializers/message_train.rb'
         
     | 
| 
       17 
22 
     | 
    
         
             
                end
         
     | 
| 
       18 
23 
     | 
    
         | 
| 
       19 
24 
     | 
    
         
             
                # Not doing this any more thanks to:
         
     | 
| 
       20 
     | 
    
         
            -
                # http://blog.pivotal.io/pivotal-labs/labs 
     | 
| 
      
 25 
     | 
    
         
            +
                # http://blog.pivotal.io/pivotal-labs/labs/\
         
     | 
| 
      
 26 
     | 
    
         
            +
                # leave-your-migrations-in-your-rails-engines
         
     | 
| 
       21 
27 
     | 
    
         
             
                def add_migrations
         
     | 
| 
       22 
     | 
    
         
            -
                  output  
     | 
| 
      
 28 
     | 
    
         
            +
                  output 'Next come migrations.', :magenta
         
     | 
| 
       23 
29 
     | 
    
         
             
                  rake 'message_train:install:migrations'
         
     | 
| 
       24 
30 
     | 
    
         
             
                end
         
     | 
| 
       25 
31 
     | 
    
         | 
| 
       26 
32 
     | 
    
         
             
                def add_route
         
     | 
| 
       27 
     | 
    
         
            -
                  output  
     | 
| 
       28 
     | 
    
         
            -
                  gsub_file 
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
                  output 'Adding MessageTrain to your routes.rb file', :magenta
         
     | 
| 
      
 34 
     | 
    
         
            +
                  gsub_file(
         
     | 
| 
      
 35 
     | 
    
         
            +
                    'config/routes.rb',
         
     | 
| 
      
 36 
     | 
    
         
            +
                    %r{mount MessageTrain::Engine => '/.*', as: 'message_train'},
         
     | 
| 
      
 37 
     | 
    
         
            +
                    ''
         
     | 
| 
      
 38 
     | 
    
         
            +
                  )
         
     | 
| 
      
 39 
     | 
    
         
            +
                  route("mount MessageTrain::Engine => '/', as: 'message_train'")
         
     | 
| 
       30 
40 
     | 
    
         
             
                end
         
     | 
| 
       31 
41 
     | 
    
         | 
| 
       32 
42 
     | 
    
         
             
                def goodbye
         
     | 
| 
       33 
     | 
    
         
            -
                  output 
     | 
| 
      
 43 
     | 
    
         
            +
                  output(
         
     | 
| 
      
 44 
     | 
    
         
            +
                    "Thanks for installing! Don't forget to run your migrations. "\
         
     | 
| 
      
 45 
     | 
    
         
            +
                      'See http://gemvein.com/museum/cases/message_train for '\
         
     | 
| 
      
 46 
     | 
    
         
            +
                      'configuration tips.',
         
     | 
| 
      
 47 
     | 
    
         
            +
                    :magenta
         
     | 
| 
      
 48 
     | 
    
         
            +
                  )
         
     | 
| 
       34 
49 
     | 
    
         
             
                end
         
     | 
| 
       35 
50 
     | 
    
         
             
              end
         
     | 
| 
       36 
     | 
    
         
            -
            end
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,16 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module MessageTrain
         
     | 
| 
       2 
2 
     | 
    
         
             
              module Generators
         
     | 
| 
      
 3 
     | 
    
         
            +
                # Generator Utiities
         
     | 
| 
       3 
4 
     | 
    
         
             
                module Utils
         
     | 
| 
       4 
5 
     | 
    
         
             
                  def output(output, color = :green)
         
     | 
| 
       5 
6 
     | 
    
         
             
                    say("           -  #{output}", color)
         
     | 
| 
       6 
7 
     | 
    
         
             
                  end
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
                  def ask_for(wording, default_value = nil, override_if_present_value = nil)
         
     | 
| 
       9 
     | 
    
         
            -
                    override_if_present_value.present? 
     | 
| 
       10 
     | 
    
         
            -
                      display( 
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                    if override_if_present_value.present?
         
     | 
| 
      
 11 
     | 
    
         
            +
                      display(
         
     | 
| 
      
 12 
     | 
    
         
            +
                        "Using [#{override_if_present_value}] for question '#{wording}'"
         
     | 
| 
      
 13 
     | 
    
         
            +
                      ) && override_if_present_value
         
     | 
| 
      
 14 
     | 
    
         
            +
                    else
         
     | 
| 
      
 15 
     | 
    
         
            +
                      ask(
         
     | 
| 
      
 16 
     | 
    
         
            +
                        "           ?  #{wording} Press <enter> for [#{default_value}] >",
         
     | 
| 
      
 17 
     | 
    
         
            +
                        :yellow
         
     | 
| 
      
 18 
     | 
    
         
            +
                      ).presence || default_value
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
       12 
20 
     | 
    
         
             
                  end
         
     | 
| 
       13 
21 
     | 
    
         
             
                end
         
     | 
| 
       14 
22 
     | 
    
         
             
              end
         
     | 
| 
       15 
23 
     | 
    
         
             
            end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # MessageTrain module
         
     | 
| 
       1 
2 
     | 
    
         
             
            module MessageTrain
         
     | 
| 
       2 
3 
     | 
    
         
             
              def self.configure(configuration = MessageTrain::Configuration.new)
         
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
                  yield configuration
         
     | 
| 
       5 
     | 
    
         
            -
                end
         
     | 
| 
      
 4 
     | 
    
         
            +
                block_given? && yield(configuration)
         
     | 
| 
       6 
5 
     | 
    
         
             
                @@configuration = configuration
         
     | 
| 
       7 
6 
     | 
    
         
             
              end
         
     | 
| 
       8 
7 
     | 
    
         | 
| 
         @@ -10,6 +9,7 @@ module MessageTrain 
     | 
|
| 
       10 
9 
     | 
    
         
             
                @@configuration ||= MessageTrain::Configuration.new
         
     | 
| 
       11 
10 
     | 
    
         
             
              end
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
              # MessageTrain configuration
         
     | 
| 
       13 
13 
     | 
    
         
             
              class Configuration
         
     | 
| 
       14 
14 
     | 
    
         
             
                attr_accessor :slug_columns,
         
     | 
| 
       15 
15 
     | 
    
         
             
                              :name_columns,
         
     | 
| 
         @@ -42,6 +42,5 @@ module MessageTrain 
     | 
|
| 
       42 
42 
     | 
    
         
             
                  self.from_email = ''
         
     | 
| 
       43 
43 
     | 
    
         
             
                  self.site_name = 'Example Site Name'
         
     | 
| 
       44 
44 
     | 
    
         
             
                end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
45 
     | 
    
         
             
              end
         
     | 
| 
       47 
     | 
    
         
            -
            end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/message_train/engine.rb
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module MessageTrain
         
     | 
| 
      
 2 
     | 
    
         
            +
              # MessageTrain Engine
         
     | 
| 
       2 
3 
     | 
    
         
             
              class Engine < ::Rails::Engine
         
     | 
| 
       3 
4 
     | 
    
         
             
                isolate_namespace MessageTrain
         
     | 
| 
       4 
5 
     | 
    
         
             
                config.generators do |g|
         
     | 
| 
         @@ -9,12 +10,5 @@ module MessageTrain 
     | 
|
| 
       9 
10 
     | 
    
         
             
                  g.stylesheets     false
         
     | 
| 
       10 
11 
     | 
    
         
             
                  g.javascripts     false
         
     | 
| 
       11 
12 
     | 
    
         
             
                end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                config.to_prepare do
         
     | 
| 
       14 
     | 
    
         
            -
                  # Rails.application.config.assets.paths << File.expand_path("../../assets/stylesheets", __FILE__)
         
     | 
| 
       15 
     | 
    
         
            -
                  # Rails.application.config.assets.paths << File.expand_path("../../assets/javascripts", __FILE__)
         
     | 
| 
       16 
     | 
    
         
            -
                  # Rails.application.config.assets.precompile << %w( index )
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
13 
     | 
    
         
             
              end
         
     | 
| 
       20 
14 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,31 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # String Extension
         
     | 
| 
       1 
2 
     | 
    
         
             
            module StringExtension
         
     | 
| 
       2 
3 
     | 
    
         
             
              def localize(*args)
         
     | 
| 
       3 
     | 
    
         
            -
                if args.first.is_a? Symbol
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                args << {: 
     | 
| 
       9 
     | 
    
         
            -
                  
         
     | 
| 
      
 4 
     | 
    
         
            +
                sym = if args.first.is_a? Symbol
         
     | 
| 
      
 5 
     | 
    
         
            +
                        args.shift
         
     | 
| 
      
 6 
     | 
    
         
            +
                      else
         
     | 
| 
      
 7 
     | 
    
         
            +
                        underscore.tr(' ', '_').gsub(/[^a-z0-9_]+/i, '').to_sym
         
     | 
| 
      
 8 
     | 
    
         
            +
                      end
         
     | 
| 
      
 9 
     | 
    
         
            +
                args << { default: self }
         
     | 
| 
       10 
10 
     | 
    
         
             
                I18n.t(sym, *args).html_safe
         
     | 
| 
       11 
11 
     | 
    
         
             
              end
         
     | 
| 
       12 
     | 
    
         
            -
              alias  
     | 
| 
       13 
     | 
    
         
            -
            end 
     | 
| 
      
 12 
     | 
    
         
            +
              alias l localize
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
       14 
14 
     | 
    
         
             
            String.send :include, StringExtension
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            # Symbol Extension
         
     | 
| 
       17 
17 
     | 
    
         
             
            module SymbolExtensionCustom
         
     | 
| 
       18 
     | 
    
         
            -
              
         
     | 
| 
       19 
18 
     | 
    
         
             
              def localize_with_debugging(*args)
         
     | 
| 
       20 
19 
     | 
    
         
             
                localized_sym = I18n.translate(self, *args)
         
     | 
| 
       21 
20 
     | 
    
         
             
                localized_sym.is_a?(String) ? localized_sym.html_safe : localized_sym
         
     | 
| 
       22 
21 
     | 
    
         
             
              end
         
     | 
| 
       23 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
              
         
     | 
| 
      
 22 
     | 
    
         
            +
              alias l localize_with_debugging
         
     | 
| 
       25 
23 
     | 
    
         
             
              def l_with_args(*args)
         
     | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
      
 24 
     | 
    
         
            +
                l(*args).html_safe
         
     | 
| 
       27 
25 
     | 
    
         
             
              end
         
     | 
| 
       28 
     | 
    
         
            -
              
         
     | 
| 
       29 
26 
     | 
    
         
             
            end
         
     | 
| 
       30 
     | 
    
         
            -
             
         
     | 
| 
       31 
     | 
    
         
            -
            Symbol.send :include, SymbolExtensionCustom
         
     | 
| 
      
 27 
     | 
    
         
            +
            Symbol.send :include, SymbolExtensionCustom
         
     |