Sha256: e38cd1d127bafacd71bac217335e4dc75b2a2fa5a1af5bdbd3cc53ef9e516fb7

Contents?: true

Size: 707 Bytes

Versions: 19

Compression:

Stored size: 707 Bytes

Contents

module Locomotive
  module Concerns
    module Page
      module Redirect

        extend ActiveSupport::Concern

        included do

          ## fields ##
          field :redirect,      type: Boolean, default:  false
          field :redirect_url,  type: String,  localize: true, default: ''
          field :redirect_type, type: Integer, default:  301

          ## validations ##
          validates_presence_of :redirect_type, if: :redirect?
          validates_presence_of :redirect_url,  if: :redirect?
          validates_format_of   :redirect_url,  with: Locomotive::Regexps::URL_AND_MAILTO, if:  ->(page) { page.redirect? && !page.redirect_url.blank? }

        end

      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.2.0.alpha1 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.1.1 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.1.0 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.1.0.rc1 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.0.3 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.0.2 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.0.1 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.0.0 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.0.0.rc0 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.0.0.alpha3 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-3.4.1 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.0.0.alpha2 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-4.0.0.alpha1 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-3.4.0 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-3.3.0 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-3.3.0.rc3 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-3.3.0.rc2 app/models/locomotive/concerns/page/redirect.rb
locomotivecms-3.3.0.rc1 app/models/locomotive/concerns/page/redirect.rb