summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 12:14:46 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 12:14:46 +0100
commit186ce80e7b22920ea7d54c579f635eec2d1ee98f (patch)
treef4197dc02a45cab4583dab037d93c7f402b0d81d
parentab63774d954fe1f967a97ffe5a0a66016eca2257 (diff)
Added a voicemail and fax trigger. #127
-rw-r--r--app/assets/javascripts/trigger.js.coffee3
-rw-r--r--app/assets/stylesheets/trigger.css.scss3
-rw-r--r--app/controllers/trigger_controller.rb11
-rw-r--r--app/helpers/trigger_helper.rb2
-rw-r--r--app/views/trigger/fax.html.erb2
-rw-r--r--app/views/trigger/voicemail.html.erb4
-rw-r--r--config/routes.rb5
-rw-r--r--test/functional/trigger_controller_test.rb14
-rw-r--r--test/unit/helpers/trigger_helper_test.rb4
9 files changed, 48 insertions, 0 deletions
diff --git a/app/assets/javascripts/trigger.js.coffee b/app/assets/javascripts/trigger.js.coffee
new file mode 100644
index 0000000..7615679
--- /dev/null
+++ b/app/assets/javascripts/trigger.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/app/assets/stylesheets/trigger.css.scss b/app/assets/stylesheets/trigger.css.scss
new file mode 100644
index 0000000..682b362
--- /dev/null
+++ b/app/assets/stylesheets/trigger.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the trigger controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb
new file mode 100644
index 0000000..e9821f6
--- /dev/null
+++ b/app/controllers/trigger_controller.rb
@@ -0,0 +1,11 @@
+class TriggerController < ApplicationController
+ def voicemail
+ # Something is triggered when ever a local script fetches this action.
+ #
+ end
+
+ def fax
+ # Something is triggered when ever a local script fetches this action.
+ #
+ end
+end
diff --git a/app/helpers/trigger_helper.rb b/app/helpers/trigger_helper.rb
new file mode 100644
index 0000000..0ababb3
--- /dev/null
+++ b/app/helpers/trigger_helper.rb
@@ -0,0 +1,2 @@
+module TriggerHelper
+end
diff --git a/app/views/trigger/fax.html.erb b/app/views/trigger/fax.html.erb
new file mode 100644
index 0000000..822b2cb
--- /dev/null
+++ b/app/views/trigger/fax.html.erb
@@ -0,0 +1,2 @@
+<h1>Trigger#fax</h1>
+<p>Find me in app/views/trigger/fax.html.erb</p>
diff --git a/app/views/trigger/voicemail.html.erb b/app/views/trigger/voicemail.html.erb
new file mode 100644
index 0000000..9bafe17
--- /dev/null
+++ b/app/views/trigger/voicemail.html.erb
@@ -0,0 +1,4 @@
+<h1>Trigger#voicemail</h1>
+<p>Find me in app/views/trigger/voicemail.html.erb</p>
+
+<%= debug(params) %>
diff --git a/config/routes.rb b/config/routes.rb
index b25081a..22a36e5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,10 @@
Gemeinschaft42c::Application.routes.draw do
+ scope :constraints => lambda{|req|%w(127.0.0.1).include? req.remote_addr} do
+ get "trigger/voicemail"
+ get "trigger/fax"
+ end
+
resources :call_routes do
resources :route_elements do
member do
diff --git a/test/functional/trigger_controller_test.rb b/test/functional/trigger_controller_test.rb
new file mode 100644
index 0000000..de64e4f
--- /dev/null
+++ b/test/functional/trigger_controller_test.rb
@@ -0,0 +1,14 @@
+require 'test_helper'
+
+class TriggerControllerTest < ActionController::TestCase
+ test "should get voicemail" do
+ get :voicemail
+ assert_response :success
+ end
+
+ test "should get fax" do
+ get :fax
+ assert_response :success
+ end
+
+end
diff --git a/test/unit/helpers/trigger_helper_test.rb b/test/unit/helpers/trigger_helper_test.rb
new file mode 100644
index 0000000..5f81a88
--- /dev/null
+++ b/test/unit/helpers/trigger_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class TriggerHelperTest < ActionView::TestCase
+end