sketchily 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -7
- data/app/assets/javascripts/sketchily_embed.js +0 -2
- data/app/assets/javascripts/sketchily_embed.js~ +1 -0
- data/app/views/sketchily/_embed.html.erb +3 -3
- data/app/views/sketchily/_embed.html.erb~ +1 -2
- data/app/views/sketchily/_embed.js.erb +2 -0
- data/app/views/sketchily/_embed.js.erb~ +3 -6
- data/lib/sketchily/version.rb +1 -1
- data/lib/sketchily/version.rb~ +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -8,15 +8,27 @@ Currently supports and provides `svg-edit-2.6`.
|
|
8
8
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
|
+
```rb
|
11
12
|
gem 'sketchily'
|
13
|
+
```
|
12
14
|
|
13
15
|
And then execute:
|
14
16
|
|
17
|
+
```sh
|
15
18
|
$ bundle
|
19
|
+
```
|
16
20
|
|
17
21
|
Or install it yourself as:
|
18
22
|
|
23
|
+
```sh
|
19
24
|
$ gem install sketchily
|
25
|
+
```
|
26
|
+
|
27
|
+
Also make sure your `application.js` requires jquery (it usually does by default):
|
28
|
+
|
29
|
+
```js
|
30
|
+
//= require jquery
|
31
|
+
```sh
|
20
32
|
|
21
33
|
**Note:** sketchily will **automatically** add the following files to your asset precompilation list:
|
22
34
|
|
@@ -61,10 +73,10 @@ The following examples assume that the database table for `@my_object` has a `sk
|
|
61
73
|
|
62
74
|
Example usage (haml):
|
63
75
|
|
64
|
-
```haml
|
65
|
-
= form_for @my_object do |f|
|
66
|
-
|
67
|
-
```
|
76
|
+
```haml
|
77
|
+
= form_for @my_object do |f|
|
78
|
+
= f.sketchily :sketch, :hide_menu => true
|
79
|
+
```
|
68
80
|
|
69
81
|
### `sketchily_show` helper
|
70
82
|
|
@@ -80,9 +92,9 @@ Passing only one of those options should keep the aspect ratio of the SVG consta
|
|
80
92
|
|
81
93
|
Example usage (haml):
|
82
94
|
|
83
|
-
```haml
|
84
|
-
= sketchily_show @my_object.sketch, :width => "500"
|
85
|
-
```
|
95
|
+
```haml
|
96
|
+
= sketchily_show @my_object.sketch, :width => "500"
|
97
|
+
```
|
86
98
|
|
87
99
|
## Browser Support
|
88
100
|
|
@@ -15,6 +15,9 @@
|
|
15
15
|
|
16
16
|
<%= javascript_include_tag "sketchily_embed" %>
|
17
17
|
|
18
|
+
<iframe src="/assets/svg-editor.html?source=&dimensions=<%= "#{canvas_width},#{canvas_height}" %>&canvas_expansion=<%= canvas_expansion %>&showRulers=<%= !hide_rulers %>"
|
19
|
+
width="<%= width %>" height="<%= height %>" id="svgedit_<%= id %>"></iframe>
|
20
|
+
|
18
21
|
<script type="text/javascript">
|
19
22
|
<%= render :partial => "sketchily/embed",
|
20
23
|
:formats => :js,
|
@@ -24,6 +27,3 @@
|
|
24
27
|
:hide_image_tool => hide_image_tool,
|
25
28
|
:hide_hyperlink_tool => hide_hyperlink_tool} %>
|
26
29
|
</script>
|
27
|
-
|
28
|
-
<iframe src="/assets/svg-editor.html?source=&dimensions=<%= "#{canvas_width},#{canvas_height}" %>&canvas_expansion=<%= canvas_expansion %>&showRulers=<%= !hide_rulers %>"
|
29
|
-
width="<%= width %>" height="<%= height %>" id="svgedit_<%= id %>" onload="initEmbed_<%= id %>();"></iframe>
|
@@ -14,7 +14,6 @@
|
|
14
14
|
hide_hyperlink_tool ||= false %>
|
15
15
|
|
16
16
|
<%= javascript_include_tag "sketchily_embed" %>
|
17
|
-
<%= javascript_include_tag "svgutils" %>
|
18
17
|
|
19
18
|
<script type="text/javascript">
|
20
19
|
<%= render :partial => "sketchily/embed",
|
@@ -27,4 +26,4 @@
|
|
27
26
|
</script>
|
28
27
|
|
29
28
|
<iframe src="/assets/svg-editor.html?source=&dimensions=<%= "#{canvas_width},#{canvas_height}" %>&canvas_expansion=<%= canvas_expansion %>&showRulers=<%= !hide_rulers %>"
|
30
|
-
width="<%= width %>" height="<%= height %>" id="svgedit_<%= id %>"
|
29
|
+
width="<%= width %>" height="<%= height %>" id="svgedit_<%= id %>"></iframe>
|
@@ -22,15 +22,11 @@ function handleSvgData_<%= id %>(data, error) {
|
|
22
22
|
}
|
23
23
|
else {
|
24
24
|
$("input#<%= id %>").attr("value", svgedit.utilities.encode64("<?xml version=\"1.0\"?>\n" + data));
|
25
|
-
$("input#<%= id %>").closest("form").
|
25
|
+
$("input#<%= id %>").closest("form").submit();
|
26
26
|
attachSubmitHandler_<%= id %>();
|
27
27
|
}
|
28
28
|
}
|
29
29
|
|
30
|
-
function changef(window, elems) {
|
31
|
-
alert('changed');
|
32
|
-
});
|
33
|
-
|
34
30
|
function initEmbed_<%= id %>() {
|
35
31
|
var frame = document.getElementById('svgedit_<%= id %>');
|
36
32
|
svgCanvas_<%= id %> = new embedded_svg_edit(frame);
|
@@ -59,7 +55,8 @@ function initEmbed_<%= id %>() {
|
|
59
55
|
<% end %>
|
60
56
|
|
61
57
|
attachSubmitHandler_<%= id %>();
|
62
|
-
svgCanvas_<%= id %>.bind("changed", changef)();
|
63
58
|
|
64
59
|
svgCanvas_<%= id %>.setSvgString(svgedit.utilities.decode64("<%= value.try(:squish) %>"));
|
65
60
|
}
|
61
|
+
|
62
|
+
$().load(initEmbed_<%= id %>);
|
data/lib/sketchily/version.rb
CHANGED
data/lib/sketchily/version.rb~
CHANGED