easy_data 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -0
- data/Rakefile +4 -0
- data/easy_data.gemspec +4 -1
- data/lib/controllers/easy_datas_controller.rb +122 -21
- data/lib/data_models/data_models.rb +25 -19
- data/lib/data_models/model_rdf.rb +156 -0
- data/lib/data_models/namespaces/cc.rb +36 -0
- data/lib/data_models/namespaces/cert.rb +33 -0
- data/lib/data_models/namespaces/dc.rb +87 -0
- data/lib/data_models/namespaces/dc11.rb +47 -0
- data/lib/data_models/namespaces/doap.rb +68 -0
- data/lib/data_models/namespaces/exif.rb +192 -0
- data/lib/data_models/namespaces/foaf.rb +93 -0
- data/lib/data_models/namespaces/geo.rb +35 -0
- data/lib/data_models/namespaces/http.rb +50 -0
- data/lib/data_models/namespaces/owl.rb +83 -0
- data/lib/data_models/namespaces/rdfs.rb +41 -0
- data/lib/data_models/namespaces/rsa.rb +35 -0
- data/lib/data_models/namespaces/rss.rb +38 -0
- data/lib/data_models/namespaces/sioc.rb +110 -0
- data/lib/data_models/namespaces/skos.rb +61 -0
- data/lib/data_models/namespaces/wot.rb +45 -0
- data/lib/data_models/namespaces/xhtml.rb +32 -0
- data/lib/data_models/namespaces/xsd.rb +77 -0
- data/lib/data_models/namespaces.rb +28 -0
- data/lib/data_models/parser_rdf.rb +22 -0
- data/lib/easy_data/tasks.rb +86 -0
- data/lib/easy_data/templates/easy_datas/_list_properties.html.erb +24 -0
- data/lib/easy_data/templates/easy_datas/_list_properties_edit.html.erb +34 -0
- data/lib/easy_data/templates/easy_datas/_model_attributes.html.erb +27 -0
- data/lib/easy_data/templates/easy_datas/_model_attributes_edit.html.erb +13 -0
- data/lib/easy_data/templates/easy_datas/custom_rdf.html.erb +23 -0
- data/lib/easy_data/templates/easy_datas/show.html.erb +1 -0
- data/lib/easy_data/templates/easy_datas/show.xml.builder +16 -0
- data/lib/easy_data/templates/layouts/easy_data_layout.html.erb +15 -0
- data/lib/easy_data/templates/rdf/request.xml.builder +1 -0
- data/lib/easy_data/templates/rdf/show.builder +1 -0
- data/lib/easy_data/templates/stylesheets/.easy_data_style.css.swp +0 -0
- data/lib/easy_data/templates/stylesheets/easy_data_style.css +10 -0
- data/lib/easy_data/version.rb +1 -1
- data/lib/easy_data.rb +51 -2
- data/lib/routes.rb +38 -6
- data/lib/tasks/.rakes.rb.swp +0 -0
- data/lib/tasks/testing_installation.rb +2 -2
- metadata +72 -6
@@ -0,0 +1,110 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class SIOC < Namespaces
|
4
|
+
|
5
|
+
@@uri = "http://rdfs.org/sioc/ns#"
|
6
|
+
|
7
|
+
@@properties= {"about" => "",
|
8
|
+
"account_of" => "",
|
9
|
+
"administrator_of" => "",
|
10
|
+
"attachment" => "",
|
11
|
+
"avatar" => "",
|
12
|
+
"container_of" => "",
|
13
|
+
"content" => "",
|
14
|
+
"content_encoded" => "", # @deprecated
|
15
|
+
"created_at" => "", # @deprecated
|
16
|
+
"creator_of" => "",
|
17
|
+
"description" => "", # @deprecated
|
18
|
+
"earlier_version" => "",
|
19
|
+
"email" => "",
|
20
|
+
"email_sha1" => "",
|
21
|
+
"feed" => "",
|
22
|
+
"first_name" => "", # @deprecated
|
23
|
+
"follows" => "",
|
24
|
+
"function_of" => "",
|
25
|
+
"group_of" => "", # @deprecated
|
26
|
+
"has_administrator" => "",
|
27
|
+
"has_container" => "",
|
28
|
+
"has_creator" => "",
|
29
|
+
"has_discussion" => "",
|
30
|
+
"has_function" => "",
|
31
|
+
"has_group" => "", # @deprecated
|
32
|
+
"has_host" => "",
|
33
|
+
"has_member" => "",
|
34
|
+
"has_moderator" => "",
|
35
|
+
"has_modifier" => "",
|
36
|
+
"has_owner" => "",
|
37
|
+
"has_parent" => "",
|
38
|
+
"has_part" => "", # @deprecated
|
39
|
+
"has_reply" => "",
|
40
|
+
"has_scope" => "",
|
41
|
+
"has_space" => "",
|
42
|
+
"has_subscriber" => "",
|
43
|
+
"has_usergroup" => "",
|
44
|
+
"host_of" => "",
|
45
|
+
"id" => "",
|
46
|
+
"ip_address" => "",
|
47
|
+
"last_activity_date" => "",
|
48
|
+
"last_item_date" => "",
|
49
|
+
"last_name" => "", # @deprecated
|
50
|
+
"last_reply_date" => "",
|
51
|
+
"later_version" => "",
|
52
|
+
"latest_version" => "",
|
53
|
+
"link" => "",
|
54
|
+
"links_to" => "",
|
55
|
+
"member_of" => "",
|
56
|
+
"moderator_of" => "",
|
57
|
+
"modified_at" => "", # @deprecated
|
58
|
+
"modifier_of" => "",
|
59
|
+
"name" => "",
|
60
|
+
"next_by_date" => "",
|
61
|
+
"next_version" => "",
|
62
|
+
"note" => "",
|
63
|
+
"num_authors" => "",
|
64
|
+
"num_items" => "",
|
65
|
+
"num_replies" => "",
|
66
|
+
"num_threads" => "",
|
67
|
+
"num_views" => "",
|
68
|
+
"owner_of" => "",
|
69
|
+
"parent_of" => "",
|
70
|
+
"part_of" => "", # @deprecated
|
71
|
+
"previous_by_date" => "",
|
72
|
+
"previous_version" => "",
|
73
|
+
"reference" => "", # @deprecated
|
74
|
+
"related_to" => "",
|
75
|
+
"reply_of" => "",
|
76
|
+
"scope_of" => "",
|
77
|
+
"sibling" => "",
|
78
|
+
"space_of" => "",
|
79
|
+
"subject" => "", # @deprecated
|
80
|
+
"subscriber_of" => "",
|
81
|
+
"title" => "", # @deprecated
|
82
|
+
"topic" => "",
|
83
|
+
"usergroup_of" => ""
|
84
|
+
}
|
85
|
+
|
86
|
+
# Return Namespace URI
|
87
|
+
def self.get_uri
|
88
|
+
@@uri
|
89
|
+
end
|
90
|
+
|
91
|
+
# Return tag to rdf doc
|
92
|
+
def self.to_s(property,uri,value)
|
93
|
+
@@properties[property].gsub("%uri%",uri).gsub('%value%',value)
|
94
|
+
end
|
95
|
+
|
96
|
+
#Return a list of Namespace's properties
|
97
|
+
def self.properties
|
98
|
+
@@properties.keys
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.properties_form
|
102
|
+
list = {}
|
103
|
+
@@properties.keys.each do |property|
|
104
|
+
list[property] = property
|
105
|
+
end
|
106
|
+
list
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class SKOS < Namespaces
|
4
|
+
|
5
|
+
@@uri = "http://www.w3.org/2004/02/skos/core#"
|
6
|
+
|
7
|
+
@@properties= {"altLabel" => "",
|
8
|
+
"broadMatch" => "",
|
9
|
+
"broader" => "",
|
10
|
+
"broaderTransitive" => "",
|
11
|
+
"changeNote" => "",
|
12
|
+
"closeMatch" => "",
|
13
|
+
"definition" => "",
|
14
|
+
"editorialNote" => "",
|
15
|
+
"exactMatch" => "",
|
16
|
+
"example" => "",
|
17
|
+
"hasTopConcept" => "",
|
18
|
+
"hiddenLabel" => "",
|
19
|
+
"historyNote" => "",
|
20
|
+
"inScheme" => "",
|
21
|
+
"mappingRelation" => "",
|
22
|
+
"member" => "",
|
23
|
+
"memberList" => "",
|
24
|
+
"narrowMatch" => "",
|
25
|
+
"narrower" => "",
|
26
|
+
"narrowerTransitive" => "",
|
27
|
+
"notation" => "",
|
28
|
+
"note" => "",
|
29
|
+
"prefLabel" => "",
|
30
|
+
"related" => "",
|
31
|
+
"relatedMatch" => "",
|
32
|
+
"scopeNote" => "",
|
33
|
+
"semanticRelation" => "",
|
34
|
+
"topConceptOf" => ""
|
35
|
+
}
|
36
|
+
|
37
|
+
# Return Namespace URI
|
38
|
+
def self.get_uri
|
39
|
+
@@uri
|
40
|
+
end
|
41
|
+
|
42
|
+
# Return tag to rdf doc
|
43
|
+
def self.to_s(property,uri,value)
|
44
|
+
@@properties[property].gsub("%uri%",uri).gsub('%value%',value)
|
45
|
+
end
|
46
|
+
|
47
|
+
#Return a list of Namespace's properties
|
48
|
+
def self.properties
|
49
|
+
@@properties.keys
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.properties_form
|
53
|
+
list = {}
|
54
|
+
@@properties.keys.each do |property|
|
55
|
+
list[property] = property
|
56
|
+
end
|
57
|
+
list
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class WOT < Namespaces
|
4
|
+
|
5
|
+
@@uri = "http://www.xmlns.com/wot/0.1/"
|
6
|
+
@@properties= {"assurance" => "",
|
7
|
+
"encryptedTo" => "",
|
8
|
+
"encrypter" => "",
|
9
|
+
"fingerprint" => "",
|
10
|
+
"hasKey" => "",
|
11
|
+
"hex_id" => "",
|
12
|
+
"identity" => "",
|
13
|
+
"length" => "",
|
14
|
+
"pubkeyAddress" => "",
|
15
|
+
"sigdate" => "",
|
16
|
+
"signed" => "",
|
17
|
+
"signer" => "",
|
18
|
+
"sigtime" => ""
|
19
|
+
}
|
20
|
+
|
21
|
+
# Return Namespace URI
|
22
|
+
def self.get_uri
|
23
|
+
@@uri
|
24
|
+
end
|
25
|
+
|
26
|
+
# Return tag to rdf doc
|
27
|
+
def self.to_s(property,uri,value)
|
28
|
+
@@properties[property].gsub("%uri%",uri).gsub('%value%',value)
|
29
|
+
end
|
30
|
+
|
31
|
+
#Return a list of Namespace's properties
|
32
|
+
def self.properties
|
33
|
+
@@properties.keys
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.properties_form
|
37
|
+
list = {}
|
38
|
+
@@properties.keys.each do |property|
|
39
|
+
list[property] = property
|
40
|
+
end
|
41
|
+
list
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class XHTML < Namespaces
|
4
|
+
@@uri = "http://www.w3.org/1999/xhtml/vocab#"
|
5
|
+
@@properties= {
|
6
|
+
}
|
7
|
+
|
8
|
+
# Return Namespace URI
|
9
|
+
def self.get_uri
|
10
|
+
@@uri
|
11
|
+
end
|
12
|
+
|
13
|
+
# Return tag to rdf doc
|
14
|
+
def self.to_s(property,uri,value)
|
15
|
+
@@properties[property].gsub("%uri%",uri).gsub('%value%',value)
|
16
|
+
end
|
17
|
+
|
18
|
+
#Return a list of Namespace's properties
|
19
|
+
def self.properties
|
20
|
+
@@properties.keys
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.properties_form
|
24
|
+
list = {}
|
25
|
+
@@properties.keys.each do |property|
|
26
|
+
list[property] = property
|
27
|
+
end
|
28
|
+
list
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class XSD < Namespaces
|
4
|
+
|
5
|
+
@@uri = "http://www.w3.org/2001/XMLSchema#"
|
6
|
+
|
7
|
+
@@properties= {"NOTATION" => "",
|
8
|
+
"QName" => "",
|
9
|
+
"anyURI" => "",
|
10
|
+
"base64Binary" => "",
|
11
|
+
"boolean" => "",
|
12
|
+
"date" => "",
|
13
|
+
"dateTime" => "",
|
14
|
+
"decimal" => "",
|
15
|
+
"double" => "",
|
16
|
+
"duration" => "",
|
17
|
+
"float" => "",
|
18
|
+
"gDay" => "",
|
19
|
+
"gMonth" => "",
|
20
|
+
"gMonthDay" => "",
|
21
|
+
"gYear" => "",
|
22
|
+
"gYearMonth" => "",
|
23
|
+
"hexBinary" => "",
|
24
|
+
"string" => "",
|
25
|
+
"time" => "",
|
26
|
+
"ENTITIES" => "", # XML Schema built-in derived types
|
27
|
+
"ENTITY" => "", # @see http://www.w3.org/TR/xmlschema-2/#built-in-derived
|
28
|
+
"ID" => "",
|
29
|
+
"IDREF" => "",
|
30
|
+
"IDREFS" => "",
|
31
|
+
"NCName" => "",
|
32
|
+
"NMTOKEN" => "",
|
33
|
+
"NMTOKENS" => "",
|
34
|
+
"Name" => "",
|
35
|
+
"byte" => "",
|
36
|
+
"int" => "",
|
37
|
+
"integer" => "",
|
38
|
+
"language" => "",
|
39
|
+
"long" => "",
|
40
|
+
"negativeInteger" => "",
|
41
|
+
"nonNegativeInteger" => "",
|
42
|
+
"nonPositiveInteger" => "",
|
43
|
+
"normalizedString" => "",
|
44
|
+
"positiveInteger" => "",
|
45
|
+
"short" => "",
|
46
|
+
"token" => "",
|
47
|
+
"unsignedByte" => "",
|
48
|
+
"unsignedInt" => "",
|
49
|
+
"unsignedLong" => "",
|
50
|
+
"unsignedShort" => ""
|
51
|
+
}
|
52
|
+
|
53
|
+
# Return Namespace URI
|
54
|
+
def self.get_uri
|
55
|
+
@@uri
|
56
|
+
end
|
57
|
+
|
58
|
+
# Return tag to rdf doc
|
59
|
+
def self.to_s(property,uri,value)
|
60
|
+
@@properties[property].gsub("%uri%",uri).gsub('%value%',value)
|
61
|
+
end
|
62
|
+
|
63
|
+
#Return a list of Namespace's properties
|
64
|
+
def self.properties
|
65
|
+
@@properties.keys
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.properties_form
|
69
|
+
list = {}
|
70
|
+
@@properties.keys.each do |property|
|
71
|
+
list[property] = property
|
72
|
+
end
|
73
|
+
list
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module EasyData
|
2
|
+
module RDF
|
3
|
+
class Namespaces
|
4
|
+
|
5
|
+
|
6
|
+
@@namespaces=['cc','cert','dc','dc11','doap','exif','foaf','geo','http','owl','rdfs','rsa','rss','sioc','skos','wot','xhtml','xsd']
|
7
|
+
|
8
|
+
def self.list
|
9
|
+
@@namespaces
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.list_form
|
13
|
+
list = {}
|
14
|
+
|
15
|
+
@@namespaces.each do |namespace|
|
16
|
+
list[namespace] = namespace
|
17
|
+
end
|
18
|
+
|
19
|
+
list
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.get_tag(attribute,namespace,property,value)
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class ParserRdf
|
2
|
+
|
3
|
+
def to_rdf(model)
|
4
|
+
rdf_info = ModelRdf.new
|
5
|
+
|
6
|
+
model_rdf = {}
|
7
|
+
|
8
|
+
rdf_info.get_attributes_model(model).each do |att|
|
9
|
+
model_rdf << parser_attribute(att)
|
10
|
+
end
|
11
|
+
|
12
|
+
model_rdf
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def parser_attribute(att,info_rdf)
|
20
|
+
{info_rdf => att}
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require "ftools"
|
2
|
+
require 'rake'
|
3
|
+
require 'easy_data'
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
|
7
|
+
namespace :easy_data do
|
8
|
+
|
9
|
+
desc <<-END_DESC
|
10
|
+
"This tasks install and initialize parameters for run gem."
|
11
|
+
END_DESC
|
12
|
+
task :install => [:generate_info_initialize,:generate_info_rdf,:copy_style_interface] do
|
13
|
+
puts "*** Finish install Easy Data gem in this proyect ***"
|
14
|
+
end
|
15
|
+
|
16
|
+
desc <<-END_DESC
|
17
|
+
"Generate info initialize gem"
|
18
|
+
END_DESC
|
19
|
+
task :generate_info_initialize => :environment do
|
20
|
+
|
21
|
+
easy_data_initialize_dir = "#{RAILS_ROOT}/config/initializers"
|
22
|
+
|
23
|
+
file = File.open("#{easy_data_initialize_dir}/load_easy_data.rb","w")
|
24
|
+
|
25
|
+
puts "Generating info initialize gem"
|
26
|
+
|
27
|
+
file.puts "#Load templates paths:"
|
28
|
+
file.puts "ActionController::Base.view_paths << EasyData.get_view_path"
|
29
|
+
|
30
|
+
|
31
|
+
file.close
|
32
|
+
end
|
33
|
+
|
34
|
+
desc <<-END_DESC
|
35
|
+
"Generating yml file with asociate info rdf to model's attributes"
|
36
|
+
END_DESC
|
37
|
+
task :generate_info_rdf => :environment do
|
38
|
+
|
39
|
+
puts "Generating RDF informations "
|
40
|
+
|
41
|
+
models = DataModels.load_models
|
42
|
+
|
43
|
+
easy_data_dir = "#{RAILS_ROOT}/config/easy_data"
|
44
|
+
|
45
|
+
unless File.exist? easy_data_dir
|
46
|
+
File.makedirs easy_data_dir
|
47
|
+
end
|
48
|
+
|
49
|
+
file = File.open("#{easy_data_dir}/rdf_info.yaml","w")
|
50
|
+
rdf_info = {}
|
51
|
+
|
52
|
+
file.puts "#This is a document about RDF descriptions"
|
53
|
+
|
54
|
+
models.each do |model|
|
55
|
+
|
56
|
+
model_data = DataModels.get_model_data(model)
|
57
|
+
|
58
|
+
if model_data.respond_to?:columns
|
59
|
+
|
60
|
+
rdf_info[model] = EasyData.yaml_description_model(model_data)
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
file.puts rdf_info.to_yaml
|
67
|
+
|
68
|
+
|
69
|
+
file.close
|
70
|
+
|
71
|
+
puts "Rdf Information Model, was generated in #{easy_data_dir}/rdf_info.yaml"
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
desc <<-END_DESC
|
76
|
+
"Copy style for custom rdf interface"
|
77
|
+
END_DESC
|
78
|
+
task :copy_style_interface => :environment do
|
79
|
+
|
80
|
+
file_style = EasyData.get_style_path
|
81
|
+
#Copy file to public/stylesheets:
|
82
|
+
puts "Copy Style File to this proyect"
|
83
|
+
File.copy(File.join(File.dirname(__FILE__), 'templates/stylesheets/easy_data_style.css'),"#{RAILS_ROOT}/public/stylesheets/easy_data_style.css")
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="attributes_info">
|
2
|
+
<%attributes.each do |att,properties|%>
|
3
|
+
<div class="property">
|
4
|
+
<span class="attribute"><%=att%></span>
|
5
|
+
<% unless properties[:namespace].nil?%>
|
6
|
+
<div id="privacy">
|
7
|
+
<span>Access privacy: </span>
|
8
|
+
<span><%= properties[:privacy] %></span>
|
9
|
+
</div>
|
10
|
+
<div id="<%="namespace"%>">
|
11
|
+
<span>Rdf Namespace: </span>
|
12
|
+
<span><%= properties[:namespace] -%></span>
|
13
|
+
</div>
|
14
|
+
<div id="<%= "property"%>">
|
15
|
+
<span>Property:</span>
|
16
|
+
<span><%=properties[:property] %></span>
|
17
|
+
</div>
|
18
|
+
<%else%>
|
19
|
+
<span>This attribute can't be publicate</span>
|
20
|
+
<%end%>
|
21
|
+
</div>
|
22
|
+
<br />
|
23
|
+
<%end%>
|
24
|
+
</div>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<div class="attributes_info">
|
2
|
+
<%attributes.each do |att,properties|%>
|
3
|
+
<div class="property">
|
4
|
+
<span class="attribute"><%=att%></span>
|
5
|
+
<br />
|
6
|
+
<% unless properties[:privacy].nil?%>
|
7
|
+
<div id="select_privacy">
|
8
|
+
<span>Access privacy: </span>
|
9
|
+
<%= select "privacy",att, {"Hidden" => 0,"Public" => 1,"Authenticated" => 2}%>
|
10
|
+
<span class="rdf_info"><%= "(Current value: #{properties[:privacy]})"%></span>
|
11
|
+
</div>
|
12
|
+
<br />
|
13
|
+
|
14
|
+
<div id="<%="select_#{model}_#{att}"%>">
|
15
|
+
<span>Rdf Type: </span>
|
16
|
+
<%= select "rdf_type_#{type}",att,namespaces,{:prompt => "Select a namespaces..."} -%>
|
17
|
+
<span class="rdf_info"><%= "(Current value: #{properties[:namespace]})" %></span>
|
18
|
+
</div>
|
19
|
+
<%= observe_field "rdf_type_#{type}_#{att}",{:url => {:controller => "easy_datas",:action => "load_properties",
|
20
|
+
:block=>"properties_#{att}",:attribute => att,:model => model,:type => type},
|
21
|
+
:with => '"id="+value',
|
22
|
+
:on => :selected,
|
23
|
+
:update => "properties_#{model}_#{att}"}
|
24
|
+
%>
|
25
|
+
<br/>
|
26
|
+
<div id="<%= "properties_#{model}_#{att}"%>"> </div>
|
27
|
+
<% else %>
|
28
|
+
<span> This attribute can't be publicate</span>
|
29
|
+
<% end%>
|
30
|
+
</div>
|
31
|
+
<br/>
|
32
|
+
<%end%>
|
33
|
+
</div>
|
34
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<div id="list_attributes" class="model_attributes">
|
2
|
+
|
3
|
+
<%if @model_attributes.respond_to?:each%>
|
4
|
+
<!-- ATTRIBUTES -->
|
5
|
+
<span>Resource Attributes</span>
|
6
|
+
<%= render :partial => "list_properties",:locals => {:attributes => @model_attributes["attributes"]} %>
|
7
|
+
<span>Associations whit others Resources</span>
|
8
|
+
<!--ASSOCIATIONS-->
|
9
|
+
<%= render :partial => "list_properties",:locals => {:attributes => @model_attributes["associations"]} %>
|
10
|
+
<%else%>
|
11
|
+
<span>Model no found</span>
|
12
|
+
<%end%>
|
13
|
+
<span>
|
14
|
+
<%= link_to_remote "Edit",:url => {:controller => 'easy_datas',
|
15
|
+
:action => :model_attributes_edit,
|
16
|
+
:model => @model},
|
17
|
+
:update => "#{@model}_attributes",
|
18
|
+
:success => "Effect.Appear('#{@model}_attributes', { duration: 0.4 })",
|
19
|
+
:failure => "alert('Ooops! An error occurred.')"
|
20
|
+
%>
|
21
|
+
</span>
|
22
|
+
|
23
|
+
<%= link_to_function "[Close]","Effect.Fade('#{@model}_attributes',{duration: .3})",:class=>"close_list"%>
|
24
|
+
|
25
|
+
</div>
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% form_remote_tag :url => {:controller => 'easy_datas',:action => "custom_attributes",:model => @model},
|
2
|
+
:update => "#{@model}_attributes" do -%>
|
3
|
+
<div id="list_attributes" class="model_attributes">
|
4
|
+
<!-- Attributes -->
|
5
|
+
<span>Attributes</span>
|
6
|
+
<%= render :partial => "list_properties_edit",:locals => {:attributes => @model_attributes["attributes"],:model => @model,:namespaces => @namespaces,:type => "attributes"}%>
|
7
|
+
<!--Associations-->
|
8
|
+
<span>Associations</span>
|
9
|
+
<%= render :partial => "list_properties_edit",:locals => {:attributes => @model_attributes["associations"],:model => @model,:namespaces => @namespaces,:type => "associations"}%>
|
10
|
+
<%= submit_tag "Send" %>
|
11
|
+
<%= link_to_function "[Close]","Effect.Fade('#{@model}_attributes',{duration: .3})",:class=>"close_list"%>
|
12
|
+
<%end -%>
|
13
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h2>Model List</h2>
|
2
|
+
<hr/>
|
3
|
+
<%if @models.respond_to?:each%>
|
4
|
+
<ul>
|
5
|
+
<%@models.each do |model|%>
|
6
|
+
<li class="list_model">
|
7
|
+
<h2><%= model %></h2>
|
8
|
+
<span><%= link_to_remote "Abrir",:url => {:controller => 'easy_datas',
|
9
|
+
:action => :model_attributes,
|
10
|
+
:model => model},
|
11
|
+
:update => "#{model}_attributes",
|
12
|
+
:success => "Effect.Appear('#{model}_attributes', { duration: 0.4 })",
|
13
|
+
:failure => "alert('Ooops! An error occurred.')"
|
14
|
+
%>
|
15
|
+
</span>
|
16
|
+
|
17
|
+
<div id="<%=model%>_attributes" class="list_attributes" style="display:none"></div>
|
18
|
+
</li>
|
19
|
+
<%end%>
|
20
|
+
</ul>
|
21
|
+
<%else%>
|
22
|
+
<h3> Not list model </h3>
|
23
|
+
<%end%>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Show template</h1>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
xml.instruct! :xml, :version => "1.0", :encoding => "UTF-8"
|
2
|
+
|
3
|
+
xml.rdf :RDF, @rdf_model[:header] do
|
4
|
+
@rdf_model[:body].each do |element,prop|
|
5
|
+
xml.rdf :Description, {:about => prop["description"]} do
|
6
|
+
prop["attributes"].each do |att,value|
|
7
|
+
xml.tag!(att,value)
|
8
|
+
end
|
9
|
+
prop["associations"].each do |assoc,value|
|
10
|
+
value[:id].each do |id|
|
11
|
+
xml.tag!(assoc,nil,{"rdf:resource"=>"#{@host}/#{value[:model]}/id:#{id}"})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
5
|
+
<title></title>
|
6
|
+
<%= javascript_include_tag(:defaults)%>
|
7
|
+
<%= stylesheet_link_tag "easy_data_style" %>
|
8
|
+
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="content">
|
12
|
+
<%= yield %>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
xml.instruct!
|
@@ -0,0 +1 @@
|
|
1
|
+
xml.instruct! :xml, :version => "1.0", :encoding => "UTF-8"
|
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
body{width:90%;padding: 2% 5%}
|
2
|
+
h1{color:red;text-decoration:underline}
|
3
|
+
ul{list-style:none;width:90%;float:left;}
|
4
|
+
ul li.list_model{color:white;background:grey}
|
5
|
+
ul div.list_attributes{overflow:hidden;background-color:white;color:black;padding:0 5%;}
|
6
|
+
ul.attributes_info{width:100%;clear:left;padding:0}
|
7
|
+
div.attributes_info{padding: 1% 3%;overflow:hidden}
|
8
|
+
div.attributes_info div.property{border-bottom:1px black solid;padding:1em}
|
9
|
+
div.attributes_info div.property span.attribute{font-size:1.15em;font-weight:bold;}
|
10
|
+
div.attributes_info div.property span.rdf_info{color:grey;font-size:12px}
|
data/lib/easy_data/version.rb
CHANGED