-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.haml
More file actions
67 lines (40 loc) · 1.46 KB
/
Copy pathexample.haml
File metadata and controls
67 lines (40 loc) · 1.46 KB
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
57
58
59
60
61
62
63
64
65
66
class DealsShowController
@$inject: ['deal']
constructor: (deal) ->
@deal = deal.data
angular.module('bakery.deals').controller('DealsIndexController', DealsIndexController)
%a(if-can='manageDeals' ui-sref='dealsNew') New Deal
%a(if-can='!manageDeals') Cannot Text
%a(ui-sref='dealsNew') New Deal
%a(ui-sref="dealsShow({ dealKey: deal.key})") Show Deal
%div{ ng: { controller: 'DealsController as dealsCtrl', init: 'dealsCtrl.prepareData()' }}
= if can? :manage, Deal
%a{ href: "deals/new" } New Deal
%td.sensitive
{{ dealsCtrl.foo }}
%td
= @publisher.name
= render 'bar_table', ngController: 'dealsCtrl'
:javascript
angular.module("deals").run(function (DataService) {
DataService.set('publisher', #{@publisher.to_json if @publisher});
});
%div(ng-init='dealsCtrl.prepareData()')
%a(ui-sref='dealsNew' if-can='manageDeals') New Deal
%td.sensitive(ng-bind='dealsCtrl.foo')
%td(ng-bind='dealsCtrl.publisher.name')
%ng-include(src="'deals/bar_table.html'" include-replace)
%span(ng-bind='metricsCtrl.foo')
angular.module('bakeryServices').constant 'PERMISSIONS',
manageDeals: 'manageDeals'
createDeals: 'createDeals'
readDeals: 'readDeals'
$httpProvider.interceptors.push ->
{
'request': (config) ->
if config.data? and config.url.match(/^\//)
config.data = humps.decamelizeKeys(config.data)
return config
'response': (response) ->
return humps.camelizeKeys(response)
}