Permalink
Browse files

updated mustache to head and put template into a separate div

  • Loading branch information...
1 parent 57d0494 commit 2d63903d6c24c38c0cb3f259fee2cb3c59387351 @thilo thilo committed Jan 27, 2012
Showing with 27 additions and 18 deletions.
  1. +12 −6 app/views/space/plans.html.erb
  2. +5 −4 public/javascripts/application.js
  3. +10 −8 public/javascripts/mustache.js
@@ -1,5 +1,4 @@
-
-<ul id="plans">
+<div id="planTemplate" style="display:none">
<li class="plan">
<h3 class="plan-name">{{name}}</h3>
<p class="plan-description">
@@ -23,9 +22,16 @@
{{/included_per_timespan}}
{{/time_passes}}
- <a class="plan-link" href="{{url}}">Sign Up</a>
+ {{=[% %]=}}
+ <a class="plan-link" href="[%url%]" target="_blank">Sign Up</a>
+ [%={{ }}=%]
</li>
- <script type="text/javascript" charset="utf-8">
- cobotFb(<%= @space_json %>, <%= @plans_json %>);
- </script>
+</div>
+
+
+<ul id="plans">
</ul>
+<script type="text/javascript" charset="utf-8">
+ cobotFb(<%= @space_json %>, <%= @plans_json %>);
+</script>
+
@@ -1,7 +1,6 @@
var cobotFb = function(space, plans){
var $plans = $('#plans'),
- planTemplate = $plans.find(".plan").html();
- $plans.empty();
+ planTemplate = $('#planTemplate').html();
var display_gross = function(){
return space.display_price == "gross";
@@ -19,7 +18,8 @@ var cobotFb = function(space, plans){
return price;
}
};
-
+ console.log(this, planTemplate);
+
$.each(plans, function(){
// no hidden plans
if(!this.hidden){
@@ -28,7 +28,8 @@ var cobotFb = function(space, plans){
};
this.display_day_pass_price = price_to_display_price(this.day_pass_price);
this.display_price_per_cycle = price_to_display_price(this.price_per_cycle);
- planHtml = Mustache.to_html(planTemplate, this);
+ this.url = space.url + '/membership/new/?plan_id='+ this.id;
+ var planHtml = Mustache.to_html(planTemplate, this);
$plans.append(planHtml);
}
});

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 2d63903

Please sign in to comment.