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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af78e3a3b3190e96e4629eca15575fb7263dc151
4
- data.tar.gz: 4a527b419de29ca230e321f7d1cb992381a225e1
3
+ metadata.gz: da3fc2347e5716f9f549a545bd6cb3a9cde5e32b
4
+ data.tar.gz: 78a135ad4902cd88f5adc3e97d5731fdb70be421
5
5
  SHA512:
6
- metadata.gz: 07f8239672326faa5914e19eea4e5a9ce80eef7d6af43b3f0d89fda1dd60731b9ce29e7287faf391eaead8b9d7bb1abc36d3562a447ffa3eb8cc033e03226203
7
- data.tar.gz: 0dc77ceaee151835a71cdf6785387ffd1864e2d361efa22f12c9d1790c0ced54552ad86942b66294fdb51e8d663cff46b2ea01d8eb817795a0ba40007fc9fede
6
+ metadata.gz: d1f8227352d67cb0432409aee74d2305258825696235df972e7814c86519d72e4946ce8b313d81a4c5dad5b6e812a61eb8851fe2368cc3ed6c14cd584dedce52
7
+ data.tar.gz: df0c1fb82035d91a70eee4d32e829273fc3747aa388966dac758f9e22ef16a3ad185326003ff8d78305879d24b8c4c595437f87c2e77d9181e67e8121c206b76
@@ -10,4 +10,6 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
+ //= require jquery
14
+ //= require jquery_ujs
13
15
  //= require_tree .
@@ -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();
@@ -59,3 +59,9 @@ nav {
59
59
  color:#28343a;
60
60
  }
61
61
  }
62
+
63
+ .tos-form{
64
+ .col {
65
+ padding:10px !important;
66
+ }
67
+ }
@@ -1,25 +1,25 @@
1
- <div class="row">
2
- <div class="container">
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
- <%= f.label :termsofservice %>
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.text_field attr_name, as: attr_type %>
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
- <%= content_class.tableize.titleize %>
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.termsofservice, content_entry_path(entry) %>
9
- <%= time_ago_in_words entry.created_at %> ago
10
- <%= entry.version %>
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>
@@ -1,7 +1,4 @@
1
- New <%= content_class.titleize %>
2
-
3
1
  <div class="row">
4
2
  <%= render 'form' %>
5
- </div>
6
-
7
3
  <%= link_to 'Back', content_entries_path %>
4
+ </div>
data/config/routes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  Ucpengine::Engine.routes.draw do
2
- post 'preview', to: 'preview#show', as: :preview
3
-
2
+ post 'preview', to: 'previews#show', as: :preview
3
+
4
4
  scope "/:content_class" do
5
5
  resources :entries
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module Ucpengine
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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/shot.html.erb
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