Module: Adminix::Setup::Views

Defined in:
lib/adminix/setup/views.rb

Class Method Summary collapse

Class Method Details

.complete_view(_assigns) ⇒ Object



99
100
101
102
103
104
105
106
107
# File 'lib/adminix/setup/views.rb', line 99

def self.complete_view(_assigns)
  layout do
    panel(title: 'Application setup process completed') do
      %{
        <p>Your application setup is completed.
      }
    end
  end
end

.connect_service_view(assigns) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/adminix/setup/views.rb', line 79

def self.connect_service_view(assigns)
  layout do
    panel(title: 'Connect existing service') do
      %{
        <form method="POST" action="/connect-service?t=#{assigns[:token]}">
          <div class="form-group">
            <label for="service_id">Please select service to connect</label>
            <select class="form-control" name="service[id]" id="service_id">
              #{(assigns[:services].map { |s| "<option value='#{s['id']}'>#{s['name']}</option>" }).join('')}
            </select>
          </div>
          <button type="submit" class="btn btn-primary">Launch your service</button>
          <br/><br/>
          <a href="/create-service?t=#{assigns[:token]}" title="Connect service">Want to create a new one? Create service</a>
        </form>
      }
    end
  end
end

.create_service_view(assigns) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/adminix/setup/views.rb', line 64

def self.create_service_view(assigns)
  layout do
    panel(title: 'Create service') do
      %{
        <form method="POST" action="/create-service?t=#{assigns[:token]}">
          #{form_group('name', type: 'text', name: 'service[name]', label: 'Service name', placeholder: 'Please enter your service name')}
          <button type="submit" class="btn btn-primary" onclick="location.href='/complete';">Launch your service</button>
          <br/><br/>
          #{assigns[:service_exists] ? "<a href=\"/connect-service?t=#{assigns[:token]}\" title=\"Connect service\">Already have an existing service? Choose it</a>" : ''} 
        </form>
      }
    end
  end
end

.error_view(_assigns) ⇒ Object



109
110
111
112
113
114
115
116
117
# File 'lib/adminix/setup/views.rb', line 109

def self.error_view(_assigns)
  layout do
    panel(title: 'Something went wrong') do
      %{
        <p>Something went wrong please retry a process.</p>
      }
    end
  end
end

.login_view(assigns) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/adminix/setup/views.rb', line 24

def self.(assigns)
  session = assigns[:session] || {}
  errors = assigns[:errors] || []
  layout do
    panel(title: 'Login') do
      %{
        <form method="POST" action="/login">
          #{form_group('email', type: 'email', name: 'session[email]', label: 'Email', placeholder: 'Please enter your email', value: session[:email])}
          #{form_group('password', type: 'password', name: 'session[password]', label: 'Password', placeholder: 'Please enter your password')}
          #{errors.count != 0 ? render_errors(errors) : ''}
          <button type="submit" class="btn btn-primary">Login</button>
          <br/><br/>
          <a href="/sign-up" title="Sign up">New to Adminix? Create a FREE account</a>
        </form>
      }
    end
  end
end

.root_view(_assigns) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/adminix/setup/views.rb', line 3

def self.root_view(_assigns)
  layout do
    %{
      <div class="row">
        <div class="col-md-6 col-md-offset-3">
          <br/>
          <a href="http://adminix.io" title="Adminix website" target="_blank">
            <img src="http://www.adminix.io/images/logo_square.jpg" alt="Adminix logo" class="img-responsive center-block" style="width: 130px" />
          </a>
          <br/>
          <p>Thank you for using Adminix image!</p>
          <p>Your application is almost deployed, please click on "Continue" button to finish setup process.</p>
          <button type="button" class="btn btn-primary" onclick="location.href='/sign-up';">Continue</button>
          <br/><br/>
          <a href="http://adminix.io" title="Adminix website" target="_blank">Click to visit our website</a>
        </div>
      </div>
    }
  end
end

.sign_up_view(assigns) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/adminix/setup/views.rb', line 43

def self.(assigns)
  user = assigns[:user] || {}
  errors = assigns[:errors] || []
  layout do
    panel(title: 'Create a FREE Adminix account') do
      %{
        <form method="POST" action="/sign-up">
          #{form_group('first_name', type: 'text', name: 'user[first_name]', label: 'First name', placeholder: 'Please enter your first name', value: user[:first_name])}
          #{form_group('last_name', type: 'text', name: 'user[last_name]', label: 'Last name', placeholder: 'Please enter your last name', value: user[:last_name])}
          #{form_group('email', type: 'email', name: 'user[email]', label: 'Email', placeholder: 'Please enter your email', value: user[:email])}
          #{form_group('password', type: 'password', name: 'user[password]', label: 'Password', placeholder: 'Please enter your password')}
          #{errors.count != 0 ? render_errors(errors) : ''}
          <button type="submit" class="btn btn-primary">Sign up</button>
          <br/><br/>
          <a href="/login" title="Login">Already have an account? Login</a>
        </form>
      }
    end
  end
end