tb_core 1.4.8 → 1.5.4
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/README.md +2 -2
- data/app/assets/javascripts/admin/core/application.js +3 -1
- data/app/assets/javascripts/admin/core/editor.js +19 -72
- data/app/controllers/admin/users_controller.rb +2 -2
- data/app/controllers/concerns/tb_core/error_handling.rb +1 -0
- data/app/helpers/tb_core/application_helper.rb +17 -0
- data/app/models/concerns/tb_core/user_model.rb +36 -5
- data/app/views/layouts/admin/application.html.erb +1 -0
- data/lib/tb_core/engine.rb +2 -0
- data/lib/tb_core/form_builder.rb +1 -1
- data/lib/tb_core/regex.rb +12 -0
- data/lib/tb_core/test_helper.rb +24 -22
- data/lib/tb_core/version.rb +1 -1
- data/spec/controllers/admin/dashboard_controller_spec.rb +1 -1
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/config/application.rb +1 -46
- metadata +52 -14
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 685a39f5f0708976182b94ca4eba53159105aae179377c82506808ac3c0140aa
         | 
| 4 | 
            +
              data.tar.gz: 8281b2db3cd5ec6ff3c68b564ebc2b30d5fb4e90b1e1fd2d5966ad18b967ab49
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 30658044ef646b5daffa80b31eaf80b6408d9336189e01671ab523a89d85edf86da366bf09d6b8ac0842a6c787718e5570452c461f98505ce79616ddc0e81efd
         | 
| 7 | 
            +
              data.tar.gz: 78b94c0636177d2e71249dceaf11b153c1680f39597360393aa1b8b98defccae365f1509ae19295295e6db3aa58e5fe172125aeada933bfd98ef2f50efa5398f
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            [](https://circleci.com/bb/moser-inc/tb_core)
         | 
| 2 2 |  | 
| 3 3 | 
             
            Twice Baked Core
         | 
| 4 4 | 
             
            ================
         | 
| @@ -105,7 +105,7 @@ Create a file in your app at `app/views/admin/users/_form_additions.html.erb`. | |
| 105 105 | 
             
                  <%= f.label :avatar, :class=>"control-label"%>
         | 
| 106 106 | 
             
                  <div class="controls">
         | 
| 107 107 | 
             
                    <%= f.file_field :avatar %>
         | 
| 108 | 
            -
                  </div> | 
| 108 | 
            +
                  </div>
         | 
| 109 109 | 
             
                </div>
         | 
| 110 110 |  | 
| 111 111 | 
             
            ### Adding fields to the user show action
         | 
| @@ -12,7 +12,9 @@ window.spud = { admin: window.tb }; | |
| 12 12 |  | 
| 13 13 | 
             
            document.addEventListener('DOMContentLoaded', function() {
         | 
| 14 14 |  | 
| 15 | 
            -
               | 
| 15 | 
            +
              if (typeof tinymce != "undefined") {
         | 
| 16 | 
            +
                tb.editor.init();
         | 
| 17 | 
            +
              }
         | 
| 16 18 |  | 
| 17 19 | 
             
              $("#modal_window .modal-footer .form-submit").bind('click', function() {
         | 
| 18 20 | 
             
                $("#modal_window .modal-body form").submit();
         | 
| @@ -4,7 +4,13 @@ tb.editor = {}; | |
| 4 4 |  | 
| 5 5 | 
             
              var editor = tb.editor;
         | 
| 6 6 |  | 
| 7 | 
            -
               | 
| 7 | 
            +
              /*
         | 
| 8 | 
            +
              * Use tb.editor.overrides to set custom configs in your application
         | 
| 9 | 
            +
              *
         | 
| 10 | 
            +
              * tb.editor.overrides = { menubar: true }
         | 
| 11 | 
            +
              *
         | 
| 12 | 
            +
              */
         | 
| 13 | 
            +
              editor.overrides = {};
         | 
| 8 14 |  | 
| 9 15 | 
             
              var registeredPlugins = [
         | 
| 10 16 | 
             
                'autolink','lists','image','link','media','paste', 'code'
         | 
| @@ -14,62 +20,31 @@ tb.editor = {}; | |
| 14 20 | 
             
                'undo', 'redo', '|',
         | 
| 15 21 | 
             
                'bold','italic','underline','strikethrough','|',
         | 
| 16 22 | 
             
                'formatselect','|',
         | 
| 17 | 
            -
                'cut','copy','paste', ' | 
| 23 | 
            +
                'cut','copy','paste', '|',
         | 
| 18 24 | 
             
                'bullist','numlist','outdent','indent','|',
         | 
| 19 25 | 
             
                'link','unlink','image', '|', 'code', '|'
         | 
| 20 26 | 
             
              ];
         | 
| 21 27 |  | 
| 22 | 
            -
              var validElements = "@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|" +
         | 
| 23 | 
            -
                "onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|" +
         | 
| 24 | 
            -
                "onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|" +
         | 
| 25 | 
            -
                "name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u," +
         | 
| 26 | 
            -
                "#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|" +
         | 
| 27 | 
            -
                "src|border|alt=|title|hspace|vspace|width|height|align|hidpi_src],-sub,-sup," +
         | 
| 28 | 
            -
                "-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|" +
         | 
| 29 | 
            -
                "height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|" +
         | 
| 30 | 
            -
                "height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot," +
         | 
| 31 | 
            -
                "#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor" +
         | 
| 32 | 
            -
                "|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div," +
         | 
| 33 | 
            -
                "-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face" +
         | 
| 34 | 
            -
                "|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite]," +
         | 
| 35 | 
            -
                "object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width" +
         | 
| 36 | 
            -
                "|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo," +
         | 
| 37 | 
            -
                "button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|" +
         | 
| 38 | 
            -
                "valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method]," +
         | 
| 39 | 
            -
                "input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value]," +
         | 
| 40 | 
            -
                "kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value]," +
         | 
| 41 | 
            -
                "q[cite],samp,select[disabled|multiple|name|size],small," +
         | 
| 42 | 
            -
                "textarea[cols|rows|disabled|name|readonly],tt,var,big";
         | 
| 43 | 
            -
             | 
| 44 28 | 
             
              var extendedValidElements = [
         | 
| 45 29 | 
             
                "iframe[src|width|height|name|align|frameborder|allowfullscreen]"
         | 
| 46 30 | 
             
              ];
         | 
| 47 31 |  | 
| 48 | 
            -
              editor.init = function( | 
| 32 | 
            +
              editor.init = function(args) {
         | 
| 49 33 | 
             
                editor.unload();
         | 
| 50 | 
            -
                editor.checkAndCallTinyMce(options);
         | 
| 51 | 
            -
              };
         | 
| 52 34 |  | 
| 53 | 
            -
             | 
| 54 | 
            -
                var theme = options.theme || 'modern';
         | 
| 55 | 
            -
                var height = options.height || 400;
         | 
| 56 | 
            -
                var width = options.width || $(element).width();
         | 
| 57 | 
            -
                var buttons = options.buttons || registeredButtons;
         | 
| 58 | 
            -
                var plugins = options.plugins || registeredPlugins;
         | 
| 35 | 
            +
                var selector = args ? args.selector : 'textarea.tinymce';
         | 
| 59 36 |  | 
| 60 | 
            -
                 | 
| 61 | 
            -
                   | 
| 62 | 
            -
                   | 
| 37 | 
            +
                var options = Object.assign({
         | 
| 38 | 
            +
                  selector: selector,
         | 
| 39 | 
            +
                  height: 400,
         | 
| 63 40 | 
             
                  menubar: false,
         | 
| 64 | 
            -
                   | 
| 65 | 
            -
                   | 
| 66 | 
            -
                  convert_urls: false,
         | 
| 67 | 
            -
                  valid_elements: validElements,
         | 
| 68 | 
            -
                  media_strict: false,
         | 
| 41 | 
            +
                  toolbar: registeredButtons.join(' '),
         | 
| 42 | 
            +
                  plugins: registeredPlugins.join(' '),
         | 
| 69 43 | 
             
                  extended_valid_elements: extendedValidElements.join(","),
         | 
| 70 | 
            -
                   | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 44 | 
            +
                  convert_urls: false
         | 
| 45 | 
            +
                }, editor.overrides);
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                tinymce.init(options)
         | 
| 73 48 | 
             
              };
         | 
| 74 49 |  | 
| 75 50 | 
             
              editor.unload = function() {
         | 
| @@ -111,32 +86,4 @@ tb.editor = {}; | |
| 111 86 | 
             
                }
         | 
| 112 87 | 
             
              };
         | 
| 113 88 |  | 
| 114 | 
            -
              var loadScript = null;
         | 
| 115 | 
            -
             | 
| 116 | 
            -
              editor.checkAndCallTinyMce = function(options){
         | 
| 117 | 
            -
                options = options || {};
         | 
| 118 | 
            -
                var selector = options.selector || 'textarea.tinymce';
         | 
| 119 | 
            -
                var $elements = $(selector);
         | 
| 120 | 
            -
             | 
| 121 | 
            -
                if($elements.length === 0){
         | 
| 122 | 
            -
                  return;
         | 
| 123 | 
            -
                }
         | 
| 124 | 
            -
             | 
| 125 | 
            -
                if(loadScript === null){
         | 
| 126 | 
            -
                  loadScript = $.when(
         | 
| 127 | 
            -
                    $.ajax({url: '//cdn.tinymce.com/4.3/tinymce.min.js', dataType: 'script', cache: true}),
         | 
| 128 | 
            -
                    $.ajax({url: '//cdn.tinymce.com/4.3/jquery.tinymce.min.js', dataType: 'script', cache: true})
         | 
| 129 | 
            -
                  ).done(function(){
         | 
| 130 | 
            -
                    $('body').trigger("tb:tinymce-loaded");
         | 
| 131 | 
            -
                    editor.tinymce.loaded = true;
         | 
| 132 | 
            -
                  });
         | 
| 133 | 
            -
                }
         | 
| 134 | 
            -
             | 
| 135 | 
            -
                loadScript.done(function(){
         | 
| 136 | 
            -
                  $elements.each(function(){
         | 
| 137 | 
            -
                    editor.initMCEWithOptions(this, options);
         | 
| 138 | 
            -
                  });
         | 
| 139 | 
            -
                });
         | 
| 140 | 
            -
              };
         | 
| 141 | 
            -
             | 
| 142 89 | 
             
            })();
         | 
| @@ -8,8 +8,8 @@ class Admin::UsersController < Admin::ApplicationController | |
| 8 8 | 
             
              respond_to :html, :csv
         | 
| 9 9 |  | 
| 10 10 | 
             
              sortable_by :email, :current_login_at,
         | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 11 | 
            +
                name: [:last_name, :first_name],
         | 
| 12 | 
            +
                default: :email
         | 
| 13 13 |  | 
| 14 14 | 
             
              def index
         | 
| 15 15 | 
             
                @spud_users = SpudUser.order(sortable_query).paginate(page: params[:page], per_page: 15)
         | 
| @@ -13,6 +13,21 @@ module TbCore::ApplicationHelper | |
| 13 13 | 
             
                return form_for(record, options, &block)
         | 
| 14 14 | 
             
              end
         | 
| 15 15 |  | 
| 16 | 
            +
              def tb_form_with(record, **options, &block)
         | 
| 17 | 
            +
                options[:builder] = TbCore::FormBuilder
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                options[:html] ||= {}
         | 
| 20 | 
            +
                if options[:html][:class]
         | 
| 21 | 
            +
                  options[:html][:class] += ' form-horizontal'
         | 
| 22 | 
            +
                else
         | 
| 23 | 
            +
                  options[:html][:class] = 'form-horizontal'
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                options[:model] = record
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                return form_with(options, &block)
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
             | 
| 16 31 | 
             
              def tb_form_errors(record, *fields_to_display)
         | 
| 17 32 | 
             
                if record.errors.any?
         | 
| 18 33 | 
             
                  content_tag :div, class: 'form-errors test' do
         | 
| @@ -56,6 +71,7 @@ module TbCore::ApplicationHelper | |
| 56 71 | 
             
                end
         | 
| 57 72 | 
             
              end
         | 
| 58 73 |  | 
| 74 | 
            +
              # rubocop:disable Rails/HelperInstanceVariable
         | 
| 59 75 | 
             
              def tb_page_title
         | 
| 60 76 | 
             
                if content_for?(:title)
         | 
| 61 77 | 
             
                  title = content_for(:title) + ' | ' + TbCore.site_name
         | 
| @@ -66,6 +82,7 @@ module TbCore::ApplicationHelper | |
| 66 82 | 
             
                end
         | 
| 67 83 | 
             
                return content_tag :title, title
         | 
| 68 84 | 
             
              end
         | 
| 85 | 
            +
              # rubocop:enable Rails/HelperInstanceVariable
         | 
| 69 86 |  | 
| 70 87 | 
             
              def current_site_name
         | 
| 71 88 | 
             
                return TbCore.config.site_name
         | 
| @@ -2,26 +2,27 @@ module TbCore | |
| 2 2 | 
             
              module UserModel
         | 
| 3 3 | 
             
                extend ActiveSupport::Concern
         | 
| 4 4 |  | 
| 5 | 
            +
                # rubocop:disable Metrics/BlockLength
         | 
| 5 6 | 
             
                included do
         | 
| 6 7 | 
             
                  self.table_name = 'spud_users'
         | 
| 7 8 |  | 
| 8 9 | 
             
                  acts_as_authentic do |c|
         | 
| 9 | 
            -
                    c.transition_from_crypto_providers = Authlogic::CryptoProviders::Sha512
         | 
| 10 10 | 
             
                    c.crypto_provider = Authlogic::CryptoProviders::SCrypt
         | 
| 11 11 | 
             
                    c.logged_in_timeout = 24.hours
         | 
| 12 12 | 
             
                    c.login_field = :email if TbCore.config.use_email_as_login
         | 
| 13 | 
            -
                     | 
| 14 | 
            -
                      c.merge_validates_length_of_password_field_options(minimum: TbCore.config.user_password_length)
         | 
| 15 | 
            -
                    end
         | 
| 13 | 
            +
                    c.require_password_confirmation = true
         | 
| 16 14 | 
             
                  end
         | 
| 17 15 |  | 
| 16 | 
            +
                  attr_accessor :password_confirmation
         | 
| 17 | 
            +
             | 
| 18 18 | 
             
                  belongs_to :role,
         | 
| 19 | 
            -
                    class_name: SpudRole | 
| 19 | 
            +
                    class_name: 'SpudRole', foreign_key: :spud_role_id, optional: true
         | 
| 20 20 | 
             
                  has_many :spud_user_settings,
         | 
| 21 21 | 
             
                    dependent: :destroy, foreign_key: :spud_user_id
         | 
| 22 22 |  | 
| 23 23 | 
             
                  validates :first_name, :last_name, presence: true
         | 
| 24 24 | 
             
                  before_validation :set_login_to_email, if: -> { TbCore.config.use_email_as_login }
         | 
| 25 | 
            +
             | 
| 25 26 | 
             
                  before_update :unset_requires_password_change
         | 
| 26 27 |  | 
| 27 28 | 
             
                  scope :admins, lambda {
         | 
| @@ -29,7 +30,37 @@ module TbCore | |
| 29 30 | 
             
                  }
         | 
| 30 31 |  | 
| 31 32 | 
             
                  scope :ordered, -> { order('last_name asc, first_name asc, email asc') }
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  # These used to be built in to Authlogic
         | 
| 35 | 
            +
                  # See: https://github.com/binarylogic/authlogic/blob/5986e1bd056ccecc519d9f49cc83a0ba757668b4/doc/use_normal_rails_validation.md
         | 
| 36 | 
            +
                  validates :email,
         | 
| 37 | 
            +
                    format: {
         | 
| 38 | 
            +
                      with: ::TbCore::Regex::EMAIL,
         | 
| 39 | 
            +
                      message: proc {
         | 
| 40 | 
            +
                        ::Authlogic::I18n.t(
         | 
| 41 | 
            +
                          'error_messages.email_invalid',
         | 
| 42 | 
            +
                          default: 'should look like an email address.'
         | 
| 43 | 
            +
                        )
         | 
| 44 | 
            +
                      }
         | 
| 45 | 
            +
                    },
         | 
| 46 | 
            +
                    length: { maximum: 100 },
         | 
| 47 | 
            +
                    uniqueness: {
         | 
| 48 | 
            +
                      case_sensitive: false,
         | 
| 49 | 
            +
                      if: :will_save_change_to_email?
         | 
| 50 | 
            +
                    }
         | 
| 51 | 
            +
                  validates :password,
         | 
| 52 | 
            +
                    confirmation: { if: :require_password? },
         | 
| 53 | 
            +
                    length: {
         | 
| 54 | 
            +
                      minimum: 8,
         | 
| 55 | 
            +
                      if: :require_password?
         | 
| 56 | 
            +
                    }
         | 
| 57 | 
            +
                  validates :password_confirmation,
         | 
| 58 | 
            +
                    length: {
         | 
| 59 | 
            +
                      minimum: 8,
         | 
| 60 | 
            +
                      if: :require_password?
         | 
| 61 | 
            +
                    }
         | 
| 32 62 | 
             
                end
         | 
| 63 | 
            +
                # rubocop:enable Metrics/BlockLength
         | 
| 33 64 |  | 
| 34 65 | 
             
                module ClassMethods
         | 
| 35 66 |  | 
| @@ -2,6 +2,7 @@ | |
| 2 2 | 
             
            <html lang="en">
         | 
| 3 3 | 
             
            <head>
         | 
| 4 4 | 
             
              <title><%= TbCore.config.site_name %> Admin</title>
         | 
| 5 | 
            +
              <%= tinymce_assets unless ENV['TB_SKIP_TINYMCE'] %>
         | 
| 5 6 | 
             
              <%= stylesheet_link_tag *TbCore.config.admin_stylesheets %>
         | 
| 6 7 | 
             
              <%= javascript_include_tag *TbCore.config.admin_javascripts %>
         | 
| 7 8 | 
             
              <%= csrf_meta_tags %>
         | 
    
        data/lib/tb_core/engine.rb
    CHANGED
    
    | @@ -7,6 +7,7 @@ require 'will_paginate-bootstrap' | |
| 7 7 | 
             
            require 'breadcrumbs_on_rails'
         | 
| 8 8 | 
             
            require 'rails-ujs'
         | 
| 9 9 | 
             
            require 'sortable_by'
         | 
| 10 | 
            +
            require 'tinymce-rails'
         | 
| 10 11 |  | 
| 11 12 | 
             
            module Spud
         | 
| 12 13 | 
             
            end
         | 
| @@ -15,6 +16,7 @@ module TbCore | |
| 15 16 | 
             
              class Engine < ::Rails::Engine
         | 
| 16 17 | 
             
                require "#{root}/lib/tb_core/errors"
         | 
| 17 18 | 
             
                require "#{root}/lib/tb_core/form_builder"
         | 
| 19 | 
            +
                require "#{root}/lib/tb_core/regex"
         | 
| 18 20 | 
             
                require "#{root}/lib/tb_core/searchable"
         | 
| 19 21 | 
             
                require "#{root}/lib/tb_core/spud_core"
         | 
| 20 22 |  | 
    
        data/lib/tb_core/form_builder.rb
    CHANGED
    
    | @@ -219,7 +219,7 @@ class TbCore::FormBuilder < ActionView::Helpers::FormBuilder | |
| 219 219 | 
             
              # Builds a file field group
         | 
| 220 220 | 
             
              #
         | 
| 221 221 | 
             
              def tb_file_field(attribute, options={})
         | 
| 222 | 
            -
                tb_input_field(attribute) do
         | 
| 222 | 
            +
                tb_input_field(attribute, nil, options) do
         | 
| 223 223 | 
             
                  file_field(attribute)
         | 
| 224 224 | 
             
                end
         | 
| 225 225 | 
             
              end
         | 
    
        data/lib/tb_core/test_helper.rb
    CHANGED
    
    | @@ -1,29 +1,31 @@ | |
| 1 1 | 
             
            require 'authlogic/test_case'
         | 
| 2 2 |  | 
| 3 | 
            -
            module TbCore | 
| 4 | 
            -
               | 
| 3 | 
            +
            module TbCore
         | 
| 4 | 
            +
              module TestHelper
         | 
| 5 | 
            +
                include Authlogic::TestCase
         | 
| 5 6 |  | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 7 | 
            +
                # Use this helper in controller specs to establish a login session
         | 
| 8 | 
            +
                # - admin: Set to true to create a super_admin
         | 
| 9 | 
            +
                # - permissions: One or more permissions you want to assign to the user (a role will be auto generated)
         | 
| 10 | 
            +
                #
         | 
| 11 | 
            +
                def activate_session(admin: false, permissions: nil)
         | 
| 12 | 
            +
                  activate_authlogic()
         | 
| 13 | 
            +
                  if permissions
         | 
| 14 | 
            +
                    permissions = [permissions] unless permissions.is_a?(Array)
         | 
| 15 | 
            +
                    role = SpudRole.create(name: 'New Role', permission_tags: permissions)
         | 
| 16 | 
            +
                  else
         | 
| 17 | 
            +
                    role = nil
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
                  @user = FactoryBot.create(:spud_user, super_admin: admin, role: role)
         | 
| 20 | 
            +
                  SpudUserSession.create(@user)
         | 
| 21 | 
            +
                  return @user
         | 
| 17 22 | 
             
                end
         | 
| 18 | 
            -
                @user = FactoryBot.create(:spud_user, super_admin: admin, role: role)
         | 
| 19 | 
            -
                SpudUserSession.create(@user)
         | 
| 20 | 
            -
                return @user
         | 
| 21 | 
            -
              end
         | 
| 22 23 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 24 | 
            +
                # Returns the current user
         | 
| 25 | 
            +
                #
         | 
| 26 | 
            +
                def current_user
         | 
| 27 | 
            +
                  return @user
         | 
| 28 | 
            +
                end
         | 
| 27 29 | 
             
              end
         | 
| 28 30 | 
             
            end
         | 
| 29 31 |  | 
| @@ -31,7 +33,7 @@ end | |
| 31 33 | 
             
            #
         | 
| 32 34 | 
             
            if defined?(RSpec)
         | 
| 33 35 | 
             
              RSpec.configure do |config|
         | 
| 34 | 
            -
                config.include TbCore:: | 
| 36 | 
            +
                config.include TbCore::TestHelper
         | 
| 35 37 | 
             
              end
         | 
| 36 38 | 
             
            end
         | 
| 37 39 |  | 
    
        data/lib/tb_core/version.rb
    CHANGED
    
    
| @@ -69,7 +69,7 @@ RSpec.describe Admin::DashboardController, type: :controller do | |
| 69 69 | 
             
                it 'should contain data array in reponse' do
         | 
| 70 70 | 
             
                  get :badges
         | 
| 71 71 | 
             
                  json = JSON.parse(response.body)
         | 
| 72 | 
            -
                  expect(response. | 
| 72 | 
            +
                  expect(response.media_type).to eq('application/json')
         | 
| 73 73 | 
             
                  expect(json).to have_key('data')
         | 
| 74 74 | 
             
                end
         | 
| 75 75 |  | 
| @@ -12,51 +12,6 @@ module Dummy | |
| 12 12 | 
             
                  config.from_address = 'no-reply@dummy.com'
         | 
| 13 13 | 
             
                end
         | 
| 14 14 |  | 
| 15 | 
            -
                 | 
| 16 | 
            -
                # Application configuration should go into files in config/initializers
         | 
| 17 | 
            -
                # -- all .rb files in that directory are automatically loaded.
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                # Custom directories with classes and modules you want to be autoloadable.
         | 
| 20 | 
            -
                # config.autoload_paths += %W(#{config.root}/extras)
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                # Only load the plugins named here, in the order given (default is alphabetical).
         | 
| 23 | 
            -
                # :all can be used as a placeholder for all plugins not explicitly named.
         | 
| 24 | 
            -
                # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                # Activate observers that should always be running.
         | 
| 27 | 
            -
                # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
         | 
| 30 | 
            -
                # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
         | 
| 31 | 
            -
                # config.time_zone = 'Central Time (US & Canada)'
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
         | 
| 34 | 
            -
                # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
         | 
| 35 | 
            -
                # config.i18n.default_locale = :de
         | 
| 36 | 
            -
                config.i18n.enforce_available_locales = true
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                # Configure the default encoding used in templates for Ruby 1.9.
         | 
| 39 | 
            -
                config.encoding = 'utf-8'
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                # Configure sensitive parameters which will be filtered from the log file.
         | 
| 42 | 
            -
                config.filter_parameters += [:password]
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                # Use SQL instead of Active Record's schema dumper when creating the database.
         | 
| 45 | 
            -
                # This is necessary if your schema can't be completely dumped by the schema dumper,
         | 
| 46 | 
            -
                # like if you have constraints or database-specific column types
         | 
| 47 | 
            -
                # config.active_record.schema_format = :sql
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                # Enforce whitelist mode for mass assignment.
         | 
| 50 | 
            -
                # This will create an empty whitelist of attributes available for mass-assignment for all models
         | 
| 51 | 
            -
                # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
         | 
| 52 | 
            -
                # parameters by using an attr_accessible or attr_protected declaration.
         | 
| 53 | 
            -
                # config.active_record.whitelist_attributes = true
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                # Enable the asset pipeline
         | 
| 56 | 
            -
                # config.assets.enabled = true
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                # Version of your assets, change this if you want to expire all your assets
         | 
| 59 | 
            -
                # config.assets.version = '1.0'
         | 
| 60 | 
            -
             | 
| 15 | 
            +
                config.load_defaults '6.0'
         | 
| 61 16 | 
             
              end
         | 
| 62 17 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,23 +1,20 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: tb_core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.4 | 
| 4 | 
            +
              version: 1.5.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Greg Woods
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-02-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: authlogic
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - ">="
         | 
| 18 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 3.4.3
         | 
| 20 | 
            -
                - - "<"
         | 
| 21 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 22 19 | 
             
                    version: '5.0'
         | 
| 23 20 | 
             
              type: :runtime
         | 
| @@ -25,9 +22,6 @@ dependencies: | |
| 25 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 26 23 | 
             
                requirements:
         | 
| 27 24 | 
             
                - - ">="
         | 
| 28 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version: 3.4.3
         | 
| 30 | 
            -
                - - "<"
         | 
| 31 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 32 26 | 
             
                    version: '5.0'
         | 
| 33 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| @@ -156,6 +150,20 @@ dependencies: | |
| 156 150 | 
             
                - - ">="
         | 
| 157 151 | 
             
                  - !ruby/object:Gem::Version
         | 
| 158 152 | 
             
                    version: '0'
         | 
| 153 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 154 | 
            +
              name: tinymce-rails
         | 
| 155 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 156 | 
            +
                requirements:
         | 
| 157 | 
            +
                - - ">="
         | 
| 158 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 159 | 
            +
                    version: '0'
         | 
| 160 | 
            +
              type: :runtime
         | 
| 161 | 
            +
              prerelease: false
         | 
| 162 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 163 | 
            +
                requirements:
         | 
| 164 | 
            +
                - - ">="
         | 
| 165 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 166 | 
            +
                    version: '0'
         | 
| 159 167 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 160 168 | 
             
              name: will_paginate
         | 
| 161 169 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -242,6 +250,20 @@ dependencies: | |
| 242 250 | 
             
                    version: '0'
         | 
| 243 251 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 244 252 | 
             
              name: rspec-rails
         | 
| 253 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 254 | 
            +
                requirements:
         | 
| 255 | 
            +
                - - ">="
         | 
| 256 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 257 | 
            +
                    version: 4.0.0.beta2
         | 
| 258 | 
            +
              type: :development
         | 
| 259 | 
            +
              prerelease: false
         | 
| 260 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 261 | 
            +
                requirements:
         | 
| 262 | 
            +
                - - ">="
         | 
| 263 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 264 | 
            +
                    version: 4.0.0.beta2
         | 
| 265 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 266 | 
            +
              name: rubocop
         | 
| 245 267 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 246 268 | 
             
                requirements:
         | 
| 247 269 | 
             
                - - ">="
         | 
| @@ -255,7 +277,21 @@ dependencies: | |
| 255 277 | 
             
                  - !ruby/object:Gem::Version
         | 
| 256 278 | 
             
                    version: '0'
         | 
| 257 279 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 258 | 
            -
              name: rubocop
         | 
| 280 | 
            +
              name: rubocop-performance
         | 
| 281 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 282 | 
            +
                requirements:
         | 
| 283 | 
            +
                - - ">="
         | 
| 284 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 285 | 
            +
                    version: '0'
         | 
| 286 | 
            +
              type: :development
         | 
| 287 | 
            +
              prerelease: false
         | 
| 288 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 289 | 
            +
                requirements:
         | 
| 290 | 
            +
                - - ">="
         | 
| 291 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 292 | 
            +
                    version: '0'
         | 
| 293 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 294 | 
            +
              name: rubocop-rails
         | 
| 259 295 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 260 296 | 
             
                requirements:
         | 
| 261 297 | 
             
                - - ">="
         | 
| @@ -426,6 +462,7 @@ files: | |
| 426 462 | 
             
            - lib/tb_core/engine.rb
         | 
| 427 463 | 
             
            - lib/tb_core/errors.rb
         | 
| 428 464 | 
             
            - lib/tb_core/form_builder.rb
         | 
| 465 | 
            +
            - lib/tb_core/regex.rb
         | 
| 429 466 | 
             
            - lib/tb_core/responder.rb
         | 
| 430 467 | 
             
            - lib/tb_core/searchable.rb
         | 
| 431 468 | 
             
            - lib/tb_core/spud_core.rb
         | 
| @@ -442,6 +479,7 @@ files: | |
| 442 479 | 
             
            - spec/controllers/tb_core/application_controller_spec.rb
         | 
| 443 480 | 
             
            - spec/dummy/README.rdoc
         | 
| 444 481 | 
             
            - spec/dummy/Rakefile
         | 
| 482 | 
            +
            - spec/dummy/app/assets/config/manifest.js
         | 
| 445 483 | 
             
            - spec/dummy/app/assets/javascripts/admin/application.js
         | 
| 446 484 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 447 485 | 
             
            - spec/dummy/app/assets/stylesheets/admin/application.scss
         | 
| @@ -488,7 +526,7 @@ files: | |
| 488 526 | 
             
            homepage: http://bitbucket.org/moser-inc/tb_core
         | 
| 489 527 | 
             
            licenses: []
         | 
| 490 528 | 
             
            metadata: {}
         | 
| 491 | 
            -
            post_install_message: | 
| 529 | 
            +
            post_install_message:
         | 
| 492 530 | 
             
            rdoc_options: []
         | 
| 493 531 | 
             
            require_paths:
         | 
| 494 532 | 
             
            - lib
         | 
| @@ -503,15 +541,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 503 541 | 
             
                - !ruby/object:Gem::Version
         | 
| 504 542 | 
             
                  version: '0'
         | 
| 505 543 | 
             
            requirements: []
         | 
| 506 | 
            -
             | 
| 507 | 
            -
             | 
| 508 | 
            -
            signing_key: 
         | 
| 544 | 
            +
            rubygems_version: 3.0.3
         | 
| 545 | 
            +
            signing_key:
         | 
| 509 546 | 
             
            specification_version: 4
         | 
| 510 547 | 
             
            summary: Twice Baked Core Engine
         | 
| 511 548 | 
             
            test_files:
         | 
| 512 549 | 
             
            - spec/spec_helper.rb
         | 
| 513 550 | 
             
            - spec/dummy/app/controllers/application_controller.rb
         | 
| 514 551 | 
             
            - spec/dummy/app/views/layouts/application.html.erb
         | 
| 552 | 
            +
            - spec/dummy/app/assets/config/manifest.js
         | 
| 515 553 | 
             
            - spec/dummy/app/assets/javascripts/admin/application.js
         | 
| 516 554 | 
             
            - spec/dummy/app/assets/javascripts/application.js
         | 
| 517 555 | 
             
            - spec/dummy/app/assets/stylesheets/application.scss
         |