kms 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bdb5f40cdd7073b7ef6e7b3762b4d7276d5b9b5
4
- data.tar.gz: 5c8bff41c2f74efc654ac57995cddfe4f521b878
3
+ metadata.gz: 2b29d6d6a21d5d406c54173448dde0d22f79dd7f
4
+ data.tar.gz: 0849ee6b4745180394d85e21755545530efaa494
5
5
  SHA512:
6
- metadata.gz: 28bd4b93a4b3660f01c591f58dbdb26848f82a33c48c1af556c2f9646a9756f23ffaea5b68755120027c9bf2ec7f1125ff6f1db7cca787f4f11fdc1f384f9713
7
- data.tar.gz: d2ac4c3deb95e732c554958c2af73605613b3abbc934ae9ecde6fa6b6753556581a33694527e80d0079e0c77c6ad88cb4d9596063e45bbec86c0701bf49a611e
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(assets, 'content_type')
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($scope.asset.content_type) or /css/.test($scope.asset.content_type) or /text\//.test($scope.asset.content_type)
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
- $state.go('snippets')
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
- user.remove().then ->
26
- $scope.users = _.without($scope.users, user)
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
- = Kms::Asset.model_name.human(count: 1.1)
7
- /a.pull-right href="#" Manage
8
- a.btn.btn-sm.btn-primary.pull-right ui-sref="assets.new"
9
- = I18n.t("add_asset")
10
- .widget-body.no-padding
11
- .table-responsive
12
- table.table ng-repeat="(content_type, typed_assets) in assets"
13
- thead
14
- tr
15
- td.text-center.bg-info colspan="3"
16
- | {{ content_type }}
17
- tbody
18
- tr ng-repeat="asset in typed_assets"
19
- td style="width: 40%"
20
- | {{ asset.filename }}
21
- td style="width: 40%"
22
- | {{asset.file.url}}
23
- td
24
- .btn-group.pull-right
25
- a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
26
- i.fa.fa-pencil
27
- a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
28
- i.fa.fa-times
29
- /div ui-tree=""
30
- /ol ui-tree-nodes="" ng-model="pages" id="tree-root"
31
- /li ng-repeat="node in pages" ui-tree-node="" ng-include="'nodes_renderer.html'"
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")
@@ -141,7 +141,7 @@
141
141
  p
142
142
  table.table
143
143
  tr
144
- th #{ I18n.t('liquor_help.properties') } var_loop
144
+ th #{ I18n.t('liquor_help.property') } var_loop
145
145
  th = I18n.t('liquor_help.description')
146
146
  tr
147
147
  td length
@@ -8,7 +8,7 @@ p
8
8
  p
9
9
  table.table
10
10
  tr
11
- th #{ I18n.t('liquor_help.properties') } Page
11
+ th #{ I18n.t('liquor_help.property') } Page
12
12
  th = I18n.t('liquor_help.description')
13
13
  tr
14
14
  td slug
@@ -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
- button.btn.btn-default type="submit" = I18n.t(:update_snippet)
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: [:text, :performing_plain_text]) if @asset.text_or_javascript?
42
+ attrs.merge!(methods: [:filename, :text]) if @asset.stylesheet_or_javascript?
43
43
  render json: @asset.to_json(attrs)
44
44
  end
45
45
 
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'carrierwave/processing/mime_types'
4
3
  module Kms
5
4
  class AssetUploader < CarrierWave::Uploader::Base
6
5
 
@@ -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"
@@ -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: "Контент-менеджер"
@@ -0,0 +1,5 @@
1
+ class SetDefaultValueForKmsSettingsValuesField < ActiveRecord::Migration[5.0]
2
+ def change
3
+ change_column_default :kms_settings, :values, {}
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Kms
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
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.6.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-11-18 00:00:00.000000000 Z
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: '0'
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: '0'
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