Sha256: 93a7e70b343f309562bc6ed96f39e725919d767d19f45fc8ccc3bcba98122c38

Contents?: true

Size: 1.92 KB

Versions: 68

Compression:

Stored size: 1.92 KB

Contents

<p class="lead">Things you found fun.</p>

<table class="table responsive table-condensed" id="fun_activities">
<tbody>
    <tr>
      <th>Time Period</th>
      <th>Activity</th>
      <th>Pleasure of Activity</th>
      <th>Sense of Accomplishment</th>
    </tr>
  <%= render partial: "think_feel_do_engine/activities/activity", collection: activities %>
</tbody>
</table>

<p>Why does this matter?</p>

<p>Because doing things that are fun can make you happier.</p>

<p>Have fun! Really!</p>

<script type="text/javascript">
$(document).on('page:change page:load', function() 
{

var prevWeek = null;

_.each($("#fun_activities tr"),
	function(rows,index)
	{
		var row = $(rows).children();
		if(index == 0) return;
		var activity = getStartEndTime($(row[0]).text());
		activity = populateWithRow(activity,row);
		if(prevWeek === null){ prevWeek = activity;}
		else if(isContinuousDuplicate(prevWeek,activity))
		{
			$(rows).remove();
			prevWeek.end = activity.end;
			$(prevWeek.ref[0]).text(prevWeek.start + " - " + prevWeek.end);
		}
		else
		{
			prevWeek = activity;
		}
	});

});

isContinuousDuplicate = function(prevWeek,currentWeek)
{
	return prevWeek.end == currentWeek.start
			 && prevWeek.name == currentWeek.name
			 && prevWeek.pleasure == currentWeek.pleasure
			 && prevWeek.accomplishment == currentWeek.accomplishment;
}

getStartEndTime = function(str)
{
	var split = str.indexOf("-");
	if(split < 0) return ["",""];
	var s = str.substr(0,split-1);
	var e = str.substr(split+2);
	return {"start":s,"end":e,"name":"","pleasure":"","accomplishment":"", "ref": null};
}

populateWithRow = function(obj,row)
{
	obj.name = $(row[1]).text();
	obj.pleasure = $(row[2]).text();
	obj.accomplishment = $(row[3]).text();
	obj.ref = row;
	return obj;
}

$(function(){
		  $('table.responsive').ngResponsiveTables({
		  	smallPaddingCharNo: 13,
	    	mediumPaddingCharNo: 18,
	    	largePaddingCharNo: 30,
	    	shiftedIndex:0
		  });
		});

</script>

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
think_feel_do_engine-3.19.2 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.19.1 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.19.0 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.18.0 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.17.2 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.17.1 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.17.0 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.16.3 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.16.2 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.16.1 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.15.7 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.16.0 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.15.6 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.15.5 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.15.4 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.15.3 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.15.2 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.15.1 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.15.0 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb
think_feel_do_engine-3.14.9 app/views/think_feel_do_engine/activities/pleasurable_index.html.erb