summaryrefslogtreecommitdiff
path: root/app/controllers/phone_number_ranges_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/phone_number_ranges_controller.rb')
-rw-r--r--app/controllers/phone_number_ranges_controller.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/app/controllers/phone_number_ranges_controller.rb b/app/controllers/phone_number_ranges_controller.rb
new file mode 100644
index 0000000..a4e7238
--- /dev/null
+++ b/app/controllers/phone_number_ranges_controller.rb
@@ -0,0 +1,56 @@
+class PhoneNumberRangesController < ApplicationController
+ load_and_authorize_resource :tenant
+ load_and_authorize_resource :phone_number_range, :through => [:tenant]
+
+ before_filter :set_parent
+ before_filter :spread_breadcrumbs
+
+ def index
+ end
+
+ def show
+ end
+
+ def new
+ @phone_number_range = @parent.phone_number_ranges.build
+ end
+
+ def create
+ @phone_number_range = @parent.phone_number_ranges.build(params[:phone_number_range])
+ if @phone_number_range.save
+ redirect_to @phone_number_range, :notice => t('phone_number_ranges.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ end
+
+ def update
+ if @phone_number_range.update_attributes(params[:phone_number_range])
+ redirect_to @phone_number_range, :notice => t('phone_number_ranges.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @phone_number_range.destroy
+ redirect_to phone_number_ranges_url, :notice => t('phone_number_ranges.controller.successfuly_destroyed')
+ end
+
+ private
+
+ def set_parent
+ @parent = @tenant
+ end
+
+ def spread_breadcrumbs
+ add_breadcrumb t("phone_number_ranges.index.page_title"), tenant_phone_number_ranges_path(@tenant)
+ if @phone_number_range && !@phone_number_range.new_record?
+ add_breadcrumb t("phone_number_ranges.ranges.#{@phone_number_range}.label"), tenant_phone_number_range_path(@tenant, @phone_number_range)
+ end
+ end
+
+end