iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 413 forks source link

Loading template not found. Naming convention issue. #1473

Open dheerajbhaskar opened 8 years ago

dheerajbhaskar commented 8 years ago

Expectation:

Per the readme.md, templates are found this way: if the route name is game.loading, then the template GameLoading is tried to load first.

Problem

When I do this, I get this error: Error of template not found

As the error message suggests, gameLoading for template name works perfectly fine. This might be a trivial issue but this breaks the project naming convention for templates. What readme.md says holds good for Router.route declarations like Router.route('/', {name: 'game.main'});

This is breaking for me and is very reproducible:

Code:

My loading template:

<template name="gameLoading">
    <div id="game_loading">Game loading...
    </div>
</template>

My controller:

GameController = RouteController.extend({
  loadingTemplate: 'game.loading',
  // some other stuff below
});

My project structure:

Folder PATH listing
Volume serial number is 04CD0000 EC7B:A1F2
C:.
|   .gitignore
|   abgame.css
|   abgame.html
|   abgame.js
|   info.txt          
|
|               
+---both
|   +---collections
|   |       collections.js
|   |       schemas.js
|   |       
|   \---methods
|           game_main.js
|           
+---client
|   +---game_dealer
|   |       game_dealer.html
|   |       game_dealer_controller.js
|   |       game_dealer_helpers.js
|   |       game_dealer_lifecycle.js
|   |       
|   +---game_main
|   |       game_main.html
|   |       game_main_controller.js
|   |       game_main_events.js
|   |       game_main_helpers.js
|   |       game_main_lifecycle.js
|   |       
|   \---shared
|       +---game_background
|       |       game_background.html
|       |       
|       +---game_cards
|       |       game_cards.html
|       |       game_cards.js
|       |       
|       +---game_message
|       |       game_message.html
|       |       game_message.js
|       |       
|       +---game_timer
|       |       game_timer.html
|       |       game_timer.js
|       |       
|       \---lib
|           |   game_controller.js
|           |   game_main_utility.js
|           |   
|           \---game_loading
|                   game_loading.css
|                   game_loading.html
|                   
+---lib
|   |   CONSTANTS.js
|   |   logging.js
|   |   
|   \---helpers
|           CONFIG.js
|           
+---public
|   \---images
|       |   all_bg.jpg
|       |   button_close.png
|       |   button_mute.png
|       |   button_settings.png
|       |   button_unmute.png
|       |   homescreen_pokertable_bg.png
|       |   
|       +---chips
|       |       gamescreen_chip_green_2d.png
|       |       gamescreen_chip_maroon_2d.png
|       |       gamescreen_chip_yellow_2d.png
|       |       
|       \---gamescreen_playing_cards
|               gamescreen_cards_back_side.png
|               gamescreen_cards_c2.png
|               gamescreen_cards_c3.png
|               gamescreen_cards_c4.png
|               gamescreen_cards_c5.png
|               gamescreen_cards_c6.png
|               gamescreen_cards_c7.png
|               gamescreen_cards_c8.png
|               gamescreen_cards_c9.png
|               gamescreen_cards_ca.png
|               gamescreen_cards_cj.png
|               gamescreen_cards_ck.png
|               gamescreen_cards_cq.png
|               gamescreen_cards_cx.png
|               gamescreen_cards_d2.png
|               gamescreen_cards_d3.png
|               gamescreen_cards_d4.png
|               gamescreen_cards_d5.png
|               gamescreen_cards_d6.png
|               gamescreen_cards_d7.png
|               gamescreen_cards_d8.png
|               gamescreen_cards_d9.png
|               gamescreen_cards_da.png
|               gamescreen_cards_dj.png
|               gamescreen_cards_dk.png
|               gamescreen_cards_dq.png
|               gamescreen_cards_dx.png
|               gamescreen_cards_h2.png
|               gamescreen_cards_h3.png
|               gamescreen_cards_h4.png
|               gamescreen_cards_h5.png
|               gamescreen_cards_h6.png
|               gamescreen_cards_h7.png
|               gamescreen_cards_h8.png
|               gamescreen_cards_h9.png
|               gamescreen_cards_ha.png
|               gamescreen_cards_hj.png
|               gamescreen_cards_hk.png
|               gamescreen_cards_hq.png
|               gamescreen_cards_hx.png
|               gamescreen_cards_s2.png
|               gamescreen_cards_s3.png
|               gamescreen_cards_s4.png
|               gamescreen_cards_s5.png
|               gamescreen_cards_s6.png
|               gamescreen_cards_s7.png
|               gamescreen_cards_s8.png
|               gamescreen_cards_s9.png
|               gamescreen_cards_sa.png
|               gamescreen_cards_sj.png
|               gamescreen_cards_sk.png
|               gamescreen_cards_sq.png
|               gamescreen_cards_sx.png
|               
\---server
    |   api.js
    |   CONST_SERVER.js
    |   kadira.js
    |   
    \---publish
            game_main.js
dheerajbhaskar commented 8 years ago

Okay, this might seem obvious in hindsight, does the loadingTemplate: 'game.loading' mean to declare the name of the loading template verbatim? if I declare it to be GameLoading then it works fine according to the naming conventions.

chrisbutler commented 8 years ago

@dheerajbhaskar yeah, i'm not sure the template namespacing/translation was intended to work on the loading template... but it does seem logical to have that functionality