Sha256: 1e57366341c90eb490d53adf4b5fb3a8729bfe69ba3b64fc2977a09d24d7022b

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

module Backbone
  module Generators
    module ResourceHelpers
      
      def backbone_path
        "app/assets/javascripts/backbone"
      end
      
      def model_namespace
        [js_app_name, "Models", class_name].join(".")
      end
      
      def singular_model_name
        uncapitalize singular_name.camelize
      end
      
      def plural_model_name
        uncapitalize(plural_name.camelize)
      end
      
      def collection_namespace
        [js_app_name, "Collections", plural_name.camelize].join(".")
      end
      
      def view_namespace
        [js_app_name, "Views", plural_name.camelize].join(".")
      end
      
      def router_namespace
        [js_app_name, "Routers", plural_name.camelize].join(".")
      end
      
      def jst(action)
        "backbone/templates/#{plural_name}/#{action}"
      end
      
      def js_app_name
        application_name.camelize
      end
      
      def application_name
        if defined?(Rails) && Rails.application
          Rails.application.class.name.split('::').first
        else
          "application"
        end
      end
      
      def uncapitalize(str)
        str[0, 1].downcase << str[1..-1]
      end
      
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
bbr-wsm-1.1.0 lib/generators/backbone/resource_helpers.rb
rails-backbone-1.2.0 lib/generators/backbone/resource_helpers.rb
railsy_backbone-0.0.1 lib/generators/resource_helper.rb
rails-backbone-0.9.10 lib/generators/backbone/resource_helpers.rb
rails-backbone-0.9.0 lib/generators/backbone/resource_helpers.rb
rails-backbone-0.8.0 lib/generators/backbone/resource_helpers.rb
rails-backbone-0.7.2 lib/generators/backbone/resource_helpers.rb
rails-backbone-0.7.1 lib/generators/backbone/resource_helpers.rb
rails-backbone-0.7.0 lib/generators/backbone/resource_helpers.rb
rails-backbone-0.6.1 lib/generators/backbone/resource_helpers.rb
rails-backbone-0.6.0 lib/generators/backbone/resource_helpers.rb
rails-backbone-0.6.0.rc lib/generators/backbone/resource_helpers.rb
rails-backbone-0.5.5 lib/generators/backbone/resource_helpers.rb