inverter 0.4.7 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -51
- data/README.md +14 -30
- data/app/assets/javascripts/inputs/inverter-image.coffee +3 -27
- data/app/assets/javascripts/inputs/inverter-link.coffee +3 -24
- data/app/assets/javascripts/inputs/inverter-version.coffee +1 -13
- data/app/assets/javascripts/inputs/inverter.coffee +5 -23
- data/app/assets/javascripts/inverter.coffee +0 -4
- data/app/assets/stylesheets/inverter.scss +6 -8
- data/inverter.gemspec +3 -14
- data/lib/inverter/concerns/inverter.rb +4 -2
- data/lib/inverter/engine.rb +0 -4
- data/lib/inverter/version.rb +1 -1
- data/lib/inverter.rb +1 -7
- metadata +3 -75
- data/CONTRIBUTING.md +0 -24
- data/LICENSE.md +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d73cd9565c1e6d90d3de1af3379e74452170ff61
|
4
|
+
data.tar.gz: fce29d8eede22d34ba07f55904b5fc3307d73c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0341fda4baf0697160351806193c45b59636876fb302f19471ff3ff66caabbf3336ae1d574478b92d6b55d35cdd97e378a0159cfbc5a83ce00f2643fcb24ac7
|
7
|
+
data.tar.gz: 02cb86dfd194ee6253a6c6a83efb3c60a551e5c824367b5cf19b2b9d0c5d14acdbdf6170c127d38d003fab0380875b4f6e3c42e431f06384634170ecfa704381
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
inverter (0.
|
5
|
-
ants (>= 0.1.4)
|
6
|
-
awesome_print (>= 1.6.1)
|
7
|
-
meta-tags (>= 2.0)
|
8
|
-
mongoid-history (>= 0.4.7)
|
9
|
-
mongoid-slug (>= 4.0.0)
|
4
|
+
inverter (0.5.0)
|
10
5
|
redcarpet (>= 3.2.3)
|
11
6
|
render_anywhere (>= 0.0.10)
|
12
7
|
|
@@ -49,14 +44,7 @@ GEM
|
|
49
44
|
thread_safe (~> 0.3, >= 0.3.4)
|
50
45
|
tzinfo (~> 1.1)
|
51
46
|
ansi (1.5.0)
|
52
|
-
ants (0.3.5)
|
53
|
-
devise
|
54
|
-
mongoid (>= 4.0)
|
55
|
-
mongoid-slug (>= 4.0.0)
|
56
47
|
arel (6.0.0)
|
57
|
-
awesome_print (1.6.1)
|
58
|
-
bcrypt (3.1.10)
|
59
|
-
bson (3.2.6)
|
60
48
|
builder (3.2.2)
|
61
49
|
capybara (2.4.4)
|
62
50
|
mime-types (>= 1.16)
|
@@ -75,14 +63,6 @@ GEM
|
|
75
63
|
execjs
|
76
64
|
coffee-script-source (1.9.1.1)
|
77
65
|
database_cleaner (1.4.1)
|
78
|
-
devise (3.5.2)
|
79
|
-
bcrypt (~> 3.0)
|
80
|
-
orm_adapter (~> 0.1)
|
81
|
-
railties (>= 3.2.6, < 5)
|
82
|
-
responders
|
83
|
-
thread_safe (~> 0.1)
|
84
|
-
warden (~> 1.2.3)
|
85
|
-
easy_diff (0.0.6)
|
86
66
|
erubis (2.7.0)
|
87
67
|
execjs (2.5.2)
|
88
68
|
factory_girl (4.5.0)
|
@@ -98,8 +78,6 @@ GEM
|
|
98
78
|
nokogiri (>= 1.5.9)
|
99
79
|
mail (2.6.3)
|
100
80
|
mime-types (>= 1.16, < 3)
|
101
|
-
meta-tags (2.1.0)
|
102
|
-
actionpack (>= 3.0.0)
|
103
81
|
mime-types (2.6.1)
|
104
82
|
mini_portile (0.6.2)
|
105
83
|
minitest (5.7.0)
|
@@ -124,29 +102,8 @@ GEM
|
|
124
102
|
builder
|
125
103
|
minitest (>= 5.0)
|
126
104
|
ruby-progressbar
|
127
|
-
mongo (2.1.2)
|
128
|
-
bson (~> 3.0)
|
129
|
-
mongoid (5.0.1)
|
130
|
-
activemodel (~> 4.0)
|
131
|
-
mongo (~> 2.1)
|
132
|
-
origin (~> 2.1)
|
133
|
-
tzinfo (>= 0.3.37)
|
134
|
-
mongoid-compatibility (0.3.1)
|
135
|
-
activesupport
|
136
|
-
mongoid (>= 2.0)
|
137
|
-
mongoid-history (0.5.0)
|
138
|
-
activesupport
|
139
|
-
easy_diff
|
140
|
-
mongoid (>= 3.0)
|
141
|
-
mongoid-compatibility
|
142
|
-
mongoid-slug (5.1.1)
|
143
|
-
mongoid (>= 3.0)
|
144
|
-
mongoid-compatibility
|
145
|
-
stringex (~> 2.0)
|
146
105
|
nokogiri (1.6.6.2)
|
147
106
|
mini_portile (~> 0.6.0)
|
148
|
-
origin (2.1.1)
|
149
|
-
orm_adapter (0.5.0)
|
150
107
|
rack (1.6.1)
|
151
108
|
rack-test (0.6.3)
|
152
109
|
rack (>= 1.0)
|
@@ -175,11 +132,9 @@ GEM
|
|
175
132
|
rake (>= 0.8.7)
|
176
133
|
thor (>= 0.18.1, < 2.0)
|
177
134
|
rake (10.4.2)
|
178
|
-
redcarpet (3.3.
|
135
|
+
redcarpet (3.3.4)
|
179
136
|
render_anywhere (0.0.12)
|
180
137
|
rails (>= 3.0.7)
|
181
|
-
responders (2.1.0)
|
182
|
-
railties (>= 4.2.0, < 5)
|
183
138
|
ruby-progressbar (1.7.5)
|
184
139
|
sprockets (3.1.0)
|
185
140
|
rack (~> 1.0)
|
@@ -187,13 +142,10 @@ GEM
|
|
187
142
|
actionpack (>= 3.0)
|
188
143
|
activesupport (>= 3.0)
|
189
144
|
sprockets (>= 2.8, < 4.0)
|
190
|
-
stringex (2.5.2)
|
191
145
|
thor (0.19.1)
|
192
146
|
thread_safe (0.3.5)
|
193
147
|
tzinfo (1.2.2)
|
194
148
|
thread_safe (~> 0.1)
|
195
|
-
warden (1.2.3)
|
196
|
-
rack (>= 1.0)
|
197
149
|
xpath (2.0.0)
|
198
150
|
nokogiri (~> 1.3)
|
199
151
|
|
@@ -214,4 +166,4 @@ DEPENDENCIES
|
|
214
166
|
rake (~> 10.0)
|
215
167
|
|
216
168
|
BUNDLED WITH
|
217
|
-
1.
|
169
|
+
1.11.2
|
data/README.md
CHANGED
@@ -2,14 +2,19 @@
|
|
2
2
|
|
3
3
|
*Easy way to connect Rails templates content to CMS*
|
4
4
|
|
5
|
-
Mark content that you want to change via CMS in Rails templates. It's
|
5
|
+
Mark content that you want to change via CMS in Rails templates. It's
|
6
|
+
automatically populated to models and is accessible via CMS. When Rails renders
|
7
|
+
template it pulls editable content from databased automatically.
|
6
8
|
|
9
|
+
This gem intendent to be used with
|
10
|
+
[Character](https://github.com/slates-studio/character) based project to satisfy
|
11
|
+
all dependencies.
|
7
12
|
|
8
13
|
## Setup
|
9
14
|
|
10
15
|
Add to ```Gemfile```:
|
11
16
|
|
12
|
-
gem "inverter"
|
17
|
+
gem "inverter"
|
13
18
|
|
14
19
|
Setup initializer ```config/initializers/inverter.rb```:
|
15
20
|
|
@@ -36,15 +41,18 @@ class Page
|
|
36
41
|
include Mongoid::Document
|
37
42
|
include Mongoid::Timestamps
|
38
43
|
include Mongoid::Inverter
|
39
|
-
include
|
44
|
+
include UnderscoreId
|
40
45
|
end
|
41
46
|
```
|
42
47
|
|
43
|
-
Setup admin page controller configuration ```controllers/admin/pages_controller.rb```:
|
48
|
+
Setup admin page controller configuration ```controllers/admin/api/pages_controller.rb```:
|
44
49
|
|
45
50
|
```ruby
|
46
|
-
|
47
|
-
|
51
|
+
module Admin
|
52
|
+
module Api
|
53
|
+
class PagesController < BaseController
|
54
|
+
end
|
55
|
+
end
|
48
56
|
end
|
49
57
|
```
|
50
58
|
|
@@ -177,27 +185,3 @@ To sync all inverter objects with template changes run:
|
|
177
185
|
rake inverter:sync
|
178
186
|
|
179
187
|
**You might need to run this command on production after deploy if some templates blocks were changed.**
|
180
|
-
|
181
|
-
|
182
|
-
## Inverter Family:
|
183
|
-
|
184
|
-
- [Character](https://github.com/slate-studio/chr): Powerful responsive javascript CMS for apps
|
185
|
-
- [Mongosteen](https://github.com/slate-studio/mongosteen): An easy way to add RESTful actions for Mongoid models
|
186
|
-
- [Inverter](https://github.com/slate-studio/inverter): An easy way to connect Rails templates content to Character CMS
|
187
|
-
- [Loft](https://github.com/slate-studio/loft): Media assets manager for Character CMS
|
188
|
-
|
189
|
-
|
190
|
-
## License
|
191
|
-
|
192
|
-
Copyright © 2015 [Slate Studio, LLC](http://slatestudio.com). Inverter is free software, and may be redistributed under the terms specified in the [license](LICENSE.md).
|
193
|
-
|
194
|
-
|
195
|
-
## About Slate Studio
|
196
|
-
|
197
|
-
[![Slate Studio](https://slate-git-images.s3-us-west-1.amazonaws.com/slate.png)](http://slatestudio.com)
|
198
|
-
|
199
|
-
Inverter is maintained and funded by [Slate Studio, LLC](http://slatestudio.com). Tweet your questions or suggestions to [@slatestudio](https://twitter.com/slatestudio) and while you’re at it follow us too.
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
@@ -1,22 +1,16 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
# Author: Alexander Kravets <alex@slatestudio.com>,
|
3
3
|
# Slate Studio (http://www.slatestudio.com)
|
4
|
-
#
|
5
|
-
# Coding Guide:
|
6
|
-
# https://github.com/thoughtbot/guides/tree/master/style/coffeescript
|
7
|
-
# -----------------------------------------------------------------------------
|
8
|
-
|
9
4
|
# -----------------------------------------------------------------------------
|
10
5
|
# INPUT INVERTER IMAGE
|
11
6
|
#
|
12
7
|
# Dependencies:
|
13
8
|
# - Loft character plugin for assets management
|
14
9
|
# - Chr input string implementation
|
15
|
-
#
|
16
10
|
# -----------------------------------------------------------------------------
|
17
11
|
class @InputInverterImage extends InputString
|
18
12
|
|
19
|
-
# PRIVATE
|
13
|
+
# PRIVATE ===================================================================
|
20
14
|
|
21
15
|
_add_input: ->
|
22
16
|
@_normalize_value()
|
@@ -28,13 +22,11 @@ class @InputInverterImage extends InputString
|
|
28
22
|
@$el.append @$input
|
29
23
|
@$input.val(@value)
|
30
24
|
|
31
|
-
|
32
25
|
@_add_image()
|
33
26
|
@_add_choose_button()
|
34
27
|
@_add_remove_button()
|
35
28
|
@_add_alt()
|
36
29
|
|
37
|
-
|
38
30
|
_normalize_value: ->
|
39
31
|
if @value && @value.indexOf('<img') > -1
|
40
32
|
@value = @value.replace(new RegExp('"', 'g'), "'")
|
@@ -44,13 +36,10 @@ class @InputInverterImage extends InputString
|
|
44
36
|
else
|
45
37
|
@value = "<img src='' alt='' />"
|
46
38
|
|
47
|
-
|
48
39
|
_alt: -> $(@value).attr('alt')
|
49
40
|
|
50
|
-
|
51
41
|
_src: -> $(@value).attr('src')
|
52
42
|
|
53
|
-
|
54
43
|
_add_alt: ->
|
55
44
|
@$altInput =$ "<input type='text' value='' placeholder='Text alternative (alt)' />"
|
56
45
|
@$el.append @$altInput
|
@@ -61,18 +50,15 @@ class @InputInverterImage extends InputString
|
|
61
50
|
newAlt = $(e.target).val()
|
62
51
|
@_update_value(@_src(), newAlt)
|
63
52
|
|
64
|
-
|
65
53
|
_update_alt: ->
|
66
54
|
@$altInput.val(@_alt())
|
67
55
|
if @_src() == '' then @$altInput.hide() else @$altInput.show()
|
68
56
|
|
69
|
-
|
70
57
|
_add_image: ->
|
71
58
|
@$image =$ "<a href='' target='_blank' class='image'><img src='' /></a>"
|
72
59
|
@$el.append @$image
|
73
60
|
@_update_image()
|
74
61
|
|
75
|
-
|
76
62
|
_update_image: ->
|
77
63
|
imageUrl = @_src()
|
78
64
|
if imageUrl == ''
|
@@ -83,7 +69,6 @@ class @InputInverterImage extends InputString
|
|
83
69
|
@$image.attr('href', imageUrl).children().attr('src', imageUrl)
|
84
70
|
@$image.show()
|
85
71
|
|
86
|
-
|
87
72
|
_add_choose_button: ->
|
88
73
|
@$actions =$ "<span class='input-actions'></span>"
|
89
74
|
@$label.append @$actions
|
@@ -100,19 +85,16 @@ class @InputInverterImage extends InputString
|
|
100
85
|
alt = @_alt() || objects[0].name
|
101
86
|
@_update_value(newSrc, alt)
|
102
87
|
|
103
|
-
|
104
88
|
_update_choose_button_title: ->
|
105
89
|
title = if @value == '' then 'Choose or upload' else 'Choose other or upload'
|
106
90
|
@$chooseBtn.html(title)
|
107
91
|
|
108
|
-
|
109
92
|
_update_value: (src, alt) ->
|
110
93
|
value = @value
|
111
94
|
value = value.replace("src='#{ @_src() }'", "src='#{ src }'")
|
112
95
|
value = value.replace("alt='#{ @_alt() }'", "alt='#{ alt }'")
|
113
96
|
@updateValue(value)
|
114
97
|
|
115
|
-
|
116
98
|
_add_remove_button: ->
|
117
99
|
@$removeBtn =$ "<a href='#' class='remove'>Remove</a>"
|
118
100
|
@$el.append @$removeBtn
|
@@ -122,8 +104,7 @@ class @InputInverterImage extends InputString
|
|
122
104
|
if confirm('Are you sure?')
|
123
105
|
@updateValue('')
|
124
106
|
|
125
|
-
|
126
|
-
# PUBLIC ================================================
|
107
|
+
# PUBLIC ====================================================================
|
127
108
|
|
128
109
|
updateValue: (@value) ->
|
129
110
|
@_normalize_value()
|
@@ -133,9 +114,4 @@ class @InputInverterImage extends InputString
|
|
133
114
|
@_update_image()
|
134
115
|
@_update_alt()
|
135
116
|
|
136
|
-
|
137
|
-
chr.formInputs['inverter-image'] = InputInverterImage
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
117
|
+
formagicInputs['inverter-image'] = InputInverterImage
|
@@ -1,28 +1,21 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
# Author: Alexander Kravets <alex@slatestudio.com>,
|
3
3
|
# Slate Studio (http://www.slatestudio.com)
|
4
|
-
#
|
5
|
-
# Coding Guide:
|
6
|
-
# https://github.com/thoughtbot/guides/tree/master/style/coffeescript
|
7
|
-
# -----------------------------------------------------------------------------
|
8
|
-
|
9
4
|
# -----------------------------------------------------------------------------
|
10
5
|
# INPUT INVERTER LINK
|
11
6
|
# - depends on Loft character plugin for assets management
|
12
7
|
# -----------------------------------------------------------------------------
|
13
8
|
class @InputInverterLink extends InputString
|
14
9
|
|
15
|
-
# PRIVATE
|
10
|
+
# PRIVATE ===================================================================
|
16
11
|
|
17
12
|
_has_empty_value: ->
|
18
13
|
return ($(@value).attr('href') == '' && $(@value).html() == '')
|
19
14
|
|
20
|
-
|
21
15
|
_normalize_value: ->
|
22
16
|
if ! (@value.indexOf('<a') > -1)
|
23
17
|
@value = "<a title='' href=''></a>"
|
24
18
|
|
25
|
-
|
26
19
|
_add_input: ->
|
27
20
|
@$input =$ "<input type='hidden' name='#{ @name }' value='' />"
|
28
21
|
@$el.append @$input
|
@@ -34,19 +27,15 @@ class @InputInverterLink extends InputString
|
|
34
27
|
@_add_url()
|
35
28
|
@_add_actions()
|
36
29
|
|
37
|
-
|
38
30
|
_update_value: (url, title) ->
|
39
31
|
$wrapper =$ "<div>#{ @value }</div>"
|
40
32
|
$wrapper.children().attr('href', url).attr('title', title).html(title)
|
41
33
|
@updateValue($wrapper.html())
|
42
34
|
|
43
|
-
|
44
35
|
_title: -> $(@value).html()
|
45
36
|
|
46
|
-
|
47
37
|
_url: -> $(@value).attr('href')
|
48
38
|
|
49
|
-
|
50
39
|
_add_title: ->
|
51
40
|
@$titleInput =$ "<input type='text' value='' placeholder='Title' />"
|
52
41
|
@$el.append @$titleInput
|
@@ -57,7 +46,6 @@ class @InputInverterLink extends InputString
|
|
57
46
|
newTitle = $(e.target).val()
|
58
47
|
@_update_value(@_url(), newTitle)
|
59
48
|
|
60
|
-
|
61
49
|
_add_url: ->
|
62
50
|
@$urlInput =$ "<input type='text' value='' placeholder='URL' />"
|
63
51
|
@$el.append @$urlInput
|
@@ -68,7 +56,6 @@ class @InputInverterLink extends InputString
|
|
68
56
|
newUrl = $(e.target).val()
|
69
57
|
@_update_value(newUrl, @_title())
|
70
58
|
|
71
|
-
|
72
59
|
_add_actions: ->
|
73
60
|
@$actions =$ "<span class='input-actions'></span>"
|
74
61
|
@$label.append @$actions
|
@@ -76,7 +63,6 @@ class @InputInverterLink extends InputString
|
|
76
63
|
@_add_choose_button()
|
77
64
|
@_add_remove_button()
|
78
65
|
|
79
|
-
|
80
66
|
_add_choose_button: ->
|
81
67
|
@$chooseBtn =$ "<a href='#' class='choose'>Choose or upload a file</a>"
|
82
68
|
@$actions.append @$chooseBtn
|
@@ -88,7 +74,6 @@ class @InputInverterLink extends InputString
|
|
88
74
|
title = @_title() || objects[0].name
|
89
75
|
@_update_value(url, title)
|
90
76
|
|
91
|
-
|
92
77
|
_add_remove_button: ->
|
93
78
|
@$removeBtn =$ "<a href='#' class='remove'>Remove</a>"
|
94
79
|
@$actions.append @$removeBtn
|
@@ -97,8 +82,7 @@ class @InputInverterLink extends InputString
|
|
97
82
|
e.preventDefault()
|
98
83
|
@_update_value('', '')
|
99
84
|
|
100
|
-
|
101
|
-
# PUBLIC ================================================
|
85
|
+
# PUBLIC ====================================================================
|
102
86
|
|
103
87
|
updateValue: (@value) ->
|
104
88
|
@_normalize_value()
|
@@ -114,9 +98,4 @@ class @InputInverterLink extends InputString
|
|
114
98
|
|
115
99
|
@$input.trigger('change')
|
116
100
|
|
117
|
-
|
118
|
-
chr.formInputs['inverter-link'] = InputInverterLink
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
101
|
+
formagicInputs['inverter-link'] = InputInverterLink
|
@@ -1,11 +1,6 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
# Author: Alexander Kravets <alex@slatestudio.com>,
|
3
3
|
# Slate Studio (http://www.slatestudio.com)
|
4
|
-
#
|
5
|
-
# Coding Guide:
|
6
|
-
# https://github.com/thoughtbot/guides/tree/master/style/coffeescript
|
7
|
-
# -----------------------------------------------------------------------------
|
8
|
-
|
9
4
|
# -----------------------------------------------------------------------------
|
10
5
|
# INPUT INVERTER VERSION SELECT
|
11
6
|
# -----------------------------------------------------------------------------
|
@@ -19,7 +14,6 @@ class @InputInverterVersion extends InputSelect
|
|
19
14
|
|
20
15
|
@$el =$ "<div class='input-#{ @config.type } #{ @config.klass } #{ @config.klassName }'>"
|
21
16
|
|
22
|
-
|
23
17
|
_add_input: ->
|
24
18
|
@$input =$ """<select name='#{ @name }'></select>"""
|
25
19
|
@$el.append @$input
|
@@ -28,15 +22,9 @@ class @InputInverterVersion extends InputSelect
|
|
28
22
|
|
29
23
|
@_add_options()
|
30
24
|
|
31
|
-
|
32
25
|
_load_version: ->
|
33
26
|
version = @$input.val()
|
34
27
|
$.get @url, { version: version }, (object) ->
|
35
28
|
chr.module.view.form.updateValues(object)
|
36
29
|
|
37
|
-
|
38
|
-
chr.formInputs['inverter-version'] = InputInverterVersion
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
30
|
+
formagicInputs['inverter-version'] = InputInverterVersion
|
@@ -1,11 +1,6 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
2
|
# Author: Alexander Kravets <alex@slatestudio.com>,
|
3
3
|
# Slate Studio (http://www.slatestudio.com)
|
4
|
-
#
|
5
|
-
# Coding Guide:
|
6
|
-
# https://github.com/thoughtbot/guides/tree/master/style/coffeescript
|
7
|
-
# -----------------------------------------------------------------------------
|
8
|
-
|
9
4
|
# -----------------------------------------------------------------------------
|
10
5
|
# INPUT INVERTER
|
11
6
|
# -----------------------------------------------------------------------------
|
@@ -19,7 +14,6 @@ if ! @_slugify
|
|
19
14
|
.replace(/\-\-+/g, '-') # Replace multiple - with single -
|
20
15
|
.trim() # Trim - from start/end of text
|
21
16
|
|
22
|
-
|
23
17
|
class @InputInverter
|
24
18
|
constructor: (@name, @value, @config, @object) ->
|
25
19
|
@startsWith = @config.startsWith
|
@@ -34,13 +28,11 @@ class @InputInverter
|
|
34
28
|
|
35
29
|
return this
|
36
30
|
|
37
|
-
|
38
|
-
# PRIVATE ===============================================
|
31
|
+
# PRIVATE ===================================================================
|
39
32
|
|
40
33
|
_create_el: ->
|
41
34
|
@$el =$ "<div class='input-#{ @config.type } #{ @config.klassName }'>"
|
42
35
|
|
43
|
-
|
44
36
|
_add_input: (name, value) ->
|
45
37
|
inputConfig = $.extend {}, @config
|
46
38
|
|
@@ -55,7 +47,7 @@ class @InputInverter
|
|
55
47
|
inputType ?= @config.defaultInputType || 'text'
|
56
48
|
inputType = $.trim(inputType)
|
57
49
|
|
58
|
-
if !
|
50
|
+
if ! formagicInputs[inputType]
|
59
51
|
inputType = 'text'
|
60
52
|
|
61
53
|
if @startsWith
|
@@ -70,7 +62,7 @@ class @InputInverter
|
|
70
62
|
inputConfig.klassName = 'inverter-block-' + _slugify(inputConfig.label)
|
71
63
|
inputConfig.klass ?= 'stacked'
|
72
64
|
|
73
|
-
inputClass =
|
65
|
+
inputClass = formagicInputs[inputType]
|
74
66
|
|
75
67
|
# here we have @config.namePrefix undefined, so the second case works
|
76
68
|
# where @name is [_blocks] and name is the name of the block
|
@@ -82,8 +74,7 @@ class @InputInverter
|
|
82
74
|
|
83
75
|
return new inputClass(inputName, value, inputConfig, @object)
|
84
76
|
|
85
|
-
|
86
|
-
# PUBLIC ================================================
|
77
|
+
# PUBLIC ====================================================================
|
87
78
|
|
88
79
|
initialize: ->
|
89
80
|
for name, input of @inputs
|
@@ -91,7 +82,6 @@ class @InputInverter
|
|
91
82
|
|
92
83
|
@config.onInitialize?(this)
|
93
84
|
|
94
|
-
|
95
85
|
hash: (hash={}) ->
|
96
86
|
obj = {}
|
97
87
|
# workaround for using block names to have consistency
|
@@ -102,20 +92,12 @@ class @InputInverter
|
|
102
92
|
hash[@config.klassName] = obj
|
103
93
|
return hash
|
104
94
|
|
105
|
-
|
106
95
|
updateValue: (@value) ->
|
107
96
|
for key, input of @inputs
|
108
97
|
input.updateValue(@value[key])
|
109
98
|
|
110
|
-
|
111
99
|
showErrorMessage: (message) -> ;
|
112
100
|
|
113
|
-
|
114
101
|
hideErrorMessage: -> ;
|
115
102
|
|
116
|
-
|
117
|
-
chr.formInputs['inverter'] = InputInverter
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
103
|
+
formagicInputs['inverter'] = InputInverter
|
@@ -1,11 +1,9 @@
|
|
1
|
-
//
|
2
1
|
// Styles for Inverter Character CMS plugin, this should be included in
|
3
2
|
// admin.scss (default)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
.view.has-unsaved-changes .input-inverter-version select { opacity: .25; }
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
.view.has-unsaved-changes .input-inverter-version .error-message:after {
|
4
|
+
content: 'You have unsaved changes.';
|
5
|
+
}
|
11
6
|
|
7
|
+
.view.has-unsaved-changes .input-inverter-version select {
|
8
|
+
opacity: .25;
|
9
|
+
}
|
data/inverter.gemspec
CHANGED
@@ -23,25 +23,14 @@ pulled from databased automatically.
|
|
23
23
|
s.files = `git ls-files`.split("\n")
|
24
24
|
s.require_paths = ['lib']
|
25
25
|
|
26
|
-
s.add_dependency
|
27
|
-
s.add_dependency
|
28
|
-
s.add_dependency('meta-tags', '>= 2.0')
|
29
|
-
s.add_dependency('mongoid-history', '>= 0.4.7')
|
30
|
-
s.add_dependency('mongoid-slug', '>= 4.0.0')
|
31
|
-
s.add_dependency('redcarpet', '>= 3.2.3')
|
32
|
-
s.add_dependency('awesome_print', '>= 1.6.1')
|
26
|
+
s.add_dependency "render_anywhere", ">= 0.0.10"
|
27
|
+
s.add_dependency "redcarpet", ">= 3.2.3"
|
33
28
|
|
34
29
|
s.add_development_dependency 'bundler', '~> 1.9'
|
35
|
-
s.add_development_dependency 'rake',
|
36
|
-
|
37
|
-
# automated tests
|
30
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
38
31
|
s.add_development_dependency 'rails', '~> 4.1.2'
|
39
32
|
s.add_development_dependency 'database_cleaner'
|
40
33
|
s.add_development_dependency 'factory_girl_rails'
|
41
34
|
s.add_development_dependency 'minitest-reporters'
|
42
35
|
s.add_development_dependency 'minitest-focus'
|
43
36
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "history_tracker"
|
2
|
+
|
1
3
|
module Mongoid
|
2
4
|
module Inverter
|
3
5
|
extend ActiveSupport::Concern
|
@@ -6,8 +8,8 @@ module Mongoid
|
|
6
8
|
include Mongoid::Timestamps
|
7
9
|
include Mongoid::Slug
|
8
10
|
include Mongoid::History::Trackable
|
9
|
-
include
|
10
|
-
include
|
11
|
+
include PageMeta
|
12
|
+
include DocumentVersions
|
11
13
|
|
12
14
|
# ATTRIBUTES
|
13
15
|
field :_template_name
|
data/lib/inverter/engine.rb
CHANGED
data/lib/inverter/version.rb
CHANGED
data/lib/inverter.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require "mongoid_slug"
|
2
|
-
require "mongoid-history"
|
3
|
-
require "history_tracker"
|
4
1
|
require "redcarpet"
|
5
2
|
|
6
3
|
require "inverter/concerns/inverter"
|
@@ -20,8 +17,5 @@ module Inverter
|
|
20
17
|
extend Object
|
21
18
|
end
|
22
19
|
|
23
|
-
require "meta_tags"
|
24
|
-
require "ants"
|
25
|
-
|
26
20
|
ActionController::Base.send :include, Inverter::ControllerHelper
|
27
|
-
ActionView::TemplateRenderer.send :include, Inverter::TemplateRendererHelper
|
21
|
+
ActionView::TemplateRenderer.send :include, Inverter::TemplateRendererHelper
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inverter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kravets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: ants
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.4
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.4
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: render_anywhere
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,48 +24,6 @@ dependencies:
|
|
38
24
|
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: 0.0.10
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: meta-tags
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2.0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '2.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: mongoid-history
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.4.7
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.4.7
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: mongoid-slug
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 4.0.0
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 4.0.0
|
83
27
|
- !ruby/object:Gem::Dependency
|
84
28
|
name: redcarpet
|
85
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,20 +38,6 @@ dependencies:
|
|
94
38
|
- - ">="
|
95
39
|
- !ruby/object:Gem::Version
|
96
40
|
version: 3.2.3
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: awesome_print
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 1.6.1
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 1.6.1
|
111
41
|
- !ruby/object:Gem::Dependency
|
112
42
|
name: bundler
|
113
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,10 +147,8 @@ extensions: []
|
|
217
147
|
extra_rdoc_files: []
|
218
148
|
files:
|
219
149
|
- ".gitignore"
|
220
|
-
- CONTRIBUTING.md
|
221
150
|
- Gemfile
|
222
151
|
- Gemfile.lock
|
223
|
-
- LICENSE.md
|
224
152
|
- README.md
|
225
153
|
- Rakefile
|
226
154
|
- app/assets/javascripts/inputs/inverter-image.coffee
|
@@ -324,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
324
252
|
version: '0'
|
325
253
|
requirements: []
|
326
254
|
rubyforge_project: inverter
|
327
|
-
rubygems_version: 2.
|
255
|
+
rubygems_version: 2.5.1
|
328
256
|
signing_key:
|
329
257
|
specification_version: 4
|
330
258
|
summary: An easy way to connect Rails templates content to CMS.
|
data/CONTRIBUTING.md
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
We love pull requests. Here’s a quick guide:
|
2
|
-
|
3
|
-
1. Fork the repository.
|
4
|
-
2. Make your changes in a topic branch.
|
5
|
-
3. Squash your commits into a single one (more on that [here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)).
|
6
|
-
4. Rebase against `origin/master`, push to your fork and submit a pull request.
|
7
|
-
5. If you are writing a new feature please add documentation for it by making another pull request to the `gh-pages` branch.
|
8
|
-
|
9
|
-
At this point you’re waiting on us. We like to at least comment on, if not
|
10
|
-
accept, pull requests within three business days (and, typically, one business
|
11
|
-
day). We may suggest some changes or improvements or alternatives.
|
12
|
-
|
13
|
-
Some things that will increase the chance that your pull request is accepted:
|
14
|
-
|
15
|
-
* Fix a bug, refactor code or expand an existing feature.
|
16
|
-
* Use the right syntax and naming conventions.
|
17
|
-
* Update parts of the documentation that are affected by your contribution.
|
18
|
-
|
19
|
-
**Git Commit Messages**
|
20
|
-
|
21
|
-
* Capitalize your commit messages.
|
22
|
-
* Start your message with a verb.
|
23
|
-
* Use present tense.
|
24
|
-
* Refer to the issue/PR number in your squashed commit message.
|
data/LICENSE.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright © 2015 [Slate Studio, LLC](http://slatestudio.com)
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the “Software”), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|