kms 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/kms/application/controllers/pages_controller.coffee.erb +1 -2
  3. data/app/assets/javascripts/templates/assets/index.html.slim +4 -12
  4. data/app/assets/javascripts/templates/help/scopes.html.slim +74 -0
  5. data/app/assets/javascripts/templates/pages/index.html.slim +4 -3
  6. data/app/assets/javascripts/templates/snippets/index.html.slim +4 -3
  7. data/app/assets/javascripts/templates/templates/index.html.slim +4 -3
  8. data/app/assets/javascripts/templates/users/index.html.slim +3 -2
  9. data/app/assets/stylesheets/kms/custom.css.scss +3 -0
  10. data/app/controllers/kms/pages_controller.rb +2 -2
  11. data/app/models/ability.rb +0 -1
  12. data/app/models/concerns/kms/positioned.rb +18 -0
  13. data/app/models/kms/page.rb +2 -12
  14. data/app/services/kms/functions_registry.rb +11 -0
  15. data/app/uploaders/kms/asset_uploader.rb +1 -1
  16. data/config/initializers/help.rb +1 -1
  17. data/config/initializers/liquor.rb +0 -47
  18. data/config/locales/en.yml +22 -0
  19. data/config/locales/ru.yml +22 -0
  20. data/lib/generators/kms/install/install_generator.rb +2 -0
  21. data/lib/generators/kms/install/templates/carrierwave.rb +14 -0
  22. data/lib/kms/dependencies.rb +2 -0
  23. data/lib/kms/engine.rb +1 -1
  24. data/lib/kms/version.rb +1 -1
  25. data/spec/controllers/kms/snippets_controller_spec.rb +6 -6
  26. data/spec/internal/log/test.log +2439 -0
  27. data/spec/services/kms/functions_registry_spec.rb +14 -0
  28. data/spec/spec_helper.rb +1 -1
  29. data/vendor/assets/bower.json +1 -1
  30. data/vendor/assets/bower_components/angular-ui-tree/CHANGELOG.md +164 -0
  31. data/vendor/assets/bower_components/angular-ui-tree/CONTRIBUTING.md +39 -0
  32. data/vendor/assets/bower_components/angular-ui-tree/README.md +145 -37
  33. data/vendor/assets/bower_components/angular-ui-tree/bower.json +28 -18
  34. data/vendor/assets/bower_components/angular-ui-tree/{source → dist}/angular-ui-tree.css +18 -16
  35. data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.js +1408 -822
  36. data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.min.css +1 -2
  37. data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.min.js +3 -3
  38. data/vendor/assets/bower_components/angular-ui-tree/e2e/basic-example/basic-example.js +81 -0
  39. data/vendor/assets/bower_components/angular-ui-tree/e2e/basic-example/page.js +42 -0
  40. data/vendor/assets/bower_components/angular-ui-tree/e2e/table-example/page.js +31 -0
  41. data/vendor/assets/bower_components/angular-ui-tree/e2e/table-example/table-example.js +34 -0
  42. data/vendor/assets/bower_components/angular-ui-tree/index.js +2 -0
  43. data/vendor/assets/bower_components/angular-ui-tree/protractor.conf.js +19 -0
  44. data/vendor/assets/bower_components/angular/angular.js +4880 -2111
  45. data/vendor/assets/bower_components/angular/angular.min.js +320 -297
  46. data/vendor/assets/bower_components/angular/angular.min.js.gzip +0 -0
  47. data/vendor/assets/bower_components/angular/angular.min.js.map +3 -3
  48. data/vendor/assets/bower_components/angular/bower.json +1 -1
  49. data/vendor/assets/bower_components/angular/package.json +1 -1
  50. metadata +32 -40
  51. data/vendor/assets/bower_components/angular-ui-tree/Gruntfile.js +0 -229
  52. data/vendor/assets/bower_components/angular-ui-tree/build/compiler.jar +0 -0
  53. data/vendor/assets/bower_components/angular-ui-tree/demo/css/demo-horizontal.css +0 -47
  54. data/vendor/assets/bower_components/angular-ui-tree/demo/css/demo.css +0 -31
  55. data/vendor/assets/bower_components/angular-ui-tree/demo/css/tree.css +0 -25
  56. data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.js +0 -1243
  57. data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.min.css +0 -2
  58. data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.min.js +0 -6
  59. data/vendor/assets/bower_components/angular-ui-tree/demo/filter.html +0 -64
  60. data/vendor/assets/bower_components/angular-ui-tree/demo/groups.html +0 -100
  61. data/vendor/assets/bower_components/angular-ui-tree/demo/index.html +0 -101
  62. data/vendor/assets/bower_components/angular-ui-tree/demo/js/demo.js +0 -63
  63. data/vendor/assets/bower_components/angular-ui-tree/demo/js/filter.js +0 -91
  64. data/vendor/assets/bower_components/angular-ui-tree/demo/js/groups.js +0 -143
  65. data/vendor/assets/bower_components/angular-ui-tree/demo/js/tree.js +0 -102
  66. data/vendor/assets/bower_components/angular-ui-tree/demo/js/trees.js +0 -60
  67. data/vendor/assets/bower_components/angular-ui-tree/demo/test.html +0 -60
  68. data/vendor/assets/bower_components/angular-ui-tree/demo/tree-horizontal.html +0 -66
  69. data/vendor/assets/bower_components/angular-ui-tree/demo/tree.html +0 -66
  70. data/vendor/assets/bower_components/angular-ui-tree/demo/trees.html +0 -92
  71. data/vendor/assets/bower_components/angular-ui-tree/guide/00_usage.ngdoc +0 -78
  72. data/vendor/assets/bower_components/angular-ui-tree/guide/01_development_setup.ngdoc +0 -58
  73. data/vendor/assets/bower_components/angular-ui-tree/guide/index.ngdoc +0 -33
  74. data/vendor/assets/bower_components/angular-ui-tree/karma.conf.js +0 -49
  75. data/vendor/assets/bower_components/angular-ui-tree/package.json +0 -40
  76. data/vendor/assets/bower_components/angular-ui-tree/source/angular-ui-tree.scss +0 -63
  77. data/vendor/assets/bower_components/angular-ui-tree/source/controllers/handleCtrl.js +0 -16
  78. data/vendor/assets/bower_components/angular-ui-tree/source/controllers/nodeCtrl.js +0 -141
  79. data/vendor/assets/bower_components/angular-ui-tree/source/controllers/nodesCtrl.js +0 -100
  80. data/vendor/assets/bower_components/angular-ui-tree/source/controllers/treeCtrl.js +0 -63
  81. data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTree.js +0 -115
  82. data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeHandle.js +0 -27
  83. data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeNode.js +0 -427
  84. data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeNodes.js +0 -59
  85. data/vendor/assets/bower_components/angular-ui-tree/source/main.js +0 -23
  86. data/vendor/assets/bower_components/angular-ui-tree/source/services/helper.js +0 -265
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3376e353187d1fcbd9033b374380f744467c2e3
4
- data.tar.gz: ac386e50234dfa6e1c5830f1193412a4c8e8957b
3
+ metadata.gz: c7a60114d095d742beb0d36848becbcdddf79bc8
4
+ data.tar.gz: 614ac6dc07bf7781306c107c97c3438a43b88877
5
5
  SHA512:
6
- metadata.gz: c9108885e35beeaea1ed0f8bd2b4b86da47814736ae204c194385e9b2a0aff4436406ce0c06a7f01c48e6855086959e51d2dffe207e98fb2a68bdf441ea564e5
7
- data.tar.gz: bc3e1331a225a5bfe633dfd04d8fa2a4ebb180bc17b57ce5138a7b7aacd528c8d9530a565163d64501b5b429d916187cf9d2c9cf01c2a7c07da17faa38f9c9ff
6
+ metadata.gz: 3155d389e80cac754afd5ac0d1d3d05e9e6d6574754a74ddb150ca52869b321e7a195b8d36d40d0889aae6240a958acb167ecf51f1dda3f52db127c91928162e
7
+ data.tar.gz: 689ce17498530639bd86c95f03c486f6ffadd65c29ce4ab04ebccb01848bf91d510e6a14ea2971b98f5fed4e00d7ccb1ee31b4487f0e49bf0c44837439c92ae6
@@ -88,8 +88,7 @@ PagesController = ($scope, $state, $cookieStore, Restangular, $stateParams, Aler
88
88
 
89
89
  $scope.treeOptions = {
90
90
  dropped: (event) ->
91
- Restangular.all('pages').customPOST(angular.toJson($scope.pages),'sorting')
92
- $scope.store.getList().then (pages) ->
91
+ Restangular.all('pages').customPOST(angular.toJson($scope.pages),'sorting').then (pages) ->
93
92
  $scope.pages = pages
94
93
  }
95
94
 
@@ -21,8 +21,6 @@
21
21
  | {{asset.file.url}}
22
22
  td
23
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
24
  a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
27
25
  i.fa.fa-times
28
26
  tab
@@ -34,13 +32,12 @@
34
32
  tbody
35
33
  tr ng-repeat="asset in assets.css"
36
34
  td style="width: 40%"
37
- | {{ asset.filename }}
35
+ a ui-sref="assets.edit({id: asset.id})"
36
+ | {{ asset.filename }}
38
37
  td style="width: 40%"
39
38
  | {{asset.file.url}}
40
39
  td
41
40
  .btn-group.pull-right
42
- a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
43
- i.fa.fa-pencil
44
41
  a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
45
42
  i.fa.fa-times
46
43
  tab
@@ -52,13 +49,12 @@
52
49
  tbody
53
50
  tr ng-repeat="asset in assets.javascript"
54
51
  td style="width: 40%"
55
- | {{ asset.filename }}
52
+ a ui-sref="assets.edit({id: asset.id})"
53
+ | {{ asset.filename }}
56
54
  td style="width: 40%"
57
55
  | {{asset.file.url}}
58
56
  td
59
57
  .btn-group.pull-right
60
- a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
61
- i.fa.fa-pencil
62
58
  a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
63
59
  i.fa.fa-times
64
60
  tab
@@ -75,8 +71,6 @@
75
71
  | {{asset.file.url}}
76
72
  td
77
73
  .btn-group.pull-right
78
- a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
79
- i.fa.fa-pencil
80
74
  a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
81
75
  i.fa.fa-times
82
76
  tab
@@ -93,8 +87,6 @@
93
87
  | {{asset.file.url}}
94
88
  td
95
89
  .btn-group.pull-right
96
- a.btn.btn-sm.btn-info ui-sref="assets.edit({id: asset.id})"
97
- i.fa.fa-pencil
98
90
  a.btn.btn-sm.btn-danger ng-click="destroy(asset)"
99
91
  i.fa.fa-times
100
92
  li.pull-right
@@ -0,0 +1,74 @@
1
+ h4 = I18n.t("liquor_help.scopes_title")
2
+ p
3
+ ul
4
+ li
5
+ var find_by
6
+ p
7
+ span = I18n.t('liquor_help.scopes.find_by.main_description')
8
+ p
9
+ code
10
+ | {% assign news_page = index.children.find_by(title: 'News') %}
11
+ li
12
+ var find_all_by
13
+ p
14
+ span = I18n.t('liquor_help.scopes.find_all_by.main_description')
15
+ p
16
+ code
17
+ | {% for p in: index.children.find_all_by(published: true) do: %}
18
+ li
19
+ var except
20
+ p
21
+ span = I18n.t('liquor_help.scopes.except.main_description')
22
+ p
23
+ code
24
+ | {% assign correct_pages = index.children.except(excepted_page) %}
25
+ li
26
+ var find_except_by
27
+ p
28
+ span = I18n.t('liquor_help.scopes.find_except_by.main_description')
29
+ p
30
+ code
31
+ | {% for p in: index.children.find_except_by(hidden: true) do: %}
32
+ li
33
+ var limit
34
+ p
35
+ span = I18n.t('liquor_help.scopes.limit.main_description')
36
+ p
37
+ code
38
+ | {% for post in: models.posts.limit(3) do: %}
39
+ li
40
+ var offset
41
+ p
42
+ span = I18n.t('liquor_help.scopes.offset.main_description')
43
+ p
44
+ code
45
+ | {% for post in: models.posts.limit(3).offset(3) do: %}
46
+ li
47
+ var first
48
+ p
49
+ span = I18n.t('liquor_help.scopes.first.main_description')
50
+ p
51
+ code
52
+ | {% assign first_post = models.posts.first %}
53
+ li
54
+ var last
55
+ p
56
+ span = I18n.t('liquor_help.scopes.last.main_description')
57
+ p
58
+ code
59
+ | {% assign last_post = models.posts.last %}
60
+ li
61
+ var
62
+ | []
63
+ p
64
+ span = I18n.t('liquor_help.scopes.by_index.main_description')
65
+ p
66
+ code
67
+ | {% assign third_post = models.posts[2] %}
68
+ li
69
+ var pluck
70
+ p
71
+ span = I18n.t('liquor_help.scopes.pluck.main_description')
72
+ p
73
+ code
74
+ | {% for post_title in: models.posts.pluck('title') %}
@@ -4,13 +4,14 @@ script type="text/ng-template" id="nodes_renderer.html"
4
4
  div style="width:50%;float:left;height:30px;line-height:30px;" ng-class="{'not-published': !node.published}"
5
5
  a data-nodrag="" ng-click="toggle(node)" ng-if="node.children" style="padding-right:5px;"
6
6
  i.fa ng-class="{'fa-plus': collapsed, 'fa-minus': !collapsed}"
7
- | {{node.title}} 
7
+ a ui-sref="pages.edit({id: node.id})" data-nodrag=""
8
+ | {{node.title}} 
8
9
  i.fa.fa-cogs style="font-size:18px !important" ng-if="node.templatable"
9
10
  div style="width:30%;float:left;height:30px;line-height:30px;"
10
11
  | {{ node.fullpath }}
11
12
  .btn-group.pull-right
12
- a.btn.btn-sm.btn-info data-nodrag="" ui-sref="pages.edit({id: node.id})"
13
- i.fa.fa-pencil
13
+ /a.btn.btn-sm.btn-info data-nodrag="" ui-sref="pages.edit({id: node.id})"
14
+ /i.fa.fa-pencil
14
15
  a.btn.btn-sm.btn-danger data-nodrag="" ng-click="destroy(node)" style="margin-right: 8px;"
15
16
  i.fa.fa-times
16
17
  ol ui-tree-nodes="pages" ng-model="node.children" ng-class="{hidden: collapsed}"
@@ -13,10 +13,11 @@
13
13
  tbody
14
14
  tr ng-repeat="snippet in snippets"
15
15
  td style="width: 80%"
16
- | {{ snippet.name }}
16
+ a ui-sref="snippets.edit({id: snippet.id})"
17
+ | {{ snippet.name }}
17
18
  td
18
19
  .btn-group.pull-right
19
- a.btn.btn-sm.btn-info ui-sref="snippets.edit({id: snippet.id})" ng-show="currentUser.admin"
20
- i.fa.fa-pencil
20
+ /a.btn.btn-sm.btn-info ui-sref="snippets.edit({id: snippet.id})" ng-show="currentUser.admin"
21
+ /i.fa.fa-pencil
21
22
  a.btn.btn-sm.btn-danger ng-click="destroy(snippet)" ng-show="currentUser.admin"
22
23
  i.fa.fa-times
@@ -13,10 +13,11 @@
13
13
  tbody
14
14
  tr ng-repeat="template in templates"
15
15
  td style="width: 80%"
16
- | {{ template.name }}
16
+ a ui-sref="templates.edit({id: template.id})"
17
+ | {{ template.name }}
17
18
  td
18
19
  .btn-group.pull-right
19
- a.btn.btn-sm.btn-info ui-sref="templates.edit({id: template.id})" ng-show="currentUser.admin"
20
- i.fa.fa-pencil
20
+ /a.btn.btn-sm.btn-info ui-sref="templates.edit({id: template.id})" ng-show="currentUser.admin"
21
+ /i.fa.fa-pencil
21
22
  a.btn.btn-sm.btn-danger ng-click="destroy(template)" ng-show="currentUser.admin"
22
23
  i.fa.fa-times
@@ -17,5 +17,6 @@
17
17
  td
18
18
  | {{ user.localized_role }}
19
19
  td
20
- a.btn.btn-sm.btn-danger ng-click="destroy(user)"
21
- i.fa.fa-times
20
+ .btn-group.pull-right
21
+ a.btn.btn-sm.btn-danger ng-click="destroy(user)"
22
+ i.fa.fa-times
@@ -83,3 +83,6 @@ table td {
83
83
  .nav-tabs li a {
84
84
  cursor: pointer;
85
85
  }
86
+ .widget .widget-header table i {
87
+ margin-right: 0px;
88
+ }
@@ -5,7 +5,7 @@ module Kms
5
5
 
6
6
  def index
7
7
  #render json: Page.order("created_at asc").to_json(methods: :parent_id, except: :ancestry)
8
- render json: Page.arrange_serializable(:order => :position).to_json
8
+ render json: Page.arrange_serializable(order: :position).to_json
9
9
  end
10
10
 
11
11
  def create
@@ -44,7 +44,7 @@ module Kms
44
44
  p.update_attribute(:position, index)
45
45
  sort(page["id"], page["children"]) if page["children"].present?
46
46
  end
47
- render json: Page.arrange_serializable.to_json
47
+ render json: Page.arrange_serializable(order: :position).to_json
48
48
  end
49
49
 
50
50
  protected
@@ -8,7 +8,6 @@ class Ability
8
8
  if user.admin?
9
9
  can :manage, :all
10
10
  else
11
- can :index, Kms::Template
12
11
  can :manage, Kms::Page
13
12
  can :manage, Kms::Asset
14
13
  Kms::AbilityService.abilities.each do |ability_block|
@@ -0,0 +1,18 @@
1
+ module Kms
2
+ module Positioned
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_create :set_position
7
+ end
8
+
9
+ def set_position
10
+ if parent.present?
11
+ max = parent.children.maximum(:position)
12
+ else
13
+ max = self.class.where('ancestry IS ?', nil).maximum(:position)
14
+ end
15
+ self.position = max ? max + 1 : 0
16
+ end
17
+ end
18
+ end
@@ -2,8 +2,9 @@ module Kms
2
2
  class Page < ActiveRecord::Base
3
3
  include Liquor::Dropable
4
4
  include CompileTemplates
5
+ include Positioned
5
6
 
6
- INDEX_SLUG = "index"
7
+ INDEX_SLUG = "index".freeze
7
8
  INDEX_FULLPATH = ""
8
9
 
9
10
  scope :published, lambda { where(published: true) }
@@ -16,8 +17,6 @@ module Kms
16
17
 
17
18
  before_save :build_fullpath
18
19
 
19
- before_create :set_position
20
-
21
20
  has_ancestry
22
21
 
23
22
  def index?
@@ -34,15 +33,6 @@ module Kms
34
33
  end
35
34
  end
36
35
 
37
- def set_position
38
- if parent.present?
39
- max = parent.children.maximum(:position)
40
- else
41
- max = Page.where('ancestry IS ?', nil).maximum(:position)
42
- end
43
- self.position = max ? max + 1 : 0
44
- end
45
-
46
36
  # fetch items for templatable page
47
37
  def fetch_items
48
38
  templatable_type.constantize.all
@@ -0,0 +1,11 @@
1
+ module Kms
2
+ class FunctionsRegistry
3
+ cattr_accessor :modules do
4
+ [Liquor::Pagination, Kms::Functions::Assets, Kms::Functions::Currency]
5
+ end
6
+
7
+ def self.register(module_const)
8
+ modules << module_const
9
+ end
10
+ end
11
+ end
@@ -8,7 +8,7 @@ module Kms
8
8
  # include CarrierWave::MiniMagick
9
9
 
10
10
  # Choose what kind of storage to use for this uploader:
11
- storage :file
11
+ storage (ENV['KMS_ASSETS_STORAGE'] && ENV['KMS_ASSETS_STORAGE'].to_sym) || :file
12
12
  # storage :fog
13
13
 
14
14
  # Override the directory where uploaded files will be stored.
@@ -1 +1 @@
1
- Kms::HelpService.register_templates Kms::Engine, 'help/filters.html', 'help/variables.html'
1
+ Kms::HelpService.register_templates Kms::Engine, 'help/filters.html', 'help/variables.html', 'help/scopes.html'
@@ -1,49 +1,2 @@
1
1
  require 'kms/functions/assets'
2
2
  require 'kms/functions/currency'
3
- #Kms.template_manager = Liquor::Manager.new(import: [Liquor::Pagination, Kms::Functions::Assets, Kms::Functions::Currency])
4
-
5
- # if ActiveRecord::Base.connection.tables.include?('kms_templates')
6
- # Kms::Template.all.each do |template|
7
- # Kms.template_manager.register_layout(template.register_id, template.content || "", Kms::ExternalsRegistry.externals.keys)
8
- # end
9
- # end
10
- # if ActiveRecord::Base.connection.tables.include?('kms_pages')
11
- # Kms::Page.all.each do |page|
12
- # Kms.template_manager.register_template(page.register_id, page.content || "", Kms::ExternalsRegistry.externals.keys)
13
- # end
14
- # end
15
- #Rails.configuration.x.template_manager.register_partial("_pagination", <<-eos
16
- #{% pagination start: %}
17
- #<div class='digg_pagination'>
18
- #{% if page.is_current then: %}
19
- #<span class="disabled previous_page">&#8592; Previous</span>
20
- #{% else: %}
21
- #<a href="{{ prev_page_path }}" rel="previous" class="previous_page_page">&#8592; Previous</a>
22
- #{% end if %}
23
- #{% page: %}
24
- #{% if page.is_current then: %}
25
- #<em class="current">{{ page.number }}</em>
26
- #{% elsif: page.is_next then: %}
27
- #<a href="{{ page.path }}" rel="next">{{ page.number }}</a>
28
- #{% elsif: page.is_prev then: %}
29
- #<a href="{{ page.path }}" rel="previous">{{ page.number }}</a>
30
- #{% else: %}
31
- #<a href="{{ page.path }}">3</a>
32
- #{% end if %}
33
- #{% gap: %}
34
- #<span class="gap">&hellip;</span>
35
- #{% end: %}
36
- #{% if page.is_current then: %}
37
- #<span class="disabled next_page">Next &#8594;</span>
38
- #{% else: %}
39
- #<a href="{{ next_page_path }}" rel="next" class="next_page">Next &#8594;</a></div>
40
- #{% end if %}
41
- #{% end pagination %}
42
- #eos
43
- #)
44
-
45
- # unless Kms.template_manager.compile
46
- # Kms.template_manager.errors.each do |error|
47
- # puts error
48
- # end
49
- # end
@@ -50,6 +50,7 @@ en:
50
50
  tags_title: "Tags"
51
51
  filters_title: "Filters"
52
52
  variables_title: "Variables"
53
+ scopes_title: "Scopes"
53
54
  endpoints_title: "Endpoints"
54
55
  property: "Property of"
55
56
  parameter: "Parameter for"
@@ -75,6 +76,27 @@ en:
75
76
  main_description: "Tag yield has 3 forms. In the simples case (without arguments) it inserts content of internal template (Page content in terms of this CMS). If string with handle was setup with {% content_for %}, then yield returns this string. If no string with handle, yield returns result of if_none block execution, if such block was specified, or just empty string:"
76
77
  include:
77
78
  main_description: 'Tag include includes content of Snippet into template. The only argument of include - Snippet ID (field "Slug/ID" that you need to setup on Snippet creation in "Snippets"):'
79
+ scopes:
80
+ find_by:
81
+ main_description: 'find_by allows you to find one element in collection by some condition/criteria'
82
+ find_all_by:
83
+ main_description: 'find_all_by finds all collection elements matching criterias'
84
+ except:
85
+ main_description: 'except returns you all collection elements except ones provided as argument'
86
+ find_except_by:
87
+ main_description: 'find_except_by finds all collection elements not matching provided criterias'
88
+ limit:
89
+ main_description: 'limit method is equal to SQL limit so it allows to limit number of collection items'
90
+ offset:
91
+ main_description: 'offset method is equal to SQL offset so it allows to fetch records by offset'
92
+ first:
93
+ main_description: 'returns first element in collection'
94
+ last:
95
+ main_description: 'returns last element in collection'
96
+ by_index:
97
+ main_description: 'returns element by its index'
98
+ pluck:
99
+ main_description: 'returns collection containing elements specific field values (not full object)'
78
100
  variables:
79
101
  var_loop:
80
102
  main_description: 'Variable giving access to current state of cycle/iteration. Can be used only in "for" cycle. var_loop - common name, for accessing actual cycle variable you need to concatenate cycle variable name and "_loop". Example:'
@@ -50,6 +50,7 @@ ru:
50
50
  tags_title: "Тэги"
51
51
  filters_title: "Фильтры"
52
52
  variables_title: "Переменные"
53
+ scopes_title: "Методы коллекций"
53
54
  endpoints_title: "Запросы"
54
55
  property: "Свойство"
55
56
  parameter: "Параметр для"
@@ -75,6 +76,27 @@ ru:
75
76
  main_description: "Тэг yield имеет 3 формы написания. В самом простом случае (без аргументов) тэг вставляет содержимое внутреннего шаблона (в данной CMS это страница). Если строка с handle была задана с помощью {% content_for %}, тогда yield возвращает эту строку. Если не было задано строки с этим handle, yield либо возвращает результат выполнения блока if_none, если он задан, или пустую строку:"
76
77
  include:
77
78
  main_description: 'Тэг include включает в шаблон содержимое Сниппета. Единственный аргумент include - это идентификатор Сниппета (поле "Идентификатор", указанное при создании сниппета в разделе "Сниппеты"):'
79
+ scopes:
80
+ find_by:
81
+ main_description: 'find_by позволяет найти один элемент коллекции по заданному условию'
82
+ find_all_by:
83
+ main_description: 'find_all_by находит все элементы коллекции, удовлетворяющие критериям'
84
+ except:
85
+ main_description: 'except возвращает элементы коллекции, кроме тех, которые поданы в качестве аргументов'
86
+ find_except_by:
87
+ main_description: 'find_except_by находит все элементы коллекции, не удовлетворяющие заданным критериям'
88
+ limit:
89
+ main_description: 'limit эквивалентен limit в SQL и позволяет ограничить количество элементов коллекции'
90
+ offset:
91
+ main_description: 'offset эквивалентен offset в SQL и позволяет получить данные со смещением'
92
+ first:
93
+ main_description: 'возвращает первый элемент коллекции'
94
+ last:
95
+ main_description: 'возвращает последний элемент коллекции'
96
+ by_index:
97
+ main_description: 'возвращает элемент по индексу'
98
+ pluck:
99
+ main_description: 'возвращает коллекцию, содержащую значения определенного свойства'
78
100
  variables:
79
101
  var_loop:
80
102
  main_description: 'Переменная, предоставляющая доступ к текущему состоянию цикла. Может быть использована только внутри цикла for. var_loop - обобщённое имя, для получения настоящего имени переменной нужно сконкатенировать название переменной цикла и "_loop". Например:'