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: d73cd9565c1e6d90d3de1af3379e74452170ff61
4
- data.tar.gz: fce29d8eede22d34ba07f55904b5fc3307d73c2f
3
+ metadata.gz: 2935b1b6c9c2ae092abb179904d73a08a6ff94c5
4
+ data.tar.gz: 014643fe8175f88f1d41c64ba0d65e6c11adb13f
5
5
  SHA512:
6
- metadata.gz: c0341fda4baf0697160351806193c45b59636876fb302f19471ff3ff66caabbf3336ae1d574478b92d6b55d35cdd97e378a0159cfbc5a83ce00f2643fcb24ac7
7
- data.tar.gz: 02cb86dfd194ee6253a6c6a83efb3c60a551e5c824367b5cf19b2b9d0c5d14acdbdf6170c127d38d003fab0380875b4f6e3c42e431f06384634170ecfa704381
6
+ metadata.gz: 3eee49819019d2829a934034084e5b0ca151c96fb7f399d3da48191abfe6656bf30a9a003c2cacaa33034bdf25b026e99b4caf2fbbe2343b68b8031a0aeb0208
7
+ data.tar.gz: e870dc0d940f56fe767b5374a04271ed2706600bcf55b88bda5e777f01755f957d31261bc2d4dd5d85303c602b9741e3e2a0cad2c7098d0e08b8d3f133a4a530
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- inverter (0.5.0)
4
+ inverter (0.5.1)
5
5
  redcarpet (>= 3.2.3)
6
6
  render_anywhere (>= 0.0.10)
7
7
 
@@ -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 =$ "<a href='#' class='choose'>Choose or upload a file</a>"
76
+ @$chooseBtn =$ "<button>#{ Icons.upload }</button>"
77
77
  @$actions.append @$chooseBtn
78
78
 
79
- @_update_choose_button_title()
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 =$ "<a href='#' class='remove'>Remove</a>"
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 =$ "<a href='#' class='choose'>Choose or upload a file</a>"
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.showModal 'all', false, (objects) =>
73
- url = objects[0].file.url
74
- title = @_title() || objects[0].name
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
- # ATTRIBUTES
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
- # HISTORY
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
- # INDEXES
36
+ ## Indexes
38
37
  index({ _template_name: 1 })
39
38
  index({ _ignore_sync: 1 })
40
39
 
41
- # SLUG
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
- # returns title to be used in cms and identify page in list
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
-
@@ -1,3 +1,3 @@
1
1
  module Inverter
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
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.0
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-01-18 00:00:00.000000000 Z
11
+ date: 2016-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: render_anywhere