├── .github └── workflows │ └── build.yml ├── .gitignore ├── CHANGELOG.md ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── angular-rails-templates.gemspec ├── gemfiles ├── rails_5.0.gemfile ├── rails_5.0_sprockets4.gemfile ├── rails_5.2.gemfile ├── rails_5.2_sprockets4.gemfile ├── rails_6.0.gemfile ├── rails_6.1.gemfile ├── rails_7.0.gemfile ├── rails_7.1.gemfile ├── rails_7.2.gemfile ├── rails_8.0.gemfile ├── rails_head.gemfile └── rails_head_sprockets4.gemfile ├── lib ├── angular-rails-templates.rb └── angular-rails-templates │ ├── compact_javascript_escape.rb │ ├── engine.rb │ ├── javascript_template.js.erb │ ├── processor.rb │ ├── transformer.rb │ └── version.rb ├── test ├── compact_javascript_escape_test.rb ├── dummy │ ├── README.rdoc │ ├── Rakefile │ ├── app │ │ ├── assets │ │ │ ├── config │ │ │ │ └── manifest.js │ │ │ ├── images │ │ │ │ └── .keep │ │ │ ├── javascripts │ │ │ │ ├── application.js │ │ │ │ ├── erb_template.html.erb │ │ │ │ ├── haml_template.html.haml │ │ │ │ ├── ignored_namespace │ │ │ │ │ └── hello-world.html │ │ │ │ ├── markdown.html.md │ │ │ │ ├── plain.html │ │ │ │ ├── slim_template.html.slim │ │ │ │ ├── subfolder │ │ │ │ │ ├── haml_template.html.haml │ │ │ │ │ ├── slim_template.html.slim │ │ │ │ │ └── template.html │ │ │ │ └── subfolder2 │ │ │ │ │ └── template.html │ │ │ └── templates │ │ │ │ ├── sub │ │ │ │ ├── sub.html.str │ │ │ │ └── sub2.html.haml │ │ │ │ └── test.html │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ ├── concerns │ │ │ │ └── .keep │ │ │ └── welcome_controller.rb │ │ ├── helpers │ │ │ └── application_helper.rb │ │ ├── mailers │ │ │ └── .keep │ │ ├── models │ │ │ ├── .keep │ │ │ └── concerns │ │ │ │ └── .keep │ │ └── views │ │ │ ├── layouts │ │ │ └── application.html.erb │ │ │ └── welcome │ │ │ └── index.html.haml │ ├── bin │ │ ├── bundle │ │ ├── rails │ │ └── rake │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── database.yml │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── backtrace_silencers.rb │ │ │ ├── filter_parameter_logging.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ ├── secret_token.rb │ │ │ ├── session_store.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ └── routes.rb │ ├── lib │ │ └── assets │ │ │ └── .keep │ ├── log │ │ └── .keep │ └── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── angular.min.js │ │ └── favicon.ico ├── integration │ ├── static_assets_integration_test.rb │ └── user_assets_integration_test.rb ├── precompile_test.rb └── test_helper.rb └── vendor └── assets └── javascripts └── angular-rails-templates.js.erb /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake 6 | # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby 7 | 8 | name: build 9 | 10 | on: [push, pull_request] 11 | 12 | jobs: 13 | test: 14 | runs-on: ubuntu-20.04 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | ruby: 19 | - '3.1' 20 | - '3.2' 21 | - '3.3' 22 | gemfile: 23 | - rails_6.0 24 | - rails_6.1 25 | - rails_7.0 26 | - rails_7.1 27 | - rails_7.2 28 | - rails_8.0 29 | exclude: 30 | - gemfile: rails_8.0 31 | ruby: '3.1' 32 | include: 33 | - gemfile: rails_5.0 34 | ruby: '2.6' 35 | - gemfile: rails_5.0_sprockets4 36 | ruby: '2.6' 37 | - gemfile: rails_5.2 38 | ruby: '2.7' 39 | - gemfile: rails_5.2_sprockets4 40 | ruby: '2.7' 41 | 42 | env: 43 | BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile 44 | AWS_REGION: us-east1 45 | steps: 46 | - uses: actions/checkout@v2 47 | - uses: ruby/setup-ruby@v1 48 | with: 49 | ruby-version: ${{ matrix.ruby }} 50 | bundler-cache: true 51 | - run: bundle exec rake test 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | test/dummy/tmp/* 3 | test/dummy/log/* 4 | test/dummy/public/assets/* 5 | *.lock 6 | .DS_Store 7 | vendor/ruby 8 | .bundle 9 | coverage 10 | .ruby-version 11 | /.idea 12 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog 2 | 3 | ### [Unreleased] 4 | 5 | ### 1.3.1 6 | 7 | - Fix broken tests due to missing Logger (#174) (Eric Helms) 8 | - Rely on the digest class defined by Rails (#173) (Eric Helms) 9 | 10 | ### 1.3.0 11 | 12 | - Support Rails 8 (#172) (Eric Pugh) 13 | 14 | ### 1.2.2 15 | 16 | - Support Rails 7.2 (#170) (Mansoor Khan) 17 | 18 | ### 1.2.1 19 | 20 | - Support Rails 7.1 (#169) (Mathieu Jobin) 21 | 22 | ### 1.2.0 23 | 24 | - Support Rails 7 25 | 26 | ### 1.1.0 27 | 28 | - Support Rails 6 29 | - Use global Rails namespace [merqlove, #148] 30 | 31 | ### 1.0.2 32 | 33 | - Silence deprecation warning on sprockets 3.7 [kressh, #145] 34 | 35 | ### 1.0.1 36 | 37 | - Better support for Rails 5 and Sprockets 4 [merqlove/sandrew, #142] 38 | 39 | ### 1.0.0 40 | 41 | - Add support for Rails 5.0 [pitr, #131] 42 | 43 | ### 1.0.0.beta2 44 | 45 | - Loading tilt gem before using 46 | - Configurable extension `.html` [speranskydanil, #99] 47 | - Default inside_paths is a relative path [redterror, #108] 48 | - Do not process files outside inside_paths path [keenahn, #113] 49 | 50 | ### 1.0.0.beta1 51 | 52 | - Add support for Rails 4.2 [superchris/pitr, #126] 53 | - Remove support for Rails 4.1 and less 54 | 55 | ### 0.2.0 56 | 57 | - Add config.angular_templates.inside_paths [sars, #90] 58 | 59 | ### 0.1.5 60 | 61 | - Lock Sprocket support to version 2 [davetron5000, #96] 62 | 63 | ### 0.1.4 64 | 65 | - Run when `initialize_on_precompile = false` [squirly, #84] 66 | 67 | ### 0.1.3 68 | 69 | - Add array support to config.angular_templates.ignore_prefix [AaronV, #54] 70 | - Compatibility with slim-rails 2.1.5 [blackxored, #57] 71 | 72 | ### 0.1.2 73 | 74 | - Automatic Sprockets Cache busting (+ tilt warning silence) [whitehat101, #48] 75 | 76 | ### 0.1.1 77 | 78 | - Add vendor folder to gemspec [whitehat101, #41] 79 | - Add Tilt as dependency [pitr, #43] 80 | 81 | ### 0.1.0 82 | 83 | - **BREAKING** Bring back a separate JS file for module declaration [whitehat101, #35] 84 | - Fix Rails 4 support [brianewing, #39] 85 | - Add Tilt support [whitehat101, #38] 86 | - Add Template Chaining e.g. `example.html.haml.erb` [whitehat101, #38] 87 | - Add HtmlCompressor [whitehat101, #38] 88 | 89 | ### 0.0.7 90 | 91 | - Add support for HAML and SLIM templates [oivoodoo, #26] 92 | 93 | ### 0.0.6 94 | 95 | - Fix for Rails 4 [pitr, #20] 96 | 97 | ### 0.0.5 (yanked) 98 | 99 | - Support Rails 3.2+ (in addition to Rails 4) [pitr, #14] 100 | 101 | ### 0.0.4 102 | 103 | - Deprecate need for angular-rails-templates.js (pitr, #9) 104 | - Add ignore_prefix (pitr, #7) 105 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "rails", "~> 6.0" 4 | gem "haml" 5 | gem "slim-rails" 6 | gem "kramdown" 7 | 8 | gem 'coveralls', require: false 9 | 10 | gemspec 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Damien MATHIEU 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular Rails Templates 2 | 3 | [](http://badge.fury.io/rb/angular-rails-templates) 4 | [](https://coveralls.io/github/pitr/angular-rails-templates?branch=master) 5 | [](https://codeclimate.com/github/pitr/angular-rails-templates) 6 | [](http://issuestats.com/github/pitr/angular-rails-templates) 7 | [](http://issuestats.com/github/pitr/angular-rails-templates) 8 | [](https://waffle.io/pitr/angular-rails-templates) 9 | 10 | Adds your HTML templates into Angular's `$templateCache` using Rails asset pipeline. 11 | 12 | **IMPORTANT**: for Rails 4.2+ use version 1.0+ of this gem. For Rails 3 - 4.1 use version 0.x 13 | 14 | Branch | Build Status 15 | ------------|--------- 16 | master | [](https://github.com/pitr/angular-rails-templates) 17 | 0-x-stable | [](https://travis-ci.org/pitr/angular-rails-templates) 18 | 19 | It removes the need for AJAX calls to retrieve the templates (or for you to manually set them into the DOM). 20 | 21 | ## Usage 22 | 23 | ### 1. Add the Gem 24 | 25 | In Gemfile 26 | 27 | ```ruby 28 | gem 'angular-rails-templates' 29 | ``` 30 | 31 | ### 2. Include Templates in Rails Asset Pipeline 32 | 33 | Then, in your `application.js` file, require `angular-rails-templates` and your templates: 34 | 35 | ```javascript 36 | //= require angularjs 37 | // ... 38 | //= require angular-rails-templates 39 | // 40 | // Templates in app/assets/javascript/templates 41 | //= require_tree ./templates 42 | // OR 43 | // Templates in app/assets/templates (but see step 5) 44 | //= require_tree ../templates 45 | ``` 46 | 47 | Make sure to `require angular-rails-templates` **before** you require your templates. 48 | 49 | Name your templates like you would name any other Rails view. **The `.html` part is required.** If it is not present your views will not be added to angular's template cache. 50 | 51 | ``` 52 | foo.html 53 | foo.html.erb 54 | foo.html.haml 55 | foo.html.slim 56 | ``` 57 | 58 | Angular Rails Templates will try to load support for the following markups if their gems are present: 59 | 60 | | Extension | Required gem | 61 | |---------- |----------------------------------------------------------| 62 | | .erb | - | 63 | | .str | - | 64 | | .haml | haml | 65 | | .slim | slim | 66 | | .md | liquid, rdiscount, redcarpet, bluecloth, kramdown, maruku | 67 | 68 | See [Advanced](#advanced-configuration) if you would like to use other markup languages. 69 | 70 | ### 3. Add a Dependency in your Angular Application Module 71 | 72 | Your Angular module needs to depend on the `templates` module. (configurable, see [Advanced Configuration](#configuration-option-module_name)) 73 | 74 | ```javascript 75 | angular.module('myApplication', ['templates']); 76 | ``` 77 | 78 | ### 4. Use your Templates 79 | 80 | No matter what the source file extension is, your template's url will be `#{base_name}.html` 81 | 82 | For example: 83 | ```ruby 84 | main.html => main.html 85 | widget.html.haml => widget.html 86 | modals/confirm.html.slim => modals/confirm.html 87 | modals/dialog.html.slim.erb.str => modals/dialog.html # don't do this 88 | ``` 89 | 90 | The templates can then be accessed via `templateUrl` as expected: 91 | 92 | ```javascript 93 | // Template: app/assets/templates/yourTemplate.html.haml 94 | { 95 | templateUrl: 'yourTemplate.html' 96 | } 97 | ``` 98 | 99 | Or anything else that uses `$templateCache` or `$templateRequest` 100 | 101 | ```html 102 |
103 | ``` 104 | 105 | ### 5. Avoid name collisions 106 | 107 | If you have `app/assets/javascript/user.js` and `app/assets/templates/user.html`, the former one will actually hide the latter. This is due to how Rails asset pipeline sees asset files, both are served under `/assets/user.js`. Please use namespacing to combat this issue. 108 | 109 | ## Advanced Configuration 110 | 111 | Angular Rails Templates has some configuration options that can be set inside `config/application.rb` 112 | 113 | Here are their default values: 114 | ```ruby 115 | # config/application.rb 116 | config.angular_templates.module_name = 'templates' 117 | config.angular_templates.ignore_prefix = %w(templates/) 118 | config.angular_templates.inside_paths = ['app/assets'] 119 | config.angular_templates.markups = %w(erb str haml slim md) 120 | config.angular_templates.extension = 'html' 121 | ``` 122 | 123 | ### Configuration Option: `module_name` 124 | 125 | This configures the module name that your templates will be placed into. 126 | It is used to generate javascript like: 127 | 128 | ```javascipt 129 | angular.module("<%= module_name %>")... 130 | ``` 131 | 132 | Although it is not recommended, you can set `module_name` to the name of your main application module and remove `require angular-rails-templates` from your javascript manifest to have your templates directly injected into your app. 133 | 134 | ### Configuration Option: `ignore_prefix` 135 | 136 | *If you place your templates in `app/assets/templates` this option is mostly useless.* 137 | 138 | `ignore_prefix` will be stripped from the beginning of the `templateUrl` it reports to angularjs. 139 | 140 | Since the default ignore_prefix is [`templates/`], any templates placed under `app/assets/javascripts/templates` will automatically have short names. If your templates are not in this location, you will need to use the full path to the template. 141 | 142 | You can set `config.angular_templates.ignore_prefix` to change the default ignore prefix. Default is [`templates/`]. 143 | 144 | 145 | ``` javascript 146 | // Templates in: app/assets/javascripts/templates (default) 147 | // ignore_prefix: templates/ (default) 148 | { 149 | templateUrl: 'yourTemplate.html' 150 | } 151 | // This won't work: 152 | { 153 | templateUrl: 'templates/yourTemplate.html' 154 | } 155 | ``` 156 | 157 | ``` javascript 158 | // Templates in: app/assets/javascripts/my_app/templates (custom) 159 | // ignore_prefix: templates/ (default) 160 | { 161 | templateUrl: 'my_app/templates/yourTemplate.html' 162 | } 163 | 164 | // ignore_prefix: my_app/templates/ (custom) 165 | { 166 | templateUrl: 'yourTemplate.html' 167 | } 168 | ``` 169 | 170 | 171 | ### Configuration Option: `inside_paths` 172 | 173 | Templates only from paths matched by `inside_paths` will be used. By default anything under app/assets can be templates. This option is useful if you are using this gem inside an engine. Also useful if you DON'T want some files to be processed by this gem (see issue #88) 174 | 175 | 176 | ### Configuration Option: `markups` 177 | 178 | Any markup that Tilt supports can be used, but you may need to add a gem to your Gemfile. See [Tilt](https://github.com/rtomayko/tilt) for a list of the supported markups and required libraries. 179 | 180 | ```ruby 181 | # Gemfile 182 | gem "asciidoctor" 183 | gem "radius" 184 | gem "creole" 185 | gem "tilt-handlebars" 186 | 187 | # config/application.rb 188 | config.angular_templates.markups.push 'asciidoc', 'radius', 'wiki', 'hbs' 189 | ``` 190 | If you would like to use a non-standard extension or you would like to use a custom template, you just need to tell Tilt about it. 191 | 192 | ```ruby 193 | # config/initializers/angular_rails_templates.rb 194 | Tilt.register Tilt::HamlTemplate, 'nghaml' 195 | 196 | # config/application.rb 197 | config.angular_templates.markups.push 'nghaml' 198 | ``` 199 | Note: You would still need to use `foo`**`.html`**`.nghaml` 200 | 201 | ### Configuration Option: `extension` 202 | 203 | By default this gem looks only at templates with `.html` suffix, eg. `foo.html` or `foo.html.haml`. This extension allows you to change that to another extension 204 | 205 | ## License 206 | 207 | MIT License. Copyright 2017 pitr 208 | 209 | ## Authors & contributors 210 | 211 | * Damien Mathieu <42@dmathieu.com> 212 | * pitrYou may have mistyped the address or the page may have moved.
55 |If you are the application owner check the logs for more information.
57 | 58 | 59 | -------------------------------------------------------------------------------- /test/dummy/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Maybe you tried to change something you didn't have access to.
55 |If you are the application owner check the logs for more information.
57 | 58 | 59 | -------------------------------------------------------------------------------- /test/dummy/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |If you are the application owner check the logs for more information.
56 | 57 | 58 | -------------------------------------------------------------------------------- /test/dummy/public/angular.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.16 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(O,U,s){'use strict';function t(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.16/"+(b?b+"/":"")+a;for(c=1;c=h&&(n.resolve(r),m(p.$$intervalId),delete e[p.$$intervalId]);z||b.$apply()},f);e[p.$$intervalId]=n;return p}var e={};d.cancel=function(a){return a&&a.$$intervalId in e?(e[a.$$intervalId].reject("canceled"),clearInterval(a.$$intervalId),delete e[a.$$intervalId],
80 | !0):!1};return d}]}function ad(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),
81 | DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function wc(b){b=b.split("/");for(var a=b.length;a--;)b[a]=wb(b[a]);return b.join("/")}function xc(b,a,c){b=sa(b,c);a.$$protocol=
82 | b.protocol;a.$$host=b.hostname;a.$$port=Y(b.port)||we[b.protocol]||null}function yc(b,a,c){var d="/"!==b.charAt(0);d&&(b="/"+b);b=sa(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?b.pathname.substring(1):b.pathname);a.$$search=Yb(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function oa(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function Ya(b){var a=b.indexOf("#");return-1==a?b:b.substr(0,a)}function Jb(b){return b.substr(0,
83 | Ya(b).lastIndexOf("/")+1)}function zc(b,a){this.$$html5=!0;a=a||"";var c=Jb(b);xc(b,this,b);this.$$parse=function(a){var e=oa(c,a);if(!w(e))throw Kb("ipthprfx",a,c);yc(e,this,b);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Zb(this.$$search),b=this.$$hash?"#"+wb(this.$$hash):"";this.$$url=wc(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$rewrite=function(d){var e;if((e=oa(b,d))!==s)return d=e,(e=oa(a,e))!==s?c+(oa("/",e)||e):b+d;if((e=oa(c,
84 | d))!==s)return c+e;if(c==d+"/")return c}}function Lb(b,a){var c=Jb(b);xc(b,this,b);this.$$parse=function(d){var e=oa(b,d)||oa(c,d),e="#"==e.charAt(0)?oa(a,e):this.$$html5?e:"";if(!w(e))throw Kb("ihshprfx",d,a);yc(e,this,b);d=this.$$path;var g=/^\/?.*?:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));g.exec(e)||(d=(e=g.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Zb(this.$$search),e=this.$$hash?"#"+wb(this.$$hash):"";this.$$url=wc(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=
85 | b+(this.$$url?a+this.$$url:"")};this.$$rewrite=function(a){if(Ya(b)==Ya(a))return a}}function Ac(b,a){this.$$html5=!0;Lb.apply(this,arguments);var c=Jb(b);this.$$rewrite=function(d){var e;if(b==Ya(d))return d;if(e=oa(c,d))return b+a+e;if(c===d+"/")return c}}function nb(b){return function(){return this[b]}}function Bc(b,a){return function(c){if(E(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Vd(){var b="",a=!1;this.hashPrefix=function(a){return B(a)?(b=a,this):b};this.html5Mode=
86 | function(b){return B(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function f(a){c.$broadcast("$locationChangeSuccess",h.absUrl(),a)}var h,l=d.baseHref(),k=d.url();a?(l=k.substring(0,k.indexOf("/",k.indexOf("//")+2))+(l||"/"),e=e.history?zc:Ac):(l=Ya(k),e=Lb);h=new e(l,"#"+b);h.$$parse(h.$$rewrite(k));g.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var b=y(a.target);"a"!==K(b[0].nodeName);)if(b[0]===g[0]||!(b=b.parent())[0])return;
87 | var e=b.prop("href");X(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=sa(e.animVal).href);var f=h.$$rewrite(e);e&&(!b.attr("target")&&f&&!a.isDefaultPrevented())&&(a.preventDefault(),f!=d.url()&&(h.$$parse(f),c.$apply(),O.angular["ff-684208-preventDefault"]=!0))}});h.absUrl()!=k&&d.url(h.absUrl(),!0);d.onUrlChange(function(a){h.absUrl()!=a&&(c.$evalAsync(function(){var b=h.absUrl();h.$$parse(a);c.$broadcast("$locationChangeStart",a,b).defaultPrevented?(h.$$parse(b),d.url(b)):f(b)}),c.$$phase||
88 | c.$digest())});var m=0;c.$watch(function(){var a=d.url(),b=h.$$replace;m&&a==h.absUrl()||(m++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),f(a))}));h.$$replace=!1;return m});return h}]}function Wd(){var b=!0,a=this;this.debugEnabled=function(a){return B(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:
89 | a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||C;a=!1;try{a=!!e.apply}catch(l){}return a?function(){var a=[];q(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function fa(b,a){if("constructor"===b)throw Ba("isecfld",a);return b}function Za(b,
90 | a){if(b){if(b.constructor===b)throw Ba("isecfn",a);if(b.document&&b.location&&b.alert&&b.setInterval)throw Ba("isecwindow",a);if(b.children&&(b.nodeName||b.prop&&b.attr&&b.find))throw Ba("isecdom",a);}return b}function ob(b,a,c,d,e){e=e||{};a=a.split(".");for(var g,f=0;1 P.S. I love you","
"],col:[2,"
"],tr:[2,"","
"],td:[3,"
"],_default:[0,"",""]};ea.optgroup=ea.option;ea.tbody=ea.tfoot=ea.colgroup=ea.caption=ea.thead;ea.th=ea.td;var Ja=N.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===U.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),N(O).on("load",a))},toString:function(){var b=
141 | [];q(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?y(this[b]):y(this[this.length+b])},length:0,push:Ke,sort:[].sort,splice:[].splice},kb={};q("multiple selected checked disabled readOnly required open".split(" "),function(b){kb[K(b)]=b});var nc={};q("input select option textarea button form details".split(" "),function(b){nc[Fa(b)]=!0});q({data:jc,inheritedData:jb,scope:function(b){return y(b).data("$scope")||jb(b.parentNode||b,["$isolateScope","$scope"])},
142 | isolateScope:function(b){return y(b).data("$isolateScope")||y(b).data("$isolateScopeNoTemplate")},controller:kc,injector:function(b){return jb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Gb,css:function(b,a,c){a=Ta(a);if(B(c))b.style[a]=c;else{var d;8>=S&&(d=b.currentStyle&&b.currentStyle[a],""===d&&(d="auto"));d=d||b.style[a];8>=S&&(d=""===d?s:d);return d}},attr:function(b,a,c){var d=K(a);if(kb[d])if(B(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));
143 | else return b[a]||(b.attributes.getNamedItem(a)||C).specified?d:s;else if(B(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?s:b},prop:function(b,a,c){if(B(c))b[a]=c;else return b[a]},text:function(){function b(b,d){var e=a[b.nodeType];if(E(d))return e?b[e]:"";b[e]=d}var a=[];9>S?(a[1]="innerText",a[3]="nodeValue"):a[1]=a[3]="textContent";b.$dv="";return b}(),val:function(b,a){if(E(a)){if("SELECT"===Ka(b)&&b.multiple){var c=[];q(b.options,function(a){a.selected&&
144 | c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(E(a))return b.innerHTML;for(var c=0,d=b.childNodes;c"," html-haml
"}
44 | end
45 |
46 | # assuming the user loads an approperate md library
47 | it "compiles markdown (markdown.html.md)" do
48 | visit '/assets/markdown.js'
49 | page.source.must_include %Q{// source: app/assets/javascripts/markdown.html.md}
50 | page.source.must_include %Q{$templateCache.put("markdown.html"}
51 | page.source.must_match %r{slim template
"}
67 | end
68 | end
69 |
70 | describe "templates in assets/javascript/ignored_namespace" do
71 |
72 | it "is configured with a custom namespace" do
73 | assert_equal config.ignore_prefix.count, 1
74 | assert_match config.ignore_prefix[0], "ignored_namespace/"
75 | end
76 |
77 | it "compiles haml (slim_template.html.slim)" do
78 | visit '/assets/slim_template.js'
79 | page.source.must_include %Q{// source: app/assets/javascripts/slim_template.html}
80 | page.source.must_include %Q{$templateCache.put("slim_template.html"}
81 | page.source.must_include %q{"slim template
"}
82 | end
83 | end
84 |
85 | describe "templates in assets/javascript/subfolder" do
86 |
87 | it "compiles html in a subfolder (template.html)" do
88 | visit '/assets/subfolder/template.js'
89 | page.source.must_include %Q{// source: app/assets/javascripts/subfolder/template.html}
90 | page.source.must_include %Q{$templateCache.put("subfolder/template.html"}
91 | page.source.must_include %q{'