Sha256: cf8db529f0342870394051c393d2ef0735d18b40f0ccc4a853b77e4a483286bd

Contents?: true

Size: 731 Bytes

Versions: 6

Compression:

Stored size: 731 Bytes

Contents

# -*- encoding : utf-8 -*-
module RademadeAdmin
  module Templates

    def native_template_folder
      # 15 = "RademadeAdmin::".length
      # 11 = "Controller".length
      # e.g. RademadeAdmin::QuestionAnswer::UsersController to "question_answer/users"
      @native_template_folder ||= self.class.to_s[15..-11].underscore
    end

    def form_template_path(real = false)
      abstract_template((real ? '_' : '') + 'form')
    end

    def abstract_template(template)
      if template_exists?(template, @template_service.template_path(native_template_folder))
        folder = native_template_folder
      else
        folder = 'abstract'
      end
      @template_service.template_path(folder, template)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rademade_admin-0.1.5 app/services/model_controller/templates.rb
rademade_admin-0.1.4 app/services/model_controller/templates.rb
rademade_admin-0.1.3 app/services/model_controller/templates.rb
rademade_admin-0.1.2 app/services/model_controller/templates.rb
rademade_admin-0.1.1 app/services/model_controller/templates.rb
rademade_admin-0.1.0 app/services/model_controller/templates.rb