cb2b11c1af729686fee7d62496b0ab0e05268d5b
[nit.git] / contrib / opportunity / src / templates / boilerplate.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License
14
15 # Contains the main components of a webpage for Opportunity
16 module boilerplate
17
18 import template
19
20 # Header for a Opportunity page
21 class OpportunityHeader
22 super Template
23
24 # Javascript code that is included in the `OpportunityPage`
25 var page_js = "" is writable
26
27 redef fun rendering do
28 add """
29 <!DOCTYPE html>
30 <html>
31 <head>
32 <title>Opportunity - The meetup planner</title>
33 <meta charset="utf-8">
34 <meta name="viewport" content="width=device-width, initial-scale=1">
35 <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
36 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
37 <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
38 <script>
39 {{{page_js}}}
40 </script>
41 <style>
42 .menu {
43 background-color: #0d8921;
44 background-repeat: repeat-x;
45 color: white;
46 }
47 .navbar-brand{
48 color: white;
49 }
50 .navbar-brand:hover{
51 color: #EEEEEE;
52 }
53 .navbar-nav{
54 color: white;
55 }
56 .navbar-nav: hover{
57 background-color: #0d8921;
58 color: white;
59 }
60 .answer:hover {
61 cursor:pointer;
62 background-color:#0d8921;
63 color:white;
64 }
65 .opportunity-action:hoverĀ {
66 cursor:pointer;
67 }
68 </style>
69 </head>
70 <body>
71 <nav class="menu" role="navigation">
72 <div class="container">
73 <div class="navbar-header">
74 <a class="navbar-brand" href="/" >Opportunity</a>
75 </div>
76 </div>
77 </nav>
78 <div class="container-fluid">
79 """
80 end
81
82 end
83
84 # Footer for a Opportunity page
85 class OpportunityFooter
86 super Template
87
88 redef fun rendering do
89 add """
90 </div>
91 </body>
92 <div class="footer">
93 <div class="well well-sm">
94 <p class="text-muted text-center">
95 Opportunity, the meetup planner.
96 </p>
97 <p class="text-muted text-center">
98 Proudly powered by <a href="http://nitlanguage.org/">Nit</a>!
99 </p>
100 </div>
101 </div>
102 </html>
103 """
104 end
105
106 end
107
108 # Any Opportunity page that contains the header, body and footer.
109 class OpportunityPage
110 super Template
111
112 var header = new OpportunityHeader
113
114 var body: Streamable = "" is writable
115
116 var footer = new OpportunityFooter
117
118 redef fun rendering do
119 add header
120 add body
121 add footer
122 end
123
124 end