From 113e3c6c6117fbeca7b9bf1f0e6dc26b0db9c407 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 16 Jan 2013 08:33:45 -0500 Subject: call_routes added --- app/controllers/call_routes_controller.rb | 41 +++++++++++++++++++++++++++++ app/helpers/call_routes_helper.rb | 2 ++ app/models/call_route.rb | 3 +++ app/views/call_routes/_form.html.haml | 7 +++++ app/views/call_routes/_form_core.html.haml | 6 +++++ app/views/call_routes/_index_core.html.haml | 17 ++++++++++++ app/views/call_routes/edit.html.haml | 3 +++ app/views/call_routes/index.html.haml | 6 +++++ app/views/call_routes/new.html.haml | 3 +++ app/views/call_routes/show.html.haml | 19 +++++++++++++ 10 files changed, 107 insertions(+) create mode 100644 app/controllers/call_routes_controller.rb create mode 100644 app/helpers/call_routes_helper.rb create mode 100644 app/models/call_route.rb create mode 100644 app/views/call_routes/_form.html.haml create mode 100644 app/views/call_routes/_form_core.html.haml create mode 100644 app/views/call_routes/_index_core.html.haml create mode 100644 app/views/call_routes/edit.html.haml create mode 100644 app/views/call_routes/index.html.haml create mode 100644 app/views/call_routes/new.html.haml create mode 100644 app/views/call_routes/show.html.haml (limited to 'app') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb new file mode 100644 index 0000000..631339b --- /dev/null +++ b/app/controllers/call_routes_controller.rb @@ -0,0 +1,41 @@ +class CallRoutesController < ApplicationController + def index + @call_routes = CallRoute.all + end + + def show + @call_route = CallRoute.find(params[:id]) + end + + def new + @call_route = CallRoute.new + end + + def create + @call_route = CallRoute.new(params[:call_route]) + if @call_route.save + redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') + else + render :new + end + end + + def edit + @call_route = CallRoute.find(params[:id]) + end + + def update + @call_route = CallRoute.find(params[:id]) + if @call_route.update_attributes(params[:call_route]) + redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @call_route = CallRoute.find(params[:id]) + @call_route.destroy + redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') + end +end diff --git a/app/helpers/call_routes_helper.rb b/app/helpers/call_routes_helper.rb new file mode 100644 index 0000000..dfe87dd --- /dev/null +++ b/app/helpers/call_routes_helper.rb @@ -0,0 +1,2 @@ +module CallRoutesHelper +end diff --git a/app/models/call_route.rb b/app/models/call_route.rb new file mode 100644 index 0000000..4cf2445 --- /dev/null +++ b/app/models/call_route.rb @@ -0,0 +1,3 @@ +class CallRoute < ActiveRecord::Base + attr_accessible :table, :name, :endpoint_type, :endpoint_id, :position +end diff --git a/app/views/call_routes/_form.html.haml b/app/views/call_routes/_form.html.haml new file mode 100644 index 0000000..1415852 --- /dev/null +++ b/app/views/call_routes/_form.html.haml @@ -0,0 +1,7 @@ += simple_form_for(@call_route) do |f| + = f.error_notification + + = render "form_core", :f => f + + .actions + = f.button :submit, conditional_t('call_routes.form.submit') \ No newline at end of file diff --git a/app/views/call_routes/_form_core.html.haml b/app/views/call_routes/_form_core.html.haml new file mode 100644 index 0000000..4b97434 --- /dev/null +++ b/app/views/call_routes/_form_core.html.haml @@ -0,0 +1,6 @@ +.inputs + = f.input :table, :label => t('call_routes.form.table.label'), :hint => conditional_hint('call_routes.form.table.hint') + = f.input :name, :label => t('call_routes.form.name.label'), :hint => conditional_hint('call_routes.form.name.hint') + = f.input :endpoint_type, :label => t('call_routes.form.endpoint_type.label'), :hint => conditional_hint('call_routes.form.endpoint_type.hint') + = f.input :endpoint_id, :label => t('call_routes.form.endpoint_id.label'), :hint => conditional_hint('call_routes.form.endpoint_id.hint') + = f.input :position, :label => t('call_routes.form.position.label'), :hint => conditional_hint('call_routes.form.position.hint') diff --git a/app/views/call_routes/_index_core.html.haml b/app/views/call_routes/_index_core.html.haml new file mode 100644 index 0000000..6ea3af7 --- /dev/null +++ b/app/views/call_routes/_index_core.html.haml @@ -0,0 +1,17 @@ +%table + %tr + %th= t('call_routes.index.table') + %th= t('call_routes.index.name') + %th= t('call_routes.index.endpoint_type') + %th= t('call_routes.index.endpoint_id') + %th= t('call_routes.index.position') + + - reset_cycle + - for call_route in call_routes + %tr{:class => cycle('odd', 'even')} + %td= call_route.table + %td= call_route.name + %td= call_route.endpoint_type + %td= call_route.endpoint_id + %td= call_route.position + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route} \ No newline at end of file diff --git a/app/views/call_routes/edit.html.haml b/app/views/call_routes/edit.html.haml new file mode 100644 index 0000000..0ad46c5 --- /dev/null +++ b/app/views/call_routes/edit.html.haml @@ -0,0 +1,3 @@ +- title t("call_routes.edit.page_title") + += render "form" \ No newline at end of file diff --git a/app/views/call_routes/index.html.haml b/app/views/call_routes/index.html.haml new file mode 100644 index 0000000..687a9dc --- /dev/null +++ b/app/views/call_routes/index.html.haml @@ -0,0 +1,6 @@ +- title t("call_routes.index.page_title") + +- if @call_routes && @call_routes.count > 0 + = render "index_core", :call_routes => @call_routes + += render :partial => 'shared/create_link', :locals => {:child_class => CallRoute} \ No newline at end of file diff --git a/app/views/call_routes/new.html.haml b/app/views/call_routes/new.html.haml new file mode 100644 index 0000000..0796d7f --- /dev/null +++ b/app/views/call_routes/new.html.haml @@ -0,0 +1,3 @@ +- title t("call_routes.new.page_title") + += render "form" \ No newline at end of file diff --git a/app/views/call_routes/show.html.haml b/app/views/call_routes/show.html.haml new file mode 100644 index 0000000..31c3cb0 --- /dev/null +++ b/app/views/call_routes/show.html.haml @@ -0,0 +1,19 @@ +- title t("call_routes.show.page_title") + +%p + %strong= t('call_routes.show.table') + ":" + = @call_route.table +%p + %strong= t('call_routes.show.name') + ":" + = @call_route.name +%p + %strong= t('call_routes.show.endpoint_type') + ":" + = @call_route.endpoint_type +%p + %strong= t('call_routes.show.endpoint_id') + ":" + = @call_route.endpoint_id +%p + %strong= t('call_routes.show.position') + ":" + = @call_route.position + += render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @call_route } \ No newline at end of file -- cgit v1.2.3 From 8c83a89c6fbfdb31cae8ea6fcf2fd50c12c076a5 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 16 Jan 2013 08:37:56 -0500 Subject: route_elements added --- app/controllers/route_elements_controller.rb | 41 ++++++++++++++++++++++++++ app/helpers/route_elements_helper.rb | 2 ++ app/models/route_element.rb | 5 ++++ app/views/route_elements/_form.html.haml | 7 +++++ app/views/route_elements/_form_core.html.haml | 9 ++++++ app/views/route_elements/_index_core.html.haml | 23 +++++++++++++++ app/views/route_elements/edit.html.haml | 3 ++ app/views/route_elements/index.html.haml | 6 ++++ app/views/route_elements/new.html.haml | 3 ++ app/views/route_elements/show.html.haml | 28 ++++++++++++++++++ 10 files changed, 127 insertions(+) create mode 100644 app/controllers/route_elements_controller.rb create mode 100644 app/helpers/route_elements_helper.rb create mode 100644 app/models/route_element.rb create mode 100644 app/views/route_elements/_form.html.haml create mode 100644 app/views/route_elements/_form_core.html.haml create mode 100644 app/views/route_elements/_index_core.html.haml create mode 100644 app/views/route_elements/edit.html.haml create mode 100644 app/views/route_elements/index.html.haml create mode 100644 app/views/route_elements/new.html.haml create mode 100644 app/views/route_elements/show.html.haml (limited to 'app') diff --git a/app/controllers/route_elements_controller.rb b/app/controllers/route_elements_controller.rb new file mode 100644 index 0000000..595a20d --- /dev/null +++ b/app/controllers/route_elements_controller.rb @@ -0,0 +1,41 @@ +class RouteElementsController < ApplicationController + def index + @route_elements = RouteElement.all + end + + def show + @route_element = RouteElement.find(params[:id]) + end + + def new + @route_element = RouteElement.new + end + + def create + @route_element = RouteElement.new(params[:route_element]) + if @route_element.save + redirect_to @route_element, :notice => t('route_elements.controller.successfuly_created') + else + render :new + end + end + + def edit + @route_element = RouteElement.find(params[:id]) + end + + def update + @route_element = RouteElement.find(params[:id]) + if @route_element.update_attributes(params[:route_element]) + redirect_to @route_element, :notice => t('route_elements.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @route_element = RouteElement.find(params[:id]) + @route_element.destroy + redirect_to route_elements_url, :notice => t('route_elements.controller.successfuly_destroyed') + end +end diff --git a/app/helpers/route_elements_helper.rb b/app/helpers/route_elements_helper.rb new file mode 100644 index 0000000..4262a50 --- /dev/null +++ b/app/helpers/route_elements_helper.rb @@ -0,0 +1,2 @@ +module RouteElementsHelper +end diff --git a/app/models/route_element.rb b/app/models/route_element.rb new file mode 100644 index 0000000..e845f24 --- /dev/null +++ b/app/models/route_element.rb @@ -0,0 +1,5 @@ +class RouteElement < ActiveRecord::Base + attr_accessible :call_route_id, :var_in, :var_out, :pattern, :replacement, :action, :mandatory, :position + + belongs_to :call_route +end diff --git a/app/views/route_elements/_form.html.haml b/app/views/route_elements/_form.html.haml new file mode 100644 index 0000000..cfa4c6b --- /dev/null +++ b/app/views/route_elements/_form.html.haml @@ -0,0 +1,7 @@ += simple_form_for(@route_element) do |f| + = f.error_notification + + = render "form_core", :f => f + + .actions + = f.button :submit, conditional_t('route_elements.form.submit') \ No newline at end of file diff --git a/app/views/route_elements/_form_core.html.haml b/app/views/route_elements/_form_core.html.haml new file mode 100644 index 0000000..7697cb0 --- /dev/null +++ b/app/views/route_elements/_form_core.html.haml @@ -0,0 +1,9 @@ +.inputs + = f.input :call_route_id, :label => t('route_elements.form.call_route_id.label'), :hint => conditional_hint('route_elements.form.call_route_id.hint') + = f.input :var_in, :label => t('route_elements.form.var_in.label'), :hint => conditional_hint('route_elements.form.var_in.hint') + = f.input :var_out, :label => t('route_elements.form.var_out.label'), :hint => conditional_hint('route_elements.form.var_out.hint') + = f.input :pattern, :label => t('route_elements.form.pattern.label'), :hint => conditional_hint('route_elements.form.pattern.hint') + = f.input :replacement, :label => t('route_elements.form.replacement.label'), :hint => conditional_hint('route_elements.form.replacement.hint') + = f.input :action, :label => t('route_elements.form.action.label'), :hint => conditional_hint('route_elements.form.action.hint') + = f.input :mandatory, :label => t('route_elements.form.mandatory.label'), :hint => conditional_hint('route_elements.form.mandatory.hint') + = f.input :position, :label => t('route_elements.form.position.label'), :hint => conditional_hint('route_elements.form.position.hint') diff --git a/app/views/route_elements/_index_core.html.haml b/app/views/route_elements/_index_core.html.haml new file mode 100644 index 0000000..63665fd --- /dev/null +++ b/app/views/route_elements/_index_core.html.haml @@ -0,0 +1,23 @@ +%table + %tr + %th= t('route_elements.index.call_route_id') + %th= t('route_elements.index.var_in') + %th= t('route_elements.index.var_out') + %th= t('route_elements.index.pattern') + %th= t('route_elements.index.replacement') + %th= t('route_elements.index.action') + %th= t('route_elements.index.mandatory') + %th= t('route_elements.index.position') + + - reset_cycle + - for route_element in route_elements + %tr{:class => cycle('odd', 'even')} + %td= route_element.call_route_id + %td= route_element.var_in + %td= route_element.var_out + %td= route_element.pattern + %td= route_element.replacement + %td= route_element.action + %td= route_element.mandatory + %td= route_element.position + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => route_element} \ No newline at end of file diff --git a/app/views/route_elements/edit.html.haml b/app/views/route_elements/edit.html.haml new file mode 100644 index 0000000..770eb6c --- /dev/null +++ b/app/views/route_elements/edit.html.haml @@ -0,0 +1,3 @@ +- title t("route_elements.edit.page_title") + += render "form" \ No newline at end of file diff --git a/app/views/route_elements/index.html.haml b/app/views/route_elements/index.html.haml new file mode 100644 index 0000000..b05236b --- /dev/null +++ b/app/views/route_elements/index.html.haml @@ -0,0 +1,6 @@ +- title t("route_elements.index.page_title") + +- if @route_elements && @route_elements.count > 0 + = render "index_core", :route_elements => @route_elements + += render :partial => 'shared/create_link', :locals => {:child_class => RouteElement} \ No newline at end of file diff --git a/app/views/route_elements/new.html.haml b/app/views/route_elements/new.html.haml new file mode 100644 index 0000000..903e808 --- /dev/null +++ b/app/views/route_elements/new.html.haml @@ -0,0 +1,3 @@ +- title t("route_elements.new.page_title") + += render "form" \ No newline at end of file diff --git a/app/views/route_elements/show.html.haml b/app/views/route_elements/show.html.haml new file mode 100644 index 0000000..a439353 --- /dev/null +++ b/app/views/route_elements/show.html.haml @@ -0,0 +1,28 @@ +- title t("route_elements.show.page_title") + +%p + %strong= t('route_elements.show.call_route_id') + ":" + = @route_element.call_route_id +%p + %strong= t('route_elements.show.var_in') + ":" + = @route_element.var_in +%p + %strong= t('route_elements.show.var_out') + ":" + = @route_element.var_out +%p + %strong= t('route_elements.show.pattern') + ":" + = @route_element.pattern +%p + %strong= t('route_elements.show.replacement') + ":" + = @route_element.replacement +%p + %strong= t('route_elements.show.action') + ":" + = @route_element.action +%p + %strong= t('route_elements.show.mandatory') + ":" + = @route_element.mandatory +%p + %strong= t('route_elements.show.position') + ":" + = @route_element.position + += render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @route_element } \ No newline at end of file -- cgit v1.2.3 From 0bf4d1350f5d2a07db874977674e5ae0ff0d4256 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 16 Jan 2013 08:38:54 -0500 Subject: route_elements belong to route --- app/models/call_route.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') diff --git a/app/models/call_route.rb b/app/models/call_route.rb index 4cf2445..eba247c 100644 --- a/app/models/call_route.rb +++ b/app/models/call_route.rb @@ -1,3 +1,5 @@ class CallRoute < ActiveRecord::Base attr_accessible :table, :name, :endpoint_type, :endpoint_id, :position + + has_many :route_elements, :dependent => :destroy end -- cgit v1.2.3