ishapi 0.1.8.292 → 0.1.8.293

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0eccc109ec40b082e8f36531cda0b97d004b21dd4ecaa6e5631614fdc8d9051
4
- data.tar.gz: de11d35fa75d9752c32dc8d6e0ee83b31a3cbfc5df3d05e11305931bb34ca555
3
+ metadata.gz: 1d72a1d1df005b55a8b87d8cf9a0393e1672559758bfbc807812820ceddd08fb
4
+ data.tar.gz: 6aef010b6fa8cd4c32d163350f4252664d152f20ac3940cb88817ad59728fe9d
5
5
  SHA512:
6
- metadata.gz: c1b9e369a9dd15f3aa8dbba842bddf94ab5ea3c3d99df44f452b90da7b906a9f65e69475814aaf7cf04d78c79c7d1862047b3138e1b7d0d27b6ed411b8e952b0
7
- data.tar.gz: 8d461fc7c5ba44dc92c1e27bb1a5ede8188b9387578341a5848cd0d29155aa30b6e004b4cdac4cd580a756561c4b4c45d80a13562a3665dd8855975b244c600a
6
+ metadata.gz: 43271cdf8278e92cd4a821c1a1e18a828e59fb1bd8573e3142dd4dc096c71d9fd089d3379484323a710e44efbfc84d21fc6dffa160cb705f10da459ddf9d2f34
7
+ data.tar.gz: 8a8e0b3e38ba4d58140be181e83e302324a9fbe731d2dec9edc8edb21e5459949e0208b4b835e85b6a74e9b0477218e2be6914b2c8972bd6e7adbbed4d46d4bb
@@ -116,5 +116,26 @@ class ::Ishapi::ApplicationController < ActionController::Base
116
116
  @current_ability ||= Ishapi::Ability.new( @current_profile )
117
117
  end
118
118
 
119
+ def flash_alert what
120
+ flash[:alert] ||= []
121
+ if String == what.class
122
+ str = what
123
+ else
124
+ str = "Cannot create/update #{what.class.name}: #{what.errors.full_messages.join(', ')} ."
125
+ end
126
+ flash[:alert] << str
127
+ end
128
+
129
+ def flash_notice what
130
+ flash[:notice] ||= []
131
+ if String == what.class
132
+ str = what
133
+ else
134
+ str = "Created/updated #{what.class.name} ."
135
+ end
136
+ flash[:notice] << str
137
+ end
138
+
139
+
119
140
  end
120
141
 
@@ -20,9 +20,15 @@ module ::Ishapi
20
20
  template_id: params[:template_id],
21
21
  campaign_id: params[:campaign_id],
22
22
  })
23
- @unsubscribe.update_attributes({
23
+ flag = @unsubscribe.update_attributes({
24
24
  unsubscribed_at: Time.now,
25
25
  })
26
+ if flag
27
+ flash_notice "You have been unsubscribed."
28
+ else
29
+ flash_alert "We're sorry, but something went wrong. Please try again later."
30
+ end
31
+
26
32
  end
27
33
  end
28
34
 
@@ -1,2 +1,5 @@
1
1
 
2
- Thanks! You have been unsubscribed.
2
+ = flash[:notice]
3
+ = flash[:alert]
4
+
5
+ -# Thanks! You have been unsubscribed.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ishapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.292
4
+ version: 0.1.8.293
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox