blob: a4e723897f6ab87d8e88f1152d524212839bee30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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
|