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 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
- = f.sketchily :sketch, :hide_menu => true
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
 
@@ -1,4 +1,2 @@
1
- //= require jquery
2
- //= require jquery_ujs
3
1
  //= require embedapi
4
2
  //= require svgutils
@@ -1,3 +1,4 @@
1
1
  //= require jquery
2
+ //= require jquery_ujs
2
3
  //= require embedapi
3
4
  //= require svgutils
@@ -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 %>" onload="initEmbed_<%= id %>();"></iframe>
29
+ width="<%= width %>" height="<%= height %>" id="svgedit_<%= id %>"></iframe>
@@ -58,3 +58,5 @@ function initEmbed_<%= id %>() {
58
58
 
59
59
  svgCanvas_<%= id %>.setSvgString(svgedit.utilities.decode64("<%= value.try(:squish) %>"));
60
60
  }
61
+
62
+ $("#svgedit_<%= id %>").load(initEmbed_<%= id %>);
@@ -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").trigger("submit.rails");
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 %>);
@@ -1,3 +1,3 @@
1
1
  module Sketchily
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Sketchily
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sketchily
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: