Class: Antenna::HTML

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/antenna/html.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info_plist, manifest_url, display_image_url) ⇒ HTML

Returns a new instance of HTML.



9
10
11
# File 'lib/antenna/html.rb', line 9

def initialize(info_plist, manifest_url, display_image_url)
    @info_plist, @manifest_url, @display_image_url = info_plist, manifest_url, display_image_url
end

Instance Attribute Details

#display_image_urlObject

Returns the value of attribute display_image_url.



7
8
9
# File 'lib/antenna/html.rb', line 7

def display_image_url
  @display_image_url
end

#info_plistObject

Returns the value of attribute info_plist.



7
8
9
# File 'lib/antenna/html.rb', line 7

def info_plist
  @info_plist
end

#manifest_urlObject

Returns the value of attribute manifest_url.



7
8
9
# File 'lib/antenna/html.rb', line 7

def manifest_url
  @manifest_url
end

#need_shineObject

Returns the value of attribute need_shine.



7
8
9
# File 'lib/antenna/html.rb', line 7

def need_shine
  @need_shine
end

Instance Method Details

#templateObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/antenna/html.rb', line 13

def template
  <<-EOF
<!doctype html>
<html>
<head>
<title><%= @info_plist.bundle_display_name %> v<%= @info_plist.bundle_short_version %> (<%= @info_plist.bundle_version %>)</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="-1" />
<style type="text/css">
    body { font-family: Helvetica, Arial, sans-serif; text-align: center; color: #444; font-size: 18px; }
    img { display: block; margin: 1em auto; border: none; width: 120px; height: 120px; border-radius: 20px; }
    .btn, a.btn, a.btn:visited, a.btn:hover, a.btn:link { 
        display: inline-block;
        border-radius: 3px;
        background-color: #0095c8;
        color: white;
        padding: .8em 1em;
        text-decoration: none;
    }
    a.btn:hover {
        background-color: #00bbfb;
        color: white;
    }
    .disabled {
        background-color: gray !important;
        cursor: default;
    }
    p {
        color: #999
    }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<h1><%= @info_plist.bundle_display_name %></h1>
<h2><%= @info_plist.bundle_short_version %> (<%= @info_plist.bundle_version %>)</h2>
<% if @display_image_url %>
<a href="itms-services://?action=download-manifest&amp;url=<%= u(@manifest_url) %>">
    <img src="<%= @display_image_url %>">
</a>
<% end %>
<div align="center">
    <table style="width: 95%">
    	<tr>
    		<td align="center" style="height: 50pt"><input id="checkTerm" type="checkbox" onchange="validateButton()"/>
            <label >&nbspCheck to be able to download</label></td>
    	</tr>
    	<tr>
            <td align="center">&nbsp</td>
        </tr>
        <tr>
            <td align="center"><a id="buttonDownload" onclick="" class="btn disabled">Tap to install</a></td>
        </tr>
        <tr>
            <td align="center">&nbsp</td>
        </tr>
        <tr >
            <td align="center" >
                <div >
                    <h2>Cheesecake Certificate</h2>
                </div>
            </td>
        </tr>
        <tr >
            <td align="center" >
                <div >
                    <label><font size="3">After install the app, follow the instructions below</font></label>
                </div>
            </td>
        </tr>
        <tr>
            <td align="center">&nbsp</td>
        </tr>
        <tr>
            <td align="center"><b>1 - Access Settings</b></td>
        </tr>
        <tr>
            <td align="center"><img src="Passo_1.jpeg" style="border-radius:0; width:250px; height:450px"></td>
        </tr>
        <tr>
            <td align="center">&nbsp</td>
        </tr>
        <tr>
            <td align="center"><b>2 - Click on menu General</b></td>
        </tr>
        <tr>
            <td align="center"><img src="Passo_2.jpeg" style="border-radius:0; width:250px; height:450px"></td>
        </tr>
        <tr>
            <td align="center">&nbsp</td>
        </tr>
        <tr>
            <td align="center"><b>3 - Click on Profiles & Device Management</b></td>
        </tr>
        <tr>
            <td align="center"><img src="Passo_3.jpeg" style="border-radius:0; width:250px; height:450px"></td>
        </tr>
        <tr>
            <td align="center">&nbsp</td>
        </tr>
        <tr>
            <td align="center"><b>4 - Click on Cheesecake Labs Software S A</b></td>
        </tr>
        <tr>
            <td align="center"><img src="Passo_4.jpeg" style="border-radius:0; width:250px; height:450px"></td>
        </tr>
        <tr>
            <td align="center">&nbsp</td>
        </tr>
        <tr>
            <td align="center"><b>5 - Click on: Trust "Cheesecake Labs Software S A"</b></td>
        </tr>
        <tr>
            <td align="center"><img src="Passo_5.jpeg" style="border-radius:0; width:250px; height:450px"></td>
        </tr>
        <tr>
            <td align="center">&nbsp</td>
        </tr>
        <tr>
            <td align="center"><b>6 - Click on: Trust<b/></td>
        </tr>
        <tr>
            <td align="center"><img src="Passo_6.jpeg" style="border-radius:0; width:250px; height:450px"></td>
        </tr>
        <tr>
            <td align="center"><b>Done, now you can use the app :) <b/></td>
        </tr>
        <tr>
            <td align="center">&nbsp</td>
        </tr>
    </table>
</div>
<% if @info_plist.bundle_minimum_os_version %>
<p class="comment">
    This app requires iOS <%= @info_plist.bundle_minimum_os_version %> or higher.
</p>
<% end %>
</body>
</html>
<script>
	function validateButton() {
		if(document.getElementById('checkTerm').checked == true){
   	$('#buttonDownload').removeClass('disabled');
    } else {
	    $('#buttonDownload').addClass('disabled');
    } 
	}
	
	$('#buttonDownload').click(function(e){
		window.location.href = 'itms-services://?action=download-manifest&amp;url=<%= u(@manifest_url) %>'
	})
	
	$('.disabled').click(function(e){
 	e.preventDefault();
  	})
  	
  	
</script>
EOF
end

#to_sObject



177
178
179
# File 'lib/antenna/html.rb', line 177

def to_s
  ERB.new(template).result(binding)
end