iqvoc_skosxl 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/Gemfile +40 -0
  2. data/Gemfile.lock +154 -0
  3. data/README.md +26 -0
  4. data/Rakefile +11 -0
  5. data/app/assets/javascripts/iqvoc_skosxl/manifest.js +0 -0
  6. data/app/assets/javascripts/manifest.js +3 -0
  7. data/app/assets/stylesheets/iqvoc_skosxl/manifest.css +0 -0
  8. data/app/assets/stylesheets/manifest.css +5 -0
  9. data/app/controllers/labels/versions_controller.rb +109 -0
  10. data/app/controllers/labels_controller.rb +130 -0
  11. data/app/controllers/rdf_controller.rb +23 -0
  12. data/app/helpers/iqvoc_skosxl_helper.rb +18 -0
  13. data/app/helpers/labels_helper.rb +68 -0
  14. data/app/models/concept/skosxl/extension.rb +62 -0
  15. data/app/models/label/relation/base.rb +54 -0
  16. data/app/models/label/relation/skosxl/base.rb +12 -0
  17. data/app/models/label/skosxl/base.rb +219 -0
  18. data/app/models/labeling/skosxl/alt_label.rb +8 -0
  19. data/app/models/labeling/skosxl/base.rb +75 -0
  20. data/app/models/labeling/skosxl/hidden_label.rb +12 -0
  21. data/app/models/labeling/skosxl/pref_label.rb +12 -0
  22. data/app/views/labels/_base_data.html.erb +62 -0
  23. data/app/views/labels/_change_note.html.erb +46 -0
  24. data/app/views/labels/_details.html.erb +6 -0
  25. data/app/views/labels/_label_relation.html.erb +7 -0
  26. data/app/views/labels/_labeling.html.erb +3 -0
  27. data/app/views/labels/_note.html.erb +33 -0
  28. data/app/views/labels/_show_head.html.erb +22 -0
  29. data/app/views/labels/_value_and_language.html.erb +9 -0
  30. data/app/views/labels/edit.html.erb +22 -0
  31. data/app/views/labels/new.html.erb +3 -0
  32. data/app/views/labels/show.ttl.erb +1 -0
  33. data/app/views/labels/show_published.html.erb +13 -0
  34. data/app/views/labels/show_unpublished.html.erb +36 -0
  35. data/app/views/partials/label/relation/_base.html.erb +9 -0
  36. data/app/views/partials/label/relation/_edit_base.html.erb +13 -0
  37. data/app/views/partials/label/skosxl/_edit_link_base.html.erb +1 -0
  38. data/app/views/partials/label/skosxl/_new_link_base.html.erb +7 -0
  39. data/app/views/partials/labeling/skosxl/_base.html.erb +19 -0
  40. data/app/views/partials/labeling/skosxl/_edit_base.html.erb +15 -0
  41. data/app/views/partials/labeling/skosxl/_search_result.html.erb +9 -0
  42. data/app/views/rdf/show_label.iqrdf +5 -0
  43. data/config/application.rb +56 -0
  44. data/config/boot.rb +13 -0
  45. data/config/database.template.yml +38 -0
  46. data/config/database.yml +36 -0
  47. data/config/engine.rb +13 -0
  48. data/config/environment.rb +5 -0
  49. data/config/environments/development.rb +55 -0
  50. data/config/environments/production.rb +64 -0
  51. data/config/environments/test.rb +44 -0
  52. data/config/initializers/iqvoc.rb +4 -0
  53. data/config/initializers/iqvoc_skosxl.rb +1 -0
  54. data/config/initializers/secret_token.rb.template +9 -0
  55. data/config/initializers/session_store.rb +8 -0
  56. data/config/locales/activerecord.de.yml +18 -0
  57. data/config/locales/activerecord.en.yml +18 -0
  58. data/config/locales/de.yml +5 -0
  59. data/config/locales/en.yml +5 -0
  60. data/config/routes.rb +15 -0
  61. data/db/migrate/20110408121540_extend_label.rb +37 -0
  62. data/db/migrate/20110408123644_add_label_relations.rb +24 -0
  63. data/db/schema.rb +146 -0
  64. data/db/seeds.rb +0 -0
  65. data/iqvoc_skosxl.gemspec +22 -0
  66. data/lib/engine_tasks/db.rake +19 -0
  67. data/lib/iqvoc/skosxl/version.rb +5 -0
  68. data/lib/iqvoc/xllabel.rb +60 -0
  69. data/lib/iqvoc_skosxl.rb +22 -0
  70. data/test/factories.rb +23 -0
  71. data/test/integration/concept_label_language_test.rb +95 -0
  72. data/test/integration/dashboard_test.rb +29 -0
  73. data/test/integration/edit_labels_test.rb +26 -0
  74. data/test/integration/labels_order_test.rb +27 -0
  75. data/test/integration_test_helper.rb +27 -0
  76. data/test/test_helper.rb +15 -0
  77. data/test/unit/label_test.rb +30 -0
  78. metadata +154 -0
@@ -0,0 +1,15 @@
1
+ <%= content_tag("li", { :class => "translation", :lang => language || nil }, true) do %>
2
+ <%= label_tag(klass.name.to_relation_name,
3
+ klass.model_name.human(:count => 2) + " (#{language})") %>
4
+ <%= text_field_tag "concept[labelings_by_id][#{klass.name.to_relation_name}][#{language}]",
5
+ concept.labelings_by_id(klass.name.to_relation_name, language),
6
+ :id => "#{klass.name.to_relation_name}_#{language}",
7
+ :class => "entity_select",
8
+ :"data-query-url" => labels_path(:format => :json, :language => language),
9
+ :"data-entity-uri" => label_path("{id}"),
10
+ :"data-entities" => Iqvoc::XLLabel.base_class.editor_selectable.
11
+ by_language(language).by_origin(concept.labelings_by_id(
12
+ klass.name.to_relation_name, language).
13
+ split(Iqvoc::InlineDataHelper::Splitter)).
14
+ map { |l| label_widget_data(l) }.to_json %>
15
+ <%- end -%>
@@ -0,0 +1,9 @@
1
+ <%- if concept = result.owner -%>
2
+ <dt>
3
+ <%= link_to highlight_query(result.target.value, params[:query]), concept_path(:id => concept) %>
4
+ </dt>
5
+ <dd><%= t('txt.views.search_results.type') %>: <%= result.class.model_name.human %></dd>
6
+ <%- if result.target.language -%>
7
+ <dd><%= t('txt.views.search_results.language') %>: <%= result.target.language %></dd>
8
+ <%- end -%>
9
+ <%- end -%>
@@ -0,0 +1,5 @@
1
+ Iqvoc.default_rdf_namespace_helper_methods.each do |meth|
2
+ document.namespaces(self.send(meth))
3
+ end
4
+
5
+ render_label_rdf(document, @label)
@@ -0,0 +1,56 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require *Rails.groups(:assets => %w(development test))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ module Iqvoc::SKOSXL
13
+ class Application < Rails::Application
14
+
15
+ # This has to be here because iqvoc_skosxl.rb needs to know if it runs as app or as engine
16
+ require 'iqvoc_skosxl'
17
+
18
+ # Settings in config/environments/* take precedence over those specified here.
19
+ # Application configuration should go into files in config/initializers
20
+ # -- all .rb files in that directory are automatically loaded.
21
+
22
+ # Custom directories with classes and modules you want to be autoloadable.
23
+ # config.autoload_paths += %W(#{config.root}/extras)
24
+
25
+ # Only load the plugins named here, in the order given (default is alphabetical).
26
+ # :all can be used as a placeholder for all plugins not explicitly named.
27
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
28
+
29
+ # Activate observers that should always be running.
30
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
31
+
32
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
33
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
34
+ # config.time_zone = 'Central Time (US & Canada)'
35
+
36
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
37
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
38
+ config.i18n.default_locale = :de
39
+ # config.i18n.available_locales = [:de, :en]
40
+
41
+ # JavaScript files you want as :defaults (application.js is always included).
42
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
43
+
44
+ # Configure the default encoding used in templates for Ruby 1.9.
45
+ config.encoding = "utf-8"
46
+
47
+ # Configure sensitive parameters which will be filtered from the log file.
48
+ config.filter_parameters += [:password, :password_confirmation]
49
+
50
+ # Enable the asset pipeline
51
+ config.assets.enabled = true
52
+
53
+ # Version of your assets, change this if you want to expire all your assets
54
+ config.assets.version = '1.0'
55
+ end
56
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,38 @@
1
+ <% socket = [
2
+ "/tmp/mysql.sock",
3
+ "/opt/local/var/run/mysql5/mysqld.sock",
4
+ "/tmp/mysqld.sock",
5
+ "/var/run/mysqld.sock"
6
+ ].detect { |socket| File.exist?(socket) } %>
7
+
8
+ defaults: &defaults
9
+ encoding: utf8
10
+ username: root
11
+ password:
12
+ <% if defined?(JRuby) %>
13
+ adapter: jdbcmysql
14
+ hostname: localhost
15
+ <% else %>
16
+ adapter: mysql2
17
+ socket: <%= socket %>
18
+ <% end %>
19
+
20
+ development:
21
+ <<: *defaults
22
+ database: iqvoc_skosxl_development
23
+
24
+ # Warning: The database defined as 'test' will be erased and
25
+ # re-generated from your development database when you run 'rake'.
26
+ # Do not set this db to the same as development or production.
27
+ test:
28
+ <<: *defaults
29
+ adapter: sqlite3
30
+ database: ":memory:"
31
+ verbosity: silent
32
+
33
+ production:
34
+ encoding: utf8
35
+ username: iqvoc_skosxl
36
+ password:
37
+ database: iqvoc_skosxl
38
+ adapter: oracle_enhanced
@@ -0,0 +1,36 @@
1
+ <% socket = [
2
+ "/tmp/mysql.sock",
3
+ "/opt/local/var/run/mysql5/mysqld.sock",
4
+ "/tmp/mysqld.sock",
5
+ "/var/run/mysqld.sock"
6
+ ].detect { |socket| File.exist?(socket) } %>
7
+
8
+ defaults: &defaults
9
+ encoding: utf8
10
+ username: root
11
+ password:
12
+ <% if defined?(JRuby) %>
13
+ adapter: jdbcmysql
14
+ hostname: localhost
15
+ <% else %>
16
+ adapter: mysql2
17
+ socket: <%= socket %>
18
+ <% end %>
19
+
20
+ development:
21
+ <<: *defaults
22
+ database: iqvoc_skosxl_development
23
+
24
+ # Warning: The database defined as 'test' will be erased and
25
+ # re-generated from your development database when you run 'rake'.
26
+ # Do not set this db to the same as development or production.
27
+ test:
28
+ <<: *defaults
29
+ database: iqvoc_skosxl_test
30
+
31
+ production:
32
+ encoding: utf8
33
+ username: iqvoc_skosxl
34
+ password:
35
+ database: iqvoc_skosxl
36
+ adapter: oracle_enhanced
data/config/engine.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rails'
2
+
3
+ module Iqvoc
4
+ module SKOSXL
5
+
6
+ class Engine < Rails::Engine
7
+
8
+ paths["lib/tasks"] << "lib/engine_tasks"
9
+
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Iqvoc::SKOSXL::Application.initialize!
@@ -0,0 +1,55 @@
1
+ if Iqvoc::SKOSXL.const_defined?(:Application)
2
+ Iqvoc::SKOSXL::Application.configure do
3
+ # Settings specified here will take precedence over those in config/environment.rb
4
+
5
+ # In the development environment your application's code is reloaded on
6
+ # every request. This slows down response time but is perfect for development
7
+ # since you don't have to restart the webserver when you make code changes.
8
+ config.cache_classes = false
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+
26
+ # Do not compress assets
27
+ config.assets.compress = false
28
+
29
+ # Expands the lines which load the assets
30
+ config.assets.debug = true
31
+
32
+ # The default URI prefix for RDF data. This will be followed by a document
33
+ # specific shnippet like (specimenType) and the id.
34
+
35
+ # The JDBC driver url for the coinnection to the virtuoso triple store.
36
+ # Login crdentials have to be stored here too. See
37
+ # http://docs.openlinksw.com/virtuoso/VirtuosoDriverJDBC.html#jdbcurl4mat for
38
+ # more details.
39
+ # Example: "jdbc:virtuoso://localhost:1111/UID=dba/PWD=dba"
40
+ # Use nil to disable virtuoso triple synchronization
41
+ # Rails.application.config.virtuoso_jdbc_driver_url = "jdbc:virtuoso://virtuoso.dyndns.org:1111/UID=iqvoc/PWD=vocpass!/charset=UTF-8"
42
+ config.virtuoso_jdbc_driver_url = nil
43
+
44
+ # Set up the virtuoso synchronization (which is a triggered pull from the
45
+ # virtuoso server) to be run in a new thread.
46
+ # This is needed in environments where the webserver only runs in a single
47
+ # process/thread (mostly in development environments).
48
+ # When a synchronizaion would be triggered e.g. from a running
49
+ # update action in the UPB, the update would trigger virtuoso to do a HTTP GET
50
+ # back to the UPB to fetch the RDF data. But the only process in the UPB would be
51
+ # blocked by the update... => Deadlock. You can avoid this by using the threaded
52
+ # mode.
53
+ config.virtuoso_sync_threaded = false
54
+ end
55
+ end
@@ -0,0 +1,64 @@
1
+ if Iqvoc.const_defined?(:Application)
2
+ Iqvoc::SKOSXL::Application.configure do
3
+ # Settings specified here will take precedence over those in config/environment.rb
4
+
5
+ # The production environment is meant for finished, "live" apps.
6
+ # Code is not reloaded between requests
7
+ config.cache_classes = true
8
+
9
+ # Full error reports are disabled and caching is turned on
10
+ config.consider_all_requests_local = false
11
+ config.action_controller.perform_caching = true
12
+
13
+ # Specifies the header that your server uses for sending files
14
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
15
+
16
+ # For nginx:
17
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
18
+
19
+ # If you have no front-end server that supports something like X-Sendfile,
20
+ # just comment this out and Rails will serve the files
21
+
22
+ # See everything in the log (default is :info)
23
+ # config.log_level = :debug
24
+
25
+ # Use a different logger for distributed setups
26
+ # config.logger = SyslogLogger.new
27
+
28
+ # Use a different cache store in production
29
+ # config.cache_store = :mem_cache_store
30
+
31
+ # Disable Rails's static asset server
32
+ # In production, Apache or nginx will already do this
33
+ config.serve_static_assets = false
34
+
35
+ # Disable Rails's static asset server
36
+ # In production, Apache or nginx will already do this
37
+ config.serve_static_assets = false
38
+
39
+ # Compress JavaScripts and CSS
40
+ config.assets.compress = true
41
+
42
+ # Don't fallback to assets pipeline if a precompiled asset is missed
43
+ config.assets.compile = false
44
+
45
+ # Generate digests for assets URLs
46
+ config.assets.digest = true
47
+
48
+ # Enable serving of images, stylesheets, and javascripts from an asset server
49
+ # config.action_controller.asset_host = "http://assets.example.com"
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+ end
64
+ end
@@ -0,0 +1,44 @@
1
+ if Iqvoc.const_defined?(:Application)
2
+ Iqvoc::SKOSXL::Application.configure do
3
+ # Settings specified here will take precedence over those in config/environment.rb
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+ config.cache_classes = true
10
+
11
+ # Log error messages when you accidentally call methods on nil.
12
+ config.whiny_nils = true
13
+
14
+ # Show full error reports and disable caching
15
+ config.consider_all_requests_local = true
16
+ config.action_controller.perform_caching = false
17
+
18
+ # Raise exceptions instead of rendering exception templates
19
+ config.action_dispatch.show_exceptions = false
20
+
21
+ # Disable request forgery protection in test environment
22
+ config.action_controller.allow_forgery_protection = false
23
+
24
+ # Tell Action Mailer not to deliver emails to the real world.
25
+ # The :test delivery method accumulates sent emails in the
26
+ # ActionMailer::Base.deliveries array.
27
+ config.action_mailer.delivery_method = :test
28
+
29
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
30
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
31
+ # like if you have constraints or database-specific column types
32
+ # config.active_record.schema_format = :sql
33
+
34
+ # Print deprecation notices to the stderr
35
+ config.active_support.deprecation = :stderr
36
+
37
+ # Configure static asset server for tests with Cache-Control for performance
38
+ config.serve_static_assets = true
39
+ config.static_cache_control = "public, max-age=3600"
40
+
41
+ # Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
42
+ config.assets.allow_debugging = true
43
+ end
44
+ end
@@ -0,0 +1,4 @@
1
+ # Search
2
+
3
+ Iqvoc.searchable_class_names = ['Labeling::SKOSXL::Base'] +
4
+ Iqvoc::Concept.labeling_class_names.keys + Iqvoc::Concept.note_class_names
@@ -0,0 +1 @@
1
+ require 'iqvoc/xllabel'
@@ -0,0 +1,9 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ if Iqvoc::SKOSXL.const_defined?(:Application)
8
+ Iqvoc::SKOSXL::Application.config.secret_token = '1cf4863673a83d39f30e77670978adaa9009fc27e6869066c67157ef6790c4b79a4eb4c32029987a3444483b73cb01606291c272a32d6201c06f4ca75dcd5b14'
9
+ end
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ if Iqvoc::SKOSXL.const_defined?(:Application)
3
+ Iqvoc::SKOSXL::Application.config.session_store :cookie_store, :key => '_iqvoc_skosxl_session'
4
+ end
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rake db:sessions:create")
8
+ # Iqvoc::Application.config.session_store :active_record_store
@@ -0,0 +1,18 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ label/skosxl/base:
5
+ one: XL-Label
6
+ other: XL-Labels
7
+ label/skosxl/relation/base:
8
+ one: Label-Relation
9
+ other: Label-Relationen
10
+ labeling/skosxl/base:
11
+ one: Label
12
+ other: Labels
13
+ labeling/skosxl/pref_label:
14
+ one: Bevorzugtes Label
15
+ other: Bevorzugte Labels
16
+ labeling/skosxl/alt_label:
17
+ one: Alternatives Label
18
+ other: Alternative Labels
@@ -0,0 +1,18 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ label/skosxl/base:
5
+ one: XL Label
6
+ other: XL Labels
7
+ label/skosxl/relation/base:
8
+ one: Label Relation
9
+ other: Label Relations
10
+ labeling/skosxl/base:
11
+ one: Label
12
+ other: Labels
13
+ labeling/skosxl/pref_label:
14
+ one: Preferred Label
15
+ other: Preferred Labels
16
+ labeling/skosxl/alt_label:
17
+ one: Alternative Label
18
+ other: Alternative Labels