Class: Decidim::Admin::ShareTokenForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Admin::ShareTokenForm
- Defined in:
- app/forms/decidim/admin/share_token_form.rb
Instance Method Summary collapse
- #expires_at ⇒ Object
- #map_model(model) ⇒ Object
- #organization ⇒ Object
- #token ⇒ Object
- #token_for ⇒ Object
- #user ⇒ Object
Instance Method Details
#expires_at ⇒ Object
28 29 30 31 32 |
# File 'app/forms/decidim/admin/share_token_form.rb', line 28 def expires_at return nil if no_expiration.present? super end |
#map_model(model) ⇒ Object
20 21 22 |
# File 'app/forms/decidim/admin/share_token_form.rb', line 20 def map_model(model) self.no_expiration = model.expires_at.blank? end |
#organization ⇒ Object
38 39 40 |
# File 'app/forms/decidim/admin/share_token_form.rb', line 38 def organization context[:current_organization] end |
#token ⇒ Object
24 25 26 |
# File 'app/forms/decidim/admin/share_token_form.rb', line 24 def token super.strip.upcase.gsub(/\s+/, "-") if super.present? end |
#token_for ⇒ Object
34 35 36 |
# File 'app/forms/decidim/admin/share_token_form.rb', line 34 def token_for context[:resource] end |
#user ⇒ Object
42 43 44 |
# File 'app/forms/decidim/admin/share_token_form.rb', line 42 def user context[:current_user] end |