Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactored dojo/index by creating some partials

  • Loading branch information...
commit ff12bd35c7621a2d8ec53118d09eb9d517994645 1 parent 72e765b
@JonJagger authored
View
23 app/views/dojo/_bottom_buttons.html.erb
@@ -0,0 +1,23 @@
+
+<script language="javascript" type="text/javascript"><!--
+
+$j(document).ready(function() {
+
+ $j.each(
+ ['about','basics','dashboard','faqs','feedback','links','source','tips','why'],
+ function(i,name) {
+ $j('#' + name).click(function() {
+ $cd['dialog_' + name]();
+ });
+ });
+
+});
+
+//--></script>
+
+<% [ 'about', 'basics', 'dashboard', 'faqs', 'feedback', 'links', 'source', 'tips', 'why' ].each do |name| -%>
+ <input type="button"
+ class="button"
+ id="<%=name-%>"
+ value="<%=name-%>"/>
+<% end -%>
View
45 app/views/dojo/_donate.html.erb
@@ -1,12 +1,35 @@
-
-<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
- <input type="hidden" name="cmd" value="_s-xclick">
- <input type="hidden" name="hosted_button_id" value="7HAUYJCMFCS8C">
- <input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif"
- border="0" name="submit" alt="PayPal - The safe, easier way to pay online.">
- <img alt=""
- border="0"
- src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif"
- width="1" height="1">
-</form>
+<table>
+ <tr>
+ <td>
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
+ <input type="hidden" name="cmd" value="_s-xclick">
+ <input type="hidden" name="hosted_button_id" value="7HAUYJCMFCS8C">
+ <input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif"
+ border="0" name="submit" alt="PayPal - The safe, easier way to pay online.">
+ <img alt=""
+ border="0"
+ src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif"
+ width="1" height="1">
+
+ </form> </td>
+ <td>
+ <% size = 80 -%>
+ <%= link_to image_tag("/images/raspberry-pi.gif",
+ :border => 0,
+ :size => "60x75"
+ ), "http://www.raspberrypi.org/" -%>
+ </td>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <span class="donate_text">
+ If you find cyber-dojo useful please consider making a donation.<br/>
+ All money is used solely to buy
+ <a href="http://www.raspberrypi.org/">raspberry pi</a> computers for schools.<br/>
+ Thank you.
+ </span>
+ </td>
+ </tr>
+</table>
View
19 app/views/dojo/_resume_coding_button.html.erb
@@ -0,0 +1,19 @@
+
+<script language="javascript" type="text/javascript"><!--
+
+$j(document).ready(function() {
+
+ $j('#resume_coding').click(function() {
+ run('exists_json', function(id, data) {
+ resumeCoding(id, data);
+ });
+ });
+
+});
+
+//--></script>
+
+<input type="button"
+ class="large button"
+ id="resume_coding"
+ value="resume-coding" />
View
22 app/views/dojo/_start_coding_button.html.erb
@@ -0,0 +1,22 @@
+
+<script language="javascript" type="text/javascript"><!--
+
+$j(document).ready(function() {
+
+ $j('#start_coding').click(function() {
+ var id = $j('#kata_id_input').attr('value');
+ if ($j.trim(id) === '') {
+ $cd.alert("cyber-dojo", "<h3>Please enter an id</h3>", "");
+ } else {
+ $cd.postTo('/dojo/start', { id: id }, '_blank');
+ }
+ });
+
+});
+
+//--></script>
+
+<input type="button"
+ class="large button"
+ id="start_coding"
+ value="start-coding" />
View
19 app/views/dojo/_view_dashboard_button.html.erb
@@ -0,0 +1,19 @@
+
+<script language="javascript" type="text/javascript"><!--
+
+$j(document).ready(function() {
+
+ $j('#view_dashboard').click(function() {
+ run('exists_json', function(id, data) {
+ showDashboard(id, data);
+ });
+ });
+
+});
+
+//--></script>
+
+<input type="button"
+ class="large button"
+ id="view_dashboard"
+ value="view-dashboard" />
View
77 app/views/dojo/index.html.erb
@@ -7,41 +7,12 @@ $j(document).ready(function() {
$cd.postTo('/dojo/create');
});
- $j('#start_coding').click(function() {
- var id = $j('#kata_id_input').attr('value');
- if ($j.trim(id) === '') {
- $cd.alert("cyber-dojo", "<h3>Please enter an id</h3>", "");
- } else {
- $cd.postTo('/dojo/start', { id: id }, '_blank');
- }
- });
-
- $j('#resume_coding').click(function() {
- run('exists_json', function(id, data) {
- resumeCoding(id, data);
- });
- });
-
$cd.registerCloseResumeDialog = function(resumer) {
$cd.closeResumeDialog = function() {
resumer.dialog('close');
};
};
- $j('#show_dashboard').click(function() {
- run('exists_json', function(id, data) {
- showDashboard(id, data);
- });
- });
-
- $j.each(
- ['about','basics','dashboard','faqs','feedback','links','source','tips','why'],
- function(i,name) {
- $j('#' + name).click(function() {
- $cd['dialog_' + name]();
- });
- });
-
$j('body').css('background', 'Cornsilk');
var ua = $j.browser;
@@ -166,10 +137,7 @@ function cantFind(id) {
</span>
</td>
<td>
- <input type="button"
- class="large button"
- id="start_coding"
- value="start-coding" />
+ <%= render :partial => 'start_coding_button' -%>
</td>
</tr>
<tr>
@@ -181,10 +149,7 @@ function cantFind(id) {
</span>
</td>
<td>
- <input type="button"
- class="large button"
- id="resume_coding"
- value="resume-coding" />
+ <%= render :partial => 'resume_coding_button' -%>
</td>
</tr>
<tr>
@@ -196,10 +161,7 @@ function cantFind(id) {
</span>
</td>
<td>
- <input type="button"
- class="large button"
- id="show_dashboard"
- value="view-dashboard" />
+ <%= render :partial => 'view_dashboard_button' -%>
</td>
</tr>
</table>
@@ -208,42 +170,13 @@ function cantFind(id) {
<tr>
<td class="panel">
- <% [ 'about', 'basics', 'dashboard', 'faqs', 'feedback', 'links', 'source', 'tips', 'why' ].each do |name| -%>
- <input type="button"
- class="button"
- id="<%=name-%>"
- value="<%=name-%>"/>
- <% end -%>
+ <%= render :partial => 'bottom_buttons' -%>
</td>
</tr>
<tr>
<td>
- <table>
- <tr>
- <td>
- <%= render :partial => 'donate' -%>
- </td>
- <td>
- <% size = 80 -%>
- <%= link_to image_tag("/images/raspberry-pi.gif",
- :border => 0,
- :size => "60x75"
- ), "http://www.raspberrypi.org/" -%>
- </td>
- <td>
- &nbsp;
- </td>
- <td>
- <span class="donate_text">
- If you find cyber-dojo useful please consider making a donation.<br/>
- All money is used solely to buy
- <a href="http://www.raspberrypi.org/">raspberry pi</a> computers for schools.<br/>
- Thank you.
- </span>
- </td>
- </tr>
- </table>
+ <%= render :partial => 'donate' -%>
</td>
</tr>
View
2  issues.txt
@@ -22,6 +22,8 @@ The Diff view doesn't work properly in IE8.
MINOR
-----
$cd.alert() in cyberdojo-helpers.js can be refactored to use $cd.popupDialog().
+change paypal purpose wording from cyber-dojo and add note that Pies are �30
+wrong ID alert popup font is too large
need help button on diff page
need help button on dashboard page
make the id button text the actual id, and add start date and age to the popped up info
Please sign in to comment.
Something went wrong with that request. Please try again.