Skip to content

Commit

Permalink
random updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaiwarner committed Apr 19, 2011
1 parent 6d09f44 commit 6565e1d
Show file tree
Hide file tree
Showing 9 changed files with 976 additions and 68 deletions.
11 changes: 10 additions & 1 deletion app/controllers/poms_controller.rb
Expand Up @@ -15,6 +15,7 @@ def index
# GET /poms/1.xml
def show
@pom = Pom.find(params[:id])
@groups = current_user.groups

respond_to do |format|
format.html # show.html.erb
Expand All @@ -26,6 +27,9 @@ def show
# GET /poms/new.xml
def new
@pom = Pom.new

@groups = current_user.groups


respond_to do |format|
format.html # new.html.erb
Expand All @@ -36,14 +40,19 @@ def new
# GET /poms/1/edit
def edit
@pom = Pom.find(params[:id])
@groups = current_user.groups
end

# POST /poms
# POST /poms.xml
def create
if params[:pom]['datetime'] == 'Now'
params[:pom]['datetime'] = Time.now
end

@pom = Pom.new(params[:pom])
@pom.user_id = current_user.id

respond_to do |format|
if @pom.save
format.html { redirect_to(@pom, :notice => 'pom was successfully created.') }
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.haml
Expand Up @@ -10,7 +10,7 @@

%script{ :type => "text/javascript", :src => "https://www.google.com/jsapi?key=ABQIAAAALFcVECtS_cckPZPP6gEvtBQNqA7PXSQWBnZcv0WRsLc5vt2EwhRNL4XDqi3F3gVWu6gud-eJy35NIA" }
:javascript
google.load("jquery", "1.5.0");
google.load("jquery", "1.5.2");
google.load("jqueryui", "1.8.9");
google.load("webfont", "1.0.18");
google.setOnLoadCallback(function() {
Expand All @@ -19,7 +19,7 @@
families: [ 'Philosopher' ]
}});
});
= javascript_include_tag 'jquery.simple-color.min', 'fullcalendar/fullcalendar.min', 'application'
= javascript_include_tag 'jquery-ui-timepicker-addon', 'jquery.simple-color.min', 'fullcalendar/fullcalendar.min', 'application'


= csrf_meta_tag
Expand Down
12 changes: 6 additions & 6 deletions app/views/poms/_form.html.erb
Expand Up @@ -12,22 +12,22 @@
<% end %>

<div class="field">
<%= f.label :datetime %><br />
<%= f.datetime_select :datetime %>
<%= f.label :datetime, "When" %><br />
<%= f.text_field :datetime, :class => 'datetimepicker', :value => @pom.datetime || "Now" %>
</div>
<div class="field">
<%= f.label :project_id %><br />
<%= select :pom, :project_id, current_user.projects.all.collect {|p| [ p.name, p.id ] }, {:include_blank => true} %>
<%= f.label :project_id, 'Project' %><br />
<%= grouped_collection_select :pom, :project_id, @groups, :projects, :name, :id, :name, {:include_blank => true} %>
</div>
<div class="field">
<%= f.label :description %><br />
<%= f.label :description, 'Notes' %><br />
<%= f.text_area :description %>
</div>
<div class="field">
<%= f.label :value %><br />
<%= f.text_field :value %>
</div>
<div class="actions">
<%= f.submit %>
<%= f.submit 'Start Pomodoro' %>
</div>
<% end %>
4 changes: 1 addition & 3 deletions app/views/poms/new.html.erb
@@ -1,5 +1,3 @@
<h1>New pom</h1>
<h1>Start A Pomodoro</h1>

<%= render 'form' %>
<%= link_to 'Back', poms_path %>
55 changes: 4 additions & 51 deletions app/views/poms/show.html.erb
@@ -1,62 +1,15 @@
<p id="notice"><%= notice %></p>



<% if @pom.seconds_remaining > 0 %>

<script>
Aumodoro.timer.seconds_elapsed = <%= @pom.seconds_elapsed %>;
</script>

<div class='timer'></div>

<% end %>




<hr/>



<p>
<b>Start time:</b>
<%= @pom.datetime %>
</p>

<p>
<b>Success:</b>
<%= @pom.success %>
</p>

<p>
<b>User:</b>
<%= @pom.user_id %>
</p>

<p>
<b>Project:</b>
<%= @pom.project.name if @pom.project %>
</p>

<p>
<b>Description:</b>
<%= @pom.description %>
</p>

<p>
<b>Value:</b>
<%= @pom.value %>
</p>




<div class='timer_display'>

</div>


<% end %>

<br/>

<%= link_to 'Edit', edit_pom_path(@pom) %> |
<%= link_to 'Back', poms_path %>
<%= render 'form' %>
16 changes: 11 additions & 5 deletions public/javascripts/application.js
Expand Up @@ -6,6 +6,7 @@ var Aumodoro = {
pom_length_in_minutes: 25,
display_element: '.timer',
interval: undefined,
to_string: "",
minutes: 0,
seconds: 0,

Expand Down Expand Up @@ -46,7 +47,14 @@ var Aumodoro = {
if (this.seconds < 10) {
this.seconds = "0"+this.seconds;
}
$(this.display_element).html(this.minutes+":"+this.seconds);
this.to_string = this.minutes+":"+this.seconds;
$(this.display_element).html(this.to_string);

this.update_title();
},

update_title: function() {
document.title = this.to_string;
},

init: function(options) {
Expand All @@ -66,10 +74,8 @@ $(document).ready(function(){
// Notifications
$('.notice, .alert').hide().fadeIn(3000);

// Datepicker
if ($('.datepicker').length > 0) {
$('.datepicker').timepicker();
}
// Datepicker
$('.datetimepicker').datetimepicker();

// Color picker
$('.color_picker').simpleColor({
Expand Down

0 comments on commit 6565e1d

Please sign in to comment.