inverter 0.5.0 → 0.5.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2935b1b6c9c2ae092abb179904d73a08a6ff94c5
|
4
|
+
data.tar.gz: 014643fe8175f88f1d41c64ba0d65e6c11adb13f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eee49819019d2829a934034084e5b0ca151c96fb7f399d3da48191abfe6656bf30a9a003c2cacaa33034bdf25b026e99b4caf2fbbe2343b68b8031a0aeb0208
|
7
|
+
data.tar.gz: e870dc0d940f56fe767b5374a04271ed2706600bcf55b88bda5e777f01755f957d31261bc2d4dd5d85303c602b9741e3e2a0cad2c7098d0e08b8d3f133a4a530
|
data/Gemfile.lock
CHANGED
@@ -73,10 +73,10 @@ class @InputInverterImage extends InputString
|
|
73
73
|
@$actions =$ "<span class='input-actions'></span>"
|
74
74
|
@$label.append @$actions
|
75
75
|
|
76
|
-
@$chooseBtn =$ "<
|
76
|
+
@$chooseBtn =$ "<button>#{ Icons.upload }</button>"
|
77
77
|
@$actions.append @$chooseBtn
|
78
78
|
|
79
|
-
|
79
|
+
#@_update_choose_button_title()
|
80
80
|
|
81
81
|
@$chooseBtn.on 'click', (e) =>
|
82
82
|
e.preventDefault()
|
@@ -96,7 +96,7 @@ class @InputInverterImage extends InputString
|
|
96
96
|
@updateValue(value)
|
97
97
|
|
98
98
|
_add_remove_button: ->
|
99
|
-
@$removeBtn =$ "<
|
99
|
+
@$removeBtn =$ "<button>#{ Icons.remove }</button>"
|
100
100
|
@$el.append @$removeBtn
|
101
101
|
|
102
102
|
@$removeBtn.on 'click', (e) =>
|
@@ -61,27 +61,19 @@ class @InputInverterLink extends InputString
|
|
61
61
|
@$label.append @$actions
|
62
62
|
|
63
63
|
@_add_choose_button()
|
64
|
-
@_add_remove_button()
|
65
64
|
|
66
65
|
_add_choose_button: ->
|
67
|
-
@$chooseBtn =$ "<
|
66
|
+
@$chooseBtn =$ "<button>#{ Icons.upload }</button>"
|
68
67
|
@$actions.append @$chooseBtn
|
69
68
|
|
70
69
|
@$chooseBtn.on 'click', (e) =>
|
71
70
|
e.preventDefault()
|
72
|
-
chr.modules.loft.
|
73
|
-
|
74
|
-
|
71
|
+
chr.modules.loft.showAll false, (objects) =>
|
72
|
+
asset = objects[0]
|
73
|
+
url = asset.file.url
|
74
|
+
title = @_title() || asset.name
|
75
75
|
@_update_value(url, title)
|
76
76
|
|
77
|
-
_add_remove_button: ->
|
78
|
-
@$removeBtn =$ "<a href='#' class='remove'>Remove</a>"
|
79
|
-
@$actions.append @$removeBtn
|
80
|
-
|
81
|
-
@$removeBtn.on 'click', (e) =>
|
82
|
-
e.preventDefault()
|
83
|
-
@_update_value('', '')
|
84
|
-
|
85
77
|
# PUBLIC ====================================================================
|
86
78
|
|
87
79
|
updateValue: (@value) ->
|
@@ -11,13 +11,13 @@ module Mongoid
|
|
11
11
|
include PageMeta
|
12
12
|
include DocumentVersions
|
13
13
|
|
14
|
-
|
14
|
+
## Attributes
|
15
15
|
field :_template_name
|
16
16
|
field :_name, default: ''
|
17
17
|
field :_blocks, type: Hash, default: {}
|
18
18
|
field :_ignore_sync, type: Boolean, default: false
|
19
19
|
|
20
|
-
|
20
|
+
## History
|
21
21
|
track_history track_create: true
|
22
22
|
# # telling Mongoid::History how you want to track changes
|
23
23
|
# # dynamic fields will be tracked automatically (for MongoId 4.0+ you should include Mongoid::Attributes::Dynamic to your model)
|
@@ -29,27 +29,25 @@ module Mongoid
|
|
29
29
|
# :track_update => true, # track document updates, default is true
|
30
30
|
# :track_destroy => false # track document destruction, default is false
|
31
31
|
|
32
|
-
|
33
|
-
# SCOPES
|
32
|
+
## Scopes
|
34
33
|
default_scope -> { asc(:created_at) }
|
35
34
|
scope :available_for_sync, -> { where(_ignore_sync: false) }
|
36
35
|
|
37
|
-
|
36
|
+
## Indexes
|
38
37
|
index({ _template_name: 1 })
|
39
38
|
index({ _ignore_sync: 1 })
|
40
39
|
|
41
|
-
|
40
|
+
## Slug
|
42
41
|
# used in cms for direct object access
|
43
42
|
slug do |current_object|
|
44
43
|
current_object._template_name.gsub('.html.erb', '').gsub('/', '-')
|
45
44
|
end
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
def _list_item_title
|
46
|
+
## Helpers
|
47
|
+
def name_or_template
|
50
48
|
self._name.empty? ? self._template_name : self._name
|
51
49
|
end
|
52
|
-
|
50
|
+
alias_method :_list_item_title, :name_or_template
|
53
51
|
|
54
52
|
# populates seo values to cached meta_tags object which is
|
55
53
|
# used by ActionController while template rendering
|
@@ -75,27 +73,23 @@ module Mongoid
|
|
75
73
|
end
|
76
74
|
end
|
77
75
|
|
78
|
-
|
79
76
|
# updates blocks in html with objects _blocks hash values
|
80
77
|
def update_html(html)
|
81
78
|
html = ::Inverter::Renderer.render(html, self._blocks)
|
82
79
|
return html
|
83
80
|
end
|
84
81
|
|
85
|
-
|
86
82
|
# returns datetime when template was updated
|
87
83
|
def template_updated_at
|
88
84
|
template_path = Rails.root.to_s + '/app/views/' + self._template_name
|
89
85
|
File.mtime(template_path).getgm
|
90
86
|
end
|
91
87
|
|
92
|
-
|
93
88
|
# check if template file was changed after object was saved
|
94
89
|
def template_changed?
|
95
90
|
template_updated_at > updated_at.getgm
|
96
91
|
end
|
97
92
|
|
98
|
-
|
99
93
|
# read template blocks and save to objects _blocks hash
|
100
94
|
def update_from_template!
|
101
95
|
template_parser = ::Inverter::Parser.new(self._template_name)
|
@@ -128,9 +122,7 @@ module Mongoid
|
|
128
122
|
save
|
129
123
|
end
|
130
124
|
|
131
|
-
|
132
|
-
# class methods
|
133
|
-
|
125
|
+
## Class Methods
|
134
126
|
|
135
127
|
# creat new page object from template
|
136
128
|
def self.create_from_template(template_name)
|
@@ -178,7 +170,6 @@ module Mongoid
|
|
178
170
|
end
|
179
171
|
end
|
180
172
|
|
181
|
-
|
182
173
|
# returns list of template names for gem configuration in
|
183
174
|
# config/initializers/inverter.rb
|
184
175
|
def self.get_template_names
|
@@ -206,7 +197,3 @@ module Mongoid
|
|
206
197
|
end
|
207
198
|
end
|
208
199
|
end
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
data/lib/inverter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inverter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kravets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: render_anywhere
|