arturo 0.2.3.3 → 0.2.3.4

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.
@@ -83,7 +83,7 @@ module Arturo
83
83
  flash[:notice] = t('arturo.features.flash.updated', :name => @feature.to_s)
84
84
  redirect_to feature_path(@feature)
85
85
  else
86
- flash[:alert] = t('arturo.features.flash.error_updating', :name => @feature.to_s)
86
+ flash[:alert] = t('arturo.features.flash.error_updating', :name => @feature.to_s)
87
87
  render :action => 'edit'
88
88
  end
89
89
  end
@@ -23,16 +23,5 @@ module Arturo
23
23
  def deployment_percentage_output_tag(id, value)
24
24
  content_tag(:output, value, { 'for' => id, 'class' => 'deployment_percentage no_js' })
25
25
  end
26
-
27
- def error_messages_for(feature, attribute)
28
- errors = feature.errors.on(attribute)
29
- if errors && errors.any?
30
- content_tag(:ul, :class => 'errors') do
31
- errors.map { |msg| content_tag(:li, msg, :class => 'error') }.join(''.html_safe)
32
- end
33
- else
34
- ''
35
- end
36
- end
37
26
  end
38
27
  end
@@ -8,7 +8,7 @@ module Arturo
8
8
  include Arturo::SpecialHandling
9
9
 
10
10
  Arturo::Feature::SYMBOL_REGEX = /^[a-zA-z][a-zA-Z0-9_]*$/
11
- DEFAULT_ATTRIBUTES = { :deployment_percentage => 0 }
11
+ DEFAULT_ATTRIBUTES = { :deployment_percentage => 0 }.with_indifferent_access
12
12
 
13
13
  attr_readonly :symbol
14
14
 
@@ -78,8 +78,7 @@ module Arturo
78
78
  threshold = self.deployment_percentage || 0
79
79
  return false if threshold == 0
80
80
  return true if threshold == 100
81
- (((feature_recipient.id + 17) * 13) % 100) < threshold
82
-
81
+ (((feature_recipient.id + (self.id || 1) + 17) * 13) % 100) < threshold
83
82
  end
84
83
  end
85
84
  end
@@ -1,15 +1,19 @@
1
- <% form_for(feature, :as => 'feature', :url => (feature.new_record? ? features_path : feature_path(feature))) do |form| %>
1
+ <% form_for(:feature, feature,
2
+ :url => (feature.new_record? ? features_path : feature_path(feature)),
3
+ :html => {
4
+ :method => (feature.new_record? ? :post : :put)
5
+ }) do |form| %>
2
6
  <fieldset>
3
7
  <legend><%= legend %></legend>
4
8
 
9
+ <%= error_messages_for(:feature, :object => feature) %>
10
+
5
11
  <%= form.label(:symbol) %>
6
12
  <%= form.text_field(:symbol, :required => 'required', :pattern => Arturo::Feature::SYMBOL_REGEX.source, :class => 'symbol') %>
7
- <%= error_messages_for(feature, :symbol) %>
8
13
 
9
14
  <%= form.label(:deployment_percentage) %>
10
15
  <%= form.range_field(:deployment_percentage, :min => '0', :max => '100', :step => '1', :class => 'deployment_percentage') %>
11
16
  <%= deployment_percentage_output_tag 'feature_deployment_percentage', feature.deployment_percentage %>
12
- <%= error_messages_for(feature, :deployment_percentage) %>
13
17
 
14
18
  <footer><%= form.submit %></footer>
15
19
  </fieldset>
@@ -24,7 +24,7 @@ module Arturo
24
24
  end
25
25
 
26
26
  # By default, returns current_user.
27
- #
27
+ #
28
28
  # If you would like to change this implementation, it is recommended
29
29
  # you do so in config/initializers/arturo_initializer.rb
30
30
  # @return [Object] the recipient of features.
@@ -4,11 +4,11 @@ module Arturo
4
4
  # as a helper for all views. It provides a single method,
5
5
  # may_manage_features?, that returns whether or not the current user
6
6
  # may manage features. By default, it is implemented as follows:
7
- #
7
+ #
8
8
  # def may_manage_features?
9
9
  # current_user.present? && current_user.admin?
10
10
  # end
11
- #
11
+ #
12
12
  # If you would like to change this implementation, it is recommended
13
13
  # you do so in config/initializers/arturo_initializer.rb
14
14
  module FeatureManagement
@@ -43,12 +43,12 @@ output.deployment_percentage:after { content: "%"; }
43
43
  display: block;
44
44
  }
45
45
 
46
- .feature_new label + input, .feature_new label + textarea, .feature_new label + select,
46
+ .feature_new label + input, .feature_new label + textarea, .feature_new label + select,
47
47
  .feature_edit label + input, .feature_edit label + textarea, .feature_edit label + select {
48
48
  margin-top: 0.5em;
49
49
  }
50
50
 
51
- .feature_new input + label, .feature_new textarea + label, .feature_new select + label,
51
+ .feature_new input + label, .feature_new textarea + label, .feature_new select + label,
52
52
  .feature_edit input + label, .feature_edit textarea + label, .feature_edit select + label {
53
53
  margin-top: 1.5em;
54
54
  }
@@ -16,7 +16,7 @@ if (typeof(jQuery) === 'function') {
16
16
  }
17
17
  }
18
18
  };
19
-
19
+
20
20
  jQuery(function() {
21
21
  jQuery.arturo.linkAndShowOutputs();
22
22
  });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arturo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 85
4
+ hash: 91
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 3
10
- - 3
11
- version: 0.2.3.3
10
+ - 4
11
+ version: 0.2.3.4
12
12
  platform: ruby
13
13
  authors:
14
14
  - James A. Rosen
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-02 00:00:00 -07:00
19
+ date: 2010-11-04 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency