auth-transis-client 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,5 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
- gem.add_dependency ['omniauth', 'omniauth-oauth2' ]
19
+ gem.add_dependency 'omniauth'
20
+ gem.add_dependency 'omniauth-oauth2'
20
21
  end
@@ -1,4 +1,6 @@
1
1
  require "auth-transis-client/version"
2
+ require 'omniauth'
3
+ require 'omniauth-oauth2'
2
4
  require "omni_auth"
3
5
 
4
6
  module Auth
@@ -1,7 +1,7 @@
1
1
  module Auth
2
2
  module Transis
3
3
  module Client
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
data/lib/omni_auth.rb CHANGED
@@ -35,46 +35,47 @@ module OmniAuth
35
35
  <link href="http://wwwendt.de/tech/dynatree/src/skin/ui.dynatree.css" rel="stylesheet" type="text/css">
36
36
  <script src="http://wwwendt.de/tech/dynatree/src/jquery.dynatree.js" type="text/javascript"></script>
37
37
  <script type="text/javascript">
38
- var feature = function(organization_name, feature_name, selected){
39
- return {title: feature_name, key: {organization_name: organization_name, feature_name: feature_name}, select: selected};
40
- }
41
- var organization = function(name, selected){
42
- return {title: name, expand: true, key: name, children: [
43
- feature(name,'admin',selected),
44
- feature(name,'media_plan_creation',selected),
45
- feature(name,'media_plan_negotiation',selected),
46
- feature(name,'media_plan_analysis',selected),
47
- feature(name,'finance',selected)
48
- ]
49
- }
38
+ var updateRawInfoJsonFromTree = function(tree){
39
+ var rawInfo = {organizations: [], features: []};
40
+ organizationNames = [];
41
+ $.each(tree.getSelectedNodes(), function(index, node){
42
+ if(node.data.key.organization_name && organizationNames.indexOf(node.data.key.organization_name) == -1){
43
+ organizationNames.push(node.data.key.organization_name);
44
+ }
45
+ if(node.data.key.feature_name){
46
+ rawInfo.features.push({organization_id: organizationNames.indexOf(node.data.key.organization_name)+1, name: node.data.key.feature_name});
47
+ }
48
+ });
49
+ $.each(organizationNames, function(index, name){
50
+ rawInfo.organizations.push({id: index+1, name: name});
51
+ });
52
+ $('#raw_info_json')[0].value = JSON.stringify(rawInfo);
50
53
  }
51
- var organizations = [
52
- organization('Centro',true),
53
- organization('TransisTestAgency',false),
54
- organization('TransisTestPublisher',false),
55
- ];
56
54
  $(function(){
55
+ var feature = function(organization_name, feature_name, selected){
56
+ return {title: feature_name, key: {organization_name: organization_name, feature_name: feature_name}, select: selected};
57
+ }
58
+ var organization = function(name, selected){
59
+ return {title: name, expand: true, key: name, children: [
60
+ feature(name,'admin',selected),
61
+ feature(name,'media_plan_creation',selected),
62
+ feature(name,'media_plan_negotiation',selected),
63
+ feature(name,'media_plan_analysis',selected),
64
+ feature(name,'finance',selected)
65
+ ]
66
+ }
67
+ }
68
+ var organizations = [
69
+ organization('Centro',true),
70
+ organization('TransisTestAgency',false),
71
+ organization('TransisTestPublisher',false),
72
+ ];
57
73
  $("#raw_info").dynatree({
58
74
  checkbox: true,
59
75
  selectMode: 3,
60
76
  children: organizations,
61
77
  onSelect: function(select, node) {
62
- // Get a list of all selected nodes, and convert to a key array:
63
- var rawInfo = {organizations: [], features: []};
64
- organizationNames = [];
65
- $.each(node.tree.getSelectedNodes(), function(index, node){
66
- if(node.data.key.organization_name && organizationNames.indexOf(node.data.key.organization_name) == -1){
67
- organizationNames.push(node.data.key.organization_name);
68
- }
69
- if(node.data.key.feature_name){
70
- rawInfo.features.push({organization_id: organizationNames.indexOf(node.data.key.organization_name)+1, name: node.data.key.feature_name});
71
- }
72
- });
73
- $.each(organizationNames, function(index, name){
74
- rawInfo.organizations.push({id: index+1, name: name});
75
- });
76
- $('#raw_info_json')[0].value = JSON.stringify(rawInfo);
77
-
78
+ updateRawInfoJsonFromTree(node.tree);
78
79
  },
79
80
  onDblClick: function(node, event) {
80
81
  node.toggleSelect();
@@ -86,6 +87,7 @@ module OmniAuth
86
87
  }
87
88
  },
88
89
  });
90
+ updateRawInfoJsonFromTree($('#raw_info').dynatree('getRoot').tree);
89
91
  });
90
92
  </script>
91
93
  HTML
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth-transis-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,9 +12,23 @@ cert_chain: []
12
12
  date: 2012-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name:
16
- - omniauth
17
- - omniauth-oauth2
15
+ name: omniauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: omniauth-oauth2
18
32
  requirement: !ruby/object:Gem::Requirement
19
33
  none: false
20
34
  requirements: