iqvoc 4.1.2 → 4.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +5 -2
  5. data/README.md +1 -0
  6. data/app/assets/javascripts/framework.js +3 -1
  7. data/app/assets/javascripts/iqvoc/iqvoc.js +1 -1
  8. data/app/assets/stylesheets/framework.css.scss +8 -0
  9. data/app/assets/stylesheets/iqvoc/bootstrap_extensions.css.scss +0 -61
  10. data/app/assets/stylesheets/iqvoc/components.css.scss +25 -0
  11. data/app/assets/stylesheets/iqvoc/{ie_fixes.css → ie_fixes.css.scss} +0 -0
  12. data/app/assets/stylesheets/iqvoc/manifest.css.scss +10 -0
  13. data/app/assets/stylesheets/manifest.css.scss +2 -0
  14. data/app/controllers/instance_configuration_controller.rb +11 -2
  15. data/app/controllers/search_results_controller.rb +3 -2
  16. data/app/helpers/form_helper.rb +17 -1
  17. data/app/helpers/navigation_helper.rb +47 -6
  18. data/app/models/labeling/skos/base.rb +10 -5
  19. data/app/views/collections/_form.html.erb +1 -1
  20. data/app/views/concepts/_form.html.erb +1 -1
  21. data/app/views/concepts/scheme/edit.html.erb +1 -1
  22. data/app/views/instance_configuration/index.html.erb +15 -7
  23. data/app/views/layouts/_navigation.html.erb +2 -2
  24. data/app/views/search_results/_form.html.erb +10 -0
  25. data/app/views/search_results/index.html.erb +3 -63
  26. data/app/views/search_results/sections/_collection.html.erb +3 -0
  27. data/app/views/search_results/sections/_klass.html.erb +7 -0
  28. data/app/views/search_results/sections/_languages.html.erb +15 -0
  29. data/app/views/search_results/sections/_mode.html.erb +8 -0
  30. data/app/views/search_results/sections/_terms.html.erb +7 -0
  31. data/app/views/search_results/sections/_type.html.erb +5 -0
  32. data/config/engine.rb +1 -0
  33. data/config/initializers/iqvoc.rb +1 -0
  34. data/config/locales/de.yml +11 -2
  35. data/config/locales/en.yml +11 -2
  36. data/config/locales/pt.yml +6 -1
  37. data/db/migrate/20130502151221_fix_collection_member_types.rb +8 -0
  38. data/db/migrate/20130508103137_adjust_note_languages_setting.rb +17 -0
  39. data/db/schema.rb +1 -1
  40. data/iqvoc.gemspec +1 -0
  41. data/lib/iqvoc/ability.rb +2 -0
  42. data/lib/iqvoc/configuration/core.rb +66 -46
  43. data/lib/iqvoc/instance_configuration.rb +2 -0
  44. data/lib/iqvoc/navigation.rb +61 -0
  45. data/lib/iqvoc/version.rb +1 -1
  46. data/test/integration/instance_configuration_test.rb +1 -1
  47. data/test/integration/navigation_test.rb +47 -0
  48. metadata +32 -11
  49. data/app/assets/stylesheets/framework.css +0 -6
  50. data/app/assets/stylesheets/iqvoc/manifest.css +0 -12
  51. data/app/assets/stylesheets/manifest.css +0 -4
  52. data/vendor/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
  53. data/vendor/assets/images/bootstrap/glyphicons-halflings.png +0 -0
  54. data/vendor/assets/javascripts/bootstrap/bootstrap.js +0 -1824
  55. data/vendor/assets/stylesheets/bootstrap/bootstrap-responsive.css +0 -808
  56. data/vendor/assets/stylesheets/bootstrap/bootstrap.css +0 -4960
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe748701f343a235ed146e497547f4669a07d2aa
4
- data.tar.gz: a76fbd2601fc477dd0f0f7252f4761fe2c997259
3
+ metadata.gz: 69a13cf281376e316b925171dc9c5bc7a22bd9ab
4
+ data.tar.gz: cfd1c8a7b2d3476a3704c15ed0de3653337fff4d
5
5
  SHA512:
6
- metadata.gz: 55ee8b2a162e067453c1763995cc1cd1e2f6b89b050a5d0eeaafe400c5b082bb96762cb05ff7641dc91a6c99842af0af91a806df9459a7179ae02926b6acd427
7
- data.tar.gz: d5febd044f1da68dcf60dac66c617808cd742ac05a43d206a3b88d2b693de25bc955e080a86fe0cb60ab2aa091324f0d9feb9774f76c9b3e8582d7d782390f24
6
+ metadata.gz: 93f3bdcc53729392cd0b8bbc45ff03ce1f452f33401bad96e3d1fdc96c1610cebf50a985ca21edd029202e8472626b4952512bdcf6d70831bceb86945535bf27
7
+ data.tar.gz: 21976d7d516483188dcef8c4a09bfa604479afb97855079d3c333b9b6788d37f263ec4a52f518aba9587d000f5d40a0c155ae302f848fd31cf38b9cd7b56b9c5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [4.1.3]
2
+
3
+ This version is intended as the last minor/patch release before version 5.0.0 -
4
+ that will incorporate significant overhauls of both internal and external APIs
5
+ as well as more sophisticated RDF processing.
6
+
7
+ * Improved instance configuration UI
8
+ * Adjusted internal name of note languages setting for consistency
9
+ * Updated Bootstrap
10
+ * Introduced Navigation API<br />
11
+ iQvoc extensions can be injected into the main navigation either at root
12
+ level or in a separate group
13
+ * Removed duplicate results from search when concepts had unpublished versions
14
+
1
15
  ## [4.1.2]
2
16
 
3
17
  * Dumped Jbuilder (introduced in 4.1.1) to fix endless recursions happening in hierarchical views
data/Gemfile CHANGED
@@ -24,6 +24,7 @@ gem 'rails', '3.2.13'
24
24
  group :assets do
25
25
  gem 'uglifier', '>= 1.0.3'
26
26
  gem 'sass-rails', '~> 3.2.5'
27
+ gem 'bootstrap-sass', '~> 2.3.1.0'
27
28
  gem 'therubyracer', :platforms => :ruby
28
29
  end
29
30
 
data/Gemfile.lock CHANGED
@@ -47,6 +47,8 @@ GEM
47
47
  erubis (>= 2.7.0)
48
48
  binding_of_caller (0.7.1)
49
49
  debug_inspector (>= 0.0.1)
50
+ bootstrap-sass (2.3.1.0)
51
+ sass (~> 3.2)
50
52
  bouncy-castle-java (1.5.0146.1)
51
53
  builder (3.0.4)
52
54
  cancan (1.6.8)
@@ -102,8 +104,8 @@ GEM
102
104
  journey (1.0.4)
103
105
  jruby-openssl (0.7.7)
104
106
  bouncy-castle-java (>= 1.5.0146.1)
105
- json (1.7.7)
106
- json (1.7.7-java)
107
+ json (1.8.0)
108
+ json (1.8.0-java)
107
109
  kaminari (0.13.0)
108
110
  actionpack (>= 3.0.0)
109
111
  activesupport (>= 3.0.0)
@@ -218,6 +220,7 @@ DEPENDENCIES
218
220
  awesome_print
219
221
  better_errors
220
222
  binding_of_caller
223
+ bootstrap-sass (~> 2.3.1.0)
221
224
  cancan
222
225
  cane
223
226
  capybara
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # iQvoc
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/iqvoc.png)](http://badge.fury.io/rb/iqvoc)
3
4
  [![Build Status](https://secure.travis-ci.org/innoq/iqvoc.png)](http://travis-ci.org/innoq/iqvoc)
4
5
  [![Code Climate](https://codeclimate.com/github/innoq/iqvoc.png)](https://codeclimate.com/github/innoq/iqvoc)
5
6
 
@@ -5,4 +5,6 @@
5
5
  //= require jquery.treeview
6
6
  //= require jquery.treeview.async
7
7
  //= require storage
8
- //= require bootstrap/bootstrap
8
+ //= require bootstrap-transition
9
+ //= require bootstrap-collapse
10
+ //= require bootstrap-tab
@@ -72,7 +72,7 @@ jQuery(document).ready(function($) {
72
72
  var locale = document.documentElement.getAttribute("lang");
73
73
 
74
74
  // language selection
75
- $("#language_selection .dropdown-toggle").click(function(ev) { // use Bootstrap's Dropwdown, but without the side-effects
75
+ $(".dropdown-toggle").click(function(ev) { // use Bootstrap's Dropwdown, but without the side-effects
76
76
  $(this).closest(".dropdown").toggleClass("open");
77
77
  });
78
78
  var langWidget = $("ul.lang-widget")[0];
@@ -0,0 +1,8 @@
1
+ @import 'jquery.treeview';
2
+ @import 'jquery-ui-1.8.23.custom';
3
+
4
+ @import 'bootstrap';
5
+ body {
6
+ padding-top: 60px;
7
+ }
8
+ @import 'bootstrap-responsive';
@@ -1,64 +1,3 @@
1
- [class^="icon-"], [class*=" icon-"] {
2
- background-image: asset-data-url('bootstrap/glyphicons-halflings.png');
3
- }
4
-
5
- .icon-white {
6
- background-image: asset-data-url('bootstrap/glyphicons-halflings-white.png');
7
- }
8
-
9
- .dropdown-menu {
10
- h3 {
11
- margin: 0 10px;
12
- }
13
- label {
14
- margin: 0;
15
- padding: 2px 10px;
16
-
17
- &:hover, &:hover a {
18
- text-decoration: none;
19
- color: #FFF;
20
- background-color: #08C;
21
- }
22
-
23
- input {
24
- margin-right: 0.5em;
25
- display: inline;
26
- }
27
-
28
- a {
29
- padding-left: 0;
30
- display: inline;
31
- }
32
- }
33
- }
34
-
35
- .navbar {
36
- .brand {
37
- color: #fff;
38
- }
39
-
40
- .navbar-inner {
41
- padding: 0 5px;
42
-
43
- background: -moz-linear-gradient(top,#373737 0,#343434 50%,#242424 100%);
44
- background: -o-linear-gradient(top,#373737 0,#343434 50%,#242424 100%);
45
- background: -ms-linear-gradient(top,#373737 0,#343434 50%,#242424 100%);
46
- background: -webkit-gradient(linear,left top,left bottom,from(#373737),color-stop(0.5,#343434),to(#242424));
47
- background: -webkit-gradient(linear,left bottom,left top,color-stop(1,rgba(55, 55, 55, 1)),color-stop(0.5,rgba(52, 52, 52, 1)),color-stop(0.5,rgba(52, 52, 52, 1)),color-stop(0,rgba(36, 36, 36, 1)));
48
- border-top: 1px solid #2A2A2A;
49
- border-bottom: 1px solid black;
50
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
51
- }
52
- }
53
-
54
- // Unify topbar margin on all viewports
55
- @media (min-width: 980px) {
56
- .navbar-fixed-top {
57
- position: static;
58
- margin-bottom: 18px;
59
- }
60
- }
61
-
62
1
  form#search {
63
2
  .btn-group {
64
3
  margin-top: 10px;
@@ -123,3 +123,28 @@ ol.concepts {
123
123
  }
124
124
  }
125
125
  }
126
+
127
+ .lang-widget {
128
+ padding: 0 15px 20px 15px;
129
+
130
+ h3 {
131
+ margin-top: 10px;
132
+ margin-bottom: 0;
133
+ font-size: 18px;
134
+ }
135
+ label {
136
+ margin: 0;
137
+ padding: 2px 10px;
138
+
139
+ input {
140
+ margin-top: -2px;
141
+ margin-right: 0.5em;
142
+ display: inline;
143
+ }
144
+
145
+ a {
146
+ padding-left: 0;
147
+ display: inline;
148
+ }
149
+ }
150
+ }
@@ -0,0 +1,10 @@
1
+ @import 'iqvoc/bootstrap_extensions';
2
+ @import 'iqvoc/jquery-ui_extensions';
3
+ @import 'iqvoc/layout';
4
+ @import 'iqvoc/components';
5
+ @import 'iqvoc/panel';
6
+ @import 'iqvoc/sidebar';
7
+ @import 'iqvoc/forms';
8
+ @import 'iqvoc/note';
9
+ @import 'iqvoc/entity_select';
10
+ @import 'iqvoc/hacks';
@@ -0,0 +1,2 @@
1
+ @import 'framework';
2
+ @import 'iqvoc/manifest';
@@ -21,9 +21,18 @@ class InstanceConfigurationController < ApplicationController
21
21
  def index
22
22
  authorize! :show, Iqvoc.config
23
23
 
24
- @settings = Iqvoc.config.defaults.each_with_object({}) { |(key, default_value), hsh|
24
+ settings = Iqvoc.config.defaults.
25
+ each_with_object({}) do |(key, default_value), hsh|
25
26
  hsh[key] = serialize(Iqvoc.config[key], default_value)
26
- }
27
+ end
28
+
29
+ @settings_by_namespace = settings.inject({}) do |memo, (key, value)|
30
+ namespace, setting = key.split(".", 2)
31
+ namespace = setting ? namespace : "common"
32
+ memo[namespace] ||= {}
33
+ memo[namespace][key] = value
34
+ memo
35
+ end
27
36
  end
28
37
 
29
38
  def update
@@ -17,8 +17,9 @@
17
17
  class SearchResultsController < ApplicationController
18
18
 
19
19
  def index
20
- authorize! :read, Concept::Base # TODO: I think a :search right would be
21
- # better here because you're able to serach more than only concepts.
20
+ authorize! :read, Concept::Base
21
+ # TODO: requires a dedicated :search permission because this covers more
22
+ # than just concepts
22
23
 
23
24
  self.class.prepare_basic_variables(self)
24
25
 
@@ -1,3 +1,19 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2011-2013 innoQ Deutschland GmbH
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
1
17
  module FormHelper
2
18
 
3
19
  ## Generates verbose bootstrap wrapper HTML for generic forms
@@ -24,4 +40,4 @@ module FormHelper
24
40
  end
25
41
  end
26
42
 
27
- end
43
+ end
@@ -1,5 +1,20 @@
1
- module NavigationHelper
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2011-2013 innoQ Deutschland GmbH
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
2
16
 
17
+ module NavigationHelper
3
18
  # expects an array of hashes with the following members:
4
19
  # :content - usually a navigation link
5
20
  # :active? - an optional function determining whether the respective item is
@@ -8,13 +23,23 @@ module NavigationHelper
8
23
  # specific controller
9
24
  # :authorized? - an optional function determining whether the respective item
10
25
  # is available to the current user (defaults to true)
26
+ # :items - a list of hashes to be used as second-level navigation items
11
27
  def nav_items(items)
12
28
  items.map do |item|
13
- if (not item[:authorized?]) || instance_eval(&item[:authorized?])
14
- active = item[:active?] ? instance_eval(&item[:active?]) : (item[:controller] ? params[:controller] == item[:controller] : false)
15
-
16
- content_tag "li", instance_eval(&item[:content]),
17
- :class => ("active" if active)
29
+ if !item.has_key?(:authorized?) || instance_eval(&item[:authorized?])
30
+ if item[:items]
31
+ content_tag :li, :class => "dropdown" do
32
+ raw(link_to(element_value(item[:text]).html_safe +
33
+ content_tag(:b, nil, :class => "caret"), "#",
34
+ :class => "dropdown-toggle",
35
+ :data => { :toggle => "dropdown" }) +
36
+ content_tag(:ul,
37
+ item[:items].map { |i| nav_item(i) }.join.html_safe,
38
+ :class => "dropdown-menu"))
39
+ end
40
+ else
41
+ nav_item(item)
42
+ end
18
43
  end
19
44
  end.join.html_safe
20
45
  end
@@ -55,4 +80,20 @@ module NavigationHelper
55
80
  content_tag :li, content, :class => css_class
56
81
  end
57
82
 
83
+ private
84
+
85
+ def nav_item(item)
86
+ active = item[:active?] ? instance_eval(&item[:active?]) : (item[:controller] ? params[:controller] == item[:controller] : false)
87
+ css = active ? "active" : nil
88
+ content_tag :li, link_to(element_value(item[:text]), element_value(item[:href])), :class => css
89
+ end
90
+
91
+ def nav_item_authorized?(item)
92
+ !item.has_key?(:authorized?) || instance_eval(&item[:authorized?])
93
+ end
94
+
95
+ def element_value(e)
96
+ e.is_a?(Proc) ? instance_eval(&e) : e
97
+ end
98
+
58
99
  end
@@ -46,11 +46,12 @@ class Labeling::SKOS::Base < Labeling::Base
46
46
  query_str = build_query_string(params)
47
47
 
48
48
  scope = includes(:target).order("LOWER(#{Label::Base.table_name}.value)")
49
+ languages = Array(params[:languages])
49
50
 
50
51
  if params[:query].present?
51
- scope = scope.merge(Label::Base.by_query_value(query_str).by_language(params[:languages].to_a).published)
52
+ scope = scope.merge(Label::Base.by_query_value(query_str).by_language(languages).published)
52
53
  else
53
- scope = scope.merge(Label::Base.by_language(params[:languages].to_a).published)
54
+ scope = scope.merge(Label::Base.by_language(languages).published)
54
55
  end
55
56
 
56
57
  if params[:collection_origin].present?
@@ -66,7 +67,7 @@ class Labeling::SKOS::Base < Labeling::Base
66
67
 
67
68
  scope = case params[:for]
68
69
  when 'concept'
69
- scope.where('concepts.type' => Iqvoc::Concept.base_class_name).merge(Concept::Base.published)
70
+ scope.where('concepts.type' => Iqvoc::Concept.base_class_name)
70
71
  when 'collection'
71
72
  scope.where('concepts.type' => Iqvoc::Collection.base_class_name)
72
73
  else
@@ -74,7 +75,7 @@ class Labeling::SKOS::Base < Labeling::Base
74
75
  scope
75
76
  end
76
77
 
77
- scope
78
+ scope.merge(Concept::Base.published)
78
79
  end
79
80
 
80
81
  def self.search_result_partial_name
@@ -86,7 +87,11 @@ class Labeling::SKOS::Base < Labeling::Base
86
87
  raise "#{self.name}#build_from_rdf: Object (#{rdf_object}) must be a string literal" unless rdf_object =~ /^"(.+)"(@(.+))?$/
87
88
 
88
89
  lang = $3
89
- value = JSON.parse(%Q{["#{$1}"]})[0].gsub("\\n", "\n") # Trick to decode \uHHHHH chars
90
+ value = begin
91
+ JSON.parse(%Q{["#{$1}"]})[0].gsub("\\n", "\n") # Trick to decode \uHHHHH chars
92
+ rescue JSON::ParserError
93
+ $1
94
+ end
90
95
 
91
96
  predicate_class = Iqvoc::RDFAPI::PREDICATE_DICTIONARY[rdf_predicate] || self
92
97
  predicate_class.new(:target => self.label_class.new(:value => value, :language => lang)).tap do |labeling|
@@ -49,7 +49,7 @@
49
49
  </fieldset>
50
50
 
51
51
  <div class="form-actions">
52
- <%= f.submit t("txt.common.save"), :class => "btn-primary" %>
52
+ <%= f.submit t("txt.common.save"), :class => "btn btn-primary" %>
53
53
  </div>
54
54
 
55
55
  <% end %>
@@ -73,7 +73,7 @@
73
73
  <!-- / Notations -->
74
74
 
75
75
  <div class="form-actions">
76
- <%= f.submit t("txt.common.save"), :class => "btn-primary" %>
76
+ <%= f.submit t("txt.common.save"), :class => "btn btn-primary" %>
77
77
  </div>
78
78
 
79
79
  <% end %>
@@ -25,6 +25,6 @@
25
25
  <% end %>
26
26
  </fieldset>
27
27
  <div class="form-actions">
28
- <%= f.submit t("txt.common.save"), :class => "btn-primary" %>
28
+ <%= f.submit t("txt.common.save"), :class => "btn btn-primary" %>
29
29
  </div>
30
30
  <% end %>
@@ -1,12 +1,20 @@
1
1
  <%= page_header :title => t("txt.views.instance_configuration.caption").titleize %>
2
2
 
3
- <%= form_tag(instance_configuration_path, :method => :put, :class => "") do %>
4
- <% @settings.each do |key, value| %>
5
- <label>
6
- <%= t("txt.views.instance_configuration.settings.#{key.gsub(".", "_")}") %>
7
- (<code><%= key %></code>)
8
- </label>
9
- <%= text_field_tag "config[#{key}]", value %>
3
+ <%= form_tag(instance_configuration_path, :method => :put, :class => "form-horizontal") do %>
4
+ <% @settings_by_namespace.each do |namespace, settings| %>
5
+ <fieldset>
6
+ <legend><%= t("txt.views.instance_configuration.groups.#{namespace}").titleize %></legend>
7
+ <% settings.each do |key, value| %>
8
+ <div class="control-group">
9
+ <label class="control-label">
10
+ <%= t("txt.views.instance_configuration.settings.#{key.gsub(".", "_")}") %>
11
+ </label>
12
+ <div class="controls">
13
+ <%= text_field_tag "config[#{key}]", value %>
14
+ </div>
15
+ </div>
16
+ <% end %>
17
+ </fieldset>
10
18
  <% end %>
11
19
  <div class="form-actions">
12
20
  <%= submit_tag t("txt.common.save"), :class => "btn btn-primary" %>