easy_data 0.0.6 → 0.0.7

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.
Files changed (55) hide show
  1. data/.gitignore +1 -0
  2. data/.idea/EasyData.iml +11 -0
  3. data/.idea/encodings.xml +5 -0
  4. data/.idea/misc.xml +11 -0
  5. data/.idea/modules.xml +9 -0
  6. data/.idea/vcs.xml +7 -0
  7. data/Gemfile +2 -0
  8. data/Rakefile +8 -0
  9. data/easy_data.gemspec +1 -2
  10. data/lib/controllers/easy_datas_controller.rb +86 -47
  11. data/lib/data_models/RDFa.rb +22 -13
  12. data/lib/data_models/data_models.rb +21 -4
  13. data/lib/data_models/model_rdf.rb +152 -28
  14. data/lib/data_models/namespaces.rb +6 -6
  15. data/lib/easy_data/templates/easy_datas/_data_publications.html.erb +8 -12
  16. data/lib/easy_data/templates/easy_datas/_footer.html.erb +3 -1
  17. data/lib/easy_data/templates/easy_datas/_linked_data_model.html.erb +19 -1
  18. data/lib/easy_data/templates/easy_datas/_linked_datas.html.erb +6 -5
  19. data/lib/easy_data/templates/easy_datas/_list_model_info.html.erb +2 -2
  20. data/lib/easy_data/templates/easy_datas/_list_properties.html.erb +2 -2
  21. data/lib/easy_data/templates/easy_datas/_list_properties_edit.html.erb +31 -30
  22. data/lib/easy_data/templates/easy_datas/_menu.html.erb +4 -4
  23. data/lib/easy_data/templates/easy_datas/_menu_custom.html.erb +11 -8
  24. data/lib/easy_data/templates/easy_datas/_model_attributes.html.erb +4 -2
  25. data/lib/easy_data/templates/easy_datas/_model_attributes_edit.html.erb +14 -13
  26. data/lib/easy_data/templates/easy_datas/_model_attributes_info.html.erb +16 -9
  27. data/lib/easy_data/templates/easy_datas/_settings.html.erb +7 -4
  28. data/lib/easy_data/templates/easy_datas/authenticate_user.html.erb +9 -3
  29. data/lib/easy_data/templates/easy_datas/custom_rdf.html.erb +7 -5
  30. data/lib/easy_data/templates/easy_datas/show.xml.builder +15 -13
  31. data/lib/easy_data/templates/easy_datas/show_all.xml.builder +5 -5
  32. data/lib/easy_data/templates/easy_datas/view_settings.html.erb +4 -1
  33. data/lib/easy_data/templates/images/LogoEasyData.jpg +0 -0
  34. data/lib/easy_data/templates/images/lock.png +0 -0
  35. data/lib/easy_data/templates/images/loginBt.png +0 -0
  36. data/lib/easy_data/templates/images/login_bg.png +0 -0
  37. data/lib/easy_data/templates/images/powerby.jpg +0 -0
  38. data/lib/easy_data/templates/images/rdf_icon.png +0 -0
  39. data/lib/easy_data/templates/images/rdf_icon_s.png +0 -0
  40. data/lib/easy_data/templates/layouts/easy_data_layout.html.erb +3 -2
  41. data/lib/easy_data/templates/stylesheets/easy_data_style.css +39 -23
  42. data/lib/easy_data/version.rb +1 -1
  43. data/lib/easy_data.rb +34 -3
  44. data/lib/routes.rb +5 -9
  45. data/lib/tasks/testing_installation.rb +1 -1
  46. data/test/data_models_test.rb +11 -0
  47. data/test/rdfa_test.rb +18 -0
  48. data/test/unit/RDFa_test.rb +1 -0
  49. data/test/unit/data_models_test.rb +10 -0
  50. data/test/unit/linked_data_graph_test.rb +1 -0
  51. data/test/unit/model_rdf_test.rb +1 -0
  52. data/test/unit/namespaces_test.rb +2 -0
  53. metadata +33 -12
  54. data/lib/easy_data/templates/images/main_menu.jpg +0 -0
  55. data/lib/easy_data/templates/images/rdf_icon.jpeg +0 -0
@@ -14,37 +14,100 @@ class ModelRdf
14
14
  # Query methods
15
15
  #######################################################################
16
16
 
17
- #Read the document of attributes relations with rdf properties
17
+ #Read the document of attributes relations with rdf properties
18
+ # @return [Object] return a ModelRdf's instance whit rdf info
18
19
  def initialize
19
20
  @model_rdf = YAML::load(File.open("#{RAILS_ROOT}/config/easy_data/rdf_info.yaml"))
20
21
  end
21
22
 
22
- # Return datas storeds in the configuration's yaml file
23
+ # Return datas stored in the RDF informations yaml file
24
+ # @return [Hash] return RDF informations
23
25
  def get_models
24
26
  self.model_rdf
25
27
  end
26
28
 
27
- def public?()
28
- self.model_rdf[model][:privacy] == "Public"
29
+ # Return data stored in the RDF informations yaml file about publicated models
30
+ # @return [Hash] return RDF information about public access information of publicated models
31
+ def get_public_models
32
+ models = []
33
+ self.load_models.each do |mod|
34
+ if self.public?(mod)
35
+ models << mod
36
+ end
37
+ end
29
38
  end
30
39
 
31
- def private?()
40
+ # Return data stored in the RDF informations yaml file about publicated models.
41
+ # @return [Hash] return RDF information about not hidden rdf information's models.
42
+ def get_not_hidden_models
43
+ models = []
44
+ self.load_models.each do |mod|
45
+ unless self.hidden?(mod)
46
+ models << mod
47
+ end
48
+ end
49
+ models
50
+ end
51
+
52
+ # Check if the model is public
53
+ # @param [Symbol] model's name
54
+ # @return [Boolean] true or false
55
+ def public?(model)
56
+ self.model_rdf[model][:privacy] == "Public"
57
+ end
58
+
59
+ # Check if the model is private
60
+ # @param [Symbol] model's name
61
+ # @return [Boolean] true or false
62
+ def private?(model)
32
63
  self.model_rdf[model][:privacy] == "Private"
33
64
  end
34
65
 
35
- def hidden?()
66
+ # Check if the model is hidden
67
+ # @param [Symbol] model's name
68
+ # @return [Boolean] true or false
69
+ def hidden?(model)
36
70
  self.model_rdf[model][:privacy] == "Hidden"
37
71
  end
38
72
 
73
+ # Model RDF informations and privacy
74
+ # @param [String] model's name
75
+ # @return [Hash] hash with RDF and privacy information about the model
39
76
  def get_rdf_info_model(model)
40
77
  {:namespace => self.model_rdf[model][:namespace],:property => self.model_rdf[model][:property]}
41
78
  end
42
- #Return attributes of model stored in the configuration yaml file
79
+
80
+ # Return attributes of model stored in the configuration yaml file
81
+ # @param [String] model's name
82
+ # @return [Hash] Return all information about the model and his data.
43
83
  def get_attributes_model(model)
44
84
  self.model_rdf[model]
45
85
  end
46
86
 
87
+ # Return all models which they are assocciations of current model
88
+ # @param [String] current model name
89
+ # @return [Array] list of models which the are assocciations with current model.
90
+ def get_associations_model(model)
91
+ associations = self.model_rdf[model]['associations'].keys
92
+ models = DataModels.load_models
93
+ hash_associations = {}
94
+
95
+ associations.each do |assc|
96
+ if models.include?assc.camelize
97
+ hash_associations[assc] = assc
98
+ elsif eval(model+'.reflections[:'+assc+'].class_name')
99
+ hash_associations[assc] = eval(model+'.reflections[:'+assc+'].class_name')
100
+ else
101
+ hash_associations[assc] = eval(model+'.reflections[:'+assc+'].options[:class_name]')
102
+ end
103
+ end
104
+
105
+ hash_associations
106
+ end
107
+
47
108
  # RDFa: Return attributes of model RDF info
109
+ # @param [String] model's name
110
+ # @return [String] model's rdf information to insert in HTML tag
48
111
  def model(model)
49
112
  info = get_rdf_info_model(model)
50
113
  if info[:property] && info[:property]!= "not defined"
@@ -54,72 +117,111 @@ class ModelRdf
54
117
  end
55
118
  end
56
119
 
57
- # update model rdf info
120
+ def add_model(model,attributes)
121
+ self.model_rdf[model] = attributes
122
+ end
123
+
124
+ def delete_model(model)
125
+ self.model_rdf.delete(model)
126
+ end
127
+ # Update model rdf info
128
+ # @param [String] model's name
129
+ # @param [String] model's property to be updated
130
+ # @param [Strign] new value
131
+ # @return [Boolean] true or false if the operation has finished correctly.
58
132
  def update_model(model,param,value)
59
133
  self.model_rdf[model][param.to_sym] = value
60
134
  end
61
135
 
62
136
  # update attributes with rdf properties.
137
+ # @param [String] model's name
138
+ # @param [String] model's attribute
139
+ # @param [String] attribute's property to be updated
140
+ # @param [Strign] new value
141
+ # @return [Boolean] true or false if the operation has finished correctly.
63
142
  def update_attributes_model(model,attribute,param,value)
64
143
  self.model_rdf[model]['attributes'][attribute][param.to_sym] = value
65
144
  end
66
145
 
67
146
  # RDFa: Return attribute rdf info
147
+ # @param [String] model's name
148
+ # @param [Strign] model's attribute
149
+ # @return [String] RDF information about model's attribute to insert in HTML tag.
68
150
  def attribute(model,attribute)
69
151
  att_rdf = self.model_rdf[model]['attributes'][attribute]
70
152
  " property='#{att_rdf[:namespace]}:#{att_rdf[:property]}'"
71
153
  end
72
154
 
155
+ # update associations with rdf properties.
156
+ # @param [String] model's name
157
+ # @param [String] model's attribute
158
+ # @param [String] association's property to be updated
159
+ # @param [Strign] new value
160
+ # @return [Boolean] true or false if the operation has finished correctly.
73
161
  def update_associations_model(model,association,param,value)
74
162
  self.model_rdf[model]['associations'][association][param.to_sym] = value
75
163
  end
76
164
 
77
165
  # RDFa: return a string with all prefix used to describes attributes
166
+ # @param [String] model's name
167
+ # @return [String] list of prefix to be used in RDFa information
78
168
  def get_prefix(model)
79
169
  prefix = []
80
170
  data_model = get_attributes_model(model)
81
171
  data_model["attributes"].each do |att,info|
82
172
  if info[:namespace] && info[:namespace] != 'not defined'
83
173
  puts info[:namespace]
84
- prefix << "#{info[:namespace]}:#{(eval "EasyData::RDF::#{info[:namespace].upcase}.get_uri")} "
174
+ prefix << "xmls:#{info[:namespace]}=#{(eval "EasyData::RDF::#{info[:namespace].upcase}.get_uri")} "
85
175
  end
86
176
  end
87
177
  data_model["associations"].each do |assoc,info|
88
178
  if info[:namespace] && info[:namespace] != 'not defined'
89
- prefix << "#{info[:namespace]}:#{(eval "EasyData::RDF::#{info[:namespace].upcase}.get_uri")} "
179
+ prefix << "xmls:#{info[:namespace]}=#{(eval "EasyData::RDF::#{info[:namespace].upcase}.get_uri")} "
90
180
  end
91
181
  end
92
182
 
93
183
  if data_model[:namespace] && data_model[:namespace] != 'not defined'
94
- prefix << "#{data_model[:namespace]}:#{(eval "EasyData::RDF::#{data_model[:namespace].upcase}.get_uri")}"
184
+ prefix << "xmls:#{data_model[:namespace]}=#{(eval "EasyData::RDF::#{data_model[:namespace].upcase}.get_uri")}"
95
185
  end
96
186
 
97
187
  prefix.uniq.join(" ")
98
188
  end
99
189
 
100
- # Return privacy of a attribute
190
+ # Convert index privacy to string
191
+ # @param [Integer] Index of privacy
192
+ # @return [String] Privacy label
101
193
  def privacy(index)
102
194
  @@privacy[index]
103
195
  end
104
196
 
105
197
  # Save changes in rdf_info.yaml (configuration's yaml file)
198
+ # return [Boolean] true or false if operations has finished correctly
106
199
  def save
107
200
  file = File.open("#{RAILS_ROOT}/config/easy_data/rdf_info.yaml",'w')
108
201
  file.puts YAML::dump(self.model_rdf)
109
202
  file.close
110
203
  end
111
204
 
205
+
206
+ def refresh_information
207
+ end
112
208
  #######################################################################
113
209
  # Building RDF
114
210
  #######################################################################
115
-
211
+
212
+ # Build a response to user's request
213
+ # @param [Array] Response's data
214
+ # @param [String] model's name
215
+ # @param [String] current host
216
+ # @return [Hash] Response to be render in rdf file.
116
217
  def get_model_rdf(query,model,host)
117
- if public?model.to_sym
218
+
219
+ if public?model
118
220
  request = {:body => "",:header => {"xmlns:rdf"=>"http://www.w3.org/1999/02/22-rdf-syntax-ns#"}}
119
221
  elements = {}
120
222
  models = []
121
223
  query.each do |element|
122
- elements[element.id] = {'description' => "#{host}/#{element.class.to_s}/#id:#{element.id}",
224
+ elements[element.id] = {'description' => "#{host}/s/#{element.class.to_s}/#{element.id}",
123
225
  'attributes' => get_properties_tag(element),
124
226
  'associations' => get_associations_tag(element)
125
227
  }
@@ -138,18 +240,24 @@ class ModelRdf
138
240
  {}
139
241
  end
140
242
  end
141
-
243
+ # Get all namespace used to build the response
244
+ # @param [Array] list of attributes
245
+ # @return [Array] list of namespaces used to describes them.
142
246
  def get_header(attributes)
143
247
  headers = {}
144
248
 
145
249
  (attributes["attributes"].merge(attributes["associations"])).each do |att,properties|
146
- if properties != "no publication" && properties[:namespace] != 'not defined'
147
- headers["xmlns:#{properties[:namespace]}"] = (eval "EasyData::RDF::#{properties[:namespace].upcase}.get_uri") #EasyData.get_uri_namespace(properties[:namespace])
250
+ if properties != "no publication" && properties[:namespace] != 'not defined' && properties[:privacy]=="Public"
251
+ headers["xmlns:#{properties[:namespace]}"] = (eval "EasyData::RDF::#{properties[:namespace].upcase}.get_uri") #EasyData.get_uri_namespace(properties[:namespace])
148
252
  end
149
- end
253
+ end
254
+
150
255
  headers
151
256
  end
152
257
 
258
+ # Return all attribute's information of a model's instance
259
+ # @param [Object] Model's instance
260
+ # @return [Hash] RDF's attributes informations about the object
153
261
  def get_properties_tag(element)
154
262
 
155
263
  attributes = get_attributes_model(element.class.to_s)
@@ -163,16 +271,24 @@ class ModelRdf
163
271
  if element.attributes.respond_to? :each
164
272
  element.attributes.each do |att|
165
273
  #conditions to methods to check if can be show
274
+ begin
275
+
166
276
  if can_see?(attributes["attributes"][att.first][:privacy]) && exist_info_att(attributes["attributes"][att.first],att.second)
167
277
  properties["#{attributes['attributes'][att.first][:namespace]}:#{attributes["attributes"][att.first][:property]}"] = att.second
168
278
  end
279
+ rescue
280
+ puts attributes["attributes"]
281
+ end
169
282
  end
170
283
  end
171
-
284
+
172
285
  properties
173
286
 
174
287
  end
175
288
 
289
+ # Return all association's information of a model's instance
290
+ # @param [Object] Model's instance
291
+ # @return [Hash] RDF's association informations about the object
176
292
  def get_associations_tag(element)
177
293
 
178
294
  associations = get_attributes_model(element.class.to_s)
@@ -184,14 +300,16 @@ class ModelRdf
184
300
  properties = {}
185
301
 
186
302
  class_element.reflections.each do |ref,value|
187
- rel = eval "element.#{ref}"
188
- if exist_info_assoc(rel.to_a,associations["associations"][ref.to_s]) && can_see?(associations["associations"][ref.to_s][:privacy]) && !rel.empty?
303
+
304
+ rel = Array(eval "element.#{ref}")||Array()
305
+
306
+ if exist_info_assoc(rel,associations["associations"][ref.to_s]) && can_see?(associations["associations"][ref.to_s][:privacy]) && !rel.empty?
189
307
 
190
- properties.merge!({"#{associations['associations'][ref.to_s][:namespace]}:#{associations['associations'][ref.to_s][:property]}" => {:model => rel.first.class ,
191
- :id => rel.collect{|obj| obj.id}}
192
- })
308
+ properties.merge!({"#{associations['associations'][ref.to_s][:namespace]}:#{associations['associations'][ref.to_s][:property]}" => {:model => rel.first.class ,:id => rel.collect{|obj| obj.id}}
309
+ })
193
310
  end
194
- end
311
+ end
312
+
195
313
  properties
196
314
  end
197
315
 
@@ -200,17 +318,23 @@ class ModelRdf
200
318
  ########################################################################
201
319
  ## FUNCTIONS FOR CHECK IF SHOW oR NoT THE CURRENT ITEM ##
202
320
  ########################################################################
203
-
321
+
322
+ # Check if the user can see the element data
323
+ # @param [String] privacy
324
+ # @return [Boolean] true or false, if the user can see this data
204
325
  def can_see?(privacy)
205
326
  privacy=="Public" || (privacy=="Private" && !@current_user.nil?)
206
327
  end
207
-
328
+
329
+ # Check if the attribute have defined his properties
330
+ #
208
331
  def exist_info_att(attributes,value)
209
332
  attributes[:namespace] != "not defined" &&
210
333
  attributes[:property] !="not defined" &&
211
334
  !value.nil?
212
335
  end
213
336
 
337
+ # Fixed
214
338
  def exist_info_assoc(rels,rdf_info)
215
339
  !rels.nil? && !rels.empty? &&
216
340
  rdf_info[:namespace] != "not defined" &&
@@ -2,13 +2,17 @@ module EasyData
2
2
  module RDF
3
3
  class Namespaces
4
4
 
5
-
5
+ # List of namespace availables to be used in RDF info models
6
6
  @@namespaces=['cc','cert','dc','dc11','doap','exif','foaf','geo','http','owl','rdfs','rsa','rss','sioc','skos','wot','xhtml','xsd']
7
-
7
+
8
+ # Return List of namespaces
9
+ # @return [Array] list of namespaces
8
10
  def self.list
9
11
  @@namespaces
10
12
  end
11
13
 
14
+ # Return list of namespaces to be used in a form
15
+ # @return [Hash] hash of namespace
12
16
  def self.list_form
13
17
  list = {}
14
18
 
@@ -19,10 +23,6 @@ module EasyData
19
23
  list
20
24
  end
21
25
 
22
- def self.get_tag(attribute,namespace,property,value)
23
-
24
- end
25
-
26
26
  end
27
27
  end
28
28
  end
@@ -2,11 +2,12 @@
2
2
  <ul>
3
3
  <% list.each do |model|%>
4
4
  <li>
5
- <%= link_to_remote model,:url => {:controller => 'easy_datas',
5
+ <span class="model"><%= link_to_remote model,:url => {:controller => 'easy_datas',
6
6
  :action => :model_attributes_info,
7
7
  :model => model},
8
8
  :update => "info_models"
9
- %>
9
+ %>
10
+ </span>
10
11
  </li>
11
12
  <%end%>
12
13
  </ul>
@@ -14,19 +15,14 @@
14
15
 
15
16
  <div id="info_models" class="ed_info_models">
16
17
 
17
- <span class="title_data_publications">Bienvenido al sistema de información de la interfaz RDF del proyecto <%#= proyect%></span>
18
+ <span class="title_data_publications">Wellcome to the information system interface of the proyect's RDF</span>
18
19
  <p>
19
- En el panel izquierdo se listan los modelos de la aplicación de los cuales se han publicado sus datos para acceso mediante URI's desreferenciables. Si pincha sobre cualquiera de ellos podrá visualizar los datos publicados de éstos. Los datos se dividen en atributos, que son propios del modelo y que lo describen y, asociaciones con otros modelos. De esta forma tendrá una visión de la información que puede consultar a la aplicación mediante la interfaz RDF de la que dispone.
20
+ In the left pannel, it's list the application's models which the data have publicated on them to access by URI's. If you click in any of them, you can see the data of theses models. The data are divided in attributes which belong to the data model and describe him, and associations with others data model. This way you have a look of the publicated information which you can query to the application by the RDF interfaces which you can use.
20
21
  </p>
22
+ <%if !@settings["project"]["contact_email"].nil?%>
21
23
  <p>
22
- Si tiene alguna duda sobre el funcionamiento o el modo de acceso a los datos publicados y no encuentra soluci&oacute;n aqu&iacute; puede enviarnos un email de consulta a <%#= email_admin%>.
24
+ Si tiene alguna duda sobre el funcionamiento o el modo de acceso a los datos publicados y no encuentra soluci&oacute;n aqu&iacute; puede enviarnos un email de consulta a <img href="mailto:<%= @settings["project"]["contact_email"]%>" alt="Email"/>.
23
25
  </p>
24
- <p>
25
- Un saludo.
26
- </p>
27
-
28
-
29
-
30
-
26
+ <%end%>
31
27
 
32
28
  </div>
@@ -1,3 +1,5 @@
1
1
  <div id="easy_data_footer" class="easy_data_footer">
2
- <a href="https://rubygems.org/gems/easy_data" title="Web Project EasyData"><%= image_tag(image_path("/stylesheets/easy_data/images/logo_ft.png"))%></a>
2
+ <a href="https://rubygems.org/gems/easy_data" title="Web Project EasyData">
3
+ <%= image_tag(image_path("/stylesheets/easy_data/images/powerby.jpg"))%>
4
+ </a>
3
5
  </div>
@@ -1 +1,19 @@
1
- <%= image_tag(image_path("linked_data_graphs/linked_data_#{@model}.png"))%>
1
+ <div class="title_model">Model <%= @model %></div>
2
+ <div class="linked_data_graphs"><%= image_tag(image_path("linked_data_graphs/linked_data_#{@model}.png"))%></div>
3
+
4
+ <span class="title_data_publications">Access model <%=@model%></span>
5
+
6
+ <span class="simple_data"><a href="<%= @host+'/s/'+@model.camelize.pluralize%>" title="access to <%=@model%>"><%=@host+'/s/'+@model.camelize.pluralize%></a></span><br />
7
+
8
+ <%if @associations.respond_to?:each%>
9
+ <span class="title_data_publications">
10
+ Assocciations access
11
+ </span>
12
+ <ul class="linked_data_assocciations">
13
+ <%@associations.each do |assoc,model|%>
14
+ <li><%=assoc.camelize%> : <a href="<%= @host+'/s/'+model.camelize.pluralize%>" title="access to <%=assoc%>"><%= @host+'/s/'+model.camelize.pluralize%></a></li>
15
+ <%end%>
16
+ </ul>
17
+ <%end%>
18
+
19
+
@@ -3,11 +3,12 @@
3
3
  <% @list.each do |model|%>
4
4
  <% if File.exists?("public/images/linked_data_graphs/linked_data_#{model}.png")%>
5
5
  <li>
6
- <%= link_to_remote model,:url => {:controller => "easy_datas",
7
- :action => "load_linked_data_graph",
8
- :model => model},
9
- :update => "info_models"
10
- %>
6
+ <span class="model"><%= link_to_remote model,:url => {:controller => "easy_datas",
7
+ :action => "load_linked_data_graph",
8
+ :model => model},
9
+ :update => "info_models"
10
+ %>
11
+ </span>
11
12
  </li>
12
13
  <%end%>
13
14
  <%end%>
@@ -1,6 +1,6 @@
1
1
  <div id="select_privacy">
2
2
  <span>Access privacy: </span>
3
- <%= select "privacy","#{model_name}", {"Hidden" => "Hidden","Public" => "Public","Privacy" => "Privacy"}%>
3
+ <%= select "privacy","#{model_name}", {"Hidden" => "Hidden","Public" => "Public","Privacy" => "Privacy"},{:selected => model[:privacy]}%>
4
4
  <span class="rdf_info"><%= "(Current value: #{model[:privacy]})"%></span>
5
5
  </div>
6
6
 
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
 
15
15
  <%= observe_field "namespace_#{model_name}",{:url => {:controller => "easy_datas",:action => "load_properties",
16
- :block=>"properties_#{model_name}",:attribute => model_name,:model => model_name,:type => type},
16
+ :block=>"properties_#{model_name}",:attribute => model_name,:model => model_name},
17
17
  :with => '"id="+value',
18
18
  :on => :selected,
19
19
  :update => "properties_#{model_name}"}
@@ -2,10 +2,10 @@
2
2
  <%attributes.each do |att,properties|%>
3
3
  <div class="property">
4
4
  <span class="attribute"><%=att%></span>
5
- <% unless properties[:namespace].nil?%>
5
+ <% unless properties.is_a?(String)%>
6
6
  <div id="privacy">
7
7
  <span>Access privacy: </span>
8
- <span><%= properties[:privacy] %></span>
8
+ <span><%= properties[:privacy] %></span>
9
9
  </div>
10
10
  <div id="<%="namespace"%>">
11
11
  <span>Rdf Namespace: </span>
@@ -1,34 +1,35 @@
1
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" => "Hidden","Public" => "Public","Private" => "Private"}%>
10
- <span class="rdf_info"><%= "(Current value: #{properties[:privacy]})"%></span>
11
- </div>
12
- <br />
2
+ <% attributes.each do |att, properties| %>
3
+ <div class="property">
4
+ <span class="attribute"><%= att %></span>
5
+ <br/>
6
+ <% unless properties.is_a?(String) %>
7
+ <div id="select_privacy">
8
+ <span>Access privacy: </span>
9
+ <%= select "privacy", att, {"Hidden" => "Hidden", "Public" => "Public", "Private" => "Private"},{:selected => properties[:privacy]} %>
10
+ <span class="rdf_info"><%= "(Current value: #{properties[:privacy]})" %></span>
11
+ </div>
12
+ <br/>
13
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}"%>">&nbsp;</div>
27
- <% else %>
28
- <span> This attribute can't be publicate</span>
29
- <% end%>
30
- </div>
31
- <br/>
32
- <%end%>
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
+
27
+ <div id="<%= "properties_#{model}_#{att}" %>">&nbsp;</div>
28
+ <% else %>
29
+ <span> This attribute can't be publicated</span>
30
+ <% end %>
31
+ </div>
32
+ <br/>
33
+ <% end %>
33
34
  </div>
34
35
 
@@ -1,6 +1,6 @@
1
1
  <div class="ed_main_menu">
2
2
  <ul>
3
- <li class="layer_menu"><%= "#{@settings["project"]["name"]||nil} - "%>Data Publications Information</li>
3
+ <li class="layer_menu"><%= "#{(@settings["project"]["name"] rescue nil)} - "%>Data Publications Information</li>
4
4
  <li class="menu_link"><%= link_to "Data Publications",{:controller => "easy_datas",:action => "info_easy_data"},
5
5
  {:title => "Data Publications"}
6
6
  %>
@@ -10,15 +10,15 @@
10
10
  :html => {:title => "Linked Data"}
11
11
  %>
12
12
  </li>
13
- <li class="menu_link"><%= link_to_remote "Access to Data", :url => {:controller => "easy_datas", :action => "access_to_data"},
13
+ <!--<li class="menu_link"><%#= link_to_remote "Access to Data", :url => {:controller => "easy_datas", :action => "access_to_data"},
14
14
  :update => "information_content",
15
15
  :html => {:title => "How to access to data publications?"}
16
16
  %>
17
17
  </li>
18
- <li class="menu_link"><%= link_to_remote "Quiz", :url => {:controller => 'easy_datas',:action => 'faq'},
18
+ <li class="menu_link"><%#= link_to_remote "Quiz", :url => {:controller => 'easy_datas',:action => 'faq'},
19
19
  :update => "information_content",
20
20
  :html => {:title => "Any questions?"}
21
21
  %>
22
- </li>
22
+ </li>-->
23
23
  </ul>
24
24
  </div>
@@ -1,15 +1,18 @@
1
1
  <div class="ed_main_menu">
2
2
  <ul>
3
- <li class="layer_menu"><%= "#{@settings["project"]["name"]||nil} - "%>Custom RDF Information</li>
4
- <li class="menu_link"><%= link_to "Custom Rdf",{:controller => "easy_datas",:action => "custom_rdf"},
5
- {:title => "Custom RDF information"}
3
+ <li class="layer_menu"><%= "#{(@settings["project"]["name"] rescue nil)} - " %>Custom RDF Information</li>
4
+ <li class="menu_link"><%= link_to "Custom Rdf", {:controller => "easy_datas", :action => "custom_rdf"},
5
+ {:title => "Custom RDF information"}
6
6
  %>
7
7
  </li>
8
- <li class="menu_link"><%= link_to_remote "Settings",:url => {:controller => "easy_datas",:action => "view_settings"},
9
- :update => "custom_content",
10
- :html => {:title => "Project Settings"}
8
+ <li class="menu_link"><%= link_to_remote "Settings", :url => {:controller => "easy_datas", :action => "view_settings"},
9
+ :update => "custom_content",
10
+ :html => {:title => "Project Settings"}
11
11
  %>
12
- </li>
13
- <li class="menu_link"><a href="mailto:jnillo9@gmail.com?subject='Any cuestion about EasyData'" title="Cuestion to Jnillo">Quiz</a></li>
12
+ </li>
13
+ <li class="menu_link refresh"><%= link_to "Refresh Models", :url => {:controller => "easy_datas", :action => "refresh_information"},
14
+ :html => {:title => "Refresh Models list"}
15
+ %>
16
+ </li>
14
17
  </ul>
15
18
  </div>
@@ -1,5 +1,7 @@
1
1
  <div id="list_attributes" class="model_attributes">
2
2
 
3
+ <span class="title_model"><%=@model%> Model</span>
4
+
3
5
  <%if @model_attributes.respond_to?:each%>
4
6
  <!-- ATTRIBUTES -->
5
7
 
@@ -27,7 +29,7 @@
27
29
  <span>Model no found</span>
28
30
  <%end%>
29
31
  <span>
30
- <%= link_to_remote "Edit",:url => {:controller => 'easy_datas',
32
+ <%= button_to_remote "Edit",:url => {:controller => 'easy_datas',
31
33
  :action => :model_attributes_edit,
32
34
  :model => @model},
33
35
  :update => "model_attributes",
@@ -36,7 +38,7 @@
36
38
  %>
37
39
  </span>
38
40
 
39
- <%= link_to_function "[Close]","Effect.Fade('model_attributes',{ duration : 0.3});",:class=>"close_list"%>
41
+ <%= button_to_function "Close","Effect.Fade('model_attributes',{ duration : 0.3});$('ls_#{@model}').className='model';",:class=>"close_list"%>
40
42
 
41
43
  </div>
42
44