scrivito_advanced_editors 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/scripts/create_obj.js +32 -0
- data/app/assets/stylesheets/scrivito_advanced_editors/scrivito_dialog.css +6 -0
- data/app/helpers/scrivito_advanced_editors/scrivito_advanced_tag_helper.rb +1 -1
- data/app/views/scrivito_advanced_editors/_create_obj.html.erb +1 -1
- data/lib/scrivito_advanced_editors/version.rb +1 -1
- metadata +3 -3
- data/app/assets/javascripts/scripts/create_obj.js.coffee +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8987ece4796972dad54d5cfb8a023c5b6896a79
|
4
|
+
data.tar.gz: 52afb057c120ce7d8440e99a2900061e74001059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8df9c7408cb4381463f0af49abd7ff65f2a73f3462bf52c37271a1503dd6c85623b5e2cd64b5b26ec15425c89cc592301d77fab2e8d0133ae51f9d8b23573c4a
|
7
|
+
data.tar.gz: c62225183df650bda205b17ff62dcce9263db22d27e419f70a271896929177ce0d1607a1c07564b1b1665da883257f0183f1a06538bf6a71e310e6ef73ee138d
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$(function() {
|
2
|
+
return scrivito.on('content', function() {
|
3
|
+
var elements = $('.create_obj');
|
4
|
+
|
5
|
+
return elements.each(function(index, element) {
|
6
|
+
var elem = $(element);
|
7
|
+
var obj_class = elem.data('obj-class');
|
8
|
+
var obj_path = elem.data('obj-path');
|
9
|
+
var with_date = elem.data('with-date')
|
10
|
+
|
11
|
+
return elem.on('submit', function() {
|
12
|
+
var name = elem.find('input').val();
|
13
|
+
var now = new Date();
|
14
|
+
var isoDate = now.toISOString().replace(/[^0-9]/g, '');
|
15
|
+
|
16
|
+
var options = {
|
17
|
+
_obj_class: obj_class,
|
18
|
+
_path: (obj_path + "/") + isoDate,
|
19
|
+
title: name || (obj_class + "_" + isoDate)
|
20
|
+
}
|
21
|
+
|
22
|
+
if(with_date != "") {
|
23
|
+
jQuery.extend({with_date: now}, options)
|
24
|
+
}
|
25
|
+
|
26
|
+
return scrivito.create_obj(options).done(function(data) {
|
27
|
+
return $('body').trigger("scrivito_reload");
|
28
|
+
});
|
29
|
+
});
|
30
|
+
});
|
31
|
+
});
|
32
|
+
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if scrivito_in_editable_view? %>
|
2
|
-
<form class="create_obj" data-obj-class="<%= obj_class %>" data-obj-path="<%= obj_path %>">
|
2
|
+
<form class="create_obj" data-with-date="<%= with_date %>" data-obj-class="<%= obj_class %>" data-obj-path="<%= obj_path %>">
|
3
3
|
<input type="text" name="title" class="create_obj_name form-control" placeholder="Name for new obj (optional)">
|
4
4
|
<button class="btn btn-primary">
|
5
5
|
<%= "Create new #{obj_class}" %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_advanced_editors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,7 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- LICENSE
|
77
77
|
- Rakefile
|
78
|
-
- app/assets/javascripts/scripts/create_obj.js
|
78
|
+
- app/assets/javascripts/scripts/create_obj.js
|
79
79
|
- app/assets/javascripts/scripts/jquery.caret.min.js
|
80
80
|
- app/assets/javascripts/scripts/jquery.tag-editor.min.js
|
81
81
|
- app/assets/javascripts/scripts/scrivito_list_editor.js
|
@@ -1,24 +0,0 @@
|
|
1
|
-
$ ->
|
2
|
-
scrivito.on 'content', ->
|
3
|
-
elements = $('.create_obj')
|
4
|
-
|
5
|
-
elements.each (index, element) ->
|
6
|
-
elem = $(element)
|
7
|
-
|
8
|
-
obj_class = elem.data('obj-class')
|
9
|
-
obj_path = elem.data('obj-path')
|
10
|
-
|
11
|
-
|
12
|
-
elem.on 'submit', ->
|
13
|
-
name = elem.find('input').val()
|
14
|
-
now = new Date()
|
15
|
-
isoDate = now.toISOString().replace(/[^0-9]/g, '')
|
16
|
-
|
17
|
-
scrivito
|
18
|
-
.create_obj
|
19
|
-
_obj_class: obj_class
|
20
|
-
_path: "#{obj_path}/" + isoDate
|
21
|
-
title: name || "#{obj_class}_#{isoDate}"
|
22
|
-
published_at: now
|
23
|
-
.done (data) ->
|
24
|
-
$('body').trigger("scrivito_reload")
|