appointments 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ class AppointmentsController < ApplicationController
2
+
3
+ def match_dates
4
+ date_from_ajax = params[:matched_date]
5
+ reduce = Appointment.where(:date => date_from_ajax)
6
+ hour_on_date = reduce.collect {|x| x.hour}
7
+ @new_dates = hour_on_date
8
+ render :layout => false
9
+ end
10
+
11
+ def new
12
+ @appointments = Appointment.create
13
+ respond_to do |format|
14
+ format.html
15
+ format.js
16
+ end
17
+ end
18
+
19
+
20
+ def create
21
+ @appointment = Appointment.create(params[:appointments])
22
+ if @appointment.save
23
+ redirect_to root_path
24
+ else
25
+ err = ''
26
+ @appointment.errors.full_messages.each do |m|
27
+ err << m
28
+ end
29
+
30
+ redirect_to root_path, :flash => { :alert => "#{err}, please try again" }
31
+ end
32
+ end
33
+ end
@@ -45,12 +45,12 @@
45
45
  </tr>
46
46
 
47
47
  <tr class = "cal_table3">
48
- <td class = 'cal_previous'><form method='link' action="<% root_path %>"><button class='btn'>previous</button></form></td>
48
+ <td class = 'cal_previous'><form method='link' action="<% root_path %>"><button class='btn'>&#60;&#60; previous page</button></form></td>
49
49
  </tr>
50
50
  </table>
51
51
  </div>
52
52
 
53
- <div id='cal_previous2'><button class='btn' onclick='prevPage();'>&#60;&#60; Previous Page</button></div><br />
53
+ <div id='cal_previous2'><button class='btn' onclick='prevPage();'>&#60;&#60; previous page</button></div><br />
54
54
 
55
55
  <div id="appointment_form">
56
56
  <%=form_tag(@appointments) %>
@@ -10,7 +10,7 @@ module Appointments
10
10
  end
11
11
 
12
12
  def add_view
13
- template "appointment.html.erb", "app/views/appointments/appointment.html.erb"
13
+ template "new.html.erb", "app/views/appointments/new.html.erb"
14
14
  end
15
15
 
16
16
  def add_stub_view
@@ -31,10 +31,8 @@ module Appointments
31
31
  end
32
32
 
33
33
  def add_captivate_routes
34
- match_dates = "match 'match_dates' => 'appointments#match_dates'"
35
- appointment_route = "match 'appointments' => 'appointments#appointments'"
34
+ match_dates = "match 'appointments/match_dates' => 'appointments#match_dates'"
36
35
  route match_dates
37
- route appointment_route
38
36
  end
39
37
  end
40
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appointments
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-18 00:00:00.000000000Z
12
+ date: 2012-02-19 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Schedule appointments with Rails 3 and the jQuery-UI
15
15
  email: mleveton@prepcloud.com
@@ -25,7 +25,7 @@ files:
25
25
  - lib/generators/templates/jquery.ui.widget.min.js
26
26
  - lib/generators/templates/jquery.ui.datepicker.min.js
27
27
  - lib/generators/templates/jquery-ui-1.8.17.custom.css
28
- - lib/generators/templates/appointment.html.erb
28
+ - lib/generators/templates/new.html.erb
29
29
  - lib/generators/templates/match_dates.html.erb
30
30
  - lib/generators/templates/initializer.rb
31
31
  - lib/generators/templates/initializer.rb~