push_type_admin 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/push_type/assets.js.coffee +0 -3
- data/app/assets/stylesheets/push_type/admin.scss +29 -5
- data/app/controllers/push_type/admin_controller.rb +1 -0
- data/app/controllers/push_type/assets_controller.rb +25 -3
- data/app/controllers/push_type/nodes_controller.rb +34 -6
- data/app/helpers/push_type/assets_helper.rb +8 -0
- data/app/helpers/push_type/nodes_helper.rb +10 -0
- data/app/views/layouts/push_type/admin.html.erb +4 -11
- data/app/views/push_type/admin/info.html.haml +1 -1
- data/app/views/push_type/assets/_form.html.haml +3 -9
- data/app/views/push_type/assets/_form_submit.html.haml +13 -0
- data/app/views/push_type/assets/_meta_table.html.haml +15 -0
- data/app/views/push_type/assets/edit.html.haml +3 -0
- data/app/views/push_type/assets/index.html.haml +30 -30
- data/app/views/push_type/assets/trash.html.haml +35 -0
- data/app/views/push_type/nodes/_form_fields.html.haml +3 -29
- data/app/views/push_type/nodes/_form_submit.html.haml +24 -0
- data/app/views/push_type/nodes/_meta_table.html.haml +33 -8
- data/app/views/push_type/nodes/edit.html.haml +6 -2
- data/app/views/push_type/nodes/index.html.haml +50 -48
- data/app/views/push_type/nodes/trash.html.haml +48 -0
- data/app/views/push_type/users/_form.html.haml +3 -1
- data/config/routes.rb +16 -2
- data/lib/push_type/admin/engine.rb +32 -0
- data/test/controllers/push_type/assets_controller_test.rb +30 -0
- data/test/controllers/push_type/nodes_controller_test.rb +45 -4
- data/test/dummy/app/models/page.rb +1 -1
- data/test/dummy/app/views/nodes/page.html.erb +3 -1
- data/test/dummy/config/initializers/push_type.rb +1 -1
- data/test/dummy/config/secrets.yml +2 -2
- data/test/dummy/db/migrate/{20150209204345_create_push_type_users.push_type.rb → 20150222152455_create_push_type_users.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150209204346_create_push_type_nodes.push_type.rb → 20150222152456_create_push_type_nodes.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150209204347_create_push_type_node_hierarchies.push_type.rb → 20150222152457_create_push_type_node_hierarchies.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150209204348_create_push_type_assets.push_type.rb → 20150222152458_create_push_type_assets.push_type.rb} +0 -0
- data/test/dummy/db/schema.rb +1 -1
- data/test/dummy/log/test.log +3552 -2380
- data/test/dummy/tmp/cache/assets/test/sass/2df752541ff0a319141a1cb83ca971d2ffd2d050/admin.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/0e01ae9de0f3914c8317853aedd9ace4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/30f88df6b769522639aee569e18ab005 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/3508023b6222e6b0876c773e38ec700d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5f85da4ac11a64f005e2656b99be44ac +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8d531fdb806de0724337e0b80e253914 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9c34afd1737e54e4eb06cc87ddf17b78 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a93ec74f5cd7f26f8c663d4c481fe689 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a9b8decaa2942e8913458c9f35da2693 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c206fbd33f49ab785c6ddf4bcffd3b93 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/df90022afc0d52f16bc498be20a5967d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e540a9dc1aa001f8c4cba7a6b00f69d2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/edd24c59de6c00e4e68dbbdf2775984a +0 -0
- metadata +25 -17
- data/app/assets/images/push_type/pushtype-logo.png +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8da458b8df4bfbd9fb0eed86c36442d4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a010781c05d478892856f75c751d6ab4 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e22728f8712a2a71b27522c4519c2974537ac90b
|
4
|
+
data.tar.gz: 4f9e1d5c5287432aadbc2930721e917ca07ee706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1bc3aeeb6d92be4ab25d0857954c7db2b9f47f01b5bb12b8b70e9ba5653bed1bd504cb7a6c5b6f62ab5dea8103ee3195787bd8c3fd9bdd1859bfde87d5f738c
|
7
|
+
data.tar.gz: b3ee2f5c7481296dc8e23bf51bc1faa2ea9db3b86c585eb57d27430a41fa7cc7f21e9cc6136a298386ac03ab70b89b5e07e1b710462c8ea03e85f68430e8b061
|
@@ -26,9 +26,6 @@
|
|
26
26
|
$scope.saveButtonText = ->
|
27
27
|
if $scope.asset['new_record?'] then 'Upload file' else 'Update media'
|
28
28
|
|
29
|
-
$scope.uploadedDate = ->
|
30
|
-
moment($scope.asset.created_at).format('Do MMM YYYY, h:mma')
|
31
|
-
|
32
29
|
$scope.afterUpload = (asset) ->
|
33
30
|
$scope.asset = asset
|
34
31
|
|
@@ -101,10 +101,16 @@ table {
|
|
101
101
|
width: rem-calc(40);
|
102
102
|
line-height: rem-calc(40);
|
103
103
|
text-align: center;
|
104
|
-
|
104
|
+
|
105
105
|
a {
|
106
106
|
@extend %block-link-bg;
|
107
107
|
}
|
108
|
+
&.left {
|
109
|
+
border-right: 1px solid $crumb-border-color;
|
110
|
+
}
|
111
|
+
&.right {
|
112
|
+
border-left: 1px solid $crumb-border-color;
|
113
|
+
}
|
108
114
|
}
|
109
115
|
.title {
|
110
116
|
display: inline;
|
@@ -180,14 +186,25 @@ table {
|
|
180
186
|
line-height: rem-calc(40);
|
181
187
|
text-align: center;
|
182
188
|
border-left: 1px solid $crumb-border-color;
|
183
|
-
a {
|
184
|
-
|
189
|
+
a, span {
|
190
|
+
display: block;
|
185
191
|
width: 100%;
|
186
192
|
height: rem-calc(40);
|
193
|
+
color: $gainsboro;
|
187
194
|
&:first-child {
|
188
195
|
border-bottom: 1px solid $crumb-border-color;
|
189
196
|
}
|
190
197
|
}
|
198
|
+
a {
|
199
|
+
@extend %block-link-bg;
|
200
|
+
color: $primary-color;
|
201
|
+
&.alert {
|
202
|
+
color: $alert-color;
|
203
|
+
}
|
204
|
+
&.success {
|
205
|
+
color: $success-color;
|
206
|
+
}
|
207
|
+
}
|
191
208
|
}
|
192
209
|
.handle {
|
193
210
|
position: absolute;
|
@@ -318,10 +335,17 @@ table {
|
|
318
335
|
margin: 0;
|
319
336
|
}
|
320
337
|
}
|
321
|
-
.
|
338
|
+
.text-button {
|
322
339
|
text-align: center;
|
323
340
|
margin-top: rem-calc(20);
|
341
|
+
color: $aluminum;
|
324
342
|
a {
|
343
|
+
color: $primary-color;
|
344
|
+
}
|
345
|
+
&.success a {
|
346
|
+
color: $success-color;
|
347
|
+
}
|
348
|
+
&.alert a {
|
325
349
|
color: $alert-color;
|
326
350
|
}
|
327
351
|
}
|
@@ -356,7 +380,7 @@ table {
|
|
356
380
|
display: table-cell;
|
357
381
|
}
|
358
382
|
.key {
|
359
|
-
width:
|
383
|
+
width: 25%;
|
360
384
|
padding-right: rem-calc(10);
|
361
385
|
}
|
362
386
|
.value {
|
@@ -4,12 +4,16 @@ module PushType
|
|
4
4
|
class AssetsController < AdminController
|
5
5
|
|
6
6
|
before_filter :build_asset, only: [:new, :create, :upload]
|
7
|
-
before_filter :load_asset, only: [:edit, :update, :destroy]
|
7
|
+
before_filter :load_asset, only: [:edit, :update, :destroy, :restore]
|
8
8
|
|
9
9
|
def index
|
10
10
|
@assets = PushType::Asset.not_trash.page(params[:page]).per(20)
|
11
11
|
end
|
12
12
|
|
13
|
+
def trash
|
14
|
+
@assets = PushType::Asset.trashed.page(params[:page]).per(20)
|
15
|
+
end
|
16
|
+
|
13
17
|
def new
|
14
18
|
end
|
15
19
|
|
@@ -47,8 +51,26 @@ module PushType
|
|
47
51
|
end
|
48
52
|
|
49
53
|
def destroy
|
50
|
-
@asset.
|
51
|
-
|
54
|
+
if @asset.trashed?
|
55
|
+
@asset.destroy
|
56
|
+
flash[:notice] = 'Media permanently deleted.'
|
57
|
+
redirect_to push_type.trash_assets_path
|
58
|
+
else
|
59
|
+
@asset.trash!
|
60
|
+
flash[:notice] = 'Media trashed.'
|
61
|
+
redirect_to push_type.assets_path
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def restore
|
66
|
+
@asset.restore!
|
67
|
+
flash[:notice] = 'Media successfully restored.'
|
68
|
+
redirect_to push_type.assets_path
|
69
|
+
end
|
70
|
+
|
71
|
+
def empty
|
72
|
+
PushType::Asset.trashed.destroy_all
|
73
|
+
flash[:notice] = 'Trash successfully emptied.'
|
52
74
|
redirect_to push_type.assets_path
|
53
75
|
end
|
54
76
|
|
@@ -4,12 +4,16 @@ module PushType
|
|
4
4
|
class NodesController < AdminController
|
5
5
|
|
6
6
|
before_filter :build_node, only: [:new, :create]
|
7
|
-
before_filter :load_node, only: [:edit, :update, :destroy, :position]
|
7
|
+
before_filter :load_node, only: [:edit, :update, :destroy, :restore, :position]
|
8
8
|
|
9
9
|
def index
|
10
10
|
@nodes = node_scope.not_trash.page(params[:page]).per(30)
|
11
11
|
end
|
12
12
|
|
13
|
+
def trash
|
14
|
+
@nodes = PushType::Node.all.trashed.page(params[:page]).per(30).reorder(deleted_at: :desc)
|
15
|
+
end
|
16
|
+
|
13
17
|
def new
|
14
18
|
end
|
15
19
|
|
@@ -35,9 +39,15 @@ module PushType
|
|
35
39
|
end
|
36
40
|
|
37
41
|
def destroy
|
38
|
-
@node.
|
39
|
-
|
40
|
-
|
42
|
+
if @node.trashed?
|
43
|
+
@node.destroy
|
44
|
+
flash[:notice] = "#{ @node.type } permanently deleted."
|
45
|
+
redirect_to redirect_path
|
46
|
+
else
|
47
|
+
@node.trash!
|
48
|
+
flash[:notice] = "#{ @node.type } trashed."
|
49
|
+
redirect_to redirect_path(true)
|
50
|
+
end
|
41
51
|
end
|
42
52
|
|
43
53
|
def position
|
@@ -48,6 +58,18 @@ module PushType
|
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
61
|
+
def restore
|
62
|
+
@node.restore!
|
63
|
+
flash[:notice] = "#{ @node.type } successfully restored."
|
64
|
+
redirect_to redirect_path
|
65
|
+
end
|
66
|
+
|
67
|
+
def empty
|
68
|
+
PushType::Node.trashed.destroy_all
|
69
|
+
flash[:notice] = 'Trash successfully emptied.'
|
70
|
+
redirect_to push_type.nodes_path
|
71
|
+
end
|
72
|
+
|
51
73
|
private
|
52
74
|
|
53
75
|
def node_scope
|
@@ -73,8 +95,14 @@ module PushType
|
|
73
95
|
params.fetch(@node.type.underscore.to_sym, {}).permit(*fields)
|
74
96
|
end
|
75
97
|
|
76
|
-
def redirect_path
|
77
|
-
@node.
|
98
|
+
def redirect_path(skip_trash = false)
|
99
|
+
if @node.trashed? && !skip_trash
|
100
|
+
push_type.trash_nodes_path
|
101
|
+
elsif @node.root?
|
102
|
+
push_type.nodes_path
|
103
|
+
else
|
104
|
+
push_type.node_nodes_path(@node.parent_id)
|
105
|
+
end
|
78
106
|
end
|
79
107
|
|
80
108
|
def initial_breadcrumb
|
@@ -7,6 +7,7 @@
|
|
7
7
|
<%= javascript_include_tag 'vendor/modernizr' %>
|
8
8
|
<%= javascript_include_tag 'push_type/admin', 'push_type/admin_assets' %>
|
9
9
|
<%= stylesheet_link_tag 'push_type/admin', 'push_type/admin_assets', '//fonts.googleapis.com/css?family=Lato:300,300italic,400,700', media: 'all' %>
|
10
|
+
<%= favicon_link_tag 'push_type/pushtype-favicon.png' %>
|
10
11
|
<%= csrf_meta_tags %>
|
11
12
|
</head>
|
12
13
|
<body>
|
@@ -14,21 +15,13 @@
|
|
14
15
|
<header class="header" role="banner">
|
15
16
|
<div class="row">
|
16
17
|
<div class="small-4 medium-3 large-2 columns">
|
17
|
-
<%= link_to image_tag('push_type/pushtype-logo.
|
18
|
+
<%= link_to image_tag('push_type/pushtype-logo.svg', size: '140x26', alt: 'PushType'), push_type.root_path %>
|
18
19
|
</div>
|
19
20
|
<nav class="small-4 medium-6 large-8 columns">
|
20
|
-
|
21
|
-
<%= content_tag :li, link_to('Content', push_type.nodes_path), class: 'active' %>
|
22
|
-
<%= content_tag :li, link_to('Media', push_type.assets_path) %>
|
23
|
-
<%= content_tag :li, link_to('Users', push_type.users_path) %>
|
24
|
-
</ul>
|
21
|
+
<%= render_menu(:main) %>
|
25
22
|
</nav>
|
26
23
|
<nav class="small-4 medium-3 large-2 columns">
|
27
|
-
|
28
|
-
<%= content_tag :li, link_to(ficon(:info), push_type.info_path, data: { :'reveal-id' => 'reveal-ajax', :'reveal-ajax' => true }) %>
|
29
|
-
<%= content_tag :li, link_to(ficon(:widget), push_type.edit_profile_path) rescue nil %>
|
30
|
-
<%= content_tag :li, link_to(ficon(:power), push_type.destroy_user_session_path, method: 'delete') rescue nil %>
|
31
|
-
</ul>
|
24
|
+
<%= render_menu(:utility) %>
|
32
25
|
</nav>
|
33
26
|
</div>
|
34
27
|
</header>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
%p.text-center= image_tag 'push_type/pushtype-logo.
|
1
|
+
%p.text-center= image_tag 'push_type/pushtype-logo.svg', size: '140x26', alt: 'PushType'
|
2
2
|
|
3
3
|
%p PushType is an open source content management system for Ruby on Rails, developed and maintained by #{ link_to 'Push Code Ltd', 'http://www.pushcode.com' }.
|
4
4
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
.large-8.columns
|
5
5
|
.container
|
6
6
|
.head
|
7
|
-
.left.btn= link_to ficon(:previous),
|
7
|
+
.left.btn= link_to ficon(:previous), asset_back_link(@asset)
|
8
8
|
.title= yield :title
|
9
9
|
.body.padded
|
10
10
|
.row.asset-upload
|
@@ -30,9 +30,6 @@
|
|
30
30
|
%tr
|
31
31
|
%th Content type
|
32
32
|
%td {{ asset.mime_type }}
|
33
|
-
%tr
|
34
|
-
%th Uploaded
|
35
|
-
%td {{ uploadedDate() }}
|
36
33
|
.row.string
|
37
34
|
.columns
|
38
35
|
= f.label :description
|
@@ -41,10 +38,7 @@
|
|
41
38
|
.large-4.columns
|
42
39
|
.side-panel{ :'side-panel' => true }
|
43
40
|
.padded
|
44
|
-
|
41
|
+
= render 'meta_table'
|
45
42
|
.submit.text-center
|
46
|
-
|
47
|
-
= ficon :check, '{{ saveButtonText() }}'
|
48
|
-
- unless @asset.new_record?
|
49
|
-
.delete-link= link_to 'Delete media', push_type.asset_path(@asset), method: 'delete', data: { confirm: { body: 'Deleted media will be moved to the trash. You can restore trashed media later.' } }
|
43
|
+
= render 'form_submit'
|
50
44
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
- unless @asset.trashed?
|
2
|
+
%button.button.radius{ ng: { class: 'saveButtonClass()' } }
|
3
|
+
= ficon :check, '{{ saveButtonText() }}'
|
4
|
+
- unless @asset.new_record?
|
5
|
+
.text-button.alert
|
6
|
+
= link_to 'Delete media', push_type.asset_path(@asset), method: 'delete', data: { confirm: { body: 'Deleted media will be moved to the trash. You can restore trashed media later.' } }
|
7
|
+
|
8
|
+
- else
|
9
|
+
%button.button.radius.secondary= ficon :check, 'Save as trash'
|
10
|
+
.text-button.success
|
11
|
+
= link_to 'Restore media', push_type.restore_asset_path(@asset), method: 'put'
|
12
|
+
.text-button.alert
|
13
|
+
= link_to 'Permanently delete media', push_type.asset_path(@asset), method: 'delete', data: { confirm: true }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
.meta-table
|
2
|
+
- unless @asset.new_record?
|
3
|
+
.meta-row
|
4
|
+
.key= ficon :calendar, 'Uploaded'
|
5
|
+
.value= l @asset.created_at, format: :short
|
6
|
+
|
7
|
+
- if @asset.uploader
|
8
|
+
.meta-row
|
9
|
+
.key= ficon :torso, 'Uploader'
|
10
|
+
.value= @asset.uploader.name
|
11
|
+
|
12
|
+
- if @asset.trashed?
|
13
|
+
.meta-row
|
14
|
+
.key= ficon :calendar, 'Deleted'
|
15
|
+
.value= l @asset.deleted_at, format: :short
|
@@ -1,34 +1,34 @@
|
|
1
1
|
- title 'Media'
|
2
2
|
|
3
|
-
|
4
|
-
.columns
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
%div{ ng: { controller: 'AssetListCtrl', init: "assets=#{ assets_array(@assets).to_json }; assetUrl='#{ push_type.edit_asset_path('~id') }'" } }
|
4
|
+
.large-8.columns
|
5
|
+
- if @assets.empty?
|
6
|
+
.empty-default{ ng: { hide: 'assetCount() > 0' } }
|
7
|
+
%h2 No uploads
|
8
|
+
%p Upload images, documents, videos. Get started by uploading your first file.
|
9
|
+
= link_to ficon(:plus, 'New upload'), push_type.new_asset_path, class: 'button radius success'
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
.preview
|
19
|
-
%img{ alt: '{{ asset.file_name }}', ng: { src: '{{ asset.preview_thumb_url }}' } }
|
20
|
-
.title {{ asset.description_or_file_name }}
|
11
|
+
%section
|
12
|
+
%ul.asset-list.small-block-grid-2.medium-block-grid-4
|
13
|
+
%li{ ng: { repeat: 'asset in assets' } }
|
14
|
+
%article.asset-list-item
|
15
|
+
%a{ ng: { href: '{{ editUrl(asset) }}' } }
|
16
|
+
.preview
|
17
|
+
%img{ alt: '{{ asset.file_name }}', ng: { src: '{{ asset.preview_thumb_url }}' } }
|
18
|
+
.title {{ asset.description_or_file_name }}
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
20
|
+
.large-4.columns
|
21
|
+
.side-panel{ :'side-panel' => true }
|
22
|
+
.padded
|
23
|
+
.pagination-centered
|
24
|
+
.pagination-stats {{ assetCount() }} items - Page #{ @assets.current_page } of #{ @assets.total_pages }
|
25
|
+
= paginate @assets
|
26
|
+
.cta.text-center
|
27
|
+
= link_to ficon(:plus, 'New upload'), push_type.new_asset_path, class: 'button radius success'
|
28
|
+
- if @assets.current_page == 1
|
29
|
+
.asset-upload
|
30
|
+
.dropzone{ asset: { upload: push_type.upload_assets_path, maxfiles: 10 } }
|
31
|
+
.prompt Drag files to quickly upload them…
|
32
|
+
.icon= ficon(:upload_cloud)
|
33
|
+
.text-button
|
34
|
+
= link_to ficon(:trash, 'Trash bin'), push_type.trash_assets_path
|
@@ -0,0 +1,35 @@
|
|
1
|
+
- title 'Trash'
|
2
|
+
|
3
|
+
- breadcrumbs.add 'Trash', push_type.trash_assets_path
|
4
|
+
|
5
|
+
- if @assets.empty?
|
6
|
+
.columns
|
7
|
+
.empty-default
|
8
|
+
%h2 No trash
|
9
|
+
= link_to ficon(:arrow_left, 'Back to media'), push_type.assets_path, class: 'button radius secondary'
|
10
|
+
|
11
|
+
- else
|
12
|
+
%div
|
13
|
+
.large-8.columns
|
14
|
+
%section
|
15
|
+
%ul.asset-list.small-block-grid-2.medium-block-grid-4
|
16
|
+
- for asset in @assets
|
17
|
+
%li
|
18
|
+
%article.asset-list-item
|
19
|
+
= link_to push_type.edit_asset_path(asset) do
|
20
|
+
.preview
|
21
|
+
= image_tag asset_preview_thumb_url(asset), alt: asset.file_name
|
22
|
+
.title= asset.description_or_file_name
|
23
|
+
|
24
|
+
.large-4.columns
|
25
|
+
.side-panel{ :'side-panel' => true }
|
26
|
+
.padded
|
27
|
+
.pagination-centered
|
28
|
+
.pagination-stats
|
29
|
+
= pluralize @assets.total_count, 'item'
|
30
|
+
- unless @assets.total_count == 0
|
31
|
+
\- Page #{ @assets.current_page } of #{ @assets.total_pages }
|
32
|
+
= paginate @assets
|
33
|
+
.cta.text-center
|
34
|
+
= link_to ficon(:trash, 'Empty trash'), push_type.trash_assets_path, method: 'delete', class: 'button radius alert', data: { confirm: true }
|
35
|
+
|