styxie 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d2156cfb84c6af5e34dc8519e9c45cddbfe9c1f
4
- data.tar.gz: f4b9bcb8b735cc5285fa1fbe75828db219e5c121
3
+ metadata.gz: 23e361b31cee7cf8fc8ccb700048313cdc7e9400
4
+ data.tar.gz: b357462d86d9afb4f4b1b5b7a6f942315634e31e
5
5
  SHA512:
6
- metadata.gz: abdd26d978c1334c0138bf9fefd442f0ec21c39f5af03c5ad8eccd2aa66064538237fb09265af1f2e8e09167552dcb00ed3f42faf3e44ab066dd72d96452c4a1
7
- data.tar.gz: 6588c7c4ea55f3aacad4cdace62cfb55a4e3e4bf590e4ecf13a72991c086f05f88481442ee9ec20e6a5970e834fec0a3d6487e984aac5329ce5f4857e08b3689
6
+ metadata.gz: 05ea6cbc7a0404fe01db7fbc1eef51e757369d044eb5880448dc3f1fb0ddc0a053510a9e21aaf58e8e7910c9ada5ed56796ef98e611d67412e36f1daa8a19773
7
+ data.tar.gz: 41918856f00e1ca78e3ec7556935835c49e5e95e1d64dd9b180730235bdacfbbefa237070e358e729db3f6418621259937136dfc2bfa6e05474db3774eeb9853
data/README.md CHANGED
@@ -13,7 +13,7 @@ In your Gemfile, add this line:
13
13
 
14
14
  In your assets application.js include appropriate libs:
15
15
 
16
- //= require styx <- Helpers and Initializers
16
+ //= require styxie <- Helpers and Initializers
17
17
 
18
18
  ## Basic Usage
19
19
 
@@ -40,7 +40,7 @@ To enable initializers bootstrap, add *styx_initialize* call into your layout:
40
40
  <title>Rails Application</title>
41
41
  <%= stylesheet_link_tag "application" %>
42
42
  <%= javascript_include_tag "application" %>
43
- <%= styx_initialize %>
43
+ <%= styxie_initialize %>
44
44
  <%= csrf_meta_tags %>
45
45
  ```
46
46
 
@@ -66,12 +66,12 @@ initializers you can use *styxie_initialize_with* helper in your controller or v
66
66
  # app/controllers/foos_controller.rb
67
67
  class FoosController < ApplicationController
68
68
  def index
69
- styx_initialize_with some: 'data', and: { even: 'more data' }
69
+ styxie_initialize_with some: 'data', and: { even: 'more data' }
70
70
  end
71
71
  end
72
72
 
73
73
  # app/views/foos/index.html.erb
74
- <%- styx_initialize_with enabled: true %>
74
+ <%- styxie_initialize_with enabled: true %>
75
75
  ```
76
76
 
77
77
  As the result *Styxie.Initializers.Foos->index* will be called with data equal to
@@ -6,11 +6,21 @@ module Styxie
6
6
  end
7
7
 
8
8
  def styxie_initialize(klass: styxie_class, method: action_name, data: styxie_configuration)
9
- result = render_to_string partial: 'styxie/initializer', locals: {
10
- klass: klass,
11
- method: method,
12
- data: data
13
- }
9
+ json = data.to_json
10
+ result = <<-CODE
11
+ <script type="text/javascript">
12
+ //<![CDATA[
13
+ if (Styxie.Initializers.#{klass} && Styxie.Initializers.#{klass}.initialize)
14
+ {
15
+ Styxie.Initializers.#{klass}.initialize(#{json});
16
+ }
17
+ if (Styxie.Initializers.#{klass} && Styxie.Initializers.#{klass}['#{method}'])
18
+ {
19
+ Styxie.Initializers.#{klass}['#{method}'](#{json});
20
+ }
21
+ //]]>
22
+ </script>
23
+ CODE
14
24
 
15
25
  result.html_safe
16
26
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Styxie
4
+ VERSION = '0.0.2'.freeze
5
+ end
data/styxie.gemspec CHANGED
@@ -1,10 +1,15 @@
1
1
  # frozen_string_literal: true
2
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
+
4
+ # Maintain your gem's version:
5
+ require 'styxie/version'
6
+
2
7
  Gem::Specification.new do |s|
3
8
  s.name = 'styxie'
4
- s.version = '0.0.1'
9
+ s.version = Styxie::VERSION
5
10
  s.platform = Gem::Platform::RUBY
6
11
  s.summary = 'Set of helpers to maintain bridge between Server side and Client (JS) side'
7
- s.email = 'dev@httplab.ru'
12
+ s.email = 'non.gi.suong@ya.ru, dev@httplab.ru'
8
13
  s.homepage = 'http://github.com/httplab/styxie'
9
14
  s.description = s.summary
10
15
  s.authors = ['Yury Kotov', 'Httplab']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: styxie
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
  - Yury Kotov
@@ -13,7 +13,7 @@ date: 2016-09-03 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Set of helpers to maintain bridge between Server side and Client (JS)
15
15
  side
16
- email: dev@httplab.ru
16
+ email: non.gi.suong@ya.ru, dev@httplab.ru
17
17
  executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
@@ -27,13 +27,13 @@ files:
27
27
  - README.md
28
28
  - Rakefile
29
29
  - app/assets/javascripts/styxie.js.coffee
30
- - app/views/styxie/_initializer.html.erb
31
30
  - docker-compose.yml
32
31
  - init.rb
33
32
  - lib/styxie.rb
34
33
  - lib/styxie/engine.rb
35
34
  - lib/styxie/helpers.rb
36
35
  - lib/styxie/initializer.rb
36
+ - lib/styxie/version.rb
37
37
  - spec/controllers/tests_controller_spec.rb
38
38
  - spec/internal/app/controllers/tests_controller.rb
39
39
  - spec/internal/app/views/tests/index.html.erb
@@ -1,12 +0,0 @@
1
- <script type="text/javascript">
2
- //<![CDATA[
3
- if (Styxie.Initializers.<%=klass%> && Styxie.Initializers.<%=klass%>.initialize)
4
- {
5
- Styxie.Initializers.<%=klass%>.initialize(<%=data.to_json.html_safe%>);
6
- }
7
- if (Styxie.Initializers.<%=klass%> && Styxie.Initializers.<%=klass%>['<%=method%>'])
8
- {
9
- Styxie.Initializers.<%=klass%>['<%=method%>'](<%=data.to_json.html_safe%>);
10
- }
11
- //]]>
12
- </script>