ng_on_rails 0.0.3.7 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/assets/javascripts/directives/shared.js.coffee +10 -1
- data/app/helpers/ng_on_rails_helper.rb +6 -4
- data/lib/ng_on_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93285a45d0781b80469f0f66f4e345eb87a0c96c
|
4
|
+
data.tar.gz: a9e54cb600e22921599ccb578483c0f2d9857e03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e93bfdcce2b87b6f1500ca100edab5da8839b7c421cf5d1bfa4432dd1c78aafa983e60e2645f18cc206158afedf9dd3d91cd4e34cdd7bff4d42ea558f1484216
|
7
|
+
data.tar.gz: 67c19da7f9ceff2b2cd87a540baeb6abd50becf205e1b81d99bc04b8b8a66d9c02a28903a2680e12abdc4a21dddfdb836b376ccc9bde2fc7bbaa898fa6df12c2
|
data/README.md
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
*A Rails inspired framework for using AngularJS with Rails*
|
8
8
|
|
9
|
+
**IMPORTANT!!! The key parts of this project, namely the Rails-Service and the render(View) directives are working properly. However there were some breaking changes with Angular 1.3 and I've been updating my thoughts on best practices. All this is leading to new ideas on how the generators should work. Moreover, talk of Angular 2.0 has called into question the logic of continuing this project as it is now. I'll be making updates so I can use it with projects I am personally working on but it probably won't be actively maintained until after Angular 2.0 comes out and there is a complete overhaul**
|
10
|
+
|
9
11
|
**This project is in active development. Check back often for updates and be very careful when using with any production app.**
|
10
12
|
|
11
13
|
This gem aims to standardize and simplify how AngularJS is integrated within a rails application. The hope is to push towards a *convention-over-configuration* approach with using AngularJS with rails.
|
@@ -2,9 +2,18 @@
|
|
2
2
|
# NgOnRails: Render Directives
|
3
3
|
#
|
4
4
|
|
5
|
+
set_data = (scope,el,attrs)->
|
6
|
+
if !!attrs['data']
|
7
|
+
scope.data = angular.copy(scope.data) || {}
|
8
|
+
data_array = attrs['data'].split(";")
|
9
|
+
for data in data_array
|
10
|
+
key_val_arr = data.split("=")
|
11
|
+
scope.data[key_val_arr[0].trim()] = scope.$eval(key_val_arr[1].trim())
|
12
|
+
|
5
13
|
NgOnRailsApp.directive "renderView", ->
|
6
14
|
restrict: "AE",
|
7
15
|
transclude: true,
|
16
|
+
link: set_data,
|
8
17
|
template: (el,attrs)->
|
9
18
|
format = attrs.format || "html"
|
10
19
|
'<div ng_include="\'/angular_app/'+attrs.url+'.'+format+'\'"></div>'
|
@@ -12,6 +21,7 @@ NgOnRailsApp.directive "renderView", ->
|
|
12
21
|
NgOnRailsApp.directive "render", ->
|
13
22
|
restrict: "AE",
|
14
23
|
transclude: true,
|
24
|
+
link: set_data,
|
15
25
|
template: (el,attrs)->
|
16
26
|
format = attrs.format || "html"
|
17
27
|
url_parts = attrs.url.split("/")
|
@@ -22,7 +32,6 @@ NgOnRailsApp.directive "render", ->
|
|
22
32
|
path = url_parts.join("/")
|
23
33
|
'<div ng_include="\'/angular_app/'+path+'.'+format+'\'"></div>'
|
24
34
|
|
25
|
-
|
26
35
|
#
|
27
36
|
# NgOnRails: View Helper Directives
|
28
37
|
#
|
@@ -11,10 +11,10 @@ module NgOnRailsHelper
|
|
11
11
|
if ng_data.blank?
|
12
12
|
rv = instance_var
|
13
13
|
else
|
14
|
-
unless ng_data[name] == "IGNORE"
|
15
|
-
if instance_var.is_a?(ActiveRecord::Base)
|
14
|
+
unless ng_data[name] == "IGNORE"
|
15
|
+
if instance_var.is_a?(ActiveRecord::Base) || instance_var.is_a?(ActiveRecord::Relation)
|
16
16
|
if !ng_data[name]
|
17
|
-
if !!ng_data["BUILD"]
|
17
|
+
if !!ng_data["BUILD"]
|
18
18
|
rv = build(name,instance_var)
|
19
19
|
else
|
20
20
|
rv = instance_var
|
@@ -25,6 +25,8 @@ module NgOnRailsHelper
|
|
25
25
|
path = ng_data[name][:path]
|
26
26
|
model_name = ng_data[name][:as] || name
|
27
27
|
rv = build(model_name,instance_var,path)
|
28
|
+
else
|
29
|
+
rv = instance_var
|
28
30
|
end
|
29
31
|
else
|
30
32
|
rv = instance_var
|
@@ -44,7 +46,7 @@ module NgOnRailsHelper
|
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
47
|
-
return locals_hash.to_json
|
49
|
+
return escape_javascript(locals_hash.to_json)
|
48
50
|
end
|
49
51
|
|
50
52
|
private
|
data/lib/ng_on_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ng_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brookie Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: angularjs-rails
|