Module: Card::Set::Type::Signup::Views::HtmlFormat

Extended by:
AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb

Instance Method Summary collapse

Instance Method Details

#account_linesObject



54
55
56
57
58
59
60
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 54

def 
  if card.account?
    verification_lines
  else
    [t(:account_missing_account)]
  end
end


93
94
95
96
97
98
99
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 93

def approval_link text, with_or_without
  return unless card.can_approve?

  link_to_card card, text,
               path: { action: :update,
                       card: { trigger: "approve_#{with_or_without}_verification" } }
end


84
85
86
87
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 84

def approve_with_token_link
  action = card..status == "unverified" ? "Resend" : "Send"
  approval_link "#{action} verification email", :with
end


89
90
91
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 89

def approve_without_token_link
  approval_link "Approve without verification", :without
end


101
102
103
104
105
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 101

def deny_link
  return unless card.ok? :delete

  link_to_card card, "Deny and delete", path: { action: :delete }
end

#invitation?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 9

def invitation?
  Auth.signed_in? && card.can_approve?
end

#invite_buttonObject



28
29
30
31
32
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 28

def invite_button
  return unless invitation?

  button_tag "Send Invitation", situation: "primary"
end

#invited?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 46

def invited?
  !self_signup?
end

#self_signup?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 50

def self_signup?
  card.creator_id == AnonymousID
end

#signup_lineObject

TODO: localize



40
41
42
43
44
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 40

def 
  ["<strong>#{safe_name}</strong>",
   ("was" if invited?),
   "signed up on #{format_date card.created_at}"].compact.join " "
end

#verification_linesObject



62
63
64
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 62

def verification_lines
  [verification_sent_line, verification_link_line].compact
end


73
74
75
76
77
78
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 73

def verification_link_line
  links = verification_links
  return if links.empty?

  links.join " "
end


80
81
82
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 80

def verification_links
  [approve_with_token_link, approve_without_token_link, deny_link].compact
end

#verification_sent_lineObject



66
67
68
69
70
71
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 66

def verification_sent_line
   = card.
  return unless .email_card.ok?(:read)

  "A verification email has been sent to #{.email}"
end

#view: content_formgroupsObject



18
19
20
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 18

view :content_formgroups do
  [, (multi_card_editor? ? multi_card_edit(true) : "")].join
end

#view: coreObject



34
35
36
37
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 34

view :core, template: :haml, cache: :never do
  @lines = [] + 
  @body = process_content _render_raw
end

#view: newObject



13
14
15
16
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 13

view :new, cache: :never do
  voo.title = invitation? ? t(:account_invite) : t(:account_sign_up)
  super()
end

#view: new_buttonsObject



22
23
24
25
26
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/signup/views.rb', line 22

view :new_buttons, cache: :never do
  button_formgroup do
    [standard_create_button, invite_button].compact
  end
end