caboose-cms 0.8.75 → 0.8.76

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21b91fa667e8f15c2e468aad28553f330944ff2c
4
- data.tar.gz: b577889b8ba1893c832007dd37b31b20cb83defa
3
+ metadata.gz: 97b1c789c00f8996509c420259c60bab77fab081
4
+ data.tar.gz: 05460bf1a36080d2b95675de27181b1aa955823e
5
5
  SHA512:
6
- metadata.gz: 716cdc6c7fa6bac30618f7a26f5323beec3b2a20829075e76e3a734663cd394e1104d7134329039a9d257c61b4da1416bed0f7c8fcf90861e328a6c0980c4a72
7
- data.tar.gz: 46af5b356eb4d70b41b19f81b7881cb6a58fc2329634dbc4e091eb8d389bbe65b854af9c79b4c89e0ee1d287b7e3cec8f50d22dd0fe7723913c47800d77b330e
6
+ metadata.gz: 0b1809f2a0c84e27c53c9c40222eac7058f5ea2cc9ed923f4be23217885507cb50b1536fc9b68afe0705b056ee12ac5faafafe1cb826c46f18b6b3252effc549
7
+ data.tar.gz: c28f108185d95bb20852aa532f4ab1f0c8167acfd86d2d6101cb78310c15f1310369e4ea4aa02c47143d61eed8ccd46c48ab23b37402791855cea522091dd1cc
@@ -1,148 +1,146 @@
1
- #
2
- #module Caboose
3
- # class UserSubscriptionsController < ApplicationController
4
- #
5
- # #===========================================================================
6
- # # Admin actions
7
- # #===========================================================================
8
- #
9
- # # @route GET /admin/users/:user_id/subscriptions
10
- # def admin_index
11
- # return if !user_is_allowed('usersubscriptions', 'view')
12
- # render :layout => 'caboose/admin'
13
- # end
14
- #
15
- # # @route GET /admin/users/:user_id/subscriptions/json
16
- # def admin_json
17
- # return if !user_is_allowed('usersubscriptions', 'view')
18
- #
19
- # pager = PageBarGenerator.new(params, {
20
- # 'subscription_id' => '',
21
- # 'user_id' => params[:user_id],
22
- # 'date_started_gte' => '',
23
- # 'date_started_lte' => '',
24
- # 'date_started_full_gte' => '',
25
- # 'date_started_full_lte' => '',
26
- # 'status' => ''
27
- # },{
28
- # 'model' => 'Caboose::UserSubscription',
29
- # 'sort' => 'date_started',
30
- # 'desc' => false,
31
- # 'base_url' => "/admin/users/#{params[:user_id]}/subscriptions",
32
- # 'use_url_params' => false
33
- # })
34
- # render :json => {
35
- # :pager => pager,
36
- # :models => pager.items
37
- # }
38
- # end
39
- #
40
- # # @route GET /admin/users/:user_id/subscriptions/:id
41
- # def admin_edit
42
- # return if !user_is_allowed('usersubscriptions', 'edit')
43
- # @user_subscription = UserSubscription.find(params[:id])
44
- # render :layout => 'caboose/admin'
45
- # end
46
- #
47
- # # @route GET /admin/users/:user_id/subscriptions/:id/json
48
- # def admin_json_single
49
- # return if !user_is_allowed('usersubscriptions', 'view')
50
- # us = UserSubscription.find(params[:id])
51
- # render :json => us
52
- # end
53
- #
54
- # # @route POST /admin/users/:user_id/subscriptions
55
- # def admin_add
56
- # return unless user_is_allowed('usersubscriptions', 'add')
57
- #
58
- # resp = Caboose::StdClass.new
59
- # s = params[:subscription_id] ? Subscription.where(:id => params[:subscription_id]).first : nil
60
- #
61
- # if subscription_id.nil? || s.nil? || s.site_id != @site.id
62
- # resp.error = "A valid subscription is required."
63
- # else
64
- # us = UserSubscription.create(
65
- # :subscription_id => s.id,
66
- # :user_id => params[:user_id],
67
- # :date_started => Date.today,
68
- # :date_started_full => Date.today,
69
- # :status => UserSubcription::STATUS_ACTIVE
70
- # )
71
- # resp.redirect = "/admin/users/#{params[:user_id]}/subscriptions/#{us.id}"
72
- # resp.success = true
73
- # end
74
- # render :json => resp
75
- # end
76
- #
77
- # # @route PUT /admin/users/:user_id/subscriptions/:id
78
- # def admin_update
79
- # return unless user_is_allowed('usersubscriptions', 'edit')
80
- #
81
- # resp = StdClass.new
82
- # models = params[:id] == 'bulk' ? params[:model_ids].collect{ |model_id| UserSubscription.find(model_id) } : [UserSubscription.find(params[:id])]
83
- #
84
- # params.each do |k, v|
85
- # case k
86
- # when 'subscription_id' then models.each{ |us| us.subscription_id = v }
87
- # when 'user_id' then models.each{ |us| us.user_id = v }
88
- # when 'date_started' then models.each{ |us| us.date_started = v }
89
- # when 'date_started_full' then models.each{ |us| us.date_started_full = v }
90
- # when 'status' then models.each{ |us| us.status = v }
91
- # end
92
- # end
93
- # models.each{ |us| us.save }
94
- # resp.success = true
95
- # render :json => resp
96
- # end
97
- #
98
- # # @route DELETE /admin/users/:user_id/subscriptions/:id
99
- # def admin_delete
100
- # return unless user_is_allowed('usersubscriptions', 'delete')
101
- #
102
- # model_ids = params[:id] == 'bulk' ? params[:model_ids] : [params[:id]]
103
- # model_ids.each do |model_id|
104
- # UserSubscription.where(:id => model_id).destroy_all
105
- # end
106
- #
107
- # render :json => { :sucess => true }
108
- # end
109
- #
110
- # # @route_priority 1
111
- # # @route GET /admin/user-subscriptions/:field-options
112
- # # @route GET /admin/users/:user_id/subscriptions/:field-options
113
- # def admin_options
114
- # if !user_is_allowed('subscriptions', 'edit')
115
- # render :json => false
116
- # return
117
- # end
118
- #
119
- # options = []
120
- ## case params[:field]
121
- ## when 'subscription'
122
- ## options = Subcription.where(:site_id => @site.id).reorder(:name).
123
- ## :status
124
- ##
125
- ## STATUS_ACTIVE = 'active'
126
- ## STATUS_INACTIVE = 'inactive'
127
- ##
128
- ## when 'interval'
129
- ## options = [
130
- ## { 'value' => Subscription::INTERVAL_MONTHLY , 'text' => 'Monthly' },
131
- ## { 'value' => Subscription::INTERVAL_YEARLY , 'text' => 'Yearly' }
132
- ## ]
133
- ## when 'prorate-method'
134
- ## options = [
135
- ## { 'value' => Subscription::PRORATE_METHOD_FLAT , 'text' => 'Flat Amount' },
136
- ## { 'value' => Subscription::PRORATE_METHOD_PERCENTAGE , 'text' => 'Percentage of Interval' },
137
- ## { 'value' => Subscription::PRORATE_METHOD_CUSTOM , 'text' => 'Custom' }
138
- ## ]
139
- ## when 'start-day'
140
- ## options = (1..31).collect{ |i| { 'value' => i, 'text' => i }}
141
- ## when 'start-month'
142
- ## options = (1..12).collect{ |i| { 'value' => i, 'text' => Date.new(2000, i, 1).strftime('%B') }}
143
- ## end
144
- # render :json => options
145
- # end
146
- #
147
- # end
148
- #end
1
+
2
+ module Caboose
3
+ class UserSubscriptionsController < ApplicationController
4
+
5
+ #===========================================================================
6
+ # Admin actions
7
+ #===========================================================================
8
+
9
+ # @route GET /admin/user-subscriptions
10
+ def admin_index
11
+ return if !user_is_allowed('usersubscriptions', 'view')
12
+ render :layout => 'caboose/admin'
13
+ end
14
+
15
+ # @route GET /admin/users/:user_id/subscriptions
16
+ def admin_user_index
17
+ return if !user_is_allowed('usersubscriptions', 'view')
18
+ @edituser = User.find(params[:user_id])
19
+ render :layout => 'caboose/admin'
20
+ end
21
+
22
+ # @route GET /admin/user-subscriptions/json
23
+ # @route GET /admin/users/:user_id/subscriptions/json
24
+ def admin_json
25
+ return if !user_is_allowed('usersubscriptions', 'view')
26
+
27
+ pager = PageBarGenerator.new(params, {
28
+ 'subscription_id' => '',
29
+ 'user_id' => params[:user_id] ? params[:user_id] : '',
30
+ 'date_started_gte' => '',
31
+ 'date_started_lte' => '',
32
+ 'date_started_full_gte' => '',
33
+ 'date_started_full_lte' => '',
34
+ 'status' => ''
35
+ },{
36
+ 'model' => 'Caboose::UserSubscription',
37
+ 'sort' => 'date_started',
38
+ 'desc' => false,
39
+ 'base_url' => params[:user_id] ? "/admin/users/#{params[:user_id]}/subscriptions" : '/admin/user-subscriptions',
40
+ 'use_url_params' => false
41
+ })
42
+ render :json => {
43
+ :pager => pager,
44
+ :models => pager.items.as_json(:include => [:user, :subscription])
45
+ }
46
+ end
47
+
48
+ # @route GET /admin/users/:user_id/subscriptions/:id
49
+ def admin_edit
50
+ return if !user_is_allowed('usersubscriptions', 'edit')
51
+ @user_subscription = UserSubscription.find(params[:id])
52
+ @edituser = User.find(params[:user_id])
53
+ render :layout => 'caboose/admin'
54
+ end
55
+
56
+ # @route GET /admin/users/:user_id/subscriptions/:id/json
57
+ def admin_json_single
58
+ return if !user_is_allowed('usersubscriptions', 'view')
59
+ us = UserSubscription.find(params[:id])
60
+ render :json => us
61
+ end
62
+
63
+ # @route POST /admin/users/:user_id/subscriptions
64
+ def admin_add
65
+ return unless user_is_allowed('usersubscriptions', 'add')
66
+
67
+ resp = Caboose::StdClass.new
68
+ s = params[:subscription_id] ? Subscription.where(:id => params[:subscription_id]).first : nil
69
+
70
+ if subscription_id.nil? || s.nil? || s.site_id != @site.id
71
+ resp.error = "A valid subscription is required."
72
+ else
73
+ us = UserSubscription.create(
74
+ :subscription_id => s.id,
75
+ :user_id => params[:user_id],
76
+ :date_started => Date.today,
77
+ :date_started_full => Date.today,
78
+ :status => UserSubcription::STATUS_ACTIVE
79
+ )
80
+ resp.redirect = "/admin/users/#{params[:user_id]}/subscriptions/#{us.id}"
81
+ resp.success = true
82
+ end
83
+ render :json => resp
84
+ end
85
+
86
+ # @route PUT /admin/users/:user_id/subscriptions/:id
87
+ def admin_update
88
+ return unless user_is_allowed('usersubscriptions', 'edit')
89
+
90
+ resp = StdClass.new
91
+ models = params[:id] == 'bulk' ? params[:model_ids].collect{ |model_id| UserSubscription.find(model_id) } : [UserSubscription.find(params[:id])]
92
+
93
+ params.each do |k, v|
94
+ case k
95
+ when 'subscription_id' then models.each{ |us| us.subscription_id = v }
96
+ when 'user_id' then models.each{ |us| us.user_id = v }
97
+ when 'date_started' then models.each{ |us| us.date_started = v }
98
+ when 'date_started_full' then models.each{ |us| us.date_started_full = v }
99
+ when 'status' then models.each{ |us| us.status = v }
100
+ end
101
+ end
102
+ models.each{ |us| us.save }
103
+ resp.success = true
104
+ render :json => resp
105
+ end
106
+
107
+ # @route DELETE /admin/users/:user_id/subscriptions/:id
108
+ def admin_delete
109
+ return unless user_is_allowed('usersubscriptions', 'delete')
110
+
111
+ model_ids = params[:id] == 'bulk' ? params[:model_ids] : [params[:id]]
112
+ model_ids.each do |model_id|
113
+ UserSubscription.where(:id => model_id).destroy_all
114
+ end
115
+
116
+ render :json => { :sucess => true }
117
+ end
118
+
119
+ # @route_priority 1
120
+ # @route GET /admin/user-subscriptions/:field-options
121
+ # @route GET /admin/users/:user_id/subscriptions/:field-options
122
+ def admin_options
123
+ if !user_is_allowed('subscriptions', 'edit')
124
+ render :json => false
125
+ return
126
+ end
127
+
128
+ options = []
129
+ case params[:field]
130
+ when 'subscription'
131
+ arr = Subcription.where(:site_id => @site.id).reorder(:name).all
132
+ options = arr.collect{ |s| { 'value' => s.id, 'text' => s.name }}
133
+ when 'status'
134
+ options = [
135
+ { 'value' => UserSubscription::STATUS_ACTIVE , 'text' => 'Active' },
136
+ { 'value' => UserSubscription::STATUS_INACTIVE , 'text' => 'Inactive' }
137
+ ]
138
+ when 'user'
139
+ arr = User.where(:site_id => @site.id).reorder('last_name, first_name').all
140
+ options = arr.collect{ |u| { 'value' => u.id, 'text' => "#{u.first_name} #{u.last_name}" }}
141
+ end
142
+ render :json => options
143
+ end
144
+
145
+ end
146
+ end
@@ -7,21 +7,23 @@ class Caboose::CorePlugin < Caboose::CaboosePlugin
7
7
  nav << { 'id' => 'my-account' , 'text' => 'My Account' , 'href' => '/my-account' , 'modal' => true }
8
8
 
9
9
  item = { 'id' => 'core', 'text' => 'Settings', 'children' => [] }
10
- item['children'] << { 'id' => 'blocktypes' , 'text' => 'AB Test Variants' , 'href' => '/admin/ab-variants' , 'modal' => false } if user.is_allowed('abvariants' , 'view')
11
- item['children'] << { 'id' => 'blocktypes' , 'text' => 'Block Types' , 'href' => '/admin/block-types' , 'modal' => false } if user.is_allowed('blocktypes' , 'view') if site.is_master == true
12
- item['children'] << { 'id' => 'fonts' , 'text' => 'Fonts' , 'href' => '/admin/fonts' , 'modal' => false } if user.is_allowed('fonts' , 'view') if site.use_fonts == true
13
- item['children'] << { 'id' => 'redirects' , 'text' => 'Permanent Redirects' , 'href' => '/admin/redirects' , 'modal' => false } if user.is_allowed('redirects' , 'view')
14
- item['children'] << { 'id' => 'permissions' , 'text' => 'Permissions' , 'href' => '/admin/permissions' , 'modal' => false } if user.is_allowed('permissions' , 'view')
15
- item['children'] << { 'id' => 'pagecustomfields' , 'text' => 'Page Custom Fields' , 'href' => '/admin/page-custom-fields' , 'modal' => false } if user.is_allowed('pagecustomfields' , 'view')
16
- item['children'] << { 'id' => 'post_categories' , 'text' => 'Post Categories' , 'href' => '/admin/post-categories' , 'modal' => false } if user.is_allowed('post_categories' , 'view')
17
- item['children'] << { 'id' => 'postcustomfields' , 'text' => 'Post Custom Fields' , 'href' => '/admin/post-custom-fields' , 'modal' => false } if user.is_allowed('postcustomfields' , 'view')
18
- item['children'] << { 'id' => 'roles' , 'text' => 'Roles' , 'href' => '/admin/roles' , 'modal' => false } if user.is_allowed('roles' , 'view')
19
- item['children'] << { 'id' => 'sites' , 'text' => 'Sites' , 'href' => '/admin/sites' , 'modal' => false } if user.is_allowed('sites' , 'view') if site.is_master == true
20
- item['children'] << { 'id' => 'smtp' , 'text' => 'SMTP (Mail)' , 'href' => '/admin/smtp' , 'modal' => false } if user.is_allowed('smtp' , 'view')
21
- item['children'] << { 'id' => 'social' , 'text' => 'Social Media' , 'href' => '/admin/social' , 'modal' => false } if user.is_allowed('social' , 'view')
22
- item['children'] << { 'id' => 'store' , 'text' => 'Store' , 'href' => '/admin/store' , 'modal' => false } if user.is_allowed('store' , 'view') if site.use_store == true
23
- item['children'] << { 'id' => 'users' , 'text' => 'Users' , 'href' => '/admin/users' , 'modal' => false } if user.is_allowed('users' , 'view')
24
- item['children'] << { 'id' => 'variables' , 'text' => 'Variables' , 'href' => '/admin/settings' , 'modal' => false } if user.is_allowed('settings' , 'view')
10
+ item['children'] << { 'id' => 'blocktypes' , 'text' => 'AB Test Variants' , 'href' => '/admin/ab-variants' , 'modal' => false } if user.is_allowed('abvariants' , 'view')
11
+ item['children'] << { 'id' => 'blocktypes' , 'text' => 'Block Types' , 'href' => '/admin/block-types' , 'modal' => false } if user.is_allowed('blocktypes' , 'view') if site.is_master == true
12
+ item['children'] << { 'id' => 'fonts' , 'text' => 'Fonts' , 'href' => '/admin/fonts' , 'modal' => false } if user.is_allowed('fonts' , 'view') if site.use_fonts == true
13
+ item['children'] << { 'id' => 'redirects' , 'text' => 'Permanent Redirects' , 'href' => '/admin/redirects' , 'modal' => false } if user.is_allowed('redirects' , 'view')
14
+ item['children'] << { 'id' => 'permissions' , 'text' => 'Permissions' , 'href' => '/admin/permissions' , 'modal' => false } if user.is_allowed('permissions' , 'view')
15
+ item['children'] << { 'id' => 'pagecustomfields' , 'text' => 'Page Custom Fields' , 'href' => '/admin/page-custom-fields' , 'modal' => false } if user.is_allowed('pagecustomfields' , 'view')
16
+ item['children'] << { 'id' => 'post_categories' , 'text' => 'Post Categories' , 'href' => '/admin/post-categories' , 'modal' => false } if user.is_allowed('post_categories' , 'view')
17
+ item['children'] << { 'id' => 'postcustomfields' , 'text' => 'Post Custom Fields' , 'href' => '/admin/post-custom-fields' , 'modal' => false } if user.is_allowed('postcustomfields' , 'view')
18
+ item['children'] << { 'id' => 'roles' , 'text' => 'Roles' , 'href' => '/admin/roles' , 'modal' => false } if user.is_allowed('roles' , 'view')
19
+ item['children'] << { 'id' => 'sites' , 'text' => 'Sites' , 'href' => '/admin/sites' , 'modal' => false } if user.is_allowed('sites' , 'view') if site.is_master == true
20
+ item['children'] << { 'id' => 'smtp' , 'text' => 'SMTP (Mail)' , 'href' => '/admin/smtp' , 'modal' => false } if user.is_allowed('smtp' , 'view')
21
+ item['children'] << { 'id' => 'social' , 'text' => 'Social Media' , 'href' => '/admin/social' , 'modal' => false } if user.is_allowed('social' , 'view')
22
+ item['children'] << { 'id' => 'store' , 'text' => 'Store' , 'href' => '/admin/store' , 'modal' => false } if user.is_allowed('store' , 'view') if site.use_store == true
23
+ item['children'] << { 'id' => 'users' , 'text' => 'Users' , 'href' => '/admin/users' , 'modal' => false } if user.is_allowed('users' , 'view')
24
+ item['children'] << { 'id' => 'usersubscriptions' , 'text' => 'User Subscriptions' , 'href' => '/admin/user-subscriptions' , 'modal' => false } if user.is_allowed('usersubscriptions' , 'view')
25
+ item['children'] << { 'id' => 'subscriptions' , 'text' => 'Subscriptions' , 'href' => '/admin/subscriptions' , 'modal' => false } if user.is_allowed('subscriptions' , 'view')
26
+ item['children'] << { 'id' => 'variables' , 'text' => 'Variables' , 'href' => '/admin/settings' , 'modal' => false } if user.is_allowed('settings' , 'view')
25
27
  nav << item if item['children'].count > 0
26
28
 
27
29
  item = { 'id' => 'content', 'text' => 'Content', 'children' => [] }
@@ -0,0 +1,38 @@
1
+
2
+ <%= render :partial => 'caboose/users/admin_header' %>
3
+
4
+ <p><div id='usersubscription_<%= @user_subscription.id %>_subscription_id' ></div></p>
5
+ <p><div id='usersubscription_<%= @user_subscription.id %>_user_id' ></div></p>
6
+ <p><div id='usersubscription_<%= @user_subscription.id %>_date_started' ></div></p>
7
+ <p><div id='usersubscription_<%= @user_subscription.id %>_date_started_full' ></div></p>
8
+ <p><div id='usersubscription_<%= @user_subscription.id %>_status' ></div></p>
9
+
10
+ <%= render :partial => 'caboose/users/admin_footer' %>
11
+
12
+ <% content_for :caboose_css do %>
13
+ <style type='text/css'>
14
+ #content input[type=checkbox] { position: relative; }
15
+ #roles { height: 200px; overflow-y: scroll; margin-bottom: 20px; }
16
+ </style>
17
+ <% end %>
18
+ <% content_for :caboose_js do %>
19
+ <%= javascript_include_tag "caboose/model/all" %>
20
+ <script type="text/javascript">
21
+
22
+ $(document).ready(function() {
23
+ new ModelBinder({
24
+ name: 'UserSubcription',
25
+ id: <%= @edituser.id %>,
26
+ update_url: '/admin/users/<%= @edituser.id %>/subscriptions/<%= @user_subscription.id %>',
27
+ authenticity_token: '<%= form_authenticity_token %>',
28
+ attributes: [
29
+ { name: 'subscription_id' , nice_name: 'Subcription' , type: 'select' , value: <%= raw Caboose.json(@edituser.subscription_id ) %>, width: 400, options_url '/admin/users/<%= @edituser.id %>/subscriptions/subscription-options' },
30
+ { name: 'date_started' , nice_name: 'Date Started' , type: 'date' , value: <%= raw Caboose.json(@edituser.date_started ) %>, width: 400 },
31
+ { name: 'date_started_full' , nice_name: 'Date Started Full' , type: 'date' , value: <%= raw Caboose.json(@edituser.date_started_full ) %>, width: 400 },
32
+ { name: 'status' , nice_name: 'Status' , type: 'select' , value: <%= raw Caboose.json(@edituser.status ) %>, width: 400, options_url '/admin/users/<%= @edituser.id %>/subscriptions/status-options' }
33
+ ]
34
+ });
35
+ });
36
+
37
+ </script>
38
+ <% end %>
@@ -0,0 +1,38 @@
1
+
2
+ <h1>User Subcriptions</h1>
3
+
4
+ <div id='usersubscriptions'></div>
5
+
6
+ <% content_for :caboose_js do %>
7
+ <%= javascript_include_tag 'caboose/model/all' %>
8
+ <script type='text/javascript'>
9
+
10
+ $(document).ready(function() {
11
+ var that = this;
12
+ var table = new IndexTable({
13
+ form_authenticity_token: '<%= form_authenticity_token %>',
14
+ container: 'usersubscriptions',
15
+ base_url: '/admin/user-subscriptions',
16
+ allow_bulk_edit: true,
17
+ allow_bulk_delete: true,
18
+ allow_duplicate: false,
19
+ allow_advanced_edit: true,
20
+ fields: [
21
+ { show: true, bulk_edit: true, name: 'subscription_id' , nice_name: 'Subscription' , sort: 'subscription_id' , type: 'select' , value: function(us) { return us.subscription_id }, text: function(us) { return us.subscription ? us.subscription.name : us.subscription_id; }, width: 75, align: 'left', options_url: '/admin/user-subscriptions/subscription-options' },
22
+ { show: true, bulk_edit: true, name: 'user_id' , nice_name: 'User' , sort: 'user_id' , type: 'select' , value: function(us) { return us.user_id }, text: function(us) { return us.user ? us.user.first_name + ' ' + us.user.last_name : us.user_id; }, width: 75, align: 'left', options_url: '/admin/user-subscriptions/user-options' },
23
+ { show: true, bulk_edit: true, name: 'date_started' , nice_name: 'Date Started' , sort: 'date_started' , type: 'date' , value: function(us) { return us.date_started }, width: 75, align: 'left' },
24
+ { show: true, bulk_edit: true, name: 'date_started_full' , nice_name: 'Date Started Full' , sort: 'date_started_full' , type: 'date' , value: function(us) { return us.date_started_full }, width: 75, align: 'left' },
25
+ { show: true, bulk_edit: true, name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'select' , value: function(us) { return us.status }, width: 75, align: 'left', options_url: '/admin/user-subscriptions/status-options' }
26
+ ],
27
+ new_model_text: 'New User Subscription',
28
+ no_models_text: "This user doesn't have any subscriptions right now.",
29
+ new_model_fields: [
30
+ { name: 'subscription_id', nice_name: 'Subscription', type: 'select', width: 400, options_url: '/admin/user-subscriptions/subscription-options' }
31
+ ],
32
+ bulk_import_fields: ['subscription_id', 'user_id', 'date_started', 'date_started_full', 'status'],
33
+ bulk_import_url: '/admin/user-subscriptions/bulk'
34
+ });
35
+ });
36
+
37
+ </script>
38
+ <% end %>
@@ -0,0 +1,39 @@
1
+
2
+ <%= render :partial => 'caboose/users/admin_header' %>
3
+
4
+ <div id='usersubscriptions'></div>
5
+
6
+ <%= render :partial => 'caboose/users/admin_footer' %>
7
+
8
+ <% content_for :caboose_js do %>
9
+ <%= javascript_include_tag 'caboose/model/all' %>
10
+ <script type='text/javascript'>
11
+
12
+ $(document).ready(function() {
13
+ var that = this;
14
+ var table = new IndexTable({
15
+ form_authenticity_token: '<%= form_authenticity_token %>',
16
+ container: 'usersubscriptions',
17
+ base_url: '/admin/users/<%= @edituser.id %>/subscriptions',
18
+ allow_bulk_edit: true,
19
+ allow_bulk_delete: true,
20
+ allow_duplicate: false,
21
+ allow_advanced_edit: true,
22
+ fields: [
23
+ { show: true, bulk_edit: true, name: 'subscription_id' , nice_name: 'Subscription' , sort: 'subscription_id' , type: 'select' , value: function(us) { return us.subscription_id }, text: function(us) { return us.subscription ? us.subscription.name : us.subscription_id; }, width: 75, align: 'left', options_url: '/admin/users<%= @edituser.id %>/subscriptions/subscription-options' },
24
+ { show: true, bulk_edit: true, name: 'date_started' , nice_name: 'Date Started' , sort: 'date_started' , type: 'date' , value: function(us) { return us.date_started }, width: 75, align: 'left' },
25
+ { show: true, bulk_edit: true, name: 'date_started_full' , nice_name: 'Date Started Full' , sort: 'date_started_full' , type: 'date' , value: function(us) { return us.date_started_full }, width: 75, align: 'left' },
26
+ { show: true, bulk_edit: true, name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'select' , value: function(us) { return us.status }, width: 75, align: 'left', options_url: '/admin/users<%= @edituser.id %>/subscriptions/status-options' }
27
+ ],
28
+ new_model_text: 'New User Subscription',
29
+ no_models_text: "This user doesn't have any subscriptions right now.",
30
+ new_model_fields: [
31
+ { name: 'subscription_id', nice_name: 'Subscription', type: 'select', width: 400, options_url: '/admin/users<%= @edituser.id %>/subscriptions/subscription-options' }
32
+ ],
33
+ bulk_import_fields: ['subscription_id', 'date_started', 'date_started_full', 'status'],
34
+ bulk_import_url: '/admin/users/<%= @edituser.id %>/subscriptions/bulk'
35
+ });
36
+ });
37
+
38
+ </script>
39
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.8.75'
2
+ VERSION = '0.8.76'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.75
4
+ version: 0.8.76
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -1208,6 +1208,9 @@ files:
1208
1208
  - app/views/caboose/store/admin_edit_tax.html.erb
1209
1209
  - app/views/caboose/subscriptions/admin_edit.html.erb
1210
1210
  - app/views/caboose/subscriptions/admin_index.html.erb
1211
+ - app/views/caboose/user_subscriptions/admin_edit.html.erb
1212
+ - app/views/caboose/user_subscriptions/admin_index.html.erb
1213
+ - app/views/caboose/user_subscriptions/admin_user_index.html.erb
1211
1214
  - app/views/caboose/users/_admin_footer.html.erb
1212
1215
  - app/views/caboose/users/_admin_header.html.erb
1213
1216
  - app/views/caboose/users/admin_delete_form.html.erb