typus 3.1.1 → 3.1.2

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/CHANGELOG CHANGED
@@ -1,6 +1,13 @@
1
1
  = 3.2.0 (unreleased)
2
2
 
3
- = 3.1.1 (unreleased)
3
+ = 3.1.2
4
+
5
+ * [CHANGED] Images, links and belongs_to associations do not have links
6
+ when popup mode. This will avoid an "Inception" problem.
7
+
8
+ * [FIXED] Problems on HABTM associations when generating association names.
9
+
10
+ = 3.1.1
4
11
 
5
12
  * [CHANGED] Removed user guide. Docs can now be found at http://docs.typuscmf.com/
6
13
 
data/README.md CHANGED
@@ -55,7 +55,7 @@ user to be able to run tests.
55
55
 
56
56
  ## Links
57
57
 
58
- - [Documentation](https://docs.typuscmf.com/)
58
+ - [Documentation](http://docs.typuscmf.com/)
59
59
  - [Issues](https://github.com/typus/typus/issues)
60
60
  - [Source Code][typus] and [RubyGems][typus_gem]
61
61
  - [Mailing List](http://groups.google.com/group/typus)
@@ -2,7 +2,7 @@ $(document).ready(function() {
2
2
 
3
3
  $("#quicksearch").searchField();
4
4
 
5
- $('.resource :input', document.myForm).bind("change", function() { setConfirmUnload(true); });
5
+ $(".resource :input", document.myForm).bind("change", function() { setConfirmUnload(true); });
6
6
 
7
7
  $("a.fancybox").fancybox({
8
8
  'titlePosition': 'over',
@@ -11,24 +11,6 @@ $(document).ready(function() {
11
11
  'scrolling': false,
12
12
  });
13
13
 
14
- $(".iframe_with_form_reload").fancybox({
15
- 'width': 720,
16
- 'height': '90%',
17
- 'autoScale': false,
18
- 'transitionIn': 'none',
19
- 'transitionOut': 'none',
20
- 'type': 'iframe',
21
- 'centerOnScroll': true,
22
- 'scrolling': false,
23
- onClosed: function() {
24
- var attribute = Typus.resource_attribute;
25
- var text = Typus.resource_to_label;
26
- var value = Typus.resource_id;
27
- $(attribute).append(new Option(text, value, true, true));
28
- $(".chzn-select").trigger("liszt:updated");
29
- },
30
- });
31
-
32
14
  $(".iframe").fancybox({
33
15
  'width': 720,
34
16
  'height': '90%',
@@ -39,8 +21,15 @@ $(document).ready(function() {
39
21
  'centerOnScroll': true,
40
22
  'scrolling': false,
41
23
  onClosed: function() {
42
- if (Typus.parent_location_reload)
24
+ if (Typus.parent_location_reload) {
43
25
  parent.location.reload(true);
26
+ } else {
27
+ var attribute = Typus.resource_attribute;
28
+ var text = Typus.resource_to_label;
29
+ var value = Typus.resource_id;
30
+ $(attribute).append(new Option(text, value, true, true));
31
+ $(".chzn-select").trigger("liszt:updated");
32
+ }
44
33
  },
45
34
  });
46
35
 
@@ -6,7 +6,7 @@
6
6
  *= require typus/reset
7
7
  *= require typus/layout
8
8
  *= require typus/defaults
9
- *= require typus/errors
9
+ *= require typus/feedback
10
10
  *= require typus/account
11
11
  *= require typus/header
12
12
  *= require typus/content
@@ -31,3 +31,9 @@
31
31
 
32
32
  #errorExplanation ul { margin: 1em 1.5em; }
33
33
  #errorExplanation ul li { list-style: square!important; margin: 0!important; }
34
+
35
+ .notice p,
36
+ .alert p {
37
+ margin: 0;
38
+ padding: 5px 0;
39
+ }
@@ -41,7 +41,7 @@ module Admin::Resources::DataTypes::BelongsToHelper
41
41
  if att_value = item.send(attribute)
42
42
  action = item.send(attribute).class.typus_options_for(:default_action_on_item)
43
43
  message = att_value.to_label
44
- if admin_user.can?(action, att_value.class.name)
44
+ if !params[:_popup] && admin_user.can?(action, att_value.class.name)
45
45
  message = link_to(message, :controller => "/admin/#{att_value.class.to_resource}", :action => action, :id => att_value.id)
46
46
  end
47
47
  end
@@ -51,9 +51,14 @@ module Admin::Resources::DataTypes::BelongsToHelper
51
51
 
52
52
  def display_belongs_to(item, attribute)
53
53
  data = item.send(attribute)
54
- link_to data.to_label, { :controller => data.class.to_resource,
55
- :action => params[:action],
56
- :id => data.id }
54
+
55
+ options = {
56
+ :controller => data.class.to_resource,
57
+ :action => params[:action],
58
+ :id => data.id
59
+ }
60
+
61
+ params[:_popup] ? data.to_label : link_to(data.to_label, options)
57
62
  end
58
63
 
59
64
  def belongs_to_filter(filter)
@@ -78,7 +83,7 @@ module Admin::Resources::DataTypes::BelongsToHelper
78
83
  :action => 'new',
79
84
  :attribute => options[:attribute],
80
85
  :_popup => true }
81
- link_to Typus::I18n.t("Add New"), default_options, { :class => 'iframe_with_form_reload' }
86
+ link_to Typus::I18n.t("Add New"), default_options, { :class => 'iframe' }
82
87
  end
83
88
 
84
89
  end
@@ -27,7 +27,7 @@ module Admin::Resources::DataTypes::DragonflyHelper
27
27
  :preview => data.process(:thumb, Typus.image_preview_size).url,
28
28
  :thumb => data.process(:thumb, Typus.image_table_thumb_size).url
29
29
  else
30
- link_to data.name, data.url
30
+ params[:_popup] ? data.name : link_to(data.name, data.url)
31
31
  end
32
32
  end
33
33
 
@@ -42,7 +42,9 @@ module Admin::Resources::DataTypes::DragonflyHelper
42
42
  :thumb => data.process(:thumb, Typus.image_thumb_size).url,
43
43
  :options => options
44
44
  else
45
- link_to data.name, data.url
45
+ html = params[:_popup] ? data.name : link_to(data.name, data.url)
46
+ # OPTIMIZE: Generate the tag with Ruby.
47
+ "<p>#{html}</p>".html_safe
46
48
  end
47
49
  end
48
50
 
@@ -11,7 +11,7 @@ module Admin::Resources::DataTypes::HasAndBelongsToManyHelper
11
11
 
12
12
  resource_ids = "#{attribute.singularize}_ids"
13
13
  html_options = { :disabled => attribute_disabled?(resource_ids.to_sym) }
14
- model = @resource.name.downcase.gsub("::", "_")
14
+ model = @resource.name.underscore.gsub("/", "_")
15
15
  options = { :attribute => "#{model}_#{attribute}" }
16
16
 
17
17
  label_text = @resource.human_attribute_name(attribute)
@@ -32,7 +32,7 @@ module Admin::Resources::DataTypes::HasAndBelongsToManyHelper
32
32
  render "admin/templates/has_and_belongs_to_many", locals
33
33
  end
34
34
 
35
- def build_label_text_for_has_and_belongs_to_many(klass, html_options, options)
35
+ def build_label_text_for_has_and_belongs_to_many(klass, html_options, options = {})
36
36
  if html_options[:disabled] == true
37
37
  Typus::I18n.t("Read only")
38
38
  elsif admin_user.can?('create', klass) && !headless_mode?
@@ -46,7 +46,7 @@ module Admin::Resources::DataTypes::HasAndBelongsToManyHelper
46
46
  :attribute => options[:attribute],
47
47
  :_popup => true }
48
48
 
49
- link_to Typus::I18n.t("Add New"), options, { :class => "iframe_with_form_reload" }
49
+ link_to Typus::I18n.t("Add New"), options, { :class => "iframe" }
50
50
  end
51
51
 
52
52
  end
@@ -12,8 +12,12 @@
12
12
 
13
13
  <fieldset class="buttons">
14
14
  <ol>
15
- <% build_save_options.each do |key, value| %>
16
- <li><%= submit_tag Typus::I18n.t(value), :name => key, :onclick => "setConfirmUnload(false);", :disable_with => Typus::I18n.t(value) %></li>
15
+ <% build_save_options.each do |key, value, special| %>
16
+ <%
17
+ message = Typus::I18n.t(value)
18
+ options = { :name => key, :onclick => "setConfirmUnload(false);", :disable_with => message }
19
+ %>
20
+ <li><%= submit_tag message, options %></li>
17
21
  <% end %>
18
22
  </ol>
19
23
  </fieldset>
@@ -1,3 +1,7 @@
1
- <%= link_to preview, :class => "fancybox" do %>
1
+ <% if params[:_popup] %>
2
2
  <%= image_tag thumb, :alt => preview %>
3
+ <% else %>
4
+ <%= link_to preview, :class => "fancybox" do %>
5
+ <%= image_tag thumb, :alt => preview %>
6
+ <% end %>
3
7
  <% end %>
@@ -81,10 +81,6 @@ module Typus
81
81
  self.salt = generate_hash("--#{Time.zone.now.to_s(:number)}--#{email}--") if new_record?
82
82
  end
83
83
 
84
- def set_token
85
- self.token = "#{SecureRandom.hex(3)}-#{SecureRandom.hex(3)}"
86
- end
87
-
88
84
  def password_required?
89
85
  crypted_password.blank? || !password.blank?
90
86
  end
@@ -71,10 +71,6 @@ module Typus
71
71
  self.password_digest = BCrypt::Password.create(unencrypted_password)
72
72
  end
73
73
 
74
- def set_token
75
- self.token = "#{SecureRandom.hex(6)}-#{SecureRandom.hex(6)}"
76
- end
77
-
78
74
  def password_must_be_strong
79
75
  if password.present?
80
76
  errors.add(:password, :too_short, :count => 7) unless password.size > 6
@@ -64,6 +64,13 @@ module Typus
64
64
  id == resource.send(Typus.user_foreign_key)
65
65
  end
66
66
 
67
+ def set_token
68
+ token = "#{SecureRandom.hex(6)}-#{SecureRandom.hex(6)}"
69
+ token.encode!('UTF-8') if token.respond_to?(:encode)
70
+ self.token = token
71
+ end
72
+ protected :set_token
73
+
67
74
  end
68
75
  end
69
76
  end
@@ -1,3 +1,3 @@
1
1
  module Typus
2
- VERSION = "3.1.1"
2
+ VERSION = "3.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-08 00:00:00.000000000Z
12
+ date: 2011-09-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
16
- requirement: &70333450722940 !ruby/object:Gem::Requirement
16
+ requirement: &70188177679660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70333450722940
24
+ version_requirements: *70188177679660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: kaminari
27
- requirement: &70333450722120 !ruby/object:Gem::Requirement
27
+ requirement: &70188177679240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70333450722120
35
+ version_requirements: *70188177679240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
38
- requirement: &70333450720960 !ruby/object:Gem::Requirement
38
+ requirement: &70188177678740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 3.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70333450720960
46
+ version_requirements: *70188177678740
47
47
  description: Ruby on Rails Admin Panel (Engine) to allow trusted users edit structured
48
48
  content.
49
49
  email:
@@ -65,7 +65,7 @@ files:
65
65
  - app/assets/stylesheets/typus/content.css
66
66
  - app/assets/stylesheets/typus/custom.css
67
67
  - app/assets/stylesheets/typus/defaults.css
68
- - app/assets/stylesheets/typus/errors.css
68
+ - app/assets/stylesheets/typus/feedback.css
69
69
  - app/assets/stylesheets/typus/footer.css
70
70
  - app/assets/stylesheets/typus/forms.css
71
71
  - app/assets/stylesheets/typus/hacks.css
@@ -316,7 +316,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
316
316
  version: '0'
317
317
  segments:
318
318
  - 0
319
- hash: 431185922972537498
319
+ hash: -275893211556444060
320
320
  required_rubygems_version: !ruby/object:Gem::Requirement
321
321
  none: false
322
322
  requirements:
@@ -325,10 +325,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
325
  version: '0'
326
326
  segments:
327
327
  - 0
328
- hash: 431185922972537498
328
+ hash: -275893211556444060
329
329
  requirements: []
330
330
  rubyforge_project: typus
331
- rubygems_version: 1.8.7
331
+ rubygems_version: 1.8.10
332
332
  signing_key:
333
333
  specification_version: 3
334
334
  summary: Effortless backend interface for Ruby on Rails applications. (Admin scaffold