Sha256: d0459eca6c7f54318cd92d34fb6093a63bc0071f32033a1e64b906e8aee5fb6c

Contents?: true

Size: 544 Bytes

Versions: 17

Compression:

Stored size: 544 Bytes

Contents

require 'ui_bibz/utils/internationalization'
module UiBibz::Ui
  class Base
    include ActionView::Helpers
    include Rails.application.routes.url_helpers

    attr_accessor :output_buffer

    # To know if translation missing
    def i18n_set? key
      I18n.t key, :raise => true rescue false
    end

    # Add "id" in url to match with current record
    def inject_url url, record
      url.gsub(/(\/id\/?)/, "/#{ record.id }/")
    end

    def generate_id name = nil
      "#{ name || 'id' }-#{ Random.rand(99999) }"
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ui_bibz-2.4.0 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.15 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.14 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.13 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.12 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.11 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.10 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.9 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.8 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.7 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.6 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.5 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.4 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.3 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.2 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.1 lib/ui_bibz/ui/base.rb
ui_bibz-2.3.0 lib/ui_bibz/ui/base.rb