hobo 1.3.0.RC1 → 1.3.0.RC2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0.RC1
1
+ 1.3.0.RC2
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.add_runtime_dependency('hobo_support', ["= #{version}"])
15
15
  s.add_runtime_dependency('hobo_fields', ["= #{version}"])
16
16
  s.add_runtime_dependency('dryml', ["= #{version}"])
17
- s.add_runtime_dependency('will_paginate', [">= 3.0.pre"])
17
+ s.add_runtime_dependency('will_paginate', [">= 3.0.0"])
18
18
 
19
19
  s.add_development_dependency('rubydoctest', [">= 0"])
20
20
  s.add_development_dependency('shoulda', [">= 0"])
@@ -0,0 +1,25 @@
1
+ # Even if you only support one language, you can use this file to customise the names that appear in the UI
2
+ # e.g.
3
+
4
+ nb:
5
+ hello: "Hei verden"
6
+
7
+ # attributes:
8
+ # created_at: Opprettet
9
+ # updated_at: Endret
10
+ #
11
+ # activerecord:
12
+ # models:
13
+ # user:
14
+ # one: Bruker
15
+ # other: Brukere
16
+ # attributes:
17
+ # user:
18
+ # name: Navn
19
+ # password: Passord
20
+ # current_password: Gjeldende Password
21
+ # password_confirmation: Bekreft Passord
22
+ # email_address: E-post
23
+ # attribute_help:
24
+ # user:
25
+ # email_address: Vi kommer aldri til � dele mailadressen din med tredjepart
@@ -0,0 +1,198 @@
1
+ # Hobo internals translation file for Norwegian
2
+ # Translated by Ronny Hanssen (super.ronny@gmail.com)
3
+ # If you find an error or if you have suggestions on improvements, please post it to http://hobousers.googlegroups.com.
4
+
5
+ nb:
6
+ hobo:
7
+ # default hobo pages translations
8
+ index:
9
+ # if you uncomment the following you will loose the automatic selection of dynamically pluralized nav-tabs
10
+ # if you need a different title you should implement a different way to select the tab on your own
11
+ #title: "%{model} Index"
12
+ heading: "%{model}liste"
13
+
14
+ new:
15
+ title: "Ny %{model}"
16
+ heading: "Ny %{model}"
17
+
18
+ show:
19
+ title: "%{model}"
20
+ heading: "%{model} %{name}"
21
+ back_link: "Tilbake"
22
+ edit_link: "Endre %{model}"
23
+ new_link: "Ny %{model}"
24
+ add_form_heading: "Legg til %{model}"
25
+
26
+ edit:
27
+ title: "Endre %{model}"
28
+ heading: "Endre %{model}"
29
+
30
+ index_for_owner:
31
+ title: "%{model} for"
32
+ # be aware that you will loose the automatic Your <collection> / Jom's <collection>
33
+ # default output for User models
34
+ # you better define the heading.* in the specific collection namespace
35
+ #heading:
36
+ subheading: "For:"
37
+
38
+ new_for_owner:
39
+ title: "Ny %{model} for"
40
+ heading: "Ny %{model}"
41
+ subheading: "For:"
42
+
43
+ login:
44
+ title: "Logg på"
45
+ heading: "Logg på"
46
+ email_address: &email_address "E-post adresse"
47
+ name: "Navn"
48
+ password: "Passord"
49
+ remember_me: "Husk meg"
50
+ login: "Logg på"
51
+ signup: "Opprett konto"
52
+ forgot_password: &forgot_password "Glemt passordet?"
53
+
54
+ signup:
55
+ title: "Opprett Konto"
56
+ heading: "Opprett Konto"
57
+
58
+ forgot_password:
59
+ title: *forgot_password
60
+ heading: *forgot_password
61
+ text: "Skriv inn epost-adressen du brukte når du registrerte deg.
62
+ Vi sender deg en epost som du kan bruke for å generere et nytt passord."
63
+ email_address: *email_address
64
+ send: "Send"
65
+
66
+ forgot_password_sent:
67
+ title: "Gjenopprettelse av passord - Epost sendt."
68
+ heading: "Gjenopprettelse av passord - Epost sendt."
69
+ text: "En epost med instruksjoner om hvordan du kan opprette nytt passsord har blitt sendt til %{email_address}. Hvis du ikke mottar denne mailen så vennligst sjekk søppelpostfilter o.l."
70
+
71
+ account_disabled_page:
72
+ title: "Konto inaktiv"
73
+ heading: "Konto inaktiv"
74
+ text: "Kontoen din er inaktiv for øyeblikket."
75
+
76
+ account_page:
77
+ title: "Din Konto"
78
+ heading: "Din Konto"
79
+ new_password: "Nytt passord"
80
+ confirm_new_password: "Bekreft nytt passord"
81
+
82
+ # default hobo action translation
83
+ # The action with added model variable are new, create, delete, save,
84
+ # edit and back_to_parent
85
+ actions:
86
+ new: "Ny %{model}"
87
+ create: "Opprett %{model}"
88
+ previous: "Forrige"
89
+ next: "Neste"
90
+ add: "Legg til"
91
+ show_all: "Vis alle %{model}..."
92
+ delete: "Slett %{model}"
93
+ save: "Lagre %{model}"
94
+ cancel: "Avbryt"
95
+ edit: "Endre %{model}"
96
+ edit_control: "Endre"
97
+ back: "Tilbake til"
98
+ back_to_parent: "Tilbake til %{parent} %{name}"
99
+ send: "Send"
100
+ remove: "Fjern"
101
+ signup: "Opprett konto"
102
+ login: "Logg på"
103
+ logout: "Logg av"
104
+ logged_in_as: "Logget på som %{name}"
105
+ account: "Konto"
106
+ save_account: "Lagre Dine Innstillinger"
107
+
108
+ # default hobo message translation
109
+ messages:
110
+ create:
111
+ success: "%{model} ble opprettet"
112
+ error: "Klarte ikke å opprette %{model}.\n%{errors}"
113
+ creator:
114
+ error: "Kunne ikke utføre oppretteren; %{name}.\n%{errors}"
115
+ transition:
116
+ error: "Kunne ikke utføre transisjonen; %{name}.\n%{errors}"
117
+ update:
118
+ no_attribute_error: "Ingen oppdatering spesifisert i 'params'"
119
+ success: "Endringene for %{model} ble lagret"
120
+ error: "Det oppsto et problem med å gjennomføre denne endringen.\n%{errors}"
121
+ destroy:
122
+ success: "%{model} ble slettet"
123
+ signup:
124
+ success: "Takk for at du opprettet en konto!"
125
+ must_activate: "Du må aktivere kontoen din før du kan logge på. Vennligst sjekk eposten din."
126
+ login:
127
+ success: "Du er nå logget på."
128
+ error: "Du oppga ikke et gyldig %{login} og passord!"
129
+ logout: "Du er nå logget av."
130
+ reset_password: "Passordet ditt har blitt tilbakestilt."
131
+ permission_denied: "Ingen Tilgang"
132
+ not_found: "Finner ikke siden du ba om."
133
+ unauthenticated: "Kunne ikke autentisere deg"
134
+ validate_password: "må være minst 6 tegn langt og kan ikke være bare små bokstaver"
135
+ current_password_is_not_correct: "er ikke riktig"
136
+ you_are_site_admin: "Du har nå admininstrator-rettigheter for dette webstedet"
137
+ you_signed_up: "Du har opprettet konto"
138
+ none: "Ingen %{model} tilgjengelig."
139
+ confirm: "Er du sikker?"
140
+
141
+ # default hobo collection translation
142
+ collection:
143
+ count: &collection_count
144
+ zero: "Ingen %{model}"
145
+ one: "Viser %{count} %{model}"
146
+ other: "Viser %{count} %{model}"
147
+ # you can use the following to completely override the collection heading
148
+ # be aware that you will loose the automatic Your <collection> / Jom's <collection>
149
+ # default output for User models
150
+ # you better define the heading.* in the specific collection namespace
151
+ #heading:
152
+ add_form_heading: "Legg til %{model}"
153
+ empty_message: "Ingen poster å vise"
154
+
155
+ # default hobo form translation
156
+ form:
157
+ new:
158
+ heading: "Ny %{model}"
159
+ error:
160
+ heading: "Følgende feil oppstod:"
161
+ select_many:
162
+ prompt: "Legg til %{model}"
163
+
164
+ # hobo support
165
+ support:
166
+ or: "eller"
167
+ a: "en"
168
+ an: "en"
169
+
170
+ table_plus:
171
+ search: "Søk"
172
+ submit_label: "Søk"
173
+
174
+ live_search:
175
+ label: "Søk"
176
+ results_label: "Søkeresultater"
177
+ close_button: "lukk"
178
+ no_results: "Ingen resultater for søket ditt."
179
+
180
+ dev_user_changer:
181
+ guest: "Gjest"
182
+
183
+ admin:
184
+ subsite_name: "Admin"
185
+ invite_new_user: "Invitér en ny bruker"
186
+
187
+ subsite:
188
+ back_link: "Tlbake til nettstedet"
189
+
190
+ boolean_yes: "Ja"
191
+ boolean_no: "Nei"
192
+ password_hidden: "[passordet er skjult]"
193
+
194
+ in_place_editor:
195
+ click_to_edit: "(klikk her for å endre)"
196
+
197
+ select_one_editor:
198
+ blank_message: *no_model
@@ -444,23 +444,6 @@ var Hobo = {
444
444
  },
445
445
 
446
446
 
447
- fixSectionGroup: function(e) {
448
- rows = e.childElements().map(function(e, i) {
449
- cells = e.childElements().map(function(e, i) {
450
- return e.outerHTML.sub("<DIV", "<td valign='top'").sub(/<\/DIV>$/i, "</td>")
451
- }).join('')
452
-
453
- var attrs = e.outerHTML.match(/<DIV([^>]+)/)[1]
454
- return "<tr" + attrs + ">" + cells + "</tr>"
455
- }).join("\n")
456
-
457
- var attrs = e.outerHTML.match(/<DIV([^>]+)/)[1]
458
-
459
- var table= "<table cellpadding='0' cellspacing='0' border='0' style='border-collapse: collapse; border-spacing: 0'" + attrs + ">" +
460
- rows + "</table>"
461
- e.outerHTML = table
462
- },
463
-
464
447
  makeHtmlEditor: function(textarea) {
465
448
  // do nothing - plugins can overwrite this method
466
449
  }
@@ -913,10 +896,6 @@ AutocompleteBehavior = Behavior.create({
913
896
  Event.addBehavior.reassignAfterAjax = true;
914
897
  Event.addBehavior({
915
898
 
916
- 'div.section-group' : function() {
917
- if (Prototype.Browser.IE) Hobo.fixSectionGroup(this);
918
- },
919
-
920
899
  'div.select-many.input' : SelectManyInput(),
921
900
 
922
901
  'textarea.html' : function() {
@@ -34,7 +34,7 @@ module Generators
34
34
  routes << link("put '#{records}/:id/#{transition}(.:format)' => '#{records}#do_#{transition}', :as => 'do_#{record}_#{transition}'", transition, :put)
35
35
  routes << link("get '#{records}/:id/#{transition}(.:format)' => '#{records}##{transition}', :as => '#{record}_#{transition}'", transition)
36
36
  end
37
- routes.compact
37
+ routes.compact.uniq
38
38
  end
39
39
 
40
40
  def resource_routes
@@ -785,16 +785,16 @@ module Hobo
785
785
 
786
786
 
787
787
  def this
788
- @this ||= (instance_variable_get("@#{model.name.underscore}") ||
789
- instance_variable_get("@#{model.name.underscore.pluralize}"))
788
+ @this ||= (instance_variable_get("@#{model.name.demodulize.underscore}") ||
789
+ instance_variable_get("@#{model.name.demodulize.underscore.pluralize}"))
790
790
  end
791
791
 
792
792
 
793
793
  def this=(object)
794
- ivar = if object.is_a?(Array)
795
- (object.try.member_class || model).name.underscore.pluralize
794
+ ivar = if object.is_a?(Array) || object.respond_to?(:member_class)
795
+ (object.try.member_class || model).name.demodulize.underscore.pluralize
796
796
  else
797
- object.class.name.underscore
797
+ object.class.name.demodulize.underscore
798
798
  end
799
799
  @this = instance_variable_set("@#{ivar}", object)
800
800
  end
@@ -56,21 +56,45 @@ module Hobo
56
56
 
57
57
  WillPaginate::Collection.class_eval do
58
58
  attr_accessor :member_class, :origin, :origin_attribute
59
+
60
+ # make paginate_by_sql, etc. carry metadata
61
+ def replace_with_hobo_metadata(array)
62
+ result = replace_without_hobo_metadata(array)
63
+ self.member_class = array.try.member_class
64
+ self.origin = array.try.origin
65
+ self.origin_attribute = array.try.origin_attribute
66
+ result
67
+ end
68
+ alias_method_chain :replace, :hobo_metadata
59
69
  end
60
70
 
61
- WillPaginate::Finders::Base.class_eval do
62
- def paginate_with_hobo_metadata(*args, &block)
71
+ WillPaginate::ActiveRecord::Pagination.class_eval do
72
+
73
+ def apply_hobo_metadata(collection)
63
74
  klass = Object.instance_method(:class).bind(self).call
64
75
  is_relation = klass <= ActiveRecord::Relation
65
76
  is_association_proxy = klass <= ActiveRecord::Associations::AssociationProxy
66
- collection = paginate_without_hobo_metadata(*args, &block)
67
77
  collection.member_class = (is_relation || is_association_proxy) ? member_class : self
68
78
  collection.origin = try.proxy_owner
69
79
  collection.origin_attribute = try.proxy_reflection._?.name
70
80
  collection
71
81
  end
82
+
83
+ # NOTE: as of will_paginate 3.0.0, the standard paginate method calls the page method.
84
+ # However, it converts an association proxy into a relation first (via adding a limit clause),
85
+ # which causes the proxy_owner and proxy_reflection methods to disappear.
86
+ def paginate_with_hobo_metadata(*args, &block)
87
+ collection = paginate_without_hobo_metadata(*args, &block)
88
+ apply_hobo_metadata(collection)
89
+ end
72
90
  alias_method_chain :paginate, :hobo_metadata
73
91
 
92
+ def page_with_hobo_metadata(*args, &block)
93
+ collection = page_without_hobo_metadata(*args, &block)
94
+ apply_hobo_metadata(collection)
95
+ end
96
+ alias_method_chain :page, :hobo_metadata
97
+
74
98
  end
75
99
 
76
100
  end
@@ -119,7 +143,6 @@ module Hobo
119
143
  end
120
144
  end
121
145
 
122
-
123
146
  module ClassMethods
124
147
 
125
148
  # TODO: should this be an inheriting_cattr_accessor as well? Probably.
@@ -103,9 +103,9 @@ module Hobo
103
103
  end
104
104
 
105
105
  def transition(name, change, options={}, &block)
106
- @lifecycle.def_transition(name,
107
- Array(change.keys.first), change.values.first,
108
- block, options)
106
+ change.each do |k,v|
107
+ @lifecycle.def_transition(name, Array(k), v, block, options)
108
+ end
109
109
  end
110
110
 
111
111
  def invariant(&block)
@@ -41,7 +41,7 @@ module Hobo
41
41
  Creator.new(self, name.to_s, on_create, options)
42
42
  end
43
43
 
44
- def self.def_transition(name, start_state, end_states, on_transition, options)
44
+ def self.def_transition(name, start_states, end_state, on_transition, options)
45
45
  class_eval %{
46
46
  def #{name}!(user, attributes=nil)
47
47
  transition(:#{name}, user, attributes)
@@ -50,7 +50,7 @@ module Hobo
50
50
  can_transition?(:#{name}, user)
51
51
  end
52
52
  }
53
- Transition.new(self, name.to_s, start_state, end_states, on_transition, options)
53
+ Transition.new(self, name.to_s, start_states, end_state, on_transition, options)
54
54
  end
55
55
 
56
56
  def self.state_names
@@ -29,7 +29,7 @@ model_key = model.to_s.underscore
29
29
  </def>
30
30
  <% end -%>
31
31
 
32
- <% transitions.each do |transition| -%>
32
+ <% transitions.uniq{|s| s.name}.each do |transition| -%>
33
33
  <def tag="<%= transition.name.to_s.dasherize %>-form" polymorphic/>
34
34
  <def tag="<%= transition.name.to_s.dasherize %>-form" for="<%= model.name %>">
35
35
  <form lifecycle="<%= transition.name %>" merge param="default">
@@ -314,7 +314,7 @@ new_link = :new.in?(actions)
314
314
 
315
315
  <section param="content-body">
316
316
  <% if new_link -%>
317
- <a action="new" to="&model" param="new-link">
317
+ <a action="new" to="&@<%= owner %>.<%= collection_name %>" param="new-link">
318
318
  <ht key="<%= model_key %>.actions.new" >New <%=model_name %></ht>
319
319
  </a>
320
320
 
@@ -496,12 +496,14 @@ Assuming the context is a blog post...
496
496
  <!-- Renders localized `number_with_delimiter this`, or `format % this` if the `format` attribute is given -->
497
497
  <def tag="view" for="Numeric" attrs="format"><%= format ? format % this : number_with_delimiter(this) %></def>
498
498
 
499
- <!-- Renders `this` with HTML escaping and newlines replaced with `<br>` tags -->
499
+ <!-- If `this.html_safe?`, returns this unchanged. Otherwise renders `this` with HTML escaping and newlines replaced with `<br>` tags -->
500
500
  <def tag="view" for="string"><%=
501
- if !(this.class == String) && this.respond_to?(:to_html) # workaround for Maruku which adds String#to_html : (
501
+ if this.html_safe?
502
+ this
503
+ elsif !(this.class == String) && this.respond_to?(:to_html) # workaround for Maruku which adds String#to_html : (
502
504
  this.to_html(scope.xmldoctype)
503
505
  else
504
- h(this).gsub("\n", "<br#{scope.xmldoctype ? ' /' : ''}>")
506
+ h(this).gsub("\n", "<br#{scope.xmldoctype ? ' /' : ''}>").html_safe
505
507
  end
506
508
  %></def>
507
509
 
@@ -25,7 +25,9 @@ Transitions with parameters are implemented using a form. HTML does not allow f
25
25
 
26
26
  html_attributes[:method] ||= has_params ? :get : :put
27
27
  add_classes!(html_attributes, "transition-button #{transition_name}-button")
28
- label = ht("#{this.class.to_s.underscore}.actions.#{transition_name}", :default => (label || transition_name.to_s.titleize))
28
+ label = t("activerecord.attributes.#{this.class.to_s.underscore}.lifecycle.transitions.#{transition_name}", :default => (label || transition_name.to_s.titleize))
29
+ title = t("activerecord.attribute_help.#{this.class.to_s.underscore}.lifecycle.transitions.#{transition_name}")
30
+ html_attributes.update(:title => title) unless title.empty?
29
31
  url = object_url(this, transition_name, :method => html_attributes[:method])
30
32
 
31
33
  if (update || !ajax_attributes.empty?) && !has_params
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hobo
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 1.3.0.RC1
5
+ version: 1.3.0.RC2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tom Locke
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-05 00:00:00 -04:00
13
+ date: 2011-08-15 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - "="
23
23
  - !ruby/object:Gem::Version
24
- version: 1.3.0.RC1
24
+ version: 1.3.0.RC2
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirements:
33
33
  - - "="
34
34
  - !ruby/object:Gem::Version
35
- version: 1.3.0.RC1
35
+ version: 1.3.0.RC2
36
36
  type: :runtime
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - "="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.3.0.RC1
46
+ version: 1.3.0.RC2
47
47
  type: :runtime
48
48
  version_requirements: *id003
49
49
  - !ruby/object:Gem::Dependency
@@ -54,7 +54,7 @@ dependencies:
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: 3.0.pre
57
+ version: 3.0.0
58
58
  type: :runtime
59
59
  version_requirements: *id004
60
60
  - !ruby/object:Gem::Dependency
@@ -147,6 +147,7 @@ files:
147
147
  - lib/generators/hobo/i18n/templates/app.es.yml
148
148
  - lib/generators/hobo/i18n/templates/app.fr.yml
149
149
  - lib/generators/hobo/i18n/templates/app.it.yml
150
+ - lib/generators/hobo/i18n/templates/app.nb.yml
150
151
  - lib/generators/hobo/i18n/templates/app.pt-PT.yml
151
152
  - lib/generators/hobo/i18n/templates/app.ru.yml
152
153
  - lib/generators/hobo/i18n/templates/hobo.de.yml
@@ -154,6 +155,7 @@ files:
154
155
  - lib/generators/hobo/i18n/templates/hobo.es.yml
155
156
  - lib/generators/hobo/i18n/templates/hobo.fr.yml
156
157
  - lib/generators/hobo/i18n/templates/hobo.it.yml
158
+ - lib/generators/hobo/i18n/templates/hobo.nb.yml
157
159
  - lib/generators/hobo/i18n/templates/hobo.pt-PT.yml
158
160
  - lib/generators/hobo/i18n/templates/hobo.ru.yml
159
161
  - lib/generators/hobo/invite_only.rb