kms 0.6.0 → 0.7.0
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/kms/application/controllers/{assets_controller.coffee → assets_controller.coffee.erb} +16 -3
- data/app/assets/javascripts/kms/application/controllers/{pages_controller.coffee → pages_controller.coffee.erb} +1 -1
- data/app/assets/javascripts/kms/application/controllers/{snippets_controller.coffee → snippets_controller.coffee.erb} +4 -3
- data/app/assets/javascripts/kms/application/controllers/{templates_controller.coffee → templates_controller.coffee.erb} +1 -1
- data/app/assets/javascripts/kms/application/controllers/users_controller.coffee +3 -3
- data/app/assets/javascripts/templates/assets/index.html.slim +99 -28
- data/app/assets/javascripts/templates/help.html.slim +1 -1
- data/app/assets/javascripts/templates/help/variables.html.slim +1 -1
- data/app/assets/javascripts/templates/snippets/edit.html.slim +3 -1
- data/app/assets/stylesheets/kms/custom.css.scss +18 -0
- data/app/controllers/kms/assets_controller.rb +1 -1
- data/app/uploaders/kms/asset_uploader.rb +0 -1
- data/config/locales/en.yml +8 -1
- data/config/locales/ru.yml +7 -0
- data/db/migrate/20161118151849_set_default_value_for_kms_settings_values_field.rb +5 -0
- data/lib/kms/version.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b29d6d6a21d5d406c54173448dde0d22f79dd7f
|
4
|
+
data.tar.gz: 0849ee6b4745180394d85e21755545530efaa494
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14de95ca65c0c43d2cf79173e30a1fa54149c40d01d560a752c9b613a557c7cacaf150fc9715af9e84247b92fc44471940cf5b4885e83663fff88fc4bbc321f8
|
7
|
+
data.tar.gz: 9669c4f34b6546c3764c43cdf8c07659afb7c904ecdfc162d7cf547dd2e7b52944bca099453490efea59f61549e696c5723f1976f18927eb77e3402805056198
|
@@ -12,12 +12,13 @@ AssetsController = ($scope, $state, $cookieStore, $cookies, Restangular, $stateP
|
|
12
12
|
|
13
13
|
$scope.store = Restangular.all('assets')
|
14
14
|
$scope.store.getList().then (assets)->
|
15
|
-
$scope.assets = _.groupBy
|
15
|
+
$scope.assets = _.groupBy assets, (asset)->
|
16
|
+
$scope.getAssetGroup(asset)
|
16
17
|
|
17
18
|
if $stateParams.id
|
18
19
|
$scope.store.get($stateParams.id).then (asset)->
|
19
20
|
$scope.asset = asset
|
20
|
-
if /javascript/.test
|
21
|
+
if /css|javascript/.test $scope.getAssetGroup(asset)
|
21
22
|
$scope.asset.performing_plain_text = true
|
22
23
|
else
|
23
24
|
{}
|
@@ -36,7 +37,7 @@ AssetsController = ($scope, $state, $cookieStore, $cookies, Restangular, $stateP
|
|
36
37
|
Alertify.error(ErrorsService.prepareErrorsString(response.data.errors))
|
37
38
|
|
38
39
|
$scope.destroy = (asset)->
|
39
|
-
if(confirm('
|
40
|
+
if(confirm('<%= I18n.t(:are_you_sure) %>'))
|
40
41
|
asset.remove().then ->
|
41
42
|
for content_type, values of $scope.assets
|
42
43
|
$scope.assets[content_type] = _.without($scope.assets[content_type], asset)
|
@@ -52,6 +53,18 @@ AssetsController = ($scope, $state, $cookieStore, $cookies, Restangular, $stateP
|
|
52
53
|
else
|
53
54
|
"htmlmixed"
|
54
55
|
|
56
|
+
$scope.getAssetGroup = (asset)->
|
57
|
+
if /jpg|jpeg|bmp|gif|png/.test(asset.filename)
|
58
|
+
"images"
|
59
|
+
else if /eot|woff|ttf|woff2/.test(asset.filename)
|
60
|
+
"fonts"
|
61
|
+
else if /css/.test(asset.filename)
|
62
|
+
"css"
|
63
|
+
else if /js/.test(asset.filename)
|
64
|
+
"javascript"
|
65
|
+
else
|
66
|
+
"other"
|
67
|
+
|
55
68
|
$scope.isImageType = (file)->
|
56
69
|
['jpg', 'jpeg', 'gif','png'].indexOf(file.getType()) >= 0
|
57
70
|
|
@@ -78,7 +78,7 @@ PagesController = ($scope, $state, $cookieStore, Restangular, $stateParams, Aler
|
|
78
78
|
Alertify.error(ErrorsService.prepareErrorsString(response.data.errors))
|
79
79
|
|
80
80
|
$scope.destroy = (page)->
|
81
|
-
if(confirm('
|
81
|
+
if(confirm('<%= I18n.t(:are_you_sure) %>'))
|
82
82
|
Restangular.restangularizeElement(null, page, 'pages').remove().then ->
|
83
83
|
$scope.store.getList().then (pages)->
|
84
84
|
$scope.pages = pages
|
@@ -31,14 +31,15 @@ SnippetsController = ($scope, $state, Restangular, $stateParams, Alertify, Error
|
|
31
31
|
, (response)->
|
32
32
|
Alertify.error(ErrorsService.prepareErrorsString(response.data.errors))
|
33
33
|
|
34
|
-
$scope.update = ->
|
34
|
+
$scope.update = (event)->
|
35
35
|
$scope.snippet.put().then ->
|
36
|
-
|
36
|
+
if event.target.attributes['data-redirect']
|
37
|
+
$state.go('snippets')
|
37
38
|
,(response)->
|
38
39
|
Alertify.error(ErrorsService.prepareErrorsString(response.data.errors))
|
39
40
|
|
40
41
|
$scope.destroy = (snippet)->
|
41
|
-
if(confirm('
|
42
|
+
if(confirm('<%= I18n.t(:are_you_sure) %>'))
|
42
43
|
snippet.remove().then ->
|
43
44
|
$scope.snippets = _.without($scope.snippets, snippet)
|
44
45
|
|
@@ -39,7 +39,7 @@ TemplatesController = ($scope, $state, $cookieStore, Restangular, $stateParams,
|
|
39
39
|
Alertify.error(ErrorsService.prepareErrorsString(response.data.errors))
|
40
40
|
|
41
41
|
$scope.destroy = (template)->
|
42
|
-
if(confirm('
|
42
|
+
if(confirm('<%= I18n.t(:are_you_sure) %>'))
|
43
43
|
template.remove().then ->
|
44
44
|
$scope.templates = _.without($scope.templates, template)
|
45
45
|
|
@@ -22,10 +22,10 @@ UsersController = ($scope, $state, $cookieStore, Restangular, $stateParams) ->
|
|
22
22
|
#console.log('bug')
|
23
23
|
|
24
24
|
$scope.destroy = (user)->
|
25
|
-
|
26
|
-
|
25
|
+
if(confirm('<%= I18n.t(:are_you_sure) %>'))
|
26
|
+
user.remove().then ->
|
27
|
+
$scope.users = _.without($scope.users, user)
|
27
28
|
|
28
29
|
|
29
30
|
angular.module('KMS')
|
30
31
|
.controller('UsersController', ['$scope', '$state', '$cookieStore', 'Restangular', '$stateParams', UsersController])
|
31
|
-
|
@@ -1,31 +1,102 @@
|
|
1
1
|
.row
|
2
2
|
.col-lg-12
|
3
|
-
.widget
|
3
|
+
.widget.assets-block
|
4
4
|
.widget-header
|
5
|
-
i.fa.fa-image
|
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
|
-
|
5
|
+
/i.fa.fa-image
|
6
|
+
/= Kms::Asset.model_name.human(count: 1.1)
|
7
|
+
tabset
|
8
|
+
tab
|
9
|
+
tab-heading
|
10
|
+
i.fa.fa-image
|
11
|
+
= I18n.t(:images)
|
12
|
+
.table-responsive
|
13
|
+
table.table
|
14
|
+
tbody
|
15
|
+
tr ng-repeat="asset in assets.images"
|
16
|
+
td style="width: 10%"
|
17
|
+
img.img-responsive ng-src="{{ asset.file.url }}"
|
18
|
+
td style="width: 40%"
|
19
|
+
| {{ asset.filename }}
|
20
|
+
td style="width: 40%"
|
21
|
+
| {{asset.file.url}}
|
22
|
+
td
|
23
|
+
.btn-group.pull-right
|
24
|
+
a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
|
25
|
+
i.fa.fa-pencil
|
26
|
+
a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
|
27
|
+
i.fa.fa-times
|
28
|
+
tab
|
29
|
+
tab-heading
|
30
|
+
i.fa.fa-code
|
31
|
+
= I18n.t(:stylesheets)
|
32
|
+
.table-responsive
|
33
|
+
table.table
|
34
|
+
tbody
|
35
|
+
tr ng-repeat="asset in assets.css"
|
36
|
+
td style="width: 40%"
|
37
|
+
| {{ asset.filename }}
|
38
|
+
td style="width: 40%"
|
39
|
+
| {{asset.file.url}}
|
40
|
+
td
|
41
|
+
.btn-group.pull-right
|
42
|
+
a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
|
43
|
+
i.fa.fa-pencil
|
44
|
+
a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
|
45
|
+
i.fa.fa-times
|
46
|
+
tab
|
47
|
+
tab-heading
|
48
|
+
i.fa.fa-code
|
49
|
+
= I18n.t(:javascripts)
|
50
|
+
.table-responsive
|
51
|
+
table.table
|
52
|
+
tbody
|
53
|
+
tr ng-repeat="asset in assets.javascript"
|
54
|
+
td style="width: 40%"
|
55
|
+
| {{ asset.filename }}
|
56
|
+
td style="width: 40%"
|
57
|
+
| {{asset.file.url}}
|
58
|
+
td
|
59
|
+
.btn-group.pull-right
|
60
|
+
a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
|
61
|
+
i.fa.fa-pencil
|
62
|
+
a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
|
63
|
+
i.fa.fa-times
|
64
|
+
tab
|
65
|
+
tab-heading
|
66
|
+
i.fa.fa-font
|
67
|
+
= I18n.t(:fonts)
|
68
|
+
.table-responsive
|
69
|
+
table.table
|
70
|
+
tbody
|
71
|
+
tr ng-repeat="asset in assets.fonts"
|
72
|
+
td style="width: 40%"
|
73
|
+
| {{ asset.filename }}
|
74
|
+
td style="width: 40%"
|
75
|
+
| {{asset.file.url}}
|
76
|
+
td
|
77
|
+
.btn-group.pull-right
|
78
|
+
a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
|
79
|
+
i.fa.fa-pencil
|
80
|
+
a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
|
81
|
+
i.fa.fa-times
|
82
|
+
tab
|
83
|
+
tab-heading
|
84
|
+
i.fa.fa-file-text
|
85
|
+
= I18n.t(:other_assets)
|
86
|
+
.table-responsive
|
87
|
+
table.table
|
88
|
+
tbody
|
89
|
+
tr ng-repeat="asset in assets.other"
|
90
|
+
td style="width: 40%"
|
91
|
+
| {{ asset.filename }}
|
92
|
+
td style="width: 40%"
|
93
|
+
| {{asset.file.url}}
|
94
|
+
td
|
95
|
+
.btn-group.pull-right
|
96
|
+
a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
|
97
|
+
i.fa.fa-pencil
|
98
|
+
a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
|
99
|
+
i.fa.fa-times
|
100
|
+
li.pull-right
|
101
|
+
a.btn.btn-sm.btn-primary.add-asset ui-sref="assets.new"
|
102
|
+
= I18n.t("add_asset")
|
@@ -2,4 +2,6 @@
|
|
2
2
|
.col-lg-12
|
3
3
|
form role="form" ng-submit="update()"
|
4
4
|
ng-include src="'snippets/form.html'"
|
5
|
-
|
5
|
+
.btn-group
|
6
|
+
button.btn.btn-default type="submit" data-redirect="true" ng-click="update($event)" = I18n.t(:update_snippet)
|
7
|
+
button.btn.btn-default type="submit" ng-click="update($event)" = I18n.t(:update_snippet_and_continue)
|
@@ -65,3 +65,21 @@ table td {
|
|
65
65
|
.CodeMirror {
|
66
66
|
height: 500px;
|
67
67
|
}
|
68
|
+
.assets-block {
|
69
|
+
a.btn.add-asset {
|
70
|
+
border: none;
|
71
|
+
border-radius: 3px;
|
72
|
+
padding: 6px 12px;
|
73
|
+
margin-right: 0;
|
74
|
+
&:hover, &:focus {
|
75
|
+
background-color: #3071a9;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
.table-responsive {
|
79
|
+
background: #fff;
|
80
|
+
color: #333333;
|
81
|
+
}
|
82
|
+
.nav-tabs li a {
|
83
|
+
cursor: pointer;
|
84
|
+
}
|
85
|
+
}
|
@@ -39,7 +39,7 @@ module Kms
|
|
39
39
|
def show
|
40
40
|
@asset = Asset.find(params[:id])
|
41
41
|
attrs = {}
|
42
|
-
attrs.merge!(methods: [:
|
42
|
+
attrs.merge!(methods: [:filename, :text]) if @asset.stylesheet_or_javascript?
|
43
43
|
render json: @asset.to_json(attrs)
|
44
44
|
end
|
45
45
|
|
data/config/locales/en.yml
CHANGED
@@ -16,6 +16,7 @@ en:
|
|
16
16
|
update_page_and_continue: "Update page and continue"
|
17
17
|
update_template_and_continue: "Update template and continue"
|
18
18
|
update_asset_and_continue: "Update asset and continue"
|
19
|
+
update_snippet_and_continue: "Update snippet and continue"
|
19
20
|
add_asset: "Add asset"
|
20
21
|
new_asset: "New Asset"
|
21
22
|
edit_asset: "Edit Asset"
|
@@ -34,7 +35,13 @@ en:
|
|
34
35
|
no_settings: "No settings specified"
|
35
36
|
yes_word: "Yes"
|
36
37
|
no_word: "No"
|
37
|
-
or: "
|
38
|
+
or: "Or"
|
39
|
+
are_you_sure: "Are you sure?"
|
40
|
+
images: "Images"
|
41
|
+
stylesheets: "Stylesheets"
|
42
|
+
javascripts: "Javascript"
|
43
|
+
fonts: "Fonts"
|
44
|
+
other_assets: "Other"
|
38
45
|
roles:
|
39
46
|
admin: "Admin"
|
40
47
|
content_manager: "Content manager"
|
data/config/locales/ru.yml
CHANGED
@@ -16,6 +16,7 @@ ru:
|
|
16
16
|
update_page_and_continue: "Обновить страницу и продолжить"
|
17
17
|
update_template_and_continue: "Обновить шаблон и продолжить"
|
18
18
|
update_asset_and_continue: "Обновить файл и продолжить"
|
19
|
+
update_snippet_and_continue: "Обновить сниппет и продолжить"
|
19
20
|
add_asset: "Добавить файл"
|
20
21
|
new_asset: "Новый Файл"
|
21
22
|
edit_asset: "Редактирование Файла"
|
@@ -35,6 +36,12 @@ ru:
|
|
35
36
|
yes_word: "Да"
|
36
37
|
no_word: "Нет"
|
37
38
|
or: "Или"
|
39
|
+
are_you_sure: "Вы уверены?"
|
40
|
+
images: "Изображения"
|
41
|
+
stylesheets: "CSS"
|
42
|
+
javascripts: "Javascript"
|
43
|
+
fonts: "Шрифты"
|
44
|
+
other_assets: "Другое"
|
38
45
|
roles:
|
39
46
|
admin: "Администратор"
|
40
47
|
content_manager: "Контент-менеджер"
|
data/lib/kms/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Petrov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -127,16 +127,16 @@ dependencies:
|
|
127
127
|
name: carrierwave
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- - "
|
130
|
+
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: 1.0.0
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - "
|
137
|
+
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 1.0.0
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: active_model_serializers
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -310,13 +310,13 @@ files:
|
|
310
310
|
- app/assets/fonts/glyphicons-halflings-regular.ttf
|
311
311
|
- app/assets/fonts/glyphicons-halflings-regular.woff
|
312
312
|
- app/assets/javascripts/kms/application.js
|
313
|
-
- app/assets/javascripts/kms/application/controllers/assets_controller.coffee
|
313
|
+
- app/assets/javascripts/kms/application/controllers/assets_controller.coffee.erb
|
314
314
|
- app/assets/javascripts/kms/application/controllers/help_controller.coffee
|
315
|
-
- app/assets/javascripts/kms/application/controllers/pages_controller.coffee
|
315
|
+
- app/assets/javascripts/kms/application/controllers/pages_controller.coffee.erb
|
316
316
|
- app/assets/javascripts/kms/application/controllers/settings_controller.coffee
|
317
317
|
- app/assets/javascripts/kms/application/controllers/sidebar_controller.coffee
|
318
|
-
- app/assets/javascripts/kms/application/controllers/snippets_controller.coffee
|
319
|
-
- app/assets/javascripts/kms/application/controllers/templates_controller.coffee
|
318
|
+
- app/assets/javascripts/kms/application/controllers/snippets_controller.coffee.erb
|
319
|
+
- app/assets/javascripts/kms/application/controllers/templates_controller.coffee.erb
|
320
320
|
- app/assets/javascripts/kms/application/controllers/users_controller.coffee
|
321
321
|
- app/assets/javascripts/kms/application/module.coffee
|
322
322
|
- app/assets/javascripts/kms/application/routes.coffee.erb
|
@@ -413,6 +413,7 @@ files:
|
|
413
413
|
- db/migrate/20150209120632_add_position_to_kms_pages.rb
|
414
414
|
- db/migrate/20160129100437_create_kms_snippets.rb
|
415
415
|
- db/migrate/20160712094512_create_kms_settings.rb
|
416
|
+
- db/migrate/20161118151849_set_default_value_for_kms_settings_values_field.rb
|
416
417
|
- lib/generators/kms/install/install_generator.rb
|
417
418
|
- lib/generators/kms/install/templates/devise.rb
|
418
419
|
- lib/generators/kms/install/templates/dragonfly.rb
|