ucpengine 0.0.1 → 0.0.2
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 +4 -4
- data/app/assets/javascripts/ucpengine/application.js +2 -0
- data/app/assets/javascripts/ucpengine/entries.js +0 -46
- data/app/assets/javascripts/ucpengine/live-preview.js +46 -0
- data/app/assets/stylesheets/ucpengine/application.scss +6 -0
- data/app/views/ucpengine/entries/_form.html.erb +9 -9
- data/app/views/ucpengine/entries/index.html.erb +5 -8
- data/app/views/ucpengine/entries/new.html.erb +1 -4
- data/config/routes.rb +2 -2
- data/lib/ucpengine/version.rb +1 -1
- metadata +2 -2
- /data/app/views/ucpengine/previews/{shot.html.erb → show.html.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da3fc2347e5716f9f549a545bd6cb3a9cde5e32b
|
4
|
+
data.tar.gz: 78a135ad4902cd88f5adc3e97d5731fdb70be421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1f8227352d67cb0432409aee74d2305258825696235df972e7814c86519d72e4946ce8b313d81a4c5dad5b6e812a61eb8851fe2368cc3ed6c14cd584dedce52
|
7
|
+
data.tar.gz: df0c1fb82035d91a70eee4d32e829273fc3747aa388966dac758f9e22ef16a3ad185326003ff8d78305879d24b8c4c595437f87c2e77d9181e67e8121c206b76
|
@@ -1,46 +0,0 @@
|
|
1
|
-
|
2
|
-
var Ucpengine = Ucpengine || {};
|
3
|
-
|
4
|
-
Ucpengine.Utils = {
|
5
|
-
// Source: https://remysharp.com/2010/07/21/throttling-function-calls
|
6
|
-
debounce: function(fn, delay) {
|
7
|
-
var timer = null;
|
8
|
-
return function () {
|
9
|
-
var context = this, args = arguments;
|
10
|
-
clearTimeout(timer);
|
11
|
-
timer = setTimeout(function () {
|
12
|
-
fn.apply(context, args);
|
13
|
-
}, delay);
|
14
|
-
};
|
15
|
-
}
|
16
|
-
};
|
17
|
-
|
18
|
-
Ucpengine.LivePreview = {
|
19
|
-
selectors: {
|
20
|
-
textarea: 'form textarea',
|
21
|
-
preview: '#live-preview'
|
22
|
-
},
|
23
|
-
|
24
|
-
initialize: function() {
|
25
|
-
$(document).on('keyup', this.selectors.textarea, Ucpengine.Utils.debounce(this.generatePreview.bind(this), 200));
|
26
|
-
},
|
27
|
-
|
28
|
-
generatePreview: function(event) {
|
29
|
-
var preview = $(this.selectors.preview);
|
30
|
-
var previewUrl = preview.attr('data-preview-url');
|
31
|
-
|
32
|
-
$.ajax({
|
33
|
-
type: 'POST',
|
34
|
-
url: previewUrl,
|
35
|
-
data: {
|
36
|
-
text: event.target.value
|
37
|
-
},
|
38
|
-
|
39
|
-
success: function(data) {
|
40
|
-
preview.html(data);
|
41
|
-
}
|
42
|
-
});
|
43
|
-
}
|
44
|
-
};
|
45
|
-
|
46
|
-
Ucpengine.LivePreview.initialize();
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
var Ucpengine = Ucpengine || {};
|
3
|
+
|
4
|
+
Ucpengine.Utils = {
|
5
|
+
// Source: https://remysharp.com/2010/07/21/throttling-function-calls
|
6
|
+
debounce: function(fn, delay) {
|
7
|
+
var timer = null;
|
8
|
+
return function () {
|
9
|
+
var context = this, args = arguments;
|
10
|
+
clearTimeout(timer);
|
11
|
+
timer = setTimeout(function () {
|
12
|
+
fn.apply(context, args);
|
13
|
+
}, delay);
|
14
|
+
};
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
Ucpengine.LivePreview = {
|
19
|
+
selectors: {
|
20
|
+
textarea: 'form textarea',
|
21
|
+
preview: '#live-preview'
|
22
|
+
},
|
23
|
+
|
24
|
+
initialize: function() {
|
25
|
+
$(document).on('keyup', this.selectors.textarea, Ucpengine.Utils.debounce(this.generatePreview.bind(this), 200));
|
26
|
+
},
|
27
|
+
|
28
|
+
generatePreview: function(event) {
|
29
|
+
var preview = $(this.selectors.preview);
|
30
|
+
var previewUrl = preview.attr('data-preview-url');
|
31
|
+
|
32
|
+
$.ajax({
|
33
|
+
type: 'POST',
|
34
|
+
url: previewUrl,
|
35
|
+
data: {
|
36
|
+
text: event.target.value
|
37
|
+
},
|
38
|
+
|
39
|
+
success: function(data) {
|
40
|
+
preview.html(data);
|
41
|
+
}
|
42
|
+
});
|
43
|
+
}
|
44
|
+
};
|
45
|
+
|
46
|
+
Ucpengine.LivePreview.initialize();
|
@@ -1,25 +1,25 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<div class="
|
1
|
+
<div class="row tos-form">
|
2
|
+
<div class="col s6">
|
3
3
|
<%= form_for(@entry, as: :entry, url: @entry.persisted? ? content_entry_path(@entry) : entries_path) do |f| %>
|
4
4
|
<%= f.hidden_field :type, value: @entry.type %>
|
5
5
|
|
6
6
|
<%= f.label :version %>
|
7
7
|
<%= f.text_field :version %>
|
8
8
|
|
9
|
+
<!--
|
9
10
|
<%= f.label :published_at %>
|
10
11
|
<%= f.text_field :published_at %>
|
12
|
+
-->
|
11
13
|
|
12
|
-
|
13
|
-
<%= f.text_field :termsofservice %>
|
14
|
-
|
14
|
+
<p>Terms of Service</p>
|
15
15
|
<% @entry.class.content_attributes.each do |attr_name, attr_type| %>
|
16
|
-
<%= f.
|
16
|
+
<%= f.text_area attr_name, as: attr_type %>
|
17
17
|
<% end %>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
18
|
<%= f.submit "Save" %>
|
22
19
|
<% end %>
|
20
|
+
</div>
|
21
|
+
<div class="col s5">
|
22
|
+
<p>Terms of Service Preview</p>
|
23
23
|
<div id="live-preview" data-preview-url="<%= preview_path %>"></div>
|
24
24
|
</div>
|
25
25
|
</div>
|
@@ -1,13 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%= link_to "New #{content_class.titleize}", new_content_entry_path, class: 'btn btn-primary space-2' %>
|
4
|
-
|
5
|
-
<ul class="collection">
|
1
|
+
<ul class="collection with-header">
|
2
|
+
<li class="collection-header"><h4>Recent Terms of Service <br><%= link_to "New #{content_class.titleize}", new_content_entry_path %></h4></li>
|
6
3
|
<% @entries.each do |entry| %>
|
7
4
|
<li class="collection-item">
|
8
|
-
<%= link_to entry.
|
9
|
-
<%= time_ago_in_words entry.created_at %> ago
|
10
|
-
|
5
|
+
Version: <%= link_to entry.version, content_entry_path(entry) %>
|
6
|
+
Created <%= time_ago_in_words entry.created_at %> ago
|
7
|
+
|
11
8
|
<%= link_to 'Edit', edit_content_entry_path(entry) %>
|
12
9
|
<%= link_to 'Destroy', content_entry_path(entry), method: :delete, data: { confirm: 'Are you sure?' } %>
|
13
10
|
</li>
|
data/config/routes.rb
CHANGED
data/lib/ucpengine/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucpengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- johnvehr
|
@@ -210,7 +210,7 @@ files:
|
|
210
210
|
- app/views/ucpengine/entries/index.html.erb
|
211
211
|
- app/views/ucpengine/entries/new.html.erb
|
212
212
|
- app/views/ucpengine/entries/show.html.erb
|
213
|
-
- app/views/ucpengine/previews/
|
213
|
+
- app/views/ucpengine/previews/show.html.erb
|
214
214
|
- config/locales/simple_form.en.yml
|
215
215
|
- config/routes.rb
|
216
216
|
- db/migrate/20161028170915_create_ucpengine_entries.rb
|
File without changes
|